@guiexpert/table 1.1.90 → 1.1.92

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 (217) hide show
  1. package/README.md +8 -2
  2. package/css/main.css +129 -4
  3. package/css/table-classes.css +93 -0
  4. package/css/table-color-classes.css +3 -1
  5. package/css/table-color-vars.css +20 -2
  6. package/css/table-tree.css +13 -1
  7. package/index.cjs +111 -96
  8. package/index.d.ts +203 -184
  9. package/index.js +4927 -2096
  10. package/lib/common/debounce.d.ts +1 -0
  11. package/lib/common/decorator/avoid-double-execution.decorator.d.ts +2 -0
  12. package/lib/common/escape-html.d.ts +22 -0
  13. package/lib/common/generator/column-def-generator-service.d.ts +2 -1
  14. package/lib/common/generator/domain/property-type.d.ts +19 -0
  15. package/lib/common/generator/domain/value-info.d.ts +2 -1
  16. package/lib/common/generator/json-service.d.ts +1 -0
  17. package/lib/common/generator/property-type.service.d.ts +3 -2
  18. package/lib/common/generator/scheme-generator-service.d.ts +3 -1
  19. package/lib/common/generator/string-util.d.ts +7 -0
  20. package/lib/common/throttle.d.ts +1 -0
  21. package/lib/table/action/action-id.type.d.ts +5 -1
  22. package/lib/table/action/on-action-triggered.if.d.ts +2 -1
  23. package/lib/table/action/osx-shortcut-actionId-mapping.d.ts +3 -1
  24. package/lib/table/action/shortcut-actionid-mapping.type.d.ts +3 -1
  25. package/lib/table/action/shortcut-util.d.ts +12 -0
  26. package/lib/table/action/shortcut.service.d.ts +5 -3
  27. package/lib/table/action/windows-shortcut-actionId-mapping.d.ts +3 -1
  28. package/lib/table/aria/aria-grid-info.d.ts +76 -0
  29. package/lib/table/aria/aria-ids.d.ts +56 -0
  30. package/lib/table/aria/aria-texts.d.ts +34 -0
  31. package/lib/table/aria/aria-texts.if.d.ts +88 -0
  32. package/lib/table/aria/live-announcer.d.ts +62 -0
  33. package/lib/table/aria/tree-aria-info.d.ts +58 -0
  34. package/lib/table/checkbox/all-rows-checkbox-model.d.ts +31 -0
  35. package/lib/table/checkbox/checkbox-model.d.ts +3 -2
  36. package/lib/table/checkbox/checkbox-model.if.d.ts +2 -1
  37. package/lib/table/checkbox/tree-checkbox-model.d.ts +19 -4
  38. package/lib/table/color/color-rgb.d.ts +2 -1
  39. package/lib/table/color/color-rgb.if.d.ts +2 -0
  40. package/lib/table/color/ge-css-color-util.d.ts +25 -2
  41. package/lib/table/color/three-color-gradient-arg.d.ts +3 -2
  42. package/lib/table/color/three-color-gradient-arg.if.d.ts +3 -1
  43. package/lib/table/color/two-color-gradient-arg.d.ts +3 -2
  44. package/lib/table/color/two-color-gradient-arg.if.d.ts +3 -1
  45. package/lib/table/crud/column-widths.d.ts +2 -1
  46. package/lib/table/crud/column-widths.if.d.ts +1 -0
  47. package/lib/table/crud/crud-action.d.ts +1 -0
  48. package/lib/table/crud/crud-object-edit.d.ts +25 -3
  49. package/lib/table/crud/crud-object-view.d.ts +6 -0
  50. package/lib/table/crud/crud-options.d.ts +35 -4
  51. package/lib/table/crud/crud-options.if.d.ts +3 -2
  52. package/lib/table/crud/crud-table-model-factory.d.ts +72 -8
  53. package/lib/table/crud/url-info.d.ts +2 -1
  54. package/lib/table/crud/url-info.if.d.ts +1 -0
  55. package/lib/table/crud/urls.if.d.ts +2 -1
  56. package/lib/table/css-vars.d.ts +1 -0
  57. package/lib/table/data/chunk/chunk.data-event.d.ts +3 -2
  58. package/lib/table/data/chunk/chunk.data-event.if.d.ts +2 -1
  59. package/lib/table/data/chunk/request-chunk.d.ts +2 -1
  60. package/lib/table/data/chunk/request-chunk.if.d.ts +1 -0
  61. package/lib/table/data/common/aligns.d.ts +18 -0
  62. package/lib/table/data/common/area-map-factory.d.ts +3 -2
  63. package/lib/table/data/common/area-map.d.ts +3 -1
  64. package/lib/table/data/common/area-map.type.d.ts +1 -0
  65. package/lib/table/data/common/args-adjust-columns-to-row-parent-params.d.ts +6 -4
  66. package/lib/table/data/common/args-render-cell-div.d.ts +5 -3
  67. package/lib/table/data/common/boolean-function.d.ts +10 -0
  68. package/lib/table/data/common/cell-range.d.ts +16 -7
  69. package/lib/table/data/common/checkbox-column-def.d.ts +6 -4
  70. package/lib/table/data/common/checked-type.d.ts +2 -0
  71. package/lib/table/data/common/event/ge-cell-indices.d.ts +2 -0
  72. package/lib/table/data/common/event/ge-key-event.d.ts +2 -0
  73. package/lib/table/data/common/event/ge-model-change-event.d.ts +16 -2
  74. package/lib/table/data/common/event/ge-mouse-event.d.ts +52 -4
  75. package/lib/table/data/common/event/ge-scroll-event.d.ts +27 -1
  76. package/lib/table/data/common/event/ge-state-change-event.d.ts +30 -0
  77. package/lib/table/data/common/event/input/table-cell-update-event.d.ts +14 -10
  78. package/lib/table/data/common/event/input/table-cell-update-event.if.d.ts +3 -1
  79. package/lib/table/data/common/filter-function.d.ts +2 -0
  80. package/lib/table/data/common/get-t.d.ts +2 -0
  81. package/lib/table/data/common/index-and-px.d.ts +2 -0
  82. package/lib/table/data/common/size-unit.type.d.ts +2 -0
  83. package/lib/table/data/common/size.d.ts +13 -2
  84. package/lib/table/data/common/size.if.d.ts +3 -1
  85. package/lib/table/data/common/sizes.d.ts +133 -1
  86. package/lib/table/data/common/sort-item.d.ts +16 -3
  87. package/lib/table/data/common/sort-state.type.d.ts +2 -0
  88. package/lib/table/data/common/tree-arrow.type.d.ts +2 -0
  89. package/lib/table/data/common/tree-row-if.d.ts +22 -1
  90. package/lib/table/data/common/tree-row.d.ts +3 -1
  91. package/lib/table/data/common/value-label.d.ts +2 -1
  92. package/lib/table/data/common/value-label.if.d.ts +1 -0
  93. package/lib/table/data/div-scope.type.d.ts +2 -0
  94. package/lib/table/data/event/mouse-target-data.d.ts +5 -3
  95. package/lib/table/data/geo-data.d.ts +2 -0
  96. package/lib/table/data/options/auto-restore-options.d.ts +44 -1
  97. package/lib/table/data/options/auto-restore-options.if.d.ts +95 -45
  98. package/lib/table/data/options/default-row-heights.d.ts +20 -2
  99. package/lib/table/data/options/default-row-heights.if.d.ts +4 -1
  100. package/lib/table/data/options/default-row-id.d.ts +4 -0
  101. package/lib/table/data/options/header-group-options.d.ts +3 -2
  102. package/lib/table/data/options/header-group-options.if.d.ts +3 -4
  103. package/lib/table/data/options/icon.d.ts +2 -1
  104. package/lib/table/data/options/icon.if.d.ts +2 -0
  105. package/lib/table/data/options/overlay-options.d.ts +30 -0
  106. package/lib/table/data/options/overlay-options.if.d.ts +79 -0
  107. package/lib/table/data/options/sorted-options.d.ts +3 -2
  108. package/lib/table/data/options/sorted-options.if.d.ts +3 -1
  109. package/lib/table/data/options/table-options.d.ts +40 -13
  110. package/lib/table/data/options/table-options.if.d.ts +152 -44
  111. package/lib/table/data/options/tree-options.d.ts +3 -2
  112. package/lib/table/data/options/tree-options.if.d.ts +3 -1
  113. package/lib/table/data/side-ident.type.d.ts +2 -0
  114. package/lib/table/data/table-model-and-options.d.ts +5 -3
  115. package/lib/table/data/table-model-and-options.if.d.ts +4 -2
  116. package/lib/table/data/tablemodel/area-ident.type.d.ts +4 -0
  117. package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +10 -9
  118. package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +13 -4
  119. package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +44 -12
  120. package/lib/table/data/tablemodel/areamodel/area-model-hidden.d.ts +9 -7
  121. package/lib/table/data/tablemodel/areamodel/area-model-object-array-with-columndefs.d.ts +16 -14
  122. package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +48 -31
  123. package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +162 -11
  124. package/lib/table/data/tablemodel/areamodel/area-model.d.ts +66 -104
  125. package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +75 -50
  126. package/lib/table/data/tablemodel/areamodel/async-area-model-object-array.d.ts +5 -5
  127. package/lib/table/data/tablemodel/areamodel/col-and-rowspan-model.d.ts +14 -3
  128. package/lib/table/data/tablemodel/areamodel/cover-grid-body-model.d.ts +17 -8
  129. package/lib/table/data/tablemodel/areamodel/has-default-row-height-if.d.ts +1 -0
  130. package/lib/table/data/tablemodel/areamodel/object-array-holder.if.d.ts +1 -0
  131. package/lib/table/data/tablemodel/cellgroup/cell-group-ext.d.ts +3 -2
  132. package/lib/table/data/tablemodel/cellgroup/cell-group.d.ts +4 -1
  133. package/lib/table/data/tablemodel/cellgroup/cell-group.if.d.ts +34 -0
  134. package/lib/table/data/tablemodel/cellgroup/cellgroup-factory.d.ts +4 -3
  135. package/lib/table/data/tablemodel/column/column-def.d.ts +67 -10
  136. package/lib/table/data/tablemodel/column/column-def.if.d.ts +63 -96
  137. package/lib/table/data/tablemodel/column/column-visibility.d.ts +11 -0
  138. package/lib/table/data/tablemodel/cover-grid-table-model.d.ts +11 -10
  139. package/lib/table/data/tablemodel/padding.d.ts +2 -0
  140. package/lib/table/data/tablemodel/table-model.d.ts +75 -14
  141. package/lib/table/data/tablemodel/table-model.if.d.ts +52 -8
  142. package/lib/table/ele-scope.d.ts +53 -5
  143. package/lib/table/event-adapter.d.ts +20 -10
  144. package/lib/table/event-checkbox-changed-handler.d.ts +2 -1
  145. package/lib/table/event-listener.if.d.ts +50 -9
  146. package/lib/table/factory/cover-grid-factory.d.ts +4 -3
  147. package/lib/table/factory/table-factory.d.ts +103 -64
  148. package/lib/table/factory/tree-factory.d.ts +45 -3
  149. package/lib/table/focus/event-focus-changed-listener.if.d.ts +5 -3
  150. package/lib/table/focus/focus-model.d.ts +7 -5
  151. package/lib/table/focus/focus-model.if.d.ts +22 -1
  152. package/lib/table/focus/focus.type.d.ts +2 -0
  153. package/lib/table/input-handler.d.ts +5 -1
  154. package/lib/table/instanceof-workaround.d.ts +16 -0
  155. package/lib/table/license-manager.d.ts +2 -0
  156. package/lib/table/mouse-handler.d.ts +20 -9
  157. package/lib/table/overlay/calc-overlay-kind.d.ts +31 -0
  158. package/lib/table/overlay/ge-overlay-kind.type.d.ts +17 -0
  159. package/lib/table/overlay/table-overlay.d.ts +108 -0
  160. package/lib/table/render-scope.d.ts +141 -27
  161. package/lib/table/renderer/action/action-event-listener.if.d.ts +2 -1
  162. package/lib/table/renderer/action/action-event.d.ts +4 -3
  163. package/lib/table/renderer/action/action-event.if.d.ts +2 -1
  164. package/lib/table/renderer/action/actions-cell-renderer.d.ts +8 -7
  165. package/lib/table/renderer/cell-group-ext-cell-renderer.d.ts +8 -7
  166. package/lib/table/renderer/cell-render.if.d.ts +41 -4
  167. package/lib/table/renderer/checkbox-boolean-property-cell-renderer.d.ts +7 -5
  168. package/lib/table/renderer/checkbox-cell-renderer.d.ts +8 -5
  169. package/lib/table/renderer/date-to-int-date-cell-renderer.d.ts +6 -5
  170. package/lib/table/renderer/date-to-iso-cell-renderer.d.ts +6 -5
  171. package/lib/table/renderer/date-to-locale-date-cell-renderer.d.ts +6 -5
  172. package/lib/table/renderer/date-to-tec-cell-renderer.d.ts +6 -5
  173. package/lib/table/renderer/edit/edit-cell-renderer.type.d.ts +2 -1
  174. package/lib/table/renderer/edit/edit-input-pipe-for-number.d.ts +2 -1
  175. package/lib/table/renderer/edit/edit-input-pipe.if.d.ts +2 -0
  176. package/lib/table/renderer/edit/input-cell-renderer.d.ts +6 -5
  177. package/lib/table/renderer/edit/select-cell-renderer.d.ts +7 -6
  178. package/lib/table/renderer/male-female-to-icon-cell-renderer.d.ts +19 -6
  179. package/lib/table/renderer/number-cell-progress-bar-cell-renderer.d.ts +11 -6
  180. package/lib/table/renderer/number-cell-renderer.d.ts +6 -5
  181. package/lib/table/renderer/positive-and-negative-number-renderer.d.ts +6 -5
  182. package/lib/table/renderer/progress-bar-cell-renderer.d.ts +12 -6
  183. package/lib/table/renderer/renderer-cleanup-fn.type.d.ts +1 -0
  184. package/lib/table/renderer/renderer.d.ts +3 -2
  185. package/lib/table/renderer/simple-array-cell-renderer.d.ts +6 -5
  186. package/lib/table/renderer/star-rating-cell-renderer.d.ts +12 -6
  187. package/lib/table/renderer/true-false-cell-renderer.d.ts +17 -5
  188. package/lib/table/resize-handler.d.ts +3 -1
  189. package/lib/table/selection/event-selection-changed-listener.if.d.ts +2 -1
  190. package/lib/table/selection/multi-rows-selection-model.d.ts +7 -4
  191. package/lib/table/selection/selection-model.d.ts +112 -10
  192. package/lib/table/selection/selection-model.if.d.ts +48 -3
  193. package/lib/table/selection/selection-service.d.ts +35 -7
  194. package/lib/table/selection/selection.type.d.ts +3 -0
  195. package/lib/table/service/abstract-store-state.service.d.ts +1 -1
  196. package/lib/table/service/convenience-dom.service.d.ts +37 -14
  197. package/lib/table/service/copy-service.d.ts +18 -4
  198. package/lib/table/service/copy-service.if.d.ts +4 -3
  199. package/lib/table/service/data/collapsed-expanded.data.d.ts +1 -0
  200. package/lib/table/service/data/html-style.type.d.ts +1 -0
  201. package/lib/table/service/dom-service.if.d.ts +30 -0
  202. package/lib/table/service/excel-service.d.ts +24 -1
  203. package/lib/table/service/excel-service.if.d.ts +7 -0
  204. package/lib/table/service/ge-filter.service.d.ts +1 -0
  205. package/lib/table/service/simple-dom-service.d.ts +3 -1
  206. package/lib/table/service/store-state-collapsed-expand.service.d.ts +4 -3
  207. package/lib/table/service/store-state-scroll-pos.service.d.ts +3 -2
  208. package/lib/table/service/store-state-sorting.service.d.ts +4 -3
  209. package/lib/table/service/tree-row.service.d.ts +5 -1
  210. package/lib/table/state/state-storage.if.d.ts +39 -0
  211. package/lib/table/state/table-state-migration.d.ts +36 -0
  212. package/lib/table/state/table-state-part.d.ts +13 -0
  213. package/lib/table/state/table-state.if.d.ts +181 -0
  214. package/lib/table/state/table-state.service.d.ts +158 -0
  215. package/lib/table/table-api.d.ts +450 -550
  216. package/lib/table/table-scope.d.ts +288 -114
  217. package/package.json +23 -8
