Skip to content

Commit 3451aca

Browse files
authored
[WC-1769]: fix feedback (#456)
2 parents 17f8931 + 109955e commit 3451aca

File tree

11 files changed

+39
-70
lines changed

11 files changed

+39
-70
lines changed

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorConfig.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ export function getProperties(
7878
if (values.showEmptyPlaceholder === "none") {
7979
hidePropertyIn(defaultProperties, values, "emptyPlaceholder");
8080
}
81-
if (!values.showHeaderFilters) {
82-
hidePropertyIn(defaultProperties, values, "filterList");
83-
}
8481

8582
hideSelectionProperties(defaultProperties, values);
8683

@@ -127,7 +124,6 @@ export function getProperties(
127124
"columnsHidable",
128125
"configurationAttribute",
129126
"onConfigurationChange",
130-
"showHeaderFilters",
131127
"filterList",
132128
"filtersPlaceholder",
133129
"filterSectionTitle"
@@ -229,7 +225,7 @@ export const getPreview = (
229225
borders: true
230226
})(
231227
dropzone(
232-
dropzone.placeholder("Place filter widget(s) here"),
228+
dropzone.placeholder("Place widgets like filter widget(s) and action button(s) here"),
233229
dropzone.hideDataSourceHeaderIf(canHideDataSourceHeader)
234230
)(values.filtersPlaceholder)
235231
);
@@ -296,7 +292,7 @@ export const getPreview = (
296292
return container()(
297293
titleHeader,
298294
...(canHideDataSourceHeader ? [datasource(values.datasource)()] : []),
299-
...(values.showHeaderFilters && values.filterList.length > 0 ? [headerFilters] : []),
295+
headerFilters,
300296
headers,
301297
...Array.from({ length: 5 }).map(() => columns),
302298
...footer

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorPreview.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,9 @@ export function preview(props: DatagridPreviewProps): ReactElement {
122122
)}
123123
hasMoreItems={false}
124124
headerFilters={
125-
props.showHeaderFilters ? (
126-
<props.filtersPlaceholder.renderer caption="Place filter widget(s) here">
127-
<div />
128-
</props.filtersPlaceholder.renderer>
129-
) : null
125+
<props.filtersPlaceholder.renderer caption="Place widgets like filter widget(s) and action button(s) here">
126+
<div />
127+
</props.filtersPlaceholder.renderer>
130128
}
131129
headerWrapperRenderer={selectableWrapperRenderer}
132130
numberOfItems={5}

packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -173,33 +173,25 @@ export default function Datagrid(props: DatagridContainerProps): ReactElement {
173173
hasMoreItems={props.datasource.hasMoreItems ?? false}
174174
headerWrapperRenderer={useCallback((_columnIndex: number, header: ReactElement) => header, [])}
175175
headerFilters={useMemo(
176-
() =>
177-
props.showHeaderFilters ? (
178-
<FilterContext.Provider
179-
value={{
180-
filterDispatcher: prev => {
181-
if (prev.filterType) {
182-
const [, filterDispatcher] = multipleFilteringState[prev.filterType];
183-
filterDispatcher(prev);
184-
setFiltered(true);
185-
}
186-
return prev;
187-
},
188-
multipleAttributes: filterList,
189-
multipleInitialFilters
190-
}}
191-
>
192-
{props.filtersPlaceholder}
193-
</FilterContext.Provider>
194-
) : null,
195-
[
196-
FilterContext,
197-
filterList,
198-
multipleInitialFilters,
199-
props.filtersPlaceholder,
200-
multipleFilteringState,
201-
props.showHeaderFilters
202-
]
176+
() => (
177+
<FilterContext.Provider
178+
value={{
179+
filterDispatcher: prev => {
180+
if (prev.filterType) {
181+
const [, filterDispatcher] = multipleFilteringState[prev.filterType];
182+
filterDispatcher(prev);
183+
setFiltered(true);
184+
}
185+
return prev;
186+
},
187+
multipleAttributes: filterList,
188+
multipleInitialFilters
189+
}}
190+
>
191+
{props.filtersPlaceholder}
192+
</FilterContext.Provider>
193+
),
194+
[FilterContext, filterList, multipleInitialFilters, props.filtersPlaceholder, multipleFilteringState]
203195
)}
204196
id={id.current}
205197
numberOfItems={props.datasource.totalCount}

packages/pluggableWidgets/datagrid-web/src/Datagrid.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,9 @@
258258
</propertyGroup>
259259
<propertyGroup caption="Grid wide filtering">
260260
<propertyGroup caption="Grid wide filtering">
261-
<property key="showHeaderFilters" type="boolean" defaultValue="false">
262-
<caption>Grid wide filters</caption>
263-
<description>When enabled and at least one filter is configured below, there is a dropzone available above the grid. Filter widgets can be added here to filter over multiple attributes/columns instead of a single column. To filter per column, check the column configuration.</description>
264-
</property>
265261
<property key="filterList" type="object" isList="true" required="false">
266262
<caption>Filters</caption>
267-
<description>The list of attributes that are used by the filter widgets placed in the grid wide dropzone. Filtering over associations it not supported.</description>
263+
<description>The list of attributes is used by the filter widgets that are placed in the placeholder above the data grid. This enables filtering across multiple attributes or columns instead of limiting to a single column.</description>
268264
<properties>
269265
<propertyGroup caption="General">
270266
<property key="filter" type="attribute" dataSource="../datasource">

packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export interface DatagridContainerProps {
101101
columnsDraggable: boolean;
102102
columnsHidable: boolean;
103103
configurationAttribute?: EditableValue<string>;
104-
showHeaderFilters: boolean;
105104
filterList: FilterListType[];
106105
filtersPlaceholder?: ReactNode;
107106
filterSectionTitle?: DynamicValue<string>;
@@ -138,7 +137,6 @@ export interface DatagridPreviewProps {
138137
columnsHidable: boolean;
139138
configurationAttribute: string;
140139
onConfigurationChange: {} | null;
141-
showHeaderFilters: boolean;
142140
filterList: FilterListPreviewType[];
143141
filtersPlaceholder: { widgetCount: number; renderer: ComponentType<{ caption?: string }> };
144142
filterSectionTitle: string;

packages/pluggableWidgets/gallery-web/src/Gallery.editorConfig.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ export function getProperties(
2626
hidePropertyIn(defaultProperties, values, "emptyPlaceholder");
2727
}
2828

29-
if (!showHeader(values)) {
30-
hidePropertyIn(defaultProperties, values, "filtersPlaceholder");
31-
}
32-
3329
if (values.itemSelection === "None") {
3430
hidePropertyIn(defaultProperties, values, "onSelectionChange");
3531
}
@@ -116,7 +112,7 @@ export function getPreview(values: GalleryPreviewProps, isDarkMode: boolean): St
116112
{
117113
type: "DropZone",
118114
property: values.filtersPlaceholder,
119-
placeholder: "Gallery header: Place widgets here"
115+
placeholder: "Place widgets like filter widget(s) and action button(s) here"
120116
} as DropZoneProps
121117
]
122118
} as RowLayoutProps;
@@ -187,14 +183,10 @@ export function getPreview(values: GalleryPreviewProps, isDarkMode: boolean): St
187183

188184
return {
189185
type: "Container",
190-
children: [titleHeader, ...(showHeader(values) ? [filters] : []), content, ...footer]
186+
children: [titleHeader, filters, content, ...footer]
191187
};
192188
}
193189

194190
function getSingularPlural(word: string, elements: number): string {
195191
return elements > 1 ? word + "s" : word;
196192
}
197-
198-
function showHeader(values: GalleryPreviewProps): boolean {
199-
return values.filterList?.length > 0 || values.sortList?.length > 0 || values.itemSelection === "Multi";
200-
}

packages/pluggableWidgets/gallery-web/src/Gallery.editorPreview.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function Preview(props: GalleryPreviewProps): ReactElement {
88
id: String(index) as GUID
99
}));
1010

11-
const showHeader = props.filterList.length > 0 || props.sortList.length > 0 || props.itemSelection === "Multi";
1211
return (
1312
<GalleryComponent
1413
className={props.class}
@@ -22,13 +21,11 @@ function Preview(props: GalleryPreviewProps): ReactElement {
2221
[props.emptyPlaceholder]
2322
)}
2423
header={
25-
showHeader ? (
26-
<props.filtersPlaceholder.renderer caption="Gallery header: Place widgets here">
27-
<div />
28-
</props.filtersPlaceholder.renderer>
29-
) : null
24+
<props.filtersPlaceholder.renderer caption="Place widgets like filter widget(s) and action button(s) here">
25+
<div />
26+
</props.filtersPlaceholder.renderer>
3027
}
31-
showHeader={!!props.filterList.length}
28+
showHeader
3229
hasMoreItems={false}
3330
items={items}
3431
itemRenderer={useCallback(

packages/pluggableWidgets/selection-helper-web/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
### Added
1010

11-
- We added Selection Helper widget.
11+
- We added Selection helper widget.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Selection Helper
1+
# Selection helper
22

3-
Please see [Selection Helper](https://docs.mendix.com/appstore/modules/gallery#selection-helper-widget) in the Mendix documentation for details.
3+
Please see [Selection helper](https://docs.mendix.com/appstore/modules/gallery#selection-helper-widget) in the Mendix documentation for details.

packages/pluggableWidgets/selection-helper-web/src/SelectionHelper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function SelectionHelper(props: SelectionHelperContainerProps): ReactElem
1010
if (contextValue.hasError) {
1111
return (
1212
<Alert bootstrapStyle="danger">
13-
The Selection Helper widget must be placed inside the header of the Gallery widget with multi-selection.
13+
The Selection helper widget must be placed inside the header of the Gallery widget with multi-selection.
1414
</Alert>
1515
);
1616
}

0 commit comments

Comments
 (0)