@fusion.dev/helix-headless 0.239.0 → 0.240.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 (89) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/column-manager/index.d.ts +1 -0
  4. package/dist/column-manager/index.js +1 -0
  5. package/dist/column-manager/root/column-manager-root.d.ts +137 -0
  6. package/dist/column-manager/root/column-manager-root.js +253 -0
  7. package/dist/data-table/binding.d.ts +85 -0
  8. package/dist/data-table/binding.js +58 -0
  9. package/dist/data-table/edit.d.ts +47 -0
  10. package/dist/data-table/edit.js +60 -0
  11. package/dist/data-table/events/before-cell-commit.d.ts +16 -0
  12. package/dist/data-table/events/before-cell-commit.js +11 -0
  13. package/dist/data-table/events/before-cell-edit.d.ts +13 -0
  14. package/dist/data-table/events/before-cell-edit.js +11 -0
  15. package/dist/data-table/events/before-export.d.ts +15 -0
  16. package/dist/data-table/events/before-export.js +11 -0
  17. package/dist/data-table/events/before-view-change.d.ts +16 -0
  18. package/dist/data-table/events/before-view-change.js +11 -0
  19. package/dist/data-table/events/cell-commit.d.ts +12 -0
  20. package/dist/data-table/events/cell-commit.js +11 -0
  21. package/dist/data-table/events/cell-edit.d.ts +11 -0
  22. package/dist/data-table/events/cell-edit.js +11 -0
  23. package/dist/data-table/events/details.d.ts +47 -0
  24. package/dist/data-table/events/export.d.ts +11 -0
  25. package/dist/data-table/events/export.js +11 -0
  26. package/dist/data-table/events/index.d.ts +18 -2
  27. package/dist/data-table/events/index.js +17 -1
  28. package/dist/data-table/events/view-change.d.ts +12 -0
  29. package/dist/data-table/events/view-change.js +11 -0
  30. package/dist/data-table/export.d.ts +43 -0
  31. package/dist/data-table/export.js +26 -0
  32. package/dist/data-table/index.d.ts +2 -0
  33. package/dist/data-table/index.js +2 -0
  34. package/dist/data-table/root/data-table-root.d.ts +406 -26
  35. package/dist/data-table/root/data-table-root.js +959 -30
  36. package/dist/data-table/view.d.ts +124 -0
  37. package/dist/data-table/view.js +249 -0
  38. package/dist/data-table/xlsx/index.d.ts +27 -0
  39. package/dist/data-table/xlsx/index.js +119 -0
  40. package/dist/date-input/root/date-input-root.d.ts +7 -0
  41. package/dist/date-input/root/date-input-root.js +9 -1
  42. package/dist/element-events.generated.js +9 -0
  43. package/dist/filter-input/root/filter-input-root.d.ts +31 -0
  44. package/dist/filter-input/root/filter-input-root.js +94 -12
  45. package/dist/filter-input/table.d.ts +64 -0
  46. package/dist/filter-input/table.js +76 -0
  47. package/dist/index.d.ts +5 -0
  48. package/dist/index.js +5 -0
  49. package/dist/input/root/input-root.d.ts +7 -0
  50. package/dist/input/root/input-root.js +9 -1
  51. package/dist/number-input/root/number-input-root.d.ts +7 -0
  52. package/dist/number-input/root/number-input-root.js +9 -1
  53. package/dist/quick-filters/events/before-view-save.d.ts +14 -0
  54. package/dist/quick-filters/events/before-view-save.js +11 -0
  55. package/dist/quick-filters/events/details.d.ts +10 -0
  56. package/dist/quick-filters/events/details.js +1 -0
  57. package/dist/quick-filters/events/index.d.ts +16 -0
  58. package/dist/quick-filters/events/index.js +9 -0
  59. package/dist/quick-filters/events/view-save.d.ts +11 -0
  60. package/dist/quick-filters/events/view-save.js +11 -0
  61. package/dist/quick-filters/filter/quick-filter.d.ts +48 -0
  62. package/dist/quick-filters/filter/quick-filter.js +33 -0
  63. package/dist/quick-filters/index.d.ts +3 -0
  64. package/dist/quick-filters/index.js +3 -0
  65. package/dist/quick-filters/root/quick-filters-root.d.ts +118 -0
  66. package/dist/quick-filters/root/quick-filters-root.js +183 -0
  67. package/dist/selection-bar/index.d.ts +1 -0
  68. package/dist/selection-bar/index.js +1 -0
  69. package/dist/selection-bar/root/selection-bar-root.d.ts +65 -0
  70. package/dist/selection-bar/root/selection-bar-root.js +44 -0
  71. package/dist/table/column/table-column.d.ts +82 -0
  72. package/dist/table/column/table-column.js +54 -0
  73. package/dist/table/column-type.d.ts +7 -0
  74. package/dist/table/column-type.js +1 -0
  75. package/dist/table-export/index.d.ts +1 -0
  76. package/dist/table-export/index.js +1 -0
  77. package/dist/table-export/root/table-export-root.d.ts +132 -0
  78. package/dist/table-export/root/table-export-root.js +233 -0
  79. package/dist/view-panel/index.d.ts +1 -0
  80. package/dist/view-panel/index.js +1 -0
  81. package/dist/view-panel/root/view-panel-root.d.ts +132 -0
  82. package/dist/view-panel/root/view-panel-root.js +209 -0
  83. package/examples.json +1 -1
  84. package/lint.json +1 -1
  85. package/package.json +5 -5
  86. package/types/jsx.d.ts +1231 -9
  87. package/types/svelte.d.ts +6 -0
  88. package/types/vue.d.ts +605 -6
  89. package/types/words.d.ts +305 -5
