@lowdefy/blocks-table 0.0.0-experimental-20260929110023

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 (590) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +12 -0
  3. package/dist/blocks/Table/Table.js +25 -0
  4. package/dist/blocks/Table/Table.lazy.js +33 -0
  5. package/dist/blocks/Table/TableFallback.js +35 -0
  6. package/dist/blocks/Table/e2e.js +47 -0
  7. package/dist/blocks/Table/gallery.yaml +836 -0
  8. package/dist/blocks/Table/meta.js +964 -0
  9. package/dist/blocks/Table/tests/Table.e2e.yaml +434 -0
  10. package/dist/blocks/Table/tests/TableFeatures.e2e.yaml +291 -0
  11. package/dist/blocks/Table/tests/TableLinkTarget.e2e.yaml +25 -0
  12. package/dist/blocks/Table/tests/TableParity.e2e.yaml +101 -0
  13. package/dist/blocks/Table/tests/bulk.e2e.yaml +271 -0
  14. package/dist/blocks/Table/tests/deals.yaml +30 -0
  15. package/dist/blocks/Table/tests/deals_columns.yaml +37 -0
  16. package/dist/blocks/Table/tests/editing.e2e.yaml +501 -0
  17. package/dist/blocks/Table/tests/expandable.e2e.yaml +87 -0
  18. package/dist/blocks/Table/tests/filtering.e2e.yaml +251 -0
  19. package/dist/blocks/Table/tests/grouping.e2e.yaml +272 -0
  20. package/dist/blocks/Table/tests/grouping_deals.yaml +24 -0
  21. package/dist/blocks/Table/tests/grouping_deals_columns.yaml +32 -0
  22. package/dist/blocks/Table/tests/headerMenu.e2e.yaml +134 -0
  23. package/dist/blocks/Table/tests/parity_properties.yaml +144 -0
  24. package/dist/blocks/Table/tests/people.yaml +39 -0
  25. package/dist/blocks/Table/tests/people_columns.yaml +22 -0
  26. package/dist/blocks/Table/tests/polish.e2e.yaml +372 -0
  27. package/dist/blocks/Table/tests/server-mongodb.e2e.yaml +169 -0
  28. package/dist/blocks/Table/tests/server.e2e.yaml +267 -0
  29. package/dist/blocks/Table/tests/toolbar.e2e.yaml +140 -0
  30. package/dist/blocks/Table/tests/tree.e2e.yaml +245 -0
  31. package/dist/blocks/Table/tests/views.e2e.yaml +235 -0
  32. package/dist/blocks/TableInput/TableInput.js +24 -0
  33. package/dist/blocks/TableInput/TableInput.lazy.js +17 -0
  34. package/dist/blocks/TableInput/TableInputRoot.js +65 -0
  35. package/dist/blocks/TableInput/e2e.js +16 -0
  36. package/dist/blocks/TableInput/gallery.yaml +153 -0
  37. package/dist/blocks/TableInput/meta.js +93 -0
  38. package/dist/blocks/TableInput/tests/TableInput.e2e.yaml +272 -0
  39. package/dist/blocks.js +16 -0
  40. package/dist/core/Body.js +112 -0
  41. package/dist/core/Cell.js +86 -0
  42. package/dist/core/Chevron.js +32 -0
  43. package/dist/core/EmptyState.js +32 -0
  44. package/dist/core/Grid.js +219 -0
  45. package/dist/core/GroupHeaderRow.js +81 -0
  46. package/dist/core/HeaderCell.js +58 -0
  47. package/dist/core/HeaderRow.js +76 -0
  48. package/dist/core/HeaderTitle.js +49 -0
  49. package/dist/core/LazyCell.js +71 -0
  50. package/dist/core/LoadingRows.js +38 -0
  51. package/dist/core/RenderProbeContext.js +19 -0
  52. package/dist/core/Row.js +98 -0
  53. package/dist/core/SkeletonRow.js +42 -0
  54. package/dist/core/SummaryRow.js +86 -0
  55. package/dist/core/TableRoot.js +195 -0
  56. package/dist/core/aggregateShortLabels.js +25 -0
  57. package/dist/core/applyLayoutVars.js +22 -0
  58. package/dist/core/buildGroupSegments.js +36 -0
  59. package/dist/core/collectBodyOverlays.js +20 -0
  60. package/dist/core/collectCellLeads.js +21 -0
  61. package/dist/core/collectClaimedViewKeys.js +26 -0
  62. package/dist/core/collectGridHandlers.js +29 -0
  63. package/dist/core/collectHeaderParts.js +20 -0
  64. package/dist/core/collectRowRenderers.js +21 -0
  65. package/dist/core/collectSliceDefinitions.js +29 -0
  66. package/dist/core/computeLayout.js +133 -0
  67. package/dist/core/createAccessor.js +39 -0
  68. package/dist/core/createApi.js +86 -0
  69. package/dist/core/createCellActivity.js +47 -0
  70. package/dist/core/createColumnDefs.js +42 -0
  71. package/dist/core/createFeatureActions.js +24 -0
  72. package/dist/core/createFeatureSet.js +39 -0
  73. package/dist/core/createInitialState.js +63 -0
  74. package/dist/core/createKeyIndex.js +26 -0
  75. package/dist/core/createMethodStubs.js +30 -0
  76. package/dist/core/createSliceHandlers.js +26 -0
  77. package/dist/core/createStableCoreRowModel.js +91 -0
  78. package/dist/core/createTanstackFeatures.js +24 -0
  79. package/dist/core/createTextMeasure.js +106 -0
  80. package/dist/core/densityHeights.js +20 -0
  81. package/dist/core/deriveValue.js +53 -0
  82. package/dist/core/dispatchGridEvent.js +21 -0
  83. package/dist/core/distributeFlex.js +28 -0
  84. package/dist/core/getCellFit.js +34 -0
  85. package/dist/core/getHeaderCellProps.js +21 -0
  86. package/dist/core/getHeaderLevels.js +50 -0
  87. package/dist/core/getRecordCount.js +23 -0
  88. package/dist/core/getSummaryLabel.js +35 -0
  89. package/dist/core/getValueSignature.js +26 -0
  90. package/dist/core/isDataItem.js +21 -0
  91. package/dist/core/isDefaultViewColumns.js +36 -0
  92. package/dist/core/isRowEqual.js +40 -0
  93. package/dist/core/isSameSignature.js +19 -0
  94. package/dist/core/lazyCellTypes.js +33 -0
  95. package/dist/core/lazyComponent.js +30 -0
  96. package/dist/core/loadOptionalFeature.js +35 -0
  97. package/dist/core/normalizeViewColumn.js +29 -0
  98. package/dist/core/pickViewPart.js +23 -0
  99. package/dist/core/renderRegion.js +21 -0
  100. package/dist/core/resolveMountValue.js +31 -0
  101. package/dist/core/resolveViewColumns.js +65 -0
  102. package/dist/core/someColumnConfig.js +30 -0
  103. package/dist/core/stabilizeData.js +90 -0
  104. package/dist/core/table.css +557 -0
  105. package/dist/core/useFeatureData.js +35 -0
  106. package/dist/core/useFeatureFragments.js +55 -0
  107. package/dist/core/useFeatureItems.js +78 -0
  108. package/dist/core/useFeatureMethods.js +29 -0
  109. package/dist/core/useFeatureRows.js +36 -0
  110. package/dist/core/useFeatureSet.js +54 -0
  111. package/dist/core/useForeignKeys.js +38 -0
  112. package/dist/core/useGridFeatures.js +26 -0
  113. package/dist/core/useStableConfig.js +34 -0
  114. package/dist/core/useSummary.js +73 -0
  115. package/dist/core/useTableConfig.js +189 -0
  116. package/dist/core/useTableState.js +150 -0
  117. package/dist/core/useViewportSize.js +40 -0
  118. package/dist/e2e.js +16 -0
  119. package/dist/features/bulk/BulkBar.js +46 -0
  120. package/dist/features/bulk/bulk.css +57 -0
  121. package/dist/features/bulk/bulkFeature.js +28 -0
  122. package/dist/features/bulk/countSelection.js +27 -0
  123. package/dist/features/bulk/createSelectAllMatching.js +43 -0
  124. package/dist/features/bulk/useBulkBar.js +42 -0
  125. package/dist/features/clipboard/clipboardFeature.js +24 -0
  126. package/dist/features/clipboard/createPasteCells.js +61 -0
  127. package/dist/features/clipboard/getCopyText.js +57 -0
  128. package/dist/features/clipboard/handleCopyKeyDown.js +37 -0
  129. package/dist/features/clipboard/parseTsv.js +70 -0
  130. package/dist/features/clipboard/pasteFeature.js +26 -0
  131. package/dist/features/clipboard/planPaste.js +101 -0
  132. package/dist/features/clipboard/serializeTsv.js +25 -0
  133. package/dist/features/clipboard/usePasteListener.js +45 -0
  134. package/dist/features/columnManager/ColumnManager.js +253 -0
  135. package/dist/features/columnManager/ColumnManagerPopover.js +37 -0
  136. package/dist/features/columnManager/DragHandleIcon.js +39 -0
  137. package/dist/features/columnManager/LazyColumnManagerPopover.js +19 -0
  138. package/dist/features/columnManager/applyManagerRegions.js +43 -0
  139. package/dist/features/columnManager/boundaryIds.js +21 -0
  140. package/dist/features/columnManager/buildManagerSequence.js +38 -0
  141. package/dist/features/columnManager/columnManager.css +155 -0
  142. package/dist/features/columnManager/columnManagerFeature.js +37 -0
  143. package/dist/features/columnManager/createCloseColumnManager.js +21 -0
  144. package/dist/features/columnManager/createOpenColumnManager.js +21 -0
  145. package/dist/features/columnManager/createResetColumns.js +43 -0
  146. package/dist/features/columnManager/getColumnManagerMenuItems.js +26 -0
  147. package/dist/features/columnManager/getListRoom.js +31 -0
  148. package/dist/features/columnManager/getManagerEntries.js +31 -0
  149. package/dist/features/columnManager/moveSequenceEntry.js +25 -0
  150. package/dist/features/columnManager/sequenceToRegions.js +38 -0
  151. package/dist/features/columnManager/snapListHeight.js +35 -0
  152. package/dist/features/columnManager/updateScrollHints.js +23 -0
  153. package/dist/features/columnManager/useColumnManager.js +36 -0
  154. package/dist/features/density/densityFeature.js +39 -0
  155. package/dist/features/density/densityToValue.js +23 -0
  156. package/dist/features/density/getViewWrapColumn.js +53 -0
  157. package/dist/features/density/initDensity.js +27 -0
  158. package/dist/features/density/initWrap.js +23 -0
  159. package/dist/features/editing/AddRowButton.js +28 -0
  160. package/dist/features/editing/CellEditor.js +284 -0
  161. package/dist/features/editing/EditMarker.js +38 -0
  162. package/dist/features/editing/EditingLayer.js +148 -0
  163. package/dist/features/editing/RowControlsCell.js +89 -0
  164. package/dist/features/editing/RowControlsHeader.js +18 -0
  165. package/dist/features/editing/SelectedTag.js +33 -0
  166. package/dist/features/editing/addChangeRow.js +34 -0
  167. package/dist/features/editing/applyChangeUpdates.js +28 -0
  168. package/dist/features/editing/applyChanges.js +90 -0
  169. package/dist/features/editing/applyMoveOverlay.js +44 -0
  170. package/dist/features/editing/applyMoveToChanges.js +66 -0
  171. package/dist/features/editing/applyOverlay.js +41 -0
  172. package/dist/features/editing/coerceCellValue.js +187 -0
  173. package/dist/features/editing/collectRawColumns.js +38 -0
  174. package/dist/features/editing/computeEditTargets.js +108 -0
  175. package/dist/features/editing/computeRowMove.js +78 -0
  176. package/dist/features/editing/createAddRow.js +68 -0
  177. package/dist/features/editing/createCancelEdit.js +29 -0
  178. package/dist/features/editing/createCommitEdit.js +124 -0
  179. package/dist/features/editing/createDeleteRow.js +39 -0
  180. package/dist/features/editing/createEditSpecs.js +80 -0
  181. package/dist/features/editing/createEmptyChanges.js +23 -0
  182. package/dist/features/editing/createMoveRow.js +65 -0
  183. package/dist/features/editing/createNewRow.js +32 -0
  184. package/dist/features/editing/createResetChanges.js +29 -0
  185. package/dist/features/editing/createSaveCellEdit.js +113 -0
  186. package/dist/features/editing/createSaveRowMove.js +90 -0
  187. package/dist/features/editing/createStartEdit.js +57 -0
  188. package/dist/features/editing/createStepHistory.js +33 -0
  189. package/dist/features/editing/createUndoStack.js +67 -0
  190. package/dist/features/editing/createValueStore.js +34 -0
  191. package/dist/features/editing/createWriteCell.js +34 -0
  192. package/dist/features/editing/createWriteChanges.js +43 -0
  193. package/dist/features/editing/editing.css +223 -0
  194. package/dist/features/editing/editingFeature.js +66 -0
  195. package/dist/features/editing/findCellByKey.js +23 -0
  196. package/dist/features/editing/findInvalidCells.js +41 -0
  197. package/dist/features/editing/findNextEditableCell.js +54 -0
  198. package/dist/features/editing/focusCell.js +28 -0
  199. package/dist/features/editing/fromDateValue.js +29 -0
  200. package/dist/features/editing/fromEditorDraft.js +45 -0
  201. package/dist/features/editing/generateRowKey.js +25 -0
  202. package/dist/features/editing/getDataGap.js +28 -0
  203. package/dist/features/editing/getEditOptions.js +33 -0
  204. package/dist/features/editing/getEditorKind.js +36 -0
  205. package/dist/features/editing/getEventError.js +24 -0
  206. package/dist/features/editing/getKeyField.js +23 -0
  207. package/dist/features/editing/getReorderBlock.js +33 -0
  208. package/dist/features/editing/handleEditDoubleClick.js +34 -0
  209. package/dist/features/editing/handleEditKeyDown.js +123 -0
  210. package/dist/features/editing/handleRowControlsClick.js +29 -0
  211. package/dist/features/editing/handleRowDragPointerDown.js +95 -0
  212. package/dist/features/editing/isCellEditable.js +20 -0
  213. package/dist/features/editing/isPrintableKey.js +22 -0
  214. package/dist/features/editing/isSameTargets.js +19 -0
  215. package/dist/features/editing/matchOption.js +21 -0
  216. package/dist/features/editing/needsEditing.js +26 -0
  217. package/dist/features/editing/normalizeChanges.js +37 -0
  218. package/dist/features/editing/positionBetween.js +30 -0
  219. package/dist/features/editing/pruneOverlay.js +39 -0
  220. package/dist/features/editing/removeChangeRow.js +48 -0
  221. package/dist/features/editing/reorderByKeys.js +34 -0
  222. package/dist/features/editing/rowControlsColumn.js +33 -0
  223. package/dist/features/editing/setChangeField.js +72 -0
  224. package/dist/features/editing/setRowField.js +23 -0
  225. package/dist/features/editing/sortByPosition.js +31 -0
  226. package/dist/features/editing/toDateValue.js +38 -0
  227. package/dist/features/editing/toEditorDraft.js +56 -0
  228. package/dist/features/editing/toSelectOptions.js +39 -0
  229. package/dist/features/editing/useEditingData.js +199 -0
  230. package/dist/features/editing/useEditingFragments.js +77 -0
  231. package/dist/features/editing/useEditingGrid.js +25 -0
  232. package/dist/features/editing/validateCellValue.js +25 -0
  233. package/dist/features/editing/valuesEqual.js +31 -0
  234. package/dist/features/editing/warnMissingEvent.js +23 -0
  235. package/dist/features/events/createActivateRow.js +54 -0
  236. package/dist/features/events/eventsFeature.js +35 -0
  237. package/dist/features/events/getBodyTarget.js +27 -0
  238. package/dist/features/events/getRowIndex.js +24 -0
  239. package/dist/features/events/handleAuxClick.js +38 -0
  240. package/dist/features/events/handlePointerDown.js +22 -0
  241. package/dist/features/events/handleRowClick.js +57 -0
  242. package/dist/features/events/handleRowDoubleClick.js +45 -0
  243. package/dist/features/events/isTextDrag.js +30 -0
  244. package/dist/features/events/openRowLink.js +29 -0
  245. package/dist/features/expandable/DetailRow.js +57 -0
  246. package/dist/features/expandable/ExpandToggle.js +34 -0
  247. package/dist/features/expandable/expandable.css +40 -0
  248. package/dist/features/expandable/expandableFeature.js +34 -0
  249. package/dist/features/expandable/handleExpandClick.js +25 -0
  250. package/dist/features/expandable/needsExpandable.js +20 -0
  251. package/dist/features/expandable/normalizeExpandable.js +52 -0
  252. package/dist/features/expandable/useExpandableItems.js +101 -0
  253. package/dist/features/expansion/createToggleRowExpanded.js +52 -0
  254. package/dist/features/expansion/expansionFeature.js +31 -0
  255. package/dist/features/expansion/getExpandedIds.js +26 -0
  256. package/dist/features/expansion/initExpanded.js +22 -0
  257. package/dist/features/export/buildCsv.js +39 -0
  258. package/dist/features/export/createExportCsv.js +59 -0
  259. package/dist/features/export/exportFeature.js +25 -0
  260. package/dist/features/export/toCsvField.js +20 -0
  261. package/dist/features/filtering/ChoiceFilter.js +30 -0
  262. package/dist/features/filtering/CloseIcon.js +29 -0
  263. package/dist/features/filtering/ColumnFilter.js +192 -0
  264. package/dist/features/filtering/ColumnFilterPopover.js +38 -0
  265. package/dist/features/filtering/DateFilter.js +80 -0
  266. package/dist/features/filtering/DraftInput.js +37 -0
  267. package/dist/features/filtering/DraftInputNumber.js +36 -0
  268. package/dist/features/filtering/FilterBuilder.js +45 -0
  269. package/dist/features/filtering/FilterGroup.js +116 -0
  270. package/dist/features/filtering/FilterIcon.js +26 -0
  271. package/dist/features/filtering/FilterIndicator.js +40 -0
  272. package/dist/features/filtering/FilterLeaf.js +86 -0
  273. package/dist/features/filtering/LazyColumnFilterPopover.js +19 -0
  274. package/dist/features/filtering/LazyFilterBuilder.js +19 -0
  275. package/dist/features/filtering/NumberFilter.js +43 -0
  276. package/dist/features/filtering/OptionsFilter.js +72 -0
  277. package/dist/features/filtering/RelativeDateEditor.js +90 -0
  278. package/dist/features/filtering/TextFilter.js +51 -0
  279. package/dist/features/filtering/ValueEditor.js +210 -0
  280. package/dist/features/filtering/buildColumnFilter.js +95 -0
  281. package/dist/features/filtering/changeLeafOperator.js +46 -0
  282. package/dist/features/filtering/createApplyFiltering.js +78 -0
  283. package/dist/features/filtering/createClearFilters.js +24 -0
  284. package/dist/features/filtering/createCloseColumnFilter.js +28 -0
  285. package/dist/features/filtering/createConditionFilteredRowModel.js +40 -0
  286. package/dist/features/filtering/createDefaultLeaf.js +31 -0
  287. package/dist/features/filtering/createOpenColumnFilter.js +25 -0
  288. package/dist/features/filtering/createRowTest.js +32 -0
  289. package/dist/features/filtering/createSearchMatcher.js +35 -0
  290. package/dist/features/filtering/createSetFilter.js +27 -0
  291. package/dist/features/filtering/createSetSearch.js +29 -0
  292. package/dist/features/filtering/createUpdateColumnFilter.js +29 -0
  293. package/dist/features/filtering/defaultRelativeDate.js +20 -0
  294. package/dist/features/filtering/filterRowModel.js +66 -0
  295. package/dist/features/filtering/filtering.css +151 -0
  296. package/dist/features/filtering/filteringFeature.js +82 -0
  297. package/dist/features/filtering/filteringToValue.js +23 -0
  298. package/dist/features/filtering/formatFilterDate.js +24 -0
  299. package/dist/features/filtering/getColumnConditions.js +24 -0
  300. package/dist/features/filtering/getConditionKeys.js +31 -0
  301. package/dist/features/filtering/getDistinctOptions.js +52 -0
  302. package/dist/features/filtering/getFilterKind.js +37 -0
  303. package/dist/features/filtering/getFilterResultKey.js +26 -0
  304. package/dist/features/filtering/getFilterResults.js +53 -0
  305. package/dist/features/filtering/getFilteredKeys.js +31 -0
  306. package/dist/features/filtering/getFilteringHeaderProps.js +22 -0
  307. package/dist/features/filtering/getFilteringMenuItems.js +42 -0
  308. package/dist/features/filtering/getFilteringTableOptions.js +33 -0
  309. package/dist/features/filtering/getGroupOperator.js +23 -0
  310. package/dist/features/filtering/getOperatorLabel.js +50 -0
  311. package/dist/features/filtering/getPlainTitle.js +26 -0
  312. package/dist/features/filtering/getSearchColumns.js +23 -0
  313. package/dist/features/filtering/getSearchKey.js +19 -0
  314. package/dist/features/filtering/getSearchText.js +57 -0
  315. package/dist/features/filtering/getTopLevelConditions.js +25 -0
  316. package/dist/features/filtering/getValueShape.js +30 -0
  317. package/dist/features/filtering/handleFilterIndicatorClick.js +25 -0
  318. package/dist/features/filtering/initFilter.js +25 -0
  319. package/dist/features/filtering/initSearch.js +24 -0
  320. package/dist/features/filtering/isColumnCondition.js +22 -0
  321. package/dist/features/filtering/isCompleteLeaf.js +45 -0
  322. package/dist/features/filtering/isServerMode.js +21 -0
  323. package/dist/features/filtering/normalizeSearch.js +21 -0
  324. package/dist/features/filtering/parseColumnFilter.js +128 -0
  325. package/dist/features/filtering/parseFilterDate.js +24 -0
  326. package/dist/features/filtering/prepareFilterResult.js +63 -0
  327. package/dist/features/filtering/pruneCondition.js +35 -0
  328. package/dist/features/filtering/setColumnFilter.js +51 -0
  329. package/dist/features/filtering/textFilterOperators.js +26 -0
  330. package/dist/features/filtering/toRootGroup.js +34 -0
  331. package/dist/features/filtering/useDraft.js +65 -0
  332. package/dist/features/filtering/useFilteringState.js +32 -0
  333. package/dist/features/filtering/useSyncedState.js +45 -0
  334. package/dist/features/grouping/GroupCell.js +72 -0
  335. package/dist/features/grouping/GroupCheckbox.js +38 -0
  336. package/dist/features/grouping/GroupLabel.js +73 -0
  337. package/dist/features/grouping/GroupRow.js +103 -0
  338. package/dist/features/grouping/StickyGroupRow.js +136 -0
  339. package/dist/features/grouping/buildGroupTree.js +138 -0
  340. package/dist/features/grouping/buildStickyLevels.js +35 -0
  341. package/dist/features/grouping/countGroupSelection.js +26 -0
  342. package/dist/features/grouping/createAggregateColumns.js +38 -0
  343. package/dist/features/grouping/createCollapseAllGroups.js +26 -0
  344. package/dist/features/grouping/createExpandAllGroups.js +23 -0
  345. package/dist/features/grouping/createGroupLevels.js +46 -0
  346. package/dist/features/grouping/createSetCollapsedGroups.js +27 -0
  347. package/dist/features/grouping/createSetGroup.js +35 -0
  348. package/dist/features/grouping/createSetGroupKeys.js +27 -0
  349. package/dist/features/grouping/createToggleGroup.js +38 -0
  350. package/dist/features/grouping/createToggleGroupSelected.js +49 -0
  351. package/dist/features/grouping/findGroupIndices.js +25 -0
  352. package/dist/features/grouping/flattenGroups.js +58 -0
  353. package/dist/features/grouping/getGroupLabel.js +34 -0
  354. package/dist/features/grouping/getStickyGroups.js +60 -0
  355. package/dist/features/grouping/groupRowsFeature.js +57 -0
  356. package/dist/features/grouping/grouping.css +128 -0
  357. package/dist/features/grouping/groupingFeature.js +48 -0
  358. package/dist/features/grouping/groupingHeaderMenuItems.js +44 -0
  359. package/dist/features/grouping/groupingToValue.js +26 -0
  360. package/dist/features/grouping/handleGroupClick.js +51 -0
  361. package/dist/features/grouping/handleGroupKeyDown.js +60 -0
  362. package/dist/features/grouping/initAggregates.js +36 -0
  363. package/dist/features/grouping/initCollapsedGroups.js +29 -0
  364. package/dist/features/grouping/initGrouping.js +34 -0
  365. package/dist/features/grouping/needsGroupRows.js +23 -0
  366. package/dist/features/grouping/orderGroups.js +49 -0
  367. package/dist/features/grouping/resolveAggregates.js +29 -0
  368. package/dist/features/grouping/toGroupIdentity.js +24 -0
  369. package/dist/features/grouping/toGroupKeys.js +24 -0
  370. package/dist/features/grouping/useGrouping.js +91 -0
  371. package/dist/features/headerMenu/HeaderMenuDropdown.js +86 -0
  372. package/dist/features/headerMenu/HeaderMenuTrigger.js +44 -0
  373. package/dist/features/headerMenu/LazyHeaderMenuDropdown.js +19 -0
  374. package/dist/features/headerMenu/MenuIcon.js +38 -0
  375. package/dist/features/headerMenu/collectHeaderMenuItems.js +69 -0
  376. package/dist/features/headerMenu/createAutosizeColumn.js +35 -0
  377. package/dist/features/headerMenu/createCloseHeaderMenu.js +28 -0
  378. package/dist/features/headerMenu/createOpenHeaderMenu.js +30 -0
  379. package/dist/features/headerMenu/focusHeaderControl.js +31 -0
  380. package/dist/features/headerMenu/freezeColumns.js +31 -0
  381. package/dist/features/headerMenu/getChromeMenuItems.js +144 -0
  382. package/dist/features/headerMenu/getVisibleOrder.js +19 -0
  383. package/dist/features/headerMenu/handleHeaderButtonPointerDown.js +27 -0
  384. package/dist/features/headerMenu/handleHeaderMenuClick.js +26 -0
  385. package/dist/features/headerMenu/handleHeaderMenuKeyDown.js +28 -0
  386. package/dist/features/headerMenu/headerMenu.css +122 -0
  387. package/dist/features/headerMenu/headerMenuFeature.js +46 -0
  388. package/dist/features/headerMenu/measureColumnWidth.js +51 -0
  389. package/dist/features/headerMenu/pinColumn.js +27 -0
  390. package/dist/features/headerMenu/sectionOrder.js +25 -0
  391. package/dist/features/headerMenu/useHeaderMenuState.js +27 -0
  392. package/dist/features/index.js +149 -0
  393. package/dist/features/keyboard/findCellElement.js +21 -0
  394. package/dist/features/keyboard/getNextCell.js +74 -0
  395. package/dist/features/keyboard/handleGridFocus.js +31 -0
  396. package/dist/features/keyboard/handleGridKeyDown.js +72 -0
  397. package/dist/features/keyboard/isCellRendered.js +22 -0
  398. package/dist/features/keyboard/keyboardFeature.js +26 -0
  399. package/dist/features/keyboard/useKeyboard.js +84 -0
  400. package/dist/features/lazyCells/getBodyRowKey.js +19 -0
  401. package/dist/features/lazyCells/handlePointerLeave.js +21 -0
  402. package/dist/features/lazyCells/handlePointerOver.js +22 -0
  403. package/dist/features/lazyCells/handleRowBlur.js +22 -0
  404. package/dist/features/lazyCells/handleRowFocus.js +26 -0
  405. package/dist/features/lazyCells/lazyCellsFeature.js +33 -0
  406. package/dist/features/lazyCells/useFastScroll.js +57 -0
  407. package/dist/features/ordering/getColumnClientBounds.js +32 -0
  408. package/dist/features/ordering/handleReorderPointerDown.js +137 -0
  409. package/dist/features/ordering/initColumnOrder.js +18 -0
  410. package/dist/features/ordering/moveKeys.js +27 -0
  411. package/dist/features/ordering/orderingFeature.js +35 -0
  412. package/dist/features/pagination/TablePagination.js +31 -0
  413. package/dist/features/pagination/initPageSize.js +28 -0
  414. package/dist/features/pagination/paginationFeature.js +36 -0
  415. package/dist/features/pagination/paginationToValue.js +24 -0
  416. package/dist/features/pagination/usePager.js +32 -0
  417. package/dist/features/pagination/usePagination.js +58 -0
  418. package/dist/features/pinning/initColumnPinning.js +21 -0
  419. package/dist/features/pinning/pinningFeature.js +33 -0
  420. package/dist/features/pinning/pinningToViewColumn.js +24 -0
  421. package/dist/features/queue/createAfterRowAction.js +40 -0
  422. package/dist/features/queue/findNextRowId.js +26 -0
  423. package/dist/features/queue/findRowAction.js +77 -0
  424. package/dist/features/queue/handleRowActionKey.js +44 -0
  425. package/dist/features/queue/queueFeature.js +27 -0
  426. package/dist/features/selection/SelectAllHeader.js +40 -0
  427. package/dist/features/selection/SelectCell.js +30 -0
  428. package/dist/features/selection/countSelectedRows.js +31 -0
  429. package/dist/features/selection/createClearSelection.js +29 -0
  430. package/dist/features/selection/createToggleAllRowsSelected.js +60 -0
  431. package/dist/features/selection/createToggleRowSelected.js +86 -0
  432. package/dist/features/selection/getRawRowKey.js +23 -0
  433. package/dist/features/selection/getSelectAllExcept.js +23 -0
  434. package/dist/features/selection/getSelectAllState.js +42 -0
  435. package/dist/features/selection/handleSelectionClick.js +30 -0
  436. package/dist/features/selection/initRowSelection.js +36 -0
  437. package/dist/features/selection/initSelectionMode.js +19 -0
  438. package/dist/features/selection/initSelectionView.js +35 -0
  439. package/dist/features/selection/isSelectAllValue.js +19 -0
  440. package/dist/features/selection/isSelectionViewCurrent.js +22 -0
  441. package/dist/features/selection/notifySelectionChange.js +32 -0
  442. package/dist/features/selection/pruneRowSelection.js +26 -0
  443. package/dist/features/selection/selectionFeature.js +69 -0
  444. package/dist/features/selection/selectionToValue.js +48 -0
  445. package/dist/features/selection/useSelection.js +77 -0
  446. package/dist/features/serverData/buildServerItems.js +109 -0
  447. package/dist/features/serverData/createBlockCache.js +205 -0
  448. package/dist/features/serverData/createRefresh.js +23 -0
  449. package/dist/features/serverData/createServerStore.js +360 -0
  450. package/dist/features/serverData/getBlockRange.js +29 -0
  451. package/dist/features/serverData/getListKey.js +20 -0
  452. package/dist/features/serverData/getNeededBlocks.js +45 -0
  453. package/dist/features/serverData/needsServerData.js +20 -0
  454. package/dist/features/serverData/normalizeServerData.js +41 -0
  455. package/dist/features/serverData/pickServerView.js +43 -0
  456. package/dist/features/serverData/readFetchResult.js +36 -0
  457. package/dist/features/serverData/serverData.css +21 -0
  458. package/dist/features/serverData/serverDataFeature.js +38 -0
  459. package/dist/features/serverData/serverRangeFeature.js +22 -0
  460. package/dist/features/serverData/useServerData.js +48 -0
  461. package/dist/features/serverData/useServerItems.js +35 -0
  462. package/dist/features/serverData/useServerRange.js +35 -0
  463. package/dist/features/serverData/useServerView.js +70 -0
  464. package/dist/features/sizing/ResizeHandle.js +24 -0
  465. package/dist/features/sizing/handleResizePointerDown.js +66 -0
  466. package/dist/features/sizing/initColumnSizing.js +23 -0
  467. package/dist/features/sizing/sizingFeature.js +39 -0
  468. package/dist/features/sizing/sizingToViewColumn.js +24 -0
  469. package/dist/features/sorting/SortIndicator.js +37 -0
  470. package/dist/features/sorting/buildSortKeys.js +52 -0
  471. package/dist/features/sorting/collectSortKeys.js +30 -0
  472. package/dist/features/sorting/createClearSort.js +21 -0
  473. package/dist/features/sorting/createIndexSortedRowModel.js +33 -0
  474. package/dist/features/sorting/createSetSort.js +43 -0
  475. package/dist/features/sorting/createSortKeyCollector.js +59 -0
  476. package/dist/features/sorting/createToggleSort.js +42 -0
  477. package/dist/features/sorting/getCachedSortKeys.js +19 -0
  478. package/dist/features/sorting/getSortHeaderProps.js +25 -0
  479. package/dist/features/sorting/getSortKeys.js +38 -0
  480. package/dist/features/sorting/handleSortClick.js +27 -0
  481. package/dist/features/sorting/initSorting.js +37 -0
  482. package/dist/features/sorting/isNumericSortType.js +21 -0
  483. package/dist/features/sorting/prepareSortKeys.js +92 -0
  484. package/dist/features/sorting/rankSortKeys.js +33 -0
  485. package/dist/features/sorting/setCachedSortKeys.js +24 -0
  486. package/dist/features/sorting/sortInSlices.js +69 -0
  487. package/dist/features/sorting/sortIndices.js +40 -0
  488. package/dist/features/sorting/sortKeysCache.js +19 -0
  489. package/dist/features/sorting/sortRowModel.js +84 -0
  490. package/dist/features/sorting/sortingFeature.js +62 -0
  491. package/dist/features/sorting/sortingToValue.js +27 -0
  492. package/dist/features/sorting/toFloatSortKeys.js +24 -0
  493. package/dist/features/sorting/yieldToMain.js +27 -0
  494. package/dist/features/toolbar/ColumnTitle.js +28 -0
  495. package/dist/features/toolbar/DensityToggle.js +53 -0
  496. package/dist/features/toolbar/FilterButton.js +56 -0
  497. package/dist/features/toolbar/GroupButton.js +51 -0
  498. package/dist/features/toolbar/OptionsQuickFilter.js +72 -0
  499. package/dist/features/toolbar/QuickFilter.js +46 -0
  500. package/dist/features/toolbar/RecordCount.js +27 -0
  501. package/dist/features/toolbar/SaveViewAs.js +66 -0
  502. package/dist/features/toolbar/SortButton.js +94 -0
  503. package/dist/features/toolbar/Toolbar.js +88 -0
  504. package/dist/features/toolbar/ToolbarCount.js +25 -0
  505. package/dist/features/toolbar/ToolbarIcon.js +28 -0
  506. package/dist/features/toolbar/ToolbarList.js +100 -0
  507. package/dist/features/toolbar/ToolbarSearch.js +63 -0
  508. package/dist/features/toolbar/ViewActions.js +41 -0
  509. package/dist/features/toolbar/ViewTabLabel.js +39 -0
  510. package/dist/features/toolbar/ViewTabMenu.js +48 -0
  511. package/dist/features/toolbar/ViewTabs.js +44 -0
  512. package/dist/features/toolbar/countConditions.js +25 -0
  513. package/dist/features/toolbar/formatRecordCount.js +19 -0
  514. package/dist/features/toolbar/getQuickFilterValues.js +25 -0
  515. package/dist/features/toolbar/getRootConditions.js +25 -0
  516. package/dist/features/toolbar/handleToolbarKeyDown.js +28 -0
  517. package/dist/features/toolbar/isDefaultSorting.js +26 -0
  518. package/dist/features/toolbar/isQuickFilterLeaf.js +20 -0
  519. package/dist/features/toolbar/moveItem.js +25 -0
  520. package/dist/features/toolbar/needsToolbar.js +21 -0
  521. package/dist/features/toolbar/normalizeToolbar.js +61 -0
  522. package/dist/features/toolbar/setQuickFilterValues.js +35 -0
  523. package/dist/features/toolbar/toolbar.css +185 -0
  524. package/dist/features/toolbar/toolbarFeature.js +27 -0
  525. package/dist/features/toolbar/useToolbar.js +41 -0
  526. package/dist/features/toolbar/validateQuickFilters.js +28 -0
  527. package/dist/features/transactions/applyTransactionToRows.js +56 -0
  528. package/dist/features/transactions/createApplyTransaction.js +26 -0
  529. package/dist/features/transactions/normalizeTransaction.js +49 -0
  530. package/dist/features/transactions/transactionsFeature.js +24 -0
  531. package/dist/features/transactions/useTransactionData.js +44 -0
  532. package/dist/features/tree/TreeToggle.js +39 -0
  533. package/dist/features/tree/buildTreeIndex.js +60 -0
  534. package/dist/features/tree/buildTreeItems.js +96 -0
  535. package/dist/features/tree/flattenTreeData.js +45 -0
  536. package/dist/features/tree/getDescendantIds.js +28 -0
  537. package/dist/features/tree/handleTreeClick.js +25 -0
  538. package/dist/features/tree/handleTreeKeyDown.js +58 -0
  539. package/dist/features/tree/needsTree.js +20 -0
  540. package/dist/features/tree/normalizeTree.js +41 -0
  541. package/dist/features/tree/rowNeedsChildren.js +25 -0
  542. package/dist/features/tree/tree.css +55 -0
  543. package/dist/features/tree/treeFeature.js +35 -0
  544. package/dist/features/tree/useTreeData.js +33 -0
  545. package/dist/features/tree/useTreeItems.js +61 -0
  546. package/dist/features/views/compactView.js +30 -0
  547. package/dist/features/views/createViewsApi.js +74 -0
  548. package/dist/features/views/decodeViewParam.js +30 -0
  549. package/dist/features/views/encodeViewParam.js +25 -0
  550. package/dist/features/views/findActiveView.js +23 -0
  551. package/dist/features/views/getStorageKey.js +20 -0
  552. package/dist/features/views/getViewKey.js +27 -0
  553. package/dist/features/views/getViewSliceDeps.js +27 -0
  554. package/dist/features/views/isViewDirty.js +34 -0
  555. package/dist/features/views/mountViewValue.js +36 -0
  556. package/dist/features/views/needsViews.js +23 -0
  557. package/dist/features/views/normalizePersist.js +27 -0
  558. package/dist/features/views/normalizeViews.js +41 -0
  559. package/dist/features/views/notifyViewSelect.js +29 -0
  560. package/dist/features/views/readMountPayload.js +31 -0
  561. package/dist/features/views/readPersistedView.js +45 -0
  562. package/dist/features/views/sanitizePersistedView.js +49 -0
  563. package/dist/features/views/stableStringify.js +27 -0
  564. package/dist/features/views/useViews.js +136 -0
  565. package/dist/features/views/viewKeys.js +28 -0
  566. package/dist/features/views/viewsFeature.js +26 -0
  567. package/dist/features/views/writePersistedView.js +42 -0
  568. package/dist/features/virtualization/computeRowOffsets.js +29 -0
  569. package/dist/features/virtualization/computeWindow.js +92 -0
  570. package/dist/features/virtualization/createScrollToRow.js +36 -0
  571. package/dist/features/virtualization/firstIndexAbove.js +30 -0
  572. package/dist/features/virtualization/getMeasureKey.js +23 -0
  573. package/dist/features/virtualization/isMeasuredColumn.js +20 -0
  574. package/dist/features/virtualization/isSameRange.js +18 -0
  575. package/dist/features/virtualization/positionedRowsFeature.js +22 -0
  576. package/dist/features/virtualization/scrollToCell.js +49 -0
  577. package/dist/features/virtualization/shiftRowOffsets.js +35 -0
  578. package/dist/features/virtualization/usePositionedRows.js +37 -0
  579. package/dist/features/virtualization/useRowOffsets.js +123 -0
  580. package/dist/features/virtualization/useScrollWindow.js +114 -0
  581. package/dist/features/virtualization/useTanstackRowWindow.js +43 -0
  582. package/dist/features/virtualization/useVirtualization.js +64 -0
  583. package/dist/features/virtualization/virtualizationFeature.js +24 -0
  584. package/dist/features/virtualization/writeScrollEdges.js +33 -0
  585. package/dist/features/visibility/initColumnVisibility.js +22 -0
  586. package/dist/features/visibility/visibilityFeature.js +31 -0
  587. package/dist/features/visibility/visibilityToViewColumn.js +20 -0
  588. package/dist/metas.js +16 -0
  589. package/dist/types.js +17 -0
  590. package/package.json +91 -0
