@ixfx/components 0.7.4 → 0.7.5

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 (73) hide show
  1. package/bundle/index.d.ts +536 -178
  2. package/bundle/index.d.ts.map +1 -1
  3. package/bundle/index.js +1324 -442
  4. package/bundle/index.js.map +1 -1
  5. package/dist/ac-token.js +1 -1
  6. package/dist/crumbs.d.ts +5 -1
  7. package/dist/crumbs.d.ts.map +1 -1
  8. package/dist/crumbs.js +10 -0
  9. package/dist/crumbs.js.map +1 -1
  10. package/dist/{data-grid-BddUjAti.d.ts → data-grid-CtJ35v8L.d.ts} +26 -1
  11. package/dist/data-grid-CtJ35v8L.d.ts.map +1 -0
  12. package/dist/data-grid.d.ts +1 -1
  13. package/dist/data-grid.js +88 -7
  14. package/dist/data-grid.js.map +1 -1
  15. package/dist/{detail-list-Br0WAnry.d.ts → detail-list-BS5dRDda.d.ts} +20 -12
  16. package/dist/detail-list-BS5dRDda.d.ts.map +1 -0
  17. package/dist/detail-list.d.ts +2 -2
  18. package/dist/detail-list.js +51 -135
  19. package/dist/detail-list.js.map +1 -1
  20. package/dist/{grid-list-B_orPsot.d.ts → grid-list-D-GbghSH.d.ts} +18 -1
  21. package/dist/grid-list-D-GbghSH.d.ts.map +1 -0
  22. package/dist/grid-list.d.ts +1 -1
  23. package/dist/grid-list.js +76 -15
  24. package/dist/grid-list.js.map +1 -1
  25. package/dist/incr-search-DpbSJtgj.js +962 -0
  26. package/dist/incr-search-DpbSJtgj.js.map +1 -0
  27. package/dist/incr-search.d.ts +2 -2
  28. package/dist/incr-search.js +2 -3
  29. package/dist/index-CBS4z1v-.d.ts +365 -0
  30. package/dist/index-CBS4z1v-.d.ts.map +1 -0
  31. package/dist/index.d.ts +8 -8
  32. package/dist/index.js +4 -5
  33. package/dist/index.js.map +1 -1
  34. package/dist/{list-selection-controller-CUo-Hhcm.js → list-selection-controller-DTFI40li.js} +2 -76
  35. package/dist/list-selection-controller-DTFI40li.js.map +1 -0
  36. package/dist/miller.d.ts +81 -3
  37. package/dist/miller.d.ts.map +1 -1
  38. package/dist/miller.js +327 -68
  39. package/dist/miller.js.map +1 -1
  40. package/dist/narrowed-text.js +1 -2
  41. package/dist/narrowed-text.js.map +1 -1
  42. package/dist/{tree-B74zdI60.js → tree-DAii2A1g.js} +77 -15
  43. package/dist/tree-DAii2A1g.js.map +1 -0
  44. package/dist/{tree-component-BvV4muxx.d.ts → tree-component-F6qZ0Gdv.d.ts} +9 -1
  45. package/dist/{tree-component-BvV4muxx.d.ts.map → tree-component-F6qZ0Gdv.d.ts.map} +1 -1
  46. package/dist/tree.d.ts +22 -1
  47. package/dist/tree.d.ts.map +1 -1
  48. package/dist/tree.js +1 -1
  49. package/dist/{vertical-list-CQSEVeOT.d.ts → vertical-list-DwtCPy1b.d.ts} +17 -14
  50. package/dist/vertical-list-DwtCPy1b.d.ts.map +1 -0
  51. package/dist/vertical-list.d.ts +1 -1
  52. package/dist/vertical-list.js +59 -127
  53. package/dist/vertical-list.js.map +1 -1
  54. package/docs-user/data-grid.md +19 -0
  55. package/docs-user/detail-list.md +1 -1
  56. package/docs-user/grid-list.md +24 -0
  57. package/docs-user/incr-search.md +12 -2
  58. package/docs-user/index.json +2 -2
  59. package/docs-user/tree.md +22 -1
  60. package/docs-user/vertical-list.md +7 -1
  61. package/package.json +1 -1
  62. package/dist/data-grid-BddUjAti.d.ts.map +0 -1
  63. package/dist/detail-list-Br0WAnry.d.ts.map +0 -1
  64. package/dist/element-search-Y8SRfPGM.js +0 -185
  65. package/dist/element-search-Y8SRfPGM.js.map +0 -1
  66. package/dist/grid-list-B_orPsot.d.ts.map +0 -1
  67. package/dist/incr-search-vCzuao-2.js +0 -137
  68. package/dist/incr-search-vCzuao-2.js.map +0 -1
  69. package/dist/index-Cu5i8zZY.d.ts +0 -160
  70. package/dist/index-Cu5i8zZY.d.ts.map +0 -1
  71. package/dist/list-selection-controller-CUo-Hhcm.js.map +0 -1
  72. package/dist/tree-B74zdI60.js.map +0 -1
  73. package/dist/vertical-list-CQSEVeOT.d.ts.map +0 -1