@@ -11,20 +11,32 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
11
11
  super(...arguments);
12
12
  this.cell = undefined;
13
13
  this.compare = undefined;
14
+ this.editable = false;
15
+ this.editor = undefined;
14
16
  this.field = '';
17
+ this.filterable = false;
18
+ this.max = '';
15
19
  this.menu = false;
16
20
  this.menuLabel = '{named, select, no {Column menu} other {{name} column menu}}';
21
+ this.min = '';
17
22
  this.minTableWidth = '';
18
23
  this.moveLabel = '{named, select, no {Move column} other {Move {name}}}';
24
+ this.pattern = '';
25
+ this.required = false;
19
26
  this.resizable = false;
20
27
  this.resizeLabel = '{named, select, no {Resize column} other {Resize {name}}}';
28
+ this.rowEditable = undefined;
21
29
  this.rowHeader = false;
30
+ this.searchable = false;
22
31
  this.sortable = false;
32
+ this.validate = undefined;
23
33
  this.width = '';
24
34
  this.widthLabel = '{width, plural, one {# pixel} other {# pixels}}';
25
35
  this.isTableColumn = true;
26
36
  this.sorted = undefined;
27
37
  this.movable = false;
38
+ this.pinned = undefined;
39
+ this.pinOffset = 0;
28
40
  this.gridCell = false;
29
41
  this.tabStop = false;
30
42
  this.sortWords = '';
@@ -99,6 +111,8 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
99
111
  this.toggleState('has-menu', this.drawsMenu);
100
112
  this.toggleState('sorted-ascending', this.sorted === 'ascending');
101
113
  this.toggleState('sorted-descending', this.sorted === 'descending');
114
+ this.toggleState('pinned-start', this.pinned === 'start');
115
+ this.toggleState('pinned-end', this.pinned === 'end');
102
116
  }
