@geotab/zenith 3.16.0 → 3.17.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -1
- package/README.md.baseline +1 -0
- package/dist/absolute/absolute.js +5 -1
- package/dist/button/button.d.ts +2 -1
- package/dist/button/button.js +22 -5
- package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/dist/commonHelpers/ShowMoreCell.d.ts +5 -0
- package/dist/commonHelpers/ShowMoreCell.js +66 -0
- package/dist/commonHelpers/getAriaAttributes.js +6 -9
- package/dist/commonHelpers/getNonAriaProps.d.ts +11 -0
- package/dist/commonHelpers/getNonAriaProps.js +19 -0
- package/dist/commonHelpers/hooks/useScroll.d.ts +1 -1
- package/dist/commonHelpers/hooks/useScroll.js +6 -6
- package/dist/commonHelpers/isAriaProp.d.ts +9 -0
- package/dist/commonHelpers/isAriaProp.js +13 -0
- package/dist/commonHelpers/showMoreRow.d.ts +28 -0
- package/dist/commonHelpers/showMoreRow.js +29 -0
- package/dist/commonHelpers/tabsKeyboard.d.ts +1 -1
- package/dist/commonHelpers/tabsKeyboard.js +15 -1
- package/dist/commonStyles/colors/colors.less +18 -0
- package/dist/dataFeed/dataFeedColumnsItems.js +3 -1
- 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 +20 -2
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
- package/dist/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownHelper.d.ts +12 -0
- package/dist/dropdownRaw/dropdownHelper.js +32 -11
- package/dist/dropdownRaw/dropdownRaw.js +36 -8
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +13 -6
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +2 -2
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/dist/dropdownRaw/types.d.ts +36 -0
- package/dist/filterButton/filterButton.d.ts +1 -1
- package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
- package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
- 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 +4 -2
- package/dist/header/headerMenu.d.ts +2 -0
- package/dist/header/headerMenu.js +1 -1
- package/dist/index.css +319 -68
- package/dist/index.d.ts +3 -1
- package/dist/index.js +9 -3
- package/dist/menu/components/menuButton.d.ts +3 -1
- package/dist/menu/components/menuButton.js +66 -47
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/miniTabs/miniTabs.js +4 -2
- package/dist/pageHeader/pageHeaderButton.d.ts +1 -1
- package/dist/pageHeader/pageHeaderButton.js +4 -2
- 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/pillExpandable/pillContent.d.ts +3 -2
- package/dist/pillExpandable/pillContent.js +2 -2
- package/dist/pillExpandable/pillExpandable.js +20 -5
- package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
- package/dist/pillExpandable/pillExpandablePopoverContent.js +1 -1
- package/dist/pillExpandable/pillExpandableSimple.d.ts +3 -1
- package/dist/pillExpandable/pillExpandableSimple.js +19 -9
- package/dist/selectList/selectList.js +1 -0
- package/dist/selectList/selectListItem.d.ts +10 -1
- package/dist/selectList/selectListItem.js +12 -9
- package/dist/table/children/tablePagination.d.ts +1 -1
- package/dist/table/children/useTableChildren.d.ts +4 -2
- package/dist/table/children/useTableChildren.js +64 -16
- package/dist/table/nested/nestedData.d.ts +29 -1
- package/dist/table/nested/nestedData.js +45 -4
- package/dist/table/nested/useNestedRows.js +18 -22
- package/dist/table/nested/useShowMore.d.ts +41 -0
- package/dist/table/nested/useShowMore.js +56 -0
- package/dist/table/selectable/interfaces.d.ts +17 -0
- package/dist/table/selectable/useDragSelection.d.ts +10 -0
- package/dist/table/selectable/useDragSelection.js +145 -0
- package/dist/table/selectable/useSelectableRows.d.ts +5 -2
- package/dist/table/selectable/useSelectableRows.js +131 -36
- package/dist/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/dist/table/selectable/utils/calculateSelectionState.js +43 -7
- package/dist/table/selectable/utils/checkRow.js +4 -2
- package/dist/table/selectable/utils/getCurrentPageSelection.js +9 -5
- 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.d.ts +1 -1
- package/dist/table/selectable/utils/isRowChecked.js +40 -7
- package/dist/table/table.d.ts +1 -2
- package/dist/table/table.js +58 -31
- package/dist/tabs/tabs.d.ts +1 -0
- package/dist/tabs/tabs.js +50 -17
- package/dist/textInputRaw/textInputRaw.js +3 -2
- package/dist/tooltip/tooltip.d.ts +2 -0
- package/dist/tooltip/tooltip.js +19 -7
- package/dist/utils/localization/translations/ar-001.json +1 -0
- package/dist/utils/localization/translations/bg-BG.json +1 -0
- package/dist/utils/localization/translations/cs.json +1 -0
- package/dist/utils/localization/translations/da-DK.json +1 -0
- package/dist/utils/localization/translations/de.json +1 -0
- package/dist/utils/localization/translations/el-GR.json +1 -0
- package/dist/utils/localization/translations/en.json +4 -0
- package/dist/utils/localization/translations/es.json +1 -0
- package/dist/utils/localization/translations/et-EE.json +1 -0
- package/dist/utils/localization/translations/fi-FI.json +1 -0
- package/dist/utils/localization/translations/fr-FR.json +1 -0
- package/dist/utils/localization/translations/fr.json +1 -0
- package/dist/utils/localization/translations/hu-HU.json +1 -0
- package/dist/utils/localization/translations/id.json +1 -0
- package/dist/utils/localization/translations/it.json +1 -0
- package/dist/utils/localization/translations/ja.json +1 -0
- package/dist/utils/localization/translations/ka-GE.json +1 -0
- package/dist/utils/localization/translations/ko-KR.json +1 -0
- package/dist/utils/localization/translations/lt-LT.json +1 -0
- package/dist/utils/localization/translations/lv-LV.json +1 -0
- package/dist/utils/localization/translations/ms.json +1 -0
- package/dist/utils/localization/translations/nb-NO.json +1 -0
- package/dist/utils/localization/translations/nl.json +1 -0
- package/dist/utils/localization/translations/pl.json +1 -0
- package/dist/utils/localization/translations/pt-BR.json +1 -0
- package/dist/utils/localization/translations/pt-PT.json +1 -0
- package/dist/utils/localization/translations/ro-RO.json +1 -0
- package/dist/utils/localization/translations/sk-SK.json +1 -0
- package/dist/utils/localization/translations/sv.json +1 -0
- package/dist/utils/localization/translations/th.json +1 -0
- package/dist/utils/localization/translations/tr.json +1 -0
- package/dist/utils/localization/translations/zh-Hans.json +1 -0
- package/dist/utils/localization/translations/zh-TW.json +1 -0
- package/dist/waiting/waiting.js +95 -1
- package/esm/absolute/absolute.js +5 -1
- package/esm/button/button.d.ts +2 -1
- package/esm/button/button.js +22 -5
- package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/esm/commonHelpers/ShowMoreCell.d.ts +5 -0
- package/esm/commonHelpers/ShowMoreCell.js +57 -0
- package/esm/commonHelpers/getAriaAttributes.js +6 -9
- package/esm/commonHelpers/getNonAriaProps.d.ts +11 -0
- package/esm/commonHelpers/getNonAriaProps.js +15 -0
- package/esm/commonHelpers/hooks/useScroll.d.ts +1 -1
- package/esm/commonHelpers/hooks/useScroll.js +6 -6
- package/esm/commonHelpers/isAriaProp.d.ts +9 -0
- package/esm/commonHelpers/isAriaProp.js +9 -0
- package/esm/commonHelpers/showMoreRow.d.ts +28 -0
- package/esm/commonHelpers/showMoreRow.js +22 -0
- package/esm/commonHelpers/tabsKeyboard.d.ts +1 -1
- package/esm/commonHelpers/tabsKeyboard.js +15 -1
- package/esm/commonStyles/colors/colorsConstant.js +11 -11
- package/esm/dataFeed/dataFeedColumnsItems.js +3 -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 +20 -2
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
- package/esm/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownHelper.d.ts +12 -0
- package/esm/dropdownRaw/dropdownHelper.js +30 -10
- package/esm/dropdownRaw/dropdownRaw.js +37 -9
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +13 -6
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +2 -2
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/esm/dropdownRaw/types.d.ts +36 -0
- package/esm/filterButton/filterButton.d.ts +1 -1
- package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
- package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
- 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 +4 -2
- package/esm/header/headerMenu.d.ts +2 -0
- package/esm/header/headerMenu.js +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/menu/components/menuButton.d.ts +3 -1
- package/esm/menu/components/menuButton.js +66 -47
- package/esm/menu/components/menuItem.js +4 -4
- package/esm/miniTabs/miniTabs.js +4 -2
- package/esm/pageHeader/pageHeaderButton.d.ts +1 -1
- package/esm/pageHeader/pageHeaderButton.js +4 -2
- 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/pillExpandable/pillContent.d.ts +3 -2
- package/esm/pillExpandable/pillContent.js +2 -2
- package/esm/pillExpandable/pillExpandable.js +20 -5
- package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
- package/esm/pillExpandable/pillExpandablePopoverContent.js +1 -1
- package/esm/pillExpandable/pillExpandableSimple.d.ts +3 -1
- package/esm/pillExpandable/pillExpandableSimple.js +20 -10
- package/esm/selectList/selectList.js +1 -0
- package/esm/selectList/selectListItem.d.ts +10 -1
- package/esm/selectList/selectListItem.js +12 -9
- package/esm/table/children/tablePagination.d.ts +1 -1
- package/esm/table/children/useTableChildren.d.ts +4 -2
- package/esm/table/children/useTableChildren.js +64 -16
- package/esm/table/nested/nestedData.d.ts +29 -1
- package/esm/table/nested/nestedData.js +44 -3
- package/esm/table/nested/useNestedRows.js +18 -22
- package/esm/table/nested/useShowMore.d.ts +41 -0
- package/esm/table/nested/useShowMore.js +52 -0
- package/esm/table/selectable/interfaces.d.ts +17 -0
- package/esm/table/selectable/useDragSelection.d.ts +10 -0
- package/esm/table/selectable/useDragSelection.js +141 -0
- package/esm/table/selectable/useSelectableRows.d.ts +5 -2
- package/esm/table/selectable/useSelectableRows.js +129 -35
- package/esm/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/esm/table/selectable/utils/calculateSelectionState.js +43 -7
- package/esm/table/selectable/utils/checkRow.js +4 -2
- package/esm/table/selectable/utils/getCurrentPageSelection.js +9 -5
- 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.d.ts +1 -1
- package/esm/table/selectable/utils/isRowChecked.js +40 -7
- package/esm/table/table.d.ts +1 -2
- package/esm/table/table.js +43 -16
- package/esm/tabs/tabs.d.ts +1 -0
- package/esm/tabs/tabs.js +50 -17
- package/esm/textInputRaw/textInputRaw.js +3 -2
- package/esm/tooltip/tooltip.d.ts +2 -0
- package/esm/tooltip/tooltip.js +19 -7
- package/esm/utils/localization/translations/ar-001.json +1 -0
- package/esm/utils/localization/translations/bg-BG.json +1 -0
- package/esm/utils/localization/translations/cs.json +1 -0
- package/esm/utils/localization/translations/da-DK.json +1 -0
- package/esm/utils/localization/translations/de.json +1 -0
- package/esm/utils/localization/translations/el-GR.json +1 -0
- package/esm/utils/localization/translations/en.json +4 -0
- package/esm/utils/localization/translations/es.json +1 -0
- package/esm/utils/localization/translations/et-EE.json +1 -0
- package/esm/utils/localization/translations/fi-FI.json +1 -0
- package/esm/utils/localization/translations/fr-FR.json +1 -0
- package/esm/utils/localization/translations/fr.json +1 -0
- package/esm/utils/localization/translations/hu-HU.json +1 -0
- package/esm/utils/localization/translations/id.json +1 -0
- package/esm/utils/localization/translations/it.json +1 -0
- package/esm/utils/localization/translations/ja.json +1 -0
- package/esm/utils/localization/translations/ka-GE.json +1 -0
- package/esm/utils/localization/translations/ko-KR.json +1 -0
- package/esm/utils/localization/translations/lt-LT.json +1 -0
- package/esm/utils/localization/translations/lv-LV.json +1 -0
- package/esm/utils/localization/translations/ms.json +1 -0
- package/esm/utils/localization/translations/nb-NO.json +1 -0
- package/esm/utils/localization/translations/nl.json +1 -0
- package/esm/utils/localization/translations/pl.json +1 -0
- package/esm/utils/localization/translations/pt-BR.json +1 -0
- package/esm/utils/localization/translations/pt-PT.json +1 -0
- package/esm/utils/localization/translations/ro-RO.json +1 -0
- package/esm/utils/localization/translations/sk-SK.json +1 -0
- package/esm/utils/localization/translations/sv.json +1 -0
- package/esm/utils/localization/translations/th.json +1 -0
- package/esm/utils/localization/translations/tr.json +1 -0
- package/esm/utils/localization/translations/zh-Hans.json +1 -0
- package/esm/utils/localization/translations/zh-TW.json +1 -0
- package/esm/waiting/waiting.js +96 -2
- package/package.json +18 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRangeIds = void 0;
|
|
4
|
+
const getRangeIds = (rows, fromId, toId, isSelectable) => {
|
|
5
|
+
const fromIdx = rows.findIndex(row => row.id === fromId);
|
|
6
|
+
const toIdx = rows.findIndex(row => row.id === toId);
|
|
7
|
+
if (fromIdx === -1 || toIdx === -1) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const start = Math.min(fromIdx, toIdx);
|
|
11
|
+
const end = Math.max(fromIdx, toIdx);
|
|
12
|
+
const ids = [];
|
|
13
|
+
for (let i = start; i <= end; i++) {
|
|
14
|
+
const row = rows[i];
|
|
15
|
+
if (isSelectable(row)) {
|
|
16
|
+
ids.push(row.id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return ids;
|
|
20
|
+
};
|
|
21
|
+
exports.getRangeIds = getRangeIds;
|
|
@@ -2,7 +2,7 @@ import { IEntityWithId } from "../../../commonHelpers/entity";
|
|
|
2
2
|
import { IRowEntity } from "../../../dataGrid/row/row";
|
|
3
3
|
import { SelectionState } from "../interfaces";
|
|
4
4
|
import { TSelectionStrategy } from "../useSelectableRows";
|
|
5
|
-
export declare const isRowChecked: <T extends IRowEntity<N>, N extends IEntityWithId>(selections: Set<string>, state: SelectionState, strategy: TSelectionStrategy | undefined, entity: T | N, isNested: boolean) => {
|
|
5
|
+
export declare const isRowChecked: <T extends IRowEntity<N>, N extends IEntityWithId>(selections: Set<string>, state: SelectionState, strategy: TSelectionStrategy | undefined, entity: T | N, isNested: boolean, checkboxVisible?: (e: T | N, isNested?: boolean) => boolean, checkboxDisabled?: (e: T | N, isNested?: boolean) => boolean) => {
|
|
6
6
|
indeterminate: boolean;
|
|
7
7
|
checked: boolean;
|
|
8
8
|
};
|
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isRowChecked = void 0;
|
|
4
|
+
const showMoreRow_1 = require("../../../commonHelpers/showMoreRow");
|
|
4
5
|
const interfaces_1 = require("../interfaces");
|
|
5
|
-
|
|
6
|
+
// The full, un-capped children list, so children hidden behind a "+N more" row still count
|
|
7
|
+
// towards the parent checkbox state.
|
|
8
|
+
const getNestedChildren = (entity, strategy) => strategy === "nested" ? (0, showMoreRow_1.getChildrenForSelection)(entity) : undefined;
|
|
9
|
+
// Children the parent checkbox can actually act on - the consumer may hide or disable some.
|
|
10
|
+
const filterSelectable = (children, checkboxVisible, checkboxDisabled) => children.filter(child => {
|
|
11
|
+
if (checkboxVisible && !checkboxVisible(child, true)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (checkboxDisabled && checkboxDisabled(child, true)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
const isRowChecked = (selections, state, strategy, entity, isNested, checkboxVisible, checkboxDisabled) => {
|
|
6
20
|
if (state === interfaces_1.SelectionState.All) {
|
|
7
|
-
|
|
21
|
+
// When the overall selection is "all", `selections` holds the ids that have been
|
|
22
|
+
// explicitly excluded from that selection (see ISelectionValue), not included ids.
|
|
23
|
+
if (isNested) {
|
|
24
|
+
return { indeterminate: false, checked: !selections.has(entity.id) };
|
|
25
|
+
}
|
|
26
|
+
const children = getNestedChildren(entity, strategy);
|
|
27
|
+
if (children && children.length > 0) {
|
|
28
|
+
const selectableChildren = filterSelectable(children, checkboxVisible, checkboxDisabled);
|
|
29
|
+
if (selectableChildren.length === 0) {
|
|
30
|
+
return { indeterminate: false, checked: true };
|
|
31
|
+
}
|
|
32
|
+
const allChildrenChecked = selectableChildren.every(child => !selections.has(child.id));
|
|
33
|
+
const someChildrenChecked = selectableChildren.some(child => !selections.has(child.id));
|
|
34
|
+
return { indeterminate: someChildrenChecked && !allChildrenChecked, checked: allChildrenChecked };
|
|
35
|
+
}
|
|
36
|
+
return { indeterminate: false, checked: !selections.has(entity.id) };
|
|
8
37
|
}
|
|
9
38
|
if (isNested) {
|
|
10
39
|
return { indeterminate: false, checked: selections.has(entity.id) };
|
|
11
40
|
}
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
const children = getNestedChildren(entity, strategy);
|
|
42
|
+
if (children && children.length > 0) {
|
|
43
|
+
const selectableChildren = filterSelectable(children, checkboxVisible, checkboxDisabled);
|
|
44
|
+
if (selectableChildren.length === 0) {
|
|
45
|
+
return { indeterminate: false, checked: false };
|
|
46
|
+
}
|
|
47
|
+
const allChildrenSelected = selectableChildren.every(child => selections.has(child.id));
|
|
48
|
+
const someChildrenSelected = selectableChildren.some(child => selections.has(child.id));
|
|
49
|
+
return { indeterminate: someChildrenSelected && !allChildrenSelected, checked: allChildrenSelected };
|
|
17
50
|
}
|
|
18
51
|
return { indeterminate: false, checked: selections.has(entity.id) };
|
|
19
52
|
};
|
package/dist/table/table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IZenComponentProps, IZenGridItem } from "../commonHelpers/zenComponent";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { ISelectableRowsOptions } from "./selectable/useSelectableRows";
|
|
3
|
+
import { getEmptySelection, ISelectableRowsOptions } from "./selectable/useSelectableRows";
|
|
4
4
|
import { ISortableOptions } from "./sortable/useSortableColumns";
|
|
5
5
|
import { IFlexibleColumnsOptions } from "./flexible/useFlexibleColumns";
|
|
6
6
|
import { IColumnComponent, IListColumnWrapper } from "../dataGrid/listColumn";
|
|
@@ -11,7 +11,6 @@ import { ITablePagination, TablePagination } from "./children/tablePagination";
|
|
|
11
11
|
import { ITableEmpty, TableEmpty } from "./children/tableEmpty";
|
|
12
12
|
import { ITableFooter, TableFooter } from "./children/tableFooter";
|
|
13
13
|
import "./table.less";
|
|
14
|
-
import { getEmptySelection } from "./selectable/useSelectableRows";
|
|
15
14
|
import { ColumnSortDirection } from "./sortable/interfaces";
|
|
16
15
|
import { getSortableValue } from "./sortable/useSortableColumns";
|
|
17
16
|
import { ActionsColumn } from "../dataGrid/columns/actionsColumn/actionsColumn";
|
package/dist/table/table.js
CHANGED
|
@@ -11,23 +11,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
11
11
|
const react_1 = require("react");
|
|
12
12
|
const dataFeed_1 = require("../dataFeed/dataFeed");
|
|
13
13
|
const dataGrid_1 = require("../dataGrid/dataGrid");
|
|
14
|
+
const lazyLoadingEnd_1 = require("../dataGrid/lazyLoadingEnd/lazyLoadingEnd");
|
|
14
15
|
const useSelectableRows_1 = require("./selectable/useSelectableRows");
|
|
15
|
-
const useSortableColumns_1 = require("./sortable/useSortableColumns");
|
|
16
|
-
const useFlexibleColumns_1 = require("./flexible/useFlexibleColumns");
|
|
17
|
-
const useActions_1 = require("./actions/useActions");
|
|
18
|
-
const useLoading_1 = require("./loading/useLoading");
|
|
19
|
-
const emptySearchList_1 = require("../dataGrid/emptySearchList/emptySearchList");
|
|
20
|
-
const entitiesListActions_1 = require("../dataGrid/entitiesListActions/entitiesListActions");
|
|
21
|
-
const dataFeedSelectPanel_1 = require("../dataFeed/dataFeedSelectPanel/dataFeedSelectPanel");
|
|
22
|
-
const columnsListButton_1 = require("../dataGrid/entitiesListActions/actions/columnsListButton");
|
|
23
|
-
const useTableChildren_1 = require("./children/useTableChildren");
|
|
24
|
-
const deviceType_1 = require("../commonHelpers/hooks/deviceType");
|
|
25
|
-
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
26
|
-
const tableFullscreen_1 = require("./children/tableFullscreen");
|
|
27
|
-
const tableBulkActions_1 = require("./children/tableBulkActions");
|
|
28
|
-
const tablePagination_1 = require("./children/tablePagination");
|
|
29
|
-
const tableEmpty_1 = require("./children/tableEmpty");
|
|
30
|
-
const tableFooter_1 = require("./children/tableFooter");
|
|
31
16
|
injectString("da-DK", "Loading more rows", "Indl\xE6ser flere r\xE6kker");
|
|
32
17
|
injectString("en", "Loading more rows", "Loading more rows");
|
|
33
18
|
injectString("fi-FI", "Loading more rows", "Ladataan lis\xE4\xE4 rivej\xE4");
|
|
@@ -145,13 +130,29 @@ injectString("ka-GE", "Bulk select", "\u10DB\u10D0\u10E1\u10D8\u10E3\u10E0\u10D8
|
|
|
145
130
|
injectString("el-GR", "Bulk select", "\u039C\u03B1\u03B6\u03B9\u03BA\u03AE \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE");
|
|
146
131
|
injectString("et-EE", "Bulk select", "Massvalimine");
|
|
147
132
|
injectString("bg-BG", "Bulk select", "\u041C\u0430\u0441\u043E\u0432 \u0438\u0437\u0431\u043E\u0440");
|
|
148
|
-
const useSelectableRows_2 = require("./selectable/useSelectableRows");
|
|
149
133
|
Object.defineProperty(exports, "getEmptySelection", {
|
|
150
134
|
enumerable: true,
|
|
151
135
|
get: function () {
|
|
152
|
-
return
|
|
136
|
+
return useSelectableRows_1.getEmptySelection;
|
|
153
137
|
}
|
|
154
138
|
});
|
|
139
|
+
const useSortableColumns_1 = require("./sortable/useSortableColumns");
|
|
140
|
+
const useFlexibleColumns_1 = require("./flexible/useFlexibleColumns");
|
|
141
|
+
const useActions_1 = require("./actions/useActions");
|
|
142
|
+
const useLoading_1 = require("./loading/useLoading");
|
|
143
|
+
const emptySearchList_1 = require("../dataGrid/emptySearchList/emptySearchList");
|
|
144
|
+
const entitiesListActions_1 = require("../dataGrid/entitiesListActions/entitiesListActions");
|
|
145
|
+
const dataFeedSelectPanel_1 = require("../dataFeed/dataFeedSelectPanel/dataFeedSelectPanel");
|
|
146
|
+
const columnsListButton_1 = require("../dataGrid/entitiesListActions/actions/columnsListButton");
|
|
147
|
+
const useTableChildren_1 = require("./children/useTableChildren");
|
|
148
|
+
const deviceType_1 = require("../commonHelpers/hooks/deviceType");
|
|
149
|
+
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
150
|
+
const getCurrentPageSelection_1 = require("./selectable/utils/getCurrentPageSelection");
|
|
151
|
+
const tableFullscreen_1 = require("./children/tableFullscreen");
|
|
152
|
+
const tableBulkActions_1 = require("./children/tableBulkActions");
|
|
153
|
+
const tablePagination_1 = require("./children/tablePagination");
|
|
154
|
+
const tableEmpty_1 = require("./children/tableEmpty");
|
|
155
|
+
const tableFooter_1 = require("./children/tableFooter");
|
|
155
156
|
const interfaces_1 = require("./sortable/interfaces");
|
|
156
157
|
Object.defineProperty(exports, "ColumnSortDirection", {
|
|
157
158
|
enumerable: true,
|
|
@@ -234,7 +235,7 @@ const TableInner = ({
|
|
|
234
235
|
active,
|
|
235
236
|
onClick
|
|
236
237
|
}) => {
|
|
237
|
-
var _a, _b, _c;
|
|
238
|
+
var _a, _b, _c, _d, _e;
|
|
238
239
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
239
240
|
const {
|
|
240
241
|
translate
|
|
@@ -255,6 +256,8 @@ const TableInner = ({
|
|
|
255
256
|
// Desktop infinite scroll is active when onScrollEnd is wired. In that mode there are no pages:
|
|
256
257
|
// pagination is hidden and "Select current page" is suppressed (the checkbox selects all instead).
|
|
257
258
|
const isInfinite = !!onScrollEnd;
|
|
259
|
+
const isAppendLoading = isLoading && (loading === null || loading === void 0 ? void 0 : loading.addToEnd) === true && entities.length > 0;
|
|
260
|
+
const selectableForRender = isLoading && !isAppendLoading ? undefined : selectable;
|
|
258
261
|
// Announce loading/loaded state to screen readers (the skeleton rows are not perceivable to them).
|
|
259
262
|
// Scoped to infinite scroll only: paged tables also pass `isLoading` for initial-fetch skeletons,
|
|
260
263
|
// and "Loading more rows" / "N more rows loaded" are semantically wrong outside infinite scroll.
|
|
@@ -266,7 +269,13 @@ const TableInner = ({
|
|
|
266
269
|
}
|
|
267
270
|
if (isLoading) {
|
|
268
271
|
setLiveMessage(translate("Loading more rows"));
|
|
269
|
-
|
|
272
|
+
// Don't advance the ref while loading: if `entities` and `isLoading` ever update across
|
|
273
|
+
// separate renders instead of together (e.g. without automatic batching), advancing here
|
|
274
|
+
// would make the next render see entities.length === prevEntitiesCountRef.current and
|
|
275
|
+
// silently skip the "N more rows loaded" announcement below.
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (entities.length > prevEntitiesCountRef.current) {
|
|
270
279
|
// Announce the delta (newly appended rows), not the running total — hearing
|
|
271
280
|
// "500 rows loaded" on a later page is confusing when only a page just arrived.
|
|
272
281
|
// Separate singular key because `translate()` has no plural support, so a raw
|
|
@@ -288,7 +297,7 @@ const TableInner = ({
|
|
|
288
297
|
const {
|
|
289
298
|
selectableColumns,
|
|
290
299
|
selectableFeedWrapper
|
|
291
|
-
} = (0, useSelectableRows_1.useSelectableRows)(nestedColumns, entities, isMobile, selectMode, setMobileSelectMode,
|
|
300
|
+
} = (0, useSelectableRows_1.useSelectableRows)(nestedColumns, entities, isMobile, selectMode, setMobileSelectMode, selectableForRender, isInfinite, gridRef, expanded);
|
|
292
301
|
const {
|
|
293
302
|
sortableColumns,
|
|
294
303
|
feedSortControl
|
|
@@ -314,13 +323,21 @@ const TableInner = ({
|
|
|
314
323
|
isFeedVisible,
|
|
315
324
|
visibleColumns
|
|
316
325
|
} = (0, useFeedExpandable_1.useFeedExpandable)(isMobile, feedExpandable);
|
|
317
|
-
|
|
326
|
+
// Keep bulk-action state available during initial/replacement loading for backward compatibility.
|
|
327
|
+
// The row controls themselves still use selectableForRender and remain hidden until real rows can render.
|
|
328
|
+
const allSelected = (0, react_1.useMemo)(() => {
|
|
318
329
|
var _a, _b;
|
|
330
|
+
return (0, useSelectableRows_1.isAllSelection)((_a = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _a === void 0 ? void 0 : _a.all, (_b = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _b === void 0 ? void 0 : _b.selected.length, selectable === null || selectable === void 0 ? void 0 : selectable.allowExclusions);
|
|
331
|
+
}, [(_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all, selectable === null || selectable === void 0 ? void 0 : selectable.allowExclusions, (_d = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _d === void 0 ? void 0 : _d.selected.length]);
|
|
332
|
+
const selectionQty = (0, react_1.useMemo)(() => {
|
|
333
|
+
var _a;
|
|
319
334
|
if (!selectable) {
|
|
320
335
|
return 0;
|
|
321
336
|
}
|
|
322
|
-
|
|
323
|
-
|
|
337
|
+
const ids = new Set((_a = selectable.selection) === null || _a === void 0 ? void 0 : _a.selected);
|
|
338
|
+
const base = entities.length > 0 ? entities : loadingEntities;
|
|
339
|
+
return allSelected ? [...(0, getCurrentPageSelection_1.getCurrentPageSelection)(base, selectable)].filter(id => !selectable.allowExclusions || !ids.has(id)).length : ids.size;
|
|
340
|
+
}, [selectable, entities, loadingEntities, allSelected]);
|
|
324
341
|
const clearSelection = (0, react_1.useCallback)(() => {
|
|
325
342
|
setSelectMode(false);
|
|
326
343
|
selectable === null || selectable === void 0 ? void 0 : selectable.onSelect({
|
|
@@ -337,23 +354,31 @@ const TableInner = ({
|
|
|
337
354
|
}, [onClickRow]);
|
|
338
355
|
const {
|
|
339
356
|
bulkActions,
|
|
357
|
+
hasSelection,
|
|
340
358
|
pagination,
|
|
359
|
+
paginationTotal,
|
|
341
360
|
activePage,
|
|
342
361
|
fullscreenButton,
|
|
343
362
|
emptyList,
|
|
344
363
|
detailPanel,
|
|
345
364
|
footer,
|
|
346
365
|
other
|
|
347
|
-
} = (0, useTableChildren_1.useTableChildren)(children, isMobile, selectionQty, ((
|
|
366
|
+
} = (0, useTableChildren_1.useTableChildren)(children, isMobile, selectionQty, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel, isInfinite, entities.length, (selectable === null || selectable === void 0 ? void 0 : selectable.allowExclusions) && ((_e = selectable.selection) === null || _e === void 0 ? void 0 : _e.all) ? new Set(selectable.selection.selected).size : 0, (selectable === null || selectable === void 0 ? void 0 : selectable.strategy) !== "nested" && !(selectable === null || selectable === void 0 ? void 0 : selectable.checkboxDisabled) && !(selectable === null || selectable === void 0 ? void 0 : selectable.checkboxVisible), !!feedEndCallback || !!isLoading);
|
|
348
367
|
const hasDetailPanel = !!detailPanel;
|
|
349
368
|
const shouldEnableRowClick = hasDetailPanel || !!onClick;
|
|
350
369
|
const activeIdForRow = shouldEnableRowClick ? activeId : undefined;
|
|
351
370
|
const onClickForRow = shouldEnableRowClick ? onClickRow : undefined;
|
|
352
371
|
const handleOnHidePanel = (0, react_1.useCallback)(() => setSelectMode(false), []);
|
|
353
372
|
const handleOnTriggerClick = (0, react_1.useCallback)(() => setSelectMode(prev => !prev), []);
|
|
354
|
-
const hasPostActions = (0, react_1.useMemo)(() => columnsPopup || isMobile &&
|
|
355
|
-
// Pagination is desktop-only
|
|
356
|
-
|
|
373
|
+
const hasPostActions = (0, react_1.useMemo)(() => columnsPopup || isMobile && selectableForRender || !isMobile && fullscreenButton || isFeedVisible, [columnsPopup, fullscreenButton, isFeedVisible, isMobile, selectableForRender]);
|
|
374
|
+
// Pagination is desktop-only. In infinite-scroll mode there are no pages, so when a
|
|
375
|
+
// Table.Pagination child is supplied, `pagination` is already the chevron-less "loaded X of Y"
|
|
376
|
+
// variant (see useTableChildren's `isInfinite` handling) rather than being hidden outright.
|
|
377
|
+
const showPagination = !!pagination && !isMobile;
|
|
378
|
+
// Shown as the last row once every row has been loaded (desktop infinite scroll only). Guarded
|
|
379
|
+
// on `paginationTotal` being a real, positive total from a Table.Pagination child — a consumer
|
|
380
|
+
// that hasn't opted in (no total) never sees this, and an empty list is handled by Table.Empty.
|
|
381
|
+
const isEndOfList = isInfinite && !isMobile && !isLoading && !!paginationTotal && entities.length >= paginationTotal;
|
|
357
382
|
const hasToolbar = (0, react_1.useMemo)(() => bulkActions || feedSortControl || showPagination || other.length || columnsPopup || !isMobile && fullscreenButton || isFeedVisible, [bulkActions, columnsPopup, feedSortControl, fullscreenButton, isFeedVisible, isMobile, other.length, showPagination]);
|
|
358
383
|
const gridAutoHeight = (0, react_1.useMemo)(() => contentHeight ? `${contentHeight}px` : undefined, [contentHeight]);
|
|
359
384
|
const minHeight = "400px";
|
|
@@ -373,7 +398,7 @@ const TableInner = ({
|
|
|
373
398
|
children: [hasToolbar ? (0, jsx_runtime_1.jsxs)(entitiesListActions_1.EntitiesListActions, {
|
|
374
399
|
gridType: isMobile ? deviceType_1.DeviceType.Mobile : deviceType_1.DeviceType.Desktop,
|
|
375
400
|
children: [(0, jsx_runtime_1.jsxs)(entitiesListActions_1.EntitiesListActions.Actions, {
|
|
376
|
-
children: [!isMobile &&
|
|
401
|
+
children: [!isMobile && hasSelection ? bulkActions : null, feedSortControl]
|
|
377
402
|
}), showPagination || other.length > 0 ? (0, jsx_runtime_1.jsxs)(entitiesListActions_1.EntitiesListActions.Pagination, {
|
|
378
403
|
children: [(0, jsx_runtime_1.jsx)(entitiesListActions_1.EntitiesListActions.CustomElements, {
|
|
379
404
|
children: other
|
|
@@ -386,7 +411,7 @@ const TableInner = ({
|
|
|
386
411
|
}) : null, isFeedVisible ? (0, jsx_runtime_1.jsx)(feedExpandControl_1.FeedExpandControl, {
|
|
387
412
|
isExpanded: isFeedExpanded,
|
|
388
413
|
onClick: handleExpanded
|
|
389
|
-
}) : null, isMobile &&
|
|
414
|
+
}) : null, isMobile && selectableForRender ? (0, jsx_runtime_1.jsx)(dataFeedSelectPanel_1.DataFeedSelectPanel, {
|
|
390
415
|
panelTitle: translate("Selection panel"),
|
|
391
416
|
buttonTitle: translate("Bulk select"),
|
|
392
417
|
onTriggerClick: handleOnTriggerClick,
|
|
@@ -439,7 +464,9 @@ const TableInner = ({
|
|
|
439
464
|
onClick: onClickForRow,
|
|
440
465
|
onScrollEnd: onScrollEnd,
|
|
441
466
|
isLoading: isLoading,
|
|
442
|
-
children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})
|
|
467
|
+
children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), isEndOfList ? (0, jsx_runtime_1.jsx)(dataGrid_1.EndOfList, {
|
|
468
|
+
children: (0, jsx_runtime_1.jsx)(lazyLoadingEnd_1.LazyLoadingEnd, {})
|
|
469
|
+
}) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})]
|
|
443
470
|
})
|
|
444
471
|
}), detailPanel !== null && detailPanel !== void 0 ? detailPanel : null]
|
|
445
472
|
})]
|
package/dist/tabs/tabs.d.ts
CHANGED
package/dist/tabs/tabs.js
CHANGED
|
@@ -141,6 +141,27 @@ const Tabs = ({
|
|
|
141
141
|
const scrollRef = (0, react_1.useRef)(0);
|
|
142
142
|
const focusableTabIdRef = (0, react_1.useRef)("");
|
|
143
143
|
const userInitiatedTabChangeRef = (0, react_1.useRef)(false);
|
|
144
|
+
const scrollTabIntoView = (0, react_1.useCallback)(tabId => {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const scrollableElement = scrollableRef.current;
|
|
147
|
+
if (!scrollableElement) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (tabId === ((_a = tabs[0]) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
151
|
+
scrollableElement.scrollLeft = 0;
|
|
152
|
+
} else if (tabId === ((_b = tabs[tabs.length - 1]) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
153
|
+
scrollableElement.scrollLeft = isRTL ? scrollableElement.clientWidth - scrollableElement.scrollWidth : scrollableElement.scrollWidth - scrollableElement.clientWidth;
|
|
154
|
+
} else {
|
|
155
|
+
const tab = scrollableElement.querySelector(`.zen-tab-item[id='${tabId}']`);
|
|
156
|
+
if (tab instanceof HTMLElement) {
|
|
157
|
+
tab.scrollIntoView({
|
|
158
|
+
block: "nearest",
|
|
159
|
+
inline: "nearest"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
setScrollButtonType(getScrollButtonType(scrollableElement, isRTL));
|
|
164
|
+
}, [isRTL, tabs]);
|
|
144
165
|
const handleButtonClick = e => {
|
|
145
166
|
if (disabled) {
|
|
146
167
|
return;
|
|
@@ -175,14 +196,23 @@ const Tabs = ({
|
|
|
175
196
|
const nextTabId = (0, tabsKeyboard_1.tabsKeyboardTabHandler)(e, tabs, (_a = zen_1.zen === null || zen_1.zen === void 0 ? void 0 : zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.activeElement);
|
|
176
197
|
if (nextTabId) {
|
|
177
198
|
focusableTabIdRef.current = nextTabId;
|
|
199
|
+
scrollTabIntoView(nextTabId);
|
|
178
200
|
}
|
|
179
201
|
return;
|
|
180
202
|
}
|
|
181
|
-
const newActiveTabId = (0, tabsKeyboard_1.tabsKeyboardHandler)(e, tabs, focusableTabIdRef.current)
|
|
203
|
+
const newActiveTabId = (0, tabsKeyboard_1.tabsKeyboardHandler)(e, tabs, focusableTabIdRef.current, isRTL);
|
|
204
|
+
if (!newActiveTabId) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
182
207
|
focusableTabIdRef.current = newActiveTabId;
|
|
183
208
|
const focusableTab = (_b = scrollableRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(`.zen-tab-item[id='${newActiveTabId}']`);
|
|
184
|
-
|
|
185
|
-
|
|
209
|
+
if (focusableTab instanceof HTMLElement) {
|
|
210
|
+
focusableTab.focus({
|
|
211
|
+
preventScroll: true
|
|
212
|
+
});
|
|
213
|
+
scrollTabIntoView(newActiveTabId);
|
|
214
|
+
}
|
|
215
|
+
}, [tabs, onTabChange, disabled, isRTL, scrollTabIntoView]);
|
|
186
216
|
(0, react_1.useEffect)(() => {
|
|
187
217
|
var _a;
|
|
188
218
|
if (!scrollableRef.current) {
|
|
@@ -276,20 +306,23 @@ const Tabs = ({
|
|
|
276
306
|
children: (0, jsx_runtime_1.jsx)("div", {
|
|
277
307
|
className: "zen-tabs__tabs",
|
|
278
308
|
role: "tablist",
|
|
279
|
-
children: tabs.map(tab =>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
309
|
+
children: tabs.map(tab => {
|
|
310
|
+
var _a;
|
|
311
|
+
return (0, jsx_runtime_1.jsx)(tabItem_1.TabItem, {
|
|
312
|
+
className: "zen-tabs__tab-item",
|
|
313
|
+
tabId: tab.id,
|
|
314
|
+
tabName: tab.name,
|
|
315
|
+
icon: typeof tab.icon === "function" ? (0, react_1.createElement)(tab.icon, {
|
|
316
|
+
size: "large"
|
|
317
|
+
}) : tab.icon,
|
|
318
|
+
quantity: tab.quantity,
|
|
319
|
+
active: activeTabId === tab.id,
|
|
320
|
+
ariaControl: tab.ariaControls === undefined ? `panel-${tab.id}` : (_a = tab.ariaControls) !== null && _a !== void 0 ? _a : undefined,
|
|
321
|
+
handleButtonClick: handleButtonClick,
|
|
322
|
+
dataAnalyticsId: tab.dataAnalyticsId,
|
|
323
|
+
disabled: disabled
|
|
324
|
+
}, tab.id);
|
|
325
|
+
})
|
|
293
326
|
})
|
|
294
327
|
}), scrollButtonType === "end" || scrollButtonType === "both" ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
295
328
|
children: [(0, jsx_runtime_1.jsx)("div", {
|
|
@@ -7,6 +7,7 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
|
7
7
|
const reviewTextControl_1 = require("../formGroup/components/reviewTextControl");
|
|
8
8
|
const useFormFieldValues_1 = require("../commonHelpers/hooks/useFormFieldValues/useFormFieldValues");
|
|
9
9
|
const useMobileClassName_1 = require("../utils/theme/useMobileClassName");
|
|
10
|
+
const getAriaAttributes_1 = require("../commonHelpers/getAriaAttributes");
|
|
10
11
|
const TextInputRaw = (props) => {
|
|
11
12
|
const driveComponentClass = (0, useDriveClassName_1.useDriveClassName)("zen-text-input");
|
|
12
13
|
const mobileComponentClass = (0, useMobileClassName_1.useMobileClassName)("zen-text-input");
|
|
@@ -14,14 +15,14 @@ const TextInputRaw = (props) => {
|
|
|
14
15
|
if (props.isReadOnly) {
|
|
15
16
|
return (0, jsx_runtime_1.jsx)(reviewTextControl_1.ReviewTextControl, { value: value, password: props.type === "password" });
|
|
16
17
|
}
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)("input", { id: props.id, ref: props.ref, type: props.type || "text", className: (0, classNames_1.classNames)([
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("input", Object.assign({ id: props.id, ref: props.ref, type: props.type || "text", className: (0, classNames_1.classNames)([
|
|
18
19
|
"zen-text-input",
|
|
19
20
|
mobileComponentClass || driveComponentClass || "",
|
|
20
21
|
props.className || "",
|
|
21
22
|
props.isError ? "zen-text-input--error" : ""
|
|
22
23
|
]), value: maxLength ? value.substring(0, maxLength) : value, placeholder: props.placeholder, disabled: disabled, onChange: onChange, onKeyDown: props.onKeyDown, onBlur: onBlur, maxLength: maxLength, autoComplete: props.autocomplete,
|
|
23
24
|
// TODO: add tests
|
|
24
|
-
min: min, max: max, step: props.step,
|
|
25
|
+
min: min, max: max, step: props.step, autoFocus: props.autoFocus, required: !!required, onFocus: props.onFocus, minLength: minLength, name: name, pattern: pattern, role: props.role }, (0, getAriaAttributes_1.getAriaAttributes)(props), { "aria-expanded": props.ariaExpanded === undefined ? undefined : props.ariaExpanded === "true" || props.ariaExpanded === true })));
|
|
25
26
|
};
|
|
26
27
|
exports.TextInputRaw = TextInputRaw;
|
|
27
28
|
exports.TextInputRaw.displayName = "TextInputRaw";
|
|
@@ -8,6 +8,8 @@ export type TMobileView = "default" | "mobileSheet";
|
|
|
8
8
|
interface ITooltip extends IZenComponentProps {
|
|
9
9
|
trigger?: ReactElement<PropsWithChildren & {
|
|
10
10
|
onClick?: (e: React.MouseEvent) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
focusableWhenDisabled?: boolean;
|
|
11
13
|
}>;
|
|
12
14
|
alignment?: TAlignment;
|
|
13
15
|
triggerClassName?: string;
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -164,13 +164,17 @@ const EventWrapper = ({
|
|
|
164
164
|
deviceType,
|
|
165
165
|
onKeyDownHandler,
|
|
166
166
|
handleUniversalClick,
|
|
167
|
+
isTriggerDisabledFocusable,
|
|
167
168
|
setTooltipVisible,
|
|
168
169
|
timerRef,
|
|
169
170
|
timerMouseLeaveRef,
|
|
170
171
|
tooltipRef
|
|
171
172
|
}) => {
|
|
172
173
|
const isCurrentDeviceDesktop = deviceType === deviceType_1.DeviceType.Desktop;
|
|
173
|
-
const
|
|
174
|
+
const triggerProps = children.props;
|
|
175
|
+
const originalOnClick = triggerProps.onClick;
|
|
176
|
+
// A disabled-focusable trigger's own `onClick` is a no-op guard, so `composedOnClick` never runs on
|
|
177
|
+
// mobile — see the `onClickCapture` handling in `mobileEvents` below.
|
|
174
178
|
const composedOnClick = (0, react_1.useCallback)(e => {
|
|
175
179
|
// Call original onClick first if it exists
|
|
176
180
|
if (originalOnClick) {
|
|
@@ -207,10 +211,13 @@ const EventWrapper = ({
|
|
|
207
211
|
handleUniversalClick(undefined);
|
|
208
212
|
}
|
|
209
213
|
}, [handleUniversalClick]);
|
|
210
|
-
const mobileEvents = {
|
|
211
|
-
onClick: composedOnClick,
|
|
214
|
+
const mobileEvents = Object.assign({
|
|
212
215
|
onKeyDown: mobileOnKeyDown
|
|
213
|
-
}
|
|
216
|
+
}, isTriggerDisabledFocusable ? {
|
|
217
|
+
onClickCapture: handleUniversalClick
|
|
218
|
+
} : {
|
|
219
|
+
onClick: composedOnClick
|
|
220
|
+
});
|
|
214
221
|
const propsToApply = isCurrentDeviceDesktop ? desktopEvents : mobileEvents;
|
|
215
222
|
return react_1.default.cloneElement(children, propsToApply);
|
|
216
223
|
};
|
|
@@ -240,6 +247,8 @@ const Tooltip = ({
|
|
|
240
247
|
const [isTooltipVisible, setTooltipVisible] = (0, react_1.useState)(false);
|
|
241
248
|
const [deviceType, setDeviceType] = (0, react_1.useState)(getInitialDeviceType);
|
|
242
249
|
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
250
|
+
const triggerProps = trigger === null || trigger === void 0 ? void 0 : trigger.props;
|
|
251
|
+
const isTriggerDisabledFocusable = Boolean(triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.disabled) && (triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.focusableWhenDisabled) !== false;
|
|
243
252
|
const tooltipId = (0, react_1.useId)();
|
|
244
253
|
const {
|
|
245
254
|
translate
|
|
@@ -270,7 +279,7 @@ const Tooltip = ({
|
|
|
270
279
|
}
|
|
271
280
|
};
|
|
272
281
|
const handleUniversalClick = (0, react_1.useCallback)(e => {
|
|
273
|
-
const hasExternalClickHandler = !!(
|
|
282
|
+
const hasExternalClickHandler = !!(triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onClick) && !isTriggerDisabledFocusable;
|
|
274
283
|
if (deviceType === deviceType_1.DeviceType.Desktop) {
|
|
275
284
|
setTooltipVisible(currentVisible => {
|
|
276
285
|
if (currentVisible) {
|
|
@@ -279,12 +288,14 @@ const Tooltip = ({
|
|
|
279
288
|
return currentVisible;
|
|
280
289
|
});
|
|
281
290
|
} else {
|
|
282
|
-
|
|
291
|
+
if (!isTriggerDisabledFocusable) {
|
|
292
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
293
|
+
}
|
|
283
294
|
if (!hasExternalClickHandler) {
|
|
284
295
|
setTooltipVisible(isVisible => !isVisible);
|
|
285
296
|
}
|
|
286
297
|
}
|
|
287
|
-
}, [
|
|
298
|
+
}, [deviceType, isTriggerDisabledFocusable, triggerProps]);
|
|
288
299
|
// Apply `triggerAriaLabel` to a `Tooltip.InlineTrigger` trigger (it has no `ariaLabel` prop
|
|
289
300
|
// of its own); the default info-icon trigger below handles `triggerAriaLabel` separately.
|
|
290
301
|
// An `aria-label` set directly on the `Tooltip.InlineTrigger` element takes priority over
|
|
@@ -311,6 +322,7 @@ const Tooltip = ({
|
|
|
311
322
|
isTooltipVisible: isTooltipVisible,
|
|
312
323
|
onKeyDownHandler: onKeyDownHandler,
|
|
313
324
|
handleUniversalClick: handleUniversalClick,
|
|
325
|
+
isTriggerDisabledFocusable: isTriggerDisabledFocusable,
|
|
314
326
|
setTooltipVisible: setTooltipVisible,
|
|
315
327
|
timerRef: timerRef,
|
|
316
328
|
timerMouseLeaveRef: timerMouseLeaveRef,
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"GroupManuallyClassifiedPowertrainId": "محرك مصنف يدوياً",
|
|
130
130
|
"GroupFuelCellElectricVehicleId": "مركبة كهربائية بخلايا الوقود",
|
|
131
131
|
"and {0} more": "و {0} إضافي",
|
|
132
|
+
"+{0} more": "+{0} أخرى",
|
|
132
133
|
"Clear selection": "مسح التحديد",
|
|
133
134
|
"Select current page": "تحديد الصفحة الحالية",
|
|
134
135
|
"OperatorOr": "معامل أو",
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"GroupManuallyClassifiedPowertrainId": "Ръчно класифицирана задвижваща система",
|
|
130
130
|
"GroupFuelCellElectricVehicleId": "Електрическо превозно средство с горивни клетки",
|
|
131
131
|
"and {0} more": "и {0} повече",
|
|
132
|
+
"+{0} more": "+ още {0}",
|
|
132
133
|
"Clear selection": "Изчистване на избора",
|
|
133
134
|
"Select current page": "Избиране на текущата страница",
|
|
134
135
|
"OperatorOr": "ИЛИ",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"GroupFuelCellElectricVehicleId": "Elektromobil s palivovým článkem",
|
|
116
116
|
"{1} selected": "{1} vybraný/vybrané",
|
|
117
117
|
"and {0} more": "a {0} dalších",
|
|
118
|
+
"+{0} more": "+{0} další",
|
|
118
119
|
"Clear selection": "Vymazat výběr",
|
|
119
120
|
"Select current page": "Vybrat aktuální stránku",
|
|
120
121
|
"OperatorOr": "NEBO",
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"GroupManuallyClassifiedPowertrainId": "Manuelt klassificeret drivlinje",
|
|
126
126
|
"GroupFuelCellElectricVehicleId": "Brændselscelle elektrisk køretøj",
|
|
127
127
|
"and {0} more": "og {0} mere",
|
|
128
|
+
"+{0} more": "+{0} mere",
|
|
128
129
|
"Clear selection": "Ryd markering",
|
|
129
130
|
"Select current page": "Vælg aktuel side",
|
|
130
131
|
"OperatorOr": "ELLER",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"GroupFuelCellElectricVehicleId": "Brennstoffzellenfahrzeug",
|
|
116
116
|
"{1} selected": "{1} ausgewählt",
|
|
117
117
|
"and {0} more": "und {0} weitere",
|
|
118
|
+
"+{0} more": "+{0} weitere",
|
|
118
119
|
"Select current page": "Aktuelle Seite auswählen",
|
|
119
120
|
"OperatorOr": "ODER",
|
|
120
121
|
"OperatorAnd": "UND",
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"GroupManuallyClassifiedPowertrainId": "Χειροκίνητα ταξινομημένο σύστημα κίνησης",
|
|
130
130
|
"GroupFuelCellElectricVehicleId": "Ηλεκτρικό όχημα κυψελών καυσίμου",
|
|
131
131
|
"and {0} more": "και {0} ακόμη",
|
|
132
|
+
"+{0} more": "+{0} ακόμα",
|
|
132
133
|
"Clear selection": "Εκκαθάριση επιλογής",
|
|
133
134
|
"Select current page": "Επιλογή τρέχουσας σελίδας",
|
|
134
135
|
"OperatorOr": "Ή",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"Previous page": "Previous page",
|
|
88
88
|
"Next page": "Next page",
|
|
89
89
|
"Showing {from} - {to} of {total}": "Showing {from} - {to} of {total}",
|
|
90
|
+
"{from}-{to} of {total}": "{from}-{to} of {total}",
|
|
90
91
|
"Selected:": "Selected:",
|
|
91
92
|
"All": "All",
|
|
92
93
|
"Go to My Reports": "Go to My Reports",
|
|
@@ -129,6 +130,7 @@
|
|
|
129
130
|
"GroupManuallyClassifiedPowertrainId": "Manually Classified Powertrain",
|
|
130
131
|
"GroupFuelCellElectricVehicleId": "Fuel Cell Electric Vehicle",
|
|
131
132
|
"and {0} more": "and {0} more",
|
|
133
|
+
"+{0} more": "+{0} more",
|
|
132
134
|
"Clear selection": "Clear selection",
|
|
133
135
|
"Select current page": "Select current page",
|
|
134
136
|
"OperatorOr": "OR",
|
|
@@ -348,6 +350,8 @@
|
|
|
348
350
|
"Loading more rows": "Loading more rows",
|
|
349
351
|
"1 more row loaded": "1 more row loaded",
|
|
350
352
|
"{count} more rows loaded": "{count} more rows loaded",
|
|
353
|
+
"No further results found": "No further results found",
|
|
354
|
+
"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.",
|
|
351
355
|
"Line chart": "Line chart",
|
|
352
356
|
"Bar chart": "Bar chart",
|
|
353
357
|
"Pie chart": "Pie chart",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"GroupFuelCellElectricVehicleId": "Vehículo eléctrico con celdas de combustible",
|
|
116
116
|
"{1} selected": "Seleccionados: {1}",
|
|
117
117
|
"and {0} more": "y {0} más",
|
|
118
|
+
"+{0} more": "+{0} más",
|
|
118
119
|
"Clear selection": "Borrar selección",
|
|
119
120
|
"Select current page": "Seleccionar página actual",
|
|
120
121
|
"OperatorOr": "O",
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"GroupManuallyClassifiedPowertrainId": "Käsitsi klassifitseeritud jõuülekanne",
|
|
130
130
|
"GroupFuelCellElectricVehicleId": "Kütuseelementidega elektrisõiduk",
|
|
131
131
|
"and {0} more": "ja {0} veel",
|
|
132
|
+
"+{0} more": "+{0} veel",
|
|
132
133
|
"Clear selection": "Tühjenda valik",
|
|
133
134
|
"Select current page": "Vali praegune leht",
|
|
134
135
|
"OperatorOr": "VÕI",
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"GroupManuallyClassifiedPowertrainId": "Manuaalisesti luokiteltu voimansiirto",
|
|
126
126
|
"GroupFuelCellElectricVehicleId": "Polttokennosähköajoneuvo",
|
|
127
127
|
"and {0} more": "ja {0} lisää",
|
|
128
|
+
"+{0} more": "+{0} lisää",
|
|
128
129
|
"Clear selection": "Tyhjennä valinta",
|
|
129
130
|
"Select current page": "Valitse nykyinen sivu",
|
|
130
131
|
"OperatorOr": "TAI",
|