@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
@@ -7,6 +7,7 @@ import { HelixBeforeFacetEvent, HelixFacetEvent } from '../events/index.js';
7
7
  import { HelixHeadlessFilterField } from '../field/filter-field.js';
8
8
  import { readFilterText } from '../grammar.js';
9
9
  import { completeTerm, currentField, currentTerm, suggests, tokenEntry, } from '../suggest.js';
10
+ import { facetOf, filterableColumns, filtersAfter, isBoundTable, tableFields, tableSource, } from '../table.js';
10
11
  const picks = (element) => typeof element.apply === 'function' &&
11
12
  Array.isArray(element.fields);
12
13
  const asksToGo = (node) => typeof node?.dismiss === 'function';
@@ -24,6 +25,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
24
25
  this.clearLabel = 'Clear';
25
26
  this.filterDelay = 0;
26
27
  this.filterSuggestions = false;
28
+ this.for = '';
27
29
  this.loading = false;
28
30
  this.loadingText = 'Loading';
29
31
  this.noResultsText = '';
@@ -55,6 +57,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
55
57
  const control = event.target;
56
58
  this.requestValue(control.value);
57
59
  restoreValue(control, this.value);
60
+ this.searchTable();
58
61
  this.dismissed = false;
59
62
  this.settleOpen();
60
63
  this.askSoon();
@@ -67,17 +70,29 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
67
70
  this.announceChange();
68
71
  };
69
72
  this.handleFacet = (event) => {
73
+ const facet = event.detail;
74
+ const table = this.boundTable;
75
+ if (table && filterableColumns(table).some((column) => column.field === facet.field)) {
76
+ table.requestView({ filters: filtersAfter(table.view.filters, facet) });
77
+ this.drawTableChips();
78
+ return;
79
+ }
70
80
  if (this.chips) {
71
- this.drawChip(event.detail);
81
+ this.drawChip(facet);
72
82
  }
73
83
  };
84
+ this.listened = null;
85
+ this.handleTableView = () => {
86
+ this.drawTableChips();
87
+ };
88
+ this.tableSuggestions = undefined;
74
89
  this.handleDismiss = (event) => {
75
90
  const chip = event.composedPath()[0];
76
91
  if (!(chip instanceof HTMLElement) || chip.slot !== 'tags') {
77
92
  return;
78
93
  }
79
94
  const field = chip.getAttribute('name') ?? '';
80
- const declared = field === '' ? undefined : this.fields.find((one) => (one.name ?? '') === field);
95
+ const declared = field === '' ? undefined : this.vocabularies.find((one) => one.name === field);
81
96
  if (!declared) {
82
97
  return;
83
98
  }
@@ -88,7 +103,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
88
103
  menu.apply(field, []);
89
104
  return;
90
105
  }
91
- const { label, operators } = declared.vocabulary;
106
+ const { label, operators } = declared;
92
107
  const usual = operators.find((operator) => operator.default) ?? operators[0];
