@geotab/zenith 3.10.0-beta.4 → 3.10.0-beta.7
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 +1 -2
- 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 -2
|
@@ -35,44 +35,19 @@ export const searchItemIndex = (items, searchStr) => {
|
|
|
35
35
|
return content.toLocaleLowerCase().indexOf(searchStr.toLocaleLowerCase()) > -1;
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
export const getFirstIndex = (items) => items.
|
|
39
|
-
export const getLastIndex = (items) =>
|
|
40
|
-
for (let i = items.length - 1; i >= 0; i--) {
|
|
41
|
-
if (!items[i].disabled) {
|
|
42
|
-
return i;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return -1;
|
|
46
|
-
};
|
|
38
|
+
export const getFirstIndex = (items) => (items.length > 0 ? 0 : -1);
|
|
39
|
+
export const getLastIndex = (items) => (items.length > 0 ? items.length - 1 : -1);
|
|
47
40
|
export const getNextIndex = (currIndex, items) => {
|
|
48
|
-
var _a;
|
|
49
41
|
if (items.length === 0) {
|
|
50
42
|
return -1;
|
|
51
43
|
}
|
|
52
|
-
|
|
53
|
-
const startIndex = nextIndex;
|
|
54
|
-
while ((_a = items[nextIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
55
|
-
nextIndex = nextIndex + 1 >= items.length ? 0 : nextIndex + 1;
|
|
56
|
-
if (nextIndex === startIndex) {
|
|
57
|
-
return currIndex;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return nextIndex;
|
|
44
|
+
return currIndex + 1 >= items.length ? 0 : currIndex + 1;
|
|
61
45
|
};
|
|
62
46
|
export const getPrevIndex = (currIndex, items) => {
|
|
63
|
-
var _a;
|
|
64
47
|
if (items.length === 0) {
|
|
65
48
|
return -1;
|
|
66
49
|
}
|
|
67
|
-
|
|
68
|
-
const startIndex = prevIndex;
|
|
69
|
-
while ((_a = items[prevIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
70
|
-
prevIndex = prevIndex <= 0 ? items.length - 1 : prevIndex - 1;
|
|
71
|
-
if (prevIndex === startIndex) {
|
|
72
|
-
return currIndex;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return prevIndex;
|
|
50
|
+
return currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
|
|
76
51
|
};
|
|
77
52
|
export const getFirstActiveIndex = (state, items, multiselect) => {
|
|
78
53
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -80,7 +55,11 @@ export const getFirstActiveIndex = (state, items, multiselect) => {
|
|
|
80
55
|
return i;
|
|
81
56
|
}
|
|
82
57
|
}
|
|
83
|
-
|
|
58
|
+
if (multiselect && items.length > 0) {
|
|
59
|
+
const firstNonDisabled = items.findIndex(item => !item.disabled);
|
|
60
|
+
return firstNonDisabled >= 0 ? firstNonDisabled : 0;
|
|
61
|
+
}
|
|
62
|
+
return -1;
|
|
84
63
|
};
|
|
85
64
|
export const getItemsState = (items, value, multiselect) => {
|
|
86
65
|
let forceUncheck = false;
|
|
@@ -48,9 +48,7 @@ export const SelectList = (_a) => {
|
|
|
48
48
|
if (!multiselect && selectItemOnFocus) {
|
|
49
49
|
dispatchState({ type: ListAction.FocusFirst, payload: { items } });
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
|
|
53
|
-
}
|
|
51
|
+
dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
|
|
54
52
|
}, [multiselect, items, selectItemOnFocus]);
|
|
55
53
|
useEffect(() => {
|
|
56
54
|
onChange && state.isItemsStateChanged && onChange(new Map(state.itemsState));
|
|
@@ -117,7 +117,8 @@ export const selectListReducer = (state, action) => {
|
|
|
117
117
|
newItemsState = updatedState;
|
|
118
118
|
});
|
|
119
119
|
const prevActiveItemId = getItemIdByIndex(state.itemsState, state.activeIndex);
|
|
120
|
-
const
|
|
120
|
+
const newActiveItemIndex = !!prevActiveItemId && getItemIndexById(newItemsState, prevActiveItemId);
|
|
121
|
+
const activeIndex = newActiveItemIndex ? newActiveItemIndex : -1;
|
|
121
122
|
return Object.assign(Object.assign({}, state), { itemsState: newItemsState, activeIndex, isItemsStateChanged: false });
|
|
122
123
|
}
|
|
123
124
|
case ListAction.SetLevel: {
|
|
@@ -65,60 +65,6 @@ injectString("zh-Hans", "Change sort direction", "\u66F4\u6539\u6392\u5E8F");
|
|
|
65
65
|
injectString("zh-TW", "Change sort direction", "\u8B8A\u66F4\u6392\u5E8F\u65B9\u5411");
|
|
66
66
|
injectString("ro-RO", "Change sort direction", "Schimba\u021Bi direc\u021Bia sort\u0103rii");
|
|
67
67
|
injectString("ar-SA", "Change sort direction", "\u062A\u063A\u064A\u064A\u0631 \u0627\u062A\u062C\u0627\u0647 \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
|
|
68
|
-
injectString("cs", "Ascending", "Vzestupn\u011B");
|
|
69
|
-
injectString("da-DK", "Ascending", "Stigende");
|
|
70
|
-
injectString("de", "Ascending", "Aufsteigend");
|
|
71
|
-
injectString("en", "Ascending", "Ascending");
|
|
72
|
-
injectString("es", "Ascending", "Ascendente");
|
|
73
|
-
injectString("fi-FI", "Ascending", "Nouseva");
|
|
74
|
-
injectString("fr", "Ascending", "Croissant");
|
|
75
|
-
injectString("fr-FR", "Ascending", "Croissant");
|
|
76
|
-
injectString("hu-HU", "Ascending", "N\xF6vekv\u0151");
|
|
77
|
-
injectString("id", "Ascending", "Naik");
|
|
78
|
-
injectString("it", "Ascending", "Crescente");
|
|
79
|
-
injectString("ja", "Ascending", "\u6607\u9806");
|
|
80
|
-
injectString("ko-KR", "Ascending", "\uC624\uB984\uCC28\uC21C");
|
|
81
|
-
injectString("ms", "Ascending", "Menaik");
|
|
82
|
-
injectString("nb-NO", "Ascending", "Stigende");
|
|
83
|
-
injectString("nl", "Ascending", "Oplopend");
|
|
84
|
-
injectString("pl", "Ascending", "Rosn\u0105co");
|
|
85
|
-
injectString("pt-BR", "Ascending", "Crescente");
|
|
86
|
-
injectString("pt-PT", "Ascending", "Ascendente");
|
|
87
|
-
injectString("sk-SK", "Ascending", "Vzostupne");
|
|
88
|
-
injectString("sv", "Ascending", "Stigande");
|
|
89
|
-
injectString("th", "Ascending", "\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01");
|
|
90
|
-
injectString("tr", "Ascending", "Artan");
|
|
91
|
-
injectString("zh-Hans", "Ascending", "\u5347\u5E8F");
|
|
92
|
-
injectString("zh-TW", "Ascending", "\u905E\u589E");
|
|
93
|
-
injectString("ro-RO", "Ascending", "Ascensiune");
|
|
94
|
-
injectString("ar-SA", "Ascending", "\u062A\u0635\u0627\u0639\u062F\u064A");
|
|
95
|
-
injectString("cs", "Descending", "Sestupn\u011B");
|
|
96
|
-
injectString("da-DK", "Descending", "Faldende");
|
|
97
|
-
injectString("de", "Descending", "Absteigend");
|
|
98
|
-
injectString("en", "Descending", "Descending");
|
|
99
|
-
injectString("es", "Descending", "Descendente");
|
|
100
|
-
injectString("fi-FI", "Descending", "Laskeva");
|
|
101
|
-
injectString("fr", "Descending", "D\xE9croissant");
|
|
102
|
-
injectString("fr-FR", "Descending", "Descendant");
|
|
103
|
-
injectString("hu-HU", "Descending", "Cs\xF6kken\u0151");
|
|
104
|
-
injectString("id", "Descending", "Menurun");
|
|
105
|
-
injectString("it", "Descending", "Decrescente");
|
|
106
|
-
injectString("ja", "Descending", "\u964D\u9806");
|
|
107
|
-
injectString("ko-KR", "Descending", "\uB0B4\uB9BC\uCC28\uC21C");
|
|
108
|
-
injectString("ms", "Descending", "Menurun");
|
|
109
|
-
injectString("nb-NO", "Descending", "Synkende");
|
|
110
|
-
injectString("nl", "Descending", "Aflopend");
|
|
111
|
-
injectString("pl", "Descending", "Malej\u0105co");
|
|
112
|
-
injectString("pt-BR", "Descending", "Decrescente");
|
|
113
|
-
injectString("pt-PT", "Descending", "Descendente");
|
|
114
|
-
injectString("sk-SK", "Descending", "Zostupne");
|
|
115
|
-
injectString("sv", "Descending", "Fallande");
|
|
116
|
-
injectString("th", "Descending", "\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22");
|
|
117
|
-
injectString("tr", "Descending", "Azalan");
|
|
118
|
-
injectString("zh-Hans", "Descending", "\u964D\u5E8F");
|
|
119
|
-
injectString("zh-TW", "Descending", "\u905E\u6E1B");
|
|
120
|
-
injectString("ro-RO", "Descending", "Cobor\xE2re");
|
|
121
|
-
injectString("ar-SA", "Descending", "\u062A\u0646\u0627\u0632\u0644\u064A");
|
|
122
68
|
injectString("cs", "Sort Options", "Sort Options");
|
|
123
69
|
injectString("da-DK", "Sort Options", "Sorteringsmuligheder");
|
|
124
70
|
injectString("de", "Sort Options", "Sort Options");
|
|
@@ -203,6 +149,7 @@ export const SortControl = ({
|
|
|
203
149
|
onClick: () => onSortDirectionToggle(),
|
|
204
150
|
disabled: disabled,
|
|
205
151
|
title: translate("Change sort direction"),
|
|
152
|
+
"aria-label": translate("Change sort direction"),
|
|
206
153
|
children: [directionIcon ? sortDirection === SortDirections.Ascending ? _jsx(IconFilter3Asc, {
|
|
207
154
|
className: "zen-sort-container__sort-icon",
|
|
208
155
|
size: isDrive ? "huge" : "large"
|
|
@@ -215,9 +162,6 @@ export const SortControl = ({
|
|
|
215
162
|
children: [buttonTextValue, ": "]
|
|
216
163
|
}), _jsx("span", {
|
|
217
164
|
children: (items.find(item => item.id === sortBy) || items[0]).children
|
|
218
|
-
}), _jsxs("span", {
|
|
219
|
-
className: "zen-visually-hidden",
|
|
220
|
-
children: [" ", sortDirection === SortDirections.Ascending ? translate("Ascending") : translate("Descending")]
|
|
221
165
|
})]
|
|
222
166
|
})]
|
|
223
167
|
}), isSingleItem ? "" : _jsx(Popup, {
|
|
@@ -244,4 +188,4 @@ export const SortControl = ({
|
|
|
244
188
|
}, popupKey)]
|
|
245
189
|
});
|
|
246
190
|
};
|
|
247
|
-
export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"
|
|
191
|
+
export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, RefObject } from "react";
|
|
2
|
-
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
|
|
2
|
+
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, selectAll: () => void, turnOffSelectAll?: boolean, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
|
|
3
3
|
bulkActions: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
4
4
|
pagination: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
5
5
|
activePage: number | undefined;
|
|
@@ -24,7 +24,7 @@ const isChildElement = function (child, expectedType) {
|
|
|
24
24
|
}
|
|
25
25
|
return false;
|
|
26
26
|
};
|
|
27
|
-
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel) => useMemo(() => {
|
|
27
|
+
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, selectAll, turnOffSelectAll, activeId, gridRef, onCloseDetailPanel) => useMemo(() => {
|
|
28
28
|
let bulkActions = undefined;
|
|
29
29
|
let tablePagination = undefined;
|
|
30
30
|
let activePage = undefined;
|
|
@@ -39,7 +39,7 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
39
39
|
}
|
|
40
40
|
if (isChildElement(child, TableBulkActions.displayName)) {
|
|
41
41
|
const bulkActionButtons = child.props.children || [];
|
|
42
|
-
bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
|
|
42
|
+
bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, onSelectAll: selectAll, turnOffSelectAll: turnOffSelectAll, children: bulkActionButtons }));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if (isChildElement(child, TablePagination.displayName)) {
|
|
@@ -100,4 +100,4 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
100
100
|
detailPanel: detailPanel,
|
|
101
101
|
other: other
|
|
102
102
|
};
|
|
103
|
-
}, [children, clearSelection, isMobile, selected, gridRef, allSelected, activeId, onCloseDetailPanel]);
|
|
103
|
+
}, [children, clearSelection, isMobile, selected, gridRef, allSelected, selectAll, turnOffSelectAll, activeId, onCloseDetailPanel]);
|
|
@@ -57,7 +57,6 @@ const SubColumnsList = ({
|
|
|
57
57
|
showCheckbox: true,
|
|
58
58
|
children: c.title
|
|
59
59
|
})), [columns, sortColumnsInt, lastVisibleColumnId]);
|
|
60
|
-
const allDisabled = useMemo(() => items.every(item => item.disabled), [items]);
|
|
61
60
|
const state = columns.reduce((res, c) => {
|
|
62
61
|
res.set(c.id, settings.get(c.id) !== false ? CheckboxState.On : CheckboxState.Off);
|
|
63
62
|
return res;
|
|
@@ -77,9 +76,8 @@ const SubColumnsList = ({
|
|
|
77
76
|
title: title || translate("Select visible columns"),
|
|
78
77
|
multiselect: true,
|
|
79
78
|
showCheckbox: true,
|
|
80
|
-
onChange: onChangeItem
|
|
81
|
-
|
|
82
|
-
}), [id, items, state, title, translate, onChangeItem, allDisabled]);
|
|
79
|
+
onChange: onChangeItem
|
|
80
|
+
}), [id, items, state, title, translate, onChangeItem]);
|
|
83
81
|
if (!title) {
|
|
84
82
|
return list;
|
|
85
83
|
}
|
|
@@ -16,14 +16,6 @@ export interface ISelectableRowsOptions<T extends IRowEntity<N>, N extends IEnti
|
|
|
16
16
|
checkboxTitle?: (entity: T | N) => string;
|
|
17
17
|
headerTitle?: (state: SelectionState) => string;
|
|
18
18
|
turnOffSelectAll?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* When `true`, the header checkbox emits the current page's IDs instead of `{ all: true }`.
|
|
21
|
-
* When `undefined`, falls back to `turnOffSelectAll` for backward compatibility.
|
|
22
|
-
*
|
|
23
|
-
* Note: avoid setting this to `false` alongside `turnOffSelectAll: true` — the checkbox
|
|
24
|
-
* will emit `{ all: true }` while the dropdown hides the "Select all" option, which is inconsistent.
|
|
25
|
-
*/
|
|
26
|
-
checkboxSelectsCurrentPage?: boolean;
|
|
27
19
|
checkboxPlaceholder?: boolean;
|
|
28
20
|
strategy?: TSelectionStrategy;
|
|
29
21
|
selectAll?: boolean;
|
|
@@ -179,16 +179,8 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
179
179
|
return translate("Deselect all");
|
|
180
180
|
}, [selectable, selectableState, state, translate]);
|
|
181
181
|
const isEntityChecked = useCallback((entity, isNested) => isRowChecked(selections, state, selectable === null || selectable === void 0 ? void 0 : selectable.strategy, entity, isNested), [selections, state, selectable === null || selectable === void 0 ? void 0 : selectable.strategy]);
|
|
182
|
-
const hasSelectable = !!selectable;
|
|
183
|
-
const selectableCheckboxSelectsCurrentPage = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxSelectsCurrentPage;
|
|
184
|
-
const selectableTurnOffSelectAll = selectable === null || selectable === void 0 ? void 0 : selectable.turnOffSelectAll;
|
|
185
|
-
const selectableCheckboxInHeader = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxInHeader;
|
|
186
|
-
const selectableSelectionLimit = selectable === null || selectable === void 0 ? void 0 : selectable.selectionLimit;
|
|
187
|
-
const selectableHeader = selectable === null || selectable === void 0 ? void 0 : selectable.header;
|
|
188
|
-
const checkboxEmitsCurrentPage = selectableCheckboxSelectsCurrentPage !== null && selectableCheckboxSelectsCurrentPage !== void 0 ? selectableCheckboxSelectsCurrentPage : selectableTurnOffSelectAll;
|
|
189
|
-
const checkboxInHeaderValue = selectableCheckboxInHeader !== undefined ? selectableCheckboxInHeader : selectableSelectionLimit !== undefined ? false : undefined;
|
|
190
182
|
const wrapper = useMemo(() => {
|
|
191
|
-
if (!
|
|
183
|
+
if (!selectable) {
|
|
192
184
|
return null;
|
|
193
185
|
}
|
|
194
186
|
return {
|
|
@@ -232,7 +224,7 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
232
224
|
onChange: newValue => {
|
|
233
225
|
var _a, _b;
|
|
234
226
|
if (newValue) {
|
|
235
|
-
const newState =
|
|
227
|
+
const newState = selectable.turnOffSelectAll ? SelectionState.CurrentPage : SelectionState.All;
|
|
236
228
|
setState(newState);
|
|
237
229
|
onChangeSelectionState(newState);
|
|
238
230
|
} else {
|
|
@@ -250,18 +242,18 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
250
242
|
}
|
|
251
243
|
},
|
|
252
244
|
calculateSelectionState: () => selectableState,
|
|
253
|
-
checkboxInHeader:
|
|
254
|
-
header:
|
|
245
|
+
checkboxInHeader: selectable.checkboxInHeader !== undefined ? selectable.checkboxInHeader : selectable.selectionLimit !== undefined ? false : undefined,
|
|
246
|
+
header: selectable.header,
|
|
255
247
|
onSelect: newState => {
|
|
256
248
|
setState(newState);
|
|
257
249
|
onChangeSelectionState(newState);
|
|
258
250
|
},
|
|
259
|
-
turnOffSelectAll:
|
|
251
|
+
turnOffSelectAll: selectable.turnOffSelectAll
|
|
260
252
|
});
|
|
261
253
|
return cell;
|
|
262
254
|
}
|
|
263
255
|
};
|
|
264
|
-
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener,
|
|
256
|
+
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener, selectable, selectableState, state, isMobile, checkboxPlaceholder, isEntityChecked, entities, setSelectMode]);
|
|
265
257
|
const selectableFeedWrapper = useCallback((primaryData, secondaryData, entity, isNested) => {
|
|
266
258
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
267
259
|
if (!entity) {
|
package/esm/table/table.js
CHANGED
|
@@ -177,6 +177,12 @@ const TableInner = ({
|
|
|
177
177
|
selected: []
|
|
178
178
|
});
|
|
179
179
|
}, [selectable]);
|
|
180
|
+
const selectAll = useCallback(() => {
|
|
181
|
+
selectable === null || selectable === void 0 ? void 0 : selectable.onSelect({
|
|
182
|
+
all: true,
|
|
183
|
+
selected: []
|
|
184
|
+
});
|
|
185
|
+
}, [selectable]);
|
|
180
186
|
const [activeIdInternal, setActiveInternal] = useState(undefined);
|
|
181
187
|
const activeId = active !== undefined ? active : activeIdInternal;
|
|
182
188
|
const onClickInternal = useCallback(id => setActiveInternal(id === activeIdInternal ? undefined : id), [activeIdInternal, setActiveInternal]);
|
|
@@ -193,7 +199,7 @@ const TableInner = ({
|
|
|
193
199
|
detailPanel,
|
|
194
200
|
footer,
|
|
195
201
|
other
|
|
196
|
-
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection, activeId, gridRef, onCloseDetailPanel);
|
|
202
|
+
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection, selectAll, selectable === null || selectable === void 0 ? void 0 : selectable.turnOffSelectAll, activeId, gridRef, onCloseDetailPanel);
|
|
197
203
|
const hasDetailPanel = !!detailPanel;
|
|
198
204
|
const shouldEnableRowClick = hasDetailPanel || !!onClick;
|
|
199
205
|
const activeIdForRow = shouldEnableRowClick ? activeId : undefined;
|
|
@@ -328,7 +328,5 @@
|
|
|
328
328
|
"File upload area": "File upload area",
|
|
329
329
|
"Uploaded": "Uploaded",
|
|
330
330
|
"Sort by Ascending": "Sort by Ascending",
|
|
331
|
-
"Sort by Descending": "Sort by Descending"
|
|
332
|
-
"Ascending": "Ascending",
|
|
333
|
-
"Descending": "Descending"
|
|
331
|
+
"Sort by Descending": "Sort by Descending"
|
|
334
332
|
}
|
|
@@ -323,7 +323,5 @@
|
|
|
323
323
|
"Supported Formats:": "Supported Formats:",
|
|
324
324
|
"Upload files.": "Upload files.",
|
|
325
325
|
"File upload area": "File upload area",
|
|
326
|
-
"Uploaded": "Uploaded"
|
|
327
|
-
"Ascending": "จากน้อยไปมาก",
|
|
328
|
-
"Descending": "จากมากไปน้อย"
|
|
326
|
+
"Uploaded": "Uploaded"
|
|
329
327
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geotab/zenith",
|
|
3
|
-
"version": "3.10.0-beta.
|
|
3
|
+
"version": "3.10.0-beta.7",
|
|
4
4
|
"description": "Zenith components library on React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"coverage": "npm run test-coverage && google-chrome ./jest-coverage/index.html",
|
|
29
29
|
"inject-translations": "node build-utils/translations/inject-translations.js",
|
|
30
30
|
"lint": "npx eslint",
|
|
31
|
-
"lint-fix": "npm run lint -- --fix",
|
|
32
31
|
"new": "node newComponent.mjs",
|
|
33
32
|
"prettier": "npx prettier . --config '.prettierrc' --ignore-path '.prettierignore'",
|
|
34
33
|
"prettier-check": "npm run prettier -- --check",
|