@geotab/zenith 3.16.0-beta.4 → 3.16.0-nightly.20260923.3d291e8
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 +35 -1
- package/README.md.baseline +1 -0
- package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/dist/commonStyles/colors/colors.less +18 -0
- package/dist/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
- package/dist/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
- package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
- package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
- package/dist/dataGrid/dataGrid.d.ts +5 -1
- package/dist/dataGrid/dataGrid.js +39 -2
- package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
- package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +54 -0
- package/dist/dataGrid/row/row.js +3 -2
- package/dist/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownHelper.d.ts +4 -0
- package/dist/dropdownRaw/dropdownHelper.js +11 -10
- package/dist/dropdownRaw/dropdownRaw.js +4 -3
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +4 -3
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +2 -2
- package/dist/dropdownRaw/types.d.ts +2 -0
- package/dist/filterButton/filterButton.d.ts +1 -1
- package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/dist/header/headerButton.d.ts +3 -1
- package/dist/header/headerButton.js +1 -1
- package/dist/header/headerMenu.d.ts +2 -0
- package/dist/header/headerMenu.js +1 -1
- package/dist/index.css +190 -30
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -3
- package/dist/menu/components/menuButton.d.ts +3 -1
- package/dist/menu/components/menuButton.js +12 -11
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/pagination/pagination.d.ts +19 -4
- package/dist/pagination/pagination.js +21 -1
- package/dist/pagination/paginationText/paginationText.d.ts +7 -1
- package/dist/pagination/paginationText/paginationText.js +6 -3
- package/dist/selectList/selectList.js +1 -0
- package/dist/selectList/selectListItem.d.ts +4 -1
- package/dist/selectList/selectListItem.js +4 -3
- package/dist/table/children/tablePagination.d.ts +1 -1
- package/dist/table/children/useTableChildren.d.ts +2 -1
- package/dist/table/children/useTableChildren.js +36 -12
- package/dist/table/selectable/interfaces.d.ts +22 -0
- package/dist/table/selectable/useDragSelection.d.ts +10 -0
- package/dist/table/selectable/useDragSelection.js +139 -0
- package/dist/table/selectable/useSelectableRows.d.ts +2 -2
- package/dist/table/selectable/useSelectableRows.js +93 -15
- package/dist/table/selectable/utils/calculateSelectionState.js +35 -0
- package/dist/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
- package/dist/table/selectable/utils/getDragSelectionRows.js +28 -0
- package/dist/table/selectable/utils/getRangeIds.d.ts +2 -0
- package/dist/table/selectable/utils/getRangeIds.js +21 -0
- package/dist/table/selectable/utils/isRowChecked.js +12 -1
- package/dist/table/table.js +22 -6
- package/dist/utils/localization/translations/en.json +3 -0
- package/dist/waiting/waiting.js +95 -1
- package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
- package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
- package/esm/dataGrid/dataGrid.d.ts +5 -1
- package/esm/dataGrid/dataGrid.js +38 -2
- package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
- package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +45 -0
- package/esm/dataGrid/row/row.js +3 -2
- package/esm/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownHelper.d.ts +4 -0
- package/esm/dropdownRaw/dropdownHelper.js +11 -10
- package/esm/dropdownRaw/dropdownRaw.js +4 -3
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +4 -3
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +2 -2
- package/esm/dropdownRaw/types.d.ts +2 -0
- package/esm/filterButton/filterButton.d.ts +1 -1
- package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/esm/header/headerButton.d.ts +3 -1
- package/esm/header/headerButton.js +1 -1
- package/esm/header/headerMenu.d.ts +2 -0
- package/esm/header/headerMenu.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/menu/components/menuButton.d.ts +3 -1
- package/esm/menu/components/menuButton.js +12 -11
- package/esm/menu/components/menuItem.js +4 -4
- package/esm/pagination/pagination.d.ts +19 -4
- package/esm/pagination/pagination.js +21 -1
- package/esm/pagination/paginationText/paginationText.d.ts +7 -1
- package/esm/pagination/paginationText/paginationText.js +6 -3
- package/esm/selectList/selectList.js +1 -0
- package/esm/selectList/selectListItem.d.ts +4 -1
- package/esm/selectList/selectListItem.js +4 -3
- package/esm/table/children/tablePagination.d.ts +1 -1
- package/esm/table/children/useTableChildren.d.ts +2 -1
- package/esm/table/children/useTableChildren.js +36 -12
- package/esm/table/selectable/interfaces.d.ts +22 -0
- package/esm/table/selectable/useDragSelection.d.ts +10 -0
- package/esm/table/selectable/useDragSelection.js +135 -0
- package/esm/table/selectable/useSelectableRows.d.ts +2 -2
- package/esm/table/selectable/useSelectableRows.js +93 -15
- package/esm/table/selectable/utils/calculateSelectionState.js +35 -0
- package/esm/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
- package/esm/table/selectable/utils/getDragSelectionRows.js +24 -0
- package/esm/table/selectable/utils/getRangeIds.d.ts +2 -0
- package/esm/table/selectable/utils/getRangeIds.js +17 -0
- package/esm/table/selectable/utils/isRowChecked.js +12 -1
- package/esm/table/table.js +23 -7
- package/esm/utils/localization/translations/en.json +3 -0
- package/esm/waiting/waiting.js +96 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -164,7 +164,7 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
164
164
|
|
|
165
165
|
### 3.10.0
|
|
166
166
|
|
|
167
|
-
- Add `
|
|
167
|
+
- Add `vertical` props to `ListItem`
|
|
168
168
|
- Add `data-analytics-id` prop to `Tab`, `TabItem`, and `Bookmark`
|
|
169
169
|
- `Nav` component: support show/hide separator between Core and Apps sections
|
|
170
170
|
- `Nav` empty state support
|
|
@@ -764,6 +764,40 @@ Upgrade today to take advantage of modern JavaScript module support and improved
|
|
|
764
764
|
- Improve sizing of the title in Header
|
|
765
765
|
- Add the property `triggerAriaLabel` to `Dropdown`
|
|
766
766
|
|
|
767
|
+
### 1.14.0
|
|
768
|
+
|
|
769
|
+
- Create the Layout
|
|
770
|
+
- Update strings
|
|
771
|
+
- Add aria-label to Stepper, Range and FilterButton
|
|
772
|
+
- Improve accessibility of icons
|
|
773
|
+
|
|
774
|
+
### 1.13.1
|
|
775
|
+
|
|
776
|
+
- Improve behavior of the DateRange selection
|
|
777
|
+
- Improve imports in Zenith
|
|
778
|
+
- Fix date position in PillExpandable
|
|
779
|
+
- Update package description, add license
|
|
780
|
+
- Add option to open links in new tab in PillExpandable
|
|
781
|
+
- Fix visual styles of MiniTabs
|
|
782
|
+
- Allow passing fragment as a child of the Header
|
|
783
|
+
- Stepper max value not working as expected
|
|
784
|
+
- Allow text formatting in the description of the PillExpandable
|
|
785
|
+
- Prevent rerendering in useMobile
|
|
786
|
+
|
|
787
|
+
### 1.13.0
|
|
788
|
+
|
|
789
|
+
- New component Table
|
|
790
|
+
- Clean search input in Dropdown on close popup
|
|
791
|
+
- Fix tabbing through all rows in a table
|
|
792
|
+
- Rename "All filters" to "Filters" in FiltersBar
|
|
793
|
+
- Improve tooltip accessibility
|
|
794
|
+
- Add ecosystem icons
|
|
795
|
+
- Increase focus area in search input
|
|
796
|
+
- Fix issue with loosing seconds when changing date or time in calendar
|
|
797
|
+
- The new component Skeleton for loading animation
|
|
798
|
+
- Fix the Select component selection issue
|
|
799
|
+
- Update npm dependencies
|
|
800
|
+
|
|
767
801
|
## Feedback
|
|
768
802
|
|
|
769
803
|
For any questions or feedback please email zenith@geotab.com.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
844121ca3e0f2233c3ae7ac5348ee03c3e60441d59b6150408db3401e9346141
|
|
@@ -11,6 +11,8 @@ export interface ICheckboxListWithActionOption {
|
|
|
11
11
|
isWithAction: boolean;
|
|
12
12
|
countSelectedChild?: number;
|
|
13
13
|
color?: IColor;
|
|
14
|
+
/** When true, renders a 1px separator line below this item. */
|
|
15
|
+
divider?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface IChangeCheckbox {
|
|
16
18
|
id: string;
|
|
@@ -443,7 +443,7 @@ const CheckboxListWithAction = ({
|
|
|
443
443
|
const labelForRender = selectSearchTerm(opt.label);
|
|
444
444
|
const labelElement = renderLabel(opt, labelForRender, titleForRender, ind);
|
|
445
445
|
return (0, jsx_runtime_1.jsxs)("li", {
|
|
446
|
-
className: (0, classNames_1.classNames)(["zen-checkbox-list-with-action__action-item", opt.isWithAction ? "zen-checkbox-list-with-action__action-item--action" : ""]),
|
|
446
|
+
className: (0, classNames_1.classNames)(["zen-checkbox-list-with-action__action-item", opt.isWithAction ? "zen-checkbox-list-with-action__action-item--action" : "", opt.divider && ind < optionsArr.length - 1 ? "zen-checkbox-list-with-action__action-item--divider" : ""]),
|
|
447
447
|
"data-item": opt.property,
|
|
448
448
|
children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, {
|
|
449
449
|
id: `${checkboxId}${opt.property}`,
|
|
@@ -82,6 +82,24 @@
|
|
|
82
82
|
--data--categorical-yellow: #f5bd60;
|
|
83
83
|
--data--categorical-red: #e56a6a;
|
|
84
84
|
--data--categorical-grey: #8a94a2;
|
|
85
|
+
|
|
86
|
+
// data visualization - sequential
|
|
87
|
+
--data--sequential-1: #8cb6f9;
|
|
88
|
+
--data--sequential-2: #6ca1f8;
|
|
89
|
+
--data--sequential-3: #428aff;
|
|
90
|
+
--data--sequential-4: #2e76ea;
|
|
91
|
+
--data--sequential-5: #1862d5;
|
|
92
|
+
--data--sequential-6: #0d51b7;
|
|
93
|
+
--data--sequential-7: #084197;
|
|
94
|
+
|
|
95
|
+
// data visualization - diverging
|
|
96
|
+
--data--diverging-1: #782c0e;
|
|
97
|
+
--data--diverging-2: #cb591f;
|
|
98
|
+
--data--diverging-3: #f98c41;
|
|
99
|
+
--data--diverging-4: #f5bd60;
|
|
100
|
+
--data--diverging-5: #428aff;
|
|
101
|
+
--data--diverging-6: #1862d5;
|
|
102
|
+
--data--diverging-7: #084197;
|
|
85
103
|
}
|
|
86
104
|
|
|
87
105
|
.zen-dark {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, PropsWithChildren, ReactElement } from "react";
|
|
1
|
+
import { FC, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactElement } from "react";
|
|
2
2
|
import { IZenIdComponentProps } from "../../../commonHelpers/zenComponent";
|
|
3
3
|
import "./checkboxColumn.less";
|
|
4
4
|
interface ICheckboxCellProps extends IZenIdComponentProps {
|
|
@@ -8,6 +8,7 @@ interface ICheckboxCellProps extends IZenIdComponentProps {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
children?: ReactElement<typeof CheckboxCell.Content>;
|
|
10
10
|
onChange?: (id: string, checked: boolean) => void;
|
|
11
|
+
onMouseDown?: (id: string, checked: boolean, e: ReactMouseEvent) => void;
|
|
11
12
|
}
|
|
12
13
|
interface ICheckboxCell extends FC<ICheckboxCellProps> {
|
|
13
14
|
Content: FC<PropsWithChildren>;
|
|
@@ -4,7 +4,7 @@ exports.CheckboxCell = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const checkbox_1 = require("../../../checkbox/checkbox");
|
|
6
6
|
const classNames_1 = require("../../../commonHelpers/classNames/classNames");
|
|
7
|
-
const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, children }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-checkbox-column", className || ""]), children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "zen-checkbox-column__checkbox", checked: checked, indeterminate: indeterminate, disabled: disabled, title: label, onChange: e => onChange && onChange(id, e.target.checked), wrapped: true }), children] }));
|
|
7
|
+
const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, onMouseDown, children }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-checkbox-column", className || ""]), onMouseDown: onMouseDown ? e => onMouseDown(id, checked, e) : undefined, children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "zen-checkbox-column__checkbox", checked: checked, indeterminate: indeterminate, disabled: disabled, title: label, onChange: e => onChange && onChange(id, e.target.checked), wrapped: true }), children] }));
|
|
8
8
|
exports.CheckboxCell = CheckboxCell;
|
|
9
9
|
exports.CheckboxCell.Content = function content({ children }) {
|
|
10
10
|
return (0, jsx_runtime_1.jsx)("div", { className: "zen-checkbox-column__content", children: children });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, RefObject } from "react";
|
|
1
|
+
import { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from "react";
|
|
2
2
|
import { IListColumnWrapper } from "../../listColumn";
|
|
3
3
|
import "./checkboxColumn.less";
|
|
4
4
|
import { SimpleEventHandler } from "../../../commonHelpers/simpleEventHandler";
|
|
@@ -17,7 +17,8 @@ export interface ICheckboxColumnWrapper<T extends object> extends IListColumnWra
|
|
|
17
17
|
attach(event: "toggle", handler: (state: [Event, HTMLButtonElement]) => void): this;
|
|
18
18
|
attach(event: "change", handler: (state: [string, boolean]) => void): this;
|
|
19
19
|
attach(event: "change-all", handler: (state: [boolean]) => void): this;
|
|
20
|
-
|
|
20
|
+
attach(event: "mousedown", handler: (state: [string, boolean, ReactMouseEvent]) => void): this;
|
|
21
|
+
detach(event: "change" | "toggle" | "change-all" | "mousedown", handler?: (state: unknown) => void): this;
|
|
21
22
|
}
|
|
22
23
|
export declare enum SelectionState {
|
|
23
24
|
All = 0,
|
|
@@ -34,6 +35,7 @@ export declare class CheckboxColumnWrapper<T extends IEntityWithId> extends Simp
|
|
|
34
35
|
private state;
|
|
35
36
|
private readonly actionsClickHandler;
|
|
36
37
|
private readonly changeHandler;
|
|
38
|
+
private readonly mouseDownHandler;
|
|
37
39
|
private readonly changeHandlerAll;
|
|
38
40
|
constructor(selections: Set<string>, options: ICheckboxColumnOptions<T>, menuTriggerRef: RefObject<HTMLButtonElement | null>);
|
|
39
41
|
get selectionState(): SelectionState;
|
|
@@ -67,6 +67,15 @@ class CheckboxColumnWrapper extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
67
67
|
this.fire("change", [id, checked]);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
// Only fired for enabled checkboxes, so a disabled row can never become a drag anchor.
|
|
71
|
+
Object.defineProperty(this, "mouseDownHandler", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: (id, checked, e) => {
|
|
76
|
+
this.fire("mousedown", [id, checked, e]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
70
79
|
Object.defineProperty(this, "changeHandlerAll", {
|
|
71
80
|
enumerable: true,
|
|
72
81
|
configurable: true,
|
|
@@ -92,7 +101,7 @@ class CheckboxColumnWrapper extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
92
101
|
}
|
|
93
102
|
const allowed = this.condition(entity);
|
|
94
103
|
const isDisable = this.disabled ? this.disabled(entity) : this.state === SelectionState.All;
|
|
95
|
-
const cell = ((0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "" : "zen-checkbox-column--no-checkbox", checked: this.state === SelectionState.All || this.selections.has(entity.id), indeterminate: false, disabled: isDisable, label: this.options.createTitle(entity), onChange: this.changeHandler, children: (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell.Content, { children: value }) }));
|
|
104
|
+
const cell = ((0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "" : "zen-checkbox-column--no-checkbox", checked: this.state === SelectionState.All || this.selections.has(entity.id), indeterminate: false, disabled: isDisable, label: this.options.createTitle(entity), onChange: this.changeHandler, onMouseDown: isDisable ? undefined : this.mouseDownHandler, children: (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell.Content, { children: value }) }));
|
|
96
105
|
return cell;
|
|
97
106
|
}
|
|
98
107
|
renderHeader(title) {
|
|
@@ -11,7 +11,7 @@ export interface IDataGrid<T, N = T> extends Omit<IZenComponentProps, "children"
|
|
|
11
11
|
description?: string;
|
|
12
12
|
emptyCellTitle?: string;
|
|
13
13
|
resetScroll?: boolean;
|
|
14
|
-
children?: ReturnType<typeof EmptyList> | ReturnType<typeof Footer>;
|
|
14
|
+
children?: ReturnType<typeof EmptyList> | ReturnType<typeof Footer> | ReturnType<typeof EndOfList>;
|
|
15
15
|
rowClassName?: TRowClassName<T>;
|
|
16
16
|
expandedRows?: string[];
|
|
17
17
|
onExpandedChange?: (id: string, isExpanded: boolean) => void;
|
|
@@ -37,10 +37,14 @@ export declare const VERTICAL_SCROLL_MODIFIER = "zen-data-grid--vertical-scroll"
|
|
|
37
37
|
export declare const MIN_CELL_WIDTH = 100;
|
|
38
38
|
export declare const EmptyList: FC<PropsWithChildren>;
|
|
39
39
|
export declare const Footer: FC<PropsWithChildren>;
|
|
40
|
+
export declare const EndOfList: FC<PropsWithChildren<{
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
}>>;
|
|
40
43
|
declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange, active, onClick, onScrollEnd, isLoading }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
41
44
|
export interface IDataGridStaticProps {
|
|
42
45
|
EmptyList: typeof EmptyList;
|
|
43
46
|
Footer: typeof Footer;
|
|
47
|
+
EndOfList: typeof EndOfList;
|
|
44
48
|
}
|
|
45
49
|
declare const DataGrid: (<T extends IRowEntity<N>, N extends IEntityWithId = T>(props: IDataGrid<T, N> & {
|
|
46
50
|
ref?: React.ForwardedRef<HTMLElement>;
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.TRANSLATIONS = exports.DataGrid = exports.Footer = exports.EmptyList = exports.MIN_CELL_WIDTH = exports.VERTICAL_SCROLL_MODIFIER = exports.HORIZONTAL_SCROLL_MODIFIER = exports.DRAGGING_MODIFIER = exports.NOT_INTERACTIVE_MODIFIER = void 0;
|
|
9
|
+
exports.TRANSLATIONS = exports.DataGrid = exports.EndOfList = exports.Footer = exports.EmptyList = exports.MIN_CELL_WIDTH = exports.VERTICAL_SCROLL_MODIFIER = exports.HORIZONTAL_SCROLL_MODIFIER = exports.DRAGGING_MODIFIER = exports.NOT_INTERACTIVE_MODIFIER = void 0;
|
|
10
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
11
|
injectString("cs", "Action", "Akce");
|
|
12
12
|
injectString("da-DK", "Action", "Handling");
|
|
@@ -78,6 +78,20 @@ const Footer = ({
|
|
|
78
78
|
children: children
|
|
79
79
|
});
|
|
80
80
|
exports.Footer = Footer;
|
|
81
|
+
// Rendered right after the last data row (desktop infinite scroll only) to indicate there is no
|
|
82
|
+
// more data to load. See Table's `isEndOfList` (table.tsx). `style` is set by DataGridInner to the
|
|
83
|
+
// table's actual rendered width (see `tableRef`/`tableObserverResult` below), so the row — and the
|
|
84
|
+
// centered content inside it (see `lazyLoadingEnd.less`) — spans the full table width even when
|
|
85
|
+
// columns overflow the visible viewport, rather than just the currently-scrolled-into-view portion.
|
|
86
|
+
const EndOfList = ({
|
|
87
|
+
children,
|
|
88
|
+
style
|
|
89
|
+
}) => (0, jsx_runtime_1.jsx)("div", {
|
|
90
|
+
className: "zen-data-grid__end-of-list",
|
|
91
|
+
style: style,
|
|
92
|
+
children: children
|
|
93
|
+
});
|
|
94
|
+
exports.EndOfList = EndOfList;
|
|
81
95
|
const FIRST_RENDERED_ROWS = 100;
|
|
82
96
|
const SCROLL_END_THRESHOLD = 100;
|
|
83
97
|
const DataGridInner = ({
|
|
@@ -107,6 +121,12 @@ const DataGridInner = ({
|
|
|
107
121
|
const [verticalScrollApplied, setVerticalScrollApplied] = (0, react_1.useState)(false);
|
|
108
122
|
// Refs
|
|
109
123
|
const gridRef = (0, react_1.useRef)(null);
|
|
124
|
+
// Separate from `gridRef` (which is the outer *scrolling container*, used above for available
|
|
125
|
+
// column-allocation space). This tracks the `<table>` element itself, whose rendered width
|
|
126
|
+
// already reflects `max(sum of column widths, container width)` per its `min-width: 100%` CSS —
|
|
127
|
+
// i.e. it's wider than the container when columns overflow. Used to size the end-of-list row to
|
|
128
|
+
// the table's true full width instead of just the visible/scrolled-into-view portion.
|
|
129
|
+
const tableRef = (0, react_1.useRef)(null);
|
|
110
130
|
const bodyRef = (0, react_1.useRef)(null);
|
|
111
131
|
const lazyRenderTimerRef = (0, react_1.useRef)(0);
|
|
112
132
|
const scrollEndFiredRef = (0, react_1.useRef)(false);
|
|
@@ -114,6 +134,7 @@ const DataGridInner = ({
|
|
|
114
134
|
const rowsMap = (0, react_1.useMemo)(() => new Map(entities.map(entity => [entity.id, entity])), [entities]);
|
|
115
135
|
const emptyList = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.EmptyList), [children]);
|
|
116
136
|
const footer = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.Footer), [children]);
|
|
137
|
+
const endOfList = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.EndOfList), [children]);
|
|
117
138
|
(0, react_1.useImperativeHandle)(ref, () => gridRef.current, []);
|
|
118
139
|
const getVisibleRows = () => {
|
|
119
140
|
if (!gridRef.current || !bodyRef.current) {
|
|
@@ -171,6 +192,14 @@ const DataGridInner = ({
|
|
|
171
192
|
} = (0, useResizeObserver_1.useResizeObserver)({
|
|
172
193
|
target: gridRef.current
|
|
173
194
|
});
|
|
195
|
+
// Only observe the table's width when an `EndOfList` child is actually present — avoids a
|
|
196
|
+
// second ResizeObserver instance (and its resulting re-renders) on the vast majority of
|
|
197
|
+
// `DataGrid` usages that never render this row.
|
|
198
|
+
const {
|
|
199
|
+
result: tableObserverResult
|
|
200
|
+
} = (0, useResizeObserver_1.useResizeObserver)({
|
|
201
|
+
target: endOfList ? tableRef.current : null
|
|
202
|
+
});
|
|
174
203
|
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width, index) => acc + (width === undefined ? 0 : getColumnWidth(width, listOfMinWidthColumns[index])), 0);
|
|
175
204
|
const unallocatedSpace = observerResult && observerResult.contentRect.width - allocatedSpace || 0;
|
|
176
205
|
const flexibleColumnsQty = listOfDefaultWidthColumns.filter(width => width === undefined).length;
|
|
@@ -308,6 +337,7 @@ const DataGridInner = ({
|
|
|
308
337
|
"aria-label": description,
|
|
309
338
|
"aria-busy": !!isLoading,
|
|
310
339
|
role: isTreeGrid ? "treegrid" : undefined,
|
|
340
|
+
ref: tableRef,
|
|
311
341
|
children: [(0, jsx_runtime_1.jsx)("thead", {
|
|
312
342
|
className: "zen-data-grid__header",
|
|
313
343
|
children: (0, jsx_runtime_1.jsx)("tr", {
|
|
@@ -318,7 +348,13 @@ const DataGridInner = ({
|
|
|
318
348
|
ref: bodyRef,
|
|
319
349
|
children: body
|
|
320
350
|
})]
|
|
321
|
-
}),
|
|
351
|
+
}), endOfList ? (0, react_1.cloneElement)(endOfList, {
|
|
352
|
+
style: Object.assign(Object.assign({}, tableObserverResult ? {
|
|
353
|
+
width: tableObserverResult.contentRect.width
|
|
354
|
+
} : {}), observerResult ? {
|
|
355
|
+
"--zen-end-of-list-viewport-width": `${observerResult.contentRect.width}px`
|
|
356
|
+
} : {})
|
|
357
|
+
}) : null, emptyList && entities.length === 0 ? emptyList : null, footer]
|
|
322
358
|
})
|
|
323
359
|
});
|
|
324
360
|
};
|
|
@@ -326,4 +362,5 @@ const DataGrid = (0, react_1.forwardRef)(DataGridInner);
|
|
|
326
362
|
exports.DataGrid = DataGrid;
|
|
327
363
|
DataGrid.EmptyList = exports.EmptyList;
|
|
328
364
|
DataGrid.Footer = exports.Footer;
|
|
365
|
+
DataGrid.EndOfList = exports.EndOfList;
|
|
329
366
|
exports.TRANSLATIONS = ["Action"];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
injectString
|
|
5
|
+
} = require("../../utils/localization/translationsDictionary");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.TRANSLATIONS = exports.LazyLoadingEnd = void 0;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
const imageNothingFound_1 = require("../../images/imageNothingFound");
|
|
12
|
+
const useLanguage_1 = require("../../utils/localization/useLanguage");
|
|
13
|
+
injectString("en", "No further results found", "No further results found");
|
|
14
|
+
injectString("en", "We couldn't find any more data matching your current selection. Try broadening your search.", "We couldn't find any more data matching your current selection. Try broadening your search.");
|
|
15
|
+
// Shown as the last "row" of a desktop infinite-scroll table (Table's `onScrollEnd`) once all rows
|
|
16
|
+
// have been loaded, i.e. `entities.length >= total` from the `Table.Pagination` child. See
|
|
17
|
+
// `dataGrid.tsx`'s `EndOfList` slot and `table.tsx`'s `isEndOfList`.
|
|
18
|
+
//
|
|
19
|
+
// Two layers: the outer `zen-lazy-loading-end` is sized by `dataGrid.tsx` to the table's actual
|
|
20
|
+
// rendered width (can be much wider than the viewport once columns overflow), so its background/
|
|
21
|
+
// border span the full table at any scroll position. The inner `__sticky` wrapper is given an
|
|
22
|
+
// explicit, narrower width (the scrollport's own width, via `dataGrid.tsx`'s
|
|
23
|
+
// `--zen-end-of-list-viewport-width` CSS variable) and `position: sticky; inset-inline-start: 0`, so
|
|
24
|
+
// it floats and tracks the *currently visible* horizontal scroll position — `position: sticky` alone
|
|
25
|
+
// doesn't shrink a normal block box's width, so without the explicit width it would just render at
|
|
26
|
+
// the outer layer's full table width and never visibly move. With it, the icon and text stay centered
|
|
27
|
+
// on whatever part of the table you're actually looking at, rather than on the table's mathematical
|
|
28
|
+
// midpoint (which could be scrolled far out of view). See lazyLoadingEnd.less.
|
|
29
|
+
const LazyLoadingEnd = () => {
|
|
30
|
+
const {
|
|
31
|
+
translate
|
|
32
|
+
} = (0, useLanguage_1.useLanguage)();
|
|
33
|
+
return (0, jsx_runtime_1.jsx)("div", {
|
|
34
|
+
className: "zen-lazy-loading-end",
|
|
35
|
+
children: (0, jsx_runtime_1.jsxs)("div", {
|
|
36
|
+
className: "zen-lazy-loading-end__sticky",
|
|
37
|
+
children: [(0, jsx_runtime_1.jsx)(imageNothingFound_1.ImageNothingFound, {
|
|
38
|
+
className: "zen-lazy-loading-end__image",
|
|
39
|
+
focusable: false
|
|
40
|
+
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
41
|
+
className: "zen-lazy-loading-end__content",
|
|
42
|
+
children: [(0, jsx_runtime_1.jsx)("div", {
|
|
43
|
+
className: "zen-lazy-loading-end__title",
|
|
44
|
+
children: translate("No further results found")
|
|
45
|
+
}), (0, jsx_runtime_1.jsx)("div", {
|
|
46
|
+
className: "zen-lazy-loading-end__description",
|
|
47
|
+
children: translate("We couldn't find any more data matching your current selection. Try broadening your search.")
|
|
48
|
+
})]
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.LazyLoadingEnd = LazyLoadingEnd;
|
|
54
|
+
exports.TRANSLATIONS = ["No further results found", "We couldn't find any more data matching your current selection. Try broadening your search."];
|
package/dist/dataGrid/row/row.js
CHANGED
|
@@ -60,7 +60,8 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
60
60
|
return acc;
|
|
61
61
|
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, active, onClick]);
|
|
62
62
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, false), [entity, renderCells]);
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const nestedEntities = (0, react_1.useMemo)(() => (expanded && entity.children ? entity.children : []), [entity.children, expanded]);
|
|
64
|
+
const nestedCells = (0, react_1.useMemo)(() => nestedEntities.map(nestedEntity => renderCells(nestedEntity, true)), [nestedEntities, renderCells]);
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("tr", { "data-row-id": id, id: mainRowId, role: "row", "aria-level": isTreeGrid ? 1 : undefined, "aria-posinset": isTreeGrid ? ariaPosinset : undefined, "aria-setsize": isTreeGrid ? ariaSetsize : undefined, "aria-expanded": isTreeGrid ? expanded : undefined, className: (0, classNames_1.classNames)(["zen-data-grid__row", className || "", isLastRow ? "zen-data-grid__row--last" : ""]), children: cells }, mainRowId), nestedCells.map((nestedRow, index) => ((0, jsx_runtime_1.jsx)("tr", { "data-row-id": nestedEntities[index].id, id: `${mainRowId}_child_${index}`, role: "row", "aria-level": 2, "aria-posinset": index + 1, "aria-setsize": nestedCells.length, className: "zen-data-grid__row zen-data-grid__row--nested", children: nestedRow }, `${mainRowId}_child_${index}`)))] }));
|
|
65
66
|
};
|
|
66
67
|
exports.DataGridRow = (0, react_1.memo)(Row);
|
|
@@ -15,6 +15,8 @@ const selectList_1 = require("../../selectList/selectList");
|
|
|
15
15
|
const checkboxState_1 = require("../../checkbox/checkboxState");
|
|
16
16
|
const selectableRowsColumnWrapper_1 = require("./columns/selectableRowsColumnWrapper");
|
|
17
17
|
const useLanguage_1 = require("../../utils/localization/useLanguage");
|
|
18
|
+
const useDragSelection_1 = require("../../table/selectable/useDragSelection");
|
|
19
|
+
const getDragSelectionRows_1 = require("../../table/selectable/utils/getDragSelectionRows");
|
|
18
20
|
injectString("cs", "Select all", "Vybrat v\u0161e");
|
|
19
21
|
injectString("da-DK", "Select all", "V\xE6lg alle");
|
|
20
22
|
injectString("de", "Select all", "Alle ausw\xE4hlen");
|
|
@@ -209,13 +211,29 @@ const withSelectableRows = DataGridComponent => {
|
|
|
209
211
|
const selectMenuRef = (0, react_1.useRef)(null);
|
|
210
212
|
const selections = (0, exports.getSelections)(selection);
|
|
211
213
|
const allSelected = selection !== undefined && selection.allSelected;
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
const isCheckboxVisible = (0, react_1.useCallback)(entity => {
|
|
215
|
+
const condition = options.condition || options.checkboxVisible;
|
|
216
|
+
return condition ? condition(entity) : true;
|
|
217
|
+
}, [options.condition, options.checkboxVisible]);
|
|
218
|
+
const isCheckboxDisabled = (0, react_1.useCallback)(entity => {
|
|
219
|
+
if (options.checkboxDisabled) {
|
|
220
|
+
return options.checkboxDisabled(entity);
|
|
221
|
+
}
|
|
222
|
+
if (options.selectionLimit !== undefined) {
|
|
223
|
+
return !selections.has(entity.id) && selections.size >= options.selectionLimit;
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}, [options, selections]);
|
|
227
|
+
const wrapper = (0, react_1.useMemo)(() => {
|
|
228
|
+
var _a;
|
|
229
|
+
return selectMode ? new selectableRowsColumnWrapper_1.SelectableRowsColumnWrapper(selections, {
|
|
230
|
+
createTitle: options.createTitle,
|
|
231
|
+
headerTitle: options.headerTitle,
|
|
232
|
+
condition: options.condition || options.checkboxVisible,
|
|
233
|
+
disabled: (_a = options.checkboxDisabled) !== null && _a !== void 0 ? _a : isCheckboxDisabled,
|
|
234
|
+
header: options.selectionLimit === undefined && options.checkboxDisabled === undefined && options.checkboxVisible === undefined && options.condition === undefined || options.checkboxInHeader === true && !options.selectionLimit
|
|
235
|
+
}, selectMenuRef) : null;
|
|
236
|
+
}, [selectMode, selections, options.createTitle, options.headerTitle, options.condition, options.checkboxVisible, options.checkboxDisabled, options.selectionLimit, options.checkboxInHeader, isCheckboxDisabled]);
|
|
219
237
|
if (wrapper) {
|
|
220
238
|
wrapper.selectionState = calculateSelectionState(entities, selections, allSelected, options);
|
|
221
239
|
}
|
|
@@ -223,9 +241,10 @@ const withSelectableRows = DataGridComponent => {
|
|
|
223
241
|
const newSelections = new Set(selections);
|
|
224
242
|
entities.forEach(entity => {
|
|
225
243
|
if (checked) {
|
|
226
|
-
|
|
244
|
+
// Intentionally not isCheckboxDisabled: "select all" ignores the selection
|
|
245
|
+
// limit, it only skips rows the consumer explicitly disabled.
|
|
227
246
|
const isEnabled = !options.checkboxDisabled || !options.checkboxDisabled(entity);
|
|
228
|
-
if (
|
|
247
|
+
if (isCheckboxVisible(entity) && isEnabled) {
|
|
229
248
|
newSelections.add(entity.id);
|
|
230
249
|
}
|
|
231
250
|
return;
|
|
@@ -238,8 +257,49 @@ const withSelectableRows = DataGridComponent => {
|
|
|
238
257
|
allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
|
|
239
258
|
turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
|
|
240
259
|
});
|
|
241
|
-
}, [selections, entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
|
|
260
|
+
}, [selections, entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll, isCheckboxVisible]);
|
|
261
|
+
const {
|
|
262
|
+
rows: dragRows,
|
|
263
|
+
entityById
|
|
264
|
+
} = (0, react_1.useMemo)(() => (0, getDragSelectionRows_1.getDragSelectionRows)(entities), [entities]);
|
|
265
|
+
const isRowSelectable = (0, react_1.useCallback)(row => {
|
|
266
|
+
const entity = entityById.get(row.id);
|
|
267
|
+
return !!entity && isCheckboxVisible(entity) && !isCheckboxDisabled(entity);
|
|
268
|
+
}, [entityById, isCheckboxVisible, isCheckboxDisabled]);
|
|
269
|
+
// "Select all" is held as a flag rather than a list of ids, so materialise the page before
|
|
270
|
+
// a range starts editing it — otherwise the range would be applied to an empty selection.
|
|
271
|
+
const getBaseSelection = (0, react_1.useCallback)(() => allSelected ? new Set(entities.map(entity => entity.id)) : new Set(selections), [allSelected, entities, selections]);
|
|
272
|
+
const onBatchSelect = (0, react_1.useCallback)((rangeIds, select, base) => {
|
|
273
|
+
const result = new Set(base);
|
|
274
|
+
const limit = options.selectionLimit;
|
|
275
|
+
for (const id of rangeIds) {
|
|
276
|
+
if (select) {
|
|
277
|
+
if (limit !== undefined && result.size >= limit) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
result.add(id);
|
|
281
|
+
} else {
|
|
282
|
+
result.delete(id);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const newState = calculateSelectionState(entities, result, false, options);
|
|
286
|
+
onSelect({
|
|
287
|
+
selected: [...result],
|
|
288
|
+
allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
|
|
289
|
+
turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
|
|
290
|
+
});
|
|
291
|
+
}, [entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
|
|
292
|
+
const {
|
|
293
|
+
onCheckboxMouseDown,
|
|
294
|
+
suppressNextChangeRef
|
|
295
|
+
} = (0, useDragSelection_1.useDragSelection)(dragRows, props.ref, onBatchSelect, getBaseSelection, isRowSelectable, selectMode);
|
|
242
296
|
const onSelectListener = (0, react_1.useCallback)(([id, checked]) => {
|
|
297
|
+
// A drag or shift-click has already emitted the whole range; swallow the click that
|
|
298
|
+
// ends it so the row it landed on is not toggled back.
|
|
299
|
+
if (suppressNextChangeRef.current) {
|
|
300
|
+
suppressNextChangeRef.current = false;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
243
303
|
if (allSelected) {
|
|
244
304
|
const newSelection = new Set(entities.map(entity => entity.id));
|
|
245
305
|
newSelection.delete(id);
|
|
@@ -261,7 +321,7 @@ const withSelectableRows = DataGridComponent => {
|
|
|
261
321
|
allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
|
|
262
322
|
turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
|
|
263
323
|
});
|
|
264
|
-
}, [entities, selections, allSelected, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
|
|
324
|
+
}, [entities, selections, allSelected, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll, suppressNextChangeRef]);
|
|
265
325
|
const onSelectAll = (0, react_1.useCallback)(([checked]) => {
|
|
266
326
|
if (checked && ((selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll) || options.turnOffSelectAll)) {
|
|
267
327
|
selectAll(true);
|
|
@@ -310,10 +370,11 @@ const withSelectableRows = DataGridComponent => {
|
|
|
310
370
|
wrapper.attach("change", onSelectListener);
|
|
311
371
|
wrapper.attach("change-all", onSelectAll);
|
|
312
372
|
wrapper.attach("toggle", onTriggerClick);
|
|
373
|
+
wrapper.attach("mousedown", ([id, checked, e]) => onCheckboxMouseDown(id, checked, e));
|
|
313
374
|
return () => {
|
|
314
375
|
wrapper.detach();
|
|
315
376
|
};
|
|
316
|
-
}, [wrapper, onSelectListener, onSelectAll, onTriggerClick]);
|
|
377
|
+
}, [wrapper, onSelectListener, onSelectAll, onTriggerClick, onCheckboxMouseDown]);
|
|
317
378
|
const listColumns = (0, react_1.useMemo)(() => {
|
|
318
379
|
const newColumns = columns.map(c => Object.assign({}, c));
|
|
319
380
|
// Remove CheckboxColumnWrappers from wrappers list
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, autocomplete, buttonType, isError, popupId, handleFocusOnPopup, allyPattern, dataAnalyticsId, ...otherProps }: import("../dropdownRaw/dropdownTrigger").IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, autocomplete, buttonType, isError, popupId, handleFocusOnPopup, allyPattern, dataAnalyticsId, isFormItem, ...otherProps }: import("../dropdownRaw/dropdownTrigger").IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,14 +13,18 @@ export declare function prepareComboOptionsForList(actionListData: Set<string>,
|
|
|
13
13
|
export declare const createOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[], isAllSelected?: boolean) => ICheckboxListWithActionOption[];
|
|
14
14
|
export declare const sortDropdownItemArray: (arr: IDropdownRawItem[], sortFn?: (a: IDropdownRawItem, b: IDropdownRawItem) => number) => IDropdownRawItem[];
|
|
15
15
|
export declare const createSingleListOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[]) => {
|
|
16
|
+
divider?: boolean | undefined;
|
|
16
17
|
id: string;
|
|
17
18
|
children: string;
|
|
19
|
+
title: string;
|
|
18
20
|
disabled: boolean | undefined;
|
|
19
21
|
multiLevel: boolean | undefined;
|
|
20
22
|
}[];
|
|
21
23
|
export declare const createListDataOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[], isMultiselect: boolean, isAllSelected?: boolean) => ICheckboxListWithActionOption[] | {
|
|
24
|
+
divider?: boolean | undefined;
|
|
22
25
|
id: string;
|
|
23
26
|
children: string;
|
|
27
|
+
title: string;
|
|
24
28
|
disabled: boolean | undefined;
|
|
25
29
|
multiLevel: boolean | undefined;
|
|
26
30
|
}[];
|
|
@@ -55,7 +55,7 @@ function prepareComboOptionsForList(actionListData, translate, options, getSelec
|
|
|
55
55
|
const preparedOptions = options && options.length
|
|
56
56
|
? options.map(option => {
|
|
57
57
|
const selectedChild = getSelectedChildFn(option.id);
|
|
58
|
-
return Object.assign({ label: (0, groupsHelper_1.getGroupDescription)(option, translate), property: option.id, checked: isAllSelected ? true : selectedIds.has(option.id), isWithAction: actionListData.has(option.id), partialChecked: isAllSelected ? false : selectedChild.length > 0, countSelectedChild: 0, blocked: isFlatList ? option.disabled || false : false }, (getTitle ? { title: getTitle(option.id) } : {}));
|
|
58
|
+
return Object.assign(Object.assign({ label: (0, groupsHelper_1.getGroupDescription)(option, translate), property: option.id, checked: isAllSelected ? true : selectedIds.has(option.id), isWithAction: actionListData.has(option.id), partialChecked: isAllSelected ? false : selectedChild.length > 0, countSelectedChild: 0, blocked: isFlatList ? option.disabled || false : false }, (getTitle ? { title: getTitle(option.id) } : {})), (option.divider ? { divider: true } : {}));
|
|
59
59
|
})
|
|
60
60
|
: [];
|
|
61
61
|
return preparedOptions;
|
|
@@ -95,14 +95,14 @@ const sortDropdownItemArray = (arr, sortFn) => {
|
|
|
95
95
|
exports.sortDropdownItemArray = sortDropdownItemArray;
|
|
96
96
|
const createSingleListOptions = (stateObj, translate, listItem) => {
|
|
97
97
|
const preparedOptions = listItem && listItem.length
|
|
98
|
-
? listItem.map(option =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
98
|
+
? listItem.map(option => {
|
|
99
|
+
const description = (0, groupsHelper_1.getGroupDescription)(stateObj.groupsMap[option.id] || option, translate);
|
|
100
|
+
return Object.assign({ id: option.id, children: description,
|
|
101
|
+
// Long names are truncated by `zen-ellipsis`, so expose the full text on hover
|
|
102
|
+
title: description, disabled: option.disabled, multiLevel: Object.keys(stateObj.groupsMap).length === 0
|
|
103
|
+
? false
|
|
104
|
+
: option.children && option.children.length > 0 && stateObj.groupsMap[option.id] !== undefined }, (option.divider ? { divider: true } : {}));
|
|
105
|
+
})
|
|
106
106
|
: [];
|
|
107
107
|
return preparedOptions;
|
|
108
108
|
};
|
|
@@ -124,7 +124,8 @@ const compareObjectsArrays = (arr1, arr2) => arr1.length === arr2.length &&
|
|
|
124
124
|
const sameDisabled = el.disabled === el2.disabled ||
|
|
125
125
|
(el.disabled === undefined && el2.disabled === false) ||
|
|
126
126
|
(el2.disabled === undefined && el.disabled === false);
|
|
127
|
-
|
|
127
|
+
const sameDivider = el.divider === el2.divider || (el.divider === undefined && el2.divider === false) || (el2.divider === undefined && el.divider === false);
|
|
128
|
+
return sameId && sameDisabled && sameDivider;
|
|
128
129
|
});
|
|
129
130
|
exports.compareObjectsArrays = compareObjectsArrays;
|
|
130
131
|
const prepareSelectedIdsToItems = (selectedIds, groupsMap, groupsMapSelected) => {
|
|
@@ -945,7 +945,7 @@ const DropdownRaw = props => {
|
|
|
945
945
|
const currentAbort = abortToken.current;
|
|
946
946
|
controlData(currentAbort.signal, newValue, state.isChecked);
|
|
947
947
|
}, [controlData, state.isChecked]);
|
|
948
|
-
const containerClassName = (0, classNames_1.classNames)(["zen-dropdown", isFormSection ? "zen-dropdown--form-item" : "", "zen-dropdown__container", className || ""]);
|
|
948
|
+
const containerClassName = (0, classNames_1.classNames)(["zen-dropdown", isFormSection || isFormItemVal ? "zen-dropdown--form-item" : "", "zen-dropdown__container", className || ""]);
|
|
949
949
|
const handleCheckboxChange = (0, react_1.useCallback)(e => {
|
|
950
950
|
const isChecked = e.target.checked;
|
|
951
951
|
dispatchState({
|
|
@@ -1219,7 +1219,7 @@ const DropdownRaw = props => {
|
|
|
1219
1219
|
isError: isError,
|
|
1220
1220
|
disabled: disabled,
|
|
1221
1221
|
count: showCounterPill ? countSelected : 0,
|
|
1222
|
-
fullWidth: fullWidthTriggerButton,
|
|
1222
|
+
fullWidth: isFormItemVal && !searchField ? true : fullWidthTriggerButton,
|
|
1223
1223
|
inputValue: state.inputValue,
|
|
1224
1224
|
placeholder: placeholder || translate("Filter by group"),
|
|
1225
1225
|
searchField: searchField && !isMobile ? searchField : false,
|
|
@@ -1235,7 +1235,8 @@ const DropdownRaw = props => {
|
|
|
1235
1235
|
handleFocusOnPopup: handleFocusOnPopup,
|
|
1236
1236
|
popupId: memoizedAllyPattern === "selectOnlyCombobox" ? selectListId : popupId,
|
|
1237
1237
|
allyPattern: memoizedAllyPattern,
|
|
1238
|
-
dataAnalyticsId: dataAnalyticsId
|
|
1238
|
+
dataAnalyticsId: dataAnalyticsId,
|
|
1239
|
+
isFormItem: isFormItemVal
|
|
1239
1240
|
}, accessibilityProps)), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, {
|
|
1240
1241
|
alignment: alignment,
|
|
1241
1242
|
triggerRef: triggerRef,
|
|
@@ -23,9 +23,10 @@ interface IDropdownSearchableTrigger {
|
|
|
23
23
|
autocomplete?: string;
|
|
24
24
|
handleFocusOnPopup?: () => void;
|
|
25
25
|
dataAnalyticsId?: string;
|
|
26
|
+
isFormItem?: boolean;
|
|
26
27
|
}
|
|
27
28
|
export declare const DropdownSearchableTrigger: {
|
|
28
|
-
({ value, className, onChange, placeholder, isOpenPopup, inputRef, handleClick, width, title, id, disabled, count, currentSelection, isError, fullWidth, ref, name, onBlur, popupId, autocomplete, handleFocusOnPopup, dataAnalyticsId, ...otherProps }: IDropdownSearchableTrigger): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
({ value, className, onChange, placeholder, isOpenPopup, inputRef, handleClick, width, title, id, disabled, count, currentSelection, isError, fullWidth, ref, name, onBlur, popupId, autocomplete, handleFocusOnPopup, dataAnalyticsId, isFormItem, ...otherProps }: IDropdownSearchableTrigger): import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
displayName: string;
|
|
30
31
|
};
|
|
31
32
|
export declare const TRANSLATIONS: string[];
|