bank20baht-ui 0.1.4 → 0.1.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.
@@ -6,15 +6,25 @@ import { BahtElement } from '../base.js';
6
6
  *
7
7
  * <baht-pagination page="4" total-pages="20"></baht-pagination>
8
8
  * <baht-pagination variant="compact" page="1" total-pages="3"></baht-pagination>
9
+ *
10
+ * `variant="cursor"` drops page numbers entirely — the host doesn't know a
11
+ * total, only whether another page exists in either direction:
12
+ *
13
+ * <baht-pagination variant="cursor" has-next has-prev></baht-pagination>
14
+ * el.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));
9
15
  */
10
16
  export declare class BahtPagination extends BahtElement {
11
17
  page: number;
12
18
  totalPages: number;
13
- /** 'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 » */
14
- variant: 'numbered' | 'compact';
19
+ /** 'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 · 'cursor' = « Prev / Next » */
20
+ variant: 'numbered' | 'compact' | 'cursor';
15
21
  /** Numbered pages shown on each side of the current page. */
16
22
  siblings: number;
23
+ /** cursor variant only — whether a next/previous page is available. */
24
+ hasNext: boolean;
25
+ hasPrev: boolean;
17
26
  private go;
27
+ private goCursor;
18
28
  /** Visible page numbers with `null` marking an ellipsis gap. */
19
29
  private get pageItems();
20
30
  protected render(): TemplateResult;
@@ -13,6 +13,13 @@ export type CellRenderer = (value: unknown, row: Record<string, unknown>) => unk
13
13
  * t.loading = false; t.page = 1; t.totalPages = 12;
14
14
  * t.addEventListener('baht-page-change', (e) => fetchPage(e.detail.page));
15
15
  * t.addEventListener('baht-row-click', (e) => open(e.detail.id));
16
+ *
17
+ * Set `cursor-mode` for cursor-based APIs (no total count) — the footer
18
+ * becomes a Prev/Next pair gated by `has-next`/`has-prev`, and the host
19
+ * listens for `baht-cursor-change` instead of `baht-page-change`:
20
+ *
21
+ * t.cursorMode = true; t.hasNext = true; t.hasPrev = false;
22
+ * t.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));
16
23
  */