@@ -1,13 +1,34 @@
1
1
  /**
2
- * Represents a (table) row in a tree structure. It's a container object for T with additional tree node information.@template T - The type of data stored in each row.
2
+ * A row of a tree table: your object (`data`) plus the tree state. Created by {@link TreeFactory.buildTreeRows}.
3
+ *
4
+ * @typeParam T - the type of your objects
5
+ *
6
+ * @example
7
+ * // expand all first-level rows: change `expanded`, rebuild the displayed rows, repaint
8
+ * const treeModel = tableModel.getBodyModel() as AreaModelTree<OrderNode>;
9
+ * for (const row of treeModel.rows) row.expanded = true;
10
+ * treeModel.recalcVisibleTreeRows(); // without it the table keeps showing the old rows
11
+ * tableApi.repaintHard();
12
+ *
13
+ * @see Training: [Tree table with checkboxes](https://gui.expert/training/tree-table/)
14
+ *
15
+ * @category Tree & checkboxes
3
16
  */
4
17
  export interface TreeRowIf<T> {
18
+ /** Marker to recognise tree rows across package boundaries (see `isTreeRow()`). */
5
19
  type?: 'TreeRow' | '';
20
+ /** Your object. Column values are read from it (`columnDef.property`). */
6
21
  data: T;
22
+ /** Are the children visible? */
7
23
  expanded: boolean;
24
+ /** The child rows, undefined for leaves. */
8
25
  children: TreeRowIf<T>[] | undefined;
26
+ /** The parent row, undefined on the top level. */
9
27
  parent: TreeRowIf<T> | undefined;
28
+ /** Depth in the tree: 0 = top level. */
10
29
  deep: number;
30
+ /** Checkbox state (with `showCheckboxWihoutExtraColumn` or a checkbox column). */
11
31
  checked: boolean;
32
+ /** Internal, set by the filter: the row or one of its descendants matches (also below collapsed rows). */
12
33
  keep: boolean;
13
34
  }