@@ -0,0 +1,964 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import AGGREGATE_LABELS from '@lowdefy/blocks-antd/table/aggregateLabels.js';
16
+ import CELL_TYPE_FAMILIES from '@lowdefy/blocks-antd/table/cellTypeFamilies.js';
17
+ // Every property TableLight accepts is valid here with the same meaning (TableLight is a strict
18
+ // subset of Table, design D16), so changing `type: TableLight` to `type: Table` keeps a block
19
+ // working. The column keys shared with TableLight use its descriptions.
20
+ const columnFlags = {
21
+ sortable: {
22
+ type: 'boolean',
23
+ description: 'Sort by clicking the header (Shift+click adds to a multi-sort). Defaults to `defaultColumn.sortable` (true).'
24
+ },
25
+ filterable: {
26
+ type: 'boolean',
27
+ description: 'Offer the column in filters: the header menu "Filter…" item and the filter builder.'
28
+ },
29
+ resizable: {
30
+ type: 'boolean',
31
+ description: 'Resize the column by dragging the right edge of its header.'
32
+ },
33
+ groupable: {
34
+ type: 'boolean',
35
+ description: 'Allow grouping rows by this column (view `group`, the `setGroup` method, the header menu). Default false.'
36
+ },
37
+ editable: {
38
+ type: [
39
+ 'boolean',
40
+ 'object'
41
+ ],
42
+ description: 'Edit cells of this column: `true`, or `{ when: Condition }` to allow it per row. The editor comes from the type: text, email, phone and url edit as text; number, currency and percent as a number; date and datetime with a date picker; boolean with a switch; tag and status select from `options`; tags select several; rating with stars. Enter, F2, double-click or typing opens it; Enter, Tab or leaving commits; Esc cancels. Table fires onCellEdit; TableInput writes its value.',
43
+ properties: {
44
+ when: {
45
+ type: 'object',
46
+ description: 'Condition tested against the row (and the cell value, for leaves without `key`) that decides whether the cell is editable.'
47
+ }
48
+ }
49
+ }
50
+ };
51
+ const textLayout = {
52
+ ellipsis: {
53
+ type: [
54
+ 'integer',
55
+ 'boolean'
56
+ ],
57
+ description: 'Clamp the text to this many lines (`true` is one) with an ellipsis; the full text shows on hover. More than one line makes rows as tall as their content.',
58
+ docs: {
59
+ displayType: 'number'
60
+ }
61
+ },
62
+ wrap: {
63
+ type: 'boolean',
64
+ default: false,
65
+ description: 'Wrap long text; rows grow to fit (measured row heights, which turn column virtualisation off). Text stays on one line by default.'
66
+ }
67
+ };
68
+ const widthProperties = {
69
+ width: {
70
+ type: 'number',
71
+ description: 'Column width in pixels. Default 160.'
72
+ },
73
+ minWidth: {
74
+ type: 'number',
75
+ description: 'Minimum width in pixels when resizing. Default 48.'
76
+ },
77
+ maxWidth: {
78
+ type: 'number',
79
+ description: 'Maximum width in pixels when resizing.'
80
+ }
81
+ };
82
+ const pinned = {
83
+ type: 'string',
84
+ enum: [
85
+ 'start',
86
+ 'end'
87
+ ],
88
+ description: 'Pin the column to the start or end, where it stays visible while scrolling.'
89
+ };
90
+ const column = {
91
+ type: [
92
+ 'object',
93
+ 'string'
94
+ ],
95
+ additionalProperties: false,
96
+ description: 'A column, or just its key. `key` (or `field`) is required.',
97
+ properties: {
98
+ key: {
99
+ type: 'string',
100
+ description: 'The column id, unique in the table and used in the view. Defaults to `field`. Two columns showing the same field need their own keys.'
101
+ },
102
+ field: {
103
+ type: 'string',
104
+ description: 'The dot path of the value in each row. Defaults to `key`.'
105
+ },
106
+ title: {
107
+ type: 'string',
108
+ description: 'The header - supports html. Defaults to the key in sentence case.'
109
+ },
110
+ type: {
111
+ type: 'string',
112
+ enum: Object.keys(CELL_TYPE_FAMILIES),
113
+ default: 'text',
114
+ description: 'The cell type. It sets how the value renders, sorts and aggregates and the default alignment.'
115
+ },
116
+ cell: {
117
+ type: 'object',
118
+ description: 'Options for the cell type, the same keys as TableLight (and the AgGrid `cell` keys where they overlap), for example `format`, `currency`, `relative`, `pageId`/`urlQuery` (link), `template` (html), `buttons` and `showOn` (buttons), `items` (menu). Row buttons (`buttons`) and menu items (`items`) also accept `key`, a single key that fires the item when its row is focused, for example `key: a` (no editor open, no modifier).',
119
+ docs: {
120
+ displayType: 'yaml'
121
+ }
122
+ },
123
+ ...widthProperties,
124
+ flex: {
125
+ type: 'number',
126
+ description: 'Grow into spare table width, by this weight.'
127
+ },
128
+ align: {
129
+ type: 'string',
130
+ enum: [
131
+ 'start',
132
+ 'center',
133
+ 'end'
134
+ ],
135
+ description: 'Horizontal alignment. Defaults to `end` for number, currency and percent.'
136
+ },
137
+ pinned,
138
+ ...textLayout,
139
+ hidden: {
140
+ type: 'boolean',
141
+ default: false,
142
+ description: 'Declare the column but hide it.'
143
+ },
144
+ ...columnFlags,
145
+ searchable: {
146
+ type: 'boolean',
147
+ description: 'Include the column in `view.search`. When any column sets it, search reads only those columns; otherwise it reads every visible column.'
148
+ },
149
+ aggregate: {
150
+ type: 'string',
151
+ enum: Object.keys(AGGREGATE_LABELS),
152
+ description: 'Default aggregate for this column, shown in group headers and the summary footer (over all filtered rows): sum, avg, min, max, count, countDistinct, countEmpty, countNotEmpty, percentEmpty, earliest or latest. The view `aggregates` overrides it, and can set aggregates for columns without one.'
153
+ },
154
+ options: {
155
+ type: [
156
+ 'array',
157
+ 'object'
158
+ ],
159
+ description: 'Labels and colours for enum values, for tag, tags and status cells: a list of values or `{ value, label, color, icon }`, or a map from value to a label or `{ label, color, icon }`. Enums sort in option order.',
160
+ docs: {
161
+ displayType: 'yaml'
162
+ }
163
+ },
164
+ tooltip: {
165
+ type: [
166
+ 'string',
167
+ 'object'
168
+ ],
169
+ description: 'A plain-text hover tooltip: a nunjucks template string (with `value` and `row`), `{ template }` or `{ field }` (a row path).',
170
+ docs: {
171
+ displayType: 'yaml'
172
+ }
173
+ },
174
+ headerTooltip: {
175
+ type: 'string',
176
+ description: 'A tooltip on the header - supports html.'
177
+ },
178
+ rules: {
179
+ type: 'array',
180
+ description: 'Conditional formatting: `[{ when, color, className, style }]`. Every rule whose `when` condition holds applies, in order.',
181
+ items: {
182
+ type: 'object'
183
+ },
184
+ docs: {
185
+ displayType: 'yaml'
186
+ }
187
+ },
188
+ validate: {
189
+ type: 'array',
190
+ description: 'Edit validation, checked before an edit commits: `[{ pass: Condition, message }]`. A failing check keeps the editor open with the message. TableInput also marks the cells of changed and added rows that fail inline.',
191
+ items: {
192
+ type: 'object',
193
+ required: [
194
+ 'pass'
195
+ ],
196
+ properties: {
197
+ pass: {
198
+ type: 'object',
199
+ description: 'Condition the edited value must pass. Leaves without `key` test the cell value; leaves with `key` read the edited row.'
200
+ },
201
+ message: {
202
+ type: 'string',
203
+ description: 'Message shown when the check fails.'
204
+ }
205
+ }
206
+ }
207
+ },
208
+ required: {
209
+ type: 'boolean',
210
+ description: 'An edit may not leave the cell empty (validated like `validate`).'
211
+ },
212
+ default: {
213
+ description: 'TableInput: the value of this column in a row added with "+ Add row".'
214
+ },
215
+ children: {
216
+ type: 'array',
217
+ description: 'Columns grouped under this header. A group needs a `title`; groups render as header rows above the column headers.',
218
+ items: {
219
+ type: [
220
+ 'object',
221
+ 'string'
222
+ ]
223
+ },
224
+ docs: {
225
+ displayType: 'yaml'
226
+ }
227
+ }
228
+ }
229
+ };
230
+ const toolbarItem = (description)=>({
231
+ type: 'boolean',
232
+ default: false,
233
+ description
234
+ });
235
+ const viewColumn = {
236
+ type: 'object',
237
+ additionalProperties: false,
238
+ required: [
239
+ 'key'
240
+ ],
241
+ properties: {
242
+ key: {
243
+ type: 'string'
244
+ },
245
+ width: {
246
+ type: 'number'
247
+ },
248
+ pinned,
249
+ hidden: {
250
+ type: 'boolean'
251
+ }
252
+ }
253
+ };
254
+ export default {
255
+ // An input with slots: its value is the table state, and `toolbarStart`, `toolbarEnd`,
256
+ // `bulkActions` and `empty` hold blocks.
257
+ category: 'input-container',
258
+ valueType: 'object',
259
+ icons: [
260
+ 'chevron-down',
261
+ 'chevron-up',
262
+ 'close',
263
+ 'download',
264
+ 'filter',
265
+ 'list',
266
+ 'more',
267
+ 'search',
268
+ 'sort',
269
+ 'view'
270
+ ],
271
+ slots: {
272
+ toolbarStart: 'Blocks at the start of the toolbar, for example a "New deal" button. Blocks sit side by side at their content width (8px gap, wrapping); the slot\'s `gap`, `align` and `justify` and a block\'s `layout.flex` still apply.',
273
+ toolbarEnd: 'Blocks at the end of the toolbar, side by side like `toolbarStart`.',
274
+ bulkActions: 'Blocks in the bulk action bar, shown while rows are selected, side by side at the end of the bar like `toolbarStart`.',
275
+ empty: 'Blocks shown instead of the empty state when there are no rows.'
276
+ },
277
+ // Server mode fetches through an internal event running the Request action.
278
+ actions: [
279
+ 'Request'
280
+ ],
281
+ cssKeys: {
282
+ element: 'The table root element.',
283
+ header: 'The header row group.',
284
+ row: 'Every body row.'
285
+ },
286
+ // Cell buttons and menu items declare their own eventName, so the event names this block fires
287
+ // are authored in its properties.
288
+ dynamicEvents: true,
289
+ events: {
290
+ onChange: {
291
+ description: 'Trigger when the table value changes through the table: a sort, a filter or search, a column change (resize, reorder, pin, hide, column manager), or a selection.',
292
+ event: {
293
+ value: 'The table value `{ view, selected, expanded }`.',
294
+ cause: 'What changed: `sort`, `filter`, `search`, `columns`, `select`, `group` (the grouping levels), `aggregate` (group aggregates), `expand` (a group, tree row or detail row collapsed or expanded), `density`, `wrap` (the toolbar Wrap toggle), or `view` (a saved view loaded, discarded to, or selected).'
295
+ }
296
+ },
297
+ onSelectionChange: {
298
+ description: 'Trigger when the row selection changes. "Select all matching" in the bulk bar (and, in server mode, the header checkbox) selects every row the view matches as `{ all: true, except, filter, search }`: every row matching that filter and search except the `except` keys, so a request can resolve it from the value alone. Changing the filter or search clears such a selection.',
299
+ event: {
300
+ selected: 'The selected row keys, or `{ all: true, except, filter, search }`.',
301
+ rows: 'The selected row objects that are loaded.'
302
+ }
303
+ },
304
+ onRowExpand: {
305
+ description: "Trigger when a tree row or an expandable row is expanded or collapsed. With `tree.lazy`, load the row's children here when `needsChildren` is true (skip the load action otherwise) and add them to `data`.",
306
+ event: {
307
+ row: 'The row object.',
308
+ rowKey: 'The row key.',
309
+ expanded: 'True when the row was expanded, false when it was collapsed.',
310
+ needsChildren: 'True when a `tree.lazy` row is expanded and none of its children are in `data` yet, so they need loading. False for every other expand and collapse.'
311
+ }
312
+ },
313
+ onExport: {
314
+ description: 'Server mode: trigger when `exportCsv` is called. The browser only holds the loaded blocks, so produce the file from the view, for example with a request and a download action.',
315
+ event: {
316
+ view: 'The table view (columns, sort, filter, search, group, ...).',
317
+ filename: 'The filename passed to exportCsv.',
318
+ formatted: 'The formatted flag passed to exportCsv.'
319
+ }
320
+ },
321
+ onRowClick: {
322
+ description: 'Trigger when a row is clicked, or activated with Enter. Clicks on buttons, links, menus and `data-event` elements in a cell, and clicks that end a text selection, do not trigger it. With `rowLink`, a plain click runs onRowClick instead of following the link.',
323
+ event: {
324
+ row: 'The row data.',
325
+ rowKey: 'The row key.',
326
+ index: 'The index of the row in `data` (with `childrenField`, in the depth-first list of every row). In server mode, its index in the rows the request matches (inside a group, in the group). `null` for a row that is not in `data`: added with `applyTransaction`, or added in a TableInput.'
327
+ }
328
+ },
329
+ onRowDoubleClick: {
330
+ description: 'Trigger when a row is double clicked.',
331
+ event: {
332
+ row: 'The row data.',
333
+ rowKey: 'The row key.',
334
+ index: 'The index of the row in `data` (with `childrenField`, in the depth-first list of every row). In server mode, its index in the rows the request matches (inside a group, in the group). `null` for a row that is not in `data`: added with `applyTransaction`, or added in a TableInput.'
335
+ }
336
+ },
337
+ onCellClick: {
338
+ description: 'Trigger actions when a cell is clicked. Clicks on controls in the cell do not trigger it.',
339
+ event: {
340
+ row: 'The row data.',
341
+ rowKey: 'The row key.',
342
+ column: 'The column: { key, field }.',
343
+ value: 'The cell value.'
344
+ }
345
+ },
346
+ onViewSelect: {
347
+ description: 'Trigger when a saved view tab is selected, after its view loads.',
348
+ event: {
349
+ id: 'The id of the selected view.'
350
+ }
351
+ },
352
+ onViewSave: {
353
+ description: 'Trigger when the user saves the current view: Save (with the active view `id`) or Save as (no `id`, a new view). The app stores views; update `views` (and `activeView`) with the result.',
354
+ event: {
355
+ view: 'The current view.',
356
+ id: 'The id of the view to overwrite. Missing for Save as.',
357
+ title: 'The view title.',
358
+ shared: 'Whether the view is shared.'
359
+ }
360
+ },
361
+ onViewDelete: {
362
+ description: 'Trigger when the user deletes a saved view from its tab menu.',
363
+ event: {
364
+ id: 'The id of the view to delete.'
365
+ }
366
+ },
367
+ onCellEdit: {
368
+ description: 'Trigger when an edited cell commits. The cell shows the new value with a saving indicator while the event runs. When the actions fail (a Request error or a Throw), the cell reverts and shows the error message. After success the new value shows until the row changes in `data`. Without this event, edits only show in the table.',
369
+ event: {
370
+ row: 'The row object before the edit.',
371
+ rowKey: 'The row key.',
372
+ column: 'The column `{ key, field }`.',
373
+ value: 'The new value.',
374
+ previous: 'The value before the edit.'
375
+ }
376
+ },
377
+ onRowMove: {
378
+ description: 'Trigger when a row is dropped at a new place (`rowDrag`): a drag of its handle, or Alt+Shift+ArrowUp/Down. The rows reorder at once with a saving indicator on the handle while the event runs; when the actions fail the order reverts and the handle shows the error message. After success the new order shows until `data` changes. With `rowDrag.positionField`, save `position` on the moved row (`positions` holds every row whose position changed: normally just this one, all rows when the list had to be renumbered). Without it, save the order from `beforeKey` / `afterKey`.',
379
+ event: {
380
+ row: 'The moved row object.',
381
+ rowKey: 'The moved row key.',
382
+ fromIndex: 'The index the row was at in the displayed rows, across every page.',
383
+ toIndex: 'The index the row is at now in the displayed rows, across every page.',
384
+ beforeKey: 'The key of the row now before it, or null at the top.',
385
+ afterKey: 'The key of the row now after it, or null at the bottom.',
386
+ position: "With a positionField: the moved row's new position.",
387
+ positions: 'With a positionField: `{ [rowKey]: position }` of every row whose position changed.'
388
+ }
389
+ },
390
+ onCellLink: {
391
+ description: 'Triggered when a link, avatar link or relation cell is clicked. The link navigates by itself; this event is for anything else to do.',
392
+ event: {
393
+ link: 'The resolved link: { pageId, href, urlQuery, newTab, ... }.',
394
+ row: 'The row data.',
395
+ value: 'The cell value (the related record for relation cells).'
396
+ }
397
+ },
398
+ onCellButton: {
399
+ description: 'Documentation reference - the event fired is the `eventName` of each button in a `buttons` cell. Define any number of named events on the block, such as `onEdit`.',
400
+ event: {
401
+ row: 'The row data.',
402
+ rowKey: 'The row key.',
403
+ value: 'The cell value.',
404
+ button: 'The clicked button: { eventName, title }.',
405
+ buttonIndex: 'The index of the button in `cell.buttons`.'
406
+ }
407
+ },
408
+ onCellMenuItem: {
409
+ description: 'Documentation reference - the event fired is the `eventName` of each item in a `menu` cell.',
410
+ event: {
411
+ row: 'The row data.',
412
+ rowKey: 'The row key.',
413
+ value: 'The cell value.',
414
+ item: 'The clicked item: { eventName, title }.',
415
+ itemIndex: 'The index of the item in `cell.items`.'
416
+ }
417
+ }
418
+ },
419
+ methods: {
420
+ exportCsv: 'Download the current view as CSV: visible data columns in order, every row in its current order (every page, rows of collapsed groups included). Accepts `{ filename, formatted }`; `formatted` (default true) exports displayed text. In server mode it fires `onExport { view }` instead.',
421
+ refresh: 'Server mode: clear the block cache and refetch the visible rows (they stay on screen until the new rows land).',
422
+ applyTransaction: 'Apply `{ add, update, remove, addIndex }` without replacing `data`: `update` rows are merged into the row with the same key, `remove` takes rows or row keys, `add` rows are appended (or inserted at `addIndex`). Only the touched rows re-render. In client mode the change holds until `data` changes; in server mode updates apply to the loaded rows, and adds or removes also refetch the visible rows. Returns `{ added, updated, removed }`.',
423
+ scrollToRow: 'Scroll a row into view. Accepts `{ rowKey, align }` with align `auto`, `start` or `center` (default). With pagination, only rows on the current page.',
424
+ clearSelection: 'Clear the row selection.',
425
+ setGroup: 'Group rows by these columns, outermost first. Accepts column keys or `[{ key }]` of groupable columns; an empty list removes the grouping.',
426
+ selectAllMatching: "Select every row the view matches, as `{ all: true, except: [], filter, search }` with the view's filter and search (checkbox selection only). Rows that arrive later and match are selected too; a filter or search change clears the selection.",
427
+ expandAllGroups: 'Expand every group (client data; server groups open one at a time).',
428
+ collapseAllGroups: 'Collapse every group at every level.',
429
+ setFilter: 'Set `view.filter` to a condition (`{ and | or: [...] }` groups of `{ key, op, value }` leaves), or clear it with null.',
430
+ clearFilters: 'Remove every filter condition. The search stays; clear it with `setSearch`.',
431
+ setSearch: 'Set `view.search`: rows match when every word appears in the searched columns. An empty string or null clears it.',
432
+ openColumnManager: 'Open the column manager: show, hide, reorder and pin columns, or reset them to the default view.'
433
+ },
434
+ properties: {
435
+ type: 'object',
436
+ additionalProperties: false,
437
+ properties: {
438
+ columns: {
439
+ type: [
440
+ 'array',
441
+ 'null'
442
+ ],
443
+ description: 'The columns, in default order.',
444
+ items: column,
445
+ docs: {
446
+ displayType: 'yaml'
447
+ }
448
+ },
449
+ defaultColumn: {
450
+ type: 'object',
451
+ additionalProperties: false,
452
+ description: 'Defaults applied to every column.',
453
+ properties: {
454
+ sortable: {
455
+ ...columnFlags.sortable,
456
+ default: true
457
+ },
458
+ filterable: {
459
+ ...columnFlags.filterable,
460
+ default: true
461
+ },
462
+ resizable: {
463
+ ...columnFlags.resizable,
464
+ default: true
465
+ },
466
+ groupable: {
467
+ ...columnFlags.groupable,
468
+ default: false
469
+ },
470
+ editable: {
471
+ ...columnFlags.editable,
472
+ default: false
473
+ },
474
+ ...widthProperties,
475
+ ...textLayout
476
+ }
477
+ },
478
+ data: {
479
+ type: [
480
+ 'array',
481
+ 'object',
482
+ 'null'
483
+ ],
484
+ description: 'The rows, or `{ mode: server, request, blockSize }` to load rows from a request in blocks as the table scrolls. In server mode the table fires the request with the event `{ startRow, endRow, view: { sort, filter, search, group, aggregates }, groupPath, selected }` (read it in the request `payload` with `_event`) and expects `{ rows, total, groups?, aggregates? }`, the contract of `MongoDBTableQuery`. Sorting, filtering and grouping then run on the server. Rows need a `rowKey`.',
485
+ items: {
486
+ type: 'object'
487
+ },
488
+ additionalProperties: false,
489
+ required: [
490
+ 'mode',
491
+ 'request'
492
+ ],
493
+ properties: {
494
+ mode: {
495
+ type: 'string',
496
+ enum: [
497
+ 'server'
498
+ ],
499
+ description: 'Load rows from `request`.'
500
+ },
501
+ request: {
502
+ type: 'string',
503
+ description: 'Id of the request on the page that returns `{ rows, total }`.'
504
+ },
505
+ blockSize: {
506
+ type: 'integer',
507
+ default: 200,
508
+ description: 'Rows per request. Blocks load as they scroll into view.'
509
+ },
510
+ maxBlocks: {
511
+ type: 'integer',
512
+ default: 20,
513
+ description: 'Blocks kept in the cache; the least recently used are dropped (and refetched when they come back into view).'
514
+ }
515
+ },
516
+ docs: {
517
+ displayType: 'yaml'
518
+ }
519
+ },
520
+ rowKey: {
521
+ type: 'string',
522
+ description: 'The row field that identifies each row. Defaults to `_id`, then `id`. Rows with neither get a key per row object, which does not survive a refetch.'
523
+ },
524
+ rowVersionField: {
525
+ type: 'string',
526
+ description: 'Dot path to a field that changes whenever a row changes (for example `updated.timestamp`). When set, rows are compared by key and this field instead of by content; a row without it is compared by content.'
527
+ },
528
+ user: {
529
+ type: 'object',
530
+ description: 'The user object for `$user` values in filters, `rules`, `rowRules` and button `hidden`/`disabled` conditions, usually `{ _user: true }`. Blocks do not see the session, so conditions read `$user` from this property.',
531
+ docs: {
532
+ displayType: 'yaml'
533
+ }
534
+ },
535
+ defaultView: {
536
+ type: 'object',
537
+ additionalProperties: false,
538
+ description: 'The initial and reset view. Parts missing from the table value fall back to this, then to the column defaults.',
539
+ properties: {
540
+ columns: {
541
+ type: 'array',
542
+ description: 'Column order, widths, pinning and visibility.',
543
+ items: viewColumn
544
+ },
545
+ sort: {
546
+ type: 'array',
547
+ description: 'Sort order: `[{ key, desc }]`.',
548
+ items: {
549
+ type: 'object',
550
+ additionalProperties: false,
551
+ required: [
552
+ 'key'
553
+ ],
554
+ properties: {
555
+ key: {
556
+ type: 'string'
557
+ },
558
+ desc: {
559
+ type: 'boolean'
560
+ }
561
+ }
562
+ }
563
+ },
564
+ filter: {
565
+ type: [
566
+ 'object',
567
+ 'null'
568
+ ],
569
+ description: 'Filter condition: `{ and: [...] }` / `{ or: [...] }` groups of `{ key, op, value }` leaves. Operators depend on the column type; `{ $user: path }` values read the `user` property.'
570
+ },
571
+ search: {
572
+ type: [
573
+ 'string',
574
+ 'null'
575
+ ],
576
+ description: 'Search text: rows match when every word appears (case-insensitive) in the display text of the searched columns.'
577
+ },
578
+ group: {
579
+ type: 'array',
580
+ description: 'Group rows by these columns, outermost first: `[{ key }]`. Only columns with `groupable: true` group; groups follow the sort on their column, else option order, else first appearance, and empty values group as "(Empty)" last.',
581
+ items: {
582
+ type: 'object',
583
+ additionalProperties: false,
584
+ required: [
585
+ 'key'
586
+ ],
587
+ properties: {
588
+ key: {
589
+ type: 'string'
590
+ }
591
+ }
592
+ }
593
+ },
594
+ collapsedGroups: {
595
+ type: 'array',
596
+ description: 'Keys of collapsed groups: the JSON of the group value path, for example `["lead"]` or `["EMEA","Ada"]` (empty values are `null`).',
597
+ items: {
598
+ type: 'string'
599
+ }
600
+ },
601
+ aggregates: {
602
+ type: 'object',
603
+ description: "Aggregates by column key, for example `{ amount: sum, deals: count }`, over the columns' own `aggregate`. `null` turns a column default off. Group headers show them under their columns."
604
+ },
605
+ density: {
606
+ type: 'string',
607
+ enum: [
608
+ 'compact',
609
+ 'default',
610
+ 'comfortable'
611
+ ],
612
+ description: 'Row density: compact 32px, default 40px, comfortable 52px rows. Defaults to `size`.'
613
+ },
614
+ wrap: {
615
+ type: 'boolean',
616
+ description: 'Wrap the text of text-like columns (text, email, phone, url, link, html, relation) that set no `wrap` or `ellipsis` of their own; rows grow to their content. The toolbar density control has a Wrap toggle.'
617
+ },
618
+ pageSize: {
619
+ type: 'integer',
620
+ description: 'Rows per page when pagination is on. Defaults to the `pageSize` property.'
621
+ }
622
+ }
623
+ },
624
+ rowSelection: {
625
+ type: 'object',
626
+ additionalProperties: false,
627
+ description: 'Turn on row selection. The selection is the `selected` part of the table value.',
628
+ properties: {
629
+ type: {
630
+ type: 'string',
631
+ enum: [
632
+ 'checkbox',
633
+ 'radio'
634
+ ],
635
+ default: 'checkbox',
636
+ description: 'Multiple (checkbox) or single (radio) selection.'
637
+ },
638
+ preserve: {
639
+ type: 'boolean',
640
+ default: false,
641
+ description: 'Keep selected keys of rows that leave `data`. Always on in server mode.'
642
+ },
643
+ cascade: {
644
+ type: 'boolean',
645
+ default: false,
646
+ description: 'In a tree, selecting or clearing a row also selects or clears all its descendants.'
647
+ }
648
+ }
649
+ },
650
+ tree: {
651
+ type: 'object',
652
+ additionalProperties: false,
653
+ description: 'Show rows as a tree (client data only): rows are indented under their parent with an expand chevron in the first column, Right and Left expand and collapse, sorting sorts within each level and a filter keeps the ancestors of matching rows. The expanded row keys are the `expanded` part of the table value. Give exactly one of `childrenField` or `parentField`.',
654
+ properties: {
655
+ childrenField: {
656
+ type: 'string',
657
+ description: "Dot path to each row's child rows (nested data)."
658
+ },
659
+ parentField: {
660
+ type: 'string',
661
+ description: "Dot path to the row key of each row's parent (flat data). Rows whose parent is not in `data` are roots."
662
+ },
663
+ lazy: {
664
+ type: 'boolean',
665
+ default: false,
666
+ description: 'Load children on demand: rows whose `hasChildrenField` is true show a chevron before their children are loaded, expanding a row fires `onRowExpand` with `needsChildren: true` until its children are in `data`, and the app adds them (for example a request whose result is merged into the data with `parentField` set).'
667
+ },
668
+ hasChildrenField: {
669
+ type: 'string',
670
+ default: 'hasChildren',
671
+ description: 'With `lazy`, the field that marks rows with children that are not loaded yet.'
672
+ },
673
+ indent: {
674
+ type: 'number',
675
+ default: 20,
676
+ description: 'Indent per level in pixels.'
677
+ }
678
+ }
679
+ },
680
+ expandable: {
681
+ type: 'object',
682
+ additionalProperties: false,
683
+ description: 'Expandable rows: a chevron in the first column opens a detail row below the row, as high as its content. The expanded row keys are the `expanded` part of the table value.',
684
+ properties: {
685
+ template: {
686
+ type: 'string',
687
+ description: 'Nunjucks HTML for the detail row, rendered with `row` and `rowKey`. Output is escaped: use `| safe` to insert HTML from a field. The HTML is sanitised.'
688
+ },
689
+ rowExpandable: {
690
+ type: 'object',
691
+ additionalProperties: false,
692
+ description: 'Which rows can expand.',
693
+ properties: {
694
+ when: {
695
+ type: 'object',
696
+ description: 'A condition (`{ key, op, value }`, or `and` / `or` lists) tested against the row.'
697
+ }
698
+ }
699
+ }
700
+ }
701
+ },
702
+ rowLink: {
703
+ type: 'object',
704
+ additionalProperties: false,
705
+ description: 'Make rows links. A plain click navigates, Cmd/Ctrl or middle click opens a new tab, and Enter on a focused row follows it. Values in `urlQuery` are row paths.',
706
+ properties: {
707
+ pageId: {
708
+ type: 'string',
709
+ description: 'The page to open.'
710
+ },
711
+ href: {
712
+ type: 'string',
713
+ description: 'A URL to open instead of a page.'
714
+ },
715
+ urlQuery: {
716
+ type: 'object',
717
+ description: 'Query parameters; each value is a path in the row, like `{ _id: _id }`.',
718
+ docs: {
719
+ displayType: 'yaml'
720
+ }
721
+ },
722
+ input: {
723
+ type: 'object',
724
+ description: 'Input for the page.',
725
+ docs: {
726
+ displayType: 'yaml'
727
+ }
728
+ },
729
+ newTab: {
730
+ type: 'boolean',
731
+ description: 'Always open in a new tab.'
732
+ }
733
+ }
734
+ },
735
+ rowRules: {
736
+ type: 'array',
737
+ items: {
738
+ type: 'object'
739
+ },
740
+ description: 'Conditional row formatting: `[{ when, className, style, color }]`, where `when` conditions name columns by `key`.',
741
+ docs: {
742
+ displayType: 'yaml'
743
+ }
744
+ },
745
+ size: {
746
+ type: 'string',
747
+ enum: [
748
+ 'compact',
749
+ 'default',
750
+ 'comfortable'
751
+ ],
752
+ default: 'default',
753
+ description: 'Row density: compact 32px, default 40px, comfortable 52px rows. The view starts at this density (`view.density` overrides it).'
754
+ },
755
+ bordered: {
756
+ type: 'boolean',
757
+ default: false,
758
+ description: 'Draw borders between cells.'
759
+ },
760
+ height: {
761
+ type: [
762
+ 'number',
763
+ 'string'
764
+ ],
765
+ description: 'A fixed table height (px number or CSS size); the rows scroll under a sticky header and the summary row stays in view. Without it the table grows with its rows up to `maxHeight`.',
766
+ docs: {
767
+ displayType: 'number'
768
+ }
769
+ },
770
+ maxHeight: {
771
+ type: [
772
+ 'number',
773
+ 'string'
774
+ ],
775
+ default: 600,
776
+ description: 'Maximum height when `height` is not set.'
777
+ },
778
+ rowHeight: {
779
+ type: 'number',
780
+ description: 'Row height in pixels. Overrides the density height.'
781
+ },
782
+ virtual: {
783
+ enum: [
784
+ 'auto',
785
+ true,
786
+ false
787
+ ],
788
+ default: 'auto',
789
+ description: 'Virtualise rows and columns. `auto` virtualises rows above 200 and columns above 20 or when the table is wider than twice its viewport.'
790
+ },
791
+ stickyHeader: {
792
+ type: 'boolean',
793
+ default: true,
794
+ description: 'Keep the header visible while the table scrolls.'
795
+ },
796
+ rowDrag: {
797
+ type: [
798
+ 'boolean',
799
+ 'object'
800
+ ],
801
+ description: 'Reorder rows by dragging a handle in a leading column, or with Alt+Shift+ArrowUp/Down on a focused row. Not available while the table is sorted (except ascending by the position field), filtered or grouped, in a tree or in server mode; the handle is disabled with a tooltip saying why. Table fires onRowMove; TableInput records the move in its value. `true`, or `{ positionField }` for fractional positions.',
802
+ additionalProperties: false,
803
+ properties: {
804
+ positionField: {
805
+ type: 'string',
806
+ description: 'Dot path of a numeric position field the rows are ordered by. A move gives only the moved row a new position: the midpoint of its new neighbours (a neighbour ∓ 1024 at the ends), renumbering the list in steps of 1024 only when there is no room left.'
807
+ }
808
+ }
809
+ },
810
+ headerMenu: {
811
+ type: 'boolean',
812
+ default: true,
813
+ description: 'Show the column menu button in each header (on hover or focus): sort, filter, pin, freeze, autosize, hide and the column manager.'
814
+ },
815
+ reorderable: {
816
+ type: 'boolean',
817
+ default: true,
818
+ description: 'Reorder columns by dragging their headers.'
819
+ },
820
+ keyboard: {
821
+ type: [
822
+ 'boolean',
823
+ 'object'
824
+ ],
825
+ default: true,
826
+ description: 'Keyboard navigation between cells. Grid roles stay on when off, and so do Ctrl/Cmd+C copy and the keys of a focused group header. An object turns it on with options.',
827
+ additionalProperties: false,
828
+ properties: {
829
+ next: {
830
+ type: 'boolean',
831
+ default: false,
832
+ description: 'After a row button, menu item or single-key action completes, move focus to the next row (queue and triage lists).'
833
+ }
834
+ }
835
+ },
836
+ toolbar: {
837
+ type: [
838
+ 'boolean',
839
+ 'object'
840
+ ],
841
+ default: false,
842
+ description: 'The toolbar above the table. `true` turns on every item; an object turns on the listed items.',
843
+ additionalProperties: false,
844
+ properties: {
845
+ views: toolbarItem('Saved view tabs (needs `views`), with the unsaved changes strip.'),
846
+ search: toolbarItem('A search box that writes `view.search` (Cmd/Ctrl+F focuses it while the table has focus).'),
847
+ quickFilters: {
848
+ type: 'array',
849
+ items: {
850
+ type: 'string'
851
+ },
852
+ description: 'Column keys to show as quick filter chips. Columns with `options` get a checkbox list (an `in` condition); others open the column filter.'
853
+ },
854
+ filter: toolbarItem('A Filter button that edits the whole `view.filter`.'),
855
+ sort: toolbarItem('A Sort button to add, remove, reorder and flip sort levels.'),
856
+ group: toolbarItem('A Group button to pick and order group levels (groupable columns).'),
857
+ columns: toolbarItem('A Columns button that opens the column manager.'),
858
+ density: toolbarItem('A compact / default / comfortable density toggle, with a Wrap toggle for `view.wrap`.'),
859
+ export: toolbarItem('An Export button that downloads the view as CSV.')
860
+ }
861
+ },
862
+ views: {
863
+ type: [
864
+ 'array',
865
+ 'null'
866
+ ],
867
+ description: 'Saved views, from any source (often a request). Selecting a tab loads its view; changes show an unsaved changes strip with Save, Save as and Discard.',
868
+ items: {
869
+ type: 'object',
870
+ required: [
871
+ 'id'
872
+ ],
873
+ properties: {
874
+ id: {
875
+ type: [
876
+ 'string',
877
+ 'number',
878
+ 'object'
879
+ ],
880
+ description: 'Unique view id: a string, number, or an ObjectId from a MongoDB request (`{ _oid }`, keyed by its hex). Events carry it as given.'
881
+ },
882
+ title: {
883
+ type: 'string',
884
+ description: 'Tab title. Defaults to the id.'
885
+ },
886
+ view: {
887
+ type: 'object',
888
+ description: 'The saved view (any part of a view).'
889
+ },
890
+ shared: {
891
+ type: 'boolean',
892
+ description: 'Whether the view is shared.'
893
+ },
894
+ locked: {
895
+ type: 'boolean',
896
+ description: 'Hide Save and Delete, so the view is only changed on purpose.'
897
+ },
898
+ count: {
899
+ type: 'number',
900
+ description: 'A count shown on the tab (queue tabs).'
901
+ }
902
+ }
903
+ }
904
+ },
905
+ activeView: {
906
+ type: [
907
+ 'string',
908
+ 'number',
909
+ 'object',
910
+ 'null'
911
+ ],
912
+ description: 'The id of the active saved view (an ObjectId id matches by its hex). Defaults to the first view. Changing it selects that view.'
913
+ },
914
+ persist: {
915
+ type: 'object',
916
+ additionalProperties: false,
917
+ required: [
918
+ 'key'
919
+ ],
920
+ description: "Keep the user's view between visits. Off by default. The selection is never persisted.",
921
+ properties: {
922
+ key: {
923
+ type: 'string',
924
+ description: 'Storage key (localStorage) or query parameter name (url).'
925
+ },
926
+ storage: {
927
+ type: 'string',
928
+ enum: [
929
+ 'local',
930
+ 'url'
931
+ ],
932
+ default: 'local',
933
+ description: '`local` keeps the view in localStorage (none in a private window or with blocked storage); `url` writes a compact encoding to the query string, replacing history.'
934
+ }
935
+ }
936
+ },
937
+ emptyText: {
938
+ type: 'string',
939
+ default: 'No data',
940
+ description: 'What to show when there are no rows - supports html.'
941
+ },
942
+ loading: {
943
+ type: 'boolean',
944
+ default: false,
945
+ description: 'Show the loading state: skeleton rows without data, a progress bar with it.'
946
+ },
947
+ pagination: {
948
+ type: 'boolean',
949
+ default: false,
950
+ description: 'Show the rows in pages of `pageSize` with a pager below the table. Off by default, unlike TableLight: the Table scrolls any number of rows virtually. `true` means what it means on TableLight: pages, with the pager always shown.'
951
+ },
952
+ pageSize: {
953
+ type: 'integer',
954
+ default: 50,
955
+ description: 'Rows per page when `pagination` is on (`view.pageSize` overrides it).'
956
+ },
957
+ summary: {
958
+ type: 'boolean',
959
+ default: true,
960
+ description: 'Show the summary footer when any aggregate is in effect: a column `aggregate`, or one the view sets in `view.aggregates`. `false` hides it.'
961
+ }
962
+ }
963
+ }
964
+ };