@geotab/zenith 3.10.0-beta.4 → 3.10.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -2
- package/dist/commonStyles/pillStyles/pillContent.less +9 -9
- package/dist/commonStyles/pillStyles/pillStyles.less +2 -2
- package/dist/dataGrid/cell/cell.d.ts +1 -2
- package/dist/dataGrid/cell/cell.js +2 -2
- package/dist/dataGrid/dataGrid.js +4 -6
- package/dist/dataGrid/listColumn.d.ts +0 -2
- package/dist/dataGrid/row/row.js +7 -11
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsList.js +1 -2
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +0 -4
- package/dist/dateRangeRaw/utils/parseLabel.js +1 -1
- package/dist/dropdown/dropdown.js +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +2 -3
- package/dist/dropdownRaw/dropdownList.js +34 -8
- package/dist/dropdownRaw/dropdownRaw.js +28 -19
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +0 -1
- package/dist/dropdownRaw/stateReducer/stateReducer.js +14 -13
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -1
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +12 -5
- package/dist/filtersBar/filtersContainer/filtersContainer.js +4 -14
- package/dist/index.css +655 -720
- package/dist/radioGroupRaw/radioGroupRaw.js +1 -2
- package/dist/selectList/selectList.helpers.d.ts +1 -1
- package/dist/selectList/selectList.helpers.js +9 -30
- package/dist/selectList/selectList.js +1 -3
- package/dist/selectList/selectList.reducer.js +2 -1
- package/dist/sortControl/sortControl.js +2 -58
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/flexible/columnsList.js +2 -4
- package/dist/table/selectable/useSelectableRows.d.ts +0 -8
- package/dist/table/selectable/useSelectableRows.js +6 -14
- package/dist/table/table.js +7 -1
- package/dist/utils/localization/translations/ar.json +1 -3
- package/dist/utils/localization/translations/cs.json +1 -3
- package/dist/utils/localization/translations/da-DK.json +1 -3
- package/dist/utils/localization/translations/de.json +1 -3
- package/dist/utils/localization/translations/en.json +1 -3
- package/dist/utils/localization/translations/es.json +1 -3
- package/dist/utils/localization/translations/fi-FI.json +1 -3
- package/dist/utils/localization/translations/fr-FR.json +1 -3
- package/dist/utils/localization/translations/fr.json +1 -3
- package/dist/utils/localization/translations/hu-HU.json +1 -3
- package/dist/utils/localization/translations/id.json +1 -3
- package/dist/utils/localization/translations/it.json +1 -3
- package/dist/utils/localization/translations/ja.json +1 -3
- package/dist/utils/localization/translations/ko-KR.json +1 -3
- package/dist/utils/localization/translations/ms.json +1 -3
- package/dist/utils/localization/translations/nb-NO.json +1 -3
- package/dist/utils/localization/translations/nl.json +1 -3
- package/dist/utils/localization/translations/pl.json +1 -3
- package/dist/utils/localization/translations/pt-BR.json +1 -3
- package/dist/utils/localization/translations/pt-PT.json +1 -3
- package/dist/utils/localization/translations/ro-RO.json +1 -3
- package/dist/utils/localization/translations/sk-SK.json +1 -3
- package/dist/utils/localization/translations/sv.json +1 -3
- package/dist/utils/localization/translations/th.json +1 -3
- package/dist/utils/localization/translations/tr.json +1 -3
- package/dist/utils/localization/translations/zh-Hans.json +1 -3
- package/dist/utils/localization/translations/zh-TW.json +1 -3
- package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -2
- package/esm/dataGrid/cell/cell.d.ts +1 -2
- package/esm/dataGrid/cell/cell.js +2 -2
- package/esm/dataGrid/dataGrid.js +4 -6
- package/esm/dataGrid/listColumn.d.ts +0 -2
- package/esm/dataGrid/row/row.js +7 -11
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +1 -2
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +0 -4
- package/esm/dateRangeRaw/utils/parseLabel.js +1 -1
- package/esm/dropdown/dropdown.js +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +2 -3
- package/esm/dropdownRaw/dropdownList.js +34 -8
- package/esm/dropdownRaw/dropdownRaw.js +29 -20
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +0 -1
- package/esm/dropdownRaw/stateReducer/stateReducer.js +15 -14
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -1
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +10 -3
- package/esm/filtersBar/filtersContainer/filtersContainer.js +4 -14
- package/esm/radioGroupRaw/radioGroupRaw.js +1 -2
- package/esm/selectList/selectList.helpers.d.ts +1 -1
- package/esm/selectList/selectList.helpers.js +9 -30
- package/esm/selectList/selectList.js +1 -3
- package/esm/selectList/selectList.reducer.js +2 -1
- package/esm/sortControl/sortControl.js +2 -58
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/flexible/columnsList.js +2 -4
- package/esm/table/selectable/useSelectableRows.d.ts +0 -8
- package/esm/table/selectable/useSelectableRows.js +6 -14
- package/esm/table/table.js +7 -1
- package/esm/utils/localization/translations/ar.json +1 -3
- package/esm/utils/localization/translations/cs.json +1 -3
- package/esm/utils/localization/translations/da-DK.json +1 -3
- package/esm/utils/localization/translations/de.json +1 -3
- package/esm/utils/localization/translations/en.json +1 -3
- package/esm/utils/localization/translations/es.json +1 -3
- package/esm/utils/localization/translations/fi-FI.json +1 -3
- package/esm/utils/localization/translations/fr-FR.json +1 -3
- package/esm/utils/localization/translations/fr.json +1 -3
- package/esm/utils/localization/translations/hu-HU.json +1 -3
- package/esm/utils/localization/translations/id.json +1 -3
- package/esm/utils/localization/translations/it.json +1 -3
- package/esm/utils/localization/translations/ja.json +1 -3
- package/esm/utils/localization/translations/ko-KR.json +1 -3
- package/esm/utils/localization/translations/ms.json +1 -3
- package/esm/utils/localization/translations/nb-NO.json +1 -3
- package/esm/utils/localization/translations/nl.json +1 -3
- package/esm/utils/localization/translations/pl.json +1 -3
- package/esm/utils/localization/translations/pt-BR.json +1 -3
- package/esm/utils/localization/translations/pt-PT.json +1 -3
- package/esm/utils/localization/translations/ro-RO.json +1 -3
- package/esm/utils/localization/translations/sk-SK.json +1 -3
- package/esm/utils/localization/translations/sv.json +1 -3
- package/esm/utils/localization/translations/th.json +1 -3
- package/esm/utils/localization/translations/tr.json +1 -3
- package/esm/utils/localization/translations/zh-Hans.json +1 -3
- package/esm/utils/localization/translations/zh-TW.json +1 -3
- package/package.json +1 -5
package/README.md
CHANGED
|
@@ -54,7 +54,6 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
54
54
|
- `Nav` component: support show/hide separator between Core and Apps sections
|
|
55
55
|
- `Nav` empty state support
|
|
56
56
|
- Allow multiple columns to be disabled in `ColumnsList`
|
|
57
|
-
- Fix `SelectList` keyboard focus skipping disabled items
|
|
58
57
|
- Flip icons for Arabic (RTL) language
|
|
59
58
|
- `Dropdown` select-all button shows active state when all items are selected
|
|
60
59
|
- Add `ariaLabel` prop to `CardButton` for accessible name override
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import "../common.less";
|
|
2
2
|
@import "../typography/typography.less";
|
|
3
3
|
|
|
4
|
-
@pill-min-width-default:
|
|
4
|
+
@pill-min-width-default: 30px;
|
|
5
5
|
@pill-max-width-default: 200px;
|
|
6
6
|
|
|
7
7
|
// TODO: update to .zen-pill-content after old pill component removed remove
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
16
16
|
justify-content: space-between;
|
|
17
|
-
border-radius:
|
|
17
|
+
border-radius: 30px;
|
|
18
18
|
height: @pill-height;
|
|
19
19
|
display: grid;
|
|
20
20
|
grid-auto-flow: column;
|
|
21
21
|
|
|
22
|
-
gap:
|
|
22
|
+
gap: 8px;
|
|
23
23
|
|
|
24
24
|
&--icon-left {
|
|
25
25
|
grid-template-columns: 12px 1fr;
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
|
|
39
39
|
&.zen-pill-new-content--empty {
|
|
40
40
|
grid-template-columns: 12px 18px;
|
|
41
|
-
gap:
|
|
41
|
+
gap: 8px;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&--hidden {
|
|
46
|
-
gap:
|
|
46
|
+
gap: 4px;
|
|
47
47
|
}
|
|
48
48
|
&.zen-pill-new-content--drive,
|
|
49
49
|
&.zen-pill-new-content--drive-tablet {
|
|
50
50
|
height: @pill-height--drive;
|
|
51
51
|
.zen-pill-non-actionable__icon {
|
|
52
|
-
min-width:
|
|
52
|
+
min-width: 16px;
|
|
53
53
|
max-width: 16px;
|
|
54
54
|
height: 16px;
|
|
55
55
|
}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
&.zen-pill-new-content--empty {
|
|
69
69
|
grid-template-columns: 16px 22px;
|
|
70
|
-
gap:
|
|
70
|
+
gap: 8px;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
height: @pill-height--mobile;
|
|
76
76
|
.body-m-400-short();
|
|
77
77
|
.zen-pill-non-actionable__icon {
|
|
78
|
-
min-width:
|
|
78
|
+
min-width: 16px;
|
|
79
79
|
max-width: 16px;
|
|
80
80
|
height: 16px;
|
|
81
81
|
}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
|
|
94
94
|
&.zen-pill-new-content--empty {
|
|
95
95
|
grid-template-columns: 16px 22px;
|
|
96
|
-
gap:
|
|
96
|
+
gap: 8px;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
color: var(--text-primary);
|
|
8
8
|
align-items: center;
|
|
9
9
|
justify-content: space-between;
|
|
10
|
-
padding:
|
|
11
|
-
border-radius:
|
|
10
|
+
padding: 4px 12px 4px 12px;
|
|
11
|
+
border-radius: 30px;
|
|
12
12
|
background: var(--backgrounds-content-1);
|
|
13
13
|
}
|
|
@@ -13,9 +13,8 @@ export interface IDataGridCell<T extends IEntityWithId> extends IZenComponentPro
|
|
|
13
13
|
defaultValue: string | undefined;
|
|
14
14
|
entity: T;
|
|
15
15
|
width?: number;
|
|
16
|
-
maxWidth?: number;
|
|
17
16
|
colspan?: number;
|
|
18
17
|
onClick?: () => void;
|
|
19
18
|
isActive?: boolean;
|
|
20
19
|
}
|
|
21
|
-
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width,
|
|
20
|
+
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
|
7
7
|
const basicColumn_1 = require("../columns/basicColumn");
|
|
8
8
|
const isActiveElement_1 = require("../../list/utils/isActiveElement");
|
|
9
9
|
const zen_1 = require("../../utils/zen");
|
|
10
|
-
const Cell = ({ index, limited, visibleOnHover, isVisible, width,
|
|
10
|
+
const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }) => {
|
|
11
11
|
const [content, setContent] = (0, react_1.useState)("");
|
|
12
12
|
const placeholderRenderer = (0, react_1.useCallback)(() => {
|
|
13
13
|
const renderFn = renderPlaceholder || (() => "...");
|
|
@@ -72,6 +72,6 @@ const Cell = ({ index, limited, visibleOnHover, isVisible, width, maxWidth, rend
|
|
|
72
72
|
visibleOnHover ? "zen-data-grid__row-cell--visible-on-hover" : "",
|
|
73
73
|
onClick ? "zen-data-grid__row-cell--clickable" : "",
|
|
74
74
|
limited ? "zen-ellipsis" : ""
|
|
75
|
-
]), style: { minWidth: width || "auto", maxWidth:
|
|
75
|
+
]), style: { minWidth: width || "auto", maxWidth: width || "auto" }, role: "gridcell", children: content }));
|
|
76
76
|
};
|
|
77
77
|
exports.DataGridCell = (0, react_1.memo)(Cell);
|
|
@@ -57,7 +57,7 @@ const getHeaderPropsFromWrappers = wrappers => wrappers.reduce((result, wrapper)
|
|
|
57
57
|
const props = (_a = wrapper.getHeaderProps) === null || _a === void 0 ? void 0 : _a.call(wrapper);
|
|
58
58
|
return props ? Object.assign(Object.assign({}, result), props) : result;
|
|
59
59
|
}, {});
|
|
60
|
-
const getColumnWidth =
|
|
60
|
+
const getColumnWidth = defaultWidth => Math.floor(Math.max(defaultWidth, exports.MIN_CELL_WIDTH));
|
|
61
61
|
const EmptyList = ({
|
|
62
62
|
children
|
|
63
63
|
}) => (0, jsx_runtime_1.jsx)("div", {
|
|
@@ -154,13 +154,12 @@ const DataGridInner = ({
|
|
|
154
154
|
setVisibleRows(visible);
|
|
155
155
|
}, [entities]);
|
|
156
156
|
const listOfDefaultWidthColumns = (0, react_1.useMemo)(() => columnsList.map(column => column.meta.defaultWidth), [columnsList]);
|
|
157
|
-
const listOfMinWidthColumns = (0, react_1.useMemo)(() => columnsList.map(column => column.meta.minWidth), [columnsList]);
|
|
158
157
|
const {
|
|
159
158
|
result: observerResult
|
|
160
159
|
} = (0, useResizeObserver_1.useResizeObserver)({
|
|
161
160
|
target: gridRef.current
|
|
162
161
|
});
|
|
163
|
-
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width
|
|
162
|
+
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width) => acc + (width === undefined ? 0 : getColumnWidth(width)), 0);
|
|
164
163
|
const unallocatedSpace = observerResult && observerResult.contentRect.width - allocatedSpace || 0;
|
|
165
164
|
const flexibleColumnsQty = listOfDefaultWidthColumns.filter(width => width === undefined).length;
|
|
166
165
|
const flexibleColumnWidth = getColumnWidth(unallocatedSpace / flexibleColumnsQty);
|
|
@@ -183,19 +182,18 @@ const DataGridInner = ({
|
|
|
183
182
|
}, [updateScroll, scheduleLazyRender]);
|
|
184
183
|
const getCellParams = (0, react_1.useCallback)(columnIndex => {
|
|
185
184
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex];
|
|
186
|
-
const minWidth = listOfMinWidthColumns[columnIndex];
|
|
187
185
|
const limited = !!defaultWidth && defaultWidth > 0;
|
|
188
186
|
const isFirst = columnIndex === 0;
|
|
189
187
|
const isLast = columnIndex === listOfDefaultWidthColumns.length - 1;
|
|
190
188
|
// If the column is the last one or doesn't have a default width, it should be limited to the remaining space
|
|
191
|
-
const width = getColumnWidth(defaultWidth || flexibleColumnWidth
|
|
189
|
+
const width = getColumnWidth(defaultWidth || flexibleColumnWidth);
|
|
192
190
|
return {
|
|
193
191
|
limited,
|
|
194
192
|
isFirst,
|
|
195
193
|
isLast,
|
|
196
194
|
width
|
|
197
195
|
};
|
|
198
|
-
}, [listOfDefaultWidthColumns,
|
|
196
|
+
}, [listOfDefaultWidthColumns, flexibleColumnWidth]);
|
|
199
197
|
const renderHeaderCell = (0, react_1.useCallback)((column, columnIndex) => {
|
|
200
198
|
var _a;
|
|
201
199
|
const {
|
|
@@ -2,8 +2,6 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import { ColumnSortDirection } from "../table/table";
|
|
3
3
|
export interface IListColumnMeta<T, N = T> {
|
|
4
4
|
readonly defaultWidth?: number;
|
|
5
|
-
readonly minWidth?: number;
|
|
6
|
-
readonly maxWidth?: number;
|
|
7
5
|
readonly defaultValue?: string;
|
|
8
6
|
readonly lazyLoad?: boolean;
|
|
9
7
|
readonly visibleOnHover?: boolean;
|
package/dist/dataGrid/row/row.js
CHANGED
|
@@ -6,12 +6,10 @@ const react_1 = require("react");
|
|
|
6
6
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
7
7
|
const cell_1 = require("../cell/cell");
|
|
8
8
|
exports.MIN_CELL_WIDTH = 100;
|
|
9
|
-
const getColumnWidth = (defaultWidth
|
|
9
|
+
const getColumnWidth = (defaultWidth) => Math.floor(Math.max(defaultWidth, exports.MIN_CELL_WIDTH));
|
|
10
10
|
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }) => {
|
|
11
11
|
const isVisible = visibleRows.has(entity.id);
|
|
12
12
|
const listOfDefaultWidthColumns = (0, react_1.useMemo)(() => columns.map(column => column.meta.defaultWidth), [columns]);
|
|
13
|
-
const listOfMinWidthColumns = (0, react_1.useMemo)(() => columns.map(column => column.meta.minWidth), [columns]);
|
|
14
|
-
const listOfMaxWidthColumns = (0, react_1.useMemo)(() => columns.map(column => column.meta.maxWidth), [columns]);
|
|
15
13
|
const getColWidth = (0, react_1.useCallback)((columnIndex, colspan) => {
|
|
16
14
|
const colsp = colspan || 1;
|
|
17
15
|
let columnWidth = 0;
|
|
@@ -20,28 +18,26 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
20
18
|
continue;
|
|
21
19
|
}
|
|
22
20
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex + i];
|
|
23
|
-
const minWidth = listOfMinWidthColumns[columnIndex + i];
|
|
24
21
|
// If the column is the last one or doesn't have a default width, it should be limited to the remaining space
|
|
25
|
-
const width = getColumnWidth(defaultWidth || flexibleColumnWidth
|
|
22
|
+
const width = getColumnWidth(defaultWidth || flexibleColumnWidth);
|
|
26
23
|
columnWidth += width;
|
|
27
24
|
}
|
|
28
25
|
return columnWidth;
|
|
29
|
-
}, [flexibleColumnWidth, listOfDefaultWidthColumns
|
|
26
|
+
}, [flexibleColumnWidth, listOfDefaultWidthColumns]);
|
|
30
27
|
const getCellParams = (0, react_1.useCallback)((columnIndex, colspan) => {
|
|
31
28
|
const width = getColWidth(columnIndex, colspan);
|
|
32
29
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex];
|
|
33
|
-
const maxWidth = listOfMaxWidthColumns[columnIndex];
|
|
34
30
|
const limited = !!defaultWidth && defaultWidth > 0;
|
|
35
31
|
const isFirst = columnIndex === 0;
|
|
36
32
|
const isLast = columnIndex === listOfDefaultWidthColumns.length - 1;
|
|
37
|
-
return { limited, isFirst, isLast, width
|
|
38
|
-
}, [getColWidth, listOfDefaultWidthColumns
|
|
33
|
+
return { limited, isFirst, isLast, width };
|
|
34
|
+
}, [getColWidth, listOfDefaultWidthColumns]);
|
|
39
35
|
const mainRowId = (0, react_1.useId)();
|
|
40
36
|
const renderCells = (0, react_1.useCallback)((rowEntity, isNested) => columns.reduce((acc, column, index) => {
|
|
41
37
|
const colspanFn = column.colspan;
|
|
42
38
|
let colspan = colspanFn ? (typeof colspanFn === "function" ? colspanFn(rowEntity) : colspanFn) : undefined;
|
|
43
39
|
colspan = colspan && colspan > 1 ? colspan : undefined;
|
|
44
|
-
const { limited, width
|
|
40
|
+
const { limited, width } = getCellParams(index, colspan);
|
|
45
41
|
if (acc.colspan > 0) {
|
|
46
42
|
acc.colspan--;
|
|
47
43
|
return acc;
|
|
@@ -56,7 +52,7 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
56
52
|
? column.columnComponent.renderNested.bind(column.columnComponent)
|
|
57
53
|
: column.columnComponent.render.bind(column.columnComponent))
|
|
58
54
|
: column.columnComponent.render.bind(column.columnComponent);
|
|
59
|
-
acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { render: e => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width,
|
|
55
|
+
acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { render: e => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : onClick ? () => onClick(rowEntity.id) : undefined, isActive: isActive, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
|
|
60
56
|
return acc;
|
|
61
57
|
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, onClick]);
|
|
62
58
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, false), [entity, renderCells]);
|
|
@@ -21,7 +21,6 @@ const SubColumnsList = ({ title, columns, settings, disabledColumns, onChange, s
|
|
|
21
21
|
showCheckbox: true,
|
|
22
22
|
children: c.title
|
|
23
23
|
})), [columns, disabledColumns, sortColumnsInt]);
|
|
24
|
-
const allDisabled = (0, react_1.useMemo)(() => items.every(item => item.disabled), [items]);
|
|
25
24
|
const state = columns.reduce((res, c) => {
|
|
26
25
|
res.set(c.id, settings.get(c.name) !== false ? checkboxState_1.CheckboxState.On : checkboxState_1.CheckboxState.Off);
|
|
27
26
|
return res;
|
|
@@ -34,7 +33,7 @@ const SubColumnsList = ({ title, columns, settings, disabledColumns, onChange, s
|
|
|
34
33
|
});
|
|
35
34
|
onChange && onChange(newSettings);
|
|
36
35
|
}, [columns, settings, onChange]);
|
|
37
|
-
const list = (0, react_1.useMemo)(() => (
|
|
36
|
+
const list = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(selectList_1.SelectList, { id: id, items: items, value: state, title: title || "", multiselect: true, showCheckbox: true, onChange: onChangeItem }), [id, items, state, title, onChangeItem]);
|
|
38
37
|
if (!title) {
|
|
39
38
|
return list;
|
|
40
39
|
}
|
|
@@ -7,10 +7,6 @@ import { DeviceType } from "../../../../commonHelpers/hooks/deviceType";
|
|
|
7
7
|
type TBulkAction = IBulkActionLink | IBulkActionButton;
|
|
8
8
|
export interface IBulkActionsProps extends IZenComponentProps {
|
|
9
9
|
selected: number;
|
|
10
|
-
/**
|
|
11
|
-
* When `true`, displays "All selected" instead of a count, and enables action buttons
|
|
12
|
-
* even when `selected` is 0 (i.e., cross-page "select all" is active).
|
|
13
|
-
*/
|
|
14
10
|
allSelected?: boolean;
|
|
15
11
|
onClearSelection: () => void;
|
|
16
12
|
onSelectAll?: () => void;
|
|
@@ -10,6 +10,6 @@ const parseLabel = (option, dateFormat, translate, toLocalFn) => {
|
|
|
10
10
|
localeFrom.getFullYear() === localeTo.getFullYear()) {
|
|
11
11
|
return (0, formatDate_1.formatDate)(localeFrom, dateFormat, translate);
|
|
12
12
|
}
|
|
13
|
-
return `${(0, formatDate_1.formatDate)(localeFrom, dateFormat, translate)}
|
|
13
|
+
return `${(0, formatDate_1.formatDate)(localeFrom, dateFormat, translate)} - ${(0, formatDate_1.formatDate)(localeTo, dateFormat, translate)}`;
|
|
14
14
|
};
|
|
15
15
|
exports.parseLabel = parseLabel;
|
|
@@ -24,4 +24,4 @@ const Dropdown = (_a) => {
|
|
|
24
24
|
return (0, jsx_runtime_1.jsx)(DropDownFormField, Object.assign({}, props));
|
|
25
25
|
};
|
|
26
26
|
exports.Dropdown = Dropdown;
|
|
27
|
-
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
|
|
27
|
+
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
|
|
@@ -13,8 +13,7 @@ export interface IDropdownList extends IZenComponentProps {
|
|
|
13
13
|
onSelect: (id: string) => void;
|
|
14
14
|
onSingleSelect: (reset: boolean, selected?: string) => void;
|
|
15
15
|
backButtonName?: string;
|
|
16
|
-
isAllSelected
|
|
17
|
-
isSelectAllActive?: boolean;
|
|
16
|
+
isAllSelected: boolean;
|
|
18
17
|
listData: ICheckboxListWithActionOption[] | ISelectListItem[];
|
|
19
18
|
isWithFooter: boolean;
|
|
20
19
|
width?: number;
|
|
@@ -40,6 +39,6 @@ interface IDropdownEmptyList extends Pick<IDropdownList, "className" | "width" |
|
|
|
40
39
|
hasError: boolean;
|
|
41
40
|
}
|
|
42
41
|
export declare const EmptyList: ({ className, width, onClearClick, onApplyClick, onCancelClick, hasApplyButton, isApplyDisabled, isClearButtonDisabled, isWithFooter, hasError }: IDropdownEmptyList) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData,
|
|
42
|
+
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isAllSelected, backButtonName, width, minWidth, isSelectAllButtonDisable, hasSelectAllButton, filterName, isMultiselect, hasApplyButton, isApplyDisabled, isClearButtonDisabled, activeValue, forceSelection, isWithFooter, isMobile, handleCheckboxChange, checkboxLabel, isChecked, listElementRef, listId }: IDropdownList) => import("react/jsx-runtime").JSX.Element;
|
|
44
43
|
export declare const TRANSLATIONS: string[];
|
|
45
44
|
export {};
|
|
@@ -174,6 +174,33 @@ injectString("zh-Hans", "Apply", "\u5E94\u7528");
|
|
|
174
174
|
injectString("zh-TW", "Apply", "\u5957\u7528");
|
|
175
175
|
injectString("ro-RO", "Apply", "Aplica\u021Bi");
|
|
176
176
|
injectString("ar-SA", "Apply", "\u062A\u0637\u0628\u064A\u0642");
|
|
177
|
+
injectString("cs", "Deselect all", "Zru\u0161it v\xFDb\u011Br v\u0161ech");
|
|
178
|
+
injectString("da-DK", "Deselect all", "Frav\xE6lg alle");
|
|
179
|
+
injectString("de", "Deselect all", "Auswahl f\xFCr alle aufheben");
|
|
180
|
+
injectString("en", "Deselect all", "Deselect all");
|
|
181
|
+
injectString("es", "Deselect all", "Deseleccionar todo");
|
|
182
|
+
injectString("fi-FI", "Deselect all", "Poista kaikki valinnat");
|
|
183
|
+
injectString("fr", "Deselect all", "D\xE9s\xE9lectionner tout");
|
|
184
|
+
injectString("fr-FR", "Deselect all", "D\xE9s\xE9lectionner tout");
|
|
185
|
+
injectString("hu-HU", "Deselect all", "Ne v\xE1lassz ki semmit.");
|
|
186
|
+
injectString("id", "Deselect all", "Batalkan pilih semua");
|
|
187
|
+
injectString("it", "Deselect all", "Deselezionare tutto");
|
|
188
|
+
injectString("ja", "Deselect all", "\u3059\u3079\u3066\u3092\u9078\u629E\u89E3\u9664");
|
|
189
|
+
injectString("ko-KR", "Deselect all", "\uBAA8\uB450 \uC120\uD0DD \uCDE8\uC18C");
|
|
190
|
+
injectString("ms", "Deselect all", "Nyahpilih semua");
|
|
191
|
+
injectString("nb-NO", "Deselect all", "Fjern alle valg");
|
|
192
|
+
injectString("nl", "Deselect all", "Alles deselecteren");
|
|
193
|
+
injectString("pl", "Deselect all", "Usu\u0144 wyb\xF3r wszystkich");
|
|
194
|
+
injectString("pt-BR", "Deselect all", "Desmarcar tudo");
|
|
195
|
+
injectString("pt-PT", "Deselect all", "Desmarcar tudo");
|
|
196
|
+
injectString("sk-SK", "Deselect all", "Zru\u0161 v\xFDber v\u0161etk\xFDch.");
|
|
197
|
+
injectString("sv", "Deselect all", "Avmarkera alla");
|
|
198
|
+
injectString("th", "Deselect all", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14");
|
|
199
|
+
injectString("tr", "Deselect all", "T\xFCm\xFCn\xFCn se\xE7imini iptal et");
|
|
200
|
+
injectString("zh-Hans", "Deselect all", "\u53D6\u6D88\u5168\u9009");
|
|
201
|
+
injectString("zh-TW", "Deselect all", "\u53D6\u6D88\u5168\u9078");
|
|
202
|
+
injectString("ro-RO", "Deselect all", "Deselecta\u021Bi tot");
|
|
203
|
+
injectString("ar-SA", "Deselect all", "\u0625\u0644\u063A\u0627\u0621 \u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644");
|
|
177
204
|
injectString("cs", "Select all", "Vybrat v\u0161e");
|
|
178
205
|
injectString("da-DK", "Select all", "V\xE6lg alle");
|
|
179
206
|
injectString("de", "Select all", "Alle ausw\xE4hlen");
|
|
@@ -332,7 +359,7 @@ const DropdownList = ({
|
|
|
332
359
|
onSelect,
|
|
333
360
|
onSingleSelect,
|
|
334
361
|
listData,
|
|
335
|
-
|
|
362
|
+
isAllSelected,
|
|
336
363
|
backButtonName,
|
|
337
364
|
width,
|
|
338
365
|
minWidth,
|
|
@@ -361,7 +388,7 @@ const DropdownList = ({
|
|
|
361
388
|
const internalListId = (0, react_1.useId)();
|
|
362
389
|
const selectListId = listId || internalListId;
|
|
363
390
|
const handleSelectAllClick = () => {
|
|
364
|
-
onSelectAllClick(
|
|
391
|
+
onSelectAllClick(isAllSelected);
|
|
365
392
|
};
|
|
366
393
|
const handleBackButtonKeyDown = (0, react_1.useCallback)(event => {
|
|
367
394
|
if (event.key === "ArrowLeft") {
|
|
@@ -389,14 +416,13 @@ const DropdownList = ({
|
|
|
389
416
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
390
417
|
forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
|
|
391
418
|
}, [activeValue, forceSelection, onSingleSelect]);
|
|
392
|
-
const selectButtonLabel = translate("Select all");
|
|
393
|
-
const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown
|
|
419
|
+
const selectButtonLabel = isAllSelected ? translate("Deselect all") : translate("Select all");
|
|
420
|
+
const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown) => (0, jsx_runtime_1.jsx)("button", {
|
|
394
421
|
type: "button",
|
|
395
422
|
disabled: isDisabled,
|
|
396
423
|
onClick: clickHandler,
|
|
397
424
|
onKeyDown: onKeyDown,
|
|
398
|
-
"
|
|
399
|
-
className: (0, classNames_1.classNames)(["zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", isSelected ? "zen-dropdown-list__action-button--selected" : ""]),
|
|
425
|
+
className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back",
|
|
400
426
|
title: title,
|
|
401
427
|
children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
402
428
|
children: [react_1.default.createElement(icon, {
|
|
@@ -470,7 +496,7 @@ const DropdownList = ({
|
|
|
470
496
|
}) : null, backButtonName ? (0, jsx_runtime_1.jsx)("div", {
|
|
471
497
|
className: "zen-dropdown-list__item-wrapper",
|
|
472
498
|
children: getActionButton(backButtonName, translate("Back"), iconBackArrow_1.IconBackArrow, false, onBackButtonClick, "large", handleBackButtonKeyDown)
|
|
473
|
-
}) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge"
|
|
499
|
+
}) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", {
|
|
474
500
|
className: "zen-dropdown-list__footer",
|
|
475
501
|
children: [(0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
476
502
|
onClick: isMultiselect ? onClearClick : handleClearClick,
|
|
@@ -499,4 +525,4 @@ const DropdownList = ({
|
|
|
499
525
|
}));
|
|
500
526
|
};
|
|
501
527
|
exports.DropdownList = DropdownList;
|
|
502
|
-
exports.TRANSLATIONS = ["Select all", "Clear", "Back", "No data"];
|
|
528
|
+
exports.TRANSLATIONS = ["Select all", "Deselect all", "Clear", "Back", "No data"];
|
|
@@ -399,6 +399,23 @@ const DropdownRaw = props => {
|
|
|
399
399
|
payload: state.currentId || state.rootId
|
|
400
400
|
});
|
|
401
401
|
}, [isFullSelectionMode, state.currentId, state.rootId]);
|
|
402
|
+
const handleSelectAllInSearch = (0, react_1.useCallback)(isAllSelect => {
|
|
403
|
+
if (isFullSelectionMode && state.isAllSelected) {
|
|
404
|
+
dispatchState({
|
|
405
|
+
type: stateActionType_1.StateActionType.DeselectItemsFromAllSelected,
|
|
406
|
+
payload: undefined
|
|
407
|
+
});
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const dataForChange = (0, dropdownHelper_1.getDataForChange)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
|
|
411
|
+
dispatchState({
|
|
412
|
+
type: stateActionType_1.StateActionType.ChangeBulkSelection,
|
|
413
|
+
payload: {
|
|
414
|
+
itemsIds: dataForChange,
|
|
415
|
+
value: !isAllSelect
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
|
|
402
419
|
const handleClearClick = (0, react_1.useCallback)(() => {
|
|
403
420
|
var _a, _b;
|
|
404
421
|
dispatchState({
|
|
@@ -534,18 +551,12 @@ const DropdownRaw = props => {
|
|
|
534
551
|
}, [setChecked, setSearch]);
|
|
535
552
|
const debouncedGetData = (0, useDebounce_1.useDebounce)((signal, searchValue, isChecked) => getData ? (isCheckboxMode ? getData(signal, searchValue, isChecked) : getData(signal, searchValue)).then(dta => handleData(dta, searchValue)).catch(handleError) : customGetData(searchValue).then(dta => handleData(dta, searchValue)).catch(handleError), 200);
|
|
536
553
|
const controlData = (0, react_1.useCallback)((signal, searchValue, isChecked) => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
type: stateActionType_1.StateActionType.ShowWaiting,
|
|
544
|
-
payload: undefined
|
|
545
|
-
});
|
|
546
|
-
debouncedGetData(signal, searchValue, isChecked);
|
|
547
|
-
}
|
|
548
|
-
}, [debouncedGetData, handleData, handleQueryMode, isQueryMode, getData, dataItems]);
|
|
554
|
+
!isQueryMode && dispatchState({
|
|
555
|
+
type: stateActionType_1.StateActionType.ShowWaiting,
|
|
556
|
+
payload: undefined
|
|
557
|
+
});
|
|
558
|
+
isQueryMode ? handleQueryMode(searchValue, isChecked) : debouncedGetData(signal, searchValue, isChecked);
|
|
559
|
+
}, [debouncedGetData, handleQueryMode, isQueryMode]);
|
|
549
560
|
(0, react_1.useEffect)(() => {
|
|
550
561
|
var _a;
|
|
551
562
|
const timeoutId = (_a = zen_1.zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, () => {
|
|
@@ -851,14 +862,13 @@ const DropdownRaw = props => {
|
|
|
851
862
|
});
|
|
852
863
|
}
|
|
853
864
|
if (state.showList) {
|
|
854
|
-
const isSearchMode =
|
|
865
|
+
const isSearchMode = state.inputValue && !state.currentId;
|
|
855
866
|
const currentListData = (0, dropdownHelper_1.createListDataOptions)(state, translate, isSearchMode ? (0, dropdownHelper_1.sortDropdownItemArray)(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== state.rootId) :
|
|
856
867
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
857
868
|
(0, dropdownHelper_1.sortDropdownItemArray)(((_b = state.groupsMap[state.currentId || state.rootId]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
|
|
858
|
-
const selectAllActiveForCurrentLevel = state.selectAllActiveForId === (state.currentId || state.rootId);
|
|
859
869
|
return (0, jsx_runtime_1.jsx)(dropdownList_1.DropdownList, {
|
|
860
870
|
onBackButtonClick: handleBackButtonClick,
|
|
861
|
-
onSelectAllClick: handleSelectAllClick,
|
|
871
|
+
onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick,
|
|
862
872
|
onClearClick: handleClearClick,
|
|
863
873
|
onCancelClick: handleCancelClick,
|
|
864
874
|
onApplyClick: handleApplyClick,
|
|
@@ -869,7 +879,6 @@ const DropdownRaw = props => {
|
|
|
869
879
|
backButtonName: state.currentId && state.groupsMap[state.currentId] ? (0, groupsHelper_1.getGroupDescription)(state.groupsMap[state.currentId], translate) : undefined,
|
|
870
880
|
filterName: isMobile ? undefined : filterName,
|
|
871
881
|
isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? (0, dropdownHelper_1.isEveryItemSelected)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? (0, dropdownHelper_1.isAllChildrenSelected)(state, state.currentId || state.rootId) : false,
|
|
872
|
-
isSelectAllActive: isFullSelectionMode ? currentAllSelected : selectAllActiveForCurrentLevel,
|
|
873
882
|
isMultiselect: multiselect,
|
|
874
883
|
forceSelection: forceSelection,
|
|
875
884
|
listData: currentListData,
|
|
@@ -878,7 +887,7 @@ const DropdownRaw = props => {
|
|
|
878
887
|
hasSelectAllButton: selectAllButton && multiselect,
|
|
879
888
|
hasApplyButton: hasApplyButton,
|
|
880
889
|
isApplyDisabled: memoizedIsApplyButtonDisabled,
|
|
881
|
-
isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode && state.isNestedList && (0, dropdownHelper_1.isAllItemsHasOneParent)(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
|
|
890
|
+
isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode !== "" && state.isNestedList && (0, dropdownHelper_1.isAllItemsHasOneParent)(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
|
|
882
891
|
isClearButtonDisabled: memoizedIsClearButtonDisabled,
|
|
883
892
|
isWithFooter: memoizedWithFooter && !isMobile,
|
|
884
893
|
isMobile: isMobile,
|
|
@@ -890,7 +899,7 @@ const DropdownRaw = props => {
|
|
|
890
899
|
});
|
|
891
900
|
}
|
|
892
901
|
return null;
|
|
893
|
-
}, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel, selectListId
|
|
902
|
+
}, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllInSearch, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel, selectListId]);
|
|
894
903
|
const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected || isFullSelectionMode && !hasApplyButton && state.isAllSelected ? (0, dropdownHelper_1.getStringFromAllSelected)(state.groupsMap, translate, state.rootId) : (0, dropdownHelper_1.getStringFromSelected)(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate, state.rootId);
|
|
895
904
|
const memoizedCurrentSelection = (0, react_1.useMemo)(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
|
|
896
905
|
const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
|
|
@@ -988,4 +997,4 @@ const DropdownRaw = props => {
|
|
|
988
997
|
};
|
|
989
998
|
exports.DropdownRaw = DropdownRaw;
|
|
990
999
|
exports.DropdownRaw.displayName = "DropdownRaw";
|
|
991
|
-
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
|
|
1000
|
+
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
|
|
@@ -77,12 +77,10 @@ function stateReducer(state, action) {
|
|
|
77
77
|
}
|
|
78
78
|
const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 &&
|
|
79
79
|
(updatedGroupsMap[exports.ROOT_GROUP_ID].children || []).some(el => el.children && el.children.length);
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const selectedInNewMap = state.selectedIds.filter(id => id in updatedGroupsMap).length;
|
|
83
|
-
const newIsAllSelected = (0, stateReducerHelper_1.computeIsAllSelected)(state.isAllSelected, state.isFullSelectionMode, newResultsExceedListLimit, groupsMapLength, selectedInNewMap);
|
|
80
|
+
state.groupsMap = updatedGroupsMap;
|
|
81
|
+
const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, state.selectedIds.length - newNamelessIds.size);
|
|
84
82
|
const rootId = (0, stateReducerHelper_1.getRootId)(updatedGroupsMap, exports.ROOT_GROUP_ID, state.firstParentNodeIsVisible);
|
|
85
|
-
return Object.assign(Object.assign({}, state), {
|
|
83
|
+
return Object.assign(Object.assign(Object.assign({}, state), { rootId: rootId || exports.ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: Object.keys(updatedGroupsMap).length - 1 >= state.listLimit }), additionalStateUpdates);
|
|
86
84
|
}
|
|
87
85
|
case stateActionType_1.StateActionType.SetListData: {
|
|
88
86
|
state.selectedIds.forEach(id => {
|
|
@@ -107,9 +105,9 @@ function stateReducer(state, action) {
|
|
|
107
105
|
case stateActionType_1.StateActionType.SetIsOpenCombo:
|
|
108
106
|
return Object.assign(Object.assign({}, state), { isOpenCombo: payload });
|
|
109
107
|
case stateActionType_1.StateActionType.ResetSelection:
|
|
110
|
-
return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined
|
|
108
|
+
return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined });
|
|
111
109
|
case stateActionType_1.StateActionType.ResetStateToGlobal:
|
|
112
|
-
return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked
|
|
110
|
+
return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked });
|
|
113
111
|
case stateActionType_1.StateActionType.NothingToShow:
|
|
114
112
|
return Object.assign(Object.assign({}, state), { showWaiting: false, showEmptyList: false, showList: false });
|
|
115
113
|
case stateActionType_1.StateActionType.Show:
|
|
@@ -225,7 +223,8 @@ function stateReducer(state, action) {
|
|
|
225
223
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
226
224
|
}
|
|
227
225
|
});
|
|
228
|
-
|
|
226
|
+
const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
|
|
227
|
+
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
|
|
229
228
|
}
|
|
230
229
|
case stateActionType_1.StateActionType.ChangeBulkSelection: {
|
|
231
230
|
const { itemsIds, value } = payload;
|
|
@@ -258,7 +257,8 @@ function stateReducer(state, action) {
|
|
|
258
257
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
259
258
|
}
|
|
260
259
|
});
|
|
261
|
-
|
|
260
|
+
const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
|
|
261
|
+
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
|
|
262
262
|
}
|
|
263
263
|
case stateActionType_1.StateActionType.SelectAllChildren: {
|
|
264
264
|
const currentEl = state.groupsMap[payload];
|
|
@@ -295,7 +295,7 @@ function stateReducer(state, action) {
|
|
|
295
295
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected)
|
|
298
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
|
|
299
299
|
}
|
|
300
300
|
case stateActionType_1.StateActionType.DeselectItemsFromAllSelected: {
|
|
301
301
|
const currentEl = state.groupsMap[state.rootId];
|
|
@@ -319,7 +319,7 @@ function stateReducer(state, action) {
|
|
|
319
319
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined
|
|
322
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined });
|
|
323
323
|
}
|
|
324
324
|
case stateActionType_1.StateActionType.ToggleValueForAllSelected: {
|
|
325
325
|
const currentEl = state.groupsMap[state.rootId];
|
|
@@ -338,7 +338,8 @@ function stateReducer(state, action) {
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
|
|
341
|
-
|
|
341
|
+
const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, newSelected.size);
|
|
342
|
+
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
|
|
342
343
|
}
|
|
343
344
|
case stateActionType_1.StateActionType.DeselectAllChildren: {
|
|
344
345
|
const childrenForDeselect = [];
|
|
@@ -350,7 +351,7 @@ function stateReducer(state, action) {
|
|
|
350
351
|
});
|
|
351
352
|
const newSelected = new Set(state.selectedIds);
|
|
352
353
|
childrenForDeselect.forEach(childId => newSelected.delete(childId));
|
|
353
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected)
|
|
354
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
|
|
354
355
|
}
|
|
355
356
|
case stateActionType_1.StateActionType.SetFirstParentNodeIsVisible: {
|
|
356
357
|
if (state.firstParentNodeIsVisible === payload) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IDropdownState } from "./stateReducer";
|
|
1
2
|
import { IDropdownRawItem } from "../types";
|
|
2
3
|
import { IGroupTree, ITypedHash } from "../../groupsFilterRaw/groupsFilterInterfaces";
|
|
3
4
|
export declare function getChildList(childArr: IDropdownRawItem[] | undefined): IDropdownRawItem[];
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const updateAllSelectedStateValueBasedOnTotalSelected: (state: IDropdownState, totalSelected: number) => Partial<Pick<IDropdownState, "isAllSelected">>;
|
|
5
6
|
export declare const getRootId: (groupsMap: ITypedHash<IGroupTree>, rootIdKey: string, firstParentNodeIsVisible?: boolean) => string | undefined;
|