@geotab/zenith 3.16.0 → 3.17.0-beta.1

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.
Files changed (282) hide show
  1. package/README.md +67 -1
  2. package/README.md.baseline +1 -0
  3. package/dist/absolute/absolute.js +5 -1
  4. package/dist/button/button.d.ts +2 -1
  5. package/dist/button/button.js +22 -5
  6. package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
  7. package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -1
  8. package/dist/commonHelpers/ShowMoreCell.d.ts +5 -0
  9. package/dist/commonHelpers/ShowMoreCell.js +66 -0
  10. package/dist/commonHelpers/getAriaAttributes.js +6 -9
  11. package/dist/commonHelpers/getNonAriaProps.d.ts +11 -0
  12. package/dist/commonHelpers/getNonAriaProps.js +19 -0
  13. package/dist/commonHelpers/hooks/useScroll.d.ts +1 -1
  14. package/dist/commonHelpers/hooks/useScroll.js +6 -6
  15. package/dist/commonHelpers/isAriaProp.d.ts +9 -0
  16. package/dist/commonHelpers/isAriaProp.js +13 -0
  17. package/dist/commonHelpers/showMoreRow.d.ts +28 -0
  18. package/dist/commonHelpers/showMoreRow.js +29 -0
  19. package/dist/commonHelpers/tabsKeyboard.d.ts +1 -1
  20. package/dist/commonHelpers/tabsKeyboard.js +15 -1
  21. package/dist/commonStyles/colors/colors.less +18 -0
  22. package/dist/dataFeed/dataFeedColumnsItems.js +3 -1
  23. package/dist/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
  24. package/dist/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
  25. package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
  26. package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
  27. package/dist/dataGrid/dataGrid.d.ts +5 -1
  28. package/dist/dataGrid/dataGrid.js +39 -2
  29. package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
  30. package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +54 -0
  31. package/dist/dataGrid/row/row.js +20 -2
  32. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
  33. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
  34. package/dist/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
  35. package/dist/dropdown/dropdownTrigger.d.ts +1 -1
  36. package/dist/dropdownRaw/dropdownHelper.d.ts +12 -0
  37. package/dist/dropdownRaw/dropdownHelper.js +32 -11
  38. package/dist/dropdownRaw/dropdownRaw.js +36 -8
  39. package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
  40. package/dist/dropdownRaw/dropdownSearchableTrigger.js +13 -6
  41. package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
  42. package/dist/dropdownRaw/dropdownTrigger.js +2 -2
  43. package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
  44. package/dist/dropdownRaw/stateReducer/stateReducer.js +5 -2
  45. package/dist/dropdownRaw/types.d.ts +36 -0
  46. package/dist/filterButton/filterButton.d.ts +1 -1
  47. package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
  48. package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
  49. package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
  50. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
  51. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
  52. package/dist/header/headerButton.d.ts +3 -1
  53. package/dist/header/headerButton.js +4 -2
  54. package/dist/header/headerMenu.d.ts +2 -0
  55. package/dist/header/headerMenu.js +1 -1
  56. package/dist/index.css +319 -68
  57. package/dist/index.d.ts +3 -1
  58. package/dist/index.js +9 -3
  59. package/dist/menu/components/menuButton.d.ts +3 -1
  60. package/dist/menu/components/menuButton.js +66 -47
  61. package/dist/menu/components/menuItem.js +4 -4
  62. package/dist/miniTabs/miniTabs.js +4 -2
  63. package/dist/pageHeader/pageHeaderButton.d.ts +1 -1
  64. package/dist/pageHeader/pageHeaderButton.js +4 -2
  65. package/dist/pagination/pagination.d.ts +19 -4
  66. package/dist/pagination/pagination.js +21 -1
  67. package/dist/pagination/paginationText/paginationText.d.ts +7 -1
  68. package/dist/pagination/paginationText/paginationText.js +6 -3
  69. package/dist/pillExpandable/pillContent.d.ts +3 -2
  70. package/dist/pillExpandable/pillContent.js +2 -2
  71. package/dist/pillExpandable/pillExpandable.js +20 -5
  72. package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
  73. package/dist/pillExpandable/pillExpandablePopoverContent.js +1 -1
  74. package/dist/pillExpandable/pillExpandableSimple.d.ts +3 -1
  75. package/dist/pillExpandable/pillExpandableSimple.js +19 -9
  76. package/dist/selectList/selectList.js +1 -0
  77. package/dist/selectList/selectListItem.d.ts +10 -1
  78. package/dist/selectList/selectListItem.js +12 -9
  79. package/dist/table/children/tablePagination.d.ts +1 -1
  80. package/dist/table/children/useTableChildren.d.ts +4 -2
  81. package/dist/table/children/useTableChildren.js +64 -16
  82. package/dist/table/nested/nestedData.d.ts +29 -1
  83. package/dist/table/nested/nestedData.js +45 -4
  84. package/dist/table/nested/useNestedRows.js +18 -22
  85. package/dist/table/nested/useShowMore.d.ts +41 -0
  86. package/dist/table/nested/useShowMore.js +56 -0
  87. package/dist/table/selectable/interfaces.d.ts +17 -0
  88. package/dist/table/selectable/useDragSelection.d.ts +10 -0
  89. package/dist/table/selectable/useDragSelection.js +145 -0
  90. package/dist/table/selectable/useSelectableRows.d.ts +5 -2
  91. package/dist/table/selectable/useSelectableRows.js +131 -36
  92. package/dist/table/selectable/utils/calculateSelectionState.d.ts +1 -1
  93. package/dist/table/selectable/utils/calculateSelectionState.js +43 -7
  94. package/dist/table/selectable/utils/checkRow.js +4 -2
  95. package/dist/table/selectable/utils/getCurrentPageSelection.js +9 -5
  96. package/dist/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
  97. package/dist/table/selectable/utils/getDragSelectionRows.js +28 -0
  98. package/dist/table/selectable/utils/getRangeIds.d.ts +2 -0
  99. package/dist/table/selectable/utils/getRangeIds.js +21 -0
  100. package/dist/table/selectable/utils/isRowChecked.d.ts +1 -1
  101. package/dist/table/selectable/utils/isRowChecked.js +40 -7
  102. package/dist/table/table.d.ts +1 -2
  103. package/dist/table/table.js +58 -31
  104. package/dist/tabs/tabs.d.ts +1 -0
  105. package/dist/tabs/tabs.js +50 -17
  106. package/dist/textInputRaw/textInputRaw.js +3 -2
  107. package/dist/tooltip/tooltip.d.ts +2 -0
  108. package/dist/tooltip/tooltip.js +19 -7
  109. package/dist/utils/localization/translations/ar-001.json +1 -0
  110. package/dist/utils/localization/translations/bg-BG.json +1 -0
  111. package/dist/utils/localization/translations/cs.json +1 -0
  112. package/dist/utils/localization/translations/da-DK.json +1 -0
  113. package/dist/utils/localization/translations/de.json +1 -0
  114. package/dist/utils/localization/translations/el-GR.json +1 -0
  115. package/dist/utils/localization/translations/en.json +4 -0
  116. package/dist/utils/localization/translations/es.json +1 -0
  117. package/dist/utils/localization/translations/et-EE.json +1 -0
  118. package/dist/utils/localization/translations/fi-FI.json +1 -0
  119. package/dist/utils/localization/translations/fr-FR.json +1 -0
  120. package/dist/utils/localization/translations/fr.json +1 -0
  121. package/dist/utils/localization/translations/hu-HU.json +1 -0
  122. package/dist/utils/localization/translations/id.json +1 -0
  123. package/dist/utils/localization/translations/it.json +1 -0
  124. package/dist/utils/localization/translations/ja.json +1 -0
  125. package/dist/utils/localization/translations/ka-GE.json +1 -0
  126. package/dist/utils/localization/translations/ko-KR.json +1 -0
  127. package/dist/utils/localization/translations/lt-LT.json +1 -0
  128. package/dist/utils/localization/translations/lv-LV.json +1 -0
  129. package/dist/utils/localization/translations/ms.json +1 -0
  130. package/dist/utils/localization/translations/nb-NO.json +1 -0
  131. package/dist/utils/localization/translations/nl.json +1 -0
  132. package/dist/utils/localization/translations/pl.json +1 -0
  133. package/dist/utils/localization/translations/pt-BR.json +1 -0
  134. package/dist/utils/localization/translations/pt-PT.json +1 -0
  135. package/dist/utils/localization/translations/ro-RO.json +1 -0
  136. package/dist/utils/localization/translations/sk-SK.json +1 -0
  137. package/dist/utils/localization/translations/sv.json +1 -0
  138. package/dist/utils/localization/translations/th.json +1 -0
  139. package/dist/utils/localization/translations/tr.json +1 -0
  140. package/dist/utils/localization/translations/zh-Hans.json +1 -0
  141. package/dist/utils/localization/translations/zh-TW.json +1 -0
  142. package/dist/waiting/waiting.js +97 -1
  143. package/esm/absolute/absolute.js +5 -1
  144. package/esm/button/button.d.ts +2 -1
  145. package/esm/button/button.js +22 -5
  146. package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
  147. package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -1
  148. package/esm/commonHelpers/ShowMoreCell.d.ts +5 -0
  149. package/esm/commonHelpers/ShowMoreCell.js +57 -0
  150. package/esm/commonHelpers/getAriaAttributes.js +6 -9
  151. package/esm/commonHelpers/getNonAriaProps.d.ts +11 -0
  152. package/esm/commonHelpers/getNonAriaProps.js +15 -0
  153. package/esm/commonHelpers/hooks/useScroll.d.ts +1 -1
  154. package/esm/commonHelpers/hooks/useScroll.js +6 -6
  155. package/esm/commonHelpers/isAriaProp.d.ts +9 -0
  156. package/esm/commonHelpers/isAriaProp.js +9 -0
  157. package/esm/commonHelpers/showMoreRow.d.ts +28 -0
  158. package/esm/commonHelpers/showMoreRow.js +22 -0
  159. package/esm/commonHelpers/tabsKeyboard.d.ts +1 -1
  160. package/esm/commonHelpers/tabsKeyboard.js +15 -1
  161. package/esm/commonStyles/colors/colorsConstant.js +11 -11
  162. package/esm/dataFeed/dataFeedColumnsItems.js +3 -1
  163. package/esm/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
  164. package/esm/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
  165. package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
  166. package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
  167. package/esm/dataGrid/dataGrid.d.ts +5 -1
  168. package/esm/dataGrid/dataGrid.js +38 -2
  169. package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
  170. package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +45 -0
  171. package/esm/dataGrid/row/row.js +20 -2
  172. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
  173. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
  174. package/esm/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
  175. package/esm/dropdown/dropdownTrigger.d.ts +1 -1
  176. package/esm/dropdownRaw/dropdownHelper.d.ts +12 -0
  177. package/esm/dropdownRaw/dropdownHelper.js +30 -10
  178. package/esm/dropdownRaw/dropdownRaw.js +37 -9
  179. package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
  180. package/esm/dropdownRaw/dropdownSearchableTrigger.js +13 -6
  181. package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
  182. package/esm/dropdownRaw/dropdownTrigger.js +2 -2
  183. package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
  184. package/esm/dropdownRaw/stateReducer/stateReducer.js +5 -2
  185. package/esm/dropdownRaw/types.d.ts +36 -0
  186. package/esm/filterButton/filterButton.d.ts +1 -1
  187. package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
  188. package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
  189. package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
  190. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
  191. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
  192. package/esm/header/headerButton.d.ts +3 -1
  193. package/esm/header/headerButton.js +4 -2
  194. package/esm/header/headerMenu.d.ts +2 -0
  195. package/esm/header/headerMenu.js +1 -1
  196. package/esm/index.d.ts +3 -1
  197. package/esm/index.js +3 -1
  198. package/esm/menu/components/menuButton.d.ts +3 -1
  199. package/esm/menu/components/menuButton.js +66 -47
  200. package/esm/menu/components/menuItem.js +4 -4
  201. package/esm/miniTabs/miniTabs.js +4 -2
  202. package/esm/pageHeader/pageHeaderButton.d.ts +1 -1
  203. package/esm/pageHeader/pageHeaderButton.js +4 -2
  204. package/esm/pagination/pagination.d.ts +19 -4
  205. package/esm/pagination/pagination.js +21 -1
  206. package/esm/pagination/paginationText/paginationText.d.ts +7 -1
  207. package/esm/pagination/paginationText/paginationText.js +6 -3
  208. package/esm/pillExpandable/pillContent.d.ts +3 -2
  209. package/esm/pillExpandable/pillContent.js +2 -2
  210. package/esm/pillExpandable/pillExpandable.js +20 -5
  211. package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
  212. package/esm/pillExpandable/pillExpandablePopoverContent.js +1 -1
  213. package/esm/pillExpandable/pillExpandableSimple.d.ts +3 -1
  214. package/esm/pillExpandable/pillExpandableSimple.js +20 -10
  215. package/esm/selectList/selectList.js +1 -0
  216. package/esm/selectList/selectListItem.d.ts +10 -1
  217. package/esm/selectList/selectListItem.js +12 -9
  218. package/esm/table/children/tablePagination.d.ts +1 -1
  219. package/esm/table/children/useTableChildren.d.ts +4 -2
  220. package/esm/table/children/useTableChildren.js +64 -16
  221. package/esm/table/nested/nestedData.d.ts +29 -1
  222. package/esm/table/nested/nestedData.js +44 -3
  223. package/esm/table/nested/useNestedRows.js +18 -22
  224. package/esm/table/nested/useShowMore.d.ts +41 -0
  225. package/esm/table/nested/useShowMore.js +52 -0
  226. package/esm/table/selectable/interfaces.d.ts +17 -0
  227. package/esm/table/selectable/useDragSelection.d.ts +10 -0
  228. package/esm/table/selectable/useDragSelection.js +141 -0
  229. package/esm/table/selectable/useSelectableRows.d.ts +5 -2
  230. package/esm/table/selectable/useSelectableRows.js +129 -35
  231. package/esm/table/selectable/utils/calculateSelectionState.d.ts +1 -1
  232. package/esm/table/selectable/utils/calculateSelectionState.js +43 -7
  233. package/esm/table/selectable/utils/checkRow.js +4 -2
  234. package/esm/table/selectable/utils/getCurrentPageSelection.js +9 -5
  235. package/esm/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
  236. package/esm/table/selectable/utils/getDragSelectionRows.js +24 -0
  237. package/esm/table/selectable/utils/getRangeIds.d.ts +2 -0
  238. package/esm/table/selectable/utils/getRangeIds.js +17 -0
  239. package/esm/table/selectable/utils/isRowChecked.d.ts +1 -1
  240. package/esm/table/selectable/utils/isRowChecked.js +40 -7
  241. package/esm/table/table.d.ts +1 -2
  242. package/esm/table/table.js +43 -16
  243. package/esm/tabs/tabs.d.ts +1 -0
  244. package/esm/tabs/tabs.js +50 -17
  245. package/esm/textInputRaw/textInputRaw.js +3 -2
  246. package/esm/tooltip/tooltip.d.ts +2 -0
  247. package/esm/tooltip/tooltip.js +19 -7
  248. package/esm/utils/localization/translations/ar-001.json +1 -0
  249. package/esm/utils/localization/translations/bg-BG.json +1 -0
  250. package/esm/utils/localization/translations/cs.json +1 -0
  251. package/esm/utils/localization/translations/da-DK.json +1 -0
  252. package/esm/utils/localization/translations/de.json +1 -0
  253. package/esm/utils/localization/translations/el-GR.json +1 -0
  254. package/esm/utils/localization/translations/en.json +4 -0
  255. package/esm/utils/localization/translations/es.json +1 -0
  256. package/esm/utils/localization/translations/et-EE.json +1 -0
  257. package/esm/utils/localization/translations/fi-FI.json +1 -0
  258. package/esm/utils/localization/translations/fr-FR.json +1 -0
  259. package/esm/utils/localization/translations/fr.json +1 -0
  260. package/esm/utils/localization/translations/hu-HU.json +1 -0
  261. package/esm/utils/localization/translations/id.json +1 -0
  262. package/esm/utils/localization/translations/it.json +1 -0
  263. package/esm/utils/localization/translations/ja.json +1 -0
  264. package/esm/utils/localization/translations/ka-GE.json +1 -0
  265. package/esm/utils/localization/translations/ko-KR.json +1 -0
  266. package/esm/utils/localization/translations/lt-LT.json +1 -0
  267. package/esm/utils/localization/translations/lv-LV.json +1 -0
  268. package/esm/utils/localization/translations/ms.json +1 -0
  269. package/esm/utils/localization/translations/nb-NO.json +1 -0
  270. package/esm/utils/localization/translations/nl.json +1 -0
  271. package/esm/utils/localization/translations/pl.json +1 -0
  272. package/esm/utils/localization/translations/pt-BR.json +1 -0
  273. package/esm/utils/localization/translations/pt-PT.json +1 -0
  274. package/esm/utils/localization/translations/ro-RO.json +1 -0
  275. package/esm/utils/localization/translations/sk-SK.json +1 -0
  276. package/esm/utils/localization/translations/sv.json +1 -0
  277. package/esm/utils/localization/translations/th.json +1 -0
  278. package/esm/utils/localization/translations/tr.json +1 -0
  279. package/esm/utils/localization/translations/zh-Hans.json +1 -0
  280. package/esm/utils/localization/translations/zh-TW.json +1 -0
  281. package/esm/waiting/waiting.js +98 -2
  282. package/package.json +15 -3
