domma-js 0.55.0 → 0.57.0

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 (116) hide show
  1. package/assets/types/generated/public/assets/flags/africa.d.ts +6 -0
  2. package/assets/types/generated/public/assets/flags/americas.d.ts +6 -0
  3. package/assets/types/generated/public/assets/flags/asia.d.ts +6 -0
  4. package/assets/types/generated/public/assets/flags/europe.d.ts +9 -0
  5. package/assets/types/generated/public/assets/flags/index.d.ts +11 -0
  6. package/assets/types/generated/public/assets/flags/oceania.d.ts +2 -0
  7. package/assets/types/generated/public/assets/icons/buildings.d.ts +6 -0
  8. package/assets/types/generated/public/assets/icons/code.d.ts +2 -0
  9. package/assets/types/generated/public/assets/icons/commerce.d.ts +7 -0
  10. package/assets/types/generated/public/assets/icons/communication.d.ts +7 -0
  11. package/assets/types/generated/public/assets/icons/devices.d.ts +6 -0
  12. package/assets/types/generated/public/assets/icons/emojis.d.ts +6 -0
  13. package/assets/types/generated/public/assets/icons/files.d.ts +7 -0
  14. package/assets/types/generated/public/assets/icons/finance.d.ts +6 -0
  15. package/assets/types/generated/public/assets/icons/forms.d.ts +5 -0
  16. package/assets/types/generated/public/assets/icons/health.d.ts +6 -0
  17. package/assets/types/generated/public/assets/icons/index.d.ts +24 -0
  18. package/assets/types/generated/public/assets/icons/media.d.ts +7 -0
  19. package/assets/types/generated/public/assets/icons/navigation.d.ts +7 -0
  20. package/assets/types/generated/public/assets/icons/seasonal.d.ts +6 -0
  21. package/assets/types/generated/public/assets/icons/social.d.ts +7 -0
  22. package/assets/types/generated/public/assets/icons/sport.d.ts +6 -0
  23. package/assets/types/generated/public/assets/icons/status.d.ts +7 -0
  24. package/assets/types/generated/public/assets/icons/transport.d.ts +7 -0
  25. package/assets/types/generated/public/assets/icons/ui.d.ts +7 -0
  26. package/assets/types/generated/public/assets/icons/weather.d.ts +6 -0
  27. package/assets/types/generated/src/auth.d.ts +424 -0
  28. package/assets/types/generated/src/avatar.d.ts +270 -0
  29. package/assets/types/generated/src/binding-source.d.ts +58 -0
  30. package/assets/types/generated/src/butterfly-drawing.d.ts +2 -0
  31. package/assets/types/generated/src/component-factory.d.ts +150 -0
  32. package/assets/types/generated/src/component.d.ts +162 -0
  33. package/assets/types/generated/src/components/back-to-top.d.ts +150 -0
  34. package/assets/types/generated/src/components/badge.d.ts +208 -0
  35. package/assets/types/generated/src/components/card.d.ts +189 -0
  36. package/assets/types/generated/src/components/command-palette.d.ts +352 -0
  37. package/assets/types/generated/src/components/dropzone.d.ts +342 -0
  38. package/assets/types/generated/src/components/focus-trap.d.ts +238 -0
  39. package/assets/types/generated/src/components/loader.d.ts +133 -0
  40. package/assets/types/generated/src/components/modal.d.ts +341 -0
  41. package/assets/types/generated/src/components/range-slider.d.ts +267 -0
  42. package/assets/types/generated/src/components/shared.d.ts +91 -0
  43. package/assets/types/generated/src/components/split-pane.d.ts +239 -0
  44. package/assets/types/generated/src/components/toast.d.ts +284 -0
  45. package/assets/types/generated/src/components/tooltip.d.ts +200 -0
  46. package/assets/types/generated/src/components/virtual-list.d.ts +340 -0
  47. package/assets/types/generated/src/config.d.ts +193 -0
  48. package/assets/types/generated/src/context-cursor.d.ts +69 -0
  49. package/assets/types/generated/src/context-menu.d.ts +596 -0
  50. package/assets/types/generated/src/dates.d.ts +367 -0
  51. package/assets/types/generated/src/dom.d.ts +1221 -0
  52. package/assets/types/generated/src/effects.d.ts +1281 -0
  53. package/assets/types/generated/src/elements.d.ts +4996 -0
  54. package/assets/types/generated/src/escape.d.ts +5 -0
  55. package/assets/types/generated/src/flags-bundle.d.ts +4 -0
  56. package/assets/types/generated/src/flags.d.ts +338 -0
  57. package/assets/types/generated/src/forms.d.ts +1060 -0
  58. package/assets/types/generated/src/globals.d.ts +45 -0
  59. package/assets/types/generated/src/http.d.ts +131 -0
  60. package/assets/types/generated/src/i18n.d.ts +261 -0
  61. package/assets/types/generated/src/icons.d.ts +213 -0
  62. package/assets/types/generated/src/index.d.ts +249 -0
  63. package/assets/types/generated/src/input-group.d.ts +135 -0
  64. package/assets/types/generated/src/models.d.ts +968 -0
  65. package/assets/types/generated/src/popover.d.ts +412 -0
  66. package/assets/types/generated/src/router.d.ts +344 -0
  67. package/assets/types/generated/src/safe-url.d.ts +10 -0
  68. package/assets/types/generated/src/sanitize.d.ts +97 -0
  69. package/assets/types/generated/src/schema-builder.d.ts +420 -0
  70. package/assets/types/generated/src/skeleton.d.ts +135 -0
  71. package/assets/types/generated/src/smooth-caret.d.ts +61 -0
  72. package/assets/types/generated/src/sortable.d.ts +369 -0
  73. package/assets/types/generated/src/storage.d.ts +93 -0
  74. package/assets/types/generated/src/tables.d.ts +901 -0
  75. package/assets/types/generated/src/theme.d.ts +277 -0
  76. package/assets/types/generated/src/ticker-tape-drawing.d.ts +2 -0
  77. package/assets/types/generated/src/treeview.d.ts +504 -0
  78. package/assets/types/generated/src/utils.d.ts +1667 -0
  79. package/assets/types/generated/src/web-components/base/domma-element.d.ts +134 -0
  80. package/assets/types/generated/src/web-components/index.d.ts +14 -0
  81. package/assets/types/generated/vendor/domma-reactive.d.ts +587 -0
  82. package/assets/types/index.d.ts +104 -216
  83. package/package.json +5 -2
  84. package/public/dist/bundles/domma-complete.css +1084 -14
  85. package/public/dist/bundles/domma-data-focused.css +1084 -14
  86. package/public/dist/bundles/domma-essentials.css +1084 -14
  87. package/public/dist/bundles/domma-full.css +1084 -14
  88. package/public/dist/bundles/domma-minimal.css +8 -8
  89. package/public/dist/domma-flags.esm.js +3 -3
  90. package/public/dist/domma-flags.esm.js.map +1 -1
  91. package/public/dist/domma-flags.min.js +3 -3
  92. package/public/dist/domma-flags.min.js.map +1 -1
  93. package/public/dist/domma-syntax.min.js +3 -3
  94. package/public/dist/domma.css +3 -3
  95. package/public/dist/domma.esm.js +5 -5
  96. package/public/dist/domma.esm.js.map +1 -1
  97. package/public/dist/domma.min.js +5 -5
  98. package/public/dist/domma.min.js.map +1 -1
  99. package/public/dist/elements.css +1073 -3
  100. package/public/dist/grid.css +3 -3
  101. package/public/dist/syntax.css +3 -3
  102. package/public/dist/themes/domma-themes.css +3 -3
  103. package/templates/kickstart/frontend/types/domma.d.ts +2 -1
  104. package/assets/types/config.d.ts +0 -136
  105. package/assets/types/dates.d.ts +0 -209
  106. package/assets/types/dom.d.ts +0 -448
  107. package/assets/types/elements.d.ts +0 -682
  108. package/assets/types/flags.d.ts +0 -130
  109. package/assets/types/http.d.ts +0 -97
  110. package/assets/types/icons.d.ts +0 -147
  111. package/assets/types/models.d.ts +0 -260
  112. package/assets/types/smooth-caret.d.ts +0 -12
  113. package/assets/types/storage.d.ts +0 -93
  114. package/assets/types/tables.d.ts +0 -327
  115. package/assets/types/theme.d.ts +0 -137
  116. package/assets/types/utils.d.ts +0 -675
