@geotab/zenith 3.10.0-beta.2 → 3.10.0-beta.4
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 +9 -1
- package/dist/commonStyles/pillStyles/pillContent.less +9 -9
- package/dist/commonStyles/pillStyles/pillStyles.less +2 -2
- package/dist/dataGrid/cell/cell.d.ts +2 -1
- package/dist/dataGrid/cell/cell.js +2 -2
- package/dist/dataGrid/dataGrid.js +6 -4
- package/dist/dataGrid/listColumn.d.ts +2 -0
- package/dist/dataGrid/row/row.js +11 -7
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
- package/dist/dateRangeRaw/utils/parseLabel.js +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +1 -2
- package/dist/dropdownRaw/dropdownList.js +2 -7
- package/dist/dropdownRaw/dropdownRaw.js +13 -8
- package/dist/filtersBar/filtersContainer/filtersContainer.js +14 -4
- package/dist/index.css +690 -653
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -3
- package/dist/radioGroupRaw/radioGroupRaw.js +2 -1
- package/dist/selectList/selectList.helpers.d.ts +1 -1
- package/dist/selectList/selectList.helpers.js +31 -6
- package/dist/selectList/selectList.js +3 -1
- package/dist/selectList/selectList.reducer.js +1 -2
- package/dist/sortControl/sortControl.js +58 -2
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/flexible/columnsList.js +4 -2
- package/dist/table/selectable/useSelectableRows.d.ts +8 -0
- package/dist/table/selectable/useSelectableRows.js +14 -6
- package/dist/table/table.js +1 -7
- package/dist/utils/localization/translations/ar.json +3 -1
- package/dist/utils/localization/translations/cs.json +3 -1
- package/dist/utils/localization/translations/da-DK.json +3 -1
- package/dist/utils/localization/translations/de.json +3 -1
- package/dist/utils/localization/translations/en.json +3 -1
- package/dist/utils/localization/translations/es.json +3 -1
- package/dist/utils/localization/translations/fi-FI.json +3 -1
- package/dist/utils/localization/translations/fr-FR.json +3 -1
- package/dist/utils/localization/translations/fr.json +3 -1
- package/dist/utils/localization/translations/hu-HU.json +3 -1
- package/dist/utils/localization/translations/id.json +3 -1
- package/dist/utils/localization/translations/it.json +3 -1
- package/dist/utils/localization/translations/ja.json +3 -1
- package/dist/utils/localization/translations/ko-KR.json +3 -1
- package/dist/utils/localization/translations/ms.json +3 -1
- package/dist/utils/localization/translations/nb-NO.json +3 -1
- package/dist/utils/localization/translations/nl.json +3 -1
- package/dist/utils/localization/translations/pl.json +3 -1
- package/dist/utils/localization/translations/pt-BR.json +3 -1
- package/dist/utils/localization/translations/pt-PT.json +3 -1
- package/dist/utils/localization/translations/ro-RO.json +3 -1
- package/dist/utils/localization/translations/sk-SK.json +3 -1
- package/dist/utils/localization/translations/sv.json +3 -1
- package/dist/utils/localization/translations/th.json +3 -1
- package/dist/utils/localization/translations/tr.json +3 -1
- package/dist/utils/localization/translations/zh-Hans.json +3 -1
- package/dist/utils/localization/translations/zh-TW.json +3 -1
- package/esm/dataGrid/cell/cell.d.ts +2 -1
- package/esm/dataGrid/cell/cell.js +2 -2
- package/esm/dataGrid/dataGrid.js +6 -4
- package/esm/dataGrid/listColumn.d.ts +2 -0
- package/esm/dataGrid/row/row.js +11 -7
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
- package/esm/dateRangeRaw/utils/parseLabel.js +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +1 -2
- package/esm/dropdownRaw/dropdownList.js +2 -7
- package/esm/dropdownRaw/dropdownRaw.js +13 -8
- package/esm/filtersBar/filtersContainer/filtersContainer.js +14 -4
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -1
- package/esm/radioGroupRaw/radioGroupRaw.js +2 -1
- package/esm/selectList/selectList.helpers.d.ts +1 -1
- package/esm/selectList/selectList.helpers.js +31 -6
- package/esm/selectList/selectList.js +3 -1
- package/esm/selectList/selectList.reducer.js +1 -2
- package/esm/sortControl/sortControl.js +58 -2
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/flexible/columnsList.js +4 -2
- package/esm/table/selectable/useSelectableRows.d.ts +8 -0
- package/esm/table/selectable/useSelectableRows.js +14 -6
- package/esm/table/table.js +1 -7
- package/esm/utils/localization/translations/ar.json +3 -1
- package/esm/utils/localization/translations/cs.json +3 -1
- package/esm/utils/localization/translations/da-DK.json +3 -1
- package/esm/utils/localization/translations/de.json +3 -1
- package/esm/utils/localization/translations/en.json +3 -1
- package/esm/utils/localization/translations/es.json +3 -1
- package/esm/utils/localization/translations/fi-FI.json +3 -1
- package/esm/utils/localization/translations/fr-FR.json +3 -1
- package/esm/utils/localization/translations/fr.json +3 -1
- package/esm/utils/localization/translations/hu-HU.json +3 -1
- package/esm/utils/localization/translations/id.json +3 -1
- package/esm/utils/localization/translations/it.json +3 -1
- package/esm/utils/localization/translations/ja.json +3 -1
- package/esm/utils/localization/translations/ko-KR.json +3 -1
- package/esm/utils/localization/translations/ms.json +3 -1
- package/esm/utils/localization/translations/nb-NO.json +3 -1
- package/esm/utils/localization/translations/nl.json +3 -1
- package/esm/utils/localization/translations/pl.json +3 -1
- package/esm/utils/localization/translations/pt-BR.json +3 -1
- package/esm/utils/localization/translations/pt-PT.json +3 -1
- package/esm/utils/localization/translations/ro-RO.json +3 -1
- package/esm/utils/localization/translations/sk-SK.json +3 -1
- package/esm/utils/localization/translations/sv.json +3 -1
- package/esm/utils/localization/translations/th.json +3 -1
- package/esm/utils/localization/translations/tr.json +3 -1
- package/esm/utils/localization/translations/zh-Hans.json +3 -1
- package/esm/utils/localization/translations/zh-TW.json +3 -1
- package/package.json +2 -1
- package/dist/commonStyles/colors/colorsConstant.d.ts +0 -44
- package/dist/commonStyles/colors/colorsConstant.js +0 -361
- package/dist/commonStyles/typography/components/typographyItem.d.ts +0 -8
- package/dist/commonStyles/typography/components/typographyItem.js +0 -45
- package/dist/testHelpers/fakeFetch.d.ts +0 -1
- package/dist/testHelpers/fakeFetch.js +0 -14
- package/dist/testHelpers/geotab-axe/index.d.ts +0 -2
- package/dist/testHelpers/geotab-axe/index.js +0 -81
- package/dist/testHelpers/jestRetry.d.ts +0 -0
- package/dist/testHelpers/jestRetry.js +0 -2
- package/dist/testHelpers/renderAsync.d.ts +0 -2
- package/dist/testHelpers/renderAsync.js +0 -12
- package/dist/testHelpers/setReadonlyHtmlProperty.d.ts +0 -1
- package/dist/testHelpers/setReadonlyHtmlProperty.js +0 -15
- package/dist/testHelpers/styled-output.d.ts +0 -30
- package/dist/testHelpers/styled-output.js +0 -42
|
@@ -13,8 +13,9 @@ export interface IDataGridCell<T extends IEntityWithId> extends IZenComponentPro
|
|
|
13
13
|
defaultValue: string | undefined;
|
|
14
14
|
entity: T;
|
|
15
15
|
width?: number;
|
|
16
|
+
maxWidth?: number;
|
|
16
17
|
colspan?: number;
|
|
17
18
|
onClick?: () => void;
|
|
18
19
|
isActive?: boolean;
|
|
19
20
|
}
|
|
20
|
-
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, maxWidth, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
|
4
4
|
import { isPromiseLike } from "../columns/basicColumn";
|
|
5
5
|
import { isActiveElement } from "../../list/utils/isActiveElement";
|
|
6
6
|
import { zen } from "../../utils/zen";
|
|
7
|
-
const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }) => {
|
|
7
|
+
const Cell = ({ index, limited, visibleOnHover, isVisible, width, maxWidth, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }) => {
|
|
8
8
|
const [content, setContent] = useState("");
|
|
9
9
|
const placeholderRenderer = useCallback(() => {
|
|
10
10
|
const renderFn = renderPlaceholder || (() => "...");
|
|
@@ -69,6 +69,6 @@ const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, render
|
|
|
69
69
|
visibleOnHover ? "zen-data-grid__row-cell--visible-on-hover" : "",
|
|
70
70
|
onClick ? "zen-data-grid__row-cell--clickable" : "",
|
|
71
71
|
limited ? "zen-ellipsis" : ""
|
|
72
|
-
]), style: { minWidth: width || "auto", maxWidth: width || "auto" }, role: "gridcell", children: content }));
|
|
72
|
+
]), style: { minWidth: width || "auto", maxWidth: maxWidth ? `${Math.max(width !== null && width !== void 0 ? width : 0, maxWidth)}px` : width || "auto" }, role: "gridcell", children: content }));
|
|
73
73
|
};
|
|
74
74
|
export const DataGridCell = memo(Cell);
|
package/esm/dataGrid/dataGrid.js
CHANGED
|
@@ -49,7 +49,7 @@ const getHeaderPropsFromWrappers = wrappers => wrappers.reduce((result, wrapper)
|
|
|
49
49
|
const props = (_a = wrapper.getHeaderProps) === null || _a === void 0 ? void 0 : _a.call(wrapper);
|
|
50
50
|
return props ? Object.assign(Object.assign({}, result), props) : result;
|
|
51
51
|
}, {});
|
|
52
|
-
const getColumnWidth = defaultWidth => Math.floor(Math.max(defaultWidth, MIN_CELL_WIDTH));
|
|
52
|
+
const getColumnWidth = (defaultWidth, minWidth) => Math.floor(Math.max(defaultWidth, minWidth !== null && minWidth !== void 0 ? minWidth : MIN_CELL_WIDTH));
|
|
53
53
|
export const EmptyList = ({
|
|
54
54
|
children
|
|
55
55
|
}) => _jsx("div", {
|
|
@@ -144,12 +144,13 @@ const DataGridInner = ({
|
|
|
144
144
|
setVisibleRows(visible);
|
|
145
145
|
}, [entities]);
|
|
146
146
|
const listOfDefaultWidthColumns = useMemo(() => columnsList.map(column => column.meta.defaultWidth), [columnsList]);
|
|
147
|
+
const listOfMinWidthColumns = useMemo(() => columnsList.map(column => column.meta.minWidth), [columnsList]);
|
|
147
148
|
const {
|
|
148
149
|
result: observerResult
|
|
149
150
|
} = useResizeObserver({
|
|
150
151
|
target: gridRef.current
|
|
151
152
|
});
|
|
152
|
-
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width) => acc + (width === undefined ? 0 : getColumnWidth(width)), 0);
|
|
153
|
+
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width, index) => acc + (width === undefined ? 0 : getColumnWidth(width, listOfMinWidthColumns[index])), 0);
|
|
153
154
|
const unallocatedSpace = observerResult && observerResult.contentRect.width - allocatedSpace || 0;
|
|
154
155
|
const flexibleColumnsQty = listOfDefaultWidthColumns.filter(width => width === undefined).length;
|
|
155
156
|
const flexibleColumnWidth = getColumnWidth(unallocatedSpace / flexibleColumnsQty);
|
|
@@ -172,18 +173,19 @@ const DataGridInner = ({
|
|
|
172
173
|
}, [updateScroll, scheduleLazyRender]);
|
|
173
174
|
const getCellParams = useCallback(columnIndex => {
|
|
174
175
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex];
|
|
176
|
+
const minWidth = listOfMinWidthColumns[columnIndex];
|
|
175
177
|
const limited = !!defaultWidth && defaultWidth > 0;
|
|
176
178
|
const isFirst = columnIndex === 0;
|
|
177
179
|
const isLast = columnIndex === listOfDefaultWidthColumns.length - 1;
|
|
178
180
|
// If the column is the last one or doesn't have a default width, it should be limited to the remaining space
|
|
179
|
-
const width = getColumnWidth(defaultWidth || flexibleColumnWidth);
|
|
181
|
+
const width = getColumnWidth(defaultWidth || flexibleColumnWidth, minWidth);
|
|
180
182
|
return {
|
|
181
183
|
limited,
|
|
182
184
|
isFirst,
|
|
183
185
|
isLast,
|
|
184
186
|
width
|
|
185
187
|
};
|
|
186
|
-
}, [listOfDefaultWidthColumns, flexibleColumnWidth]);
|
|
188
|
+
}, [listOfDefaultWidthColumns, listOfMinWidthColumns, flexibleColumnWidth]);
|
|
187
189
|
const renderHeaderCell = useCallback((column, columnIndex) => {
|
|
188
190
|
var _a;
|
|
189
191
|
const {
|
|
@@ -2,6 +2,8 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import { ColumnSortDirection } from "../table/table";
|
|
3
3
|
export interface IListColumnMeta<T, N = T> {
|
|
4
4
|
readonly defaultWidth?: number;
|
|
5
|
+
readonly minWidth?: number;
|
|
6
|
+
readonly maxWidth?: number;
|
|
5
7
|
readonly defaultValue?: string;
|
|
6
8
|
readonly lazyLoad?: boolean;
|
|
7
9
|
readonly visibleOnHover?: boolean;
|
package/esm/dataGrid/row/row.js
CHANGED
|
@@ -3,10 +3,12 @@ import { memo, useCallback, useId, useMemo } from "react";
|
|
|
3
3
|
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
4
4
|
import { DataGridCell } from "../cell/cell";
|
|
5
5
|
export const MIN_CELL_WIDTH = 100;
|
|
6
|
-
const getColumnWidth = (defaultWidth) => Math.floor(Math.max(defaultWidth, MIN_CELL_WIDTH));
|
|
6
|
+
const getColumnWidth = (defaultWidth, minWidth) => Math.floor(Math.max(defaultWidth, minWidth !== null && minWidth !== void 0 ? minWidth : MIN_CELL_WIDTH));
|
|
7
7
|
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }) => {
|
|
8
8
|
const isVisible = visibleRows.has(entity.id);
|
|
9
9
|
const listOfDefaultWidthColumns = useMemo(() => columns.map(column => column.meta.defaultWidth), [columns]);
|
|
10
|
+
const listOfMinWidthColumns = useMemo(() => columns.map(column => column.meta.minWidth), [columns]);
|
|
11
|
+
const listOfMaxWidthColumns = useMemo(() => columns.map(column => column.meta.maxWidth), [columns]);
|
|
10
12
|
const getColWidth = useCallback((columnIndex, colspan) => {
|
|
11
13
|
const colsp = colspan || 1;
|
|
12
14
|
let columnWidth = 0;
|
|
@@ -15,26 +17,28 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
15
17
|
continue;
|
|
16
18
|
}
|
|
17
19
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex + i];
|
|
20
|
+
const minWidth = listOfMinWidthColumns[columnIndex + i];
|
|
18
21
|
// If the column is the last one or doesn't have a default width, it should be limited to the remaining space
|
|
19
|
-
const width = getColumnWidth(defaultWidth || flexibleColumnWidth);
|
|
22
|
+
const width = getColumnWidth(defaultWidth || flexibleColumnWidth, minWidth);
|
|
20
23
|
columnWidth += width;
|
|
21
24
|
}
|
|
22
25
|
return columnWidth;
|
|
23
|
-
}, [flexibleColumnWidth, listOfDefaultWidthColumns]);
|
|
26
|
+
}, [flexibleColumnWidth, listOfDefaultWidthColumns, listOfMinWidthColumns]);
|
|
24
27
|
const getCellParams = useCallback((columnIndex, colspan) => {
|
|
25
28
|
const width = getColWidth(columnIndex, colspan);
|
|
26
29
|
const defaultWidth = listOfDefaultWidthColumns[columnIndex];
|
|
30
|
+
const maxWidth = listOfMaxWidthColumns[columnIndex];
|
|
27
31
|
const limited = !!defaultWidth && defaultWidth > 0;
|
|
28
32
|
const isFirst = columnIndex === 0;
|
|
29
33
|
const isLast = columnIndex === listOfDefaultWidthColumns.length - 1;
|
|
30
|
-
return { limited, isFirst, isLast, width };
|
|
31
|
-
}, [getColWidth, listOfDefaultWidthColumns]);
|
|
34
|
+
return { limited, isFirst, isLast, width, maxWidth };
|
|
35
|
+
}, [getColWidth, listOfDefaultWidthColumns, listOfMaxWidthColumns]);
|
|
32
36
|
const mainRowId = useId();
|
|
33
37
|
const renderCells = useCallback((rowEntity, isNested) => columns.reduce((acc, column, index) => {
|
|
34
38
|
const colspanFn = column.colspan;
|
|
35
39
|
let colspan = colspanFn ? (typeof colspanFn === "function" ? colspanFn(rowEntity) : colspanFn) : undefined;
|
|
36
40
|
colspan = colspan && colspan > 1 ? colspan : undefined;
|
|
37
|
-
const { limited, width } = getCellParams(index, colspan);
|
|
41
|
+
const { limited, width, maxWidth } = getCellParams(index, colspan);
|
|
38
42
|
if (acc.colspan > 0) {
|
|
39
43
|
acc.colspan--;
|
|
40
44
|
return acc;
|
|
@@ -49,7 +53,7 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
49
53
|
? column.columnComponent.renderNested.bind(column.columnComponent)
|
|
50
54
|
: column.columnComponent.render.bind(column.columnComponent))
|
|
51
55
|
: column.columnComponent.render.bind(column.columnComponent);
|
|
52
|
-
acc.cells.push(_jsx(DataGridCell, { render: e => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : onClick ? () => onClick(rowEntity.id) : undefined, isActive: isActive, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
|
|
56
|
+
acc.cells.push(_jsx(DataGridCell, { render: e => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, maxWidth: column.meta.visibleOnHover ? undefined : maxWidth, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : onClick ? () => onClick(rowEntity.id) : undefined, isActive: isActive, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
|
|
53
57
|
return acc;
|
|
54
58
|
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, onClick]);
|
|
55
59
|
const cells = useMemo(() => renderCells(entity, false), [entity, renderCells]);
|
|
@@ -18,6 +18,7 @@ const SubColumnsList = ({ title, columns, settings, disabledColumns, onChange, s
|
|
|
18
18
|
showCheckbox: true,
|
|
19
19
|
children: c.title
|
|
20
20
|
})), [columns, disabledColumns, sortColumnsInt]);
|
|
21
|
+
const allDisabled = useMemo(() => items.every(item => item.disabled), [items]);
|
|
21
22
|
const state = columns.reduce((res, c) => {
|
|
22
23
|
res.set(c.id, settings.get(c.name) !== false ? CheckboxState.On : CheckboxState.Off);
|
|
23
24
|
return res;
|
|
@@ -30,7 +31,7 @@ const SubColumnsList = ({ title, columns, settings, disabledColumns, onChange, s
|
|
|
30
31
|
});
|
|
31
32
|
onChange && onChange(newSettings);
|
|
32
33
|
}, [columns, settings, onChange]);
|
|
33
|
-
const list = useMemo(() => _jsx(SelectList, { id: id, items: items, value: state, title: title || "", multiselect: true, showCheckbox: true, onChange: onChangeItem }), [id, items, state, title, onChangeItem]);
|
|
34
|
+
const list = useMemo(() => (_jsx(SelectList, { id: id, items: items, value: state, title: title || "", multiselect: true, showCheckbox: true, onChange: onChangeItem, disabled: allDisabled })), [id, items, state, title, onChangeItem, allDisabled]);
|
|
34
35
|
if (!title) {
|
|
35
36
|
return list;
|
|
36
37
|
}
|
|
@@ -7,6 +7,10 @@ import { DeviceType } from "../../../../commonHelpers/hooks/deviceType";
|
|
|
7
7
|
type TBulkAction = IBulkActionLink | IBulkActionButton;
|
|
8
8
|
export interface IBulkActionsProps extends IZenComponentProps {
|
|
9
9
|
selected: number;
|
|
10
|
+
/**
|
|
11
|
+
* When `true`, displays "All selected" instead of a count, and enables action buttons
|
|
12
|
+
* even when `selected` is 0 (i.e., cross-page "select all" is active).
|
|
13
|
+
*/
|
|
10
14
|
allSelected?: boolean;
|
|
11
15
|
onClearSelection: () => void;
|
|
12
16
|
onSelectAll?: () => void;
|
|
@@ -7,5 +7,5 @@ export const parseLabel = (option, dateFormat, translate, toLocalFn) => {
|
|
|
7
7
|
localeFrom.getFullYear() === localeTo.getFullYear()) {
|
|
8
8
|
return formatDate(localeFrom, dateFormat, translate);
|
|
9
9
|
}
|
|
10
|
-
return `${formatDate(localeFrom, dateFormat, translate)}
|
|
10
|
+
return `${formatDate(localeFrom, dateFormat, translate)} – ${formatDate(localeTo, dateFormat, translate)}`;
|
|
11
11
|
};
|
|
@@ -15,7 +15,6 @@ export interface IDropdownList extends IZenComponentProps {
|
|
|
15
15
|
backButtonName?: string;
|
|
16
16
|
isAllSelected?: boolean;
|
|
17
17
|
isSelectAllActive?: boolean;
|
|
18
|
-
shouldBlockItems?: boolean;
|
|
19
18
|
listData: ICheckboxListWithActionOption[] | ISelectListItem[];
|
|
20
19
|
isWithFooter: boolean;
|
|
21
20
|
width?: number;
|
|
@@ -41,6 +40,6 @@ interface IDropdownEmptyList extends Pick<IDropdownList, "className" | "width" |
|
|
|
41
40
|
hasError: boolean;
|
|
42
41
|
}
|
|
43
42
|
export declare const EmptyList: ({ className, width, onClearClick, onApplyClick, onCancelClick, hasApplyButton, isApplyDisabled, isClearButtonDisabled, isWithFooter, hasError }: IDropdownEmptyList) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isSelectAllActive,
|
|
43
|
+
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isSelectAllActive, backButtonName, width, minWidth, isSelectAllButtonDisable, hasSelectAllButton, filterName, isMultiselect, hasApplyButton, isApplyDisabled, isClearButtonDisabled, activeValue, forceSelection, isWithFooter, isMobile, handleCheckboxChange, checkboxLabel, isChecked, listElementRef, listId }: IDropdownList) => import("react/jsx-runtime").JSX.Element;
|
|
45
44
|
export declare const TRANSLATIONS: string[];
|
|
46
45
|
export {};
|
|
@@ -293,7 +293,6 @@ export const DropdownList = ({
|
|
|
293
293
|
onSingleSelect,
|
|
294
294
|
listData,
|
|
295
295
|
isSelectAllActive,
|
|
296
|
-
shouldBlockItems,
|
|
297
296
|
backButtonName,
|
|
298
297
|
width,
|
|
299
298
|
minWidth,
|
|
@@ -393,15 +392,11 @@ export const DropdownList = ({
|
|
|
393
392
|
});
|
|
394
393
|
return values;
|
|
395
394
|
};
|
|
396
|
-
const multiselectOptions = shouldBlockItems ? listData.map(item => Object.assign(Object.assign({}, item), {
|
|
397
|
-
blocked: true,
|
|
398
|
-
checked: false
|
|
399
|
-
})) : listData;
|
|
400
395
|
return _jsx("div", {
|
|
401
396
|
className: "zen-dropdown-list__elements",
|
|
402
397
|
ref: listElementRef,
|
|
403
398
|
children: isMultiselect ? _jsx(CheckboxListWithAction, {
|
|
404
|
-
options:
|
|
399
|
+
options: listData,
|
|
405
400
|
label: "",
|
|
406
401
|
onChange: handleChange,
|
|
407
402
|
onClick: handleClick
|
|
@@ -417,7 +412,7 @@ export const DropdownList = ({
|
|
|
417
412
|
value: createValue(listData, activeValue)
|
|
418
413
|
})
|
|
419
414
|
});
|
|
420
|
-
}, [listElementRef, isMultiselect,
|
|
415
|
+
}, [listElementRef, isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
|
|
421
416
|
return _jsxs("div", Object.assign({
|
|
422
417
|
className: classNames(["zen-dropdown-list", driveComponentClass || ""])
|
|
423
418
|
}, styleWidth, {
|
|
@@ -526,12 +526,18 @@ export const DropdownRaw = props => {
|
|
|
526
526
|
}, [setChecked, setSearch]);
|
|
527
527
|
const debouncedGetData = useDebounce((signal, searchValue, isChecked) => getData ? (isCheckboxMode ? getData(signal, searchValue, isChecked) : getData(signal, searchValue)).then(dta => handleData(dta, searchValue)).catch(handleError) : customGetData(searchValue).then(dta => handleData(dta, searchValue)).catch(handleError), 200);
|
|
528
528
|
const controlData = useCallback((signal, searchValue, isChecked) => {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
529
|
+
if (isQueryMode) {
|
|
530
|
+
handleQueryMode(searchValue, isChecked);
|
|
531
|
+
} else if (!getData && dataItems && !searchValue) {
|
|
532
|
+
handleData(dataItems, "");
|
|
533
|
+
} else {
|
|
534
|
+
dispatchState({
|
|
535
|
+
type: StateActionType.ShowWaiting,
|
|
536
|
+
payload: undefined
|
|
537
|
+
});
|
|
538
|
+
debouncedGetData(signal, searchValue, isChecked);
|
|
539
|
+
}
|
|
540
|
+
}, [debouncedGetData, handleData, handleQueryMode, isQueryMode, getData, dataItems]);
|
|
535
541
|
useEffect(() => {
|
|
536
542
|
var _a;
|
|
537
543
|
const timeoutId = (_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
|
|
@@ -856,13 +862,12 @@ export const DropdownRaw = props => {
|
|
|
856
862
|
filterName: isMobile ? undefined : filterName,
|
|
857
863
|
isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? isEveryItemSelected(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? isAllChildrenSelected(state, state.currentId || state.rootId) : false,
|
|
858
864
|
isSelectAllActive: isFullSelectionMode ? currentAllSelected : selectAllActiveForCurrentLevel,
|
|
859
|
-
shouldBlockItems: !state.inputValue && !isFullSelectionMode && selectAllActiveForCurrentLevel,
|
|
860
865
|
isMultiselect: multiselect,
|
|
861
866
|
forceSelection: forceSelection,
|
|
862
867
|
listData: currentListData,
|
|
863
868
|
width: width || currentWidth === 180 ? undefined : currentWidth,
|
|
864
869
|
minWidth: currentWidth,
|
|
865
|
-
hasSelectAllButton: selectAllButton && multiselect
|
|
870
|
+
hasSelectAllButton: selectAllButton && multiselect,
|
|
866
871
|
hasApplyButton: hasApplyButton,
|
|
867
872
|
isApplyDisabled: memoizedIsApplyButtonDisabled,
|
|
868
873
|
isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode && state.isNestedList && isAllItemsHasOneParent(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
|
|
@@ -4,8 +4,10 @@ import { ButtonIconPosition, TextIconButton } from "../../textIconButton/textIco
|
|
|
4
4
|
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
5
5
|
import { useEffect, useRef, useState, Children, cloneElement, useCallback } from "react";
|
|
6
6
|
import { IconChevronRight } from "../../icons/iconChevronRight";
|
|
7
|
+
import { IconChevronLeft } from "../../icons/iconChevronLeft";
|
|
7
8
|
import { useLanguage } from "../../utils/localization/useLanguage";
|
|
8
9
|
import { useDriveClassName } from "../../utils/theme/useDriveClassName";
|
|
10
|
+
import { useIsRTL } from "../../utils/localization/useIsRTL";
|
|
9
11
|
import { zen } from "../../utils/zen";
|
|
10
12
|
injectString("cs", "Scroll left", "P\u0159ej\xEDt doleva");
|
|
11
13
|
injectString("da-DK", "Scroll left", "Rul til venstre");
|
|
@@ -76,6 +78,10 @@ const getScrollButtonType = element => {
|
|
|
76
78
|
}
|
|
77
79
|
return "start";
|
|
78
80
|
};
|
|
81
|
+
const getScrollIcons = isRTL => ({
|
|
82
|
+
start: isRTL ? IconChevronRight : IconChevronLeft,
|
|
83
|
+
end: isRTL ? IconChevronLeft : IconChevronRight
|
|
84
|
+
});
|
|
79
85
|
export const FiltersContainer = ({
|
|
80
86
|
className,
|
|
81
87
|
children
|
|
@@ -85,6 +91,11 @@ export const FiltersContainer = ({
|
|
|
85
91
|
const {
|
|
86
92
|
translate
|
|
87
93
|
} = useLanguage();
|
|
94
|
+
const isRTL = useIsRTL();
|
|
95
|
+
const {
|
|
96
|
+
start: startScrollIcon,
|
|
97
|
+
end: endScrollIcon
|
|
98
|
+
} = getScrollIcons(isRTL);
|
|
88
99
|
const gradientClass = "zen-filters-toolbar__gradient";
|
|
89
100
|
const scrollerClass = "zen-filters-toolbar__scroller";
|
|
90
101
|
const driveClassNameScroller = useDriveClassName(scrollerClass);
|
|
@@ -197,10 +208,9 @@ export const FiltersContainer = ({
|
|
|
197
208
|
}), _jsx(TextIconButton, {
|
|
198
209
|
title: translate("Scroll left"),
|
|
199
210
|
className: classNames(["zen-filters-toolbar__scroller", driveClassNameScroller || "", "zen-filters-toolbar__start", showLeft ? `${scrollerClass}--visible` : "", isHiddenDisplay.left ? `${scrollerClass}--hidden` : ""]),
|
|
200
|
-
icon:
|
|
211
|
+
icon: startScrollIcon,
|
|
201
212
|
iconPosition: ButtonIconPosition.Start,
|
|
202
|
-
onClick: handleScrollButtonClick(-scrollableStep)
|
|
203
|
-
iconClasses: "zen-filters-toolbar__start-icon"
|
|
213
|
+
onClick: handleScrollButtonClick(-scrollableStep)
|
|
204
214
|
}), _jsx("div", {
|
|
205
215
|
ref: scrollableRef,
|
|
206
216
|
className: classNames(["zen-filters-toolbar__scrollable", !isHiddenDisplay.left ? "has-left-scroller" : "", !isHiddenDisplay.right ? "has-right-scroller" : ""]),
|
|
@@ -213,7 +223,7 @@ export const FiltersContainer = ({
|
|
|
213
223
|
}), _jsx(TextIconButton, {
|
|
214
224
|
title: translate("Scroll right"),
|
|
215
225
|
className: classNames([scrollerClass, driveClassNameScroller || "", "zen-filters-toolbar__end", showRight ? `${scrollerClass}--visible` : "", isHiddenDisplay.right ? `${scrollerClass}--hidden` : ""]),
|
|
216
|
-
icon:
|
|
226
|
+
icon: endScrollIcon,
|
|
217
227
|
onClick: handleScrollButtonClick(scrollableStep),
|
|
218
228
|
iconPosition: ButtonIconPosition.End
|
|
219
229
|
})]
|
package/esm/index.d.ts
CHANGED
|
@@ -774,8 +774,6 @@ export { HeaderButtonsProvider } from "./utils/headerButtons/headerButtonsProvid
|
|
|
774
774
|
export { getNewFocusableItem, getFirstFocusableItem } from "./utils/keyboardHelpers";
|
|
775
775
|
export { LanguageProvider } from "./utils/localization/languageProvider";
|
|
776
776
|
export { dictionaries, injectString } from "./utils/localization/translationsDictionary";
|
|
777
|
-
export { directionContext } from "./utils/localization/directionContext";
|
|
778
|
-
export type { TTextDirection } from "./utils/localization/getTextDirection";
|
|
779
777
|
export { useDirection } from "./utils/localization/useDirection";
|
|
780
778
|
export { useLanguage } from "./utils/localization/useLanguage";
|
|
781
779
|
export { ThemeDark } from "./utils/theme/themeDark";
|
package/esm/index.js
CHANGED
|
@@ -758,7 +758,6 @@ export { HeaderButtonsProvider } from "./utils/headerButtons/headerButtonsProvid
|
|
|
758
758
|
export { getNewFocusableItem, getFirstFocusableItem } from "./utils/keyboardHelpers";
|
|
759
759
|
export { LanguageProvider } from "./utils/localization/languageProvider";
|
|
760
760
|
export { dictionaries, injectString } from "./utils/localization/translationsDictionary";
|
|
761
|
-
export { directionContext } from "./utils/localization/directionContext";
|
|
762
761
|
export { useDirection } from "./utils/localization/useDirection";
|
|
763
762
|
export { useLanguage } from "./utils/localization/useLanguage";
|
|
764
763
|
export { ThemeDark } from "./utils/theme/themeDark";
|
|
@@ -63,6 +63,7 @@ export const RadioGroupRaw = (props) => {
|
|
|
63
63
|
"zen-radio-group__item",
|
|
64
64
|
wrappedInLabel ? "zen-radio-group__item--no-paddings" : "",
|
|
65
65
|
type === "interactive" ? "zen-radio--interactive" : "",
|
|
66
|
-
size === "small" ? "zen-radio-group__item--small" : ""
|
|
66
|
+
size === "small" ? "zen-radio-group__item--small" : "",
|
|
67
|
+
direction === "horizontal" ? "zen-radio--align-start" : ""
|
|
67
68
|
]), key: ind, checked: item.value === value, disabled: disabled ? disabled : item.disabled, name: name, reverse: reverse, fullWidth: fullWidth, value: item.value, onChange: onChangeInner, wrappedInLabel: wrappedInLabel, tabIndex: selectItemOnFocus || disabled || item.disabled ? undefined : ind === focusedIndex ? 0 : -1, ref: selectItemOnFocus ? undefined : ind === focusedIndex ? focusElementRef : undefined, role: itemRole }), item.children) }, `${ind}-li`))) })) }));
|
|
68
69
|
};
|
|
@@ -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,27 +35,52 @@ 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++) {
|
|
54
|
-
if (state.get(items[i].id) === CheckboxState.On) {
|
|
79
|
+
if (!items[i].disabled && state.get(items[i].id) === CheckboxState.On) {
|
|
55
80
|
return i;
|
|
56
81
|
}
|
|
57
82
|
}
|
|
58
|
-
return multiselect
|
|
83
|
+
return multiselect ? items.findIndex(item => !item.disabled) : -1;
|
|
59
84
|
};
|
|
60
85
|
export const getItemsState = (items, value, multiselect) => {
|
|
61
86
|
let forceUncheck = false;
|
|
@@ -48,7 +48,9 @@ export const SelectList = (_a) => {
|
|
|
48
48
|
if (!multiselect && selectItemOnFocus) {
|
|
49
49
|
dispatchState({ type: ListAction.FocusFirst, payload: { items } });
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
if (!multiselect) {
|
|
52
|
+
dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
|
|
53
|
+
}
|
|
52
54
|
}, [multiselect, items, selectItemOnFocus]);
|
|
53
55
|
useEffect(() => {
|
|
54
56
|
onChange && state.isItemsStateChanged && onChange(new Map(state.itemsState));
|
|
@@ -117,8 +117,7 @@ export const selectListReducer = (state, action) => {
|
|
|
117
117
|
newItemsState = updatedState;
|
|
118
118
|
});
|
|
119
119
|
const prevActiveItemId = getItemIdByIndex(state.itemsState, state.activeIndex);
|
|
120
|
-
const
|
|
121
|
-
const activeIndex = newActiveItemIndex ? newActiveItemIndex : -1;
|
|
120
|
+
const activeIndex = prevActiveItemId !== undefined ? getItemIndexById(newItemsState, prevActiveItemId) : -1;
|
|
122
121
|
return Object.assign(Object.assign({}, state), { itemsState: newItemsState, activeIndex, isItemsStateChanged: false });
|
|
123
122
|
}
|
|
124
123
|
case ListAction.SetLevel: {
|
|
@@ -65,6 +65,60 @@ injectString("zh-Hans", "Change sort direction", "\u66F4\u6539\u6392\u5E8F");
|
|
|
65
65
|
injectString("zh-TW", "Change sort direction", "\u8B8A\u66F4\u6392\u5E8F\u65B9\u5411");
|
|
66
66
|
injectString("ro-RO", "Change sort direction", "Schimba\u021Bi direc\u021Bia sort\u0103rii");
|
|
67
67
|
injectString("ar-SA", "Change sort direction", "\u062A\u063A\u064A\u064A\u0631 \u0627\u062A\u062C\u0627\u0647 \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
|
|
68
|
+
injectString("cs", "Ascending", "Vzestupn\u011B");
|
|
69
|
+
injectString("da-DK", "Ascending", "Stigende");
|
|
70
|
+
injectString("de", "Ascending", "Aufsteigend");
|
|
71
|
+
injectString("en", "Ascending", "Ascending");
|
|
72
|
+
injectString("es", "Ascending", "Ascendente");
|
|
73
|
+
injectString("fi-FI", "Ascending", "Nouseva");
|
|
74
|
+
injectString("fr", "Ascending", "Croissant");
|
|
75
|
+
injectString("fr-FR", "Ascending", "Croissant");
|
|
76
|
+
injectString("hu-HU", "Ascending", "N\xF6vekv\u0151");
|
|
77
|
+
injectString("id", "Ascending", "Naik");
|
|
78
|
+
injectString("it", "Ascending", "Crescente");
|
|
79
|
+
injectString("ja", "Ascending", "\u6607\u9806");
|
|
80
|
+
injectString("ko-KR", "Ascending", "\uC624\uB984\uCC28\uC21C");
|
|
81
|
+
injectString("ms", "Ascending", "Menaik");
|
|
82
|
+
injectString("nb-NO", "Ascending", "Stigende");
|
|
83
|
+
injectString("nl", "Ascending", "Oplopend");
|
|
84
|
+
injectString("pl", "Ascending", "Rosn\u0105co");
|
|
85
|
+
injectString("pt-BR", "Ascending", "Crescente");
|
|
86
|
+
injectString("pt-PT", "Ascending", "Ascendente");
|
|
87
|
+
injectString("sk-SK", "Ascending", "Vzostupne");
|
|
88
|
+
injectString("sv", "Ascending", "Stigande");
|
|
89
|
+
injectString("th", "Ascending", "\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01");
|
|
90
|
+
injectString("tr", "Ascending", "Artan");
|
|
91
|
+
injectString("zh-Hans", "Ascending", "\u5347\u5E8F");
|
|
92
|
+
injectString("zh-TW", "Ascending", "\u905E\u589E");
|
|
93
|
+
injectString("ro-RO", "Ascending", "Ascensiune");
|
|
94
|
+
injectString("ar-SA", "Ascending", "\u062A\u0635\u0627\u0639\u062F\u064A");
|
|
95
|
+
injectString("cs", "Descending", "Sestupn\u011B");
|
|
96
|
+
injectString("da-DK", "Descending", "Faldende");
|
|
97
|
+
injectString("de", "Descending", "Absteigend");
|
|
98
|
+
injectString("en", "Descending", "Descending");
|
|
99
|
+
injectString("es", "Descending", "Descendente");
|
|
100
|
+
injectString("fi-FI", "Descending", "Laskeva");
|
|
101
|
+
injectString("fr", "Descending", "D\xE9croissant");
|
|
102
|
+
injectString("fr-FR", "Descending", "Descendant");
|
|
103
|
+
injectString("hu-HU", "Descending", "Cs\xF6kken\u0151");
|
|
104
|
+
injectString("id", "Descending", "Menurun");
|
|
105
|
+
injectString("it", "Descending", "Decrescente");
|
|
106
|
+
injectString("ja", "Descending", "\u964D\u9806");
|
|
107
|
+
injectString("ko-KR", "Descending", "\uB0B4\uB9BC\uCC28\uC21C");
|
|
108
|
+
injectString("ms", "Descending", "Menurun");
|
|
109
|
+
injectString("nb-NO", "Descending", "Synkende");
|
|
110
|
+
injectString("nl", "Descending", "Aflopend");
|
|
111
|
+
injectString("pl", "Descending", "Malej\u0105co");
|
|
112
|
+
injectString("pt-BR", "Descending", "Decrescente");
|
|
113
|
+
injectString("pt-PT", "Descending", "Descendente");
|
|
114
|
+
injectString("sk-SK", "Descending", "Zostupne");
|
|
115
|
+
injectString("sv", "Descending", "Fallande");
|
|
116
|
+
injectString("th", "Descending", "\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22");
|
|
117
|
+
injectString("tr", "Descending", "Azalan");
|
|
118
|
+
injectString("zh-Hans", "Descending", "\u964D\u5E8F");
|
|
119
|
+
injectString("zh-TW", "Descending", "\u905E\u6E1B");
|
|
120
|
+
injectString("ro-RO", "Descending", "Cobor\xE2re");
|
|
121
|
+
injectString("ar-SA", "Descending", "\u062A\u0646\u0627\u0632\u0644\u064A");
|
|
68
122
|
injectString("cs", "Sort Options", "Sort Options");
|
|
69
123
|
injectString("da-DK", "Sort Options", "Sorteringsmuligheder");
|
|
70
124
|
injectString("de", "Sort Options", "Sort Options");
|
|
@@ -149,7 +203,6 @@ export const SortControl = ({
|
|
|
149
203
|
onClick: () => onSortDirectionToggle(),
|
|
150
204
|
disabled: disabled,
|
|
151
205
|
title: translate("Change sort direction"),
|
|
152
|
-
"aria-label": translate("Change sort direction"),
|
|
153
206
|
children: [directionIcon ? sortDirection === SortDirections.Ascending ? _jsx(IconFilter3Asc, {
|
|
154
207
|
className: "zen-sort-container__sort-icon",
|
|
155
208
|
size: isDrive ? "huge" : "large"
|
|
@@ -162,6 +215,9 @@ export const SortControl = ({
|
|
|
162
215
|
children: [buttonTextValue, ": "]
|
|
163
216
|
}), _jsx("span", {
|
|
164
217
|
children: (items.find(item => item.id === sortBy) || items[0]).children
|
|
218
|
+
}), _jsxs("span", {
|
|
219
|
+
className: "zen-visually-hidden",
|
|
220
|
+
children: [" ", sortDirection === SortDirections.Ascending ? translate("Ascending") : translate("Descending")]
|
|
165
221
|
})]
|
|
166
222
|
})]
|
|
167
223
|
}), isSingleItem ? "" : _jsx(Popup, {
|
|
@@ -188,4 +244,4 @@ export const SortControl = ({
|
|
|
188
244
|
}, popupKey)]
|
|
189
245
|
});
|
|
190
246
|
};
|
|
191
|
-
export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"];
|
|
247
|
+
export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction", "Ascending", "Descending"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, RefObject } from "react";
|
|
2
|
-
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void,
|
|
2
|
+
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
|
|
3
3
|
bulkActions: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
4
4
|
pagination: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
5
5
|
activePage: number | undefined;
|
|
@@ -24,7 +24,7 @@ const isChildElement = function (child, expectedType) {
|
|
|
24
24
|
}
|
|
25
25
|
return false;
|
|
26
26
|
};
|
|
27
|
-
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection,
|
|
27
|
+
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel) => useMemo(() => {
|
|
28
28
|
let bulkActions = undefined;
|
|
29
29
|
let tablePagination = undefined;
|
|
30
30
|
let activePage = undefined;
|
|
@@ -39,7 +39,7 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
39
39
|
}
|
|
40
40
|
if (isChildElement(child, TableBulkActions.displayName)) {
|
|
41
41
|
const bulkActionButtons = child.props.children || [];
|
|
42
|
-
bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection,
|
|
42
|
+
bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if (isChildElement(child, TablePagination.displayName)) {
|
|
@@ -100,4 +100,4 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
100
100
|
detailPanel: detailPanel,
|
|
101
101
|
other: other
|
|
102
102
|
};
|
|
103
|
-
}, [children, clearSelection, isMobile, selected, gridRef, allSelected,
|
|
103
|
+
}, [children, clearSelection, isMobile, selected, gridRef, allSelected, activeId, onCloseDetailPanel]);
|
|
@@ -57,6 +57,7 @@ const SubColumnsList = ({
|
|
|
57
57
|
showCheckbox: true,
|
|
58
58
|
children: c.title
|
|
59
59
|
})), [columns, sortColumnsInt, lastVisibleColumnId]);
|
|
60
|
+
const allDisabled = useMemo(() => items.every(item => item.disabled), [items]);
|
|
60
61
|
const state = columns.reduce((res, c) => {
|
|
61
62
|
res.set(c.id, settings.get(c.id) !== false ? CheckboxState.On : CheckboxState.Off);
|
|
62
63
|
return res;
|
|
@@ -76,8 +77,9 @@ const SubColumnsList = ({
|
|
|
76
77
|
title: title || translate("Select visible columns"),
|
|
77
78
|
multiselect: true,
|
|
78
79
|
showCheckbox: true,
|
|
79
|
-
onChange: onChangeItem
|
|
80
|
-
|
|
80
|
+
onChange: onChangeItem,
|
|
81
|
+
disabled: allDisabled
|
|
82
|
+
}), [id, items, state, title, translate, onChangeItem, allDisabled]);
|
|
81
83
|
if (!title) {
|
|
82
84
|
return list;
|
|
83
85
|
}
|