@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
|
@@ -89,8 +89,7 @@ const RadioGroupRaw = (props) => {
|
|
|
89
89
|
"zen-radio-group__item",
|
|
90
90
|
wrappedInLabel ? "zen-radio-group__item--no-paddings" : "",
|
|
91
91
|
type === "interactive" ? "zen-radio--interactive" : "",
|
|
92
|
-
size === "small" ? "zen-radio-group__item--small" : ""
|
|
93
|
-
direction === "horizontal" ? "zen-radio--align-start" : ""
|
|
92
|
+
size === "small" ? "zen-radio-group__item--small" : ""
|
|
94
93
|
]), key: ind, checked: item.value === value, disabled: disabled ? disabled : item.disabled, name: name, reverse: reverse, fullWidth: fullWidth, value: item.value, onChange: onChangeInner, wrappedInLabel: wrappedInLabel, tabIndex: selectItemOnFocus || disabled || item.disabled ? undefined : ind === focusedIndex ? 0 : -1, ref: selectItemOnFocus ? undefined : ind === focusedIndex ? focusElementRef : undefined, role: itemRole }), item.children) }, `${ind}-li`))) })) }));
|
|
95
94
|
};
|
|
96
95
|
exports.RadioGroupRaw = RadioGroupRaw;
|
|
@@ -5,7 +5,7 @@ export declare const getItemIdByIndex: (state: Map<string, CheckboxState>, index
|
|
|
5
5
|
export declare const getItemIndexById: (state: Map<string, CheckboxState>, id: string) => number;
|
|
6
6
|
export declare const updateItemState: (initialState: Map<string, CheckboxState>, multiselect: boolean, updatedId: string, newState: CheckboxState) => [Map<string, CheckboxState>, boolean];
|
|
7
7
|
export declare const searchItemIndex: (items: ISelectListItem[], searchStr: string) => number;
|
|
8
|
-
export declare const getFirstIndex: (items: ISelectListItem[]) =>
|
|
8
|
+
export declare const getFirstIndex: (items: ISelectListItem[]) => 0 | -1;
|
|
9
9
|
export declare const getLastIndex: (items: ISelectListItem[]) => number;
|
|
10
10
|
export declare const getNextIndex: (currIndex: number, items: ISelectListItem[]) => number;
|
|
11
11
|
export declare const getPrevIndex: (currIndex: number, items: ISelectListItem[]) => number;
|
|
@@ -42,47 +42,22 @@ const searchItemIndex = (items, searchStr) => {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
exports.searchItemIndex = searchItemIndex;
|
|
45
|
-
const getFirstIndex = (items) => items.
|
|
45
|
+
const getFirstIndex = (items) => (items.length > 0 ? 0 : -1);
|
|
46
46
|
exports.getFirstIndex = getFirstIndex;
|
|
47
|
-
const getLastIndex = (items) =>
|
|
48
|
-
for (let i = items.length - 1; i >= 0; i--) {
|
|
49
|
-
if (!items[i].disabled) {
|
|
50
|
-
return i;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return -1;
|
|
54
|
-
};
|
|
47
|
+
const getLastIndex = (items) => (items.length > 0 ? items.length - 1 : -1);
|
|
55
48
|
exports.getLastIndex = getLastIndex;
|
|
56
49
|
const getNextIndex = (currIndex, items) => {
|
|
57
|
-
var _a;
|
|
58
50
|
if (items.length === 0) {
|
|
59
51
|
return -1;
|
|
60
52
|
}
|
|
61
|
-
|
|
62
|
-
const startIndex = nextIndex;
|
|
63
|
-
while ((_a = items[nextIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
64
|
-
nextIndex = nextIndex + 1 >= items.length ? 0 : nextIndex + 1;
|
|
65
|
-
if (nextIndex === startIndex) {
|
|
66
|
-
return currIndex;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return nextIndex;
|
|
53
|
+
return currIndex + 1 >= items.length ? 0 : currIndex + 1;
|
|
70
54
|
};
|
|
71
55
|
exports.getNextIndex = getNextIndex;
|
|
72
56
|
const getPrevIndex = (currIndex, items) => {
|
|
73
|
-
var _a;
|
|
74
57
|
if (items.length === 0) {
|
|
75
58
|
return -1;
|
|
76
59
|
}
|
|
77
|
-
|
|
78
|
-
const startIndex = prevIndex;
|
|
79
|
-
while ((_a = items[prevIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
80
|
-
prevIndex = prevIndex <= 0 ? items.length - 1 : prevIndex - 1;
|
|
81
|
-
if (prevIndex === startIndex) {
|
|
82
|
-
return currIndex;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return prevIndex;
|
|
60
|
+
return currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
|
|
86
61
|
};
|
|
87
62
|
exports.getPrevIndex = getPrevIndex;
|
|
88
63
|
const getFirstActiveIndex = (state, items, multiselect) => {
|
|
@@ -91,7 +66,11 @@ const getFirstActiveIndex = (state, items, multiselect) => {
|
|
|
91
66
|
return i;
|
|
92
67
|
}
|
|
93
68
|
}
|
|
94
|
-
|
|
69
|
+
if (multiselect && items.length > 0) {
|
|
70
|
+
const firstNonDisabled = items.findIndex(item => !item.disabled);
|
|
71
|
+
return firstNonDisabled >= 0 ? firstNonDisabled : 0;
|
|
72
|
+
}
|
|
73
|
+
return -1;
|
|
95
74
|
};
|
|
96
75
|
exports.getFirstActiveIndex = getFirstActiveIndex;
|
|
97
76
|
const getItemsState = (items, value, multiselect) => {
|
|
@@ -51,9 +51,7 @@ const SelectList = (_a) => {
|
|
|
51
51
|
if (!multiselect && selectItemOnFocus) {
|
|
52
52
|
dispatchState({ type: selectList_actionTypes_1.ListAction.FocusFirst, payload: { items } });
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
dispatchState({ type: selectList_actionTypes_1.ListAction.Focus, payload: { items, multiselect } });
|
|
56
|
-
}
|
|
54
|
+
dispatchState({ type: selectList_actionTypes_1.ListAction.Focus, payload: { items, multiselect } });
|
|
57
55
|
}, [multiselect, items, selectItemOnFocus]);
|
|
58
56
|
(0, react_2.useEffect)(() => {
|
|
59
57
|
onChange && state.isItemsStateChanged && onChange(new Map(state.itemsState));
|
|
@@ -120,7 +120,8 @@ const selectListReducer = (state, action) => {
|
|
|
120
120
|
newItemsState = updatedState;
|
|
121
121
|
});
|
|
122
122
|
const prevActiveItemId = (0, selectList_helpers_1.getItemIdByIndex)(state.itemsState, state.activeIndex);
|
|
123
|
-
const
|
|
123
|
+
const newActiveItemIndex = !!prevActiveItemId && (0, selectList_helpers_1.getItemIndexById)(newItemsState, prevActiveItemId);
|
|
124
|
+
const activeIndex = newActiveItemIndex ? newActiveItemIndex : -1;
|
|
124
125
|
return Object.assign(Object.assign({}, state), { itemsState: newItemsState, activeIndex, isItemsStateChanged: false });
|
|
125
126
|
}
|
|
126
127
|
case selectList_actionTypes_1.ListAction.SetLevel: {
|
|
@@ -66,60 +66,6 @@ injectString("zh-Hans", "Change sort direction", "\u66F4\u6539\u6392\u5E8F");
|
|
|
66
66
|
injectString("zh-TW", "Change sort direction", "\u8B8A\u66F4\u6392\u5E8F\u65B9\u5411");
|
|
67
67
|
injectString("ro-RO", "Change sort direction", "Schimba\u021Bi direc\u021Bia sort\u0103rii");
|
|
68
68
|
injectString("ar-SA", "Change sort direction", "\u062A\u063A\u064A\u064A\u0631 \u0627\u062A\u062C\u0627\u0647 \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
|
|
69
|
-
injectString("cs", "Ascending", "Vzestupn\u011B");
|
|
70
|
-
injectString("da-DK", "Ascending", "Stigende");
|
|
71
|
-
injectString("de", "Ascending", "Aufsteigend");
|
|
72
|
-
injectString("en", "Ascending", "Ascending");
|
|
73
|
-
injectString("es", "Ascending", "Ascendente");
|
|
74
|
-
injectString("fi-FI", "Ascending", "Nouseva");
|
|
75
|
-
injectString("fr", "Ascending", "Croissant");
|
|
76
|
-
injectString("fr-FR", "Ascending", "Croissant");
|
|
77
|
-
injectString("hu-HU", "Ascending", "N\xF6vekv\u0151");
|
|
78
|
-
injectString("id", "Ascending", "Naik");
|
|
79
|
-
injectString("it", "Ascending", "Crescente");
|
|
80
|
-
injectString("ja", "Ascending", "\u6607\u9806");
|
|
81
|
-
injectString("ko-KR", "Ascending", "\uC624\uB984\uCC28\uC21C");
|
|
82
|
-
injectString("ms", "Ascending", "Menaik");
|
|
83
|
-
injectString("nb-NO", "Ascending", "Stigende");
|
|
84
|
-
injectString("nl", "Ascending", "Oplopend");
|
|
85
|
-
injectString("pl", "Ascending", "Rosn\u0105co");
|
|
86
|
-
injectString("pt-BR", "Ascending", "Crescente");
|
|
87
|
-
injectString("pt-PT", "Ascending", "Ascendente");
|
|
88
|
-
injectString("sk-SK", "Ascending", "Vzostupne");
|
|
89
|
-
injectString("sv", "Ascending", "Stigande");
|
|
90
|
-
injectString("th", "Ascending", "\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01");
|
|
91
|
-
injectString("tr", "Ascending", "Artan");
|
|
92
|
-
injectString("zh-Hans", "Ascending", "\u5347\u5E8F");
|
|
93
|
-
injectString("zh-TW", "Ascending", "\u905E\u589E");
|
|
94
|
-
injectString("ro-RO", "Ascending", "Ascensiune");
|
|
95
|
-
injectString("ar-SA", "Ascending", "\u062A\u0635\u0627\u0639\u062F\u064A");
|
|
96
|
-
injectString("cs", "Descending", "Sestupn\u011B");
|
|
97
|
-
injectString("da-DK", "Descending", "Faldende");
|
|
98
|
-
injectString("de", "Descending", "Absteigend");
|
|
99
|
-
injectString("en", "Descending", "Descending");
|
|
100
|
-
injectString("es", "Descending", "Descendente");
|
|
101
|
-
injectString("fi-FI", "Descending", "Laskeva");
|
|
102
|
-
injectString("fr", "Descending", "D\xE9croissant");
|
|
103
|
-
injectString("fr-FR", "Descending", "Descendant");
|
|
104
|
-
injectString("hu-HU", "Descending", "Cs\xF6kken\u0151");
|
|
105
|
-
injectString("id", "Descending", "Menurun");
|
|
106
|
-
injectString("it", "Descending", "Decrescente");
|
|
107
|
-
injectString("ja", "Descending", "\u964D\u9806");
|
|
108
|
-
injectString("ko-KR", "Descending", "\uB0B4\uB9BC\uCC28\uC21C");
|
|
109
|
-
injectString("ms", "Descending", "Menurun");
|
|
110
|
-
injectString("nb-NO", "Descending", "Synkende");
|
|
111
|
-
injectString("nl", "Descending", "Aflopend");
|
|
112
|
-
injectString("pl", "Descending", "Malej\u0105co");
|
|
113
|
-
injectString("pt-BR", "Descending", "Decrescente");
|
|
114
|
-
injectString("pt-PT", "Descending", "Descendente");
|
|
115
|
-
injectString("sk-SK", "Descending", "Zostupne");
|
|
116
|
-
injectString("sv", "Descending", "Fallande");
|
|
117
|
-
injectString("th", "Descending", "\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22");
|
|
118
|
-
injectString("tr", "Descending", "Azalan");
|
|
119
|
-
injectString("zh-Hans", "Descending", "\u964D\u5E8F");
|
|
120
|
-
injectString("zh-TW", "Descending", "\u905E\u6E1B");
|
|
121
|
-
injectString("ro-RO", "Descending", "Cobor\xE2re");
|
|
122
|
-
injectString("ar-SA", "Descending", "\u062A\u0646\u0627\u0632\u0644\u064A");
|
|
123
69
|
injectString("cs", "Sort Options", "Sort Options");
|
|
124
70
|
injectString("da-DK", "Sort Options", "Sorteringsmuligheder");
|
|
125
71
|
injectString("de", "Sort Options", "Sort Options");
|
|
@@ -211,6 +157,7 @@ const SortControl = ({
|
|
|
211
157
|
onClick: () => onSortDirectionToggle(),
|
|
212
158
|
disabled: disabled,
|
|
213
159
|
title: translate("Change sort direction"),
|
|
160
|
+
"aria-label": translate("Change sort direction"),
|
|
214
161
|
children: [directionIcon ? sortDirection === SortDirections.Ascending ? (0, jsx_runtime_1.jsx)(iconFilter3Asc_1.IconFilter3Asc, {
|
|
215
162
|
className: "zen-sort-container__sort-icon",
|
|
216
163
|
size: isDrive ? "huge" : "large"
|
|
@@ -223,9 +170,6 @@ const SortControl = ({
|
|
|
223
170
|
children: [buttonTextValue, ": "]
|
|
224
171
|
}), (0, jsx_runtime_1.jsx)("span", {
|
|
225
172
|
children: (items.find(item => item.id === sortBy) || items[0]).children
|
|
226
|
-
}), (0, jsx_runtime_1.jsxs)("span", {
|
|
227
|
-
className: "zen-visually-hidden",
|
|
228
|
-
children: [" ", sortDirection === SortDirections.Ascending ? translate("Ascending") : translate("Descending")]
|
|
229
173
|
})]
|
|
230
174
|
})]
|
|
231
175
|
}), isSingleItem ? "" : (0, jsx_runtime_1.jsx)(popup_1.Popup, {
|
|
@@ -253,4 +197,4 @@ const SortControl = ({
|
|
|
253
197
|
});
|
|
254
198
|
};
|
|
255
199
|
exports.SortControl = SortControl;
|
|
256
|
-
exports.TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"
|
|
200
|
+
exports.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;
|
|
@@ -27,7 +27,7 @@ const isChildElement = function (child, expectedType) {
|
|
|
27
27
|
}
|
|
28
28
|
return false;
|
|
29
29
|
};
|
|
30
|
-
const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel) => (0, react_1.useMemo)(() => {
|
|
30
|
+
const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, selectAll, turnOffSelectAll, activeId, gridRef, onCloseDetailPanel) => (0, react_1.useMemo)(() => {
|
|
31
31
|
let bulkActions = undefined;
|
|
32
32
|
let tablePagination = undefined;
|
|
33
33
|
let activePage = undefined;
|
|
@@ -42,7 +42,7 @@ const useTableChildren = (children, isMobile, selected, allSelected, clearSelect
|
|
|
42
42
|
}
|
|
43
43
|
if (isChildElement(child, tableBulkActions_1.TableBulkActions.displayName)) {
|
|
44
44
|
const bulkActionButtons = child.props.children || [];
|
|
45
|
-
bulkActions = ((0, jsx_runtime_1.jsx)(bulkActions_1.BulkActions, { gridType: isMobile ? deviceType_1.DeviceType.Mobile : deviceType_1.DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
|
|
45
|
+
bulkActions = ((0, jsx_runtime_1.jsx)(bulkActions_1.BulkActions, { gridType: isMobile ? deviceType_1.DeviceType.Mobile : deviceType_1.DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, onSelectAll: selectAll, turnOffSelectAll: turnOffSelectAll, children: bulkActionButtons }));
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
if (isChildElement(child, tablePagination_1.TablePagination.displayName)) {
|
|
@@ -103,5 +103,5 @@ const useTableChildren = (children, isMobile, selected, allSelected, clearSelect
|
|
|
103
103
|
detailPanel: detailPanel,
|
|
104
104
|
other: other
|
|
105
105
|
};
|
|
106
|
-
}, [children, clearSelection, isMobile, selected, gridRef, allSelected, activeId, onCloseDetailPanel]);
|
|
106
|
+
}, [children, clearSelection, isMobile, selected, gridRef, allSelected, selectAll, turnOffSelectAll, activeId, onCloseDetailPanel]);
|
|
107
107
|
exports.useTableChildren = useTableChildren;
|
|
@@ -65,7 +65,6 @@ const SubColumnsList = ({
|
|
|
65
65
|
showCheckbox: true,
|
|
66
66
|
children: c.title
|
|
67
67
|
})), [columns, sortColumnsInt, lastVisibleColumnId]);
|
|
68
|
-
const allDisabled = (0, react_1.useMemo)(() => items.every(item => item.disabled), [items]);
|
|
69
68
|
const state = columns.reduce((res, c) => {
|
|
70
69
|
res.set(c.id, settings.get(c.id) !== false ? checkboxState_1.CheckboxState.On : checkboxState_1.CheckboxState.Off);
|
|
71
70
|
return res;
|
|
@@ -85,9 +84,8 @@ const SubColumnsList = ({
|
|
|
85
84
|
title: title || translate("Select visible columns"),
|
|
86
85
|
multiselect: true,
|
|
87
86
|
showCheckbox: true,
|
|
88
|
-
onChange: onChangeItem
|
|
89
|
-
|
|
90
|
-
}), [id, items, state, title, translate, onChangeItem, allDisabled]);
|
|
87
|
+
onChange: onChangeItem
|
|
88
|
+
}), [id, items, state, title, translate, onChangeItem]);
|
|
91
89
|
if (!title) {
|
|
92
90
|
return list;
|
|
93
91
|
}
|
|
@@ -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;
|
|
@@ -188,16 +188,8 @@ const useSelectableRows = (columns, entities, isMobile, selectMode, setSelectMod
|
|
|
188
188
|
return translate("Deselect all");
|
|
189
189
|
}, [selectable, selectableState, state, translate]);
|
|
190
190
|
const isEntityChecked = (0, react_1.useCallback)((entity, isNested) => (0, isRowChecked_1.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]);
|
|
191
|
-
const hasSelectable = !!selectable;
|
|
192
|
-
const selectableCheckboxSelectsCurrentPage = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxSelectsCurrentPage;
|
|
193
|
-
const selectableTurnOffSelectAll = selectable === null || selectable === void 0 ? void 0 : selectable.turnOffSelectAll;
|
|
194
|
-
const selectableCheckboxInHeader = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxInHeader;
|
|
195
|
-
const selectableSelectionLimit = selectable === null || selectable === void 0 ? void 0 : selectable.selectionLimit;
|
|
196
|
-
const selectableHeader = selectable === null || selectable === void 0 ? void 0 : selectable.header;
|
|
197
|
-
const checkboxEmitsCurrentPage = selectableCheckboxSelectsCurrentPage !== null && selectableCheckboxSelectsCurrentPage !== void 0 ? selectableCheckboxSelectsCurrentPage : selectableTurnOffSelectAll;
|
|
198
|
-
const checkboxInHeaderValue = selectableCheckboxInHeader !== undefined ? selectableCheckboxInHeader : selectableSelectionLimit !== undefined ? false : undefined;
|
|
199
191
|
const wrapper = (0, react_1.useMemo)(() => {
|
|
200
|
-
if (!
|
|
192
|
+
if (!selectable) {
|
|
201
193
|
return null;
|
|
202
194
|
}
|
|
203
195
|
return {
|
|
@@ -241,7 +233,7 @@ const useSelectableRows = (columns, entities, isMobile, selectMode, setSelectMod
|
|
|
241
233
|
onChange: newValue => {
|
|
242
234
|
var _a, _b;
|
|
243
235
|
if (newValue) {
|
|
244
|
-
const newState =
|
|
236
|
+
const newState = selectable.turnOffSelectAll ? interfaces_1.SelectionState.CurrentPage : interfaces_1.SelectionState.All;
|
|
245
237
|
setState(newState);
|
|
246
238
|
onChangeSelectionState(newState);
|
|
247
239
|
} else {
|
|
@@ -259,18 +251,18 @@ const useSelectableRows = (columns, entities, isMobile, selectMode, setSelectMod
|
|
|
259
251
|
}
|
|
260
252
|
},
|
|
261
253
|
calculateSelectionState: () => selectableState,
|
|
262
|
-
checkboxInHeader:
|
|
263
|
-
header:
|
|
254
|
+
checkboxInHeader: selectable.checkboxInHeader !== undefined ? selectable.checkboxInHeader : selectable.selectionLimit !== undefined ? false : undefined,
|
|
255
|
+
header: selectable.header,
|
|
264
256
|
onSelect: newState => {
|
|
265
257
|
setState(newState);
|
|
266
258
|
onChangeSelectionState(newState);
|
|
267
259
|
},
|
|
268
|
-
turnOffSelectAll:
|
|
260
|
+
turnOffSelectAll: selectable.turnOffSelectAll
|
|
269
261
|
});
|
|
270
262
|
return cell;
|
|
271
263
|
}
|
|
272
264
|
};
|
|
273
|
-
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener,
|
|
265
|
+
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener, selectable, selectableState, state, isMobile, checkboxPlaceholder, isEntityChecked, entities, setSelectMode]);
|
|
274
266
|
const selectableFeedWrapper = (0, react_1.useCallback)((primaryData, secondaryData, entity, isNested) => {
|
|
275
267
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
276
268
|
if (!entity) {
|
package/dist/table/table.js
CHANGED
|
@@ -227,6 +227,12 @@ const TableInner = ({
|
|
|
227
227
|
selected: []
|
|
228
228
|
});
|
|
229
229
|
}, [selectable]);
|
|
230
|
+
const selectAll = (0, react_1.useCallback)(() => {
|
|
231
|
+
selectable === null || selectable === void 0 ? void 0 : selectable.onSelect({
|
|
232
|
+
all: true,
|
|
233
|
+
selected: []
|
|
234
|
+
});
|
|
235
|
+
}, [selectable]);
|
|
230
236
|
const [activeIdInternal, setActiveInternal] = (0, react_1.useState)(undefined);
|
|
231
237
|
const activeId = active !== undefined ? active : activeIdInternal;
|
|
232
238
|
const onClickInternal = (0, react_1.useCallback)(id => setActiveInternal(id === activeIdInternal ? undefined : id), [activeIdInternal, setActiveInternal]);
|
|
@@ -243,7 +249,7 @@ const TableInner = ({
|
|
|
243
249
|
detailPanel,
|
|
244
250
|
footer,
|
|
245
251
|
other
|
|
246
|
-
} = (0, useTableChildren_1.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);
|
|
252
|
+
} = (0, useTableChildren_1.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);
|
|
247
253
|
const hasDetailPanel = !!detailPanel;
|
|
248
254
|
const shouldEnableRowClick = hasDetailPanel || !!onClick;
|
|
249
255
|
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
|
}
|