@@ -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
- }), emptyList && entities.length === 0 ? emptyList : null, footer]
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,3 @@
1
+ import "./lazyLoadingEnd.less";
2
+ export declare const LazyLoadingEnd: () => import("react/jsx-runtime").JSX.Element;
3
+ export declare const TRANSLATIONS: string[];
@@ -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."];
@@ -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 nestedCells = (0, react_1.useMemo)(() => (expanded && entity.children ? entity.children : []).map(nestedEntity => renderCells(nestedEntity, true)), [entity.children, expanded, renderCells]);
64
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("tr", { "data-row-id": id, id: mainRowId, role: "row", "aria-level": isTreeGrid ? 1 : undefined, "aria-posinset": isTreeGrid ? ariaPosinset : undefined, "aria-setsize": isTreeGrid ? ariaSetsize : undefined, "aria-expanded": isTreeGrid ? expanded : undefined, className: (0, classNames_1.classNames)(["zen-data-grid__row", className || "", isLastRow ? "zen-data-grid__row--last" : ""]), children: cells }, mainRowId), nestedCells.map((nestedRow, index) => ((0, jsx_runtime_1.jsx)("tr", { id: `${mainRowId}_child_${index}`, role: "row", "aria-level": 2, "aria-posinset": index + 1, "aria-setsize": nestedCells.length, className: "zen-data-grid__row zen-data-grid__row--nested", children: nestedRow }, `${mainRowId}_child_${index}`)))] }));
65
+ 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);
@@ -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[];
@@ -8,6 +8,39 @@ Object.defineProperty(exports, "__esModule", {
8
8
  });
