@guiexpert/table 1.1.89 → 1.1.91

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 (205) hide show
  1. package/README.md +3 -1
  2. package/css/main.css +50 -4
  3. package/css/table-classes.css +30 -0
  4. package/css/table-color-classes.css +3 -1
  5. package/css/table-color-vars.css +4 -2
  6. package/css/table-tree.css +13 -1
  7. package/index.cjs +88 -97
  8. package/index.d.ts +192 -184
  9. package/index.js +3616 -1879
  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 +53 -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 +64 -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/input/table-cell-update-event.d.ts +14 -10
  77. package/lib/table/data/common/event/input/table-cell-update-event.if.d.ts +3 -1
  78. package/lib/table/data/common/filter-function.d.ts +2 -0
  79. package/lib/table/data/common/get-t.d.ts +2 -0
  80. package/lib/table/data/common/index-and-px.d.ts +2 -0
  81. package/lib/table/data/common/size-unit.type.d.ts +2 -0
  82. package/lib/table/data/common/size.d.ts +13 -2
  83. package/lib/table/data/common/size.if.d.ts +3 -1
  84. package/lib/table/data/common/sizes.d.ts +133 -1
  85. package/lib/table/data/common/sort-item.d.ts +16 -3
  86. package/lib/table/data/common/sort-state.type.d.ts +2 -0
  87. package/lib/table/data/common/tree-arrow.type.d.ts +2 -0
  88. package/lib/table/data/common/tree-row-if.d.ts +22 -1
  89. package/lib/table/data/common/tree-row.d.ts +3 -1
  90. package/lib/table/data/common/value-label.d.ts +2 -1
  91. package/lib/table/data/common/value-label.if.d.ts +1 -0
  92. package/lib/table/data/div-scope.type.d.ts +2 -0
  93. package/lib/table/data/event/mouse-target-data.d.ts +5 -3
  94. package/lib/table/data/geo-data.d.ts +2 -0
  95. package/lib/table/data/options/auto-restore-options.d.ts +32 -1
  96. package/lib/table/data/options/auto-restore-options.if.d.ts +8 -0
  97. package/lib/table/data/options/default-row-heights.d.ts +20 -2
  98. package/lib/table/data/options/default-row-heights.if.d.ts +4 -1
  99. package/lib/table/data/options/header-group-options.d.ts +3 -2
  100. package/lib/table/data/options/header-group-options.if.d.ts +3 -4
  101. package/lib/table/data/options/icon.d.ts +2 -1
  102. package/lib/table/data/options/icon.if.d.ts +2 -0
  103. package/lib/table/data/options/sorted-options.d.ts +3 -2
  104. package/lib/table/data/options/sorted-options.if.d.ts +3 -1
  105. package/lib/table/data/options/table-options.d.ts +44 -13
  106. package/lib/table/data/options/table-options.if.d.ts +117 -44
  107. package/lib/table/data/options/tree-options.d.ts +3 -2
  108. package/lib/table/data/options/tree-options.if.d.ts +3 -1
  109. package/lib/table/data/side-ident.type.d.ts +2 -0
  110. package/lib/table/data/table-model-and-options.d.ts +5 -3
  111. package/lib/table/data/table-model-and-options.if.d.ts +4 -2
  112. package/lib/table/data/tablemodel/area-ident.type.d.ts +4 -0
  113. package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +10 -9
  114. package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +6 -4
  115. package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +13 -12
  116. package/lib/table/data/tablemodel/areamodel/area-model-hidden.d.ts +9 -7
  117. package/lib/table/data/tablemodel/areamodel/area-model-object-array-with-columndefs.d.ts +16 -14
  118. package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +35 -31
  119. package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +153 -11
  120. package/lib/table/data/tablemodel/areamodel/area-model.d.ts +66 -104
  121. package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +56 -50
  122. package/lib/table/data/tablemodel/areamodel/async-area-model-object-array.d.ts +5 -5
  123. package/lib/table/data/tablemodel/areamodel/col-and-rowspan-model.d.ts +14 -3
  124. package/lib/table/data/tablemodel/areamodel/cover-grid-body-model.d.ts +10 -8
  125. package/lib/table/data/tablemodel/areamodel/has-default-row-height-if.d.ts +1 -0
  126. package/lib/table/data/tablemodel/areamodel/object-array-holder.if.d.ts +1 -0
  127. package/lib/table/data/tablemodel/cellgroup/cell-group-ext.d.ts +3 -2
  128. package/lib/table/data/tablemodel/cellgroup/cell-group.d.ts +2 -1
  129. package/lib/table/data/tablemodel/cellgroup/cell-group.if.d.ts +28 -0
  130. package/lib/table/data/tablemodel/cellgroup/cellgroup-factory.d.ts +4 -3
  131. package/lib/table/data/tablemodel/column/column-def.d.ts +67 -10
  132. package/lib/table/data/tablemodel/column/column-def.if.d.ts +63 -96
  133. package/lib/table/data/tablemodel/column/column-visibility.d.ts +6 -0
  134. package/lib/table/data/tablemodel/cover-grid-table-model.d.ts +11 -10
  135. package/lib/table/data/tablemodel/padding.d.ts +2 -0
  136. package/lib/table/data/tablemodel/table-model.d.ts +75 -14
  137. package/lib/table/data/tablemodel/table-model.if.d.ts +52 -8
  138. package/lib/table/ele-scope.d.ts +36 -5
  139. package/lib/table/event-adapter.d.ts +17 -10
  140. package/lib/table/event-checkbox-changed-handler.d.ts +2 -1
  141. package/lib/table/event-listener.if.d.ts +42 -9
  142. package/lib/table/factory/cover-grid-factory.d.ts +4 -3
  143. package/lib/table/factory/table-factory.d.ts +103 -64
  144. package/lib/table/factory/tree-factory.d.ts +81 -4
  145. package/lib/table/focus/event-focus-changed-listener.if.d.ts +5 -3
  146. package/lib/table/focus/focus-model.d.ts +7 -5
  147. package/lib/table/focus/focus-model.if.d.ts +22 -1
  148. package/lib/table/focus/focus.type.d.ts +2 -0
  149. package/lib/table/input-handler.d.ts +5 -1
  150. package/lib/table/instanceof-workaround.d.ts +16 -0
  151. package/lib/table/license-manager.d.ts +2 -0
  152. package/lib/table/mouse-handler.d.ts +18 -9
  153. package/lib/table/render-scope.d.ts +115 -25
  154. package/lib/table/renderer/action/action-event-listener.if.d.ts +2 -1
  155. package/lib/table/renderer/action/action-event.d.ts +4 -3
  156. package/lib/table/renderer/action/action-event.if.d.ts +2 -1
  157. package/lib/table/renderer/action/actions-cell-renderer.d.ts +8 -7
  158. package/lib/table/renderer/cell-group-ext-cell-renderer.d.ts +8 -7
  159. package/lib/table/renderer/cell-render.if.d.ts +41 -4
  160. package/lib/table/renderer/checkbox-boolean-property-cell-renderer.d.ts +7 -5
  161. package/lib/table/renderer/checkbox-cell-renderer.d.ts +8 -5
  162. package/lib/table/renderer/date-to-int-date-cell-renderer.d.ts +6 -5
  163. package/lib/table/renderer/date-to-iso-cell-renderer.d.ts +6 -5
  164. package/lib/table/renderer/date-to-locale-date-cell-renderer.d.ts +6 -5
  165. package/lib/table/renderer/date-to-tec-cell-renderer.d.ts +6 -5
  166. package/lib/table/renderer/edit/edit-cell-renderer.type.d.ts +2 -1
  167. package/lib/table/renderer/edit/edit-input-pipe-for-number.d.ts +2 -1
  168. package/lib/table/renderer/edit/edit-input-pipe.if.d.ts +2 -0
  169. package/lib/table/renderer/edit/input-cell-renderer.d.ts +6 -5
  170. package/lib/table/renderer/edit/select-cell-renderer.d.ts +7 -6
  171. package/lib/table/renderer/male-female-to-icon-cell-renderer.d.ts +19 -6
  172. package/lib/table/renderer/number-cell-progress-bar-cell-renderer.d.ts +11 -6
  173. package/lib/table/renderer/number-cell-renderer.d.ts +6 -5
  174. package/lib/table/renderer/positive-and-negative-number-renderer.d.ts +6 -5
  175. package/lib/table/renderer/progress-bar-cell-renderer.d.ts +12 -6
  176. package/lib/table/renderer/renderer-cleanup-fn.type.d.ts +1 -0
  177. package/lib/table/renderer/renderer.d.ts +3 -2
  178. package/lib/table/renderer/simple-array-cell-renderer.d.ts +6 -5
  179. package/lib/table/renderer/star-rating-cell-renderer.d.ts +12 -6
  180. package/lib/table/renderer/true-false-cell-renderer.d.ts +17 -5
  181. package/lib/table/resize-handler.d.ts +3 -1
  182. package/lib/table/selection/event-selection-changed-listener.if.d.ts +2 -1
  183. package/lib/table/selection/multi-rows-selection-model.d.ts +7 -4
  184. package/lib/table/selection/selection-model.d.ts +112 -10
  185. package/lib/table/selection/selection-model.if.d.ts +48 -3
  186. package/lib/table/selection/selection-service.d.ts +35 -7
  187. package/lib/table/selection/selection.type.d.ts +3 -0
  188. package/lib/table/service/abstract-store-state.service.d.ts +1 -1
  189. package/lib/table/service/convenience-dom.service.d.ts +36 -13
  190. package/lib/table/service/copy-service.d.ts +18 -4
  191. package/lib/table/service/copy-service.if.d.ts +4 -3
  192. package/lib/table/service/data/collapsed-expanded.data.d.ts +1 -0
  193. package/lib/table/service/data/html-style.type.d.ts +1 -0
  194. package/lib/table/service/dom-service.if.d.ts +30 -0
  195. package/lib/table/service/excel-service.d.ts +43 -3
  196. package/lib/table/service/excel-service.if.d.ts +8 -1
  197. package/lib/table/service/ge-filter.service.d.ts +1 -0
  198. package/lib/table/service/simple-dom-service.d.ts +3 -1
  199. package/lib/table/service/store-state-collapsed-expand.service.d.ts +4 -3
  200. package/lib/table/service/store-state-scroll-pos.service.d.ts +3 -2
  201. package/lib/table/service/store-state-sorting.service.d.ts +4 -3
  202. package/lib/table/service/tree-row.service.d.ts +5 -1
  203. package/lib/table/table-api.d.ts +309 -550
  204. package/lib/table/table-scope.d.ts +223 -85
  205. package/package.json +23 -8