17
24
  export declare class BahtTable extends BahtElement {
18
25
  /** Rows of the CURRENT page. */
@@ -35,6 +42,10 @@ export declare class BahtTable extends BahtElement {
35
42
  renderers: Record<string, CellRenderer>;
36
43
  page: number;
37
44
  totalPages: number;
45
+ /** Switch the footer to Prev/Next (cursor-based API, no total count). */
46
+ cursorMode: boolean;
47
+ hasNext: boolean;
48
+ hasPrev: boolean;
38
49
  private get columnKeys();
39
50
  private labelFor;
40
51
  private emitRow;
@@ -5731,7 +5731,7 @@
5731
5731
  "declarations": [
5732
5732
  {
5733
5733
  "kind": "class",
5734
- "description": "Server-side pagination control: it never slices data — it only reports the\npage the user asked for via `baht-page-change`; the host fetches that page.\n\n <baht-pagination page=\"4\" total-pages=\"20\"></baht-pagination>\n <baht-pagination variant=\"compact\" page=\"1\" total-pages=\"3\"></baht-pagination>",
5734
+ "description": "Server-side pagination control: it never slices data — it only reports the\npage the user asked for via `baht-page-change`; the host fetches that page.\n\n <baht-pagination page=\"4\" total-pages=\"20\"></baht-pagination>\n <baht-pagination variant=\"compact\" page=\"1\" total-pages=\"3\"></baht-pagination>\n\n`variant=\"cursor\"` drops page numbers entirely — the host doesn't know a\ntotal, only whether another page exists in either direction:\n\n <baht-pagination variant=\"cursor\" has-next has-prev></baht-pagination>\n el.addEventListener('baht-cursor-change', (e) => fetchPage(e.detail.direction));",
5735
5735
  "name": "BahtPagination",
5736
5736
  "members": [
5737
5737
  {
@@ -5756,10 +5756,10 @@
5756
5756
  "kind": "field",
5757
5757
  "name": "variant",
5758
5758
  "type": {
5759
- "text": "'numbered' | 'compact'"
5759
+ "text": "'numbered' | 'compact' | 'cursor'"
5760
5760
  },
5761
5761
  "default": "'numbered'",
5762
- "description": "'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 »",
5762
+ "description": "'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 · 'cursor' = « Prev / Next »",
5763
5763
  "attribute": "variant"
5764
5764
  },
5765
5765
  {
@@ -5772,6 +5772,25 @@
5772
5772
  "description": "Numbered pages shown on each side of the current page.",
5773
5773
  "attribute": "siblings"
5774
5774
  },
5775
+ {
5776
+ "kind": "field",
5777
+ "name": "hasNext",
5778
+ "type": {
5779
+ "text": "boolean"
5780
+ },
5781
+ "default": "false",
5782
+ "description": "cursor variant only — whether a next/previous page is available.",
5783
+ "attribute": "has-next"
5784
+ },
5785
+ {
5786
+ "kind": "field",
5787
+ "name": "hasPrev",
5788
+ "type": {
5789
+ "text": "boolean"
5790
+ },
5791
+ "default": "false",
5792
+ "attribute": "has-prev"
5793
+ },
5775
5794
  {
5776
5795
  "kind": "method",
5777
5796
  "name": "go",
@@ -5790,6 +5809,24 @@
5790
5809
  }
5791
5810
  ]
5792
5811
  },
5812
+ {
5813
+ "kind": "method",
5814
+ "name": "goCursor",
5815
+ "privacy": "private",
5816
+ "return": {
5817
+ "type": {
5818
+ "text": "void"
5819
+ }
5820
+ },
5821
+ "parameters": [
5822
+ {
5823
+ "name": "direction",
5824
+ "type": {
5825
+ "text": "'next' | 'prev'"
5826
+ }
5827
+ }
5828
+ ]
5829
+ },
5793
5830
  {
5794
5831
  "kind": "field",
5795
5832
  "name": "pageItems",
@@ -5807,6 +5844,12 @@
5807
5844
  "type": {
5808
5845
  "text": "CustomEvent"
5809
5846
  }
5847
+ },
5848
+ {
5849
+ "name": "baht-cursor-change",
5850
+ "type": {
5851
+ "text": "CustomEvent"
5852
+ }
5810
5853
  }
5811
5854
  ],
5812
5855
  "attributes": [
@@ -5829,10 +5872,10 @@
5829
5872
  {
5830
5873
  "name": "variant",
5831
5874
  "type": {
5832
- "text": "'numbered' | 'compact'"
5875
+ "text": "'numbered' | 'compact' | 'cursor'"
5833
5876
  },
5834
5877
  "default": "'numbered'",
5835
- "description": "'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 »",
5878
+ "description": "'numbered' = 1 … 4 5 6 … 20 · 'compact' = « Page 4 of 20 · 'cursor' = « Prev / Next »",
5836
5879
  "fieldName": "variant"
5837
5880
  },
5838
5881
  {
@@ -5843,6 +5886,23 @@
5843
5886
  "default": "1",
5844
5887
  "description": "Numbered pages shown on each side of the current page.",
5845
5888
  "fieldName": "siblings"
5889
+ },
5890
+ {
5891
+ "name": "has-next",
5892
+ "type": {
5893
+ "text": "boolean"
5894
+ },
5895
+ "default": "false",
5896
+ "description": "cursor variant only — whether a next/previous page is available.",
5897
+ "fieldName": "hasNext"
5898
+ },
5899
+ {
5900
+ "name": "has-prev",
5901
+ "type": {
5902
+ "text": "boolean"
5903
+ },
5904
+ "default": "false",
5905
+ "fieldName": "hasPrev"
5846
5906
  }
5847
5907
  ],
5848
5908
  "superclass": {
@@ -8288,7 +8348,7 @@
8288
8348
  "declarations": [
8289
8349
  {
8290
8350
  "kind": "class",
8291
- "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));",
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));",
8292
8352
  "name": "BahtTable",
8293
8353
  "members": [
8294
8354
  {
@@ -8420,6 +8480,34 @@
8420
8480
  "default": "1",
8421
8481
  "attribute": "total-pages"
8422
8482
  },
8483
+ {
8484
+ "kind": "field",
8485
+ "name": "cursorMode",
8486
+ "type": {
8487
+ "text": "boolean"
8488
+ },
8489
+ "default": "false",
8490
+ "description": "Switch the footer to Prev/Next (cursor-based API, no total count).",
8491
+ "attribute": "cursor-mode"
8492
+ },
8493
+ {
8494
+ "kind": "field",
8495
+ "name": "hasNext",
8496
+ "type": {
8497
+ "text": "boolean"
8498
+ },
8499
+ "default": "false",
8500
+ "attribute": "has-next"
8501
+ },
8502
+ {
8503
+ "kind": "field",
8504
+ "name": "hasPrev",
8505
+ "type": {
8506
+ "text": "boolean"
8507
+ },
8508
+ "default": "false",
8509
+ "attribute": "has-prev"
8510
+ },
8423
8511
  {
8424
8512
  "kind": "field",
8425
8513
  "name": "columnKeys",
@@ -8613,6 +8701,31 @@
8613
8701
  },
8614
8702
  "default": "1",
8615
8703
  "fieldName": "totalPages"
8704
+ },
8705
+ {
8706
+ "name": "cursor-mode",
8707
+ "type": {
8708
+ "text": "boolean"
8709
+ },
8710
+ "default": "false",
8711
+ "description": "Switch the footer to Prev/Next (cursor-based API, no total count).",
8712
+ "fieldName": "cursorMode"
8713
+ },
8714
+ {
8715
+ "name": "has-next",
8716
+ "type": {
8717
+ "text": "boolean"
8718
+ },
8719
+ "default": "false",
8720
+ "fieldName": "hasNext"
8721
+ },
8722
+ {
8723
+ "name": "has-prev",
8724
+ "type": {
8725
+ "text": "boolean"
8726
+ },
8727
+ "default": "false",
8728
+ "fieldName": "hasPrev"
8616
8729
  }
8617
8730
  ],
8618
8731
  "superclass": {