@geotab/zenith 3.11.0 → 3.11.1
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/dataGrid/withFlexibleColumns/withFlexibleColumns.js +219 -133
- package/dist/index.css +4 -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 +467 -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/dataGrid/withFlexibleColumns/withFlexibleColumns.js +213 -132
- 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 +463 -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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { injectString } from "../../utils/localization/translationsDictionary";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
4
|
import { ColumnsSettingsStorage, mergeColumnsSettings } from "./flexibleColumnsStorage";
|
|
@@ -12,140 +13,220 @@ import { ColumnSettingsList } from "./components/columnSettingsList";
|
|
|
12
13
|
import { ColumnSettingsSidePanel } from "./components/columnSettingsSidePanel";
|
|
13
14
|
import { EmptySearchList } from "../emptySearchList/emptySearchList";
|
|
14
15
|
import { zen } from "../../utils/zen";
|
|
16
|
+
import { useLanguage } from "../../utils/localization/useLanguage";
|
|
15
17
|
// T - type of entity
|
|
16
18
|
// P - props of wrapped component
|
|
17
19
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
20
|
+
injectString("cs", "Column Settings", "Nastaven\xED sloupc\u016F");
|
|
21
|
+
injectString("da-DK", "Column Settings", "Kolonneindstillinger");
|
|
22
|
+
injectString("de", "Column Settings", "Spalteneinstellungen");
|
|
23
|
+
injectString("en", "Column Settings", "Column Settings");
|
|
24
|
+
injectString("es", "Column Settings", "Configuraci\xF3n de columnas");
|
|
25
|
+
injectString("fi-FI", "Column Settings", "Sarakkeiden asetukset");
|
|
26
|
+
injectString("fr", "Column Settings", "Param\xE8tres des colonnes");
|
|
27
|
+
injectString("fr-FR", "Column Settings", "Param\xE8tres des colonnes");
|
|
28
|
+
injectString("hu-HU", "Column Settings", "Oszlopbe\xE1ll\xEDt\xE1sok");
|
|
29
|
+
injectString("id", "Column Settings", "Pengaturan Kolom");
|
|
30
|
+
injectString("it", "Column Settings", "Impostazioni colonna");
|
|
31
|
+
injectString("ja", "Column Settings", "\u5217\u306E\u8A2D\u5B9A");
|
|
32
|
+
injectString("ko-KR", "Column Settings", "\uC5F4 \uC124\uC815");
|
|
33
|
+
injectString("ms", "Column Settings", "Tetapan Lajur");
|
|
34
|
+
injectString("nb-NO", "Column Settings", "Kolonneinnstillinger");
|
|
35
|
+
injectString("nl", "Column Settings", "Kolominstellingen");
|
|
36
|
+
injectString("pl", "Column Settings", "Ustawienia kolumn");
|
|
37
|
+
injectString("pt-BR", "Column Settings", "Configura\xE7\xF5es da coluna");
|
|
38
|
+
injectString("pt-PT", "Column Settings", "Configura\xE7\xF5es de coluna");
|
|
39
|
+
injectString("sk-SK", "Column Settings", "Nastavenia st\u013Apcov");
|
|
40
|
+
injectString("sv", "Column Settings", "Kolumninst\xE4llningar");
|
|
41
|
+
injectString("th", "Column Settings", "\u0E01\u0E32\u0E23\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C");
|
|
42
|
+
injectString("tr", "Column Settings", "S\xFCtun Ayarlar\u0131");
|
|
43
|
+
injectString("zh-Hans", "Column Settings", "\u5217\u8BBE\u7F6E");
|
|
44
|
+
injectString("zh-TW", "Column Settings", "\u6B04\u8A2D\u5B9A");
|
|
45
|
+
injectString("ro-RO", "Column Settings", "Set\u0103ri coloane");
|
|
46
|
+
injectString("ar-SA", "Column Settings", "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0623\u0639\u0645\u062F\u0629");
|
|
47
|
+
export const withFlexibleColumns = DataGridComponent => {
|
|
48
|
+
const FlexibleColumnsComponent = props => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const {
|
|
51
|
+
columns,
|
|
52
|
+
options,
|
|
53
|
+
popupTriggerRef,
|
|
54
|
+
onChangeSettings,
|
|
55
|
+
onResetSettings = () => {},
|
|
56
|
+
sortGroups,
|
|
57
|
+
sortColumns
|
|
58
|
+
} = props;
|
|
59
|
+
const {
|
|
60
|
+
translate
|
|
61
|
+
} = useLanguage();
|
|
62
|
+
const settingsStore = useMemo(() => {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return new ColumnsSettingsStorage(((_a = options.columnsSettingsStorage) === null || _a === void 0 ? void 0 : _a.pageName) || "", (_b = options.columnsSettingsStorage) === null || _b === void 0 ? void 0 : _b.storage);
|
|
65
|
+
}, [(_a = options.columnsSettingsStorage) === null || _a === void 0 ? void 0 : _a.pageName, (_b = options.columnsSettingsStorage) === null || _b === void 0 ? void 0 : _b.storage]);
|
|
66
|
+
const [isPanelOpen, setIsPanelOpen] = useState(false);
|
|
67
|
+
const allColumns = useMemo(() => columns.map(column => Object.assign(Object.assign({}, toBasicColumn(Object.assign({}, column))), {
|
|
68
|
+
visible: column.visible !== false,
|
|
69
|
+
group: column.group || ""
|
|
70
|
+
})), [columns]);
|
|
71
|
+
const columnsSettings = useMemo(() => mergeColumnsSettings(allColumns, options.columnsSettings || settingsStore.getItem()), [allColumns, options.columnsSettings, settingsStore]);
|
|
72
|
+
const hasConfigurableColumns = useMemo(() => allColumns.filter(c => c.title).some(c => !c.alwaysVisible), [allColumns]);
|
|
73
|
+
const visibleColumns = useMemo(() => {
|
|
74
|
+
const visibleColumnsMap = new Map(allColumns.map(c => [c.name, c]));
|
|
75
|
+
return columnsSettings.map((s, index) => {
|
|
76
|
+
const column = visibleColumnsMap.get(s.name);
|
|
77
|
+
if (column === undefined || !s.visible) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const wrappers = column.wrappers;
|
|
81
|
+
return Object.assign(Object.assign({}, column), {
|
|
82
|
+
meta: Object.assign(Object.assign({}, column.meta), {
|
|
83
|
+
defaultWidth: s.width
|
|
84
|
+
}),
|
|
85
|
+
wrappers: wrappers.some(w => w instanceof FlexibleColumnWrapper) ? wrappers : [...wrappers, new FlexibleColumnWrapper({
|
|
86
|
+
draggable: !(column.columnComponent instanceof ActionsColumn),
|
|
87
|
+
resizable: index !== 0
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
}).filter(c => c !== undefined);
|
|
91
|
+
}, [allColumns, columnsSettings]);
|
|
92
|
+
const gridRef = useRef(null);
|
|
93
|
+
const resizerRef = useRef(null);
|
|
94
|
+
const reordererRef = useRef(null);
|
|
95
|
+
useImperativeHandle(props.ref, () => gridRef.current, []);
|
|
96
|
+
const saveSettingsToTheStore = useCallback(newSettings =>
|
|
97
|
+
// not to block main thread this operation can be postponed
|
|
98
|
+
new Promise((resolve, reject) => {
|
|
99
|
+
var _a;
|
|
100
|
+
(_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
|
|
101
|
+
try {
|
|
102
|
+
settingsStore.setItem(newSettings);
|
|
103
|
+
resolve();
|
|
104
|
+
} catch (e) {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
106
|
+
reject(e);
|
|
107
|
+
}
|
|
108
|
+
}, 0);
|
|
109
|
+
}), [settingsStore]);
|
|
110
|
+
const listOfColumns = useMemo(() => {
|
|
111
|
+
const configurableColumnNames = new Set(allColumns.filter(c => c.title).map(c => c.name));
|
|
112
|
+
const visibleConfigurableSettings = columnsSettings.filter(s => s.visible && configurableColumnNames.has(s.name));
|
|
113
|
+
const lastVisibleColumn = visibleConfigurableSettings.length === 1 ? [visibleConfigurableSettings[0].name] : [];
|
|
114
|
+
const disabledColumns = [...allColumns.filter(c => c.alwaysVisible).map(c => c.name), ...lastVisibleColumn];
|
|
115
|
+
const columnSettingsMap = new Map(columnsSettings.map(s => [s.name, s.visible]));
|
|
116
|
+
return _jsx(ColumnSettingsList, {
|
|
117
|
+
columns: allColumns.filter(c => c.title),
|
|
118
|
+
settings: columnSettingsMap,
|
|
119
|
+
disabledColumns: disabledColumns,
|
|
120
|
+
onChange: async newSettings => {
|
|
121
|
+
const settings = columnsSettings.map(s => {
|
|
122
|
+
const visible = newSettings.get(s.name) !== false;
|
|
123
|
+
return Object.assign(Object.assign({}, s), {
|
|
124
|
+
visible
|
|
111
125
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
126
|
+
});
|
|
127
|
+
await saveSettingsToTheStore(settings);
|
|
128
|
+
onChangeSettings(settings);
|
|
129
|
+
},
|
|
130
|
+
sortGroups: sortGroups,
|
|
131
|
+
sortColumns: sortColumns
|
|
132
|
+
});
|
|
133
|
+
}, [columnsSettings, allColumns, saveSettingsToTheStore, onChangeSettings, sortGroups, sortColumns]);
|
|
134
|
+
const onReorderListener = useCallback(async ([from, to]) => {
|
|
135
|
+
if (from === to) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const column = visibleColumns[from];
|
|
139
|
+
// we should avoid moving actions column
|
|
140
|
+
const limitedTo = Math.min(to, visibleColumns.length - 1);
|
|
141
|
+
const where = visibleColumns[limitedTo];
|
|
142
|
+
if (column === undefined) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
// update order in settings
|
|
146
|
+
const settingsWithoutColumn = columnsSettings.filter(s => s.name !== column.name);
|
|
147
|
+
const originalSettings = columnsSettings.filter(s => s.name === column.name)[0];
|
|
148
|
+
const sIndex = settingsWithoutColumn.findIndex(s => s.name === where.name);
|
|
149
|
+
const newColumnSettings = [...settingsWithoutColumn.slice(0, sIndex), originalSettings, ...settingsWithoutColumn.slice(sIndex)];
|
|
150
|
+
await saveSettingsToTheStore(newColumnSettings);
|
|
151
|
+
onChangeSettings(newColumnSettings);
|
|
152
|
+
}, [columnsSettings, visibleColumns, onChangeSettings, saveSettingsToTheStore]);
|
|
153
|
+
const onResizeColumn = useCallback(async ([index, width]) => {
|
|
154
|
+
const column = visibleColumns[index];
|
|
155
|
+
if (column === undefined) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const newColumnSettings = columnsSettings.map(s => {
|
|
159
|
+
if (s.name === column.name) {
|
|
160
|
+
return Object.assign(Object.assign({}, s), {
|
|
161
|
+
width
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return s;
|
|
165
|
+
});
|
|
166
|
+
await saveSettingsToTheStore(newColumnSettings);
|
|
167
|
+
onChangeSettings(newColumnSettings);
|
|
168
|
+
}, [columnsSettings, visibleColumns, onChangeSettings, saveSettingsToTheStore]);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
if (!gridRef.current) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// resizer
|
|
174
|
+
if (!resizerRef.current) {
|
|
175
|
+
const resizer = new FlexibleColumnResizer(gridRef.current);
|
|
176
|
+
resizerRef.current = resizer;
|
|
177
|
+
}
|
|
178
|
+
resizerRef.current.detach("resize");
|
|
179
|
+
resizerRef.current.attach("resize", onResizeColumn);
|
|
180
|
+
resizerRef.current.add(visibleColumns);
|
|
181
|
+
// reorder
|
|
182
|
+
if (!reordererRef.current) {
|
|
183
|
+
const reorder = new FlexibleColumnReorder(gridRef.current, resizerRef.current, () => true);
|
|
184
|
+
reordererRef.current = reorder;
|
|
185
|
+
}
|
|
186
|
+
reordererRef.current.detach("reorder");
|
|
187
|
+
reordererRef.current.attach("reorder", onReorderListener);
|
|
188
|
+
reordererRef.current.add();
|
|
189
|
+
}, [columnsSettings, visibleColumns, onResizeColumn, onReorderListener]);
|
|
190
|
+
const onResetListener = useCallback(async () => {
|
|
191
|
+
await saveSettingsToTheStore([]);
|
|
192
|
+
onResetSettings();
|
|
193
|
+
setIsPanelOpen(false);
|
|
194
|
+
}, [onResetSettings, saveSettingsToTheStore]);
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (popupTriggerRef === null || popupTriggerRef === void 0 ? void 0 : popupTriggerRef.current) {
|
|
197
|
+
popupTriggerRef.current.style.display = hasConfigurableColumns ? "" : "none";
|
|
198
|
+
}
|
|
199
|
+
}, [popupTriggerRef, hasConfigurableColumns]);
|
|
200
|
+
return _jsxs(_Fragment, {
|
|
201
|
+
children: [popupTriggerRef && hasConfigurableColumns ? options.isFeed ? _jsx(ColumnSettingsSidePanel, {
|
|
202
|
+
triggerRef: popupTriggerRef,
|
|
203
|
+
isOpen: isPanelOpen,
|
|
204
|
+
onOpen: () => setIsPanelOpen(true),
|
|
205
|
+
onClose: () => setIsPanelOpen(false),
|
|
206
|
+
onReset: onResetListener,
|
|
207
|
+
children: _jsx(ColumnSettings, {
|
|
208
|
+
onReset: onResetListener,
|
|
209
|
+
showFooter: false,
|
|
210
|
+
children: listOfColumns
|
|
211
|
+
})
|
|
212
|
+
}) : _jsx(Popup, {
|
|
213
|
+
ariaLabel: translate("Column Settings"),
|
|
214
|
+
triggerRef: popupTriggerRef,
|
|
215
|
+
alignment: "bottom-right",
|
|
216
|
+
children: _jsx(ColumnSettings, {
|
|
217
|
+
onReset: onResetListener,
|
|
218
|
+
children: listOfColumns
|
|
219
|
+
})
|
|
220
|
+
}, "flexible-popup") : null, visibleColumns.length === 0 && hasConfigurableColumns ? _jsx("div", {
|
|
221
|
+
className: "zen-data-grid__empty",
|
|
222
|
+
children: _jsx(EmptySearchList, {})
|
|
223
|
+
}) : _jsx(DataGridComponent, Object.assign({}, props, {
|
|
224
|
+
columns: [...visibleColumns],
|
|
225
|
+
ref: gridRef
|
|
226
|
+
}), "grid")]
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
FlexibleColumnsComponent.displayName = `withFlexibleColumns(${DataGridComponent.displayName || DataGridComponent.name || "Component"})`;
|
|
230
|
+
return FlexibleColumnsComponent;
|
|
150
231
|
};
|
|
151
|
-
withFlexibleColumns.translations = [...ColumnSettings.translations, ...ColumnSettingsSidePanel.translations, ...EmptySearchList.translations];
|
|
232
|
+
withFlexibleColumns.translations = ["Column Settings", ...ColumnSettings.translations, ...ColumnSettingsSidePanel.translations, ...EmptySearchList.translations];
|
|
@@ -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++) {
|