package/dist/data-grid.js CHANGED
@@ -2,12 +2,14 @@ import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
2
2
  import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
3
3
  import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
4
4
  import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
5
+ import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES } from "./incr-search-DpbSJtgj.js";
5
6
  import { i as listItemFadeKeyframes } from "./list-item-animation-DuiwgN3l.js";
6
7
  import "./interaction-Cr13azbM.js";
7
8
  import { t as createDragGhost } from "./drag-ghost-DtSDvjri.js";
8
9
  import "./menu-Bg90Qr0B.js";
9
10
  import { LitElement, css, html, nothing } from "lit";
10
11
  import { property, query, state } from "lit/decorators.js";
12
+ import { createCommandRegistry } from "@clinth/ui-commands";
11
13
  import { repeat } from "lit/directives/repeat.js";
12
14
  //#region src/data-grid/data-grid.ts
13
15
  let DataGridElement = class DataGridElement extends LitElement {
@@ -48,6 +50,8 @@ let DataGridElement = class DataGridElement extends LitElement {
48
50
  this._sortedRows = [];
49
51
  this._flat = [];
50
52
  this._flatKeys = [];
53
+ this.#searchKeyByRow = /* @__PURE__ */ new Map();
54
+ this.search = new ListSearchController(this, { adapter: this.#createSearchAdapter() });
51
55
  this.#prevFlatKeys = [];
52
56
  this.#enteringRowKeys = /* @__PURE__ */ new Set();
53
57
  this.#rowReflowTimer = 0;
@@ -253,6 +257,7 @@ let DataGridElement = class DataGridElement extends LitElement {
253
257
  tickledStyles,
254
258
  tickledItemStyles,
255
259
  listItemFadeKeyframes,
260
+ listSearchStyles,
256
261
  css`
257
262
  :host {
258
263
  --data-grid-row-height: 28px;
@@ -261,6 +266,7 @@ let DataGridElement = class DataGridElement extends LitElement {
261
266
  --data-grid-header-bg: var(--surface-2);
262
267
  --data-grid-border: var(--border);
263
268
  --data-grid-header-text: var(--surface-3-text);
269
+ position: relative;
264
270
  display: block;
265
271
  overflow: hidden;
266
272
  border: var(--data-grid-border);
@@ -354,6 +360,55 @@ let DataGridElement = class DataGridElement extends LitElement {
354
360
  `
355
361
  ];
356
362
  }
363
+ #searchRegistry;
364
+ #unregisterSearchCommands;
365
+ #searchKeyByRow;
366
+ /** Command registry carrying this grid's `list.search.*` commands. */
367
+ get registry() {
368
+ return this.#searchRegistry;
369
+ }
370
+ #rowSearchText(row) {
371
+ if (this.rowSearchText) return this.rowSearchText(row);
372
+ const rec = row;
373
+ return this._visibleColumns.map((c) => String(rec[c.key] ?? ``)).join(` `);
374
+ }
375
+ #createSearchAdapter() {
376
+ return {
377
+ getItems: () => {
378
+ this.#searchKeyByRow.clear();
379
+ this._sortedRows.forEach((r, i) => this.#searchKeyByRow.set(r, this.getRowKey(r, i)));
380
+ return this._sortedRows;
381
+ },
382
+ getLabel: (row) => this.#rowSearchText(row),
383
+ getKey: (row) => this.#searchKeyByRow.get(row) ?? String(this._sortedRows.indexOf(row)),
384
+ focusItem: (row) => {
385
+ if (row === void 0) return;
386
+ const key = this.#searchKeyByRow.get(row);
387
+ if (key !== void 0) this.tickleRow(key);
388
+ },
389
+ selectItems: (rows) => {
390
+ this.selectKeys(rows.map((r) => this.#searchKeyByRow.get(r)).filter((k) => k !== void 0));
391
+ },
392
+ applyFilter: (matched) => {
393
+ this.filterPredicate = matched === void 0 ? void 0 : (row) => {
394
+ const k = this.#searchKeyByRow.get(row);
395
+ return k === void 0 || matched.has(k);
396
+ };
397
+ }
398
+ };
399
+ }
400
+ #effectiveSearchModes() {
401
+ const raw = this.searchModes?.trim();
402
+ if (raw === void 0) return [...LIST_SEARCH_MODES];
403
+ const requested = new Set(raw.split(/\s+/));
404
+ return LIST_SEARCH_MODES.filter((m) => requested.has(m));
405
+ }
406
+ #syncSearchCommands() {
407
+ if (!this.#searchRegistry) return;
408
+ this.search.setModes(this.#effectiveSearchModes());
409
+ this.#unregisterSearchCommands?.();
410
+ this.#unregisterSearchCommands = registerListSearchCommands(this.#searchRegistry, this.search);
411
+ }
357
412
  /** Row-key snapshot from the previous update, for the insertion / removal animation. */
358
413
  #prevFlatKeys;
359
414
  #enteringRowKeys;
@@ -366,17 +421,29 @@ let DataGridElement = class DataGridElement extends LitElement {
366
421
  if (!this.hasAttribute(`tabindex`)) this.tabIndex = 0;
367
422
  this.addEventListener(`keydown`, this._onKeyDown);
368
423
  this.addEventListener(`focusout`, this._onFocusOut);
424
+ this.#searchRegistry ??= createCommandRegistry();
425
+ this.#syncSearchCommands();
369
426
  }
370
427
  disconnectedCallback() {
371
428
  super.disconnectedCallback();
372
429
  this.removeEventListener(`keydown`, this._onKeyDown);
373
430
  this.removeEventListener(`focusout`, this._onFocusOut);
374
431
  cancelAnimationFrame(this._raf);
432
+ this.#unregisterSearchCommands?.();
433
+ this.#unregisterSearchCommands = void 0;
434
+ this.#searchRegistry = void 0;
375
435
  if (this.#rowReflowTimer) {
376
436
  clearTimeout(this.#rowReflowTimer);
377
437
  this.#rowReflowTimer = 0;
378
438
  }
379
439
  }
440
+ /**
441
+ * Dispatch a command to this grid — routes through the command registry so
442
+ * `list.search.*` (and any other registered commands) work.
443
+ */
444
+ dispatch(commandId, args) {
445
+ this.#searchRegistry?.invoke(commandId, args);
446
+ }
380
447
  firstUpdated() {
381
448
  new ResizeObserver(() => {
382
449
  if (!this._viewportEl) return;
@@ -402,6 +469,7 @@ let DataGridElement = class DataGridElement extends LitElement {
402
469
  willUpdate(changed) {
403
470
  super.willUpdate(changed);
404
471
  this.setAttribute(`data-input-mode`, this._tickled.inputMode);
472
+ if (changed.has(`searchModes`)) this.#syncSearchCommands();
405
473
  if (!this.#appendInProgress) {
406
474
  if (changed.has(`rows`) || changed.has(`sortState`) || changed.has(`columns`) || changed.has(`groupBy`) || changed.has(`groupLabel`)) this._sortedRows = this._applySort([...this.rows]);
407
475
  this._rebuildFlat();
@@ -456,18 +524,23 @@ let DataGridElement = class DataGridElement extends LitElement {
456
524
  return String(this.groupBy(row));
457
525
  }
458
526
  _rebuildFlat() {
527
+ const filtered = this.filterPredicate !== void 0;
528
+ const source = filtered ? this._sortedRows.filter((r) => this.filterPredicate(r)) : this._sortedRows;
459
529
  if (!this.groupBy) {
460
- this._flat = this._sortedRows.map((r, i) => ({
461
- type: `row`,
462
- key: this.getRowKey(r, i),
463
- row: r,
464
- idx: i
465
- }));
530
+ this._flat = source.map((r, i) => {
531
+ const idx = filtered ? this._sortedRows.indexOf(r) : i;
532
+ return {
533
+ type: `row`,
534
+ key: this.getRowKey(r, idx),
535
+ row: r,
536
+ idx
537
+ };
538
+ });
466
539
  this._flatKeys = this._flat.map((f) => f.key);
467
540
  return;
468
541
  }
469
542
  const groups = /* @__PURE__ */ new Map();
470
- for (const r of this._sortedRows) {
543
+ for (const r of source) {
471
544
  const k = this._getGroupKey(r) ?? ``;
472
545
  const arr = groups.get(k);
473
546
  if (arr) arr.push(r);
@@ -1337,6 +1410,7 @@ let DataGridElement = class DataGridElement extends LitElement {
1337
1410
  })}
1338
1411
  </div>
1339
1412
  </div>
1413
+ ${this.search.renderField()}
1340
1414
  </div>
1341
1415
  `;
1342
1416
  }
@@ -1380,6 +1454,13 @@ __decorate([property({
1380
1454
  attribute: `column-menu`
1381
1455
  })], DataGridElement.prototype, "columnMenu", void 0);
1382
1456
  __decorate([property({ attribute: false })], DataGridElement.prototype, "globalFormatter", void 0);
1457
+ __decorate([property({ attribute: false })], DataGridElement.prototype, "filterPredicate", void 0);
1458
+ __decorate([property({ attribute: false })], DataGridElement.prototype, "rowSearchText", void 0);
1459
+ __decorate([property({
1460
+ type: String,
1461
+ attribute: `search-modes`,
1462
+ reflect: true
1463
+ })], DataGridElement.prototype, "searchModes", void 0);
1383
1464
  __decorate([state()], DataGridElement.prototype, "_selectedKeys", void 0);
1384
1465
  __decorate([state()], DataGridElement.prototype, "_scrollTop", void 0);
1385
1466
  __decorate([state()], DataGridElement.prototype, "_scrollLeft", void 0);