@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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a prop key is an aria attribute, in either the hyphenated (`aria-label`) or the
|
|
3
|
+
* camelCase (`ariaLabel`) spelling.
|
|
4
|
+
*
|
|
5
|
+
* Pair it with `getAriaAttributes` when a component has to split a rest-props object: the helper
|
|
6
|
+
* collects the aria half, this predicate identifies the half it leaves behind. Sharing one rule
|
|
7
|
+
* keeps the two halves from disagreeing and silently dropping a prop.
|
|
8
|
+
*/
|
|
9
|
+
export const isAriaProp = (key) => key.startsWith("aria-") || (key.startsWith("aria") && key.length > 4 && key[4] === key[4].toUpperCase());
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { IEntityWithId } from "./entity";
|
|
3
|
+
export declare const SHOW_MORE_KIND = "showMore";
|
|
4
|
+
export type IShowMoreActivation = {
|
|
5
|
+
onActivate: () => void;
|
|
6
|
+
href?: never;
|
|
7
|
+
} | {
|
|
8
|
+
href: string;
|
|
9
|
+
onActivate?: never;
|
|
10
|
+
};
|
|
11
|
+
export type IShowMoreRow = IEntityWithId & {
|
|
12
|
+
__zenMoreRowsType: typeof SHOW_MORE_KIND;
|
|
13
|
+
remaining: number;
|
|
14
|
+
parentId: string;
|
|
15
|
+
label?: (remaining: number) => ReactNode;
|
|
16
|
+
} & IShowMoreActivation;
|
|
17
|
+
export declare const isShowMoreRow: (entity: IEntityWithId) => entity is IShowMoreRow;
|
|
18
|
+
export declare const createShowMoreRow: (params: {
|
|
19
|
+
parentId: string;
|
|
20
|
+
remaining: number;
|
|
21
|
+
label?: (remaining: number) => ReactNode;
|
|
22
|
+
} & IShowMoreActivation) => IShowMoreRow;
|
|
23
|
+
export declare const withFullChildren: <T extends {
|
|
24
|
+
children?: unknown[];
|
|
25
|
+
}>(entity: T, fullChildren: readonly unknown[]) => T;
|
|
26
|
+
export declare const getChildrenForSelection: <N extends IEntityWithId>(entity: {
|
|
27
|
+
children?: N[];
|
|
28
|
+
}) => N[] | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const SHOW_MORE_KIND = "showMore";
|
|
2
|
+
export const isShowMoreRow = (entity) =>
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
|
|
4
|
+
entity.__zenMoreRowsType === SHOW_MORE_KIND;
|
|
5
|
+
export const createShowMoreRow = (params) => {
|
|
6
|
+
const base = {
|
|
7
|
+
id: `__zen-show-more__${params.parentId}`,
|
|
8
|
+
__zenMoreRowsType: SHOW_MORE_KIND,
|
|
9
|
+
remaining: params.remaining,
|
|
10
|
+
parentId: params.parentId,
|
|
11
|
+
label: params.label
|
|
12
|
+
};
|
|
13
|
+
if ("href" in params && params.href !== undefined) {
|
|
14
|
+
return Object.assign(Object.assign({}, base), { href: params.href });
|
|
15
|
+
}
|
|
16
|
+
return Object.assign(Object.assign({}, base), { onActivate: params.onActivate });
|
|
17
|
+
};
|
|
18
|
+
// `children` is sliced down for rendering, so the un-capped list is stashed here to keep
|
|
19
|
+
// selection operating on every real child.
|
|
20
|
+
const FULL_CHILDREN_KEY = "__zenFullChildren";
|
|
21
|
+
export const withFullChildren = (entity, fullChildren) => (Object.assign(Object.assign({}, entity), { [FULL_CHILDREN_KEY]: fullChildren }));
|
|
22
|
+
export const getChildrenForSelection = (entity) => { var _a; return (_a = entity[FULL_CHILDREN_KEY]) !== null && _a !== void 0 ? _a : entity.children; };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IEntityWithId } from "./entity";
|
|
2
|
-
export declare const tabsKeyboardHandler: (e: React.KeyboardEvent, tabsArr: IEntityWithId[], activeId: string) => string | null;
|
|
2
|
+
export declare const tabsKeyboardHandler: (e: React.KeyboardEvent, tabsArr: IEntityWithId[], activeId: string, isRTL?: boolean) => string | null;
|
|
3
3
|
export declare const tabsKeyboardTabHandler: (e: React.KeyboardEvent, tabsArr: IEntityWithId[], activeElement: HTMLElement) => string | undefined;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
export const tabsKeyboardHandler = (e, tabsArr, activeId) => {
|
|
1
|
+
export const tabsKeyboardHandler = (e, tabsArr, activeId, isRTL = false) => {
|
|
2
2
|
const getCurrentIndex = () => tabsArr.findIndex(el => el.id === activeId);
|
|
3
3
|
switch (e.key) {
|
|
4
4
|
case "ArrowLeft": {
|
|
5
|
+
e.preventDefault();
|
|
6
|
+
if (isRTL) {
|
|
7
|
+
const currentIndex = getCurrentIndex();
|
|
8
|
+
const nextPaneIndex = currentIndex > -1 ? currentIndex + 1 : undefined;
|
|
9
|
+
const newPaneId = nextPaneIndex !== undefined && nextPaneIndex < tabsArr.length ? tabsArr[nextPaneIndex].id : tabsArr[0].id;
|
|
10
|
+
return newPaneId;
|
|
11
|
+
}
|
|
5
12
|
const currentIndex = getCurrentIndex();
|
|
6
13
|
const prevPaneIndex = currentIndex > -1 ? currentIndex - 1 : undefined;
|
|
7
14
|
const newPaneId = prevPaneIndex !== undefined && prevPaneIndex > -1 ? tabsArr[prevPaneIndex].id : tabsArr[tabsArr.length - 1].id;
|
|
@@ -12,6 +19,13 @@ export const tabsKeyboardHandler = (e, tabsArr, activeId) => {
|
|
|
12
19
|
return tabsArr[0].id;
|
|
13
20
|
}
|
|
14
21
|
case "ArrowRight": {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
if (isRTL) {
|
|
24
|
+
const currentIndex = getCurrentIndex();
|
|
25
|
+
const prevPaneIndex = currentIndex > -1 ? currentIndex - 1 : undefined;
|
|
26
|
+
const newPaneId = prevPaneIndex !== undefined && prevPaneIndex > -1 ? tabsArr[prevPaneIndex].id : tabsArr[tabsArr.length - 1].id;
|
|
27
|
+
return newPaneId;
|
|
28
|
+
}
|
|
15
29
|
const currentIndex = getCurrentIndex();
|
|
16
30
|
const nextPaneIndex = currentIndex > -1 ? currentIndex + 1 : undefined;
|
|
17
31
|
const newPaneId = nextPaneIndex !== undefined && nextPaneIndex < tabsArr.length ? tabsArr[nextPaneIndex].id : tabsArr[0].id;
|
|
@@ -53,67 +53,67 @@ export const Colors = {
|
|
|
53
53
|
{
|
|
54
54
|
colorName: "action-primary",
|
|
55
55
|
text: "Primary",
|
|
56
|
-
variable: "--
|
|
56
|
+
variable: "--action-primary--default",
|
|
57
57
|
description: "For immediate attention to interactive elements"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
colorName: "action-primary-hover",
|
|
61
61
|
text: "Primary - Hover",
|
|
62
|
-
variable: "--
|
|
62
|
+
variable: "--action-primary--hover",
|
|
63
63
|
description: "For indication when users hover over interactive elements"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
colorName: "action-primary-active",
|
|
67
67
|
text: "Primary - Active",
|
|
68
|
-
variable: "--
|
|
68
|
+
variable: "--action-primary--active",
|
|
69
69
|
description: "For indication when an element is clicked or tapped"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
colorName: "action-secondary",
|
|
73
73
|
text: "Secondary - Default",
|
|
74
|
-
variable: "--
|
|
74
|
+
variable: "--action-secondary--default",
|
|
75
75
|
description: "Primary text and icons colour for text and icons"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
colorName: "action-secondary-hover",
|
|
79
79
|
text: "Secondary - Hover",
|
|
80
|
-
variable: "--
|
|
80
|
+
variable: "--action-secondary--hover",
|
|
81
81
|
description: "For indication when users hover over less prominent interactive elements"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
colorName: "action-secondary-active",
|
|
85
85
|
text: "Secondary - Active",
|
|
86
|
-
variable: "--
|
|
86
|
+
variable: "--action-secondary--active",
|
|
87
87
|
description: "For indication when a secondary element is clicked or tapped"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
colorName: "action-destructive",
|
|
91
91
|
text: "Destructive - Default",
|
|
92
|
-
variable: "--
|
|
92
|
+
variable: "--action-destructive--default",
|
|
93
93
|
description: "For highlighting actions or elements that carry significant consequences"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
colorName: "action-destructive-hover",
|
|
97
97
|
text: "Destructive Hover",
|
|
98
|
-
variable: "--
|
|
98
|
+
variable: "--action-destructive--hover",
|
|
99
99
|
description: "For visual feedback when users hover over elements representing potentially irreversible actions"
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
colorName: "action-destructive-active",
|
|
103
103
|
text: "Destructive - Active",
|
|
104
|
-
variable: "--
|
|
104
|
+
variable: "--action-destructive--active",
|
|
105
105
|
description: "For when potentially irreversible actions are clicked"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
colorName: "action-tertiary-hover",
|
|
109
109
|
text: "Tertiary hover",
|
|
110
|
-
variable: "--
|
|
110
|
+
variable: "--action-tertiary--hover",
|
|
111
111
|
description: "For subtle visual feedback when users hover over less prominent interactive elements"
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
colorName: "action-tertiary-active",
|
|
115
115
|
text: "Tertiary active",
|
|
116
|
-
variable: "--
|
|
116
|
+
variable: "--action-tertiary--active",
|
|
117
117
|
description: "For less prominent interactive elements, when they are clicked or tapped"
|
|
118
118
|
}
|
|
119
119
|
],
|
|
@@ -6,6 +6,8 @@ import { DataFeedCell } from "./dataFeedCell/dataFeedCell";
|
|
|
6
6
|
import { ActionsMenu } from "../table/actions/actionsMenu";
|
|
7
7
|
import { useVisibleColumns } from "./hooks/useVisibleColumns";
|
|
8
8
|
import { Menu } from "../menu/menu";
|
|
9
|
+
import { isShowMoreRow } from "../commonHelpers/showMoreRow";
|
|
10
|
+
import { ShowMoreCell } from "../commonHelpers/ShowMoreCell";
|
|
9
11
|
const getIconFromColumnComponent = (column, entity, isNested) => {
|
|
10
12
|
const renderIcon = "renderIcon" in column.columnComponent ? column.columnComponent.renderIcon : undefined;
|
|
11
13
|
if (renderIcon) {
|
|
@@ -126,7 +128,7 @@ const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQt
|
|
|
126
128
|
entity,
|
|
127
129
|
onClick
|
|
128
130
|
]);
|
|
129
|
-
const nestedCells = useMemo(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
|
|
131
|
+
const nestedCells = useMemo(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => isShowMoreRow(nestedEntity) ? _jsx(ShowMoreCell, { row: nestedEntity }, nestedEntity.id) : renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
|
|
130
132
|
const cells = useMemo(() => renderCells(entity, nestedCells), [entity, nestedCells, renderCells]);
|
|
131
133
|
return cells;
|
|
132
134
|
};
|
|
@@ -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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Checkbox } from "../../../checkbox/checkbox";
|
|
3
3
|
import { classNames } from "../../../commonHelpers/classNames/classNames";
|
|
4
|
-
export const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, children }) => (_jsxs("div", { className: classNames(["zen-checkbox-column", className || ""]), children: [_jsx(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] }));
|
|
4
|
+
export const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, onMouseDown, children }) => (_jsxs("div", { className: classNames(["zen-checkbox-column", className || ""]), onMouseDown: onMouseDown ? e => onMouseDown(id, checked, e) : undefined, children: [_jsx(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] }));
|
|
5
5
|
CheckboxCell.Content = function content({ children }) {
|
|
6
6
|
return _jsx("div", { className: "zen-checkbox-column__content", children: children });
|
|
7
7
|
};
|
|
@@ -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;
|
|
@@ -64,6 +64,15 @@ export class CheckboxColumnWrapper extends SimpleEventHandler {
|
|
|
64
64
|
this.fire("change", [id, checked]);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
+
// Only fired for enabled checkboxes, so a disabled row can never become a drag anchor.
|
|
68
|
+
Object.defineProperty(this, "mouseDownHandler", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value: (id, checked, e) => {
|
|
73
|
+
this.fire("mousedown", [id, checked, e]);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
67
76
|
Object.defineProperty(this, "changeHandlerAll", {
|
|
68
77
|
enumerable: true,
|
|
69
78
|
configurable: true,
|
|
@@ -89,7 +98,7 @@ export class CheckboxColumnWrapper extends SimpleEventHandler {
|
|
|
89
98
|
}
|
|
90
99
|
const allowed = this.condition(entity);
|
|
91
100
|
const isDisable = this.disabled ? this.disabled(entity) : this.state === SelectionState.All;
|
|
92
|
-
const cell = (_jsx(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: _jsx(CheckboxCell.Content, { children: value }) }));
|
|
101
|
+
const cell = (_jsx(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: _jsx(CheckboxCell.Content, { children: value }) }));
|
|
93
102
|
return cell;
|
|
94
103
|
}
|
|
95
104
|
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>;
|
package/esm/dataGrid/dataGrid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { injectString } from "../utils/localization/translationsDictionary";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Children, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Children, cloneElement, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
5
5
|
import { DataGridRow } from "./row/row";
|
|
6
6
|
import { DataGridHeaderCell } from "./headerCell/headerCell";
|
|
@@ -68,6 +68,19 @@ export const Footer = ({
|
|
|
68
68
|
className: "zen-data-grid__footer",
|
|
69
69
|
children: children
|
|
70
70
|
});
|
|
71
|
+
// Rendered right after the last data row (desktop infinite scroll only) to indicate there is no
|
|
72
|
+
// more data to load. See Table's `isEndOfList` (table.tsx). `style` is set by DataGridInner to the
|
|
73
|
+
// table's actual rendered width (see `tableRef`/`tableObserverResult` below), so the row — and the
|
|
74
|
+
// centered content inside it (see `lazyLoadingEnd.less`) — spans the full table width even when
|
|
75
|
+
// columns overflow the visible viewport, rather than just the currently-scrolled-into-view portion.
|
|
76
|
+
export const EndOfList = ({
|
|
77
|
+
children,
|
|
78
|
+
style
|
|
79
|
+
}) => _jsx("div", {
|
|
80
|
+
className: "zen-data-grid__end-of-list",
|
|
81
|
+
style: style,
|
|
82
|
+
children: children
|
|
83
|
+
});
|
|
71
84
|
const FIRST_RENDERED_ROWS = 100;
|
|
72
85
|
const SCROLL_END_THRESHOLD = 100;
|
|
73
86
|
const DataGridInner = ({
|
|
@@ -97,6 +110,12 @@ const DataGridInner = ({
|
|
|
97
110
|
const [verticalScrollApplied, setVerticalScrollApplied] = useState(false);
|
|
98
111
|
// Refs
|
|
99
112
|
const gridRef = useRef(null);
|
|
113
|
+
// Separate from `gridRef` (which is the outer *scrolling container*, used above for available
|
|
114
|
+
// column-allocation space). This tracks the `<table>` element itself, whose rendered width
|
|
115
|
+
// already reflects `max(sum of column widths, container width)` per its `min-width: 100%` CSS —
|
|
116
|
+
// i.e. it's wider than the container when columns overflow. Used to size the end-of-list row to
|
|
117
|
+
// the table's true full width instead of just the visible/scrolled-into-view portion.
|
|
118
|
+
const tableRef = useRef(null);
|
|
100
119
|
const bodyRef = useRef(null);
|
|
101
120
|
const lazyRenderTimerRef = useRef(0);
|
|
102
121
|
const scrollEndFiredRef = useRef(false);
|
|
@@ -104,6 +123,7 @@ const DataGridInner = ({
|
|
|
104
123
|
const rowsMap = useMemo(() => new Map(entities.map(entity => [entity.id, entity])), [entities]);
|
|
105
124
|
const emptyList = useMemo(() => Children.toArray(children).find(child => child.type === EmptyList), [children]);
|
|
106
125
|
const footer = useMemo(() => Children.toArray(children).find(child => child.type === Footer), [children]);
|
|
126
|
+
const endOfList = useMemo(() => Children.toArray(children).find(child => child.type === EndOfList), [children]);
|
|
107
127
|
useImperativeHandle(ref, () => gridRef.current, []);
|
|
108
128
|
const getVisibleRows = () => {
|
|
109
129
|
if (!gridRef.current || !bodyRef.current) {
|
|
@@ -161,6 +181,14 @@ const DataGridInner = ({
|
|
|
161
181
|
} = useResizeObserver({
|
|
162
182
|
target: gridRef.current
|
|
163
183
|
});
|
|
184
|
+
// Only observe the table's width when an `EndOfList` child is actually present — avoids a
|
|
185
|
+
// second ResizeObserver instance (and its resulting re-renders) on the vast majority of
|
|
186
|
+
// `DataGrid` usages that never render this row.
|
|
187
|
+
const {
|
|
188
|
+
result: tableObserverResult
|
|
189
|
+
} = useResizeObserver({
|
|
190
|
+
target: endOfList ? tableRef.current : null
|
|
191
|
+
});
|
|
164
192
|
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width, index) => acc + (width === undefined ? 0 : getColumnWidth(width, listOfMinWidthColumns[index])), 0);
|
|
165
193
|
const unallocatedSpace = observerResult && observerResult.contentRect.width - allocatedSpace || 0;
|
|
166
194
|
const flexibleColumnsQty = listOfDefaultWidthColumns.filter(width => width === undefined).length;
|
|
@@ -298,6 +326,7 @@ const DataGridInner = ({
|
|
|
298
326
|
"aria-label": description,
|
|
299
327
|
"aria-busy": !!isLoading,
|
|
300
328
|
role: isTreeGrid ? "treegrid" : undefined,
|
|
329
|
+
ref: tableRef,
|
|
301
330
|
children: [_jsx("thead", {
|
|
302
331
|
className: "zen-data-grid__header",
|
|
303
332
|
children: _jsx("tr", {
|
|
@@ -308,12 +337,19 @@ const DataGridInner = ({
|
|
|
308
337
|
ref: bodyRef,
|
|
309
338
|
children: body
|
|
310
339
|
})]
|
|
311
|
-
}),
|
|
340
|
+
}), endOfList ? cloneElement(endOfList, {
|
|
341
|
+
style: Object.assign(Object.assign({}, tableObserverResult ? {
|
|
342
|
+
width: tableObserverResult.contentRect.width
|
|
343
|
+
} : {}), observerResult ? {
|
|
344
|
+
"--zen-end-of-list-viewport-width": `${observerResult.contentRect.width}px`
|
|
345
|
+
} : {})
|
|
346
|
+
}) : null, emptyList && entities.length === 0 ? emptyList : null, footer]
|
|
312
347
|
})
|
|
313
348
|
});
|
|
314
349
|
};
|
|
315
350
|
const DataGrid = forwardRef(DataGridInner);
|
|
316
351
|
DataGrid.EmptyList = EmptyList;
|
|
317
352
|
DataGrid.Footer = Footer;
|
|
353
|
+
DataGrid.EndOfList = EndOfList;
|
|
318
354
|
export { DataGrid };
|
|
319
355
|
export const TRANSLATIONS = ["Action"];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { injectString } from "../../utils/localization/translationsDictionary";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ImageNothingFound } from "../../images/imageNothingFound";
|
|
4
|
+
import { useLanguage } from "../../utils/localization/useLanguage";
|
|
5
|
+
// Shown as the last "row" of a desktop infinite-scroll table (Table's `onScrollEnd`) once all rows
|
|
6
|
+
// have been loaded, i.e. `entities.length >= total` from the `Table.Pagination` child. See
|
|
7
|
+
// `dataGrid.tsx`'s `EndOfList` slot and `table.tsx`'s `isEndOfList`.
|
|
8
|
+
//
|
|
9
|
+
// Two layers: the outer `zen-lazy-loading-end` is sized by `dataGrid.tsx` to the table's actual
|
|
10
|
+
// rendered width (can be much wider than the viewport once columns overflow), so its background/
|
|
11
|
+
// border span the full table at any scroll position. The inner `__sticky` wrapper is given an
|
|
12
|
+
// explicit, narrower width (the scrollport's own width, via `dataGrid.tsx`'s
|
|
13
|
+
// `--zen-end-of-list-viewport-width` CSS variable) and `position: sticky; inset-inline-start: 0`, so
|
|
14
|
+
// it floats and tracks the *currently visible* horizontal scroll position — `position: sticky` alone
|
|
15
|
+
// doesn't shrink a normal block box's width, so without the explicit width it would just render at
|
|
16
|
+
// the outer layer's full table width and never visibly move. With it, the icon and text stay centered
|
|
17
|
+
// on whatever part of the table you're actually looking at, rather than on the table's mathematical
|
|
18
|
+
// midpoint (which could be scrolled far out of view). See lazyLoadingEnd.less.
|
|
19
|
+
injectString("en", "No further results found", "No further results found");
|
|
20
|
+
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.");
|
|
21
|
+
export const LazyLoadingEnd = () => {
|
|
22
|
+
const {
|
|
23
|
+
translate
|
|
24
|
+
} = useLanguage();
|
|
25
|
+
return _jsx("div", {
|
|
26
|
+
className: "zen-lazy-loading-end",
|
|
27
|
+
children: _jsxs("div", {
|
|
28
|
+
className: "zen-lazy-loading-end__sticky",
|
|
29
|
+
children: [_jsx(ImageNothingFound, {
|
|
30
|
+
className: "zen-lazy-loading-end__image",
|
|
31
|
+
focusable: false
|
|
32
|
+
}), _jsxs("div", {
|
|
33
|
+
className: "zen-lazy-loading-end__content",
|
|
34
|
+
children: [_jsx("div", {
|
|
35
|
+
className: "zen-lazy-loading-end__title",
|
|
36
|
+
children: translate("No further results found")
|
|
37
|
+
}), _jsx("div", {
|
|
38
|
+
className: "zen-lazy-loading-end__description",
|
|
39
|
+
children: translate("We couldn't find any more data matching your current selection. Try broadening your search.")
|
|
40
|
+
})]
|
|
41
|
+
})]
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const TRANSLATIONS = ["No further results found", "We couldn't find any more data matching your current selection. Try broadening your search."];
|
package/esm/dataGrid/row/row.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { memo, useCallback, useId, useMemo } from "react";
|
|
3
3
|
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
4
4
|
import { DataGridCell } from "../cell/cell";
|
|
5
|
+
import { isShowMoreRow } from "../../commonHelpers/showMoreRow";
|
|
6
|
+
import { ShowMoreCell } from "../../commonHelpers/ShowMoreCell";
|
|
5
7
|
export const MIN_CELL_WIDTH = 100;
|
|
6
8
|
const getColumnWidth = (defaultWidth, minWidth) => Math.floor(Math.max(defaultWidth, minWidth !== null && minWidth !== void 0 ? minWidth : MIN_CELL_WIDTH));
|
|
7
9
|
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive, active }) => {
|
|
@@ -57,7 +59,23 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
57
59
|
return acc;
|
|
58
60
|
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, active, onClick]);
|
|
59
61
|
const cells = useMemo(() => renderCells(entity, false), [entity, renderCells]);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
+
const nestedRows = useMemo(() => {
|
|
63
|
+
const nestedEntities = expanded && entity.children ? entity.children : [];
|
|
64
|
+
return nestedEntities.map((nestedEntity, index) => {
|
|
65
|
+
const childKey = `${mainRowId}_child_${index}`;
|
|
66
|
+
const sharedProps = {
|
|
67
|
+
id: childKey,
|
|
68
|
+
role: "row",
|
|
69
|
+
"aria-level": 2,
|
|
70
|
+
"aria-posinset": index + 1,
|
|
71
|
+
"aria-setsize": nestedEntities.length
|
|
72
|
+
};
|
|
73
|
+
if (isShowMoreRow(nestedEntity)) {
|
|
74
|
+
return (_jsx("tr", Object.assign({}, sharedProps, { className: "zen-data-grid__row zen-data-grid__row--nested zen-data-grid__row--show-more", children: _jsx("td", { colSpan: columns.length, className: "zen-data-grid__row-cell zen-data-grid__row-cell--nested zen-data-grid__row-cell--show-more", children: _jsx(ShowMoreCell, { row: nestedEntity }) }) }), childKey));
|
|
75
|
+
}
|
|
76
|
+
return (_jsx("tr", Object.assign({ "data-row-id": nestedEntity.id }, sharedProps, { className: "zen-data-grid__row zen-data-grid__row--nested", children: renderCells(nestedEntity, true) }), childKey));
|
|
77
|
+
});
|
|
78
|
+
}, [entity.children, expanded, renderCells, columns.length, mainRowId]);
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_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: classNames(["zen-data-grid__row", className || "", isLastRow ? "zen-data-grid__row--last" : ""]), children: cells }, mainRowId), nestedRows] }));
|
|
62
80
|
};
|
|
63
81
|
export const DataGridRow = memo(Row);
|
|
@@ -12,6 +12,8 @@ export interface IBulkActionsProps extends IZenComponentProps {
|
|
|
12
12
|
* even when `selected` is 0 (i.e., cross-page "select all" is active).
|
|
13
13
|
*/
|
|
14
14
|
allSelected?: boolean;
|
|
15
|
+
/** Show a selection label without a count when the selected total is unknown. */
|
|
16
|
+
selectionCountUnknown?: boolean;
|
|
15
17
|
onClearSelection: () => void;
|
|
16
18
|
onSelectAll?: () => void;
|
|
17
19
|
gridType?: DeviceType;
|
|
@@ -23,7 +25,7 @@ export interface IBulkActions extends IBulkActionsProps {
|
|
|
23
25
|
ActionButton: (props: IBulkActionButton) => ReactNode;
|
|
24
26
|
}
|
|
25
27
|
export declare const BulkActions: {
|
|
26
|
-
({ selected, allSelected, className, onClearSelection, onSelectAll, gridType, children, turnOffSelectAll }: IBulkActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
({ selected, allSelected, selectionCountUnknown, className, onClearSelection, onSelectAll, gridType, children, turnOffSelectAll }: IBulkActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
ActionLink: ({ title, icon, link, disabled, type, ref }: IBulkActionLink) => import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
ActionButton: ({ title, icon, clickHandler, onClick, disabled, type, ref }: IBulkActionButton) => import("react/jsx-runtime").JSX.Element;
|
|
29
31
|
translations: string[];
|
|
@@ -13,6 +13,39 @@ import { useResizeObserver } from "../../../../commonHelpers/hooks/useResizeObse
|
|
|
13
13
|
import { Menu } from "../../../../menu/menu";
|
|
14
14
|
import { IconDotVertical } from "../../../../icons/iconDotVertical";
|
|
15
15
|
import { Button } from "../../../../button/button";
|
|
16
|
+
injectString("cs", "Selected", "Vybr\xE1no");
|
|
17
|
+
injectString("da-DK", "Selected", "Valgt");
|
|
18
|
+
injectString("de", "Selected", "Ausgew\xE4hlt");
|
|
19
|
+
injectString("en", "Selected", "Selected");
|
|
20
|
+
injectString("es", "Selected", "Seleccionado");
|
|
21
|
+
injectString("fi-FI", "Selected", "Valittu");
|
|
22
|
+
injectString("fr", "Selected", "S\xE9lectionn\xE9");
|
|
23
|
+
injectString("fr-FR", "Selected", "S\xE9lectionn\xE9");
|
|
24
|
+
injectString("hu-HU", "Selected", "Kiv\xE1lasztott");
|
|
25
|
+
injectString("id", "Selected", "Dipilih");
|
|
26
|
+
injectString("it", "Selected", "Selezionato");
|
|
27
|
+
injectString("ja", "Selected", "\u9078\u629E\u8ECA\u4E21");
|
|
28
|
+
injectString("ko-KR", "Selected", "\uC120\uD0DD\uB428");
|
|
29
|
+
injectString("ms", "Selected", "Dipilih");
|
|
30
|
+
injectString("nb-NO", "Selected", "Valgt");
|
|
31
|
+
injectString("nl", "Selected", "Geselecteerd");
|
|
32
|
+
injectString("pl", "Selected", "Wybrano");
|
|
33
|
+
injectString("pt-BR", "Selected", "Selecionado");
|
|
34
|
+
injectString("pt-PT", "Selected", "Selecionado");
|
|
35
|
+
injectString("sk-SK", "Selected", "Vybran\xE9");
|
|
36
|
+
injectString("sv", "Selected", "Valda");
|
|
37
|
+
injectString("th", "Selected", "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27");
|
|
38
|
+
injectString("tr", "Selected", "Se\xE7ildi");
|
|
39
|
+
injectString("zh-Hans", "Selected", "\u9009\u4E2D\u7684");
|
|
40
|
+
injectString("zh-TW", "Selected", "\u5DF2\u9078\u53D6");
|
|
41
|
+
injectString("ro-RO", "Selected", "Selec\u021Bie");
|
|
42
|
+
injectString("ar-001", "Selected", "\u0627\u0644\u0645\u062D\u062F\u062F");
|
|
43
|
+
injectString("lt-LT", "Selected", "Pasirinkta");
|
|
44
|
+
injectString("lv-LV", "Selected", "Atlas\u012Bts");
|
|
45
|
+
injectString("ka-GE", "Selected", "\u10D0\u10E0\u10E9\u10D4\u10E3\u10DA\u10D8");
|
|
46
|
+
injectString("el-GR", "Selected", "\u0395\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B1");
|
|
47
|
+
injectString("et-EE", "Selected", "Valitud");
|
|
48
|
+
injectString("bg-BG", "Selected", "\u0418\u0437\u0431\u0440\u0430\u043D\u0438");
|
|
16
49
|
injectString("cs", "{1} selected", "{1} vybran\xFD/vybran\xE9");
|
|
17
50
|
injectString("da-DK", "{1} selected", "{1} valgt");
|
|
18
51
|
injectString("de", "{1} selected", "{1} ausgew\xE4hlt");
|
|
@@ -181,6 +214,7 @@ injectString("bg-BG", "More", "\u041F\u043E\u0432\u0435\u0447\u0435");
|
|
|
181
214
|
export const BulkActions = ({
|
|
182
215
|
selected,
|
|
183
216
|
allSelected,
|
|
217
|
+
selectionCountUnknown,
|
|
184
218
|
className,
|
|
185
219
|
onClearSelection,
|
|
186
220
|
onSelectAll,
|
|
@@ -214,7 +248,8 @@ export const BulkActions = ({
|
|
|
214
248
|
widthDelta
|
|
215
249
|
});
|
|
216
250
|
const isMobile = gridType === DeviceType.Mobile;
|
|
217
|
-
const
|
|
251
|
+
const hasSelection = selected > 0 || allSelected || selectionCountUnknown;
|
|
252
|
+
const text = selectionCountUnknown ? translate("Selected") : translate("{1} selected").replace("{1}", allSelected ? translate("All") : selected.toFixed());
|
|
218
253
|
return _jsxs("div", {
|
|
219
254
|
className: classNames(["zen-bulk-actions", className || "", isMobile ? "zen-bulk-actions--condensed" : ""]),
|
|
220
255
|
ref: bulkActionsElement,
|
|
@@ -240,7 +275,7 @@ export const BulkActions = ({
|
|
|
240
275
|
className: "zen-bulk-actions__action-button-holder",
|
|
241
276
|
ref: buttonHolder,
|
|
242
277
|
children: [Children.map(visibleElements, element => cloneElement(element, {
|
|
243
|
-
disabled:
|
|
278
|
+
disabled: hasSelection ? element.props.disabled : true
|
|
244
279
|
})), nonFittingElements.length > 0 ? _jsx(Menu, {
|
|
245
280
|
title: translate("More"),
|
|
246
281
|
trigger: _jsx(TextIconButton, {
|
|
@@ -261,7 +296,7 @@ export const BulkActions = ({
|
|
|
261
296
|
id: props.id || "",
|
|
262
297
|
name: props.title,
|
|
263
298
|
icon: props.icon,
|
|
264
|
-
disabled: props.disabled,
|
|
299
|
+
disabled: hasSelection ? props.disabled : true,
|
|
265
300
|
onClick: clickHandler,
|
|
266
301
|
link: link
|
|
267
302
|
}, props.id);
|
|
@@ -276,4 +311,4 @@ export const BulkActions = ({
|
|
|
276
311
|
};
|
|
277
312
|
BulkActions.ActionLink = BulkActionLink;
|
|
278
313
|
BulkActions.ActionButton = BulkActionButton;
|
|
279
|
-
BulkActions.translations = ["Clear selection", "More options", "{1} selected", "Selecting..."];
|
|
314
|
+
BulkActions.translations = ["Clear selection", "More options", "{1} selected", "Selecting...", "Selected"];
|