@geotab/zenith 3.16.0-beta.4 → 3.16.0-nightly.20260924.a8d9c48
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 +39 -1
- package/README.md.baseline +1 -0
- package/dist/absolute/absolute.js +5 -1
- 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/hooks/useScroll.d.ts +1 -1
- package/dist/commonHelpers/hooks/useScroll.js +6 -6
- package/dist/commonHelpers/showMoreRow.d.ts +28 -0
- package/dist/commonHelpers/showMoreRow.js +29 -0
- 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/withSelectableRows.js +73 -12
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownHelper.d.ts +10 -0
- package/dist/dropdownRaw/dropdownHelper.js +29 -11
- package/dist/dropdownRaw/dropdownRaw.js +36 -8
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +4 -3
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +2 -2
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/dist/dropdownRaw/types.d.ts +30 -0
- package/dist/filterButton/filterButton.d.ts +1 -1
- package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/dist/header/headerButton.d.ts +3 -1
- package/dist/header/headerButton.js +1 -1
- package/dist/header/headerMenu.d.ts +2 -0
- package/dist/header/headerMenu.js +1 -1
- package/dist/index.css +226 -30
- 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 +12 -11
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/pagination/pagination.d.ts +19 -4
- package/dist/pagination/pagination.js +21 -1
- package/dist/pagination/paginationText/paginationText.d.ts +7 -1
- package/dist/pagination/paginationText/paginationText.js +6 -3
- package/dist/pillExpandable/pillExpandable.js +1 -1
- package/dist/selectList/selectList.js +1 -0
- package/dist/selectList/selectListItem.d.ts +4 -1
- package/dist/selectList/selectListItem.js +4 -3
- package/dist/table/children/tablePagination.d.ts +1 -1
- package/dist/table/children/useTableChildren.d.ts +2 -1
- package/dist/table/children/useTableChildren.js +36 -12
- package/dist/table/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 +22 -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 +2 -2
- package/dist/table/selectable/useSelectableRows.js +113 -26
- package/dist/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/dist/table/selectable/utils/calculateSelectionState.js +45 -6
- package/dist/table/selectable/utils/checkRow.js +4 -2
- package/dist/table/selectable/utils/getCurrentPageSelection.js +2 -1
- 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.js +28 -8
- 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/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/hooks/useScroll.d.ts +1 -1
- package/esm/commonHelpers/hooks/useScroll.js +6 -6
- package/esm/commonHelpers/showMoreRow.d.ts +28 -0
- package/esm/commonHelpers/showMoreRow.js +22 -0
- 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/withSelectableRows.js +73 -12
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownHelper.d.ts +10 -0
- package/esm/dropdownRaw/dropdownHelper.js +27 -10
- package/esm/dropdownRaw/dropdownRaw.js +37 -9
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +4 -3
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +2 -2
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/esm/dropdownRaw/types.d.ts +30 -0
- package/esm/filterButton/filterButton.d.ts +1 -1
- package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/esm/header/headerButton.d.ts +3 -1
- package/esm/header/headerButton.js +1 -1
- package/esm/header/headerMenu.d.ts +2 -0
- package/esm/header/headerMenu.js +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/menu/components/menuButton.d.ts +3 -1
- package/esm/menu/components/menuButton.js +12 -11
- package/esm/menu/components/menuItem.js +4 -4
- package/esm/pagination/pagination.d.ts +19 -4
- package/esm/pagination/pagination.js +21 -1
- package/esm/pagination/paginationText/paginationText.d.ts +7 -1
- package/esm/pagination/paginationText/paginationText.js +6 -3
- package/esm/pillExpandable/pillExpandable.js +1 -1
- package/esm/selectList/selectList.js +1 -0
- package/esm/selectList/selectListItem.d.ts +4 -1
- package/esm/selectList/selectListItem.js +4 -3
- package/esm/table/children/tablePagination.d.ts +1 -1
- package/esm/table/children/useTableChildren.d.ts +2 -1
- package/esm/table/children/useTableChildren.js +36 -12
- package/esm/table/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 +22 -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 +2 -2
- package/esm/table/selectable/useSelectableRows.js +113 -26
- package/esm/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/esm/table/selectable/utils/calculateSelectionState.js +45 -6
- package/esm/table/selectable/utils/checkRow.js +4 -2
- package/esm/table/selectable/utils/getCurrentPageSelection.js +2 -1
- 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.js +29 -9
- 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 +4 -1
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ Now components are ready for usage.
|
|
|
45
45
|
|
|
46
46
|
Zenith library provides components defined in Zenith Design System. It includes very basic blocks like colors, icons, font presets, atom components like buttons, checkboxes etc and high order components - header, table, filters bar etc. List of existing components can be found in [Storybook](https://developers.geotab.com/zenith-storybook/index.html).
|
|
47
47
|
|
|
48
|
+
## Translations
|
|
49
|
+
|
|
50
|
+
Zenith has English and 32 non-English locale dictionaries, including Arabic (`ar-001`) with right-to-left support. The [translation process guide](./docs/TRANSLATIONS.md) covers adding strings, Tech Content and Localization handoffs, spreadsheet sync, build-time injection, and validation. Read it before adding or changing a user-facing string, reviewing English copy, or running the sync. Locale availability does not imply that every string has a reviewed translation.
|
|
51
|
+
|
|
48
52
|
## Change log
|
|
49
53
|
|
|
50
54
|
### 3.16.0
|
|
@@ -164,7 +168,7 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
164
168
|
|
|
165
169
|
### 3.10.0
|
|
166
170
|
|
|
167
|
-
- Add `
|
|
171
|
+
- Add `vertical` props to `ListItem`
|
|
168
172
|
- Add `data-analytics-id` prop to `Tab`, `TabItem`, and `Bookmark`
|
|
169
173
|
- `Nav` component: support show/hide separator between Core and Apps sections
|
|
170
174
|
- `Nav` empty state support
|
|
@@ -764,6 +768,40 @@ Upgrade today to take advantage of modern JavaScript module support and improved
|
|
|
764
768
|
- Improve sizing of the title in Header
|
|
765
769
|
- Add the property `triggerAriaLabel` to `Dropdown`
|
|
766
770
|
|
|
771
|
+
### 1.14.0
|
|
772
|
+
|
|
773
|
+
- Create the Layout
|
|
774
|
+
- Update strings
|
|
775
|
+
- Add aria-label to Stepper, Range and FilterButton
|
|
776
|
+
- Improve accessibility of icons
|
|
777
|
+
|
|
778
|
+
### 1.13.1
|
|
779
|
+
|
|
780
|
+
- Improve behavior of the DateRange selection
|
|
781
|
+
- Improve imports in Zenith
|
|
782
|
+
- Fix date position in PillExpandable
|
|
783
|
+
- Update package description, add license
|
|
784
|
+
- Add option to open links in new tab in PillExpandable
|
|
785
|
+
- Fix visual styles of MiniTabs
|
|
786
|
+
- Allow passing fragment as a child of the Header
|
|
787
|
+
- Stepper max value not working as expected
|
|
788
|
+
- Allow text formatting in the description of the PillExpandable
|
|
789
|
+
- Prevent rerendering in useMobile
|
|
790
|
+
|
|
791
|
+
### 1.13.0
|
|
792
|
+
|
|
793
|
+
- New component Table
|
|
794
|
+
- Clean search input in Dropdown on close popup
|
|
795
|
+
- Fix tabbing through all rows in a table
|
|
796
|
+
- Rename "All filters" to "Filters" in FiltersBar
|
|
797
|
+
- Improve tooltip accessibility
|
|
798
|
+
- Add ecosystem icons
|
|
799
|
+
- Increase focus area in search input
|
|
800
|
+
- Fix issue with loosing seconds when changing date or time in calendar
|
|
801
|
+
- The new component Skeleton for loading animation
|
|
802
|
+
- Fix the Select component selection issue
|
|
803
|
+
- Update npm dependencies
|
|
804
|
+
|
|
767
805
|
## Feedback
|
|
768
806
|
|
|
769
807
|
For any questions or feedback please email zenith@geotab.com.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ac687d695edcc0c6ffdc6c27e69c5729e7b02d180623c4f81049d72111f97d0d
|
|
@@ -20,6 +20,7 @@ const getScrollableParent_1 = require("../utils/getScrollableParent");
|
|
|
20
20
|
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
21
21
|
const zen_1 = require("../utils/zen");
|
|
22
22
|
const useDirection_1 = require("../utils/localization/useDirection");
|
|
23
|
+
const CLOSE_ON_SCROLL_EVENTS = ["wheel", "touchmove"];
|
|
23
24
|
const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
24
25
|
const popupRef = (0, react_1.useRef)(null);
|
|
25
26
|
const prevScroll = (0, react_1.useRef)(0);
|
|
@@ -67,7 +68,10 @@ const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, trigger
|
|
|
67
68
|
}, [onOpenChange]);
|
|
68
69
|
(0, useResize_1.useResize)(calculatePosition, isOpen);
|
|
69
70
|
(0, useScroll_1.useScroll)(calculatePosition, isOpen && !!recalculateOnScroll, parent);
|
|
70
|
-
|
|
71
|
+
// Only "wheel"/"touchmove" are genuine user scroll gestures. The plain "scroll" event also fires for
|
|
72
|
+
// browser scroll-anchoring adjustments (e.g. a layout shift above the viewport pushing content down),
|
|
73
|
+
// which would otherwise close the popup the instant it opens.
|
|
74
|
+
(0, useScroll_1.useScroll)(handleCloseOnScroll, isOpen && !!closeOnScroll, parent, CLOSE_ON_SCROLL_EVENTS);
|
|
71
75
|
(0, react_1.useLayoutEffect)(calculatePosition, [isOpen, children, recalculateTrigger, calculatePosition]);
|
|
72
76
|
const returnFocusToTrigger = (0, react_1.useCallback)(() => {
|
|
73
77
|
if (!triggerRef.current) {
|
|
@@ -11,6 +11,8 @@ export interface ICheckboxListWithActionOption {
|
|
|
11
11
|
isWithAction: boolean;
|
|
12
12
|
countSelectedChild?: number;
|
|
13
13
|
color?: IColor;
|
|
14
|
+
/** When true, renders a 1px separator line below this item. */
|
|
15
|
+
divider?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface IChangeCheckbox {
|
|
16
18
|
id: string;
|
|
@@ -443,7 +443,7 @@ const CheckboxListWithAction = ({
|
|
|
443
443
|
const labelForRender = selectSearchTerm(opt.label);
|
|
444
444
|
const labelElement = renderLabel(opt, labelForRender, titleForRender, ind);
|
|
445
445
|
return (0, jsx_runtime_1.jsxs)("li", {
|
|
446
|
-
className: (0, classNames_1.classNames)(["zen-checkbox-list-with-action__action-item", opt.isWithAction ? "zen-checkbox-list-with-action__action-item--action" : ""]),
|
|
446
|
+
className: (0, classNames_1.classNames)(["zen-checkbox-list-with-action__action-item", opt.isWithAction ? "zen-checkbox-list-with-action__action-item--action" : "", opt.divider && ind < optionsArr.length - 1 ? "zen-checkbox-list-with-action__action-item--divider" : ""]),
|
|
447
447
|
"data-item": opt.property,
|
|
448
448
|
children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, {
|
|
449
449
|
id: `${checkboxId}${opt.property}`,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
injectString
|
|
5
|
+
} = require("../utils/localization/translationsDictionary");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ShowMoreCell = void 0;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
const useLanguage_1 = require("../utils/localization/useLanguage");
|
|
12
|
+
injectString("cs", "+{0} more", "+{0} dal\u0161\xED");
|
|
13
|
+
injectString("da-DK", "+{0} more", "+{0} mere");
|
|
14
|
+
injectString("de", "+{0} more", "+{0} weitere");
|
|
15
|
+
injectString("en", "+{0} more", "+{0} more");
|
|
16
|
+
injectString("es", "+{0} more", "+{0} m\xE1s");
|
|
17
|
+
injectString("fi-FI", "+{0} more", "+{0} lis\xE4\xE4");
|
|
18
|
+
injectString("fr", "+{0} more", "+{0} autres");
|
|
19
|
+
injectString("fr-FR", "+{0} more", "+{0} autres");
|
|
20
|
+
injectString("hu-HU", "+{0} more", "+{0} t\xF6bb");
|
|
21
|
+
injectString("id", "+{0} more", "+{0} lebih");
|
|
22
|
+
injectString("it", "+{0} more", "+{0} in pi\xF9");
|
|
23
|
+
injectString("ja", "+{0} more", "\u3055\u3089\u306B {0} \u500B");
|
|
24
|
+
injectString("ko-KR", "+{0} more", "+{0} \uB354\uBCF4\uAE30");
|
|
25
|
+
injectString("ms", "+{0} more", "+{0} lagi");
|
|
26
|
+
injectString("nb-NO", "+{0} more", "+{0} mer");
|
|
27
|
+
injectString("nl", "+{0} more", "+{0} meer");
|
|
28
|
+
injectString("pl", "+{0} more", "Jeszcze {0}");
|
|
29
|
+
injectString("pt-BR", "+{0} more", "+{0} mais");
|
|
30
|
+
injectString("pt-PT", "+{0} more", "+{0} mais");
|
|
31
|
+
injectString("sk-SK", "+{0} more", "+{0} viac");
|
|
32
|
+
injectString("sv", "+{0} more", "+{0} mer");
|
|
33
|
+
injectString("th", "+{0} more", "+{0} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21");
|
|
34
|
+
injectString("tr", "+{0} more", "+{0} daha");
|
|
35
|
+
injectString("zh-Hans", "+{0} more", "+{0}\u66F4\u591A");
|
|
36
|
+
injectString("zh-TW", "+{0} more", "\u9084\u6709 +{0} \u500B");
|
|
37
|
+
injectString("ro-RO", "+{0} more", "\xCEnc\u0103 {0}");
|
|
38
|
+
injectString("ar-001", "+{0} more", "+{0} \u0623\u062E\u0631\u0649");
|
|
39
|
+
injectString("lt-LT", "+{0} more", "+{0} daugiau");
|
|
40
|
+
injectString("lv-LV", "+{0} more", "+{0} v\u0113l");
|
|
41
|
+
injectString("ka-GE", "+{0} more", "+{0} \u10DB\u10D4\u10E2\u10D8");
|
|
42
|
+
injectString("el-GR", "+{0} more", "+{0} \u03B1\u03BA\u03CC\u03BC\u03B1");
|
|
43
|
+
injectString("et-EE", "+{0} more", "+{0} veel");
|
|
44
|
+
injectString("bg-BG", "+{0} more", "+ \u043E\u0449\u0435 {0}");
|
|
45
|
+
const ShowMoreCell = ({
|
|
46
|
+
row
|
|
47
|
+
}) => {
|
|
48
|
+
const {
|
|
49
|
+
translate
|
|
50
|
+
} = (0, useLanguage_1.useLanguage)();
|
|
51
|
+
const content = row.label ? row.label(row.remaining) : translate("+{0} more").replace("{0}", String(row.remaining));
|
|
52
|
+
if (row.href) {
|
|
53
|
+
return (0, jsx_runtime_1.jsx)("a", {
|
|
54
|
+
className: "zen-show-more__link",
|
|
55
|
+
href: row.href,
|
|
56
|
+
children: content
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return (0, jsx_runtime_1.jsx)("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
className: "zen-show-more__link",
|
|
62
|
+
onClick: row.onActivate,
|
|
63
|
+
children: content
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
exports.ShowMoreCell = ShowMoreCell;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useScroll: (callback: () => void, active: boolean, triggerRef?: Element | null) => void;
|
|
1
|
+
export declare const useScroll: (callback: () => void, active: boolean, triggerRef?: Element | null, events?: readonly string[]) => void;
|
|
@@ -3,20 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useScroll = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const zen_1 = require("../../utils/zen");
|
|
6
|
-
const
|
|
6
|
+
const DEFAULT_EVENTS = ["scroll", "wheel"];
|
|
7
|
+
const useScroll = (callback, active, triggerRef, events) => {
|
|
7
8
|
var _a;
|
|
8
9
|
if (triggerRef === void 0) { triggerRef = (_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.body; }
|
|
10
|
+
if (events === void 0) { events = DEFAULT_EVENTS; }
|
|
9
11
|
(0, react_1.useEffect)(() => {
|
|
10
12
|
if (!active || triggerRef === null) {
|
|
11
13
|
return;
|
|
12
14
|
}
|
|
13
|
-
triggerRef.addEventListener(
|
|
14
|
-
triggerRef.addEventListener("wheel", callback);
|
|
15
|
+
events.forEach(event => triggerRef.addEventListener(event, callback));
|
|
15
16
|
// eslint-disable-next-line consistent-return
|
|
16
17
|
return () => {
|
|
17
|
-
triggerRef.removeEventListener(
|
|
18
|
-
triggerRef.removeEventListener("wheel", callback);
|
|
18
|
+
events.forEach(event => triggerRef.removeEventListener(event, callback));
|
|
19
19
|
};
|
|
20
|
-
}, [callback, active, triggerRef]);
|
|
20
|
+
}, [callback, active, triggerRef, events]);
|
|
21
21
|
};
|
|
22
22
|
exports.useScroll = useScroll;
|
|
@@ -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,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChildrenForSelection = exports.withFullChildren = exports.createShowMoreRow = exports.isShowMoreRow = exports.SHOW_MORE_KIND = void 0;
|
|
4
|
+
exports.SHOW_MORE_KIND = "showMore";
|
|
5
|
+
const isShowMoreRow = (entity) =>
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
|
|
7
|
+
entity.__zenMoreRowsType === exports.SHOW_MORE_KIND;
|
|
8
|
+
exports.isShowMoreRow = isShowMoreRow;
|
|
9
|
+
const createShowMoreRow = (params) => {
|
|
10
|
+
const base = {
|
|
11
|
+
id: `__zen-show-more__${params.parentId}`,
|
|
12
|
+
__zenMoreRowsType: exports.SHOW_MORE_KIND,
|
|
13
|
+
remaining: params.remaining,
|
|
14
|
+
parentId: params.parentId,
|
|
15
|
+
label: params.label
|
|
16
|
+
};
|
|
17
|
+
if ("href" in params && params.href !== undefined) {
|
|
18
|
+
return Object.assign(Object.assign({}, base), { href: params.href });
|
|
19
|
+
}
|
|
20
|
+
return Object.assign(Object.assign({}, base), { onActivate: params.onActivate });
|
|
21
|
+
};
|
|
22
|
+
exports.createShowMoreRow = createShowMoreRow;
|
|
23
|
+
// `children` is sliced down for rendering, so the un-capped list is stashed here to keep
|
|
24
|
+
// selection operating on every real child.
|
|
25
|
+
const FULL_CHILDREN_KEY = "__zenFullChildren";
|
|
26
|
+
const withFullChildren = (entity, fullChildren) => (Object.assign(Object.assign({}, entity), { [FULL_CHILDREN_KEY]: fullChildren }));
|
|
27
|
+
exports.withFullChildren = withFullChildren;
|
|
28
|
+
const getChildrenForSelection = (entity) => { var _a; return (_a = entity[FULL_CHILDREN_KEY]) !== null && _a !== void 0 ? _a : entity.children; };
|
|
29
|
+
exports.getChildrenForSelection = getChildrenForSelection;
|
|
@@ -82,6 +82,24 @@
|
|
|
82
82
|
--data--categorical-yellow: #f5bd60;
|
|
83
83
|
--data--categorical-red: #e56a6a;
|
|
84
84
|
--data--categorical-grey: #8a94a2;
|
|
85
|
+
|
|
86
|
+
// data visualization - sequential
|
|
87
|
+
--data--sequential-1: #8cb6f9;
|
|
88
|
+
--data--sequential-2: #6ca1f8;
|
|
89
|
+
--data--sequential-3: #428aff;
|
|
90
|
+
--data--sequential-4: #2e76ea;
|
|
91
|
+
--data--sequential-5: #1862d5;
|
|
92
|
+
--data--sequential-6: #0d51b7;
|
|
93
|
+
--data--sequential-7: #084197;
|
|
94
|
+
|
|
95
|
+
// data visualization - diverging
|
|
96
|
+
--data--diverging-1: #782c0e;
|
|
97
|
+
--data--diverging-2: #cb591f;
|
|
98
|
+
--data--diverging-3: #f98c41;
|
|
99
|
+
--data--diverging-4: #f5bd60;
|
|
100
|
+
--data--diverging-5: #428aff;
|
|
101
|
+
--data--diverging-6: #1862d5;
|
|
102
|
+
--data--diverging-7: #084197;
|
|
85
103
|
}
|
|
86
104
|
|
|
87
105
|
.zen-dark {
|
|
@@ -9,6 +9,8 @@ const dataFeedCell_1 = require("./dataFeedCell/dataFeedCell");
|
|
|
9
9
|
const actionsMenu_1 = require("../table/actions/actionsMenu");
|
|
10
10
|
const useVisibleColumns_1 = require("./hooks/useVisibleColumns");
|
|
11
11
|
const menu_1 = require("../menu/menu");
|
|
12
|
+
const showMoreRow_1 = require("../commonHelpers/showMoreRow");
|
|
13
|
+
const ShowMoreCell_1 = require("../commonHelpers/ShowMoreCell");
|
|
12
14
|
const getIconFromColumnComponent = (column, entity, isNested) => {
|
|
13
15
|
const renderIcon = "renderIcon" in column.columnComponent ? column.columnComponent.renderIcon : undefined;
|
|
14
16
|
if (renderIcon) {
|
|
@@ -129,7 +131,7 @@ const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQt
|
|
|
129
131
|
entity,
|
|
130
132
|
onClick
|
|
131
133
|
]);
|
|
132
|
-
const nestedCells = (0, react_1.useMemo)(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
|
|
134
|
+
const nestedCells = (0, react_1.useMemo)(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => (0, showMoreRow_1.isShowMoreRow)(nestedEntity) ? (0, jsx_runtime_1.jsx)(ShowMoreCell_1.ShowMoreCell, { row: nestedEntity }, nestedEntity.id) : renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
|
|
133
135
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, nestedCells), [entity, nestedCells, renderCells]);
|
|
134
136
|
return cells;
|
|
135
137
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, PropsWithChildren, ReactElement } from "react";
|
|
1
|
+
import { FC, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactElement } from "react";
|
|
2
2
|
import { IZenIdComponentProps } from "../../../commonHelpers/zenComponent";
|
|
3
3
|
import "./checkboxColumn.less";
|
|
4
4
|
interface ICheckboxCellProps extends IZenIdComponentProps {
|
|
@@ -8,6 +8,7 @@ interface ICheckboxCellProps extends IZenIdComponentProps {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
children?: ReactElement<typeof CheckboxCell.Content>;
|
|
10
10
|
onChange?: (id: string, checked: boolean) => void;
|
|
11
|
+
onMouseDown?: (id: string, checked: boolean, e: ReactMouseEvent) => void;
|
|
11
12
|
}
|
|
12
13
|
interface ICheckboxCell extends FC<ICheckboxCellProps> {
|
|
13
14
|
Content: FC<PropsWithChildren>;
|
|
@@ -4,7 +4,7 @@ exports.CheckboxCell = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const checkbox_1 = require("../../../checkbox/checkbox");
|
|
6
6
|
const classNames_1 = require("../../../commonHelpers/classNames/classNames");
|
|
7
|
-
const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, children }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-checkbox-column", className || ""]), children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "zen-checkbox-column__checkbox", checked: checked, indeterminate: indeterminate, disabled: disabled, title: label, onChange: e => onChange && onChange(id, e.target.checked), wrapped: true }), children] }));
|
|
7
|
+
const CheckboxCell = ({ id, checked, indeterminate, label, disabled, className, onChange, onMouseDown, children }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-checkbox-column", className || ""]), onMouseDown: onMouseDown ? e => onMouseDown(id, checked, e) : undefined, children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "zen-checkbox-column__checkbox", checked: checked, indeterminate: indeterminate, disabled: disabled, title: label, onChange: e => onChange && onChange(id, e.target.checked), wrapped: true }), children] }));
|
|
8
8
|
exports.CheckboxCell = CheckboxCell;
|
|
9
9
|
exports.CheckboxCell.Content = function content({ children }) {
|
|
10
10
|
return (0, jsx_runtime_1.jsx)("div", { className: "zen-checkbox-column__content", children: children });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, RefObject } from "react";
|
|
1
|
+
import { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from "react";
|
|
2
2
|
import { IListColumnWrapper } from "../../listColumn";
|
|
3
3
|
import "./checkboxColumn.less";
|
|
4
4
|
import { SimpleEventHandler } from "../../../commonHelpers/simpleEventHandler";
|
|
@@ -17,7 +17,8 @@ export interface ICheckboxColumnWrapper<T extends object> extends IListColumnWra
|
|
|
17
17
|
attach(event: "toggle", handler: (state: [Event, HTMLButtonElement]) => void): this;
|
|
18
18
|
attach(event: "change", handler: (state: [string, boolean]) => void): this;
|
|
19
19
|
attach(event: "change-all", handler: (state: [boolean]) => void): this;
|
|
20
|
-
|
|
20
|
+
attach(event: "mousedown", handler: (state: [string, boolean, ReactMouseEvent]) => void): this;
|
|
21
|
+
detach(event: "change" | "toggle" | "change-all" | "mousedown", handler?: (state: unknown) => void): this;
|
|
21
22
|
}
|
|
22
23
|
export declare enum SelectionState {
|
|
23
24
|
All = 0,
|
|
@@ -34,6 +35,7 @@ export declare class CheckboxColumnWrapper<T extends IEntityWithId> extends Simp
|
|
|
34
35
|
private state;
|
|
35
36
|
private readonly actionsClickHandler;
|
|
36
37
|
private readonly changeHandler;
|
|
38
|
+
private readonly mouseDownHandler;
|
|
37
39
|
private readonly changeHandlerAll;
|
|
38
40
|
constructor(selections: Set<string>, options: ICheckboxColumnOptions<T>, menuTriggerRef: RefObject<HTMLButtonElement | null>);
|
|
39
41
|
get selectionState(): SelectionState;
|
|
@@ -67,6 +67,15 @@ class CheckboxColumnWrapper extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
67
67
|
this.fire("change", [id, checked]);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
// Only fired for enabled checkboxes, so a disabled row can never become a drag anchor.
|
|
71
|
+
Object.defineProperty(this, "mouseDownHandler", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: (id, checked, e) => {
|
|
76
|
+
this.fire("mousedown", [id, checked, e]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
70
79
|
Object.defineProperty(this, "changeHandlerAll", {
|
|
71
80
|
enumerable: true,
|
|
72
81
|
configurable: true,
|
|
@@ -92,7 +101,7 @@ class CheckboxColumnWrapper extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
92
101
|
}
|
|
93
102
|
const allowed = this.condition(entity);
|
|
94
103
|
const isDisable = this.disabled ? this.disabled(entity) : this.state === SelectionState.All;
|
|
95
|
-
const cell = ((0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "" : "zen-checkbox-column--no-checkbox", checked: this.state === SelectionState.All || this.selections.has(entity.id), indeterminate: false, disabled: isDisable, label: this.options.createTitle(entity), onChange: this.changeHandler, children: (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell.Content, { children: value }) }));
|
|
104
|
+
const cell = ((0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "" : "zen-checkbox-column--no-checkbox", checked: this.state === SelectionState.All || this.selections.has(entity.id), indeterminate: false, disabled: isDisable, label: this.options.createTitle(entity), onChange: this.changeHandler, onMouseDown: isDisable ? undefined : this.mouseDownHandler, children: (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell.Content, { children: value }) }));
|
|
96
105
|
return cell;
|
|
97
106
|
}
|
|
98
107
|
renderHeader(title) {
|
|
@@ -11,7 +11,7 @@ export interface IDataGrid<T, N = T> extends Omit<IZenComponentProps, "children"
|
|
|
11
11
|
description?: string;
|
|
12
12
|
emptyCellTitle?: string;
|
|
13
13
|
resetScroll?: boolean;
|
|
14
|
-
children?: ReturnType<typeof EmptyList> | ReturnType<typeof Footer>;
|
|
14
|
+
children?: ReturnType<typeof EmptyList> | ReturnType<typeof Footer> | ReturnType<typeof EndOfList>;
|
|
15
15
|
rowClassName?: TRowClassName<T>;
|
|
16
16
|
expandedRows?: string[];
|
|
17
17
|
onExpandedChange?: (id: string, isExpanded: boolean) => void;
|
|
@@ -37,10 +37,14 @@ export declare const VERTICAL_SCROLL_MODIFIER = "zen-data-grid--vertical-scroll"
|
|
|
37
37
|
export declare const MIN_CELL_WIDTH = 100;
|
|
38
38
|
export declare const EmptyList: FC<PropsWithChildren>;
|
|
39
39
|
export declare const Footer: FC<PropsWithChildren>;
|
|
40
|
+
export declare const EndOfList: FC<PropsWithChildren<{
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
}>>;
|
|
40
43
|
declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange, active, onClick, onScrollEnd, isLoading }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
41
44
|
export interface IDataGridStaticProps {
|
|
42
45
|
EmptyList: typeof EmptyList;
|
|
43
46
|
Footer: typeof Footer;
|
|
47
|
+
EndOfList: typeof EndOfList;
|
|
44
48
|
}
|
|
45
49
|
declare const DataGrid: (<T extends IRowEntity<N>, N extends IEntityWithId = T>(props: IDataGrid<T, N> & {
|
|
46
50
|
ref?: React.ForwardedRef<HTMLElement>;
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.TRANSLATIONS = exports.DataGrid = exports.Footer = exports.EmptyList = exports.MIN_CELL_WIDTH = exports.VERTICAL_SCROLL_MODIFIER = exports.HORIZONTAL_SCROLL_MODIFIER = exports.DRAGGING_MODIFIER = exports.NOT_INTERACTIVE_MODIFIER = void 0;
|
|
9
|
+
exports.TRANSLATIONS = exports.DataGrid = exports.EndOfList = exports.Footer = exports.EmptyList = exports.MIN_CELL_WIDTH = exports.VERTICAL_SCROLL_MODIFIER = exports.HORIZONTAL_SCROLL_MODIFIER = exports.DRAGGING_MODIFIER = exports.NOT_INTERACTIVE_MODIFIER = void 0;
|
|
10
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
11
|
injectString("cs", "Action", "Akce");
|
|
12
12
|
injectString("da-DK", "Action", "Handling");
|
|
@@ -78,6 +78,20 @@ const Footer = ({
|
|
|
78
78
|
children: children
|
|
79
79
|
});
|
|
80
80
|
exports.Footer = Footer;
|
|
81
|
+
// Rendered right after the last data row (desktop infinite scroll only) to indicate there is no
|
|
82
|
+
// more data to load. See Table's `isEndOfList` (table.tsx). `style` is set by DataGridInner to the
|
|
83
|
+
// table's actual rendered width (see `tableRef`/`tableObserverResult` below), so the row — and the
|
|
84
|
+
// centered content inside it (see `lazyLoadingEnd.less`) — spans the full table width even when
|
|
85
|
+
// columns overflow the visible viewport, rather than just the currently-scrolled-into-view portion.
|
|
86
|
+
const EndOfList = ({
|
|
87
|
+
children,
|
|
88
|
+
style
|
|
89
|
+
}) => (0, jsx_runtime_1.jsx)("div", {
|
|
90
|
+
className: "zen-data-grid__end-of-list",
|
|
91
|
+
style: style,
|
|
92
|
+
children: children
|
|
93
|
+
});
|
|
94
|
+
exports.EndOfList = EndOfList;
|
|
81
95
|
const FIRST_RENDERED_ROWS = 100;
|
|
82
96
|
const SCROLL_END_THRESHOLD = 100;
|
|
83
97
|
const DataGridInner = ({
|
|
@@ -107,6 +121,12 @@ const DataGridInner = ({
|
|
|
107
121
|
const [verticalScrollApplied, setVerticalScrollApplied] = (0, react_1.useState)(false);
|
|
108
122
|
// Refs
|
|
109
123
|
const gridRef = (0, react_1.useRef)(null);
|
|
124
|
+
// Separate from `gridRef` (which is the outer *scrolling container*, used above for available
|
|
125
|
+
// column-allocation space). This tracks the `<table>` element itself, whose rendered width
|
|
126
|
+
// already reflects `max(sum of column widths, container width)` per its `min-width: 100%` CSS —
|
|
127
|
+
// i.e. it's wider than the container when columns overflow. Used to size the end-of-list row to
|
|
128
|
+
// the table's true full width instead of just the visible/scrolled-into-view portion.
|
|
129
|
+
const tableRef = (0, react_1.useRef)(null);
|
|
110
130
|
const bodyRef = (0, react_1.useRef)(null);
|
|
111
131
|
const lazyRenderTimerRef = (0, react_1.useRef)(0);
|
|
112
132
|
const scrollEndFiredRef = (0, react_1.useRef)(false);
|
|
@@ -114,6 +134,7 @@ const DataGridInner = ({
|
|
|
114
134
|
const rowsMap = (0, react_1.useMemo)(() => new Map(entities.map(entity => [entity.id, entity])), [entities]);
|
|
115
135
|
const emptyList = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.EmptyList), [children]);
|
|
116
136
|
const footer = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.Footer), [children]);
|
|
137
|
+
const endOfList = (0, react_1.useMemo)(() => react_1.Children.toArray(children).find(child => child.type === exports.EndOfList), [children]);
|
|
117
138
|
(0, react_1.useImperativeHandle)(ref, () => gridRef.current, []);
|
|
118
139
|
const getVisibleRows = () => {
|
|
119
140
|
if (!gridRef.current || !bodyRef.current) {
|
|
@@ -171,6 +192,14 @@ const DataGridInner = ({
|
|
|
171
192
|
} = (0, useResizeObserver_1.useResizeObserver)({
|
|
172
193
|
target: gridRef.current
|
|
173
194
|
});
|
|
195
|
+
// Only observe the table's width when an `EndOfList` child is actually present — avoids a
|
|
196
|
+
// second ResizeObserver instance (and its resulting re-renders) on the vast majority of
|
|
197
|
+
// `DataGrid` usages that never render this row.
|
|
198
|
+
const {
|
|
199
|
+
result: tableObserverResult
|
|
200
|
+
} = (0, useResizeObserver_1.useResizeObserver)({
|
|
201
|
+
target: endOfList ? tableRef.current : null
|
|
202
|
+
});
|
|
174
203
|
const allocatedSpace = listOfDefaultWidthColumns.reduce((acc, width, index) => acc + (width === undefined ? 0 : getColumnWidth(width, listOfMinWidthColumns[index])), 0);
|
|
175
204
|
const unallocatedSpace = observerResult && observerResult.contentRect.width - allocatedSpace || 0;
|
|
176
205
|
const flexibleColumnsQty = listOfDefaultWidthColumns.filter(width => width === undefined).length;
|
|
@@ -308,6 +337,7 @@ const DataGridInner = ({
|
|
|
308
337
|
"aria-label": description,
|
|
309
338
|
"aria-busy": !!isLoading,
|
|
310
339
|
role: isTreeGrid ? "treegrid" : undefined,
|
|
340
|
+
ref: tableRef,
|
|
311
341
|
children: [(0, jsx_runtime_1.jsx)("thead", {
|
|
312
342
|
className: "zen-data-grid__header",
|
|
313
343
|
children: (0, jsx_runtime_1.jsx)("tr", {
|
|
@@ -318,7 +348,13 @@ const DataGridInner = ({
|
|
|
318
348
|
ref: bodyRef,
|
|
319
349
|
children: body
|
|
320
350
|
})]
|
|
321
|
-
}),
|
|
351
|
+
}), endOfList ? (0, react_1.cloneElement)(endOfList, {
|
|
352
|
+
style: Object.assign(Object.assign({}, tableObserverResult ? {
|
|
353
|
+
width: tableObserverResult.contentRect.width
|
|
354
|
+
} : {}), observerResult ? {
|
|
355
|
+
"--zen-end-of-list-viewport-width": `${observerResult.contentRect.width}px`
|
|
356
|
+
} : {})
|
|
357
|
+
}) : null, emptyList && entities.length === 0 ? emptyList : null, footer]
|
|
322
358
|
})
|
|
323
359
|
});
|
|
324
360
|
};
|
|
@@ -326,4 +362,5 @@ const DataGrid = (0, react_1.forwardRef)(DataGridInner);
|
|
|
326
362
|
exports.DataGrid = DataGrid;
|
|
327
363
|
DataGrid.EmptyList = exports.EmptyList;
|
|
328
364
|
DataGrid.Footer = exports.Footer;
|
|
365
|
+
DataGrid.EndOfList = exports.EndOfList;
|
|
329
366
|
exports.TRANSLATIONS = ["Action"];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
injectString
|
|
5
|
+
} = require("../../utils/localization/translationsDictionary");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.TRANSLATIONS = exports.LazyLoadingEnd = void 0;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
const imageNothingFound_1 = require("../../images/imageNothingFound");
|
|
12
|
+
const useLanguage_1 = require("../../utils/localization/useLanguage");
|
|
13
|
+
injectString("en", "No further results found", "No further results found");
|
|
14
|
+
injectString("en", "We couldn't find any more data matching your current selection. Try broadening your search.", "We couldn't find any more data matching your current selection. Try broadening your search.");
|
|
15
|
+
// Shown as the last "row" of a desktop infinite-scroll table (Table's `onScrollEnd`) once all rows
|
|
16
|
+
// have been loaded, i.e. `entities.length >= total` from the `Table.Pagination` child. See
|
|
17
|
+
// `dataGrid.tsx`'s `EndOfList` slot and `table.tsx`'s `isEndOfList`.
|
|
18
|
+
//
|
|
19
|
+
// Two layers: the outer `zen-lazy-loading-end` is sized by `dataGrid.tsx` to the table's actual
|
|
20
|
+
// rendered width (can be much wider than the viewport once columns overflow), so its background/
|
|
21
|
+
// border span the full table at any scroll position. The inner `__sticky` wrapper is given an
|
|
22
|
+
// explicit, narrower width (the scrollport's own width, via `dataGrid.tsx`'s
|
|
23
|
+
// `--zen-end-of-list-viewport-width` CSS variable) and `position: sticky; inset-inline-start: 0`, so
|
|
24
|
+
// it floats and tracks the *currently visible* horizontal scroll position — `position: sticky` alone
|
|
25
|
+
// doesn't shrink a normal block box's width, so without the explicit width it would just render at
|
|
26
|
+
// the outer layer's full table width and never visibly move. With it, the icon and text stay centered
|
|
27
|
+
// on whatever part of the table you're actually looking at, rather than on the table's mathematical
|
|
28
|
+
// midpoint (which could be scrolled far out of view). See lazyLoadingEnd.less.
|
|
29
|
+
const LazyLoadingEnd = () => {
|
|
30
|
+
const {
|
|
31
|
+
translate
|
|
32
|
+
} = (0, useLanguage_1.useLanguage)();
|
|
33
|
+
return (0, jsx_runtime_1.jsx)("div", {
|
|
34
|
+
className: "zen-lazy-loading-end",
|
|
35
|
+
children: (0, jsx_runtime_1.jsxs)("div", {
|
|
36
|
+
className: "zen-lazy-loading-end__sticky",
|
|
37
|
+
children: [(0, jsx_runtime_1.jsx)(imageNothingFound_1.ImageNothingFound, {
|
|
38
|
+
className: "zen-lazy-loading-end__image",
|
|
39
|
+
focusable: false
|
|
40
|
+
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
41
|
+
className: "zen-lazy-loading-end__content",
|
|
42
|
+
children: [(0, jsx_runtime_1.jsx)("div", {
|
|
43
|
+
className: "zen-lazy-loading-end__title",
|
|
44
|
+
children: translate("No further results found")
|
|
45
|
+
}), (0, jsx_runtime_1.jsx)("div", {
|
|
46
|
+
className: "zen-lazy-loading-end__description",
|
|
47
|
+
children: translate("We couldn't find any more data matching your current selection. Try broadening your search.")
|
|
48
|
+
})]
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.LazyLoadingEnd = LazyLoadingEnd;
|
|
54
|
+
exports.TRANSLATIONS = ["No further results found", "We couldn't find any more data matching your current selection. Try broadening your search."];
|
package/dist/dataGrid/row/row.js
CHANGED
|
@@ -5,6 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
7
7
|
const cell_1 = require("../cell/cell");
|
|
8
|
+
const showMoreRow_1 = require("../../commonHelpers/showMoreRow");
|
|
9
|
+
const ShowMoreCell_1 = require("../../commonHelpers/ShowMoreCell");
|
|
8
10
|
exports.MIN_CELL_WIDTH = 100;
|
|
9
11
|
const getColumnWidth = (defaultWidth, minWidth) => Math.floor(Math.max(defaultWidth, minWidth !== null && minWidth !== void 0 ? minWidth : exports.MIN_CELL_WIDTH));
|
|
10
12
|
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive, active }) => {
|
|
@@ -60,7 +62,23 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
60
62
|
return acc;
|
|
61
63
|
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, active, onClick]);
|
|
62
64
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, false), [entity, renderCells]);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
+
const nestedRows = (0, react_1.useMemo)(() => {
|
|
66
|
+
const nestedEntities = expanded && entity.children ? entity.children : [];
|
|
67
|
+
return nestedEntities.map((nestedEntity, index) => {
|
|
68
|
+
const childKey = `${mainRowId}_child_${index}`;
|
|
69
|
+
const sharedProps = {
|
|
70
|
+
id: childKey,
|
|
71
|
+
role: "row",
|
|
72
|
+
"aria-level": 2,
|
|
73
|
+
"aria-posinset": index + 1,
|
|
74
|
+
"aria-setsize": nestedEntities.length
|
|
75
|
+
};
|
|
76
|
+
if ((0, showMoreRow_1.isShowMoreRow)(nestedEntity)) {
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)("tr", Object.assign({}, sharedProps, { className: "zen-data-grid__row zen-data-grid__row--nested zen-data-grid__row--show-more", children: (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(ShowMoreCell_1.ShowMoreCell, { row: nestedEntity }) }) }), childKey));
|
|
78
|
+
}
|
|
79
|
+
return ((0, jsx_runtime_1.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));
|
|
80
|
+
});
|
|
81
|
+
}, [entity.children, expanded, renderCells, columns.length, mainRowId]);
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("tr", { "data-row-id": id, id: mainRowId, role: "row", "aria-level": isTreeGrid ? 1 : undefined, "aria-posinset": isTreeGrid ? ariaPosinset : undefined, "aria-setsize": isTreeGrid ? ariaSetsize : undefined, "aria-expanded": isTreeGrid ? expanded : undefined, className: (0, classNames_1.classNames)(["zen-data-grid__row", className || "", isLastRow ? "zen-data-grid__row--last" : ""]), children: cells }, mainRowId), nestedRows] }));
|
|
65
83
|
};
|
|
66
84
|
exports.DataGridRow = (0, react_1.memo)(Row);
|