@@ -0,0 +1,901 @@
1
+ /** @typedef {Record<string, any>} TableRow A data row - a plain object keyed by column key. */
2
+ /** @typedef {'asc'|'desc'} SortDirection */
3
+ /** @typedef {'single'|'multiple'} SelectionMode */
4
+ /** @typedef {'csv'|'json'|'excel'} ExportFormat Formats `download()` writes (anything else is written as JSON). */
5
+ /** @typedef {'copy'|'text'|'csv'|'excel'|'json'} TableExportOption Buttons the export panel can show ('copy' is an alias of 'text'). */
6
+ /** @typedef {'sort'|'filter'|'page'|'select'|'edit'|'render'} TableEventType */
7
+ /**
8
+ * Column filter operators. Text comparisons are case-insensitive; 'between' takes `[min, max]`,
9
+ * 'in' takes an array of values. An unknown operator compares as 'equals'.
10
+ * @typedef {'equals'|'contains'|'startsWith'|'endsWith'|'gt'|'lt'|'gte'|'lte'|'between'|'in'} FilterOperator
11
+ */
12
+ /**
13
+ * A column as passed in `options.columns` (a plain string is shorthand for `{key}`).
14
+ * @typedef {object} ColumnDefinition
15
+ * @property {string} key - Column key in the data object
16
+ * @property {string} [title] - Header text (defaults to the key)
17
+ * @property {boolean} [sortable] - false turns sorting off for this column (also off when `options.sortable` is false)
18
+ * @property {boolean} [filterable] - false marks the column as not filterable
19
+ * @property {boolean} [editable] - Double-click to edit the cell (needs `options.editable`)
20
+ * @property {string|number} [width] - Column width; a number is pixels
21
+ * @property {(value: any, row: TableRow, index: number) => string} [render] - Cell HTML (set as innerHTML)
22
+ * @property {any[]} [filterOptions] - Stored on the column for custom filter UIs
23
+ * @property {boolean} [visible] - false starts the column hidden
24
+ */
25
+ /**
26
+ * A column after normalisation, as `getColumns()` returns it.
27
+ * @typedef {object} TableColumn
28
+ * @property {string} key
29
+ * @property {string} title
30
+ * @property {boolean} sortable
31
+ * @property {boolean} filterable
32
+ * @property {boolean} editable
33
+ * @property {string|number|null} width
34
+ * @property {((value: any, row: TableRow, index: number) => string)|null} render
35
+ * @property {any[]|null} filterOptions
36
+ * @property {boolean} visible
37
+ */
38
+ /**
39
+ * @typedef {object} SortState
40
+ * @property {string} column
41
+ * @property {SortDirection} direction
42
+ */
43
+ /**
44
+ * @typedef {object} FilterState
45
+ * @property {string} column
46
+ * @property {any} value
47
+ * @property {FilterOperator} [operator]
48
+ */
49
+ /**
50
+ * @typedef {object} PageInfo
51
+ * @property {number} page - Current page (1-based)
52
+ * @property {number} pageSize
53
+ * @property {number} totalPages
54
+ * @property {number} totalRows - Rows after filtering
55
+ * @property {number} startRow - 1-based index of the first row on the page
56
+ * @property {number} endRow - 1-based index of the last row on the page
57
+ */
58
+ /**
59
+ * Payload of `onSort`: `sort()` sends column + direction + sorts, `sortMultiple()` sends sorts only.
60
+ * @typedef {object} TableSortEvent
61
+ * @property {string} [column]
62
+ * @property {SortDirection} [direction]
63
+ * @property {SortState[]} sorts
64
+ */
65
+ /**
66
+ * Payload of `onFilter`: `type: 'search'` from `search()`, `type: 'column'` from `filter()`.
67
+ * @typedef {object} TableFilterEvent
68
+ * @property {'search'|'column'} type
69
+ * @property {string} [query]
70
+ * @property {boolean} [isRegex]
71
+ * @property {string} [column]
72
+ * @property {any} [value]
73
+ * @property {FilterOperator} [operator]
74
+ */
75
+ /**
76
+ * Payload of `onEdit`.
77
+ * @typedef {object} TableEditEvent
78
+ * @property {TableRow} row
79
+ * @property {string} column
80
+ * @property {any} oldValue
81
+ * @property {string} newValue
82
+ */
83
+ /**
84
+ * Payload of `onExport`.
85
+ * @typedef {object} TableExportEvent
86
+ * @property {ExportFormat|'clipboard'} format
87
+ * @property {string} [filename]
88
+ * @property {number} rowCount
89
+ * @property {boolean} [selectedOnly]
90
+ */
91
+ /**
92
+ * What an event callback receives: sort -> TableSortEvent, filter -> TableFilterEvent,
93
+ * page -> PageInfo, select -> the selected rows, edit -> TableEditEvent, render -> the table.
94
+ * @typedef {TableSortEvent|TableFilterEvent|PageInfo|TableRow[]|TableEditEvent|TableInstance} TableEventData
95
+ */
96
+ /**
97
+ * @callback TableEventCallback
98
+ * @param {TableEventData} data - What each event sends: see TableEventData
99
+ * @returns {void}
100
+ */
101
+ /**
102
+ * CSS class names the table renders with.
103
+ * @typedef {object} TableClasses
104
+ * @property {string} [wrapper]
105
+ * @property {string} [table]
106
+ * @property {string} [header]
107
+ * @property {string} [body]
108
+ * @property {string} [row]
109
+ * @property {string} [cell]
110
+ * @property {string} [selected]
111
+ * @property {string} [sorted]
112
+ * @property {string} [sortAsc]
113
+ * @property {string} [sortDesc]
114
+ * @property {string} [pagination]
115
+ * @property {string} [search]
116
+ */
117
+ /**
118
+ * @typedef {object} TableOptions
119
+ * @property {TableRow[]} [data] - Initial data
120
+ * @property {Array<ColumnDefinition|string>} [columns] - Column definitions
121
+ * @property {string} [rowKey] - Row identity field for select / update / remove (default 'id')
122
+ * @property {boolean} [sortable] - Enable sorting (default true)
123
+ * @property {boolean} [multiSort] - Allow sorting by several columns (default false)
124
+ * @property {SortState|null} [defaultSort] - Sort applied on first render
125
+ * @property {boolean} [filterable] - Enable filtering (default true)
126
+ * @property {boolean} [searchable] - Show the search box (default true)
127
+ * @property {string} [searchPlaceholder] - Search box placeholder (default 'Search...')
128
+ * @property {boolean} [pagination] - Enable pagination (default true)
129
+ * @property {number} [pageSize] - Rows per page (default 10)
130
+ * @property {number[]} [pageSizeOptions] - Page size choices (default [10, 25, 50, 100])
131
+ * @property {boolean} [selectable] - Enable row selection (default false)
132
+ * @property {SelectionMode} [selectionMode] - default 'single'
133
+ * @property {boolean} [editable] - Enable cell editing on editable columns (default false)
134
+ * @property {string} [editMode] - default 'cell'
135
+ * @property {boolean} [resizable] - default true
136
+ * @property {boolean|number} [loadingSkeleton] - Skeleton rows until the first setData()/addRow(): true = min(pageSize, 5), or a row count
137
+ * @property {string} [loadingLabel] - Screen-reader status while loading (default 'Loading...')
138
+ * @property {boolean} [striped] - Striped rows (default true)
139
+ * @property {boolean} [hover] - Row hover colour (default true)
140
+ * @property {boolean} [bordered] - default true
141
+ * @property {boolean} [responsive] - default true
142
+ * @property {string|null} [evenRowColor] - Named variant (see TableInstance.stripeColors), hex/rgb/hsl or var()
143
+ * @property {string|null} [oddRowColor] - Named variant or colour
144
+ * @property {string|null} [hoverColor] - Named variant (see TableInstance.hoverColors) or colour
145
+ * @property {TableClasses} [classes] - CSS class names
146
+ * @property {boolean} [exportPanel] - Show the export panel (default false)
147
+ * @property {TableExportOption[]} [exportOptions] - Export panel buttons (default ['copy', 'csv', 'excel', 'json'])
148
+ * @property {boolean} [columnToggle] - Show the column visibility menu (default false)
149
+ * @property {boolean} [regexSearch] - Show the regex search toggle (default false)
150
+ * @property {boolean} [persistSettings] - Remember column visibility/width, sorting and page size (default false)
151
+ * @property {string|null} [storageKey] - Storage key (defaults to `domma-table-<element id>`)
152
+ * @property {((event: TableSortEvent) => void)|null} [onSort]
153
+ * @property {((event: TableFilterEvent) => void)|null} [onFilter]
154
+ * @property {((info: PageInfo) => void)|null} [onPageChange]
155
+ * @property {((selected: TableRow[]) => void)|null} [onSelect]
156
+ * @property {((event: TableEditEvent) => void)|null} [onEdit]
157
+ * @property {((table: TableInstance) => void)|null} [onRender]
158
+ * @property {((event: TableExportEvent) => void)|null} [onExport]
159
+ */
160
+ /**
161
+ * Table Instance Class
162
+ */
163
+ export class TableInstance {
164
+ static stripeColors: {
165
+ none: string;
166
+ lighter: string;
167
+ light: string;
168
+ medium: string;
169
+ dark: string;
170
+ 'primary-tint': string;
171
+ 'success-tint': string;
172
+ 'warning-tint': string;
173
+ 'danger-tint': string;
174
+ 'info-tint': string;
175
+ default: string;
176
+ };
177
+ static hoverColors: {
178
+ none: string;
179
+ lighter: string;
180
+ light: string;
181
+ medium: string;
182
+ dark: string;
183
+ default: string;
184
+ };
185
+ /**
186
+ * @param {string|HTMLElement|null} element - Container element or selector
187
+ * @param {TableOptions} [options]
188
+ */
189
+ constructor(element: string | HTMLElement | null, options?: TableOptions);
190
+ /** @type {HTMLElement|null} */
191
+ element: HTMLElement | null;
192
+ /** @type {TableOptions} */
193
+ options: TableOptions;
194
+ _originalData: TableRow[];
195
+ _data: TableRow[];
196
+ _filteredData: TableRow[];
197
+ _currentPage: number;
198
+ _pageSize: number;
199
+ _sorts: any[];
200
+ _filters: any[];
201
+ _searchQuery: string;
202
+ _selected: Set<any>;
203
+ _editingCell: {
204
+ rowIndex: number;
205
+ column: string;
206
+ };
207
+ _eventListeners: Map<any, any>;
208
+ _columnDropdownOpen: boolean;
209
+ _searchIsRegex: boolean;
210
+ _loading: boolean;
211
+ /** @type {TableColumn[]} @private */
212
+ private _columns;
213
+ /** @private */
214
+ private _init;
215
+ /**
216
+ * Resolve a color value - supports named variants, CSS variables, and direct colors
217
+ * @param {string} colorValue - Named variant (e.g., 'light') or direct color (e.g., '#fff')
218
+ * @param {Object} colorMap - Dictionary to lookup named variants
219
+ * @param {string} fallback - Fallback color if value is invalid
220
+ * @returns {string} Resolved color value
221
+ * @private
222
+ */
223
+ private _resolveColor;
224
+ /**
225
+ * Get the stripe color configuration for a row
226
+ * @param {number} rowIndex - The row index (0-based)
227
+ * @returns {Object} Object with { background, hover } colors
228
+ * @private
229
+ */
230
+ private _getRowColors;
231
+ /**
232
+ * Replace the data (ends a loadingSkeleton state) and go to page 1.
233
+ * @param {TableRow[]} data
234
+ * @returns {this}
235
+ */
236
+ setData(data: TableRow[]): this;
237
+ /**
238
+ * Rows on the current page (filtered and sorted).
239
+ * @returns {TableRow[]}
240
+ */
241
+ getData(): TableRow[];
242
+ /**
243
+ * Show (or hide) skeleton rows in place of the body - for a reload. The
244
+ * first setData() or addRow() turns it off again.
245
+ * @param {boolean} [on=true]
246
+ * @returns {this}
247
+ */
248
+ setLoading(on?: boolean): this;
249
+ /**
250
+ * Whether skeleton rows are showing.
251
+ * @returns {boolean}
252
+ */
253
+ isLoading(): boolean;
254
+ /**
255
+ * Every row that passes the search and filters, sorted.
256
+ * @returns {TableRow[]}
257
+ */
258
+ getFilteredData(): TableRow[];
259
+ /**
260
+ * The data as given, unfiltered and unsorted.
261
+ * @returns {TableRow[]}
262
+ */
263
+ getOriginalData(): TableRow[];
264
+ /**
265
+ * Append a row (ends a loadingSkeleton state).
266
+ * @param {TableRow} rowData
267
+ * @returns {this}
268
+ */
269
+ addRow(rowData: TableRow): this;
270
+ /**
271
+ * Merge values into a row.
272
+ * @param {number|string} identifier - Index in the original data (a number), or the row's `rowKey` value
273
+ * @param {Partial<TableRow>} rowData
274
+ * @returns {this}
275
+ */
276
+ updateRow(identifier: number | string, rowData: Partial<TableRow>): this;
277
+ /**
278
+ * @param {number|string} identifier - Index in the original data (a number), or the row's `rowKey` value
279
+ * @returns {this}
280
+ */
281
+ removeRow(identifier: number | string): this;
282
+ /** @private */
283
+ private _findRowIndex;
284
+ /**
285
+ * Sort by one column (replaces any other sort).
286
+ * @param {string} column
287
+ * @param {SortDirection} [direction='asc']
288
+ * @returns {this}
289
+ */
290
+ sort(column: string, direction?: SortDirection): this;
291
+ /**
292
+ * Sort by several columns, first entry first.
293
+ * @param {SortState[]} sorts
294
+ * @returns {this}
295
+ */
296
+ sortMultiple(sorts: SortState[]): this;
297
+ /** @returns {this} */
298
+ clearSort(): this;
299
+ /** @private */
300
+ private _applySort;
301
+ /**
302
+ * Search every column (plain text, case-insensitive, or a regular expression in regex mode).
303
+ * @param {string} query
304
+ * @returns {this}
305
+ */
306
+ search(query: string): this;
307
+ /**
308
+ * @param {boolean} isRegex - true treats the search query as a regular expression
309
+ * @returns {this}
310
+ */
311
+ setSearchMode(isRegex: boolean): this;
312
+ /** @returns {this} */
313
+ toggleSearchMode(): this;
314
+ /**
315
+ * Filter one column (replaces that column's earlier filter; an empty value removes it).
316
+ * @param {string} column
317
+ * @param {any} value
318
+ * @param {FilterOperator} [operator='equals']
319
+ * @returns {this}
320
+ */
321
+ filter(column: string, value: any, operator?: FilterOperator): this;
322
+ /**
323
+ * Filter with a custom predicate (replaces the previous one).
324
+ * @param {(row: TableRow, index: number, rows: TableRow[]) => boolean} filterFn
325
+ * @returns {this}
326
+ */
327
+ filterBy(filterFn: (row: TableRow, index: number, rows: TableRow[]) => boolean): this;
328
+ _customFilter: (row: TableRow, index: number, rows: TableRow[]) => boolean;
329
+ /**
330
+ * Clear the column filters, the search and the custom filter.
331
+ * @returns {this}
332
+ */
333
+ clearFilters(): this;
334
+ /** @private */
335
+ private _applyFilters;
336
+ /** @private */
337
+ private _matchFilter;
338
+ /** @private */
339
+ private _applyFiltersAndSort;
340
+ /**
341
+ * Go to a page (1-based, clamped to the page range).
342
+ * @param {number} pageNum
343
+ * @returns {this}
344
+ */
345
+ page(pageNum: number): this;
346
+ /**
347
+ * @param {number} size - Rows per page
348
+ * @returns {this}
349
+ */
350
+ pageSize(size: number): this;
351
+ /** @returns {this} */
352
+ nextPage(): this;
353
+ /** @returns {this} */
354
+ prevPage(): this;
355
+ /** @returns {this} */
356
+ firstPage(): this;
357
+ /** @returns {this} */
358
+ lastPage(): this;
359
+ /** @returns {PageInfo} */
360
+ pageInfo(): PageInfo;
361
+ /** @private */
362
+ private _getTotalPages;
363
+ /** @private */
364
+ private _getPageData;
365
+ /**
366
+ * Select a row (needs `selectable`; in 'single' mode it replaces the selection).
367
+ * @param {string|number|TableRow} identifier - The row's `rowKey` value, or the row itself
368
+ * @returns {this}
369
+ */
370
+ select(identifier: string | number | TableRow): this;
371
+ /**
372
+ * @param {string|number|TableRow} identifier - The row's `rowKey` value, or the row itself
373
+ * @returns {this}
374
+ */
375
+ deselect(identifier: string | number | TableRow): this;
376
+ /**
377
+ * @param {string|number|TableRow} identifier - The row's `rowKey` value, or the row itself
378
+ * @returns {this}
379
+ */
380
+ toggleSelect(identifier: string | number | TableRow): this;
381
+ /**
382
+ * Select every filtered row ('multiple' mode only).
383
+ * @returns {this}
384
+ */
385
+ selectAll(): this;
386
+ /** @returns {this} */
387
+ deselectAll(): this;
388
+ /**
389
+ * Selected rows among the filtered data.
390
+ * @returns {TableRow[]}
391
+ */
392
+ getSelected(): TableRow[];
393
+ /**
394
+ * @param {string|number|TableRow} identifier - The row's `rowKey` value, or the row itself
395
+ * @returns {boolean}
396
+ */
397
+ isSelected(identifier: string | number | TableRow): boolean;
398
+ /** @private */
399
+ private _getStorageKey;
400
+ /** @private */
401
+ private _loadSettings;
402
+ /** @private */
403
+ private _saveSettings;
404
+ /**
405
+ * Forget the persisted settings (with `persistSettings`).
406
+ * @returns {void}
407
+ */
408
+ clearSettings(): void;
409
+ /**
410
+ * @param {string} key
411
+ * @returns {this}
412
+ */
413
+ showColumn(key: string): this;
414
+ /**
415
+ * @param {string} key
416
+ * @returns {this}
417
+ */
418
+ hideColumn(key: string): this;
419
+ /**
420
+ * @param {string} key
421
+ * @returns {this}
422
+ */
423
+ toggleColumn(key: string): this;
424
+ /** @returns {TableColumn[]} */
425
+ getVisibleColumns(): TableColumn[];
426
+ /** @returns {TableColumn[]} */
427
+ getHiddenColumns(): TableColumn[];
428
+ /**
429
+ * @param {string} key
430
+ * @param {string|number} width - A number is pixels
431
+ * @returns {this}
432
+ */
433
+ resizeColumn(key: string, width: string | number): this;
434
+ /** @returns {TableColumn[]} */
435
+ getColumns(): TableColumn[];
436
+ /**
437
+ * Open a cell's editor (needs `editable`).
438
+ * @param {number} rowIndex - Row index on the current page
439
+ * @param {string} column
440
+ * @returns {this}
441
+ */
442
+ editCell(rowIndex: number, column: string): this;
443
+ /** @returns {this} */
444
+ saveEdits(): this;
445
+ /** @returns {this} */
446
+ cancelEdits(): this;
447
+ /**
448
+ * Selected rows if any, otherwise every filtered row, as CSV.
449
+ * @param {{columns?: TableColumn[], includeHeaders?: boolean}} [options]
450
+ * @returns {string}
451
+ */
452
+ toCSV(options?: {
453
+ columns?: TableColumn[];
454
+ includeHeaders?: boolean;
455
+ }): string;
456
+ /** @private */
457
+ private _getExportData;
458
+ /**
459
+ * Selected rows if any, otherwise every filtered row, as a JSON string (visible columns only).
460
+ * @param {{columns?: TableColumn[], pretty?: boolean}} [options]
461
+ * @returns {string}
462
+ */
463
+ toJSON(options?: {
464
+ columns?: TableColumn[];
465
+ pretty?: boolean;
466
+ }): string;
467
+ /**
468
+ * Download the export as a file (default name data.csv / data.xls / data.json).
469
+ * @param {ExportFormat} format
470
+ * @param {string} [filename]
471
+ * @returns {void}
472
+ */
473
+ download(format: ExportFormat, filename?: string): void;
474
+ /**
475
+ * Selected rows if any, otherwise every filtered row, as an Excel-readable HTML document.
476
+ * @param {{columns?: TableColumn[]}} [options]
477
+ * @returns {string}
478
+ */
479
+ toExcel(options?: {
480
+ columns?: TableColumn[];
481
+ }): string;
482
+ /**
483
+ * Copy the export to the clipboard: 'text' (tab-separated, default), 'csv' or 'json'.
484
+ * @param {'text'|'csv'|'json'} [format='text']
485
+ * @returns {Promise<this>}
486
+ */
487
+ copyToClipboard(format?: "text" | "csv" | "json"): Promise<this>;
488
+ /** @private */
489
+ private _escapeHtml;
490
+ /**
491
+ * Rebuild the table's DOM.
492
+ * @returns {this}
493
+ */
494
+ render(): this;
495
+ /** @private */
496
+ private _reinitRenderedContent;
497
+ /** @private */
498
+ private _addEventHandler;
499
+ /** @private */
500
+ private _clearEventListeners;
501
+ /** @private */
502
+ private _restoreIconsBeforeRebuild;
503
+ /**
504
+ * @overload
505
+ * @param {'sort'} event
506
+ * @param {(event: TableSortEvent) => void} callback
507
+ * @returns {this}
508
+ */
509
+ on(event: "sort", callback: (event: TableSortEvent) => void): this;
510
+ /**
511
+ * @overload
512
+ * @param {'filter'} event
513
+ * @param {(event: TableFilterEvent) => void} callback
514
+ * @returns {this}
515
+ */
516
+ on(event: "filter", callback: (event: TableFilterEvent) => void): this;
517
+ /**
518
+ * @overload
519
+ * @param {'page'} event
520
+ * @param {(info: PageInfo) => void} callback
521
+ * @returns {this}
522
+ */
523
+ on(event: "page", callback: (info: PageInfo) => void): this;
524
+ /**
525
+ * @overload
526
+ * @param {'select'} event
527
+ * @param {(selected: TableRow[]) => void} callback
528
+ * @returns {this}
529
+ */
530
+ on(event: "select", callback: (selected: TableRow[]) => void): this;
531
+ /**
532
+ * @overload
533
+ * @param {'edit'} event
534
+ * @param {(event: TableEditEvent) => void} callback
535
+ * @returns {this}
536
+ */
537
+ on(event: "edit", callback: (event: TableEditEvent) => void): this;
538
+ /**
539
+ * @overload
540
+ * @param {'render'} event
541
+ * @param {(table: TableInstance) => void} callback
542
+ * @returns {this}
543
+ */
544
+ on(event: "render", callback: (table: TableInstance) => void): this;
545
+ /**
546
+ * @overload
547
+ * @param {TableEventType} event
548
+ * @param {TableEventCallback} callback
549
+ * @returns {this}
550
+ */
551
+ on(event: TableEventType, callback: TableEventCallback): this;
552
+ /**
553
+ * Remove the callback for an event.
554
+ * @param {TableEventType} event
555
+ * @returns {this}
556
+ */
557
+ off(event: TableEventType): this;
558
+ /**
559
+ * Re-apply filters and sort, then render.
560
+ * @returns {this}
561
+ */
562
+ refresh(): this;
563
+ /**
564
+ * Remove the listeners and empty the element.
565
+ * @returns {void}
566
+ */
567
+ destroy(): void;
568
+ }
569
+ export namespace tables {
570
+ let _instances: Map<HTMLElement, TableInstance>;
571
+ /**
572
+ * Create a table in a container (a later create on the same element replaces the registered one).
573
+ * @param {string|HTMLElement} selector - Container element or selector
574
+ * @param {TableOptions} [options]
575
+ * @returns {TableInstance}
576
+ */
577
+ function create(selector: string | HTMLElement, options?: TableOptions): TableInstance;
578
+ /**
579
+ * The table created in a container, if any.
580
+ * @param {string|HTMLElement} selector
581
+ * @returns {TableInstance|undefined}
582
+ */
583
+ function get(selector: string | HTMLElement): TableInstance | undefined;
584
+ /**
585
+ * Destroy the table in a container and forget it.
586
+ * @param {string|HTMLElement} selector
587
+ * @returns {void}
588
+ */
589
+ function destroy(selector: string | HTMLElement): void;
590
+ /**
591
+ * Destroy every table created through `tables.create()`.
592
+ * @returns {void}
593
+ */
594
+ function destroyAll(): void;
595
+ }
596
+ /**
597
+ * A data row - a plain object keyed by column key.
598
+ */
599
+ export type TableRow = Record<string, any>;
600
+ export type SortDirection = "asc" | "desc";
601
+ export type SelectionMode = "single" | "multiple";
602
+ /**
603
+ * Formats `download()` writes (anything else is written as JSON).
604
+ */
605
+ export type ExportFormat = "csv" | "json" | "excel";
606
+ /**
607
+ * Buttons the export panel can show ('copy' is an alias of 'text').
608
+ */
609
+ export type TableExportOption = "copy" | "text" | "csv" | "excel" | "json";
610
+ export type TableEventType = "sort" | "filter" | "page" | "select" | "edit" | "render";
611
+ /**
612
+ * Column filter operators. Text comparisons are case-insensitive; 'between' takes `[min, max]`,
613
+ * 'in' takes an array of values. An unknown operator compares as 'equals'.
614
+ */
615
+ export type FilterOperator = "equals" | "contains" | "startsWith" | "endsWith" | "gt" | "lt" | "gte" | "lte" | "between" | "in";
616
+ /**
617
+ * A column as passed in `options.columns` (a plain string is shorthand for `{key}`).
618
+ */
619
+ export type ColumnDefinition = {
620
+ /**
621
+ * - Column key in the data object
622
+ */
623
+ key: string;
624
+ /**
625
+ * - Header text (defaults to the key)
626
+ */
627
+ title?: string;
628
+ /**
629
+ * - false turns sorting off for this column (also off when `options.sortable` is false)
630
+ */
631
+ sortable?: boolean;
632
+ /**
633
+ * - false marks the column as not filterable
634
+ */
635
+ filterable?: boolean;
636
+ /**
637
+ * - Double-click to edit the cell (needs `options.editable`)
638
+ */
639
+ editable?: boolean;
640
+ /**
641
+ * - Column width; a number is pixels
642
+ */
643
+ width?: string | number;
644
+ /**
645
+ * - Cell HTML (set as innerHTML)
646
+ */
647
+ render?: (value: any, row: TableRow, index: number) => string;
648
+ /**
649
+ * - Stored on the column for custom filter UIs
650
+ */
651
+ filterOptions?: any[];
652
+ /**
653
+ * - false starts the column hidden
654
+ */
655
+ visible?: boolean;
656
+ };
657
+ /**
658
+ * A column after normalisation, as `getColumns()` returns it.
659
+ */
660
+ export type TableColumn = {
661
+ key: string;
662
+ title: string;
663
+ sortable: boolean;
664
+ filterable: boolean;
665
+ editable: boolean;
666
+ width: string | number | null;
667
+ render: ((value: any, row: TableRow, index: number) => string) | null;
668
+ filterOptions: any[] | null;
669
+ visible: boolean;
670
+ };
671
+ export type SortState = {
672
+ column: string;
673
+ direction: SortDirection;
674
+ };
675
+ export type FilterState = {
676
+ column: string;
677
+ value: any;
678
+ operator?: FilterOperator;
679
+ };
680
+ export type PageInfo = {
681
+ /**
682
+ * - Current page (1-based)
683
+ */
684
+ page: number;
685
+ pageSize: number;
686
+ totalPages: number;
687
+ /**
688
+ * - Rows after filtering
689
+ */
690
+ totalRows: number;
691
+ /**
692
+ * - 1-based index of the first row on the page
693
+ */
694
+ startRow: number;
695
+ /**
696
+ * - 1-based index of the last row on the page
697
+ */
698
+ endRow: number;
699
+ };
700
+ /**
701
+ * Payload of `onSort`: `sort()` sends column + direction + sorts, `sortMultiple()` sends sorts only.
702
+ */
703
+ export type TableSortEvent = {
704
+ column?: string;
705
+ direction?: SortDirection;
706
+ sorts: SortState[];
707
+ };
708
+ /**
709
+ * Payload of `onFilter`: `type: 'search'` from `search()`, `type: 'column'` from `filter()`.
710
+ */
711
+ export type TableFilterEvent = {
712
+ type: "search" | "column";
713
+ query?: string;
714
+ isRegex?: boolean;
715
+ column?: string;
716
+ value?: any;
717
+ operator?: FilterOperator;
718
+ };
719
+ /**
720
+ * Payload of `onEdit`.
721
+ */
722
+ export type TableEditEvent = {
723
+ row: TableRow;
724
+ column: string;
725
+ oldValue: any;
726
+ newValue: string;
727
+ };
728
+ /**
729
+ * Payload of `onExport`.
730
+ */
731
+ export type TableExportEvent = {
732
+ format: ExportFormat | "clipboard";
733
+ filename?: string;
734
+ rowCount: number;
735
+ selectedOnly?: boolean;
736
+ };
737
+ /**
738
+ * What an event callback receives: sort -> TableSortEvent, filter -> TableFilterEvent,
739
+ * page -> PageInfo, select -> the selected rows, edit -> TableEditEvent, render -> the table.
740
+ */
741
+ export type TableEventData = TableSortEvent | TableFilterEvent | PageInfo | TableRow[] | TableEditEvent | TableInstance;
742
+ export type TableEventCallback = (data: TableEventData) => void;
743
+ /**
744
+ * CSS class names the table renders with.
745
+ */
746
+ export type TableClasses = {
747
+ wrapper?: string;
748
+ table?: string;
749
+ header?: string;
750
+ body?: string;
751
+ row?: string;
752
+ cell?: string;
753
+ selected?: string;
754
+ sorted?: string;
755
+ sortAsc?: string;
756
+ sortDesc?: string;
757
+ pagination?: string;
758
+ search?: string;
759
+ };
760
+ export type TableOptions = {
761
+ /**
762
+ * - Initial data
763
+ */
764
+ data?: TableRow[];
765
+ /**
766
+ * - Column definitions
767
+ */
768
+ columns?: Array<ColumnDefinition | string>;
769
+ /**
770
+ * - Row identity field for select / update / remove (default 'id')
771
+ */
772
+ rowKey?: string;
773
+ /**
774
+ * - Enable sorting (default true)
775
+ */
776
+ sortable?: boolean;
777
+ /**
778
+ * - Allow sorting by several columns (default false)
779
+ */
780
+ multiSort?: boolean;
781
+ /**
782
+ * - Sort applied on first render
783
+ */
784
+ defaultSort?: SortState | null;
785
+ /**
786
+ * - Enable filtering (default true)
787
+ */
788
+ filterable?: boolean;
789
+ /**
790
+ * - Show the search box (default true)
791
+ */
792
+ searchable?: boolean;
793
+ /**
794
+ * - Search box placeholder (default 'Search...')
795
+ */
796
+ searchPlaceholder?: string;
797
+ /**
798
+ * - Enable pagination (default true)
799
+ */
800
+ pagination?: boolean;
801
+ /**
802
+ * - Rows per page (default 10)
803
+ */
804
+ pageSize?: number;
805
+ /**
806
+ * - Page size choices (default [10, 25, 50, 100])
807
+ */
808
+ pageSizeOptions?: number[];
809
+ /**
810
+ * - Enable row selection (default false)
811
+ */
812
+ selectable?: boolean;
813
+ /**
814
+ * - default 'single'
815
+ */
816
+ selectionMode?: SelectionMode;
817
+ /**
818
+ * - Enable cell editing on editable columns (default false)
819
+ */
820
+ editable?: boolean;
821
+ /**
822
+ * - default 'cell'
823
+ */
824
+ editMode?: string;
825
+ /**
826
+ * - default true
827
+ */
828
+ resizable?: boolean;
829
+ /**
830
+ * - Skeleton rows until the first setData()/addRow(): true = min(pageSize, 5), or a row count
831
+ */
832
+ loadingSkeleton?: boolean | number;
833
+ /**
834
+ * - Screen-reader status while loading (default 'Loading...')
835
+ */
836
+ loadingLabel?: string;
837
+ /**
838
+ * - Striped rows (default true)
839
+ */
840
+ striped?: boolean;
841
+ /**
842
+ * - Row hover colour (default true)
843
+ */
844
+ hover?: boolean;
845
+ /**
846
+ * - default true
847
+ */
848
+ bordered?: boolean;
849
+ /**
850
+ * - default true
851
+ */
852
+ responsive?: boolean;
853
+ /**
854
+ * - Named variant (see TableInstance.stripeColors), hex/rgb/hsl or var()
855
+ */
856
+ evenRowColor?: string | null;
857
+ /**
858
+ * - Named variant or colour
859
+ */
860
+ oddRowColor?: string | null;
861
+ /**
862
+ * - Named variant (see TableInstance.hoverColors) or colour
863
+ */
864
+ hoverColor?: string | null;
865
+ /**
866
+ * - CSS class names
867
+ */
868
+ classes?: TableClasses;
869
+ /**
870
+ * - Show the export panel (default false)
871
+ */
872
+ exportPanel?: boolean;
873
+ /**
874
+ * - Export panel buttons (default ['copy', 'csv', 'excel', 'json'])
875
+ */
876
+ exportOptions?: TableExportOption[];
877
+ /**
878
+ * - Show the column visibility menu (default false)
879
+ */
880
+ columnToggle?: boolean;
881
+ /**
882
+ * - Show the regex search toggle (default false)
883
+ */
884
+ regexSearch?: boolean;
885
+ /**
886
+ * - Remember column visibility/width, sorting and page size (default false)
887
+ */
888
+ persistSettings?: boolean;
889
+ /**
890
+ * - Storage key (defaults to `domma-table-<element id>`)
891
+ */
892
+ storageKey?: string | null;
893
+ onSort?: ((event: TableSortEvent) => void) | null;
894
+ onFilter?: ((event: TableFilterEvent) => void) | null;
895
+ onPageChange?: ((info: PageInfo) => void) | null;
896
+ onSelect?: ((selected: TableRow[]) => void) | null;
897
+ onEdit?: ((event: TableEditEvent) => void) | null;
898
+ onRender?: ((table: TableInstance) => void) | null;
899
+ onExport?: ((event: TableExportEvent) => void) | null;
900
+ };
901
+ export type Tables = typeof tables;