@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,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
injectString
|
|
5
|
+
} = require("../../utils/localization/translationsDictionary");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
3
9
|
exports.withFlexibleColumns = void 0;
|
|
4
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
11
|
const react_1 = require("react");
|
|
@@ -15,141 +21,221 @@ const columnSettingsList_1 = require("./components/columnSettingsList");
|
|
|
15
21
|
const columnSettingsSidePanel_1 = require("./components/columnSettingsSidePanel");
|
|
16
22
|
const emptySearchList_1 = require("../emptySearchList/emptySearchList");
|
|
17
23
|
const zen_1 = require("../../utils/zen");
|
|
24
|
+
const useLanguage_1 = require("../../utils/localization/useLanguage");
|
|
18
25
|
// T - type of entity
|
|
19
26
|
// P - props of wrapped component
|
|
20
27
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
28
|
+
injectString("cs", "Column Settings", "Nastaven\xED sloupc\u016F");
|
|
29
|
+
injectString("da-DK", "Column Settings", "Kolonneindstillinger");
|
|
30
|
+
injectString("de", "Column Settings", "Spalteneinstellungen");
|
|
31
|
+
injectString("en", "Column Settings", "Column Settings");
|
|
32
|
+
injectString("es", "Column Settings", "Configuraci\xF3n de columnas");
|
|
33
|
+
injectString("fi-FI", "Column Settings", "Sarakkeiden asetukset");
|
|
34
|
+
injectString("fr", "Column Settings", "Param\xE8tres des colonnes");
|
|
35
|
+
injectString("fr-FR", "Column Settings", "Param\xE8tres des colonnes");
|
|
36
|
+
injectString("hu-HU", "Column Settings", "Oszlopbe\xE1ll\xEDt\xE1sok");
|
|
37
|
+
injectString("id", "Column Settings", "Pengaturan Kolom");
|
|
38
|
+
injectString("it", "Column Settings", "Impostazioni colonna");
|
|
39
|
+
injectString("ja", "Column Settings", "\u5217\u306E\u8A2D\u5B9A");
|
|
40
|
+
injectString("ko-KR", "Column Settings", "\uC5F4 \uC124\uC815");
|
|
41
|
+
injectString("ms", "Column Settings", "Tetapan Lajur");
|
|
42
|
+
injectString("nb-NO", "Column Settings", "Kolonneinnstillinger");
|
|
43
|
+
injectString("nl", "Column Settings", "Kolominstellingen");
|
|
44
|
+
injectString("pl", "Column Settings", "Ustawienia kolumn");
|
|
45
|
+
injectString("pt-BR", "Column Settings", "Configura\xE7\xF5es da coluna");
|
|
46
|
+
injectString("pt-PT", "Column Settings", "Configura\xE7\xF5es de coluna");
|
|
47
|
+
injectString("sk-SK", "Column Settings", "Nastavenia st\u013Apcov");
|
|
48
|
+
injectString("sv", "Column Settings", "Kolumninst\xE4llningar");
|
|
49
|
+
injectString("th", "Column Settings", "\u0E01\u0E32\u0E23\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C");
|
|
50
|
+
injectString("tr", "Column Settings", "S\xFCtun Ayarlar\u0131");
|
|
51
|
+
injectString("zh-Hans", "Column Settings", "\u5217\u8BBE\u7F6E");
|
|
52
|
+
injectString("zh-TW", "Column Settings", "\u6B04\u8A2D\u5B9A");
|
|
53
|
+
injectString("ro-RO", "Column Settings", "Set\u0103ri coloane");
|
|
54
|
+
injectString("ar-SA", "Column Settings", "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0623\u0639\u0645\u062F\u0629");
|
|
55
|
+
const withFlexibleColumns = DataGridComponent => {
|
|
56
|
+
const FlexibleColumnsComponent = props => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const {
|
|
59
|
+
columns,
|
|
60
|
+
options,
|
|
61
|
+
popupTriggerRef,
|
|
62
|
+
onChangeSettings,
|
|
63
|
+
onResetSettings = () => {},
|
|
64
|
+
sortGroups,
|
|
65
|
+
sortColumns
|
|
66
|
+
} = props;
|
|
67
|
+
const {
|
|
68
|
+
translate
|
|
69
|
+
} = (0, useLanguage_1.useLanguage)();
|
|
70
|
+
const settingsStore = (0, react_1.useMemo)(() => {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return new flexibleColumnsStorage_1.ColumnsSettingsStorage(((_a = options.columnsSettingsStorage) === null || _a === void 0 ? void 0 : _a.pageName) || "", (_b = options.columnsSettingsStorage) === null || _b === void 0 ? void 0 : _b.storage);
|
|
73
|
+
}, [(_a = options.columnsSettingsStorage) === null || _a === void 0 ? void 0 : _a.pageName, (_b = options.columnsSettingsStorage) === null || _b === void 0 ? void 0 : _b.storage]);
|
|
74
|
+
const [isPanelOpen, setIsPanelOpen] = (0, react_1.useState)(false);
|
|
75
|
+
const allColumns = (0, react_1.useMemo)(() => columns.map(column => Object.assign(Object.assign({}, (0, toBasicColumn_1.toBasicColumn)(Object.assign({}, column))), {
|
|
76
|
+
visible: column.visible !== false,
|
|
77
|
+
group: column.group || ""
|
|
78
|
+
})), [columns]);
|
|
79
|
+
const columnsSettings = (0, react_1.useMemo)(() => (0, flexibleColumnsStorage_1.mergeColumnsSettings)(allColumns, options.columnsSettings || settingsStore.getItem()), [allColumns, options.columnsSettings, settingsStore]);
|
|
80
|
+
const hasConfigurableColumns = (0, react_1.useMemo)(() => allColumns.filter(c => c.title).some(c => !c.alwaysVisible), [allColumns]);
|
|
81
|
+
const visibleColumns = (0, react_1.useMemo)(() => {
|
|
82
|
+
const visibleColumnsMap = new Map(allColumns.map(c => [c.name, c]));
|
|
83
|
+
return columnsSettings.map((s, index) => {
|
|
84
|
+
const column = visibleColumnsMap.get(s.name);
|
|
85
|
+
if (column === undefined || !s.visible) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const wrappers = column.wrappers;
|
|
89
|
+
return Object.assign(Object.assign({}, column), {
|
|
90
|
+
meta: Object.assign(Object.assign({}, column.meta), {
|
|
91
|
+
defaultWidth: s.width
|
|
92
|
+
}),
|
|
93
|
+
wrappers: wrappers.some(w => w instanceof flexibleColumnWrapper_1.FlexibleColumnWrapper) ? wrappers : [...wrappers, new flexibleColumnWrapper_1.FlexibleColumnWrapper({
|
|
94
|
+
draggable: !(column.columnComponent instanceof actionsColumn_1.ActionsColumn),
|
|
95
|
+
resizable: index !== 0
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
}).filter(c => c !== undefined);
|
|
99
|
+
}, [allColumns, columnsSettings]);
|
|
100
|
+
const gridRef = (0, react_1.useRef)(null);
|
|
101
|
+
const resizerRef = (0, react_1.useRef)(null);
|
|
102
|
+
const reordererRef = (0, react_1.useRef)(null);
|
|
103
|
+
(0, react_1.useImperativeHandle)(props.ref, () => gridRef.current, []);
|
|
104
|
+
const saveSettingsToTheStore = (0, react_1.useCallback)(newSettings =>
|
|
105
|
+
// not to block main thread this operation can be postponed
|
|
106
|
+
new Promise((resolve, reject) => {
|
|
107
|
+
var _a;
|
|
108
|
+
(_a = zen_1.zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, () => {
|
|
109
|
+
try {
|
|
110
|
+
settingsStore.setItem(newSettings);
|
|
111
|
+
resolve();
|
|
112
|
+
} catch (e) {
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
114
|
+
reject(e);
|
|
115
|
+
}
|
|
116
|
+
}, 0);
|
|
117
|
+
}), [settingsStore]);
|
|
118
|
+
const listOfColumns = (0, react_1.useMemo)(() => {
|
|
119
|
+
const configurableColumnNames = new Set(allColumns.filter(c => c.title).map(c => c.name));
|
|
120
|
+
const visibleConfigurableSettings = columnsSettings.filter(s => s.visible && configurableColumnNames.has(s.name));
|
|
121
|
+
const lastVisibleColumn = visibleConfigurableSettings.length === 1 ? [visibleConfigurableSettings[0].name] : [];
|
|
122
|
+
const disabledColumns = [...allColumns.filter(c => c.alwaysVisible).map(c => c.name), ...lastVisibleColumn];
|
|
123
|
+
const columnSettingsMap = new Map(columnsSettings.map(s => [s.name, s.visible]));
|
|
124
|
+
return (0, jsx_runtime_1.jsx)(columnSettingsList_1.ColumnSettingsList, {
|
|
125
|
+
columns: allColumns.filter(c => c.title),
|
|
126
|
+
settings: columnSettingsMap,
|
|
127
|
+
disabledColumns: disabledColumns,
|
|
128
|
+
onChange: async newSettings => {
|
|
129
|
+
const settings = columnsSettings.map(s => {
|
|
130
|
+
const visible = newSettings.get(s.name) !== false;
|
|
131
|
+
return Object.assign(Object.assign({}, s), {
|
|
132
|
+
visible
|
|
114
133
|
});
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
134
|
+
});
|
|
135
|
+
await saveSettingsToTheStore(settings);
|
|
136
|
+
onChangeSettings(settings);
|
|
137
|
+
},
|
|
138
|
+
sortGroups: sortGroups,
|
|
139
|
+
sortColumns: sortColumns
|
|
140
|
+
});
|
|
141
|
+
}, [columnsSettings, allColumns, saveSettingsToTheStore, onChangeSettings, sortGroups, sortColumns]);
|
|
142
|
+
const onReorderListener = (0, react_1.useCallback)(async ([from, to]) => {
|
|
143
|
+
if (from === to) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const column = visibleColumns[from];
|
|
147
|
+
// we should avoid moving actions column
|
|
148
|
+
const limitedTo = Math.min(to, visibleColumns.length - 1);
|
|
149
|
+
const where = visibleColumns[limitedTo];
|
|
150
|
+
if (column === undefined) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// update order in settings
|
|
154
|
+
const settingsWithoutColumn = columnsSettings.filter(s => s.name !== column.name);
|
|
155
|
+
const originalSettings = columnsSettings.filter(s => s.name === column.name)[0];
|
|
156
|
+
const sIndex = settingsWithoutColumn.findIndex(s => s.name === where.name);
|
|
157
|
+
const newColumnSettings = [...settingsWithoutColumn.slice(0, sIndex), originalSettings, ...settingsWithoutColumn.slice(sIndex)];
|
|
158
|
+
await saveSettingsToTheStore(newColumnSettings);
|
|
159
|
+
onChangeSettings(newColumnSettings);
|
|
160
|
+
}, [columnsSettings, visibleColumns, onChangeSettings, saveSettingsToTheStore]);
|
|
161
|
+
const onResizeColumn = (0, react_1.useCallback)(async ([index, width]) => {
|
|
162
|
+
const column = visibleColumns[index];
|
|
163
|
+
if (column === undefined) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const newColumnSettings = columnsSettings.map(s => {
|
|
167
|
+
if (s.name === column.name) {
|
|
168
|
+
return Object.assign(Object.assign({}, s), {
|
|
169
|
+
width
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return s;
|
|
173
|
+
});
|
|
174
|
+
await saveSettingsToTheStore(newColumnSettings);
|
|
175
|
+
onChangeSettings(newColumnSettings);
|
|
176
|
+
}, [columnsSettings, visibleColumns, onChangeSettings, saveSettingsToTheStore]);
|
|
177
|
+
(0, react_1.useEffect)(() => {
|
|
178
|
+
if (!gridRef.current) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// resizer
|
|
182
|
+
if (!resizerRef.current) {
|
|
183
|
+
const resizer = new flexibleColumnsResizer_1.FlexibleColumnResizer(gridRef.current);
|
|
184
|
+
resizerRef.current = resizer;
|
|
185
|
+
}
|
|
186
|
+
resizerRef.current.detach("resize");
|
|
187
|
+
resizerRef.current.attach("resize", onResizeColumn);
|
|
188
|
+
resizerRef.current.add(visibleColumns);
|
|
189
|
+
// reorder
|
|
190
|
+
if (!reordererRef.current) {
|
|
191
|
+
const reorder = new flexibleColumnsReorder_1.FlexibleColumnReorder(gridRef.current, resizerRef.current, () => true);
|
|
192
|
+
reordererRef.current = reorder;
|
|
193
|
+
}
|
|
194
|
+
reordererRef.current.detach("reorder");
|
|
195
|
+
reordererRef.current.attach("reorder", onReorderListener);
|
|
196
|
+
reordererRef.current.add();
|
|
197
|
+
}, [columnsSettings, visibleColumns, onResizeColumn, onReorderListener]);
|
|
198
|
+
const onResetListener = (0, react_1.useCallback)(async () => {
|
|
199
|
+
await saveSettingsToTheStore([]);
|
|
200
|
+
onResetSettings();
|
|
201
|
+
setIsPanelOpen(false);
|
|
202
|
+
}, [onResetSettings, saveSettingsToTheStore]);
|
|
203
|
+
(0, react_1.useEffect)(() => {
|
|
204
|
+
if (popupTriggerRef === null || popupTriggerRef === void 0 ? void 0 : popupTriggerRef.current) {
|
|
205
|
+
popupTriggerRef.current.style.display = hasConfigurableColumns ? "" : "none";
|
|
206
|
+
}
|
|
207
|
+
}, [popupTriggerRef, hasConfigurableColumns]);
|
|
208
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
209
|
+
children: [popupTriggerRef && hasConfigurableColumns ? options.isFeed ? (0, jsx_runtime_1.jsx)(columnSettingsSidePanel_1.ColumnSettingsSidePanel, {
|
|
210
|
+
triggerRef: popupTriggerRef,
|
|
211
|
+
isOpen: isPanelOpen,
|
|
212
|
+
onOpen: () => setIsPanelOpen(true),
|
|
213
|
+
onClose: () => setIsPanelOpen(false),
|
|
214
|
+
onReset: onResetListener,
|
|
215
|
+
children: (0, jsx_runtime_1.jsx)(columnSettings_1.ColumnSettings, {
|
|
216
|
+
onReset: onResetListener,
|
|
217
|
+
showFooter: false,
|
|
218
|
+
children: listOfColumns
|
|
219
|
+
})
|
|
220
|
+
}) : (0, jsx_runtime_1.jsx)(popup_1.Popup, {
|
|
221
|
+
ariaLabel: translate("Column Settings"),
|
|
222
|
+
triggerRef: popupTriggerRef,
|
|
223
|
+
alignment: "bottom-right",
|
|
224
|
+
children: (0, jsx_runtime_1.jsx)(columnSettings_1.ColumnSettings, {
|
|
225
|
+
onReset: onResetListener,
|
|
226
|
+
children: listOfColumns
|
|
227
|
+
})
|
|
228
|
+
}, "flexible-popup") : null, visibleColumns.length === 0 && hasConfigurableColumns ? (0, jsx_runtime_1.jsx)("div", {
|
|
229
|
+
className: "zen-data-grid__empty",
|
|
230
|
+
children: (0, jsx_runtime_1.jsx)(emptySearchList_1.EmptySearchList, {})
|
|
231
|
+
}) : (0, jsx_runtime_1.jsx)(DataGridComponent, Object.assign({}, props, {
|
|
232
|
+
columns: [...visibleColumns],
|
|
233
|
+
ref: gridRef
|
|
234
|
+
}), "grid")]
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
FlexibleColumnsComponent.displayName = `withFlexibleColumns(${DataGridComponent.displayName || DataGridComponent.name || "Component"})`;
|
|
238
|
+
return FlexibleColumnsComponent;
|
|
153
239
|
};
|
|
154
240
|
exports.withFlexibleColumns = withFlexibleColumns;
|
|
155
|
-
exports.withFlexibleColumns.translations = [...columnSettings_1.ColumnSettings.translations, ...columnSettingsSidePanel_1.ColumnSettingsSidePanel.translations, ...emptySearchList_1.EmptySearchList.translations];
|
|
241
|
+
exports.withFlexibleColumns.translations = ["Column Settings", ...columnSettings_1.ColumnSettings.translations, ...columnSettingsSidePanel_1.ColumnSettingsSidePanel.translations, ...emptySearchList_1.EmptySearchList.translations];
|
package/dist/index.css
CHANGED
|
@@ -5008,7 +5008,10 @@ html:lang(ar) .zen-select-item {
|
|
|
5008
5008
|
.zen-select-item:not(.zen-select-item--with-checkbox).zen-select-item--focused[aria-selected="true"] > .zen-select-item__wrapper {
|
|
5009
5009
|
background-color: var(--action-primary--hover);
|
|
5010
5010
|
}
|
|
5011
|
-
.zen-select-item--focused .zen-select-item__wrapper {
|
|
5011
|
+
.zen-select-item--focused:not(.zen-select-item--with-checkbox) > .zen-select-item__wrapper {
|
|
5012
|
+
background-color: var(--backgrounds-hover);
|
|
5013
|
+
}
|
|
5014
|
+
.zen-select-item--focused.zen-select-item--with-checkbox:focus > .zen-select-item__wrapper {
|
|
5012
5015
|
background-color: var(--backgrounds-hover);
|
|
5013
5016
|
}
|
|
5014
5017
|
.zen-select-item .zen-select-item__wrapper--with-arrow {
|
|
@@ -35,33 +35,6 @@ injectString("zh-Hans", "View all", "\u67E5\u770B\u5168\u90E8");
|
|
|
35
35
|
injectString("zh-TW", "View all", "\u6AA2\u8996\u5168\u90E8");
|
|
36
36
|
injectString("ro-RO", "View all", "Vezi tot");
|
|
37
37
|
injectString("ar-SA", "View all", "\u0639\u0631\u0636 \u0627\u0644\u0643\u0644");
|
|
38
|
-
injectString("cs", "Expand", "Rozbalit");
|
|
39
|
-
injectString("da-DK", "Expand", "Udvid");
|
|
40
|
-
injectString("de", "Expand", "Erweitern");
|
|
41
|
-
injectString("en", "Expand", "Expand");
|
|
42
|
-
injectString("es", "Expand", "Expandir");
|
|
43
|
-
injectString("fi-FI", "Expand", "Laajenna");
|
|
44
|
-
injectString("fr", "Expand", "D\xE9velopper");
|
|
45
|
-
injectString("fr-FR", "Expand", "D\xE9velopper");
|
|
46
|
-
injectString("hu-HU", "Expand", "B\u0151v\xEDtsd ki");
|
|
47
|
-
injectString("id", "Expand", "Perluas");
|
|
48
|
-
injectString("it", "Expand", "Espandere");
|
|
49
|
-
injectString("ja", "Expand", "\u5C55\u958B");
|
|
50
|
-
injectString("ko-KR", "Expand", "\uD655\uC7A5");
|
|
51
|
-
injectString("ms", "Expand", "Kembangkan");
|
|
52
|
-
injectString("nb-NO", "Expand", "Utvide");
|
|
53
|
-
injectString("nl", "Expand", "Uitvouwen");
|
|
54
|
-
injectString("pl", "Expand", "Rozwi\u0144");
|
|
55
|
-
injectString("pt-BR", "Expand", "Expandir");
|
|
56
|
-
injectString("pt-PT", "Expand", "Expandir");
|
|
57
|
-
injectString("sk-SK", "Expand", "Roz\u0161\xEDr.");
|
|
58
|
-
injectString("sv", "Expand", "Expandera");
|
|
59
|
-
injectString("th", "Expand", "\u0E02\u0E22\u0E32\u0E22");
|
|
60
|
-
injectString("tr", "Expand", "Geni\u015Flet");
|
|
61
|
-
injectString("zh-Hans", "Expand", "\u5C55\u5F00");
|
|
62
|
-
injectString("zh-TW", "Expand", "\u5C55\u958B");
|
|
63
|
-
injectString("ro-RO", "Expand", "Extinde\u021Bi");
|
|
64
|
-
injectString("ar-SA", "Expand", "\u062A\u0648\u0633\u064A\u0639");
|
|
65
38
|
const react_1 = require("react");
|
|
66
39
|
const absolute_1 = require("../absolute/absolute");
|
|
67
40
|
const focusableSelector_1 = require("../utils/focusableSelector");
|
|
@@ -201,9 +174,6 @@ const PillExpandableChild = ({
|
|
|
201
174
|
}) => {
|
|
202
175
|
const pillId = (0, react_1.useId)();
|
|
203
176
|
const descriptionId = (0, react_1.useId)();
|
|
204
|
-
const {
|
|
205
|
-
translate
|
|
206
|
-
} = (0, useLanguage_1.useLanguage)();
|
|
207
177
|
const {
|
|
208
178
|
level,
|
|
209
179
|
expandedChildPillIds,
|
|
@@ -256,7 +226,6 @@ const PillExpandableChild = ({
|
|
|
256
226
|
text: text,
|
|
257
227
|
expanded: isExpanded,
|
|
258
228
|
onExpand: handleChildToggle,
|
|
259
|
-
expandAriaText: translate("Expand"),
|
|
260
229
|
type: type,
|
|
261
230
|
errorHandler: errorHandler,
|
|
262
231
|
descriptionId: descriptionId
|
|
@@ -439,9 +408,6 @@ const PillExpandableBase = ({
|
|
|
439
408
|
}) => {
|
|
440
409
|
const popupId = (0, react_1.useId)();
|
|
441
410
|
const descriptionId = (0, react_1.useId)();
|
|
442
|
-
const {
|
|
443
|
-
translate
|
|
444
|
-
} = (0, useLanguage_1.useLanguage)();
|
|
445
411
|
const isDrive = (0, useDrive_1.useDrive)();
|
|
446
412
|
const [isMobile, setIsMobile] = (0, react_1.useState)(false);
|
|
447
413
|
const handleDeviceTypeChange = (0, react_1.useCallback)(deviceType => {
|
|
@@ -603,7 +569,6 @@ const PillExpandableBase = ({
|
|
|
603
569
|
icon: effectiveIcon,
|
|
604
570
|
text: text,
|
|
605
571
|
expanded: isPopupOpen,
|
|
606
|
-
expandAriaText: translate("Expand"),
|
|
607
572
|
ref: triggerRef,
|
|
608
573
|
type: type,
|
|
609
574
|
errorHandler: errorHandler,
|
|
@@ -643,4 +608,4 @@ const PillExpandableBase = ({
|
|
|
643
608
|
const PillExpandableMemo = (0, react_1.memo)(PillExpandableBase);
|
|
644
609
|
PillExpandableMemo.displayName = "PillExpandable";
|
|
645
610
|
exports.PillExpandable = PillExpandableMemo;
|
|
646
|
-
exports.TRANSLATIONS = ["
|
|
611
|
+
exports.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 {};
|
|
@@ -8,7 +8,9 @@ const iconChevronTop_1 = require("../icons/iconChevronTop");
|
|
|
8
8
|
const iconChevronBottom_1 = require("../icons/iconChevronBottom");
|
|
9
9
|
const iconException_1 = require("../icons/iconException");
|
|
10
10
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
11
|
-
const PillExpandableSimple = ({ onExpand,
|
|
11
|
+
const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIcon = true, type = "warning", icon = iconException_1.IconException, isBeta, isMobile, ref, className, descriptionId
|
|
12
|
+
// eslint-disable-next-line complexity
|
|
13
|
+
}) => {
|
|
12
14
|
const iconDriveClassName = (0, useDriveClassName_1.useDriveClassName)("icon");
|
|
13
15
|
const containerDriveClassName = (0, useDriveClassName_1.useDriveClassName)("zen-status-pill__container");
|
|
14
16
|
const onExpandHandler = (0, react_1.useCallback)(() => {
|
|
@@ -25,7 +27,7 @@ const PillExpandableSimple = ({ onExpand, expandAriaText, text, expanded, includ
|
|
|
25
27
|
containerDriveClassName || "",
|
|
26
28
|
className || "",
|
|
27
29
|
"zen-ellipsis"
|
|
28
|
-
]), ref: ref, onClick: onExpandHandler, tabIndex: !includeExpandIcon ? -1 : undefined, "aria-describedby": descriptionId, children: [icon !== false && ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)([
|
|
30
|
+
]), 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 && ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)([
|
|
29
31
|
"zen-status-pill__icon",
|
|
30
32
|
`zen-status-pill__icon--${type}`,
|
|
31
33
|
isLargeIcon ? "zen-status-pill__icon--large" : "",
|
|
@@ -37,7 +39,7 @@ const PillExpandableSimple = ({ onExpand, expandAriaText, text, expanded, includ
|
|
|
37
39
|
`zen-status-pill__text--${type}`,
|
|
38
40
|
"zen-ellipsis",
|
|
39
41
|
isTextCentered ? "zen-status-pill__text--centered" : ""
|
|
40
|
-
]), children: text })), includeExpandIcon && ((0, jsx_runtime_1.jsx)("div", { className: `zen-status-pill__expand-button zen-status-pill__expand-button--${type}`,
|
|
42
|
+
]), children: text })), includeExpandIcon && ((0, jsx_runtime_1.jsx)("div", { className: `zen-status-pill__expand-button zen-status-pill__expand-button--${type}`, children: (0, jsx_runtime_1.jsx)("div", { className: "zen-status-pill__icon", children: (0, react_1.createElement)(ChevronIcon, {
|
|
41
43
|
size: iconSize
|
|
42
44
|
}) }) }))] }));
|
|
43
45
|
};
|
|
@@ -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 {};
|
|
@@ -11,6 +11,7 @@ var ListAction;
|
|
|
11
11
|
ListAction["FocusPrev"] = "focusPrev";
|
|
12
12
|
ListAction["FocusNextPage"] = "focusNextPage";
|
|
13
13
|
ListAction["FocusPrevPage"] = "focusPrevPage";
|
|
14
|
+
ListAction["FocusItem"] = "focusItem";
|
|
14
15
|
ListAction["SelectFirst"] = "selectFirst";
|
|
15
16
|
ListAction["SelectLast"] = "selectLast";
|
|
16
17
|
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;
|
|
@@ -42,22 +42,47 @@ const searchItemIndex = (items, searchStr) => {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
exports.searchItemIndex = searchItemIndex;
|
|
45
|
-
const getFirstIndex = (items) =>
|
|
45
|
+
const getFirstIndex = (items) => items.findIndex(item => !item.disabled);
|
|
46
46
|
exports.getFirstIndex = getFirstIndex;
|
|
47
|
-
const getLastIndex = (items) =>
|
|
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
|
+
};
|
|
48
55
|
exports.getLastIndex = getLastIndex;
|
|
49
56
|
const getNextIndex = (currIndex, items) => {
|
|
57
|
+
var _a;
|
|
50
58
|
if (items.length === 0) {
|
|
51
59
|
return -1;
|
|
52
60
|
}
|
|
53
|
-
|
|
61
|
+
let nextIndex = currIndex + 1 >= items.length ? 0 : currIndex + 1;
|
|
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;
|
|
54
70
|
};
|
|
55
71
|
exports.getNextIndex = getNextIndex;
|
|
56
72
|
const getPrevIndex = (currIndex, items) => {
|
|
73
|
+
var _a;
|
|
57
74
|
if (items.length === 0) {
|
|
58
75
|
return -1;
|
|
59
76
|
}
|
|
60
|
-
|
|
77
|
+
let prevIndex = currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
|
|
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;
|
|
61
86
|
};
|
|
62
87
|
exports.getPrevIndex = getPrevIndex;
|
|
63
88
|
const getFirstActiveIndex = (state, items, multiselect) => {
|