@geotab/zenith 3.11.0-beta.1 → 3.11.1-beta.0
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 +8 -0
- package/dist/checkboxListWithAction/checkboxListWithAction.js +26 -27
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsList.js +116 -44
- package/dist/index.css +4 -1
- package/dist/menu/utils/useMenuItemCore.js +3 -1
- package/dist/pillExpandable/pillExpandable.js +1 -36
- package/dist/pillExpandable/pillExpandableSimple.d.ts +1 -2
- package/dist/pillExpandable/pillExpandableSimple.js +5 -3
- package/dist/selectList/selectList.actionTypes.d.ts +6 -1
- package/dist/selectList/selectList.actionTypes.js +1 -0
- package/dist/selectList/selectList.d.ts +1 -1
- package/dist/selectList/selectList.helpers.d.ts +1 -1
- package/dist/selectList/selectList.helpers.js +29 -4
- package/dist/selectList/selectList.js +464 -125
- package/dist/selectList/selectList.reducer.js +3 -2
- package/dist/selectList/selectListItem.d.ts +2 -1
- package/dist/selectList/selectListItem.js +19 -2
- package/dist/sortControl/sortControl.js +58 -2
- package/dist/summaryTile/summaryTile.d.ts +3 -1
- package/dist/summaryTile/summaryTile.js +2 -1
- package/dist/table/flexible/columnsList.js +4 -2
- package/dist/utils/localization/translations/ar.json +5 -1
- package/dist/utils/localization/translations/cs.json +5 -1
- package/dist/utils/localization/translations/da-DK.json +5 -1
- package/dist/utils/localization/translations/de.json +5 -1
- package/dist/utils/localization/translations/en.json +5 -1
- package/dist/utils/localization/translations/es.json +5 -1
- package/dist/utils/localization/translations/fi-FI.json +5 -1
- package/dist/utils/localization/translations/fr-FR.json +5 -1
- package/dist/utils/localization/translations/fr.json +5 -1
- package/dist/utils/localization/translations/hu-HU.json +5 -1
- package/dist/utils/localization/translations/id.json +5 -1
- package/dist/utils/localization/translations/it.json +5 -1
- package/dist/utils/localization/translations/ja.json +5 -1
- package/dist/utils/localization/translations/ko-KR.json +5 -1
- package/dist/utils/localization/translations/ms.json +5 -1
- package/dist/utils/localization/translations/nb-NO.json +5 -1
- package/dist/utils/localization/translations/nl.json +5 -1
- package/dist/utils/localization/translations/pl.json +5 -1
- package/dist/utils/localization/translations/pt-BR.json +5 -1
- package/dist/utils/localization/translations/pt-PT.json +5 -1
- package/dist/utils/localization/translations/ro-RO.json +5 -1
- package/dist/utils/localization/translations/sk-SK.json +5 -1
- package/dist/utils/localization/translations/sv.json +5 -1
- package/dist/utils/localization/translations/th.json +5 -1
- package/dist/utils/localization/translations/tr.json +5 -1
- package/dist/utils/localization/translations/zh-Hans.json +5 -1
- package/dist/utils/localization/translations/zh-TW.json +5 -1
- package/esm/checkboxListWithAction/checkboxListWithAction.js +26 -27
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +110 -43
- package/esm/menu/utils/useMenuItemCore.js +3 -1
- package/esm/pillExpandable/pillExpandable.js +1 -36
- package/esm/pillExpandable/pillExpandableSimple.d.ts +1 -2
- package/esm/pillExpandable/pillExpandableSimple.js +5 -3
- package/esm/selectList/selectList.actionTypes.d.ts +6 -1
- package/esm/selectList/selectList.actionTypes.js +1 -0
- package/esm/selectList/selectList.d.ts +1 -1
- package/esm/selectList/selectList.helpers.d.ts +1 -1
- package/esm/selectList/selectList.helpers.js +29 -4
- package/esm/selectList/selectList.js +460 -126
- package/esm/selectList/selectList.reducer.js +3 -2
- package/esm/selectList/selectListItem.d.ts +2 -1
- package/esm/selectList/selectListItem.js +19 -2
- package/esm/sortControl/sortControl.js +58 -2
- package/esm/summaryTile/summaryTile.d.ts +3 -1
- package/esm/summaryTile/summaryTile.js +2 -1
- package/esm/table/flexible/columnsList.js +4 -2
- package/esm/utils/localization/translations/ar.json +5 -1
- package/esm/utils/localization/translations/cs.json +5 -1
- package/esm/utils/localization/translations/da-DK.json +5 -1
- package/esm/utils/localization/translations/de.json +5 -1
- package/esm/utils/localization/translations/en.json +5 -1
- package/esm/utils/localization/translations/es.json +5 -1
- package/esm/utils/localization/translations/fi-FI.json +5 -1
- package/esm/utils/localization/translations/fr-FR.json +5 -1
- package/esm/utils/localization/translations/fr.json +5 -1
- package/esm/utils/localization/translations/hu-HU.json +5 -1
- package/esm/utils/localization/translations/id.json +5 -1
- package/esm/utils/localization/translations/it.json +5 -1
- package/esm/utils/localization/translations/ja.json +5 -1
- package/esm/utils/localization/translations/ko-KR.json +5 -1
- package/esm/utils/localization/translations/ms.json +5 -1
- package/esm/utils/localization/translations/nb-NO.json +5 -1
- package/esm/utils/localization/translations/nl.json +5 -1
- package/esm/utils/localization/translations/pl.json +5 -1
- package/esm/utils/localization/translations/pt-BR.json +5 -1
- package/esm/utils/localization/translations/pt-PT.json +5 -1
- package/esm/utils/localization/translations/ro-RO.json +5 -1
- package/esm/utils/localization/translations/sk-SK.json +5 -1
- package/esm/utils/localization/translations/sv.json +5 -1
- package/esm/utils/localization/translations/th.json +5 -1
- package/esm/utils/localization/translations/tr.json +5 -1
- package/esm/utils/localization/translations/zh-Hans.json +5 -1
- package/esm/utils/localization/translations/zh-TW.json +5 -1
- package/package.json +1 -1
|
@@ -239,6 +239,8 @@
|
|
|
239
239
|
"This field is required.": "Bu alan zorunludur.",
|
|
240
240
|
"On": "Açık",
|
|
241
241
|
"Off": "Kapalı",
|
|
242
|
+
"Checked": "İşaretlendi",
|
|
243
|
+
"Unchecked": "İşaretlenmedi",
|
|
242
244
|
"Scroll left": "Sola kaydır",
|
|
243
245
|
"Scroll right": "Sağa Kaydır",
|
|
244
246
|
"Send feedback": "Geri bildirim gönder",
|
|
@@ -323,5 +325,7 @@
|
|
|
323
325
|
"Supported Formats:": "Supported Formats:",
|
|
324
326
|
"Upload files.": "Upload files.",
|
|
325
327
|
"File upload area": "File upload area",
|
|
326
|
-
"Uploaded": "Uploaded"
|
|
328
|
+
"Uploaded": "Uploaded",
|
|
329
|
+
"Ascending": "Artan",
|
|
330
|
+
"Descending": "Azalan"
|
|
327
331
|
}
|
|
@@ -239,6 +239,8 @@
|
|
|
239
239
|
"This field is required.": "该字段为必填项。",
|
|
240
240
|
"On": "开启",
|
|
241
241
|
"Off": "关闭",
|
|
242
|
+
"Checked": "已选中",
|
|
243
|
+
"Unchecked": "未选中",
|
|
242
244
|
"Scroll left": "向左滚动",
|
|
243
245
|
"Scroll right": "向右滚动",
|
|
244
246
|
"Send feedback": "发送反馈",
|
|
@@ -323,5 +325,7 @@
|
|
|
323
325
|
"Supported Formats:": "Supported Formats:",
|
|
324
326
|
"Upload files.": "Upload files.",
|
|
325
327
|
"File upload area": "File upload area",
|
|
326
|
-
"Uploaded": "Uploaded"
|
|
328
|
+
"Uploaded": "Uploaded",
|
|
329
|
+
"Ascending": "升序",
|
|
330
|
+
"Descending": "降序"
|
|
327
331
|
}
|
|
@@ -248,6 +248,8 @@
|
|
|
248
248
|
"This field is required.": "此欄位為必填。",
|
|
249
249
|
"On": "開啟",
|
|
250
250
|
"Off": "關閉",
|
|
251
|
+
"Checked": "已勾選",
|
|
252
|
+
"Unchecked": "未勾選",
|
|
251
253
|
"Loading": "載入中",
|
|
252
254
|
"Value": "值",
|
|
253
255
|
"Data": "資料",
|
|
@@ -323,5 +325,7 @@
|
|
|
323
325
|
"Supported Formats:": "Supported Formats:",
|
|
324
326
|
"Upload files.": "Upload files.",
|
|
325
327
|
"File upload area": "File upload area",
|
|
326
|
-
"Uploaded": "Uploaded"
|
|
328
|
+
"Uploaded": "Uploaded",
|
|
329
|
+
"Ascending": "遞增",
|
|
330
|
+
"Descending": "遞減"
|
|
327
331
|
}
|
|
@@ -184,18 +184,10 @@ export const CheckboxListWithAction = ({
|
|
|
184
184
|
});
|
|
185
185
|
return elements;
|
|
186
186
|
}, [options]);
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
rowIndex,
|
|
192
|
-
type,
|
|
193
|
-
blocked
|
|
194
|
-
}) => {
|
|
195
|
-
const isActive = rowIndex === newRowIndex && type === newElementType && !blocked;
|
|
196
|
-
element.setAttribute("tabindex", isActive ? "0" : "-1");
|
|
197
|
-
});
|
|
198
|
-
}, [getFocusableElements]);
|
|
187
|
+
const getTabIndex = useCallback((rowIndex, elementType, blocked) => {
|
|
188
|
+
if (blocked) return -1;
|
|
189
|
+
return rowIndex === focusedRowIndex && elementType === focusedElementType ? 0 : -1;
|
|
190
|
+
}, [focusedRowIndex, focusedElementType]);
|
|
199
191
|
const handleKeyDown = useCallback(
|
|
200
192
|
// eslint-disable-next-line complexity
|
|
201
193
|
e => {
|
|
@@ -269,7 +261,6 @@ export const CheckboxListWithAction = ({
|
|
|
269
261
|
e.preventDefault();
|
|
270
262
|
setFocusedRowIndex(newRowIndex);
|
|
271
263
|
setFocusedElementType(newElementType);
|
|
272
|
-
updateTabIndex(newRowIndex, newElementType);
|
|
273
264
|
// Find and focus the target element
|
|
274
265
|
const targetElement = elements.find(({
|
|
275
266
|
rowIndex,
|
|
@@ -278,7 +269,7 @@ export const CheckboxListWithAction = ({
|
|
|
278
269
|
}) => rowIndex === newRowIndex && type === newElementType && !blocked);
|
|
279
270
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.element.focus();
|
|
280
271
|
}
|
|
281
|
-
}, [getFocusableElements, options, focusedRowIndex, focusedElementType, checkboxId, onChange, handleTab
|
|
272
|
+
}, [getFocusableElements, options, focusedRowIndex, focusedElementType, checkboxId, onChange, handleTab]);
|
|
282
273
|
const handleFocus = useCallback(e => {
|
|
283
274
|
const elements = getFocusableElements();
|
|
284
275
|
const focusedElement = e.target;
|
|
@@ -288,10 +279,9 @@ export const CheckboxListWithAction = ({
|
|
|
288
279
|
if (targetElementInfo && !targetElementInfo.blocked && (targetElementInfo.rowIndex !== focusedRowIndex || targetElementInfo.type !== focusedElementType)) {
|
|
289
280
|
setFocusedRowIndex(targetElementInfo.rowIndex);
|
|
290
281
|
setFocusedElementType(targetElementInfo.type);
|
|
291
|
-
updateTabIndex(targetElementInfo.rowIndex, targetElementInfo.type);
|
|
292
282
|
}
|
|
293
|
-
}, [focusedRowIndex, focusedElementType, getFocusableElements
|
|
294
|
-
// Initialize
|
|
283
|
+
}, [focusedRowIndex, focusedElementType, getFocusableElements]);
|
|
284
|
+
// Initialize focusedRowIndex when options first become available
|
|
295
285
|
useEffect(() => {
|
|
296
286
|
if (options && options.length > 0 && !isInitialized.current) {
|
|
297
287
|
// Find first non-blocked row
|
|
@@ -302,17 +292,25 @@ export const CheckboxListWithAction = ({
|
|
|
302
292
|
if (firstValidRow < options.length) {
|
|
303
293
|
setFocusedRowIndex(firstValidRow);
|
|
304
294
|
setFocusedElementType("checkbox");
|
|
305
|
-
updateTabIndex(firstValidRow, "checkbox");
|
|
306
295
|
isInitialized.current = true;
|
|
307
296
|
}
|
|
308
297
|
}
|
|
309
|
-
}, [options
|
|
310
|
-
//
|
|
298
|
+
}, [options]);
|
|
299
|
+
// Correct focusedRowIndex if options shrinks or the focused row becomes blocked after init
|
|
311
300
|
useEffect(() => {
|
|
312
|
-
if (isInitialized.current) {
|
|
313
|
-
|
|
301
|
+
if (!isInitialized.current || !options || options.length === 0) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const isInBounds = focusedRowIndex < options.length;
|
|
305
|
+
if (isInBounds && !options[focusedRowIndex].blocked) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const firstValid = options.findIndex(opt => !opt.blocked);
|
|
309
|
+
if (firstValid >= 0) {
|
|
310
|
+
setFocusedRowIndex(firstValid);
|
|
311
|
+
setFocusedElementType("checkbox");
|
|
314
312
|
}
|
|
315
|
-
}, [
|
|
313
|
+
}, [options, focusedRowIndex]);
|
|
316
314
|
const getLabelColorInfo = (color, withRightPadding, isHidden, extraArgs) => {
|
|
317
315
|
if (!color) {
|
|
318
316
|
return null;
|
|
@@ -342,7 +340,7 @@ export const CheckboxListWithAction = ({
|
|
|
342
340
|
})
|
|
343
341
|
}));
|
|
344
342
|
};
|
|
345
|
-
const renderLabel = (option, lbl, ttl) => {
|
|
343
|
+
const renderLabel = (option, lbl, ttl, rowIndex) => {
|
|
346
344
|
const additionalTitle = option.countSelectedChild && option.isWithAction ? translate("Number of selected child groups - {count}").replace("{count}", option.countSelectedChild.toString()) : "";
|
|
347
345
|
const title = option.isWithAction ? translate("View {groupName} children").replace("{groupName}", ttl).concat(additionalTitle ? `${". "}${additionalTitle}` : "") : translate("Toggle {groupName} filter").replace("{groupName}", ttl);
|
|
348
346
|
const classN = classNames(["zen-checkbox-list-with-action__label", "zen-ellipsis", option.isWithAction ? "zen-checkbox-list-with-action__label--action" : ""]);
|
|
@@ -371,7 +369,8 @@ export const CheckboxListWithAction = ({
|
|
|
371
369
|
onClick: handleClick,
|
|
372
370
|
title: title,
|
|
373
371
|
className: classN,
|
|
374
|
-
tabIndex:
|
|
372
|
+
tabIndex: getTabIndex(rowIndex, "button", option.blocked),
|
|
373
|
+
disabled: option.blocked
|
|
375
374
|
}, otherArgs, {
|
|
376
375
|
children: childEl
|
|
377
376
|
})) : _jsx("div", {
|
|
@@ -407,7 +406,7 @@ export const CheckboxListWithAction = ({
|
|
|
407
406
|
children: optionsArr.map((opt, ind) => {
|
|
408
407
|
const titleForRender = opt.title || opt.label;
|
|
409
408
|
const labelForRender = selectSearchTerm(opt.label);
|
|
410
|
-
const labelElement = renderLabel(opt, labelForRender, titleForRender);
|
|
409
|
+
const labelElement = renderLabel(opt, labelForRender, titleForRender, ind);
|
|
411
410
|
return _jsxs("li", {
|
|
412
411
|
className: classNames(["zen-checkbox-list-with-action__action-item", opt.isWithAction ? "zen-checkbox-list-with-action__action-item--action" : ""]),
|
|
413
412
|
"data-item": opt.property,
|
|
@@ -421,7 +420,7 @@ export const CheckboxListWithAction = ({
|
|
|
421
420
|
title: translate("Toggle {groupName} filter").replace("{groupName}", titleForRender),
|
|
422
421
|
describedBy: opt.isWithAction ? navigationInstructionsId : undefined,
|
|
423
422
|
"data-indeterminate": opt.partialChecked,
|
|
424
|
-
tabIndex:
|
|
423
|
+
tabIndex: getTabIndex(ind, "checkbox", opt.blocked),
|
|
425
424
|
children: opt.isWithAction ? null : labelElement
|
|
426
425
|
}), opt.isWithAction && labelElement]
|
|
427
426
|
}, `li_${ind}_${opt.property}`);
|
|
@@ -1,50 +1,117 @@
|
|
|
1
|
+
import { injectString } from "../../../utils/localization/translationsDictionary";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useId, useMemo } from "react";
|
|
3
4
|
import { groupColumns } from "../../extensions/groupColumns";
|
|
4
5
|
import { SelectList } from "../../../selectList/selectList";
|
|
5
6
|
import { CheckboxState } from "../../../checkbox/checkboxState";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
import { useLanguage } from "../../../utils/localization/useLanguage";
|
|
8
|
+
injectString("cs", "Select visible columns", "Vyberte viditeln\xE9 sloupce");
|
|
9
|
+
injectString("da-DK", "Select visible columns", "V\xE6lg synlige kolonner");
|
|
10
|
+
injectString("de", "Select visible columns", "Sichtbare Spalten ausw\xE4hlen");
|
|
11
|
+
injectString("en", "Select visible columns", "Select visible columns");
|
|
12
|
+
injectString("es", "Select visible columns", "Seleccionar columnas visibles");
|
|
13
|
+
injectString("fi-FI", "Select visible columns", "Valitse n\xE4kyv\xE4t sarakkeet");
|
|
14
|
+
injectString("fr", "Select visible columns", "S\xE9lectionner les colonnes visibles");
|
|
15
|
+
injectString("fr-FR", "Select visible columns", "S\xE9lectionner les colonnes visibles");
|
|
16
|
+
injectString("hu-HU", "Select visible columns", "L\xE1that\xF3 oszlopok kiv\xE1laszt\xE1sa");
|
|
17
|
+
injectString("id", "Select visible columns", "Pilih kolom yang terlihat");
|
|
18
|
+
injectString("it", "Select visible columns", "Selezionare colonne visibili");
|
|
19
|
+
injectString("ja", "Select visible columns", "\u8868\u793A\u5217\u3092\u9078\u629E");
|
|
20
|
+
injectString("ko-KR", "Select visible columns", "\uD45C\uC2DC\uB418\uB294 \uC5F4 \uC120\uD0DD");
|
|
21
|
+
injectString("ms", "Select visible columns", "Pilih lajur yang boleh dilihat");
|
|
22
|
+
injectString("nb-NO", "Select visible columns", "Velg synlige kolonner");
|
|
23
|
+
injectString("nl", "Select visible columns", "Zichtbare kolommen selecteren");
|
|
24
|
+
injectString("pl", "Select visible columns", "Wybierz widoczne kolumny");
|
|
25
|
+
injectString("pt-BR", "Select visible columns", "Selecionar colunas vis\xEDveis");
|
|
26
|
+
injectString("pt-PT", "Select visible columns", "Selecionar colunas vis\xEDveis");
|
|
27
|
+
injectString("sk-SK", "Select visible columns", "Vybra\u0165 vidite\u013En\xE9 st\u013Apce");
|
|
28
|
+
injectString("sv", "Select visible columns", "V\xE4lj synbara kolumner");
|
|
29
|
+
injectString("th", "Select visible columns", "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C\u0E17\u0E35\u0E48\u0E21\u0E2D\u0E07\u0E40\u0E2B\u0E47\u0E19\u0E44\u0E14\u0E49");
|
|
30
|
+
injectString("tr", "Select visible columns", "G\xF6r\xFCn\xFCr s\xFCtunlar\u0131 se\xE7");
|
|
31
|
+
injectString("zh-Hans", "Select visible columns", "\u9009\u62E9\u53EF\u89C1\u5217");
|
|
32
|
+
injectString("zh-TW", "Select visible columns", "\u9078\u53D6\u53EF\u898B\u6B04");
|
|
33
|
+
injectString("ro-RO", "Select visible columns", "Selecta\u021Bi coloanele vizibile");
|
|
34
|
+
injectString("ar-SA", "Select visible columns", "\u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0627\u0644\u0645\u0631\u0626\u064A\u0629");
|
|
35
|
+
const SubColumnsList = ({
|
|
36
|
+
title,
|
|
37
|
+
columns,
|
|
38
|
+
settings,
|
|
39
|
+
disabledColumns,
|
|
40
|
+
onChange,
|
|
41
|
+
sortColumns
|
|
42
|
+
}) => {
|
|
43
|
+
const id = useId();
|
|
44
|
+
const {
|
|
45
|
+
translate
|
|
46
|
+
} = useLanguage();
|
|
47
|
+
const sortColumnsInt = useCallback((a, b) => {
|
|
48
|
+
if (sortColumns) {
|
|
49
|
+
return sortColumns(a.title, b.title);
|
|
36
50
|
}
|
|
37
|
-
return
|
|
51
|
+
return 0;
|
|
52
|
+
}, [sortColumns]);
|
|
53
|
+
const items = useMemo(() => columns.sort(sortColumnsInt).map(c => ({
|
|
54
|
+
id: c.id,
|
|
55
|
+
title: c.title,
|
|
56
|
+
disabled: (disabledColumns === null || disabledColumns === void 0 ? void 0 : disabledColumns.includes(c.name)) || false,
|
|
57
|
+
showCheckbox: true,
|
|
58
|
+
children: c.title
|
|
59
|
+
})), [columns, disabledColumns, sortColumnsInt]);
|
|
60
|
+
const allDisabled = useMemo(() => items.every(item => item.disabled), [items]);
|
|
61
|
+
const state = columns.reduce((res, c) => {
|
|
62
|
+
res.set(c.id, settings.get(c.name) !== false ? CheckboxState.On : CheckboxState.Off);
|
|
63
|
+
return res;
|
|
64
|
+
}, new Map());
|
|
65
|
+
const onChangeItem = useCallback(newState => {
|
|
66
|
+
const newSettings = new Map(settings);
|
|
67
|
+
newState.forEach((stateVal, itemId) => {
|
|
68
|
+
var _a;
|
|
69
|
+
newSettings.set((_a = columns.find(c => c.id === itemId)) === null || _a === void 0 ? void 0 : _a.name, stateVal === CheckboxState.On);
|
|
70
|
+
});
|
|
71
|
+
onChange && onChange(newSettings);
|
|
72
|
+
}, [columns, settings, onChange]);
|
|
73
|
+
const list = useMemo(() => _jsx(SelectList, {
|
|
74
|
+
id: id,
|
|
75
|
+
items: items,
|
|
76
|
+
value: state,
|
|
77
|
+
title: title || translate("Select visible columns"),
|
|
78
|
+
multiselect: true,
|
|
79
|
+
showCheckbox: true,
|
|
80
|
+
onChange: onChangeItem,
|
|
81
|
+
disabled: allDisabled
|
|
82
|
+
}), [id, items, state, title, translate, onChangeItem, allDisabled]);
|
|
83
|
+
if (!title) {
|
|
84
|
+
return list;
|
|
85
|
+
}
|
|
86
|
+
return _jsxs("div", {
|
|
87
|
+
className: "zen-columns-list__sub-section",
|
|
88
|
+
children: [_jsx("div", {
|
|
89
|
+
className: "zen-columns-list__title zen-ellipsis",
|
|
90
|
+
children: title
|
|
91
|
+
}), list]
|
|
92
|
+
});
|
|
38
93
|
};
|
|
39
|
-
export function ColumnSettingsList({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
94
|
+
export function ColumnSettingsList({
|
|
95
|
+
columns,
|
|
96
|
+
settings,
|
|
97
|
+
disabledColumns,
|
|
98
|
+
onChange,
|
|
99
|
+
sortGroups,
|
|
100
|
+
sortColumns
|
|
101
|
+
}) {
|
|
102
|
+
const groupped = groupColumns(columns);
|
|
103
|
+
const sortGroupsInt = useCallback((a, b) => {
|
|
104
|
+
if (sortGroups) {
|
|
105
|
+
return sortGroups(a[0], b[0]);
|
|
106
|
+
}
|
|
107
|
+
return 0;
|
|
108
|
+
}, [sortGroups]);
|
|
109
|
+
return Array.from(groupped.entries()).sort(sortGroupsInt).map(([title, cs]) => _jsx(SubColumnsList, {
|
|
110
|
+
title: title,
|
|
111
|
+
columns: cs,
|
|
112
|
+
settings: settings,
|
|
113
|
+
disabledColumns: disabledColumns,
|
|
114
|
+
onChange: onChange,
|
|
115
|
+
sortColumns: sortColumns
|
|
116
|
+
}, cs.map(c => c.id).join("-")));
|
|
117
|
+
}
|
|
@@ -3,13 +3,15 @@ import { PathContext } from "../contexts/pathContext";
|
|
|
3
3
|
import { MenuAlignmentContext } from "../../header/headerContext";
|
|
4
4
|
import { buildMenuContent } from "./buildMenuContent";
|
|
5
5
|
import { useMenuItemKeyboardNav } from "./useMenuItemKeyboardNav";
|
|
6
|
+
import { useRTLAlignment } from "../../utils/localization/useRTLAlignment";
|
|
6
7
|
/**
|
|
7
8
|
* Core menu item logic shared between MenuItem and createMenuItem.
|
|
8
9
|
* Consolidates context access, state computation, and callback memoization.
|
|
9
10
|
*/
|
|
10
11
|
export const useMenuItemCore = ({ id, children, className, alignment, isMobile = false, setIsOpen, onClick, onOpenChange }) => {
|
|
11
12
|
const alignmentContext = useContext(MenuAlignmentContext);
|
|
12
|
-
const
|
|
13
|
+
const rawAlignment = alignment || alignmentContext.alignment || "right-top";
|
|
14
|
+
const contentAlignment = useRTLAlignment(rawAlignment);
|
|
13
15
|
const { path, onOpenBranch, closeBranch, navigatedViaKeyboardRef } = useContext(PathContext);
|
|
14
16
|
const ref = useRef(null);
|
|
15
17
|
const content = useMemo(() => buildMenuContent(children, isMobile, setIsOpen, className), [children, isMobile, setIsOpen, className]);
|
|
@@ -46,33 +46,6 @@ injectString("zh-Hans", "View all", "\u67E5\u770B\u5168\u90E8");
|
|
|
46
46
|
injectString("zh-TW", "View all", "\u6AA2\u8996\u5168\u90E8");
|
|
47
47
|
injectString("ro-RO", "View all", "Vezi tot");
|
|
48
48
|
injectString("ar-SA", "View all", "\u0639\u0631\u0636 \u0627\u0644\u0643\u0644");
|
|
49
|
-
injectString("cs", "Expand", "Rozbalit");
|
|
50
|
-
injectString("da-DK", "Expand", "Udvid");
|
|
51
|
-
injectString("de", "Expand", "Erweitern");
|
|
52
|
-
injectString("en", "Expand", "Expand");
|
|
53
|
-
injectString("es", "Expand", "Expandir");
|
|
54
|
-
injectString("fi-FI", "Expand", "Laajenna");
|
|
55
|
-
injectString("fr", "Expand", "D\xE9velopper");
|
|
56
|
-
injectString("fr-FR", "Expand", "D\xE9velopper");
|
|
57
|
-
injectString("hu-HU", "Expand", "B\u0151v\xEDtsd ki");
|
|
58
|
-
injectString("id", "Expand", "Perluas");
|
|
59
|
-
injectString("it", "Expand", "Espandere");
|
|
60
|
-
injectString("ja", "Expand", "\u5C55\u958B");
|
|
61
|
-
injectString("ko-KR", "Expand", "\uD655\uC7A5");
|
|
62
|
-
injectString("ms", "Expand", "Kembangkan");
|
|
63
|
-
injectString("nb-NO", "Expand", "Utvide");
|
|
64
|
-
injectString("nl", "Expand", "Uitvouwen");
|
|
65
|
-
injectString("pl", "Expand", "Rozwi\u0144");
|
|
66
|
-
injectString("pt-BR", "Expand", "Expandir");
|
|
67
|
-
injectString("pt-PT", "Expand", "Expandir");
|
|
68
|
-
injectString("sk-SK", "Expand", "Roz\u0161\xEDr.");
|
|
69
|
-
injectString("sv", "Expand", "Expandera");
|
|
70
|
-
injectString("th", "Expand", "\u0E02\u0E22\u0E32\u0E22");
|
|
71
|
-
injectString("tr", "Expand", "Geni\u015Flet");
|
|
72
|
-
injectString("zh-Hans", "Expand", "\u5C55\u5F00");
|
|
73
|
-
injectString("zh-TW", "Expand", "\u5C55\u958B");
|
|
74
|
-
injectString("ro-RO", "Expand", "Extinde\u021Bi");
|
|
75
|
-
injectString("ar-SA", "Expand", "\u062A\u0648\u0633\u064A\u0639");
|
|
76
49
|
const MAX_PILLS_TO_DISPLAY_IN_POPUP = 2;
|
|
77
50
|
const PillContext = createContext({
|
|
78
51
|
level: 0,
|
|
@@ -193,9 +166,6 @@ const PillExpandableChild = ({
|
|
|
193
166
|
}) => {
|
|
194
167
|
const pillId = useId();
|
|
195
168
|
const descriptionId = useId();
|
|
196
|
-
const {
|
|
197
|
-
translate
|
|
198
|
-
} = useLanguage();
|
|
199
169
|
const {
|
|
200
170
|
level,
|
|
201
171
|
expandedChildPillIds,
|
|
@@ -248,7 +218,6 @@ const PillExpandableChild = ({
|
|
|
248
218
|
text: text,
|
|
249
219
|
expanded: isExpanded,
|
|
250
220
|
onExpand: handleChildToggle,
|
|
251
|
-
expandAriaText: translate("Expand"),
|
|
252
221
|
type: type,
|
|
253
222
|
errorHandler: errorHandler,
|
|
254
223
|
descriptionId: descriptionId
|
|
@@ -431,9 +400,6 @@ const PillExpandableBase = ({
|
|
|
431
400
|
}) => {
|
|
432
401
|
const popupId = useId();
|
|
433
402
|
const descriptionId = useId();
|
|
434
|
-
const {
|
|
435
|
-
translate
|
|
436
|
-
} = useLanguage();
|
|
437
403
|
const isDrive = useDrive();
|
|
438
404
|
const [isMobile, setIsMobile] = useState(false);
|
|
439
405
|
const handleDeviceTypeChange = useCallback(deviceType => {
|
|
@@ -595,7 +561,6 @@ const PillExpandableBase = ({
|
|
|
595
561
|
icon: effectiveIcon,
|
|
596
562
|
text: text,
|
|
597
563
|
expanded: isPopupOpen,
|
|
598
|
-
expandAriaText: translate("Expand"),
|
|
599
564
|
ref: triggerRef,
|
|
600
565
|
type: type,
|
|
601
566
|
errorHandler: errorHandler,
|
|
@@ -635,4 +600,4 @@ const PillExpandableBase = ({
|
|
|
635
600
|
const PillExpandableMemo = memo(PillExpandableBase);
|
|
636
601
|
PillExpandableMemo.displayName = "PillExpandable";
|
|
637
602
|
export const PillExpandable = PillExpandableMemo;
|
|
638
|
-
export const TRANSLATIONS = ["
|
|
603
|
+
export const TRANSLATIONS = ["View all"];
|
|
@@ -4,7 +4,6 @@ import { IIcon } from "../icons/icon";
|
|
|
4
4
|
interface IPillExpandableSimple extends IPillExpandableBase {
|
|
5
5
|
includeExpandIcon?: boolean;
|
|
6
6
|
expanded?: boolean;
|
|
7
|
-
expandAriaText?: string;
|
|
8
7
|
onExpand?: () => void;
|
|
9
8
|
icon?: FC<IIcon> | false;
|
|
10
9
|
isBeta?: boolean;
|
|
@@ -14,7 +13,7 @@ interface IPillExpandableSimple extends IPillExpandableBase {
|
|
|
14
13
|
type?: TPillType;
|
|
15
14
|
}
|
|
16
15
|
export declare const PillExpandableSimple: {
|
|
17
|
-
({ onExpand,
|
|
16
|
+
({ onExpand, text, expanded, includeExpandIcon, type, icon, isBeta, isMobile, ref, className, descriptionId }: IPillExpandableSimple): import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
displayName: string;
|
|
19
18
|
};
|
|
20
19
|
export {};
|
|
@@ -5,7 +5,9 @@ import { IconChevronTop } from "../icons/iconChevronTop";
|
|
|
5
5
|
import { IconChevronBottom } from "../icons/iconChevronBottom";
|
|
6
6
|
import { IconException } from "../icons/iconException";
|
|
7
7
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
8
|
-
export const PillExpandableSimple = ({ onExpand,
|
|
8
|
+
export const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIcon = true, type = "warning", icon = IconException, isBeta, isMobile, ref, className, descriptionId
|
|
9
|
+
// eslint-disable-next-line complexity
|
|
10
|
+
}) => {
|
|
9
11
|
const iconDriveClassName = useDriveClassName("icon");
|
|
10
12
|
const containerDriveClassName = useDriveClassName("zen-status-pill__container");
|
|
11
13
|
const onExpandHandler = useCallback(() => {
|
|
@@ -22,7 +24,7 @@ export const PillExpandableSimple = ({ onExpand, expandAriaText, text, expanded,
|
|
|
22
24
|
containerDriveClassName || "",
|
|
23
25
|
className || "",
|
|
24
26
|
"zen-ellipsis"
|
|
25
|
-
]), ref: ref, onClick: onExpandHandler, tabIndex: !includeExpandIcon ? -1 : undefined, "aria-describedby": descriptionId, children: [icon !== false && (_jsx("div", { className: classNames([
|
|
27
|
+
]), ref: ref, onClick: onExpandHandler, tabIndex: !includeExpandIcon ? -1 : undefined, "aria-expanded": includeExpandIcon ? (expanded !== null && expanded !== void 0 ? expanded : false) : undefined, "aria-describedby": descriptionId, children: [icon !== false && (_jsx("div", { className: classNames([
|
|
26
28
|
"zen-status-pill__icon",
|
|
27
29
|
`zen-status-pill__icon--${type}`,
|
|
28
30
|
isLargeIcon ? "zen-status-pill__icon--large" : "",
|
|
@@ -34,7 +36,7 @@ export const PillExpandableSimple = ({ onExpand, expandAriaText, text, expanded,
|
|
|
34
36
|
`zen-status-pill__text--${type}`,
|
|
35
37
|
"zen-ellipsis",
|
|
36
38
|
isTextCentered ? "zen-status-pill__text--centered" : ""
|
|
37
|
-
]), children: text })), includeExpandIcon && (_jsx("div", { className: `zen-status-pill__expand-button zen-status-pill__expand-button--${type}`,
|
|
39
|
+
]), children: text })), includeExpandIcon && (_jsx("div", { className: `zen-status-pill__expand-button zen-status-pill__expand-button--${type}`, children: _jsx("div", { className: "zen-status-pill__icon", children: createElement(ChevronIcon, {
|
|
38
40
|
size: iconSize
|
|
39
41
|
}) }) }))] }));
|
|
40
42
|
};
|
|
@@ -9,6 +9,7 @@ export declare enum ListAction {
|
|
|
9
9
|
FocusPrev = "focusPrev",
|
|
10
10
|
FocusNextPage = "focusNextPage",
|
|
11
11
|
FocusPrevPage = "focusPrevPage",
|
|
12
|
+
FocusItem = "focusItem",
|
|
12
13
|
SelectFirst = "selectFirst",
|
|
13
14
|
SelectLast = "selectLast",
|
|
14
15
|
SelectNext = "selectNext",
|
|
@@ -37,6 +38,9 @@ interface IToggleCurrentPayload {
|
|
|
37
38
|
interface IFocusItemPayload {
|
|
38
39
|
items: ISelectListItem[];
|
|
39
40
|
}
|
|
41
|
+
interface IFocusItemByIndexPayload {
|
|
42
|
+
index: number;
|
|
43
|
+
}
|
|
40
44
|
interface ISetLevelPayload {
|
|
41
45
|
items: ISelectListItem[];
|
|
42
46
|
}
|
|
@@ -75,6 +79,7 @@ interface IResetPayload {
|
|
|
75
79
|
type TChangeItemStateAction = IAction<ListAction.ChangeItemState, IChangeItemStatePayload>;
|
|
76
80
|
type TToggleCurrentAction = IAction<ListAction.ToggleCurrent, IToggleCurrentPayload>;
|
|
77
81
|
type TFocusItemAction = IAction<ListAction.FocusFirst | ListAction.FocusLast | ListAction.FocusNext | ListAction.FocusPrev, IFocusItemPayload>;
|
|
82
|
+
type TFocusItemByIndexAction = IAction<ListAction.FocusItem, IFocusItemByIndexPayload>;
|
|
78
83
|
type TFocusNextPageItemAction = IAction<ListAction.FocusNextPage | ListAction.FocusPrevPage, IFocusNextPageItemPayload>;
|
|
79
84
|
type TSelectItemAction = IAction<ListAction.SelectFirst | ListAction.SelectLast | ListAction.SelectNext | ListAction.SelectPrev, ISelectItemPayload>;
|
|
80
85
|
type TSelectItemsAction = IAction<ListAction.SelectAllToTheBeginning | ListAction.SelectAllToTheEnd, ISelectItemsPayload>;
|
|
@@ -84,5 +89,5 @@ type TSetLevelAction = IAction<ListAction.SetLevel, ISetLevelPayload | undefined
|
|
|
84
89
|
type TFocusAction = IAction<ListAction.Focus, IFocusPayload>;
|
|
85
90
|
type TBlurAction = IAction<ListAction.Blur, IBlurPayload>;
|
|
86
91
|
type TResetAction = IAction<ListAction.Reset, IResetPayload>;
|
|
87
|
-
export type TAction = TChangeItemStateAction | TToggleCurrentAction | TFocusItemAction | TFocusNextPageItemAction | TSelectItemAction | TSelectItemsAction | TToggleAllAction | TSearchItemAction | TFocusAction | TBlurAction | TResetAction | TSetLevelAction;
|
|
92
|
+
export type TAction = TChangeItemStateAction | TToggleCurrentAction | TFocusItemAction | TFocusNextPageItemAction | TFocusItemByIndexAction | TSelectItemAction | TSelectItemsAction | TToggleAllAction | TSearchItemAction | TFocusAction | TBlurAction | TResetAction | TSetLevelAction;
|
|
88
93
|
export {};
|
|
@@ -8,6 +8,7 @@ export var ListAction;
|
|
|
8
8
|
ListAction["FocusPrev"] = "focusPrev";
|
|
9
9
|
ListAction["FocusNextPage"] = "focusNextPage";
|
|
10
10
|
ListAction["FocusPrevPage"] = "focusPrevPage";
|
|
11
|
+
ListAction["FocusItem"] = "focusItem";
|
|
11
12
|
ListAction["SelectFirst"] = "selectFirst";
|
|
12
13
|
ListAction["SelectLast"] = "selectLast";
|
|
13
14
|
ListAction["SelectNext"] = "selectNext";
|
|
@@ -36,6 +36,6 @@ export interface IListStateProps {
|
|
|
36
36
|
items: ISelectListItem[];
|
|
37
37
|
}
|
|
38
38
|
export declare const defaultListItemHeight = 40;
|
|
39
|
-
export declare const SelectList: ({ items: outerItems, value, multiselect, selectItemOnFocus, forceSelection, disabled, onChange, onClick, ...rest }: ISelectList) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const SelectList: ({ items: outerItems, value, multiselect, selectItemOnFocus, forceSelection, showCheckbox, disabled, onChange, onClick, ...rest }: ISelectList) => import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export declare const PassiveSelectList: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
41
41
|
export {};
|
|
@@ -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[]) => number;
|
|
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;
|
|
@@ -35,19 +35,44 @@ export const searchItemIndex = (items, searchStr) => {
|
|
|
35
35
|
return content.toLocaleLowerCase().indexOf(searchStr.toLocaleLowerCase()) > -1;
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
export const getFirstIndex = (items) =>
|
|
39
|
-
export const getLastIndex = (items) =>
|
|
38
|
+
export const getFirstIndex = (items) => items.findIndex(item => !item.disabled);
|
|
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
|
+
};
|
|
40
47
|
export const getNextIndex = (currIndex, items) => {
|
|
48
|
+
var _a;
|
|
41
49
|
if (items.length === 0) {
|
|
42
50
|
return -1;
|
|
43
51
|
}
|
|
44
|
-
|
|
52
|
+
let nextIndex = currIndex + 1 >= items.length ? 0 : currIndex + 1;
|
|
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;
|
|
45
61
|
};
|
|
46
62
|
export const getPrevIndex = (currIndex, items) => {
|
|
63
|
+
var _a;
|
|
47
64
|
if (items.length === 0) {
|
|
48
65
|
return -1;
|
|
49
66
|
}
|
|
50
|
-
|
|
67
|
+
let prevIndex = currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
|
|
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;
|
|
51
76
|
};
|
|
52
77
|
export const getFirstActiveIndex = (state, items, multiselect) => {
|
|
53
78
|
for (let i = 0; i < items.length; i++) {
|