@@ -1,15 +1,38 @@
1
- import { SizeIf } from '../../common/size.if';
2
- import { ColumnDefIf, ValueRowSortComparator } from './column-def.if';
3
- import { CellRendererIf } from '../../../renderer/cell-render.if';
4
- import { AreaObjectMapType } from '../../common/area-map.type';
5
- import { AreaObjectMap } from '../../common/area-map';
6
- import { BooleanFunction } from '../../common/boolean-function';
7
- import { SortState } from '../../common/sort-state.type';
8
- import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type';
9
- import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if';
1
+ import { SizeIf } from '../../common/size.if.js';
2
+ import { ColumnDefIf, ValueRowSortComparator } from './column-def.if.js';
3
+ import { CellRendererIf } from '../../../renderer/cell-render.if.js';
4
+ import { AreaObjectMapType } from '../../common/area-map.type.js';
5
+ import { AreaObjectMap } from '../../common/area-map.js';
6
+ import { BooleanFunction } from '../../common/boolean-function.js';
7
+ import { SortState } from '../../common/sort-state.type.js';
8
+ import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type.js';
9
+ import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if.js';
10
10
 
11
11
  /**
12
- * Represents a column definition for one column of the table.
12
+ * The column definition – see {@link ColumnDefIf} for all fields.
13
+ *
14
+ * Two ways to create one:
15
+ *
16
+ * @example
17
+ * // short: property, header label, width, CSS classes
18
+ * new ColumnDef("customer", "Customer", px180, bodyLeft);
19
+ * new ColumnDef("total", "Total", px120, allRight); // numbers: right-aligned in header, body and footer
20
+ *
21
+ * @example
22
+ * // named parameters for everything else
23
+ * ColumnDef.create({
24
+ * property: "status",
25
+ * headerLabel: "Status",
26
+ * width: px110,
27
+ * bodyRenderer: new StatusBadgeRenderer(),
28
+ * sortable: TrueFn,
29
+ * sortComparator: (a: string, b: string) => STATUS_ORDER.indexOf(a) - STATUS_ORDER.indexOf(b)
30
+ * });
31
+ *
32
+ * @see Training: [Columns with ColumnDef](https://gui.expert/training/column-definitions/),
33
+ * [Sorting](https://gui.expert/training/sorting/), [Cell renderers](https://gui.expert/training/cell-renderers/)
34
+ *
35
+ * @category Columns
13
36
  */