93
108
  this.announceFacet({
94
109
  arity: usual?.arity ?? 'many',
@@ -212,7 +227,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
212
227
  };
213
228
  this.handleFocusIn = () => {
214
229
  this.settleOpen();
215
- if (this.source && this.asked !== this.value) {
230
+ if (this.suggestionSource && this.asked !== this.value) {
216
231
  this.ask();
217
232
  }
218
233
  };
@@ -355,6 +370,65 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
355
370
  this.dispatchEvent(new HelixFacetEvent(facet));
356
371
  return true;
357
372
  }
373
+ get vocabularies() {
374
+ const declared = this.fields.map((field) => field.vocabulary);
375
+ const table = this.boundTable;
376
+ if (!table) {
377
+ return declared;
378
+ }
379
+ const names = new Set(declared.map((field) => field.name));
380
+ return [...declared, ...tableFields(table).filter((field) => !names.has(field.name))];
381
+ }
382
+ get boundTable() {
383
+ if (this.for === '' || typeof document === 'undefined') {
384
+ return null;
385
+ }
386
+ const scope = this.getRootNode();
387
+ const found = scope.getElementById?.(this.for) ?? null;
388
+ return isBoundTable(found) ? found : null;
389
+ }
390
+ bindTable() {
391
+ const table = this.boundTable;
392
+ if (table === this.listened) {
393
+ return;
394
+ }
395
+ this.listened?.removeEventListener('helix-view-change', this.handleTableView);
396
+ this.listened = table;
397
+ table?.addEventListener('helix-view-change', this.handleTableView);
398
+ if (table) {
399
+ this.drawTableChips();
400
+ }
401
+ }
402
+ drawTableChips() {
403
+ const table = this.boundTable;
404
+ if (!table) {
405
+ return;
406
+ }
407
+ const fields = new Set(filterableColumns(table).map((column) => column.field));
408
+ const facets = table.view.filters
409
+ .map((filter) => facetOf(table, filter))
410
+ .filter((facet) => facet !== undefined);
411
+ for (const field of fields) {
412
+ const facet = facets.find((one) => one.field === field);
413
+ this.drawChip(facet ?? { arity: 'many', field, label: '', operator: '', operatorLabel: '', values: [] });
414
+ }
415
+ }
416
+ searchTable() {
417
+ const table = this.boundTable;
418
+ if (table && table.view.query !== this.value) {
419
+ table.requestView({ query: this.value });
420
+ }
421
+ }
422
+ get suggestionSource() {
423
+ if (this.source) {
424
+ return this.source;
425
+ }
426
+ if (this.for === '') {
427
+ return undefined;
428
+ }
429
+ this.tableSuggestions ??= tableSource(() => this.boundTable, suggests);
430
+ return this.tableSuggestions;
431
+ }
358
432
  drawChip(facet) {
359
433
  const tag = `${this.constructor.tier}filter-chip`;
360
434
  const held = [...this.children].find((child) => child.localName === tag && child.getAttribute('name') === facet.field);
@@ -375,11 +449,11 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
375
449
  }
376
450
  }
377
451
  readFilters() {
378
- const fields = this.fields;
452
+ const fields = this.vocabularies;
379
453
  if (fields.length === 0) {
380
454
  return 0;
381
455
  }
382
- const reading = readFilterText(this.value, fields.map((field) => field.vocabulary));
456
+ const reading = readFilterText(this.value, fields);
383
457
  if (reading.terms.length === 0) {
384
458
  return 0;
385
459
  }
@@ -397,6 +471,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
397
471
  return 0;
398
472
  }
399
473
  this.requestValue([...refused, reading.text].filter(Boolean).join(' '));
474
+ this.searchTable();
400
475
  const control = this.control;
401
476
  if (control) {
402
477
  restoreValue(control, this.value);
@@ -413,10 +488,10 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
413
488
  return this.loading || this.fetching;
414
489
  }