103
117
  get cellBox() {
104
118
  return this.partNamed('column');
@@ -190,6 +204,7 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
190
204
  const hasMenu = this.drawsMenu;
191
205
  return html `<span
192
206
  part="column"
207
+ style=${this.pinned ? `--table-column-pin-offset: ${this.pinOffset}px` : nothing}
193
208
  role=${grid ? 'columnheader' : nothing}
194
209
  tabindex=${grid ? (this.tabStop ? '0' : '-1') : nothing}
195
210
  aria-sort=${grid && this.canSort ? (this.sorted ?? 'none') : nothing}
@@ -243,9 +258,21 @@ __decorate([
243
258
  __decorate([
244
259
  property({ attribute: false })
245
260
  ], HelixHeadlessTableColumn.prototype, "compare", void 0);
261
+ __decorate([
262
+ property({ type: Boolean })
263
+ ], HelixHeadlessTableColumn.prototype, "editable", void 0);
264
+ __decorate([
265
+ property({ attribute: false })
266
+ ], HelixHeadlessTableColumn.prototype, "editor", void 0);
246
267
  __decorate([
247
268
  property()
248
269
  ], HelixHeadlessTableColumn.prototype, "field", void 0);
270
+ __decorate([
271
+ property({ type: Boolean })
272
+ ], HelixHeadlessTableColumn.prototype, "filterable", void 0);
273
+ __decorate([
274
+ property()
275
+ ], HelixHeadlessTableColumn.prototype, "max", void 0);
249
276
  __decorate([
250
277
  property({ type: Boolean })
251
278
  ], HelixHeadlessTableColumn.prototype, "menu", void 0);
@@ -253,6 +280,9 @@ __decorate([
253
280
  words,
254
281
  property({ attribute: 'menu-label' })
255
282
  ], HelixHeadlessTableColumn.prototype, "menuLabel", void 0);
283
+ __decorate([
284
+ property()
285
+ ], HelixHeadlessTableColumn.prototype, "min", void 0);
256
286
  __decorate([
257
287
  property({ attribute: 'min-table-width' })
258
288
  ], HelixHeadlessTableColumn.prototype, "minTableWidth", void 0);
@@ -260,6 +290,12 @@ __decorate([
260
290
  words,
261
291
  property({ attribute: 'move-label' })
262
292
  ], HelixHeadlessTableColumn.prototype, "moveLabel", void 0);
293
+ __decorate([
294
+ property()
295
+ ], HelixHeadlessTableColumn.prototype, "pattern", void 0);
296
+ __decorate([
297
+ property({ type: Boolean })
298
+ ], HelixHeadlessTableColumn.prototype, "required", void 0);
263
299
  __decorate([
264
300
  property({ type: Boolean })
265
301
  ], HelixHeadlessTableColumn.prototype, "resizable", void 0);
@@ -267,15 +303,27 @@ __decorate([
267
303
  words,
268
304
  property({ attribute: 'resize-label' })
269
305
  ], HelixHeadlessTableColumn.prototype, "resizeLabel", void 0);
306
+ __decorate([
307
+ property({ attribute: false })
308
+ ], HelixHeadlessTableColumn.prototype, "rowEditable", void 0);
270
309
  __decorate([
271
310
  property({ attribute: 'row-header', type: Boolean })
272
311
  ], HelixHeadlessTableColumn.prototype, "rowHeader", void 0);
312
+ __decorate([
313
+ property({ type: Boolean })
314
+ ], HelixHeadlessTableColumn.prototype, "searchable", void 0);
273
315
  __decorate([
274
316
  property({ reflect: true, type: Boolean })
275
317
  ], HelixHeadlessTableColumn.prototype, "sortable", void 0);
276
318
  __decorate([
277
319
  property({ attribute: 'text-align', reflect: true })
278
320
  ], HelixHeadlessTableColumn.prototype, "textAlign", void 0);
321
+ __decorate([
322
+ property()
323
+ ], HelixHeadlessTableColumn.prototype, "type", void 0);
324
+ __decorate([
325
+ property({ attribute: false })
326
+ ], HelixHeadlessTableColumn.prototype, "validate", void 0);
279
327
  __decorate([
280
328
  property({ attribute: 'vertical-align', reflect: true })
281
329
  ], HelixHeadlessTableColumn.prototype, "verticalAlign", void 0);
@@ -292,6 +340,12 @@ __decorate([
292
340
  __decorate([
293
341
  state()
294
342
  ], HelixHeadlessTableColumn.prototype, "movable", void 0);
343
+ __decorate([
344
+ state()
345
+ ], HelixHeadlessTableColumn.prototype, "pinned", void 0);
346
+ __decorate([
347
+ state()
348
+ ], HelixHeadlessTableColumn.prototype, "pinOffset", void 0);
295
349
  __decorate([
296
350
  state()
297
351
  ], HelixHeadlessTableColumn.prototype, "gridCell", void 0);
@@ -0,0 +1,7 @@
1
+ /**
2
+ * What a column holds, shared by the Table family and the families that read
3
+ * its columns. A module that registers nothing, so a reader of the type does
4
+ * not register the column.
5
+ */
6
+ /** What a column holds, which picks the comparisons its filter offers and the field an edit opens. */
7
+ export type ColumnType = 'boolean' | 'date' | 'enum' | 'number' | 'text';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './root/table-export-root.js';
@@ -0,0 +1 @@
1
+ export * from './root/table-export-root.js';
@@ -0,0 +1,132 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { type TemplateResult } from 'lit';
3
+ import { TableBinding, type ToolTable } from '../../data-table/binding.js';
4
+ import type { ExportColumns, ExportFormat, ExportRows, ExportValues } from '../../data-table/export.js';
5
+ import '../../button/index.js';
6
+ /** The choices as they stand. */
7
+ interface ExportChoices {
8
+ columns: ExportColumns;
9
+ format: ExportFormat;
10
+ rows: ExportRows;
11
+ values: ExportValues;
12
+ }
13
+ /**
14
+ * @summary A panel that exports a Data Table's rows: which rows, which columns, which values, and the format.
15
+ *
16
+ * @description
17
+ * Set `for` to the id of a `DataTable`, and put the panel in a `Popover` or
18
+ * a `Dialog` opened by an Export button.
19
+ *
20
+ * ```html
21
+ * <helix-table-export for="invoices"></helix-table-export>
22
+ * ```
23
+ *
24
+ * It asks four things, each with how many it covers:
25
+ *
26
+ * - **Rows**: the selected rows, the rows the search and filters leave, or every row.
27
+ * - **Columns**: the columns showing, or every column.
28
+ * - **Values**: as the cells show them, or as the rows hold them.
29
+ * - **Format**: CSV, TSV, or JSON, and XLSX where the table's `xlsx` is set.
30
+ *
31
+ * Export asks the table to `download` the file, which fires
32
+ * `helix-before-export` on the table. Cancel that to make the file on your
33
+ * server. Copy puts the rows on the clipboard as TSV, which pastes into a
34
+ * spreadsheet as cells.
35
+ *
36
+ * @since 0.238.0
37
+ * @status experimental
38
+ * @category data
39
+ * @aliases Download, Export dialog
40
+ * @documentation https://fusion.dev/helix/components/table-export
41
+ *
42
+ * @csspart actions - The row that holds Copy and Export.
43
+ * @csspart choice - One choice: its input and its words.
44
+ * @csspart choice-checked - Added to `choice` while it is chosen.
45
+ * @csspart choice-input - The radio input of a choice.
46
+ * @csspart columns - The group that chooses the columns.
47
+ * @csspart copy - The button that copies the rows.
48
+ * @csspart copy-button - Forwarded from the button: the button inside `copy`.
49
+ * @csspart copy-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
50
+ * @csspart copy-spinner - Forwarded from the button. Not shown in the panel, whose buttons do not load.
51
+ * @csspart copy-text - Forwarded from the button: the words inside `copy`.
52
+ * @csspart export - The button that saves the file.
53
+ * @csspart export-button - Forwarded from the button: the button inside `export`.
54
+ * @csspart export-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
55
+ * @csspart export-spinner - Forwarded from the button. Not shown in the panel, whose buttons do not load.
56
+ * @csspart export-text - Forwarded from the button: the words inside `export`.
57
+ * @csspart format - The group that chooses the format.
58
+ * @csspart legend - A group's name.
59
+ * @csspart live - The region that says the rows were copied. Visually hidden in the styled tier.
60
+ * @csspart options - The choices of a group, after its name.
61
+ * @csspart rows - The group that chooses the rows.
62
+ * @csspart values - The group that chooses the values.
63
+ */
64
+ export declare class HelixHeadlessTableExport extends HelixElement {
65
+ /**
66
+ * The key this family's words are registered under, its styled tag:
67
+ * `registerWords('de', { 'helix-table-export': { copyLabel: 'Kopieren' } })`.
68
+ */
69
+ static words: string;
70
+ /** The words for every column. `{count}` is how many there are. */
71
+ allColumnsLabel: string;
72
+ /** The words for every row. `{count}` is how many there are. */
73
+ allRowsLabel: string;
74
+ /** The name of the group that chooses the columns. */
75
+ columnsLabel: string;
76
+ /** What a screen reader hears once the rows are copied. `{count}` is how many. */
77
+ copiedLabel: string;
78
+ /** The words on the button that copies the rows. */
79
+ copyLabel: string;
80
+ /** The words on the button that saves the file. `{count}` is how many rows it holds. */
81
+ exportLabel: string;
82
+ /** The words for the rows the search and the filters leave. `{count}` is how many. */
83
+ filteredRowsLabel: string;
84
+ /** The id of the `DataTable` the panel exports, in the same document or shadow root. */
85
+ for: string;
86
+ /** The name of the group that chooses the format. */
87
+ formatLabel: string;
88
+ /** The words for the values as the rows hold them. */
89
+ rawLabel: string;
90
+ /** The name of the group that chooses the rows. */
91
+ rowsLabel: string;
92
+ /** The words for the selected rows. `{count}` is how many. */
93
+ selectedRowsLabel: string;
94
+ /** The words for the values as the cells show them. */
95
+ shownLabel: string;
96
+ /** The name of the group that chooses the values. */
97
+ valuesLabel: string;
98
+ /** The words for the columns showing. `{count}` is how many. */
99
+ visibleColumnsLabel: string;
100
+ /** Which rows go in, which a reader changes. */
101
+ private chosenRows;
102
+ /** Which columns go in. */
103
+ private chosenColumns;
104
+ /** Which values go in. */
105
+ private chosenValues;
106
+ /** The format. */
107
+ private chosenFormat;
108
+ private said;
109
+ protected readonly binding: TableBinding;
110
+ /** The bound table, once it is in the tree. */
111
+ get table(): ToolTable | null;
112
+ /** The choices as they stand: the selected rows where some are, and the filtered ones otherwise. */
113
+ get options(): ExportChoices;
114
+ /** Saves the file, as Export does. */
115
+ export(): boolean;
116
+ /** Copies the rows as TSV, as Copy does. */
117
+ copy(): Promise<boolean>;
118
+ /** The choices of one group, each a radio input in its label. */
119
+ protected renderChoices<T extends string>(name: string, current: T, choices: readonly {
120
+ label: string;
121
+ value: T;
122
+ }[], choose: (value: T) => void): TemplateResult[];
123
+ /** Copy and Export, as this tier's buttons. */
124
+ protected renderActions(count: number, found: boolean): TemplateResult;
125
+ protected render(): TemplateResult;
126
+ }
127
+ declare global {
128
+ interface HTMLElementTagNameMap {
129
+ 'helix-headless-table-export': HelixHeadlessTableExport;
130
+ }
131
+ }
132
+ export {};
@@ -0,0 +1,233 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement, formatWords, HelixElement, words } from '@fusion.dev/helix-core';
3
+ import { nothing } from 'lit';
4
+ import { property, state } from 'lit/decorators.js';
5
+ import { html } from 'lit/static-html.js';
6
+ import { TableBinding } from '../../data-table/binding.js';
7
+ import '../../button/index.js';
8
+ const exports = (table) => table !== null && typeof table.download === 'function';
9
+ let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.allColumnsLabel = 'All ({count})';
13
+ this.allRowsLabel = 'All ({count})';
14
+ this.columnsLabel = 'Columns';
15
+ this.copiedLabel = '{count, plural, one {# row copied} other {# rows copied}}';
16
+ this.copyLabel = 'Copy';
17
+ this.exportLabel = '{count, plural, one {Export # row} other {Export # rows}}';
18
+ this.filteredRowsLabel = 'Filtered ({count})';
19
+ this.for = '';
20
+ this.formatLabel = 'Format';
21
+ this.rawLabel = 'Raw';
22
+ this.rowsLabel = 'Rows';
23
+ this.selectedRowsLabel = 'Selected ({count})';
24
+ this.shownLabel = 'As shown';
25
+ this.valuesLabel = 'Values';
26
+ this.visibleColumnsLabel = 'Visible ({count})';
27
+ this.chosenRows = undefined;
28
+ this.chosenColumns = 'visible';
29
+ this.chosenValues = 'shown';
30
+ this.chosenFormat = 'csv';
31
+ this.said = '';
32
+ this.binding = new TableBinding(this);
33
+ }
34
+ static { this.words = 'helix-table-export'; }
35
+ get table() {
36
+ return this.binding.table;
37
+ }
38
+ get options() {
39
+ const table = this.table;
40
+ const selected = table ? table.selected.split(',').filter(Boolean).length : 0;
41
+ return {
42
+ columns: this.chosenColumns,
43
+ format: this.chosenFormat,
44
+ rows: this.chosenRows ?? (selected > 0 ? 'selected' : 'filtered'),
45
+ values: this.chosenValues,
46
+ };
47
+ }
48
+ export() {
49
+ const table = this.table;
50
+ return exports(table) ? table.download(this.options) : false;
51
+ }
52
+ async copy() {
53
+ const table = this.table;
54
+ if (!exports(table) || !navigator.clipboard) {
55
+ return false;
56
+ }
57
+ const options = { ...this.options, format: 'tsv' };
58
+ try {
59
+ await navigator.clipboard.writeText(table.exportRows(options));
60
+ }
61
+ catch {
62
+ return false;
63
+ }
64
+ this.said = formatWords(this, 'copiedLabel', { count: table.exportData(options).rows.length });
65
+ return true;
66
+ }
67
+ renderChoices(name, current, choices, choose) {
68
+ return choices.map((choice) => html `<label part="choice${choice.value === current ? ' choice-checked' : ''}"
69
+ ><input
70
+ part="choice-input"
71
+ type="radio"
72
+ name=${name}
73
+ .value=${choice.value}
74
+ .checked=${choice.value === current}
75
+ @change=${() => choose(choice.value)}
76
+ />${choice.label}</label
77
+ >`);
78
+ }
79
+ renderActions(count, found) {
80
+ const button = this.tag('button');
81
+ return html `<div part="actions">
82
+ <${button} part="copy" exportparts="button: copy-button, live: copy-live, spinner: copy-spinner, text: copy-text" ?disabled=${!found} @click=${() => this.copy()}>${this.copyLabel}</${button}>
83
+ <${button} part="export" exportparts="button: export-button, live: export-live, spinner: export-spinner, text: export-text" ?disabled=${!found || count === 0} @click=${() => this.export()}
84
+ >${formatWords(this, 'exportLabel', { count })}</${button}
85
+ >
86
+ </div>`;
87
+ }
88
+ render() {
89
+ const table = this.table;
90
+ const options = this.options;
91
+ const selected = table ? table.selected.split(',').filter(Boolean).length : 0;
92
+ const columns = table?.tableColumns.filter((column) => column.field !== '') ?? [];
93
+ const visible = table
94
+ ? columns.filter((column) => !table.view.columns.hidden.includes(column.field)).length
95
+ : 0;
96
+ const count = options.rows === 'selected'
97
+ ? selected
98
+ : options.rows === 'all'
99
+ ? (table?.everyRowCount ?? 0)
100
+ : (table?.matched ?? 0);
101
+ const formats = [
102
+ { label: 'CSV', value: 'csv' },
103
+ { label: 'TSV', value: 'tsv' },
104
+ { label: 'JSON', value: 'json' },
105
+ ...(exports(table) && table.xlsx ? [{ label: 'XLSX', value: 'xlsx' }] : []),
106
+ ];
107
+ return html `<fieldset part="rows">
108
+ <legend part="legend">${this.rowsLabel}</legend>
109
+ <div part="options">${this.renderChoices('rows', options.rows, [
110
+ ...(selected > 0
111
+ ? [
112
+ {
113
+ label: formatWords(this, 'selectedRowsLabel', { count: selected }),
114
+ value: 'selected',
115
+ },
116
+ ]
117
+ : []),
118
+ {
119
+ label: formatWords(this, 'filteredRowsLabel', { count: table?.matched ?? 0 }),
120
+ value: 'filtered',
121
+ },
122
+ {
123
+ label: formatWords(this, 'allRowsLabel', { count: table?.everyRowCount ?? 0 }),
124
+ value: 'all',
125
+ },
126
+ ], (value) => (this.chosenRows = value))}</div>
127
+ </fieldset>
128
+ <fieldset part="columns">
129
+ <legend part="legend">${this.columnsLabel}</legend>
130
+ <div part="options">${this.renderChoices('columns', options.columns, [
131
+ {
132
+ label: formatWords(this, 'visibleColumnsLabel', { count: visible }),
133
+ value: 'visible',
134
+ },
135
+ {
136
+ label: formatWords(this, 'allColumnsLabel', { count: columns.length }),
137
+ value: 'all',
138
+ },
139
+ ], (value) => (this.chosenColumns = value))}</div>
140
+ </fieldset>
141
+ <fieldset part="values">
142
+ <legend part="legend">${this.valuesLabel}</legend>
143
+ <div part="options">${this.renderChoices('values', options.values, [
144
+ { label: this.shownLabel, value: 'shown' },
145
+ { label: this.rawLabel, value: 'raw' },
146
+ ], (value) => (this.chosenValues = value))}</div>
147
+ </fieldset>
148
+ <fieldset part="format">
149
+ <legend part="legend">${this.formatLabel}</legend>
150
+ <div part="options">${this.renderChoices('format', options.format, formats, (value) => (this.chosenFormat = value))}</div>
151
+ </fieldset>
152
+ ${this.renderActions(count, table !== null)}
153
+ <span part="live" aria-live="polite">${this.said || nothing}</span>`;
154
+ }
155
+ };
156
+ __decorate([
157
+ words,
158
+ property({ attribute: 'all-columns-label' })
159
+ ], HelixHeadlessTableExport.prototype, "allColumnsLabel", void 0);
160
+ __decorate([
161
+ words,
162
+ property({ attribute: 'all-rows-label' })
163
+ ], HelixHeadlessTableExport.prototype, "allRowsLabel", void 0);
164
+ __decorate([
165
+ words,
166
+ property({ attribute: 'columns-label' })
167
+ ], HelixHeadlessTableExport.prototype, "columnsLabel", void 0);
168
+ __decorate([
169
+ words,
170
+ property({ attribute: 'copied-label' })
171
+ ], HelixHeadlessTableExport.prototype, "copiedLabel", void 0);
172
+ __decorate([
173
+ words,
174
+ property({ attribute: 'copy-label' })
175
+ ], HelixHeadlessTableExport.prototype, "copyLabel", void 0);
176
+ __decorate([
177
+ words,
178
+ property({ attribute: 'export-label' })
179
+ ], HelixHeadlessTableExport.prototype, "exportLabel", void 0);
180
+ __decorate([
181
+ words,
182
+ property({ attribute: 'filtered-rows-label' })
183
+ ], HelixHeadlessTableExport.prototype, "filteredRowsLabel", void 0);
184
+ __decorate([
185
+ property()
186
+ ], HelixHeadlessTableExport.prototype, "for", void 0);
187
+ __decorate([
188
+ words,
189
+ property({ attribute: 'format-label' })
190
+ ], HelixHeadlessTableExport.prototype, "formatLabel", void 0);
191
+ __decorate([
192
+ words,
193
+ property({ attribute: 'raw-label' })
194
+ ], HelixHeadlessTableExport.prototype, "rawLabel", void 0);
195
+ __decorate([
196
+ words,
197
+ property({ attribute: 'rows-label' })
198
+ ], HelixHeadlessTableExport.prototype, "rowsLabel", void 0);
199
+ __decorate([
200
+ words,
201
+ property({ attribute: 'selected-rows-label' })
202
+ ], HelixHeadlessTableExport.prototype, "selectedRowsLabel", void 0);
203
+ __decorate([
204
+ words,
205
+ property({ attribute: 'shown-label' })
206
+ ], HelixHeadlessTableExport.prototype, "shownLabel", void 0);
207
+ __decorate([
208
+ words,
209
+ property({ attribute: 'values-label' })
210
+ ], HelixHeadlessTableExport.prototype, "valuesLabel", void 0);
211
+ __decorate([
212
+ words,
213
+ property({ attribute: 'visible-columns-label' })
214
+ ], HelixHeadlessTableExport.prototype, "visibleColumnsLabel", void 0);
215
+ __decorate([
216
+ state()
217
+ ], HelixHeadlessTableExport.prototype, "chosenRows", void 0);
218
+ __decorate([
219
+ state()
220
+ ], HelixHeadlessTableExport.prototype, "chosenColumns", void 0);
221
+ __decorate([
222
+ state()
223
+ ], HelixHeadlessTableExport.prototype, "chosenValues", void 0);
224
+ __decorate([
225
+ state()
226
+ ], HelixHeadlessTableExport.prototype, "chosenFormat", void 0);
227
+ __decorate([
228
+ state()
229
+ ], HelixHeadlessTableExport.prototype, "said", void 0);
230
+ HelixHeadlessTableExport = __decorate([
231
+ customElement('helix-headless-table-export')
232
+ ], HelixHeadlessTableExport);
233
+ export { HelixHeadlessTableExport };
@@ -0,0 +1 @@
1
+ export * from './root/view-panel-root.js';
@@ -0,0 +1 @@
1
+ export * from './root/view-panel-root.js';
@@ -0,0 +1,132 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { type TemplateResult } from 'lit';
3
+ import { TableBinding, type ToolTable } from '../../data-table/binding.js';
4
+ import '../../button/index.js';
5
+ /** The sections the panel lists, in order. */
6
+ type Section = 'columns' | 'export' | 'filters' | 'sort';
7
+ /**
8
+ * @summary A panel that changes a Data Table's whole view on a phone: its presets, filters, sort, columns, and export.
9
+ *
10
+ * @description
11
+ * On a phone a table has no room above it for a filter field, a Columns
12
+ * button and an Export button. Put this panel in a `Drawer` opened by one
13
+ * View button, set `for` to the table's id, and slot the tools into it:
14
+ *
15
+ * ```html
16
+ * <helix-drawer label="View" placement="bottom">
17
+ * <helix-view-panel for="invoices">
18
+ * <helix-quick-filters slot="presets" for="invoices">…</helix-quick-filters>
19
+ * <helix-filter-input slot="filters" for="invoices"></helix-filter-input>
20
+ * <helix-column-manager slot="columns" for="invoices"></helix-column-manager>
21
+ * <helix-table-export slot="export" for="invoices"></helix-table-export>
22
+ * </helix-view-panel>
23
+ * </helix-drawer>
24
+ * ```
25
+ *
26
+ * The panel lists Filters, Sort, Columns, and Export, each with what it holds
27
+ * now, such as "Status, Amount" or "Due, descending". A press opens that
28
+ * section in the panel, and Back returns to the list. A section with nothing
29
+ * slotted is left out, except Sort, which the panel draws itself from the
30
+ * table's `sortable` columns. Reset clears the search, the filters, and the
31
+ * sort. Show closes the drawer or the dialog the panel is in, with how many
32
+ * rows the view shows.
33
+ *
34
+ * `active` counts the search and the filters, for a badge on the View button.
35
+ * The panel takes no width of its own, so show its View button at the widths
36
+ * that need it, and the tools above the table at the rest.
37
+ *
38
+ * @since 0.238.0
39
+ * @status experimental
40
+ * @category data
41
+ * @aliases View drawer, View sheet, Mobile filters
42
+ * @documentation https://fusion.dev/helix/components/view-panel
43
+ *
44
+ * @slot columns - A `ColumnManager` for the table.
45
+ * @slot export - A `TableExport` for the table.
46
+ * @slot filters - A `FilterInput` bound to the table, or your own filters.
47
+ * @slot presets - A `QuickFilters` row for the table, shown above the sections.
48
+ *
49
+ * @csspart back - The button that returns from a section to the list.
50
+ * @csspart choice - One sort order, its input and its words.
51
+ * @csspart choice-input - The radio input of a sort order.
52
+ * @csspart header - The row that holds the title, or Back, and Reset.
53
+ * @csspart page - The open section.
54
+ * @csspart reset - The button that clears the search, the filters, and the sort.
55
+ * @csspart section - One section's button in the list.
56
+ * @csspart section-mark - The caret at the end of a section's button.
57
+ * @csspart section-name - A section's name.
58
+ * @csspart sections - The list of sections.
59
+ * @csspart show - The button that closes the panel's drawer, with how many rows the view shows.
60
+ * @csspart show-button - Forwarded from the button: the button inside `show`.
61
+ * @csspart show-live - Forwarded from the button. Not shown in the panel, whose button does not load.
62
+ * @csspart show-spinner - Forwarded from the button. Not shown in the panel, whose button does not load.
63
+ * @csspart show-text - Forwarded from the button: the words inside `show`.
64
+ * @csspart sort - The sort orders the panel draws.
65
+ * @csspart summary - What a section holds now.
66
+ * @csspart title - The panel's heading.
67
+ */
68
+ export declare class HelixHeadlessViewPanel extends HelixElement {
69
+ protected static markRules: string[];
70
+ /**
71
+ * The key this family's words are registered under, its styled tag:
72
+ * `registerWords('de', { 'helix-view-panel': { sortLabel: 'Sortierung' } })`.
73
+ */
74
+ static words: string;
75
+ /** The words on the button that returns to the list. */
76
+ backLabel: string;
77
+ /** The name of the Columns section. */
78
+ columnsLabel: string;
79
+ /** The name of the Export section. */
80
+ exportLabel: string;
81
+ /** The name the panel gives itself where `label` is empty. */
82
+ fallbackLabel: string;
83
+ /** The name of the Filters section. */
84
+ filtersLabel: string;
85
+ /** The id of the `DataTable` whose view the panel changes, in the same document or shadow root. */
86
+ for: string;
87
+ /**
88
+ * The panel's heading.
89
+ *
90
+ * Empty by default, which leaves the name to `fallbackLabel`.
91
+ */
92
+ label: string;
93
+ /** What the Sort and Filters sections say while nothing is set. */
94
+ noneLabel: string;
95
+ /** The words on the button that clears the search, the filters, and the sort. */
96
+ resetLabel: string;
97
+ /** The words on the button that closes the panel. `{count}` is how many rows the view shows. */
98
+ showLabel: string;
99
+ /**
100
+ * One sort order, in the Sort section and its summary. `{column}` is the
101
+ * column and `{direction}` is `ascending` or `descending`.
102
+ */
103
+ sortedLabel: string;
104
+ /** The name of the Sort section. */
105
+ sortLabel: string;
106
+ /** The section open now, or none for the list. */
107
+ private opened;
108
+ protected readonly binding: TableBinding;
109
+ /** The bound table, once it is in the tree. */
110
+ get table(): ToolTable | null;
111
+ /** How many things narrow the rows: the search, and each filter. For a badge on the View button. */
112
+ get active(): number;
113
+ /** Opens one section in the panel, or returns to the list with nothing. */
114
+ openSection(section: Section | undefined): void;
115
+ /** Clears the search, the filters, and the sort, as Reset does. */
116
+ reset(): boolean;
117
+ /** Closes the drawer or the dialog the panel is in, as Show does. */
118
+ show(): void;
119
+ /** Whether a slot of this name has something in it. */
120
+ private holds;
121
+ private summary;
122
+ protected renderSort(table: ToolTable): TemplateResult;
123
+ /** Show, as this tier's button. */
124
+ protected renderShow(count: number): TemplateResult;
125
+ protected render(): TemplateResult;
126
+ }
127
+ declare global {
128
+ interface HTMLElementTagNameMap {
129
+ 'helix-headless-view-panel': HelixHeadlessViewPanel;
130
+ }
131
+ }
132
+ export {};