14
37
  export declare class ColumnDef implements ColumnDefIf {
15
38
  property: string;
@@ -31,26 +54,60 @@ export declare class ColumnDef implements ColumnDefIf {
31
54
  visible: boolean;
32
55
  constructor(property: string, headerLabel: string, width?: SizeIf, classes?: AreaObjectMapType<string[]>, rendererMap?: AreaObjectMapType<CellRendererIf>, minWidth?: SizeIf, maxWidth?: SizeIf, sortable?: BooleanFunction | undefined, sortComparator?: ValueRowSortComparator | undefined, sortState?: SortState | undefined, sortStatesOrder?: SortState[] | undefined, sortIconVisible?: BooleanFunction | undefined, editable?: BooleanFunction | undefined, getEditRenderer?: GetEditRenderer | undefined, editInputPipe?: editInputPipe | undefined, isVisible?: BooleanFunction);
33
56
  static bodyRenderer(bodyRenderer: CellRendererIf): AreaObjectMap<CellRendererIf>;
57
+ /**
58
+ * Creates a column definition from named parameters. Everything is optional; defaults: width 100 px,
59
+ * visible, not editable, sortable only if `sortable` is given.
60
+ *
61
+ * `headerRenderer` / `bodyRenderer` / `footerRenderer` and `headerClasses` / `bodyClasses` / `footerClasses`
62
+ * fill {@link ColumnDefIf.rendererMap} and {@link ColumnDefIf.classes}.
63
+ *
64
+ * @example
65
+ * ColumnDef.create({
66
+ * property: "price", headerLabel: "Price", width: px100,
67
+ * headerClasses: ["ge-table-text-align-right"], bodyClasses: ["ge-table-text-align-right"],
68
+ * sortable: TrueFn
69
+ * });
70
+ */
34
71
  static create(param: {
72
+ /** Property of the row object, see {@link ColumnDefIf.property}. */
35
73
  property?: string;
74
+ /** Header label. */
36
75
  headerLabel?: string;
76
+ /** Width, default 100 px. */
37
77
  width?: SizeIf;
78
+ /** Lower limit for % widths. */
38
79
  minWidth?: SizeIf;
80
+ /** Upper limit for % widths. */
39
81
  maxWidth?: SizeIf;
82
+ /** Renderer of the header cell. */
40
83
  headerRenderer?: CellRendererIf;
84
+ /** Renderer of the body cells. */
41
85
  bodyRenderer?: CellRendererIf;
86
+ /** Renderer of the footer cells. */
42
87
  footerRenderer?: CellRendererIf;
88
+ /** CSS classes of the header cell, e.g. `["ge-table-text-align-right"]`. */
43
89
  headerClasses?: string[];
90
+ /** CSS classes of the body cells. */
44
91
  bodyClasses?: string[];
92
+ /** CSS classes of the footer cells. */
45
93
  footerClasses?: string[];
94
+ /** Sortable by double-click on the header, e.g. `TrueFn`. */
46
95
  sortable?: BooleanFunction;
96
+ /** Show the sort icon (default: follows `sortable`). */
47
97
  sortIconVisible?: BooleanFunction;
98
+ /** Own comparison of two cell values. */
48
99
  sortComparator?: ValueRowSortComparator;
100
+ /** Initial sort icon (`"asc"`, `"desc"`); sort the rows with `tableModel.doSort()` to match. */
49
101
  sortState?: SortState;
102
+ /** Order of the sort states on repeated double-clicks. */
50
103
  sortStatesOrder?: SortState[];
104
+ /** Cells can be edited, e.g. `TrueFn`. */
51
105
  editable?: BooleanFunction;
106
+ /** Column is shown (default `TrueFn`). */
52
107
  isVisible?: BooleanFunction;
108
+ /** The editor of this column. */
53
109
  getEditRenderer?: GetEditRenderer;
110
+ /** Converts the editor text before it is stored, e.g. `editInputPipeForNumber`. */
54
111
  editInputPipe?: editInputPipe;
55
112
  }): ColumnDefIf;
56
113
  }
@@ -1,10 +1,10 @@
1
- import { SizeIf } from '../../common/size.if';
2
- import { CellRendererIf } from '../../../renderer/cell-render.if';
3
- import { AreaObjectMapType } from '../../common/area-map.type';
4
- import { BooleanFunction } from '../../common/boolean-function';
5
- import { SortState } from '../../common/sort-state.type';
6
- import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type';
7
- import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if';
1
+ import { SizeIf } from '../../common/size.if.js';
2
+ import { CellRendererIf } from '../../../renderer/cell-render.if.js';
3
+ import { AreaObjectMapType } from '../../common/area-map.type.js';
4
+ import { BooleanFunction } from '../../common/boolean-function.js';
5
+ import { SortState } from '../../common/sort-state.type.js';
6
+ import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type.js';
7
+ import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if.js';
8
8
 
9
9
  /**
10
10
  * Represents a function that compares two values for sorting purposes.
@@ -21,132 +21,99 @@ import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if';
21
21
  * @param f Optional. The direction. It is not necessary to use this value in the comparator, as this number is used as a factor (1 or -1) in the outer sort method.
22
22
  *
23
23
  * @returns A number indicating the relative order of 'valueA' and 'valueB'.
24
+ *
25
+ * @category Columns
24
26
  */
25
27
  export type ValueRowSortComparator = (valueA: any, valueB: any, rowA?: any, rowB?: any, f?: number) => number;
26
28
  /**
27
- * Represents a column definition of one table column.
29
+ * Describes one column: which property it shows, header label, width, CSS classes, renderers,
30
+ * sorting, editing and visibility. Create it with {@link ColumnDef} – `new ColumnDef(property, label, width, classes)`
31
+ * or {@link ColumnDef.create} with named parameters.
32
+ *
33
+ * Column indices (e.g. in {@link AreaModelIf.getValueAt}) are positions in the `columnDefs` array –
34
+ * fixed columns and hidden columns included.
35
+ *
36
+ * @example
37
+ * const columnDefs: ColumnDefIf[] = [
38
+ * new ColumnDef("id", "ID", px80, allRight),
39
+ * ColumnDef.create({
40
+ * property: "total", headerLabel: "Total", width: px120,
41
+ * headerClasses: ["ge-table-text-align-right"], bodyClasses: ["ge-table-text-align-right"],
42
+ * sortable: TrueFn, sortState: "desc"
43
+ * })
44
+ * ];
45
+ *
46
+ * @see Training: [Columns with ColumnDef](https://gui.expert/training/column-definitions/)
47
+ *
48
+ * @category Columns
28
49
  */
29
50
  export interface ColumnDefIf {
30
- /**
31
- * Represents a property name of the table row element.
32
- * @typedef {String} VariableProperty
33
- */
51
+ /** Property of the row object shown in this column (`"customer"`). With nested objects a path like `"address.city"`. */
34
52
  property: string;
35
- /**
36
- * Represents the label for a header.
37
- *
38
- * @typedef {string} headerLabel
39
- */
53
+ /** Text of the header cell (used when the header is built from the column definitions). */
40
54
  headerLabel: string;
41
- /**
42
- * Represents the size of a column along the width dimension.
43
- *
44
- * @typedef {number} Width
45
- */
55
+ /** Width of the column: `px120`, `new Size(10, "%")` or `new Size(1, "weight")`. See {@link SizeUnitType}. */
46
56
  width: SizeIf;
47
- /**
48
- * Represents the minimum width of a column.
49
- *
50
- * @typedef {SizeIf} minWidth
51
- * @property {number} width - The minimum width value.
52
- * @property {string} unit - The unit of measurement for the minimum width value.
53
- * Default value is 'px' if not specified.
54
- */
57
+ /** Lower limit for percentage widths (`"%"`). Not applied to pixel widths or to resizing with the mouse. */
55
58
  minWidth: SizeIf;
56
- /**
57
- * Represents the maximum width of a column.
58
- *
59
- * @typedef {number} SizeIf
60
- */
59
+ /** Upper limit for percentage widths (`"%"`). Not applied to pixel widths or to resizing with the mouse. */
61
60
  maxWidth: SizeIf;
62
61
  /**
63
- * @typedef {Object} AreaObjectMapType
64
- * @template T
65
- * @property {Object.<string, T>} map - A mapping of strings to values of type T
62
+ * Cell renderers per area – `rendererMap.header`, `.body`, `.footer`.
63
+ * Without a renderer the value is shown as text.
64
+ *
65
+ * @example
66
+ * column.rendererMap.body = new NumberCellProgressBarCellRenderer(20, false);
67
+ * column.rendererMap.footer = new EuroRenderer(); // an own CellRendererIf
68
+ *
69
+ * @see Training: [Cell renderers](https://gui.expert/training/cell-renderers/)
66
70
  */
67
71
  rendererMap: AreaObjectMapType<CellRendererIf>;
68
72
  /**
69
- * Represents an object that maps an area to a collection of objects.
70
- *
71
- * @typedef {Object.<string, string[]>} AreaObjectMapType
73
+ * CSS classes per area – `classes.header`, `.body`, `.footer`. The constants {@link bodyLeft}, {@link allRight} …
74
+ * are ready-made maps for the alignment.
72
75
  */
73
76
  classes: AreaObjectMapType<string[]>;
74
- /**
75
- * Determines whether or not a column can be sorted.
76
- *
77
- * @param {boolean} sortable - Specifies if an item is sortable.
78
- * @returns {boolean} - Indicating whether the item is sortable or not.
79
- */
77
+ /** The column can be sorted by a double-click on its header (e.g. `TrueFn`). */
80
78
  sortable?: BooleanFunction;
81
- /**
82
- * Determines if the sort icon is visible.
83
- *
84
- * @typedef {BooleanFunction} sortIconVisible
85
- * @returns {boolean} Indicates whether the sort icon is visible.
86
- */
79
+ /** Show the sort icon in the header. Default: follows `sortable` resp. `sortState`. */
87
80
  sortIconVisible?: BooleanFunction;
88
81
  /**
89
- * Represents a function that compares two values for sorting purposes.
90
- * The function takes two values and optionally their corresponding row objects,
91
- * compares them, and returns a number.
92
- * If the result is negative, it means 'valueA' comes before 'valueB' in the sorted order.
93
- * If the result is positive, it means 'valueB' comes before 'valueA' in the sorted order.
94
- * If the result is zero, it means the two values are considered equal for sorting purposes.
82
+ * Own comparison of two cell values (and their rows), like for `Array.prototype.sort`.
95
83
  *
96
- * @see ValueRowSortComparator
84
+ * @example
85
+ * sortComparator: (a: string, b: string) => a.localeCompare(b, "de") // "Müller" before "Nordlicht"
86
+ *
87
+ * @see Training: [Sorting](https://gui.expert/training/sorting/)
97
88
  */
98
89
  sortComparator?: ValueRowSortComparator;
99
90
  /**
100
- * Represents the state of sorting for a list.
101
- *
102
- * @typedef {Object} SortState
103
- *
104
- * @property {string} [sortKey] - The key to sort the list by. If not provided, no sorting will be applied.
105
- * @property {boolean} [reverse] - Indicates whether the list should be sorted in reverse order. Defaults to false.
91
+ * The sort icon shown in the header: `"asc"`, `"desc"` or `""` (none). It only sets the icon –
92
+ * sort the rows once with {@link TableModelIf.doSort} to match it.
106
93
  */
107
94
  sortState?: SortState;
108
- /**
109
- * Represents the order of multiple sort states.
110
- *
111
- * @typedef {SortState[]} SortStatesOrder
112
- */
95
+ /** Order of the sort states on repeated double-clicks. Default: `TableOptions.sortOrder` (`["asc", "desc"]`). */
113
96
  sortStatesOrder?: SortState[];
114
97
  /**
115
- * Determines if a column is editable or not.
98
+ * The cells of this column can be edited (double-click or F2), e.g. `TrueFn`.
116
99
  *
117
- * @param {any} variable - The variable to check.
118
- * @returns {boolean} - Returns true if the variable is editable, false otherwise.
100
+ * @see Training: [Inline editing](https://gui.expert/training/inline-editing/)
119
101
  */
120
102
  editable?: BooleanFunction;
121
103
  /**
122
- * Determines if the column is visible or not.
104
+ * Whether the column is shown. Hidden columns are not rendered, copied or exported.
123
105
  *
124
- * @typedef {Function} isVisible
125
- * @returns {boolean} - If the element is visible, returns true. Otherwise, returns false.
106
+ * @example
107
+ * ColumnDef.create({ property: "category", headerLabel: "Category", isVisible: FalseFn })
126
108
  */
127
109
  isVisible?: BooleanFunction;
128
110
  /**
129
- * Retrieves the edit renderer for the column.
111
+ * The editor of this column. Default: `TableOptions.getEditRenderer` (a text input, {@link InputCellRenderer}).
130
112
  *
131
- * @name getEditRenderer
132
- * @function
133
- * @param {HTMLElement} element - The element for which to retrieve the edit renderer.
134
- * @returns {EditRenderer | null} - The edit renderer for the specified element, or null if not found.
113
+ * @example
114
+ * getEditRenderer: () => new SelectCellRenderer(["open", "paid"].map(s => new ValueLabel(s, s)))
135
115
  */
136
116
  getEditRenderer?: GetEditRenderer;
137
- /**
138
- * Represents an edit input pipe.
139
- *
140
- * @typedef {object} editInputPipe
141
- * @property {string} name - The name of the edit input pipe.
142
- * @property {number} id - The unique identifier of the edit input pipe.
143
- * @property {boolean} isActive - Indicates whether the edit input pipe is active.
144
- * @property {function} execute - Executes the edit input pipe operation.
145
- * @property {function} addFilter - Adds a filter to the edit input pipe.
146
- * @property {function} removeFilter - Removes a filter from the edit input pipe.
147
- * @property {function} clearFilters - Clears all filters from the edit input pipe.
148
- * @property {function} setPriority - Sets the priority of the edit input pipe.
149
- * @property {function} getStatus - Retrieves the current status of the edit input pipe.
150
- */
117
+ /** Converts the text of the editor before it is written into the model, e.g. {@link editInputPipeForNumber}. */
151
118
  editInputPipe?: editInputPipe;
152
119
  }
@@ -0,0 +1,6 @@
1
+ import { ColumnDefIf } from './column-def.if.js';
2
+
3
+ /** Sets the API visibility of a column and rebuilds its `isVisible`. */
4
+ export declare function setApiColumnVisibility(columnDef: ColumnDefIf, visible: boolean): void;
5
+ /** Sets the header group visibility of a column and rebuilds its `isVisible`. */
6
+ export declare function setGroupColumnVisibility(columnDef: ColumnDefIf, isVisible: (() => boolean) | undefined): void;
@@ -1,14 +1,15 @@
1
- import { CoverGridBodyModel } from './areamodel/cover-grid-body-model';
2
- import { AreaModelIf } from './areamodel/area-model.if';
3
- import { FilterFunction } from '../common/filter-function';
4
- import { SortItem } from '../common/sort-item';
5
- import { AreaIdent } from './area-ident.type';
6
- import { TableModelIf } from './table-model.if';
7
- import { TableScope } from '../../table-scope';
8
- import { ColumnDefIf } from './column/column-def.if';
9
- import { Padding } from './padding';
10
- import { SelectionModelIf } from '../../selection/selection-model.if';
1
+ import { CoverGridBodyModel } from './areamodel/cover-grid-body-model.js';
2
+ import { AreaModelIf } from './areamodel/area-model.if.js';
3
+ import { FilterFunction } from '../common/filter-function.js';
4
+ import { SortItem } from '../common/sort-item.js';
5
+ import { AreaIdent } from './area-ident.type.js';
6
+ import { TableModelIf } from './table-model.if.js';
7
+ import { TableScope } from '../../table-scope.js';
8
+ import { ColumnDefIf } from './column/column-def.if.js';
9
+ import { Padding } from './padding.js';
10
+ import { SelectionModelIf } from '../../selection/selection-model.if.js';
11
11
 
12
+ /** @category Table model */
12
13
  export declare class CoverGridTableModel<T> implements TableModelIf {
13
14
  bodyModel: CoverGridBodyModel<T>;
14
15
  paddingTop: number;
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Represents padding values for the top, right, bottom, and left sides of an element.
3
+ *
4
+ * @category Table model
3
5
  */
4
6
  export declare class Padding {
5
7
  top: number;
@@ -1,15 +1,15 @@
1
- import { TableModelIf } from './table-model.if';
2
- import { Padding } from './padding';
3
- import { AreaIdent } from './area-ident.type';
4
- import { AreaModelIf } from './areamodel/area-model.if';
5
- import { SideIdent } from '../side-ident.type';
6
- import { DefaultRowHeightsIf } from '../options/default-row-heights.if';
7
- import { ColumnDefIf } from './column/column-def.if';
8
- import { FilterFunction } from '../common/filter-function';
9
- import { SortItem } from '../common/sort-item';
10
- import { SelectionModelIf } from '../../selection/selection-model.if';
11
- import { GetT } from '../common/get-t';
12
- import { TableScope } from '../../table-scope';
1
+ import { TableModelIf } from './table-model.if.js';
2
+ import { Padding } from './padding.js';
3
+ import { AreaIdent } from './area-ident.type.js';
4
+ import { AreaModelIf } from './areamodel/area-model.if.js';
5
+ import { SideIdent } from '../side-ident.type.js';
6
+ import { DefaultRowHeightsIf } from '../options/default-row-heights.if.js';
7
+ import { ColumnDefIf } from './column/column-def.if.js';
8
+ import { FilterFunction } from '../common/filter-function.js';
9
+ import { SortItem } from '../common/sort-item.js';
10
+ import { SelectionModelIf } from '../../selection/selection-model.if.js';
11
+ import { GetT } from '../common/get-t.js';
12
+ import { TableScope } from '../../table-scope.js';
13
13
 
14
14
  /**
15
15
  * This is a default implementation of TableModelIf.
@@ -30,6 +30,8 @@ import { TableScope } from '../../table-scope';
30
30
  * | footer/west | footer/center | footer/east |
31
31
  * +----------------+-------------------+--------------+ </pre>
32
32
  *
33
+ *
34
+ * @category Table model
33
35
  */
34
36
  export declare class TableModel implements TableModelIf {
35
37
  readonly headerAreaModel: AreaModelIf;
@@ -50,6 +52,10 @@ export declare class TableModel implements TableModelIf {
50
52
  protected contentWidthInPx: number;
51
53
  protected padding: Padding;
52
54
  protected xPositions: number[];
55
+ /** false: the header is hidden (height 0), see {@link setHeaderVisible}. */
56
+ protected headerVisible: boolean;
57
+ /** false: the footer is hidden (height 0), see {@link setFooterVisible}. */
58
+ protected footerVisible: boolean;
53
59
  constructor(headerAreaModel: AreaModelIf, bodyAreaModel: AreaModelIf, footerAreaModel: AreaModelIf, fixedLeftColumnCount?: number, fixedRightColumnCount?: number, rowCheckboxVisible?: boolean, defaultRowHeights?: DefaultRowHeightsIf, columnDefs?: ColumnDefIf[], columnSizes?: number[], overridingColumnWidth?: number, columnCount?: number, parentSize?: number, // can be important when we have percentage widths,
54
60
  getSelectionModel?: GetT<SelectionModelIf>);
55
61
  init(): void;
@@ -62,6 +68,8 @@ export declare class TableModel implements TableModelIf {
62
68
  getColumnCount(): number;
63
69
  /**
64
70
  * Sets the width in pixel of a column (by columnIndex) in a table.
71
+ * The width is also stored in the column's ColumnDef (`width` = the new px size), so it survives a host resize
72
+ * (the widths are recalculated from the ColumnDefs then).
65
73
  *
66
74
  * @param {number} columnIndex - The index of the column.
67
75
  * @param {number} width - The desired width of the column.
@@ -201,16 +209,67 @@ export declare class TableModel implements TableModelIf {
201
209
  */
202
210
  getBodyModel(): AreaModelIf;
203
211
  /**
204
- * Checks if the footer is visible.
212
+ * Checks if the footer is visible: it has rows and is not hidden with {@link setFooterVisible}.
205
213
  *
206
214
  * @returns {boolean} True if the footer is visible, false otherwise.
207
215
  */
208
216
  isFooterVisibe(): boolean;
209
217
  /**
210
- * Checks if the header area is visible.
218
+ * Checks if the header area is visible: it has rows and is not hidden with {@link setHeaderVisible}.
211
219
  * @return {boolean} Returns true if the header area is visible, otherwise false.
212
220
  */
213
221
  isHeaderVisibe(): boolean;
222
+ /**
223
+ * Shows or hides the header. A hidden header takes no space (the body moves up); its area model and rows stay
224
+ * unchanged, so showing it again restores it. Only changes the model – {@link TableApi.setHeaderVisible} also
225
+ * repaints the table.
226
+ *
227
+ * @param {boolean} visible - false hides the header
228
+ *
229
+ * @example
230
+ * tableModel.setHeaderVisible?.(false);
231
+ */
232
+ setHeaderVisible(visible: boolean): void;
233
+ /**
234
+ * Shows or hides the footer. A hidden footer takes no space; its area model and rows stay unchanged.
235
+ * Only changes the model – {@link TableApi.setFooterVisible} also repaints the table.
236
+ *
237
+ * @param {boolean} visible - false hides the footer
238
+ *
239
+ * @example
240
+ * tableModel.setFooterVisible?.(false);
241
+ */
242
+ setFooterVisible(visible: boolean): void;
243
+ /**
244
+ * Shows or hides a column. The column keeps its definition, position and width – a hidden column has the width 0
245
+ * ({@link getColumnWidth}), is not rendered, copied or exported; showing it again restores its width.
246
+ *
247
+ * Works through {@link ColumnDefIf.isVisible}: it is replaced by {@link TrueFn} / {@link FalseFn} (an own
248
+ * `isVisible` function of the column is replaced, too). Columns without a column definition can't be hidden.
249
+ * With header groups ({@link AreaModelCellGroups}) the column is shown only if neither this method nor a collapsed
250
+ * group hides it – expanding the group does not bring back a column hidden here, and vice versa.
251
+ * Weight widths (`new Size(1, "weight")`) are shared among the shown columns.
252
+ * Recalculates the content width, the padding (fixed columns) and the x positions. Only changes the model –
253
+ * {@link TableApi.setColumnVisible} also repaints the table.
254
+ *
255
+ * @param {number | string | ColumnDefIf} column - column index (fixed columns included), property or column definition
256
+ * @param {boolean} visible - false hides the column
257
+ * @returns {boolean} false if there is no such column definition
258
+ *
259
+ * @example
260
+ * tableModel.setColumnVisible?.("category", false);
261
+ */
262
+ setColumnVisible(column: number | string | ColumnDefIf, visible: boolean): boolean;
263
+ /**
264
+ * Whether a column is shown ({@link ColumnDefIf.isVisible}). Columns without a column definition are always shown.
265
+ *
266
+ * @param {number | string | ColumnDefIf} column - column index, property or column definition
267
+ * @returns {boolean} false for hidden and for unknown columns
268
+ *
269
+ * @example
270
+ * const hidden = tableModel.isColumnVisible?.("category") === false;
271
+ */
272
+ isColumnVisible(column: number | string | ColumnDefIf): boolean;
214
273
  /**
215
274
  * Checks whether the row checkbox is visible.
216
275
  *
@@ -281,6 +340,8 @@ export declare class TableModel implements TableModelIf {
281
340
  * @return {number} - The converted size value in pixels. returns -1 if unit is not '%' or 'px'.
282
341
  */
283
342
  private sizeToPixel;
343
+ /** The column definition for a column index, a property or a column definition of this model. */
344
+ private findColumnDef;
284
345
  private arrayMove;
285
346
  private recalcContentWidthInPx;
286
347
  private calcXPositions;
@@ -1,11 +1,11 @@
1
- import { Padding } from './padding';
2
- import { AreaIdent } from './area-ident.type';
3
- import { ColumnDefIf } from './column/column-def.if';
4
- import { AreaModelIf } from './areamodel/area-model.if';
5
- import { FilterFunction } from '../common/filter-function';
6
- import { SortItem } from '../common/sort-item';
7
- import { SelectionModelIf } from '../../selection/selection-model.if';
8
- import { TableScope } from '../../table-scope';
1
+ import { Padding } from './padding.js';
2
+ import { AreaIdent } from './area-ident.type.js';
3
+ import { ColumnDefIf } from './column/column-def.if.js';
4
+ import { AreaModelIf } from './areamodel/area-model.if.js';
5
+ import { FilterFunction } from '../common/filter-function.js';
6
+ import { SortItem } from '../common/sort-item.js';
7
+ import { SelectionModelIf } from '../../selection/selection-model.if.js';
8
+ import { TableScope } from '../../table-scope.js';
9
9
 
10
10
  /**
11
11
  * The TableModelIf is on one hand a container for the header, body, and footer models
@@ -24,6 +24,8 @@ import { TableScope } from '../../table-scope';
24
24
  * | footer/west | footer/center | footer/east |
25
25
  * +----------------+-------------------+--------------+</pre>
26
26
  *
27
+ *
28
+ * @category Table model
27
29
  */
28
30
  export interface TableModelIf {
29
31
  /**
@@ -111,6 +113,48 @@ export interface TableModelIf {
111
113
  * @returns {boolean} Returns true if the footer is visible, otherwise returns false.
112
114
  */
113
115
  isFooterVisibe(): boolean;
116
+ /**
117
+ * Optional: shows or hides the header (height 0, the rows stay in the model). Implemented by {@link TableModel};
118
+ * {@link TableApi.setHeaderVisible} uses it and repaints.
119
+ *
120
+ * @param {boolean} visible - false hides the header
121
+ *
122
+ * @example
123
+ * tableModel.setHeaderVisible?.(false);
124
+ */
125
+ setHeaderVisible?(visible: boolean): void;
126
+ /**
127
+ * Optional: shows or hides the footer (height 0, the rows stay in the model). Implemented by {@link TableModel};
128
+ * {@link TableApi.setFooterVisible} uses it and repaints.
129
+ *
130
+ * @param {boolean} visible - false hides the footer
131
+ *
132
+ * @example
133
+ * tableModel.setFooterVisible?.(false);
134
+ */
135
+ setFooterVisible?(visible: boolean): void;
136
+ /**
137
+ * Optional: shows or hides a column (width 0, definition, position and width are kept). Implemented by
138
+ * {@link TableModel}; {@link TableApi.setColumnVisible} uses it and repaints.
139
+ *
140
+ * @param {number | string | ColumnDefIf} column - column index, property or column definition
141
+ * @param {boolean} visible - false hides the column
142
+ * @returns {boolean} false if there is no such column definition
143
+ *
144
+ * @example
145
+ * tableModel.setColumnVisible?.(3, false);
146
+ */
147
+ setColumnVisible?(column: number | string | ColumnDefIf, visible: boolean): boolean;
148
+ /**
149
+ * Optional: whether a column is shown. Implemented by {@link TableModel}.
150
+ *
151
+ * @param {number | string | ColumnDefIf} column - column index, property or column definition
152
+ * @returns {boolean} false for hidden and for unknown columns
153
+ *
154
+ * @example
155
+ * tableModel.isColumnVisible?.("category");
156
+ */
157
+ isColumnVisible?(column: number | string | ColumnDefIf): boolean;
114
158
  /**
115
159
  * Determines if the row checkbox is visible.
116
160
  *
@@ -1,12 +1,17 @@
1
- import { ConvenienceDomService } from './service/convenience-dom.service';
2
- import { DivScope } from './data/div-scope.type';
3
- import { TableModelIf } from './data/tablemodel/table-model.if';
4
- import { TableOptionsIf } from './data/options/table-options.if';
5
- import { GeoData } from './data/geo-data';
1
+ import { ConvenienceDomService } from './service/convenience-dom.service.js';
2
+ import { DivScope } from './data/div-scope.type.js';
3
+ import { TableModelIf } from './data/tablemodel/table-model.if.js';
4
+ import { TableOptionsIf } from './data/options/table-options.if.js';
5
+ import { GeoData } from './data/geo-data.js';
6
+ import { AriaIds } from './aria/aria-ids.js';
7
+ import { AreaIdent } from './data/tablemodel/area-ident.type.js';
8
+ import { SideIdent } from './data/side-ident.type.js';
6
9
 
7
10
  /**
8
11
  * Represents a store for HTML elements.
9
12
  * @class
13
+ *
14
+ * @category Internals
10
15
  */
11
16
  export declare class EleScope {
12
17
  readonly hostElement: HTMLDivElement;
@@ -43,7 +48,33 @@ export declare class EleScope {
43
48
  protected areaBodyWestGeo: GeoData;
44
49
  protected areaBodyCenterGeo: GeoData;
45
50
  protected areaBodyEastGeo: GeoData;
51
+ /** The IDs this table uses for ARIA references (prefix from the host id). @since 1.1.91 */
52
+ readonly ariaIds: AriaIds;
46
53
  constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, dom: ConvenienceDomService, tableOptions: TableOptionsIf);
54
+ /** The values of the host attributes before the table changed them (restored by {@link removeHostAria}). */
55
+ private readonly hostAttributesBefore;
56
+ /**
57
+ * Sets (or with `undefined` removes) an ARIA attribute of the host and remembers the app's own value the first
58
+ * time, so that {@link removeHostAria} can restore it (e.g. an `aria-label` the app set on an Angular host).
59
+ *
60
+ * @since 1.1.91
61
+ */
62
+ protected setHostAriaAttribute(key: string, value: string | undefined): void;
63
+ /**
64
+ * Removes the ARIA attributes the table has set on the host element (see {@link initHostAria}).
65
+ *
66
+ * @since 1.1.91
67
+ */
68
+ protected removeHostAria(): void;
69
+ /**
70
+ * Sets the static ARIA attributes of the host element: `role="grid"` (a tree body: `"treegrid"`) and its name
71
+ * and description from the table options. Counts and the active cell follow with every render pass.
72
+ *
73
+ * @since 1.1.91
74
+ */
75
+ protected initHostAria(): void;
76
+ /** The element that holds the rows of an area (`DivScope.child`). */
77
+ protected getAreaChild(area: AreaIdent, side: SideIdent): HTMLDivElement;
47
78
  /**
48
79
  * Adjusts the containers and rows of the table based on the current state.
49
80
  *