9
9
  exports.BulkActions = void 0;
10
10
  const jsx_runtime_1 = require("react/jsx-runtime");
11
+ injectString("cs", "Selected", "Vybr\xE1no");
12
+ injectString("da-DK", "Selected", "Valgt");
13
+ injectString("de", "Selected", "Ausgew\xE4hlt");
14
+ injectString("en", "Selected", "Selected");
15
+ injectString("es", "Selected", "Seleccionado");
16
+ injectString("fi-FI", "Selected", "Valittu");
17
+ injectString("fr", "Selected", "S\xE9lectionn\xE9");
18
+ injectString("fr-FR", "Selected", "S\xE9lectionn\xE9");
19
+ injectString("hu-HU", "Selected", "Kiv\xE1lasztott");
20
+ injectString("id", "Selected", "Dipilih");
21
+ injectString("it", "Selected", "Selezionato");
22
+ injectString("ja", "Selected", "\u9078\u629E\u8ECA\u4E21");
23
+ injectString("ko-KR", "Selected", "\uC120\uD0DD\uB428");
24
+ injectString("ms", "Selected", "Dipilih");
25
+ injectString("nb-NO", "Selected", "Valgt");
26
+ injectString("nl", "Selected", "Geselecteerd");
27
+ injectString("pl", "Selected", "Wybrano");
28
+ injectString("pt-BR", "Selected", "Selecionado");
29
+ injectString("pt-PT", "Selected", "Selecionado");
30
+ injectString("sk-SK", "Selected", "Vybran\xE9");
31
+ injectString("sv", "Selected", "Valda");
32
+ injectString("th", "Selected", "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27");
33
+ injectString("tr", "Selected", "Se\xE7ildi");
34
+ injectString("zh-Hans", "Selected", "\u9009\u4E2D\u7684");
35
+ injectString("zh-TW", "Selected", "\u5DF2\u9078\u53D6");
36
+ injectString("ro-RO", "Selected", "Selec\u021Bie");
37
+ injectString("ar-001", "Selected", "\u0627\u0644\u0645\u062D\u062F\u062F");
38
+ injectString("lt-LT", "Selected", "Pasirinkta");
39
+ injectString("lv-LV", "Selected", "Atlas\u012Bts");
40
+ injectString("ka-GE", "Selected", "\u10D0\u10E0\u10E9\u10D4\u10E3\u10DA\u10D8");
41
+ injectString("el-GR", "Selected", "\u0395\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B1");
42
+ injectString("et-EE", "Selected", "Valitud");
43
+ injectString("bg-BG", "Selected", "\u0418\u0437\u0431\u0440\u0430\u043D\u0438");
11
44
  injectString("cs", "{1} selected", "{1} vybran\xFD/vybran\xE9");