415
490
  resetSource() {
416
- if (this.source === this.used) {
491
+ if (this.suggestionSource === this.used) {
417
492
  return;
418
493
  }
419
- this.used = this.source;
494
+ this.used = this.suggestionSource;
420
495
  this.request?.abort();
421
496
  this.request = undefined;
422
497
  this.fetching = false;
@@ -424,12 +499,13 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
424
499
  if (this.sourced.length > 0) {
425
500
  this.drawSourced([]);
426
501
  }
427
- if (this.source && (this.matches(':focus-within') || this.contains(document.activeElement))) {
502
+ if (this.suggestionSource &&
503
+ (this.matches(':focus-within') || this.contains(document.activeElement))) {
428
504
  this.ask();
429
505
  }
430
506
  }
431
507
  askSoon() {
432
- if (!this.source) {
508
+ if (!this.suggestionSource) {
433
509
  return;
434
510
  }
435
511
  this.asking.cancel();
@@ -442,7 +518,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
442
518
  }
443
519
  ask() {
444
520
  this.asking.cancel();
445
- const source = this.source;
521
+ const source = this.suggestionSource;
446
522
  if (!source) {
447
523
  return;
448
524
  }
@@ -557,6 +633,8 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
557
633
  this.removeEventListener('helix-dismiss', this.handleDismiss, { capture: true });
558
634
  this.removeEventListener(HelixFacetEvent.eventName, this.handleFacet);
559
635
  this.removeEventListener('helix-before-select', this.handleSourcedSelect);
636
+ this.listened?.removeEventListener('helix-view-change', this.handleTableView);
637
+ this.listened = null;
560
638
  this.request?.abort();
561
639
  this.request = undefined;
562
640
  this.fetching = false;
@@ -591,9 +669,10 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
591
669
  }
592
670
  updated(changed) {
593
671
  super.updated(changed);
594
- if (changed.has('source')) {
672
+ if (changed.has('source') || changed.has('for')) {
595
673
  queueMicrotask(() => this.resetSource());
596
674
  }
675
+ this.bindTable();
597
676
  this.releaseCaret?.();
598
677
  this.releaseCaret = undefined;
599
678
  internalsOf(this).setFormValue(this.formValue(), this.value);
@@ -716,6 +795,9 @@ __decorate([
716
795
  __decorate([
717
796
  property({ attribute: 'filter-suggestions', type: Boolean })
718
797
  ], HelixHeadlessFilterInput.prototype, "filterSuggestions", void 0);
798
+ __decorate([
799
+ property()
800
+ ], HelixHeadlessFilterInput.prototype, "for", void 0);
719
801
  __decorate([
720
802
  property({ reflect: true, type: Boolean })
721
803
  ], HelixHeadlessFilterInput.prototype, "loading", void 0);
@@ -0,0 +1,64 @@
1
+ /**
2
+ * What a Filter Input bound to a Data Table by `for` reads from the table and
3
+ * writes to it.
4
+ *
5
+ * **By shape, and nothing here imports the table.** The Data Table family is
6
+ * the larger of the two by far, and a field that never binds to one should not
7
+ * carry it. So this names what the field needs of a table, and the table's
8
+ * columns are read the same way.
9
+ */
10
+ import type { FacetDetail } from './events/index.js';
11
+ import type { FilterGrammarField } from './grammar.js';
12
+ import type { FilterSource } from './suggest.js';
13
+ /** One filter in a table's view. */
14
+ export interface BoundFilter {
15
+ field: string;
16
+ operator: string;
17
+ values: string[];
18
+ }
19
+ /** One column of a bound table, as the field reads it. */
20
+ export interface BoundColumn {
21
+ field: string;
22
+ filterable: boolean;
23
+ textContent: string | null;
24
+ type?: string | undefined;
25
+ }
26
+ /** What the field needs of a table it is bound to. */
27
+ export interface BoundTable extends HTMLElement {
28
+ facetsOf(field: string): readonly {
29
+ count: number;
30
+ value: string;
31
+ }[];
32
+ operatorsOf(field: string): readonly {
33
+ arity: string;
34
+ label: string;
35
+ name: string;
36
+ }[];
37
+ requestView(next: {
38
+ filters?: BoundFilter[];
39
+ query?: string;
40
+ }): boolean;
41
+ readonly tableColumns: readonly BoundColumn[];
42
+ readonly view: {
43
+ filters: readonly BoundFilter[];
44
+ query: string;
45
+ };
46
+ }
47
+ /** Whether an element is a table the field can bind to. */
48
+ export declare const isBoundTable: (element: Element | null) => element is BoundTable;
49
+ /** The columns a reader can filter by: the ones marked `filterable`, with a field. */
50
+ export declare const filterableColumns: (table: BoundTable) => BoundColumn[];
51
+ /** The table's filterable columns as the grammar reads a declared field. */
52
+ export declare const tableFields: (table: BoundTable) => FilterGrammarField[];
53
+ /**
54
+ * The filters after one field's change: the field's filter replaced, or taken
55
+ * out where it has no values left and its comparison needs some.
56
+ */
57
+ export declare const filtersAfter: (filters: readonly BoundFilter[], facet: FacetDetail) => BoundFilter[];
58
+ /** The chip a filter in the view draws, as the facet that would have made it. */
59
+ export declare const facetOf: (table: BoundTable, filter: BoundFilter) => FacetDetail | undefined;
60
+ /**
61
+ * Suggestions from the table: its filterable columns while a key is typed,
62
+ * and a column's values, with how many rows hold each, after `field:`.
63
+ */
64
+ export declare const tableSource: (table: () => BoundTable | null, matches: (words: string, term: string) => boolean) => FilterSource;
@@ -0,0 +1,76 @@
1
+ export const isBoundTable = (element) => element !== null &&
2
+ typeof element.requestView === 'function' &&
3
+ typeof element.facetsOf === 'function';
4
+ export const filterableColumns = (table) => table.tableColumns.filter((column) => column.filterable && column.field !== '');
5
+ const labelOf = (column) => column.textContent?.trim() || column.field;
6
+ const grammarOperators = (table, field) => table.operatorsOf(field).map((one, place) => ({
7
+ arity: one.arity === 'none' ? 'none' : one.arity === 'one' ? 'one' : 'many',
8
+ default: place === 0,
9
+ label: one.label,
10
+ name: one.name,
11
+ }));
12
+ const valuesOf = (table, column) => {
13
+ if (column.type === 'boolean') {
14
+ return [
15
+ { label: 'true', value: 'true' },
16
+ { label: 'false', value: 'false' },
17
+ ];
18
+ }
19
+ return column.type === 'enum'
20
+ ? table.facetsOf(column.field).map(({ value }) => ({ label: value, value }))
21
+ : [];
22
+ };
23
+ export const tableFields = (table) => filterableColumns(table).map((column) => ({
24
+ label: labelOf(column),
25
+ name: column.field,
26
+ operators: grammarOperators(table, column.field),
27
+ values: valuesOf(table, column),
28
+ }));
29
+ export const filtersAfter = (filters, facet) => {
30
+ const others = filters.filter((one) => one.field !== facet.field);
31
+ if (facet.values.length === 0 && facet.arity !== 'none') {
32
+ return others;
33
+ }
34
+ const next = { field: facet.field, operator: facet.operator, values: [...facet.values] };
35
+ const at = filters.findIndex((one) => one.field === facet.field);
36
+ if (at < 0) {
37
+ return [...others, next];
38
+ }
39
+ return filters.map((one) => (one.field === facet.field ? next : one));
40
+ };
41
+ export const facetOf = (table, filter) => {
42
+ const column = filterableColumns(table).find((one) => one.field === filter.field);
43
+ if (!column) {
44
+ return undefined;
45
+ }
46
+ const operators = grammarOperators(table, filter.field);
47
+ const operator = operators.find((one) => one.name === filter.operator) ?? operators[0];
48
+ return {
49
+ arity: operator?.arity ?? 'many',
50
+ field: filter.field,
51
+ label: labelOf(column),
52
+ operator: operator?.name ?? filter.operator,
53
+ operatorLabel: operator && !operator.default ? operator.label : '',
54
+ values: filter.values,
55
+ };
56
+ };
57
+ export const tableSource = (table, matches) => ({ field, term }) => {
58
+ const bound = table();
59
+ if (!bound) {
60
+ return [];
61
+ }
62
+ const columns = filterableColumns(bound);
63
+ if (field === '') {
64
+ return columns
65
+ .filter((column) => matches(`${labelOf(column)} ${column.field}`, term))
66
+ .map((column) => ({ label: labelOf(column), value: `${column.field}:` }));
67
+ }
68
+ const column = columns.find((one) => one.field === field || labelOf(one) === field);
69
+ if (!column) {
70
+ return [];
71
+ }
72
+ const counted = column.type === 'enum' ? bound.facetsOf(column.field) : [];
73
+ return counted
74
+ .filter(({ value }) => matches(value, term))
75
+ .map(({ count, value }) => ({ label: `${value} (${count})`, value }));
76
+ };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export * from './code-editor/index.js';
33
33
  export * from './code-input/index.js';
34
34
  export * from './color-input/index.js';
35
35
  export * from './color-picker/index.js';
36
+ export * from './column-manager/index.js';
36
37
  export * from './combobox/index.js';
37
38
  export * from './command/index.js';
38
39
  export * from './copy-button/index.js';
@@ -85,12 +86,14 @@ export * from './pin-input/index.js';
85
86
  export * from './popover/index.js';
86
87
  export * from './progress/index.js';
87
88
  export * from './qr-code/index.js';
89
+ export * from './quick-filters/index.js';
88
90
  export * from './quote/index.js';
89
91
  export * from './radio/index.js';
90
92
  export * from './rating/index.js';
91
93
  export * from './scatter-chart/index.js';
92
94
  export * from './scroll-area/index.js';
93
95
  export * from './select/index.js';
96
+ export * from './selection-bar/index.js';
94
97
  export * from './shortcut-overlay/index.js';
95
98
  export * from './skeleton/index.js';
96
99
  export * from './skip-link/index.js';
@@ -108,6 +111,7 @@ export * from './stat/index.js';
108
111
  export * from './steps/index.js';
109
112
  export * from './switch/index.js';
110
113
  export * from './table/index.js';
114
+ export * from './table-export/index.js';
111
115
  export * from './tabs/index.js';
112
116
  export * from './tag/index.js';
113
117
  export * from './terminal/index.js';
@@ -124,4 +128,5 @@ export * from './tree/index.js';
124
128
  export * from './trend/index.js';
125
129
  export * from './video/index.js';
126
130
  export * from './video-playlist/index.js';
131
+ export * from './view-panel/index.js';
127
132
  export * from './virtual-list/index.js';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ export * from './code-editor/index.js';
24
24
  export * from './code-input/index.js';
25
25
  export * from './color-input/index.js';
26
26
  export * from './color-picker/index.js';
27
+ export * from './column-manager/index.js';
27
28
  export * from './combobox/index.js';
28
29
  export * from './command/index.js';
29
30
  export * from './copy-button/index.js';
@@ -76,12 +77,14 @@ export * from './pin-input/index.js';
76
77
  export * from './popover/index.js';
77
78
  export * from './progress/index.js';
78
79
  export * from './qr-code/index.js';
80
+ export * from './quick-filters/index.js';
79
81
  export * from './quote/index.js';
80
82
  export * from './radio/index.js';
81
83
  export * from './rating/index.js';
82
84
  export * from './scatter-chart/index.js';
83
85
  export * from './scroll-area/index.js';
84
86
  export * from './select/index.js';
87
+ export * from './selection-bar/index.js';
85
88
  export * from './shortcut-overlay/index.js';
86
89
  export * from './skeleton/index.js';
87
90
  export * from './skip-link/index.js';
@@ -99,6 +102,7 @@ export * from './stat/index.js';
99
102
  export * from './steps/index.js';
100
103
  export * from './switch/index.js';
101
104
  export * from './table/index.js';
105
+ export * from './table-export/index.js';
102
106
  export * from './tabs/index.js';
103
107
  export * from './tag/index.js';
104
108
  export * from './terminal/index.js';
@@ -115,4 +119,5 @@ export * from './tree/index.js';
115
119
  export * from './trend/index.js';
116
120
  export * from './video/index.js';
117
121
  export * from './video-playlist/index.js';
122
+ export * from './view-panel/index.js';
118
123
  export * from './virtual-list/index.js';
@@ -341,6 +341,13 @@ export declare class HelixHeadlessInput extends HelixHeadlessInput_base {
341
341
  */
342
342
  protected renderRevealIcon(): TemplateResult;
343
343
  protected voiceField(): HTMLInputElement | HTMLTextAreaElement | null;
344
+ /**
345
+ * A press on the field's own box, beside the text, puts focus in the text,
346
+ * as a press on a native field's padding does. Without it a field drawn
347
+ * narrower than its box, as a field sized to its value is, took no focus
348
+ * from most of its box.
349
+ */
350
+ private readonly handleFieldPress;
344
351
  protected render(): TemplateResult;
345
352
  }
346
353
  declare global {
@@ -55,6 +55,14 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinVoice(MixinContro
55
55
  this.revealLabel = 'Show password';
56
56
  this.step = '';
57
57
  this.type = 'text';
58
+ this.handleFieldPress = (event) => {
59
+ const control = this.partNamed('control');
60
+ if (event.composedPath()[0] !== event.currentTarget || !control || this.disabled) {
61
+ return;
62
+ }
63
+ event.preventDefault();
64
+ control.focus();
65
+ };
58
66
  }
59
67
  static { this.markRules = [SPOKEN_RULE]; }
60
68
  static { this.words = 'helix-input'; }
@@ -180,7 +188,7 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinVoice(MixinContro
180
188
  }
181
189
  render() {
182
190
  return html `${this.renderLabel()}
183
- <div part="field">
191
+ <div part="field" @mousedown=${this.handleFieldPress}>
184
192
  <slot name="start"></slot>
185
193
  <input
186
194
  part="control"
@@ -528,6 +528,13 @@ export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_b
528
528
  private endsRead;
529
529
  /** Says which ends hold something, one call apiece so each pairs with its `@cssstate`. */
530
530
  private readonly readEnds;
531
+ /**
532
+ * A press on the field's own box, beside the text, puts focus in the text,
533
+ * as a press on a native field's padding does. Without it a field drawn
534
+ * narrower than its box, as a field sized to its value is, took no focus
535
+ * from most of its box.
536
+ */
537
+ private readonly handleFieldPress;
531
538
  protected render(): TemplateResult;
532
539
  /**
533
540
  * The value as a number, or `NaN` while the control is empty or does not
@@ -230,6 +230,14 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
230
230
  this.toggleState('has-start', filled('start'));
231
231
  this.toggleState('has-end', filled('end'));
232
232
  };
233
+ this.handleFieldPress = (event) => {
234
+ const control = this.partNamed('control');
235
+ if (event.composedPath()[0] !== event.currentTarget || !control || this.disabled) {
236
+ return;
237
+ }
238
+ event.preventDefault();
239
+ control.focus();
240
+ };
233
241
  }
234
242
  static { this.words = 'helix-number-input'; }
235
243
  get shown() {
@@ -464,7 +472,7 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
464
472
  const atMin = parsed !== null && this.min !== undefined && parsed <= this.min;
465
473
  const atMax = parsed !== null && this.max !== undefined && parsed >= this.max;
466
474
  return html `${this.renderLabel()}
467
- <div part="field" role="group" aria-labelledby=${this.labeled ? this.labelId : nothing}>
475
+ <div part="field" role="group" aria-labelledby=${this.labeled ? this.labelId : nothing} @mousedown=${this.handleFieldPress}>
468
476
  <button
469
477
  part="decrement"
470
478
  id="decrement"
@@ -0,0 +1,14 @@
1
+ import type { ViewSaveDetail } from './details.js';
2
+ /**
3
+ * A reader asked to save the table's view, with Save view.
4
+ *
5
+ * Cancelable: cancel it to keep the view yourself, in your own store, and
6
+ * nothing is kept in the browser. Left alone, with `view-key` set, the view
7
+ * is kept in browser storage and drawn as a preset.
8
+ *
9
+ * @followedBy helix-view-save
10
+ */
11
+ export declare class HelixBeforeViewSaveEvent extends CustomEvent<ViewSaveDetail> {
12
+ static readonly eventName = "helix-before-view-save";
13
+ constructor(detail: ViewSaveDetail);
14
+ }
@@ -0,0 +1,11 @@
1
+ export class HelixBeforeViewSaveEvent extends CustomEvent {
2
+ static { this.eventName = 'helix-before-view-save'; }
3
+ constructor(detail) {
4
+ super(HelixBeforeViewSaveEvent.eventName, {
5
+ bubbles: true,
6
+ cancelable: true,
7
+ composed: true,
8
+ detail,
9
+ });
10
+ }
11
+ }
@@ -0,0 +1,10 @@
1
+ import type { DataTableView } from '../../data-table/view.js';
2
+ /** Detail carried by `helix-before-view-save` and `helix-view-save`. */
3
+ export interface ViewSaveDetail {
4
+ /** The name the view is saved under. */
5
+ label: string;
6
+ /** The table's whole view, as JSON. */
7
+ value: string;
8
+ /** The table's whole view. */
9
+ view: DataTableView;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { HelixBeforeViewSaveEvent } from './before-view-save.js';
2
+ import { HelixViewSaveEvent } from './view-save.js';
3
+ export type { ViewSaveDetail } from './details.js';
4
+ export { HelixBeforeViewSaveEvent, HelixViewSaveEvent };
5
+ declare const registry: {
6
+ readonly HelixBeforeViewSaveEvent: typeof HelixBeforeViewSaveEvent;
7
+ readonly HelixViewSaveEvent: typeof HelixViewSaveEvent;
8
+ };
9
+ type Registry = typeof registry;
10
+ type QuickFiltersEventMap = {
11
+ [K in keyof Registry as Registry[K]['eventName']]: InstanceType<Registry[K]>;
12
+ };
13
+ declare global {
14
+ interface HTMLElementEventMap extends QuickFiltersEventMap {
15
+ }
16
+ }
@@ -0,0 +1,9 @@
1
+ import { registerEventNames } from '@fusion.dev/helix-core';
2
+ import { HelixBeforeViewSaveEvent } from './before-view-save.js';
3
+ import { HelixViewSaveEvent } from './view-save.js';
4
+ export { HelixBeforeViewSaveEvent, HelixViewSaveEvent };
5
+ const registry = {
6
+ HelixBeforeViewSaveEvent,
7
+ HelixViewSaveEvent,
8
+ };
9
+ registerEventNames(Object.values(registry).map((one) => one.eventName));
@@ -0,0 +1,11 @@
1
+ import type { ViewSaveDetail } from './details.js';
2
+ /**
3
+ * The table's view was saved.
4
+ *
5
+ * The notification after `helix-before-view-save`, sent when nobody refused
6
+ * it. Not cancelable: the decision was the request's.
7
+ */
8
+ export declare class HelixViewSaveEvent extends CustomEvent<ViewSaveDetail> {
9
+ static readonly eventName = "helix-view-save";
10
+ constructor(detail: ViewSaveDetail);
11
+ }
@@ -0,0 +1,11 @@
1
+ export class HelixViewSaveEvent extends CustomEvent {
2
+ static { this.eventName = 'helix-view-save'; }
3
+ constructor(detail) {
4
+ super(HelixViewSaveEvent.eventName, {
5
+ bubbles: true,
6
+ cancelable: false,
7
+ composed: true,
8
+ detail,
9
+ });
10
+ }
11
+ }
@@ -0,0 +1,48 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { type TemplateResult } from 'lit';
3
+ import { type PartialView } from '../../data-table/view.js';
4
+ /**
5
+ * @summary One preset in a Quick Filters row: a name and the parts of a Data Table's view it sets.
6
+ *
7
+ * @description
8
+ * Write it inside `QuickFilters`. Its text is its name, and `view` holds the
9
+ * parts of the view it sets, as JSON: a preset with `filters` replaces every
10
+ * filter, and one without leaves them alone.
11
+ *
12
+ * ```html
13
+ * <helix-quick-filter view='{"filters":[{"field":"status","operator":"any","values":["Overdue"]}]}'>Overdue</helix-quick-filter>
14
+ * ```
15
+ *
16
+ * It draws nothing itself. The row draws a button for it, with how many rows
17
+ * it would show.
18
+ *
19
+ * @since 0.238.0
20
+ * @status experimental
21
+ * @category data
22
+ * @aliases Preset, Saved filter, View tab
23
+ * @documentation https://fusion.dev/helix/components/quick-filters
24
+ *
25
+ * @slot - The preset's name.
26
+ */
27
+ export declare class HelixHeadlessQuickFilter extends HelixElement {
28
+ /**
29
+ * How many rows the preset shows, where the table cannot count them, as a
30
+ * table in `server` mode cannot. Left unset, the row counts the rows the
31
+ * table holds.
32
+ */
33
+ count?: number;
34
+ /**
35
+ * The parts of the table's view the preset sets, as JSON, such as
36
+ * `{"filters":[{"field":"status","operator":"any","values":["Overdue"]}]}`.
37
+ * Only the parts it names are set.
38
+ */
39
+ view: string;
40
+ /** The parts of the view the preset sets, read from `view`. Text that is not JSON sets nothing. */
41
+ get parts(): PartialView;
42
+ protected render(): TemplateResult;
43
+ }
44
+ declare global {
45
+ interface HTMLElementTagNameMap {
46
+ 'helix-headless-quick-filter': HelixHeadlessQuickFilter;
47
+ }
48
+ }