bank20baht-ui 0.1.7 → 0.1.9

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.
@@ -21,11 +21,12 @@ export type CellRenderer = (value: unknown, row: Record<string, unknown>) => unk
21
21
  * t.cursorMode = true; t.hasNext = true; t.hasPrev = false;
22
22
  * t.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));
23
23
  *
24
- * Set `column-picker` for a built-in "Columns" toggle — it walks `columns`
25
- * (or the first row's keys, same as the header does) and lets the user
26
- * show/hide them client-side, no host wiring required:
24
+ * A built-in "Columns" button is ON by default — it opens a ServiceNow-style
25
+ * Available/Selected dual-list modal (add/remove, reorder, Select all/Clear
26
+ * all) derived from `columns` (or the first row's keys), no host wiring
27
+ * required. Set `t.columnPicker = false` (JS property — a boolean attribute
28
+ * can't express "off") to hide it:
27
29
  *
28
- * t.columnPicker = true;
29
30
  * t.addEventListener('baht-columns-change', (e) => console.log(e.detail.visibleColumns));
30
31
  *
31
32
  * `visibleColumns` still works standalone for a host-controlled subset (no
@@ -53,7 +54,7 @@ export declare class BahtTable extends BahtElement {
53
54
  renderers: Record<string, CellRenderer>;
54
55
  /** Subset + order of `columns` to render; empty/omitted = show all. */
55
56
  visibleColumns: string[];
56
- /** Built-in "Columns" toggle — derives its options from `columns`/rows. */
57
+ /** Built-in "Columns" toggle — derives its options from `columns`/rows. Set `column-picker="false"` to hide it. */
57
58
  columnPicker: boolean;
58
59
  page: number;
59
60
  totalPages: number;
@@ -64,16 +65,27 @@ export declare class BahtTable extends BahtElement {
64
65
  private pickerOpen;
65
66
  /** User's picks once they've touched the picker; null = follow `visibleColumns`/all. */
66
67
  private pickedColumns;
67
- private readonly onDocMousedown;
68
+ /** Working copy edited inside the modal; committed to `pickedColumns` on OK. */
69
+ private draftColumns;
70
+ /** Highlighted (not yet moved) options in each list. */
71
+ private pickAvail;
72
+ private pickSel;
73
+ private readonly onPickerKeydown;
68
74
  disconnectedCallback(): void;
69
75
  private get allColumnKeys();
70
76
  private get columnKeys();
71
- private togglePicker;
72
- private toggleColumn;
77
+ private openPicker;
78
+ private closePicker;
79
+ private static selectedValues;
80
+ private addToSelected;
81
+ private removeFromSelected;
82
+ private moveSelected;
83
+ private confirmPicker;
73
84
  private labelFor;
74
85
  private emitRow;
75
86
  private cell;
76
87
  private renderBody;
77
- private renderColumnPicker;
88
+ private renderColumnToggle;
89
+ private renderColumnModal;
78
90
  protected render(): TemplateResult;
79
91
  }
@@ -8348,7 +8348,7 @@
8348
8348
  "declarations": [
8349
8349
  {
8350
8350
  "kind": "class",
8351
- "description": "Server-side data table. `items` is ONE page of rows — the component never\nslices or fetches; on `baht-page-change` the host fetches the next page and\nre-feeds `items`/`page`. While that fetch runs, set `loading` to show\nskeleton rows.\n\n const t = document.querySelector('baht-table');\n t.columns = { name: 'Name', created_at: 'Created' };\n t.items = pageRows; // current page only\n t.loading = false; t.page = 1; t.totalPages = 12;\n t.addEventListener('baht-page-change', (e) => fetchPage(e.detail.page));\n t.addEventListener('baht-row-click', (e) => open(e.detail.id));\n\nSet `cursor-mode` for cursor-based APIs (no total count) — the footer\nbecomes a Prev/Next pair gated by `has-next`/`has-prev`, and the host\nlistens for `baht-cursor-change` instead of `baht-page-change`:\n\n t.cursorMode = true; t.hasNext = true; t.hasPrev = false;\n t.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));\n\nSet `column-picker` for a built-in \"Columns\" toggle — it walks `columns`\n(or the first row's keys, same as the header does) and lets the user\nshow/hide them client-side, no host wiring required:\n\n t.columnPicker = true;\n t.addEventListener('baht-columns-change', (e) => console.log(e.detail.visibleColumns));\n\n`visibleColumns` still works standalone for a host-controlled subset (no\nrefetch) — pass it explicitly and the built-in picker (if also enabled)\nstarts from that selection and keeps emitting updates for it.",
8351
+ "description": "Server-side data table. `items` is ONE page of rows — the component never\nslices or fetches; on `baht-page-change` the host fetches the next page and\nre-feeds `items`/`page`. While that fetch runs, set `loading` to show\nskeleton rows.\n\n const t = document.querySelector('baht-table');\n t.columns = { name: 'Name', created_at: 'Created' };\n t.items = pageRows; // current page only\n t.loading = false; t.page = 1; t.totalPages = 12;\n t.addEventListener('baht-page-change', (e) => fetchPage(e.detail.page));\n t.addEventListener('baht-row-click', (e) => open(e.detail.id));\n\nSet `cursor-mode` for cursor-based APIs (no total count) — the footer\nbecomes a Prev/Next pair gated by `has-next`/`has-prev`, and the host\nlistens for `baht-cursor-change` instead of `baht-page-change`:\n\n t.cursorMode = true; t.hasNext = true; t.hasPrev = false;\n t.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));\n\nA built-in \"Columns\" button is ON by default — it opens a ServiceNow-style\nAvailable/Selected dual-list modal (add/remove, reorder, Select all/Clear\nall) derived from `columns` (or the first row's keys), no host wiring\nrequired. Set `t.columnPicker = false` (JS property — a boolean attribute\ncan't express \"off\") to hide it:\n\n t.addEventListener('baht-columns-change', (e) => console.log(e.detail.visibleColumns));\n\n`visibleColumns` still works standalone for a host-controlled subset (no\nrefetch) — pass it explicitly and the built-in picker (if also enabled)\nstarts from that selection and keeps emitting updates for it.",
8352
8352
  "name": "BahtTable",
8353
8353
  "members": [
8354
8354
  {
@@ -8477,8 +8477,8 @@
8477
8477
  "type": {
8478
8478
  "text": "boolean"
8479
8479
  },
8480
- "default": "false",
8481
- "description": "Built-in \"Columns\" toggle — derives its options from `columns`/rows.",
8480
+ "default": "true",
8481
+ "description": "Built-in \"Columns\" toggle — derives its options from `columns`/rows. Set `column-picker=\"false\"` to hide it.",
8482
8482
  "attribute": "column-picker"
8483
8483
  },
8484
8484
  {
@@ -8548,7 +8548,36 @@
8548
8548
  },
8549
8549
  {
8550
8550
  "kind": "field",
8551
- "name": "onDocMousedown",
8551
+ "name": "draftColumns",
8552
+ "type": {
8553
+ "text": "string[]"
8554
+ },
8555
+ "privacy": "private",
8556
+ "default": "[]",
8557
+ "description": "Working copy edited inside the modal; committed to `pickedColumns` on OK."
8558
+ },
8559
+ {
8560
+ "kind": "field",
8561
+ "name": "pickAvail",
8562
+ "type": {
8563
+ "text": "string[]"
8564
+ },
8565
+ "privacy": "private",
8566
+ "default": "[]",
8567
+ "description": "Highlighted (not yet moved) options in each list."
8568
+ },
8569
+ {
8570
+ "kind": "field",
8571
+ "name": "pickSel",
8572
+ "type": {
8573
+ "text": "string[]"
8574
+ },
8575
+ "privacy": "private",
8576
+ "default": "[]"
8577
+ },
8578
+ {
8579
+ "kind": "field",
8580
+ "name": "onPickerKeydown",
8552
8581
  "privacy": "private",
8553
8582
  "readonly": true
8554
8583
  },
@@ -8572,7 +8601,7 @@
8572
8601
  },
8573
8602
  {
8574
8603
  "kind": "method",
8575
- "name": "togglePicker",
8604
+ "name": "openPicker",
8576
8605
  "privacy": "private",
8577
8606
  "return": {
8578
8607
  "type": {
@@ -8582,22 +8611,81 @@
8582
8611
  },
8583
8612
  {
8584
8613
  "kind": "method",
8585
- "name": "toggleColumn",
8614
+ "name": "closePicker",
8586
8615
  "privacy": "private",
8587
8616
  "return": {
8588
8617
  "type": {
8589
8618
  "text": "void"
8590
8619
  }
8620
+ }
8621
+ },
8622
+ {
8623
+ "kind": "method",
8624
+ "name": "selectedValues",
8625
+ "privacy": "private",
8626
+ "static": true,
8627
+ "return": {
8628
+ "type": {
8629
+ "text": "string[]"
8630
+ }
8591
8631
  },
8592
8632
  "parameters": [
8593
8633
  {
8594
- "name": "key",
8634
+ "name": "e",
8595
8635
  "type": {
8596
- "text": "string"
8636
+ "text": "Event"
8597
8637
  }
8598
8638
  }
8599
8639
  ]
8600
8640
  },
8641
+ {
8642
+ "kind": "method",
8643
+ "name": "addToSelected",
8644
+ "privacy": "private",
8645
+ "return": {
8646
+ "type": {
8647
+ "text": "void"
8648
+ }
8649
+ }
8650
+ },
8651
+ {
8652
+ "kind": "method",
8653
+ "name": "removeFromSelected",
8654
+ "privacy": "private",
8655
+ "return": {
8656
+ "type": {
8657
+ "text": "void"
8658
+ }
8659
+ }
8660
+ },
8661
+ {
8662
+ "kind": "method",
8663
+ "name": "moveSelected",
8664
+ "privacy": "private",
8665
+ "return": {
8666
+ "type": {
8667
+ "text": "void"
8668
+ }
8669
+ },
8670
+ "parameters": [
8671
+ {
8672
+ "name": "dir",
8673
+ "type": {
8674
+ "text": "-1 | 1"
8675
+ }
8676
+ }
8677
+ ]
8678
+ },
8679
+ {
8680
+ "kind": "method",
8681
+ "name": "confirmPicker",
8682
+ "privacy": "private",
8683
+ "return": {
8684
+ "type": {
8685
+ "text": "void"
8686
+ }
8687
+ }
8688
+ },
8601
8689
  {
8602
8690
  "kind": "method",
8603
8691
  "name": "labelFor",
@@ -8684,7 +8772,17 @@
8684
8772
  },
8685
8773
  {
8686
8774
  "kind": "method",
8687
- "name": "renderColumnPicker",
8775
+ "name": "renderColumnToggle",
8776
+ "privacy": "private",
8777
+ "return": {
8778
+ "type": {
8779
+ "text": "TemplateResult"
8780
+ }
8781
+ }
8782
+ },
8783
+ {
8784
+ "kind": "method",
8785
+ "name": "renderColumnModal",
8688
8786
  "privacy": "private",
8689
8787
  "return": {
8690
8788
  "type": {
@@ -8788,8 +8886,8 @@
8788
8886
  "type": {
8789
8887
  "text": "boolean"
8790
8888
  },
8791
- "default": "false",
8792
- "description": "Built-in \"Columns\" toggle — derives its options from `columns`/rows.",
8889
+ "default": "true",
8890
+ "description": "Built-in \"Columns\" toggle — derives its options from `columns`/rows. Set `column-picker=\"false\"` to hide it.",
8793
8891
  "fieldName": "columnPicker"
8794
8892
  },
8795
8893
  {