12
45
  injectString("da-DK", "{1} selected", "{1} valgt");
13
46
  injectString("de", "{1} selected", "{1} ausgew\xE4hlt");
@@ -189,6 +222,7 @@ const button_1 = require("../../../../button/button");
189
222
  const BulkActions = ({
190
223
  selected,
191
224
  allSelected,
225
+ selectionCountUnknown,
192
226
  className,
193
227
  onClearSelection,
194
228
  onSelectAll,
@@ -222,7 +256,8 @@ const BulkActions = ({
222
256
  widthDelta
223
257
  });
224
258
  const isMobile = gridType === deviceType_1.DeviceType.Mobile;
225
- const text = translate("{1} selected").replace("{1}", allSelected ? translate("All") : selected.toFixed());
259
+ const hasSelection = selected > 0 || allSelected || selectionCountUnknown;
260
+ const text = selectionCountUnknown ? translate("Selected") : translate("{1} selected").replace("{1}", allSelected ? translate("All") : selected.toFixed());
226
261
  return (0, jsx_runtime_1.jsxs)("div", {
227
262
  className: (0, classNames_1.classNames)(["zen-bulk-actions", className || "", isMobile ? "zen-bulk-actions--condensed" : ""]),
228
263
  ref: bulkActionsElement,
@@ -248,7 +283,7 @@ const BulkActions = ({
248
283
  className: "zen-bulk-actions__action-button-holder",
249
284
  ref: buttonHolder,
250
285
  children: [react_1.Children.map(visibleElements, element => (0, react_1.cloneElement)(element, {
251
- disabled: selected > 0 || allSelected ? element.props.disabled : true
286
+ disabled: hasSelection ? element.props.disabled : true
252
287
  })), nonFittingElements.length > 0 ? (0, jsx_runtime_1.jsx)(menu_1.Menu, {
253
288
  title: translate("More"),
254
289
  trigger: (0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, {
@@ -269,7 +304,7 @@ const BulkActions = ({
269
304
  id: props.id || "",
270
305
  name: props.title,
271
306
  icon: props.icon,
272
- disabled: props.disabled,
307
+ disabled: hasSelection ? props.disabled : true,
273
308
  onClick: clickHandler,
274
309
  link: link
275
310
  }, props.id);
@@ -285,4 +320,4 @@ const BulkActions = ({
285
320
  exports.BulkActions = BulkActions;
286
321
  exports.BulkActions.ActionLink = bulkActionLink_1.BulkActionLink;
287
322
  exports.BulkActions.ActionButton = bulkActionButton_1.BulkActionButton;
288
- exports.BulkActions.translations = ["Clear selection", "More options", "{1} selected", "Selecting..."];
323
+ exports.BulkActions.translations = ["Clear selection", "More options", "{1} selected", "Selecting...", "Selected"];
@@ -15,6 +15,8 @@ const selectList_1 = require("../../selectList/selectList");
15
15
  const checkboxState_1 = require("../../checkbox/checkboxState");
16
16
  const selectableRowsColumnWrapper_1 = require("./columns/selectableRowsColumnWrapper");
17
17
  const useLanguage_1 = require("../../utils/localization/useLanguage");
18
+ const useDragSelection_1 = require("../../table/selectable/useDragSelection");
19
+ const getDragSelectionRows_1 = require("../../table/selectable/utils/getDragSelectionRows");
18
20
  injectString("cs", "Select all", "Vybrat v\u0161e");
19
21
  injectString("da-DK", "Select all", "V\xE6lg alle");
20
22
  injectString("de", "Select all", "Alle ausw\xE4hlen");
@@ -209,13 +211,29 @@ const withSelectableRows = DataGridComponent => {
209
211
  const selectMenuRef = (0, react_1.useRef)(null);
210
212
  const selections = (0, exports.getSelections)(selection);
211
213
  const allSelected = selection !== undefined && selection.allSelected;
212
- const wrapper = (0, react_1.useMemo)(() => selectMode ? new selectableRowsColumnWrapper_1.SelectableRowsColumnWrapper(selections, {
213
- createTitle: options.createTitle,
214
- headerTitle: options.headerTitle,
215
- condition: options.condition || options.checkboxVisible,
216
- disabled: options.checkboxDisabled ? options.checkboxDisabled : entity => options.selectionLimit !== undefined ? !selections.has(entity.id) && selections.size >= options.selectionLimit : false,
217
- header: options.selectionLimit === undefined && options.checkboxDisabled === undefined && options.checkboxVisible === undefined && options.condition === undefined || options.checkboxInHeader === true && !options.selectionLimit
218
- }, selectMenuRef) : null, [selectMode, selections, options.createTitle, options.headerTitle, options.condition, options.checkboxVisible, options.checkboxDisabled, options.selectionLimit, options.checkboxInHeader]);
214
+ const isCheckboxVisible = (0, react_1.useCallback)(entity => {
215
+ const condition = options.condition || options.checkboxVisible;
216
+ return condition ? condition(entity) : true;
217
+ }, [options.condition, options.checkboxVisible]);
218
+ const isCheckboxDisabled = (0, react_1.useCallback)(entity => {
219
+ if (options.checkboxDisabled) {
220
+ return options.checkboxDisabled(entity);
221
+ }
222
+ if (options.selectionLimit !== undefined) {
223
+ return !selections.has(entity.id) && selections.size >= options.selectionLimit;
224
+ }
225
+ return false;
226
+ }, [options, selections]);
227
+ const wrapper = (0, react_1.useMemo)(() => {
228
+ var _a;
229
+ return selectMode ? new selectableRowsColumnWrapper_1.SelectableRowsColumnWrapper(selections, {
230
+ createTitle: options.createTitle,
231
+ headerTitle: options.headerTitle,
232
+ condition: options.condition || options.checkboxVisible,
233
+ disabled: (_a = options.checkboxDisabled) !== null && _a !== void 0 ? _a : isCheckboxDisabled,
234
+ header: options.selectionLimit === undefined && options.checkboxDisabled === undefined && options.checkboxVisible === undefined && options.condition === undefined || options.checkboxInHeader === true && !options.selectionLimit
235
+ }, selectMenuRef) : null;
236
+ }, [selectMode, selections, options.createTitle, options.headerTitle, options.condition, options.checkboxVisible, options.checkboxDisabled, options.selectionLimit, options.checkboxInHeader, isCheckboxDisabled]);
219
237
  if (wrapper) {
220
238
  wrapper.selectionState = calculateSelectionState(entities, selections, allSelected, options);
221
239
  }
@@ -223,9 +241,10 @@ const withSelectableRows = DataGridComponent => {
223
241
  const newSelections = new Set(selections);
224
242
  entities.forEach(entity => {
225
243
  if (checked) {
226
- const isVisible = options.condition ? options.condition(entity) : options.checkboxVisible ? options.checkboxVisible(entity) : true;
244
+ // Intentionally not isCheckboxDisabled: "select all" ignores the selection
245
+ // limit, it only skips rows the consumer explicitly disabled.
227
246
  const isEnabled = !options.checkboxDisabled || !options.checkboxDisabled(entity);
228
- if (isVisible && isEnabled) {
247
+ if (isCheckboxVisible(entity) && isEnabled) {
229
248
  newSelections.add(entity.id);
230
249
  }
231
250
  return;
@@ -238,8 +257,49 @@ const withSelectableRows = DataGridComponent => {
238
257
  allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
239
258
  turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
240
259
  });
241
- }, [selections, entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
260
+ }, [selections, entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll, isCheckboxVisible]);
261
+ const {
262
+ rows: dragRows,
263
+ entityById
264
+ } = (0, react_1.useMemo)(() => (0, getDragSelectionRows_1.getDragSelectionRows)(entities), [entities]);
265
+ const isRowSelectable = (0, react_1.useCallback)(row => {
266
+ const entity = entityById.get(row.id);
267
+ return !!entity && isCheckboxVisible(entity) && !isCheckboxDisabled(entity);
268
+ }, [entityById, isCheckboxVisible, isCheckboxDisabled]);
269
+ // "Select all" is held as a flag rather than a list of ids, so materialise the page before
270
+ // a range starts editing it — otherwise the range would be applied to an empty selection.
271
+ const getBaseSelection = (0, react_1.useCallback)(() => allSelected ? new Set(entities.map(entity => entity.id)) : new Set(selections), [allSelected, entities, selections]);
272
+ const onBatchSelect = (0, react_1.useCallback)((rangeIds, select, base) => {
273
+ const result = new Set(base);
274
+ const limit = options.selectionLimit;
275
+ for (const id of rangeIds) {
276
+ if (select) {
277
+ if (limit !== undefined && result.size >= limit) {
278
+ break;
279
+ }
280
+ result.add(id);
281
+ } else {
282
+ result.delete(id);
283
+ }
284
+ }
285
+ const newState = calculateSelectionState(entities, result, false, options);
286
+ onSelect({
287
+ selected: [...result],
288
+ allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
289
+ turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
290
+ });
291
+ }, [entities, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
292
+ const {
293
+ onCheckboxMouseDown,
294
+ suppressNextChangeRef
295
+ } = (0, useDragSelection_1.useDragSelection)(dragRows, props.ref, onBatchSelect, getBaseSelection, isRowSelectable, selectMode);
242
296
  const onSelectListener = (0, react_1.useCallback)(([id, checked]) => {
297
+ // A drag or shift-click has already emitted the whole range; swallow the click that
298
+ // ends it so the row it landed on is not toggled back.
299
+ if (suppressNextChangeRef.current) {
300
+ suppressNextChangeRef.current = false;
301
+ return;
302
+ }
243
303
  if (allSelected) {
244
304
  const newSelection = new Set(entities.map(entity => entity.id));
245
305
  newSelection.delete(id);
@@ -261,7 +321,7 @@ const withSelectableRows = DataGridComponent => {
261
321
  allSelected: newState === checkboxColumnWrapper_1.SelectionState.All,
262
322
  turnOffSelectAll: selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll
263
323
  });
264
- }, [entities, selections, allSelected, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll]);
324
+ }, [entities, selections, allSelected, options, onSelect, selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll, suppressNextChangeRef]);
265
325
  const onSelectAll = (0, react_1.useCallback)(([checked]) => {
266
326
  if (checked && ((selection === null || selection === void 0 ? void 0 : selection.turnOffSelectAll) || options.turnOffSelectAll)) {
267
327
  selectAll(true);
@@ -310,10 +370,11 @@ const withSelectableRows = DataGridComponent => {
310
370
  wrapper.attach("change", onSelectListener);
311
371
  wrapper.attach("change-all", onSelectAll);
312
372
  wrapper.attach("toggle", onTriggerClick);
373
+ wrapper.attach("mousedown", ([id, checked, e]) => onCheckboxMouseDown(id, checked, e));
313
374
  return () => {
314
375
  wrapper.detach();
315
376
  };
316
- }, [wrapper, onSelectListener, onSelectAll, onTriggerClick]);
377
+ }, [wrapper, onSelectListener, onSelectAll, onTriggerClick, onCheckboxMouseDown]);
317
378
  const listColumns = (0, react_1.useMemo)(() => {
318
379
  const newColumns = columns.map(c => Object.assign({}, c));
319
380
  // Remove CheckboxColumnWrappers from wrappers list
@@ -1 +1 @@
1
- export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, autocomplete, buttonType, isError, popupId, handleFocusOnPopup, allyPattern, dataAnalyticsId, ...otherProps }: import("../dropdownRaw/dropdownTrigger").IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, autocomplete, buttonType, isError, popupId, handleFocusOnPopup, allyPattern, dataAnalyticsId, isFormItem, ...otherProps }: import("../dropdownRaw/dropdownTrigger").IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
@@ -12,15 +12,27 @@ export declare const isAllItemsHasOneParent: (listData: IDropdownRawItem[], chil
12
12
  export declare function prepareComboOptionsForList(actionListData: Set<string>, translate: (s: string) => string, options: IDropdownRawItem[], getSelectedFn: () => string[], getSelectedChildFn: (optionId: any) => string[], isFlatList: boolean, getTitle?: (itemId: string) => string, isAllSelected?: boolean): ICheckboxListWithActionOption[];
13
13
  export declare const createOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[], isAllSelected?: boolean) => ICheckboxListWithActionOption[];
14
14
  export declare const sortDropdownItemArray: (arr: IDropdownRawItem[], sortFn?: (a: IDropdownRawItem, b: IDropdownRawItem) => number) => IDropdownRawItem[];
15
+ /**
16
+ * Floats selected items to the top of the list while preserving the relative order within each
17
+ * group (selected and unselected). When `selectedIds` is empty the original array is returned
18
+ * unchanged (no allocation). Uses a single-pass partition to avoid traversing `items` twice.
19
+ */
20
+ export declare const applySortSelectedToTop: (items: IDropdownRawItem[], selectedIds: string[]) => IDropdownRawItem[];
15
21
  export declare const createSingleListOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[]) => {
22
+ destructive: boolean | undefined;
23
+ divider?: boolean | undefined;
16
24
  id: string;
17
25
  children: string;
26
+ title: string;
18
27
  disabled: boolean | undefined;
19
28
  multiLevel: boolean | undefined;
20
29
  }[];
21
30
  export declare const createListDataOptions: (stateObj: IDropdownState, translate: (s: string) => string, listItem: IDropdownRawItem[], isMultiselect: boolean, isAllSelected?: boolean) => ICheckboxListWithActionOption[] | {
31
+ destructive: boolean | undefined;
32
+ divider?: boolean | undefined;
22
33
  id: string;
23
34
  children: string;
35
+ title: string;
24
36
  disabled: boolean | undefined;
25
37
  multiLevel: boolean | undefined;
26
38
  }[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAllyTriggerProps = exports.getSelectedCount = exports.getStringFromAllSelected = exports.getStringFromSelected = exports.checkIsDataProblem = exports.prepareSelectedIdsToItems = exports.compareObjectsArrays = exports.compareStringsArrays = exports.createListDataOptions = exports.createSingleListOptions = exports.sortDropdownItemArray = exports.createOptions = exports.isAllItemsHasOneParent = exports.getDataForChange = exports.isEveryItemSelected = exports.isAllChildrenSelected = exports.getListDataWithDisabled = exports.getGroupsTreeItem = void 0;
3
+ exports.getAllyTriggerProps = exports.getSelectedCount = exports.getStringFromAllSelected = exports.getStringFromSelected = exports.checkIsDataProblem = exports.prepareSelectedIdsToItems = exports.compareObjectsArrays = exports.compareStringsArrays = exports.createListDataOptions = exports.createSingleListOptions = exports.applySortSelectedToTop = exports.sortDropdownItemArray = exports.createOptions = exports.isAllItemsHasOneParent = exports.getDataForChange = exports.isEveryItemSelected = exports.isAllChildrenSelected = exports.getListDataWithDisabled = exports.getGroupsTreeItem = void 0;
4
4
  exports.prepareComboOptionsForList = prepareComboOptionsForList;
5
5
  const groupsHelper_1 = require("../groupsFilterRaw/groupsHelper");
6
6
  const stateReducerHelper_1 = require("./stateReducer/stateReducerHelper");
@@ -55,7 +55,7 @@ function prepareComboOptionsForList(actionListData, translate, options, getSelec
55
55
  const preparedOptions = options && options.length
56
56
  ? options.map(option => {
57
57
  const selectedChild = getSelectedChildFn(option.id);
58
- return Object.assign({ label: (0, groupsHelper_1.getGroupDescription)(option, translate), property: option.id, checked: isAllSelected ? true : selectedIds.has(option.id), isWithAction: actionListData.has(option.id), partialChecked: isAllSelected ? false : selectedChild.length > 0, countSelectedChild: 0, blocked: isFlatList ? option.disabled || false : false }, (getTitle ? { title: getTitle(option.id) } : {}));
58
+ return Object.assign(Object.assign({ label: (0, groupsHelper_1.getGroupDescription)(option, translate), property: option.id, checked: isAllSelected ? true : selectedIds.has(option.id), isWithAction: actionListData.has(option.id), partialChecked: isAllSelected ? false : selectedChild.length > 0, countSelectedChild: 0, blocked: isFlatList ? option.disabled || false : false }, (getTitle ? { title: getTitle(option.id) } : {})), (option.divider ? { divider: true } : {}));
59
59
  })
60
60
  : [];
61
61
  return preparedOptions;
@@ -93,16 +93,33 @@ const sortDropdownItemArray = (arr, sortFn) => {
93
93
  return arr;
94
94
  };
95
95
  exports.sortDropdownItemArray = sortDropdownItemArray;
96
+ /**
97
+ * Floats selected items to the top of the list while preserving the relative order within each
98
+ * group (selected and unselected). When `selectedIds` is empty the original array is returned
99
+ * unchanged (no allocation). Uses a single-pass partition to avoid traversing `items` twice.
100
+ */
101
+ const applySortSelectedToTop = (items, selectedIds) => {
102
+ if (!selectedIds.length)
103
+ return items;
104
+ const selectedSet = new Set(selectedIds);
105
+ const selected = [];
106
+ const unselected = [];
107
+ for (const item of items) {
108
+ (selectedSet.has(item.id) ? selected : unselected).push(item);
109
+ }
110
+ return [...selected, ...unselected];
111
+ };
112
+ exports.applySortSelectedToTop = applySortSelectedToTop;
96
113
  const createSingleListOptions = (stateObj, translate, listItem) => {
97
114
  const preparedOptions = listItem && listItem.length
98
- ? listItem.map(option => ({
99
- id: option.id,
100
- children: (0, groupsHelper_1.getGroupDescription)(stateObj.groupsMap[option.id] || option, translate),
101
- disabled: option.disabled,
102
- multiLevel: Object.keys(stateObj.groupsMap).length === 0
103
- ? false
104
- : option.children && option.children.length > 0 && stateObj.groupsMap[option.id] !== undefined
105
- }))
115
+ ? listItem.map(option => {
116
+ const description = (0, groupsHelper_1.getGroupDescription)(stateObj.groupsMap[option.id] || option, translate);
117
+ return Object.assign(Object.assign({ id: option.id, children: description,
118
+ // Long names are truncated by `zen-ellipsis`, so expose the full text on hover
119
+ title: description, disabled: option.disabled, multiLevel: Object.keys(stateObj.groupsMap).length === 0
120
+ ? false
121
+ : option.children && option.children.length > 0 && stateObj.groupsMap[option.id] !== undefined }, (option.divider ? { divider: true } : {})), { destructive: option.destructive });
122
+ })
106
123
  : [];
107
124
  return preparedOptions;
108
125
  };
@@ -124,7 +141,11 @@ const compareObjectsArrays = (arr1, arr2) => arr1.length === arr2.length &&
124
141
  const sameDisabled = el.disabled === el2.disabled ||
125
142
  (el.disabled === undefined && el2.disabled === false) ||
126
143
  (el2.disabled === undefined && el.disabled === false);
127
- return sameId && sameDisabled;
144
+ const sameDivider = el.divider === el2.divider || (el.divider === undefined && el2.divider === false) || (el2.divider === undefined && el.divider === false);
145
+ const sameDestructive = el.destructive === el2.destructive ||
146
+ (el.destructive === undefined && el2.destructive === false) ||
147
+ (el2.destructive === undefined && el.destructive === false);
148
+ return sameId && sameDisabled && sameDivider && sameDestructive;
128
149
  });
129
150
  exports.compareObjectsArrays = compareObjectsArrays;
130
151
  const prepareSelectedIdsToItems = (selectedIds, groupsMap, groupsMapSelected) => {