@@ -1,8 +1,10 @@
1
- import { TreeRowIf } from './tree-row-if';
1
+ import { TreeRowIf } from './tree-row-if.js';
2
2
 
3
3
  /**
4
4
  * Represents a (table) row in a tree structure. It's a container object for T with additional tree node information.
5
5
  * @template T - The type of data stored in the row.
6
+ *
7
+ * @category Tree & checkboxes
6
8
  */
7
9
  export declare class TreeRow<T> implements TreeRowIf<T> {
8
10
  data: T;
@@ -1,5 +1,6 @@
1
- import { ValueLabelIf } from './value-label.if';
1
+ import { ValueLabelIf } from './value-label.if.js';
2
2
 
3
+ /** @category Columns */
3
4
  export declare class ValueLabel implements ValueLabelIf {
4
5
  value: any;
5
6
  label: string;
@@ -1,3 +1,4 @@
1
+ /** @category Columns */
1
2
  export interface ValueLabelIf {
2
3
  value: any;
3
4
  label: string;
@@ -6,6 +6,8 @@
6
6
  * child: HTMLDivElement,
7
7
  * cache: { [key: number]: HTMLDivElement }
8
8
  * }} DivScope
9
+ *
10
+ * @category Area models
9
11
  */
10
12
  export type DivScope = {
11
13
  parent: HTMLDivElement;
@@ -1,6 +1,6 @@
1
- import { AreaIdent } from '../tablemodel/area-ident.type';
2
- import { AreaModelIf } from '../tablemodel/areamodel/area-model.if';
3
- import { TableScope } from '../../table-scope';
1
+ import { AreaIdent } from '../tablemodel/area-ident.type.js';
2
+ import { AreaModelIf } from '../tablemodel/areamodel/area-model.if.js';
3
+ import { TableScope } from '../../table-scope.js';
4
4
 
5
5
  /**
6
6
  * The MouseTargetData class is used to process and provide information about user interaction, especially mouse events, with specific areas and elements of a table built using HTML Div elements, Span elements, and Input elements.
@@ -25,6 +25,8 @@ import { TableScope } from '../../table-scope';
25
25
  *
26
26
  * @example
27
27
  * const mouseTarget = new MouseTargetData(eventTarget, tableScope);
28
+ *
29
+ * @category Internals
28
30
  */
29
31
  export declare class MouseTargetData {
30
32
  rowIdx: number;
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Represents geometric data with left, width, height, top coordinates and an optional index.
3
+ *
4
+ * @category Utilities
3
5
  */
4
6
  export declare class GeoData {
5
7
  left: number;
@@ -1,12 +1,55 @@
1
- import { AutoRestoreOptionsIf } from './auto-restore-options.if';
1
+ import { AutoRestoreOptionsIf } from './auto-restore-options.if.js';
2
2
 
3
+ /**
4
+ * Defaults for {@link TableOptionsIf.autoRestoreOptions}: everything off. Spread it and switch on what the table
5
+ * should remember in `localStorage` (one key per table) – see {@link AutoRestoreOptionsIf} for all flags.
6
+ *
7
+ * @example
8
+ * const tableOptions: TableOptionsIf = {
9
+ * ...new TableOptions(),
10
+ * autoRestoreOptions: {
11
+ * ...new AutoRestoreOptions<Order>(),
12
+ * getStorageKeyFn: () => "orders-table", // unique per table
13
+ * autoRestoreSortingState: true,
14
+ * autoRestoreScrollPosition: true,
15
+ * autoRestoreColumnLayout: true // widths, order, visibility (since 1.1.92)
16
+ * }
17
+ * };
18
+ *
19
+ * @example
20
+ * // trees: remember expanded nodes – needs a stable id per node
21
+ * const treeOptions: TableOptionsIf = {
22
+ * ...new TableOptions(),
23
+ * autoRestoreOptions: {
24
+ * ...new AutoRestoreOptions<OrderNode>(),
25
+ * getStorageKeyFn: () => "order-tree",
26
+ * getRowId: (node: OrderNode) => node.id,
27
+ * autoRestoreCollapsedExpandedState: true
28
+ * }
29
+ * };
30
+ *
31
+ * @see Training: [Remember the state](https://gui.expert/training/persist-state/)
32
+ *
33
+ * @category Options
34
+ */
3
35
  export declare class AutoRestoreOptions<T> implements AutoRestoreOptionsIf<T> {
4
36
  autoRestoreSortingState: boolean;
5
37
  autoRestoreCollapsedExpandedState: boolean;
6
38
  autoRestoreScrollPosition: boolean;
7
39
  autoRestoreCheckedState: boolean;
8
40
  autoRestoreSelectedState: boolean;
41
+ /** @since 1.1.92 */
42
+ autoRestoreColumnLayout: boolean;
43
+ /** @since 1.1.92 */
44
+ autoRestoreHeaderGroupState: boolean;
45
+ /** @since 1.1.92 */
46
+ autoRestoreCustomState: boolean;
9
47
  getStorageKeyFn: undefined;
48
+ /** @deprecated since 1.1.92 – never used by the table. */
10
49
  isSame: (r1: T, r2: T, options: AutoRestoreOptionsIf<T>) => boolean;
50
+ /**
51
+ * Default: the property `id`, then `uuid`, then the JSON of the row. The table itself uses only `id` / `uuid` of
52
+ * this default (since 1.1.92): rows without them are not stored – the JSON would write whole rows into the storage.
53
+ */
11
54
  getRowId: (row: T) => string | number;
12
55
  }
@@ -1,73 +1,123 @@
1
+ import { StateStorageIf } from '../../state/state-storage.if.js';
2
+
1
3
  /**
2
- * `IsSameFn` is a type alias for a function used within the `AutoRestoreOptionsIf` interface. The function is designed to compare
3
- * two instances of a generic type `T`, in conjunction with supplied options of type `AutoRestoreOptionsIf<T>`.
4
+ * `IsSameFn` compares two rows with the help of {@link AutoRestoreOptionsIf.getRowId}.
4
5
  *
5
- * This function is used for determining if two instances of `T` are considered the same when restoring the state of an application.
6
- * This helps in preserving specific states of the application, like sorting or selected state, across different stages or conditions
7
- * based on the developer's implementation. By default, this function uses strict equality check (`===`) if not provided.
6
+ * @deprecated since 1.1.92 – never used by the table; rows are compared by {@link AutoRestoreOptionsIf.getRowId}.
8
7
  *
9
- * @typedef
10
- * @typeparam T - The type of the objects that the function is comparing.
11
- *
12
- * @param {T} r1 - The first object instance of type `T`.
13
- * @param {T} r2 - The second object instance of type `T`.
14
- * @param {AutoRestoreOptionsIf<T>} optionsIf - The options that dictate the behavior of auto-restoring.
15
- *
16
- * @returns {boolean} - Returns `true` if the two instances are considered the same, `false` otherwise.
8
+ * @typeparam T - The type of the rows.
9
+ * @category Options
17
10
  */
18
11
  export type IsSameFn<T> = (r1: T, r2: T, optionsIf: AutoRestoreOptionsIf<T>) => boolean;
19
12
  /**
20
- * GetRowIdFn is a type alias for a function that accepts an instance of type T and returns a unique identifier
21
- * (either a string or a number) for that instance. It is used for restoring state in conjunction with the
22
- * AutoRestoreOptionsIf interface.
23
- * @typedef
24
- * @typeparam T - The type of the object that the function is going to use.
13
+ * Returns a unique, stable id for a row – used to remember expanded tree nodes, checked and selected rows and the
14
+ * first visible row ({@link AutoRestoreOptionsIf}, {@link TableStateIf}).
15
+ *
16
+ * Tree tables get the object of the node (`treeRow.data`). Models without row objects (e.g. an own `AreaModel`
17
+ * that computes its values) get `undefined` and the displayed row index – declare the second parameter to support
18
+ * them: `(_row, rowIndex) => rowIndex`.
19
+ *
20
+ * @example
21
+ * const getRowId: GetRowIdFn<Order> = (order: Order) => order.id;
22
+ *
23
+ * @typeparam T - The type of the rows.
24
+ * @category Options
25
25
  */
26
- export type GetRowIdFn<T> = ((row: T) => string | number);
26
+ export type GetRowIdFn<T> = ((row: T, rowIndex?: number) => string | number);
27
27
  /**
28
- * GetStorageKeyFn is a type alias for a function that returns a unique key (as a string) for storage.
29
- * It is used for restoring state in conjunction with the AutoRestoreOptionsIf interface.
30
- * @typedef
28
+ * Returns the storage key of a table – one key per table, e.g. `() => "orders"`. The state is stored under
29
+ * `<key>tableState`.
30
+ *
31
+ * @category Options
31
32
  */
32
33
  export type GetStorageKeyFn = (() => string);
33
34
  /**
34
- * The AutoRestoreOptionsIf interface is utilized to encapsulate options
35
- * for managing auto-restoring settings across different states of the application.
36
- * This interface is generic and can be used with any type.
37
- *
38
- * @interface
39
- * @typeparam T - Any type that this interface is going to use.
40
- * @property {boolean} autoRestoreSortingState - If true, the sorting state of
41
- * T elements will be preserved after changes in the application state.
42
- *
43
- * @property {boolean=} autoRestoreCollapsedExpandedState - Optional. If true,
44
- * the expanded/collapsed state of T elements will be preserved after changes in the application state.
35
+ * What a table remembers between page loads, and where. Everything is off by default ({@link AutoRestoreOptions});
36
+ * nothing is stored without {@link getStorageKeyFn} (the table warns once if a flag is set without it).
45
37
  *
46
- * @property {boolean=} autoRestoreScrollPosition - Optional. If true, the scroll position
47
- * in the list of T elements will be preserved after changes in the application state.
38
+ * The state is stored as one JSON value under `<key>tableState` in {@link storage} (default `localStorage`) –
39
+ * the same format as {@link TableApi.getState}. Columns are stored by property and rows by {@link getRowId}, so a
40
+ * moved column or new data never hits the wrong column or row. The stored state holds no cell values, but row ids
41
+ * can be personal data (e.g. an e-mail address as id) – prefer technical ids. The tree, checked rows, the selection
42
+ * and the first visible row need row ids; tree, checked and selected rows are computed only when their flag is set.
48
43
  *
49
- * @property {boolean=} autoRestoreCheckedState - Optional. If true, the checked state of
50
- * T elements will be preserved after changes in the application state.
44
+ * | Flag | Remembers | since |
45
+ * |---|---|---|
46
+ * | {@link autoRestoreSortingState} | sorted columns | |
47
+ * | {@link autoRestoreScrollPosition} | scroll position | |
48
+ * | {@link autoRestoreCollapsedExpandedState} | expanded tree nodes | |
49
+ * | {@link autoRestoreColumnLayout} | width, order, visibility of the columns | 1.1.92 |
50
+ * | {@link autoRestoreHeaderGroupState} | collapsed header groups | 1.1.92 |
51
+ * | {@link autoRestoreCheckedState} | checked rows | 1.1.92 (declared before, without effect) |
52
+ * | {@link autoRestoreSelectedState} | selection | 1.1.92 (declared before, without effect) |
53
+ * | {@link autoRestoreCustomState} | your data ({@link TableApi.setCustomState}) | 1.1.92 |
51
54
  *
52
- * @property {boolean=} autoRestoreSelectedState - Optional. If true, the selected state of
53
- * T elements will be preserved after changes in the application state.
55
+ * Before 1.1.92 sorting, scroll position and tree were stored under three keys (`<key>sortingState`,
56
+ * `<key>scrollState`, `<key>collapsedExpandedState`); they are read once and removed with the next save.
54
57
  *
55
- * @property {(row: T) => string | number} getRowId - Function for generating a unique identifier
56
- * for an instance of T. If not provided, each instance of T will create a new entry every time state is saved.
58
+ * @example
59
+ * const tableOptions: TableOptionsIf = {
60
+ * ...new TableOptions(),
61
+ * autoRestoreOptions: {
62
+ * ...new AutoRestoreOptions<Order>(),
63
+ * getStorageKeyFn: () => "orders",
64
+ * getRowId: (order: Order) => order.id,
65
+ * autoRestoreColumnLayout: true,
66
+ * autoRestoreSortingState: true,
67
+ * autoRestoreCheckedState: true
68
+ * }
69
+ * };
57
70
  *
58
- * @property {() => string} getStorageKeyFn - Function for generating a unique key used for storage.
59
- * If not provided, a constant key 'autorestoreoptionsif' will be used.
71
+ * @typeparam T - The type of the rows.
72
+ * @see Training: [Remember the state](https://gui.expert/training/persist-state/)
60
73
  *
61
- * @property {(r1: T, r2: T, optionsIf: AutoRestoreOptionsIf<T>) => boolean} isSame - Function for checking
62
- * if two instances of T are considered the same when restoring state. If not provided, strict equality check (===) will be used.
74
+ * @category Options
63
75
  */
64
76
  export interface AutoRestoreOptionsIf<T> {
77
+ /** Remember the sorted columns (by property). */
65
78
  autoRestoreSortingState: boolean;
79
+ /** Remember expanded and collapsed nodes of a tree table (by {@link getRowId}). */
66
80
  autoRestoreCollapsedExpandedState?: boolean;
81
+ /** Remember the scroll position (and the id of the first visible row). */
67
82
  autoRestoreScrollPosition?: boolean;
83
+ /** Remember the checked rows (by {@link getRowId}). Since 1.1.92 (before: declared without effect). */
68
84
  autoRestoreCheckedState?: boolean;
85
+ /**
86
+ * Remember the selection: rows by {@link getRowId}, columns by property. Restored in the current row order.
87
+ * Since 1.1.92 (before: declared without effect).
88
+ */
69
89
  autoRestoreSelectedState?: boolean;
90
+ /**
91
+ * Remember width, order and visibility of the columns (by property). Widths are stored only for columns that were
92
+ * resized, so `%` and weight columns stay responsive.
93
+ * @since 1.1.92
94
+ */
95
+ autoRestoreColumnLayout?: boolean;
96
+ /**
97
+ * Remember collapsed and expanded header groups ({@link CellGroupIf.toggle}).
98
+ * @since 1.1.92
99
+ */
100
+ autoRestoreHeaderGroupState?: boolean;
101
+ /**
102
+ * Remember the data set with {@link TableApi.setCustomState} (e.g. a filter text).
103
+ * @since 1.1.92
104
+ */
105
+ autoRestoreCustomState?: boolean;
106
+ /**
107
+ * A unique, stable id per row (tree: per node). With the default of {@link AutoRestoreOptions} the table uses the
108
+ * property `id`, then `uuid`; rows without them are not stored (since 1.1.92 – the JSON of the row would write
109
+ * personal data into the storage; the table warns once).
110
+ */
70
111
  getRowId?: undefined | GetRowIdFn<T>;
112
+ /** The storage key of this table, e.g. `() => "orders"`. Without it nothing is stored. */
71
113
  getStorageKeyFn?: undefined | GetStorageKeyFn;
114
+ /**
115
+ * @deprecated since 1.1.92 – never used; rows are compared by {@link getRowId}.
116
+ */
72
117
  isSame?: undefined | IsSameFn<T>;
118
+ /**
119
+ * Where the state is stored. Default: `localStorage`; `sessionStorage` or an own {@link StateStorageIf} also work.
120
+ * @since 1.1.92
121
+ */
122
+ storage?: StateStorageIf;
73
123
  }
@@ -1,8 +1,26 @@
1
- import { DefaultRowHeightsIf } from './default-row-heights.if';
1
+ import { DefaultRowHeightsIf } from './default-row-heights.if.js';
2
2
 
3
+ /**
4
+ * Row heights of header, body and footer in px – default 34 each. Used in {@link TableOptionsIf.defaultRowHeights}
5
+ * and {@link CreateTableModelPara.defaultRowHeights}.
6
+ *
7
+ * @example
8
+ * const tableOptions: TableOptionsIf = { ...new TableOptions(), defaultRowHeights: new DefaultRowHeights(40, 30, 36) };
9
+ *
10
+ * @category Options
11
+ */
3
12
  export declare class DefaultRowHeights implements DefaultRowHeightsIf {
13
+ /** Height of header rows in px. */
4
14
  header: number;
15
+ /** Height of body rows in px. */
5
16
  body: number;
17
+ /** Height of footer rows in px. */
6
18
  footer: number;
7
- constructor(header?: number, body?: number, footer?: number);
19
+ constructor(
20
+ /** Height of header rows in px. */
21
+ header?: number,
22
+ /** Height of body rows in px. */
23
+ body?: number,
24
+ /** Height of footer rows in px. */
25
+ footer?: number);
8
26
  }
@@ -7,6 +7,8 @@
7
7
  * @property `body`: It sets the height of the body rows present in the table. This value can be individually adjusted by developers.
8
8
  * @property `footer`: This property represents the height of the table footer row. It has a mutable value that can be modified as per requirements.
9
9
  *
10
+ * See {@link DefaultRowHeights} for the defaults (34 px each).
11
+ *
10
12
  * @example
11
13
  * // declaring a variable with default row heights
12
14
  * let rowHeights: DefaultRowHeightsIf = {
@@ -14,8 +16,9 @@
14
16
  * body: 100,
15
17
  * footer: 60
16
18
  * };
19
+
17
20
  *
18
- * For implementation details, refer to the `DefaultRowHeights` class.
21
+ * @category Options
19
22
  */
20
23
  export interface DefaultRowHeightsIf {
21
24
  header: number;
@@ -0,0 +1,4 @@
1
+ /** Marks a function as the default `getRowId` of {@link AutoRestoreOptions}. */
2
+ export declare function markDefaultGetRowId<F extends object>(fn: F): F;
3
+ /** true for the default `getRowId` of {@link AutoRestoreOptions} (also after spreading the options). */
4
+ export declare function isDefaultGetRowId(fn: unknown): boolean;
@@ -1,6 +1,7 @@
1
- import { IconIf } from './icon.if';
2
- import { HeaderGroupOptionsIf } from './header-group-options.if';
1
+ import { IconIf } from './icon.if.js';
2
+ import { HeaderGroupOptionsIf } from './header-group-options.if.js';
3
3
 
4
+ /** @category Header groups */
4
5
  export declare class HeaderGroupOptions implements HeaderGroupOptionsIf {
5
6
  iconExpanded: IconIf;
6
7
  iconCollapsed: IconIf;
@@ -1,4 +1,4 @@
1
- import { IconIf } from './icon.if';
1
+ import { IconIf } from './icon.if.js';
2
2
 
3
3
  /**
4
4
  * The `HeaderGroupOptionsIf` interface is part of the TypeScript project,
@@ -32,10 +32,9 @@ import { IconIf } from './icon.if';
32
32
  * classes: ["my-collapsed-icon-class"]
33
33
  * }
34
34
  * };
35
+
35
36
  *
36
- * This example creates an object conforming to the `HeaderGroupOptionsIf`
37
- * interface where `iconExpanded` and `iconCollapsed` each hold the specifications
38
- * for the expanded and collapsed states of a header group component respectively.
37
+ * @category Header groups
39
38
  */
40
39
  export interface HeaderGroupOptionsIf {
41
40
  iconExpanded: IconIf;
@@ -1,5 +1,6 @@
1
- import { IconIf } from './icon.if';
1
+ import { IconIf } from './icon.if.js';
2
2
 
3
+ /** @category Options */
3
4
  export declare class Icon implements IconIf {
4
5
  content: string;
5
6
  style: string;
@@ -10,6 +10,8 @@
10
10
  * )
11
11
  *
12
12
  * @interface
13
+ *
14
+ * @category Options
13
15
  */
14
16
  export interface IconIf {
15
17
  content: string;
@@ -0,0 +1,30 @@
1
+ import { OverlayOptionsIf } from './overlay-options.if.js';
2
+ import { GeOverlayKind } from '../../overlay/ge-overlay-kind.type.js';
3
+
4
+ /**
5
+ * The defaults of {@link OverlayOptionsIf}: English texts, an automatic "No rows to show", a loading overlay that
6
+ * blocks the body and appears right away.
7
+ *
8
+ * @example
9
+ * const overlayOptions = OverlayOptions.create({ noRowsText: "Keine Daten" });
10
+ * console.log(overlayOptions.loadingText); // "Loading…"
11
+ *
12
+ * @since 1.1.92
13
+ * @category Overlays
14
+ */
15
+ export declare class OverlayOptions implements OverlayOptionsIf {
16
+ loadingText: string;
17
+ noRowsText: string;
18
+ noMatchesText: string;
19
+ autoNoRows: boolean;
20
+ blockInteractionWhileLoading: boolean;
21
+ loadingDelayInMs: number;
22
+ getOverlayElement?: (kind: GeOverlayKind, text: string) => HTMLElement | undefined;
23
+ /**
24
+ * The defaults with the given fields on top (`undefined` fields keep their default).
25
+ *
26
+ * @param {Partial<OverlayOptionsIf>} [partial] - e.g. `tableOptions.overlayOptions`
27
+ * @returns {OverlayOptions} a new object
28
+ */
29
+ static create(partial?: Partial<OverlayOptionsIf>): OverlayOptions;
30
+ }
@@ -0,0 +1,79 @@
1
+ import { GeOverlayKind } from '../../overlay/ge-overlay-kind.type.js';
2
+
3
+ /**
4
+ * Texts and behaviour of the overlays over the table body: "Loading…" ({@link TableApi.showLoadingOverlay}),
5
+ * "No rows to show" (empty body) and "No matching rows" (the external filter hides all rows).
6
+ *
7
+ * Set it with {@link TableOptionsIf.overlayOptions} – every field is optional there, missing ones keep their
8
+ * default ({@link OverlayOptions}). The overlays are plain HTML and CSS (spinner: `@keyframes`), colours come from
9
+ * the CSS variables `--ge-table-overlay-bg`, `--ge-table-overlay-color`, `--ge-table-spinner-color`,
10
+ * `--ge-table-spinner-track-color` and `--ge-table-spinner-size`.
11
+ *
12
+ * @example
13
+ * const tableOptions: TableOptionsIf = {
14
+ * ...new TableOptions(),
15
+ * overlayOptions: {
16
+ * loadingText: "Lädt…",
17
+ * noRowsText: "Keine Daten",
18
+ * noMatchesText: "Keine Treffer",
19
+ * loadingDelayInMs: 200, // fast answers show no spinner at all
20
+ * },
21
+ * };
22
+ *
23
+ * @since 1.1.92
24
+ * @see Training: [Live data](https://gui.expert/training/live-data/)
25
+ * @category Overlays
26
+ */
27
+ export interface OverlayOptionsIf {
28
+ /** Text of the loading overlay. Default: `"Loading…"`. */
29
+ loadingText: string;
30
+ /** Text of the overlay of an empty body. Default: `"No rows to show"`. */
31
+ noRowsText: string;
32
+ /** Text when the external filter hides all rows. Default: `"No matching rows"`. */
33
+ noMatchesText: string;
34
+ /**
35
+ * `true` (default): an empty body shows "No rows to show" (or "No matching rows") by itself, after every
36
+ * repaint. `false`: only {@link TableApi.showNoRowsOverlay} shows it.
37
+ */
38
+ autoNoRows: boolean;
39
+ /**
40
+ * `true` (default): while "Loading…" is shown, the table ignores mouse events on the body (click, double click,
41
+ * hover, context menu – the page still sees them) and the keyboard cannot start editing or toggle rows in the body;
42
+ * navigation, copying and the header still work.
43
+ * `false`: the loading overlay is only a picture, the table stays usable.
44
+ * "No rows" / "No matching rows" never block.
45
+ */
46
+ blockInteractionWhileLoading: boolean;
47
+ /**
48
+ * Waits this long (ms) before the loading overlay appears. Answers that come faster show no spinner at all
49
+ * (no flashing); meanwhile an automatic "No rows to show" stays as it is. Default: `0` (right away).
50
+ */
51
+ loadingDelayInMs: number;
52
+ /**
53
+ * Own content of an overlay instead of the built-in one (spinner + text). Called once each time the overlay
54
+ * of a kind appears; return `undefined` to keep the built-in content for that kind. The table removes the
55
+ * element again when the overlay disappears or changes and in {@link TableApi.destroy}.
56
+ *
57
+ * The overlay is hidden from screen readers (`aria-hidden`, the table announces its text instead):
58
+ * put no buttons or links into it.
59
+ *
60
+ * @param {GeOverlayKind} kind - `"loading"`, `"noRows"` or `"noMatches"`
61
+ * @param {string} text - the text the built-in content would show
62
+ * @returns {HTMLElement | undefined} the element to show, or `undefined` for the default
63
+ *
64
+ * @example
65
+ * const tableOptions: TableOptionsIf = {
66
+ * ...new TableOptions(),
67
+ * overlayOptions: {
68
+ * getOverlayElement: (kind: GeOverlayKind, text: string) => {
69
+ * if (kind !== "noRows") return undefined; // built-in spinner and texts for the others
70
+ * const div = document.createElement("div");
71
+ * div.className = "my-empty-state";
72
+ * div.textContent = `📭 ${text}`;
73
+ * return div;
74
+ * },
75
+ * },
76
+ * };
77
+ */
78
+ getOverlayElement?: (kind: GeOverlayKind, text: string) => HTMLElement | undefined;
79
+ }
@@ -1,6 +1,7 @@
1
- import { IconIf } from './icon.if';
2
- import { SortedOptionsIf } from './sorted-options.if';
1
+ import { IconIf } from './icon.if.js';
2
+ import { SortedOptionsIf } from './sorted-options.if.js';
3
3
 
4
+ /** @category Options */
4
5
  export declare class SortedOptions implements SortedOptionsIf {
5
6
  iconAsc: IconIf;
6
7
  iconDesc: IconIf;
@@ -1,4 +1,4 @@
1
- import { IconIf } from './icon.if';
1
+ import { IconIf } from './icon.if.js';
2
2
 
3
3
  /**
4
4
  * This TypeScript interface, `SortedOptionsIf`, represents the configuration options for sorting.
@@ -21,6 +21,8 @@ import { IconIf } from './icon.if';
21
21
  * Note that the `classes` property in `IconIf` expects an array of strings, each string indicating a CSS class that should be applied to the icon.
22
22
  *
23
23
  * @interface
24
+ *
25
+ * @category Options
24
26
  */
25
27
  export interface SortedOptionsIf {
26
28
  iconAsc: IconIf;
@@ -1,18 +1,35 @@
1
- import { DefaultRowHeightsIf } from './default-row-heights.if';
2
- import { TableOptionsIf } from './table-options.if';
3
- import { TreeOptions } from './tree-options';
4
- import { FilterFunction } from '../common/filter-function';
5
- import { SortState } from '../common/sort-state.type';
6
- import { SortedOptions } from './sorted-options';
7
- import { GetEditRenderer } from '../../renderer/edit/edit-cell-renderer.type';
8
- import { SelectionModelIf } from '../../selection/selection-model.if';
9
- import { GetT } from '../common/get-t';
10
- import { FocusModelIf } from '../../focus/focus-model.if';
11
- import { ShortcutActionIdMapping } from '../../action/shortcut-actionid-mapping.type';
12
- import { HeaderGroupOptions } from './header-group-options';
1
+ import { DefaultRowHeightsIf } from './default-row-heights.if.js';
2
+ import { TableOptionsIf } from './table-options.if.js';
3
+ import { TreeOptions } from './tree-options.js';
4
+ import { FilterFunction } from '../common/filter-function.js';
5
+ import { SortState } from '../common/sort-state.type.js';
6
+ import { SortedOptions } from './sorted-options.js';
7
+ import { GetEditRenderer } from '../../renderer/edit/edit-cell-renderer.type.js';
8
+ import { SelectionModelIf } from '../../selection/selection-model.if.js';
9
+ import { GetT } from '../common/get-t.js';
10
+ import { FocusModelIf } from '../../focus/focus-model.if.js';
11
+ import { ShortcutActionIdMapping } from '../../action/shortcut-actionid-mapping.type.js';
12
+ import { HeaderGroupOptions } from './header-group-options.js';
13
+ import { AriaTextsIf } from '../../aria/aria-texts.if.js';
14
+ import { OverlayOptionsIf } from './overlay-options.if.js';
13
15
 
14
16
  /**
15
- * TableOptions class provides configuration options for the table.
17
+ * All default options of a table – see {@link TableOptionsIf} for the meaning of each field.
18
+ *
19
+ * Use it with the spread pattern: all defaults, plus your changes.
20
+ *
21
+ * @example
22
+ * const tableOptions: TableOptionsIf = {
23
+ * ...new TableOptions(),
24
+ * hoverColumnVisible: false,
25
+ * verticalBorderVisible: false,
26
+ * defaultRowHeights: { header: 40, body: 30, footer: 36 },
27
+ * externalFilterFunction: (order: Order) => order.total > 1000
28
+ * };
29
+ *
30
+ * @see Training: [TableOptions: behaviour and look](https://gui.expert/training/table-options/)
31
+ *
32
+ * @category Options
16
33
  */
17
34
  export declare class TableOptions implements TableOptionsIf {
18
35
  overflowX: "auto" | "scroll";
@@ -53,4 +70,14 @@ export declare class TableOptions implements TableOptionsIf {
53
70
  * Focus model of the table. Not set (default): every table creates its own `new FocusModel("cell")`.
54
71
  */
55
72
  getFocusModel?: GetT<FocusModelIf>;
73
+ /** Accessible name of the table (`aria-label`). Default: none. @since 1.1.91 */
74
+ ariaLabel?: string;
75
+ /** Id of the element that names the table (`aria-labelledby`). Default: none. @since 1.1.91 */
76
+ ariaLabelledBy?: string;
77
+ /** Id of the element that describes the table (`aria-describedby`). Default: none. @since 1.1.91 */
78
+ ariaDescribedBy?: string;
79
+ /** Own screen reader texts; missing functions use the English defaults ({@link AriaTexts}). @since 1.1.91 */
80
+ ariaTexts?: Partial<AriaTextsIf>;
81
+ /** Texts and behaviour of the "Loading…" / "No rows" overlays; missing fields use {@link OverlayOptions}. @since 1.1.92 */
82
+ overlayOptions?: Partial<OverlayOptionsIf>;
56
83
  }