wimui 0.46.0 → 0.47.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.
@@ -20,6 +20,8 @@ export type PivotHeaderCell<T extends PivotAxisInput = PivotAxisInput> = {
20
20
  startsGroup: boolean;
21
21
  /** 最上位の節か。`colgroup` と 1 対 1 に対応するのはこの段だけ。 */
22
22
  topLevel: boolean;
23
+ /** 配下の列が出ているか(グループでないセルは常に `false`)。 */
24
+ expanded: boolean;
23
25
  };
24
26
  /** 値を持つ 1 列。 */
25
27
  export type PivotColumn = {
@@ -55,10 +57,13 @@ export type PivotRow<T extends PivotAxisInput = PivotAxisInput> = {
55
57
  * - 葉は、自分の段から最下段まで縦に伸びる(木の深さが揃っていなくても段がずれない)
56
58
  * - `subtotals` を付けると、グループごとに子の後ろへ小計の列を 1 本足す
57
59
  * - `total` を付けると、右端に総計の列を 1 本足す
60
+ * - 折りたたまれたグループは、配下の列を出さず、自分の値(小計)の列を 1 本だけ出す。見出しの
61
+ * セルは葉と同じく最下段まで伸びる。段の数は、見えている木の深さになる
58
62
  */
59
63
  export declare function layoutPivotColumns<T extends PivotAxisInput>(nodes: T[], options?: {
60
64
  subtotals?: boolean;
61
65
  total?: boolean;
66
+ isExpanded?: (key: string) => boolean;
62
67
  }): PivotColumnLayout<T>;
63
68
  /**
64
69
  * 行の軸の木を、深さ優先で 1 行ずつに並べる(アウトライン形式: グループも 1 行を持つ)。
@@ -1,51 +1,73 @@
1
1
  "use client";
2
2
  //#region src/components/data-display/PivotTable/layoutPivot.ts
3
- var e = (e) => !!e.children?.length, t = (n) => n.reduce((n, r) => Math.max(n, 1 + (e(r) ? t(r.children) : 0)), 0);
3
+ var e = (e) => !!e.children?.length, t = (n, r) => n.reduce((n, i) => Math.max(n, 1 + (e(i) && r(i.key) ? t(i.children, r) : 0)), 0);
4
4
  function n(n, r = {}) {
5
- let i = Math.max(1, t(n)), a = Array.from({ length: i }, () => []), o = [], s = [], c = 0, l = (e, t, n, r, s, l) => {
6
- let u = c++, d = e?.key ?? null;
7
- a[n].push({
5
+ let i = r.isExpanded ?? (() => !0), a = Math.max(1, t(n, i)), o = Array.from({ length: a }, () => []), s = [], c = [], l = 0, u = (e, t, n, r, i, c) => {
6
+ let u = l++, d = e?.key ?? null;
7
+ o[n].push({
8
8
  id: u,
9
9
  key: d,
10
10
  node: e,
11
11
  kind: t,
12
12
  colSpan: 1,
13
- rowSpan: i - n,
13
+ rowSpan: a - n,
14
14
  reachesBottom: !0,
15
- startsGroup: l,
16
- topLevel: s
17
- }), o.push({
15
+ startsGroup: c,
16
+ topLevel: i,
17
+ expanded: !1
18
+ }), s.push({
18
19
  key: d,
19
20
  kind: t,
20
21
  headerIds: [...r, u],
21
- startsGroup: l
22
+ startsGroup: c
22
23
  });
23
- }, u = (t, n, i, o) => {
24
- let s = n === 0;
25
- if (!e(t)) return l(t, "leaf", n, i, s, o), 1;
26
- let d = {
27
- id: c++,
24
+ }, d = (t, n, c, f) => {
25
+ let p = n === 0;
26
+ if (!e(t)) return u(t, "leaf", n, c, p, f), 1;
27
+ if (!i(t.key)) {
28
+ let e = l++;
29
+ return o[n].push({
30
+ id: e,
31
+ key: t.key,
32
+ node: t,
33
+ kind: "group",
34
+ colSpan: 1,
35
+ rowSpan: a - n,
36
+ reachesBottom: !0,
37
+ startsGroup: f,
38
+ topLevel: p,
39
+ expanded: !1
40
+ }), s.push({
41
+ key: t.key,
42
+ kind: "subtotal",
43
+ headerIds: [...c, e],
44
+ startsGroup: f
45
+ }), 1;
46
+ }
47
+ let m = {
48
+ id: l++,
28
49
  key: t.key,
29
50
  node: t,
30
51
  kind: "group",
31
52
  colSpan: 0,
32
53
  rowSpan: 1,
33
54
  reachesBottom: !1,
34
- startsGroup: o,
35
- topLevel: s
55
+ startsGroup: f,
56
+ topLevel: p,
57
+ expanded: !0
36
58
  };
37
- a[n].push(d);
38
- let f = [...i, d.id], p = 0;
59
+ o[n].push(m);
60
+ let h = [...c, m.id], g = 0;
39
61
  return t.children.forEach((e, t) => {
40
- p += u(e, n + 1, f, o && t === 0);
41
- }), r.subtotals && (l(t, "subtotal", n + 1, f, !1, !1), p += 1), d.colSpan = p, p;
62
+ g += d(e, n + 1, h, f && t === 0);
63
+ }), r.subtotals && (u(t, "subtotal", n + 1, h, !1, !1), g += 1), m.colSpan = g, g;
42
64
  };
43
- for (let e of n) s.push(u(e, 0, [], !0));
44
- return r.total && (l(null, "total", 0, [], !0, !0), s.push(1)), {
45
- headerRows: a,
46
- columns: o,
47
- depth: i,
48
- groupSpans: s
65
+ for (let e of n) c.push(d(e, 0, [], !0));
66
+ return r.total && (u(null, "total", 0, [], !0, !0), c.push(1)), {
67
+ headerRows: o,
68
+ columns: s,
69
+ depth: a,
70
+ groupSpans: c
49
71
  };
50
72
  }
51
73
  function r(t, n = () => !0) {
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_scroller_1kzph_7`,t=`_root_1kzph_22`,n=`_caption_1kzph_34`,r=`_columnHeader_1kzph_41`,i=`_group_1kzph_55`,a=`_bottom_1kzph_62`,o=`_corner_1kzph_65`,s=`_rowHeader_1kzph_68`,c=`_toggle_1kzph_83`,l=`_chevron_1kzph_102`,u=`_open_1kzph_118`,d=`_leafLabel_1kzph_122`,f=`_value_1kzph_129`,p=`_groupRow_1kzph_135`,m=`_aggregate_1kzph_140`,h=`_groupStart_1kzph_144`,g=`_totalRow_1kzph_147`,_=`_gap_1kzph_152`,v=`_stickyTop_1kzph_161`,y=`_stickyLeft_1kzph_166`,b={scroller:e,root:t,caption:n,columnHeader:r,group:i,bottom:a,corner:o,rowHeader:s,toggle:c,chevron:l,open:u,leafLabel:d,value:f,groupRow:p,aggregate:m,groupStart:h,totalRow:g,gap:_,stickyTop:v,stickyLeft:y};exports.aggregate=m,exports.bottom=a,exports.caption=n,exports.chevron=l,exports.columnHeader=r,exports.corner=o,exports.default=b,exports.gap=_,exports.group=i,exports.groupRow=p,exports.groupStart=h,exports.leafLabel=d,exports.open=u,exports.root=t,exports.rowHeader=s,exports.scroller=e,exports.stickyLeft=y,exports.stickyTop=v,exports.toggle=c,exports.totalRow=g,exports.value=f;
2
+ var e=`_scroller_176sk_7`,t=`_root_176sk_22`,n=`_caption_176sk_34`,r=`_columnHeader_176sk_41`,i=`_group_176sk_55`,a=`_bottom_176sk_62`,o=`_corner_176sk_65`,s=`_rowHeader_176sk_68`,c=`_toggle_176sk_83`,l=`_chevron_176sk_102`,u=`_open_176sk_118`,d=`_columnToggle_176sk_123`,f=`_columnLeafLabel_176sk_132`,p=`_leafLabel_176sk_142`,m=`_value_176sk_149`,h=`_groupRow_176sk_155`,g=`_aggregate_176sk_160`,_=`_groupStart_176sk_164`,v=`_totalRow_176sk_167`,y=`_gap_176sk_172`,b=`_stickyTop_176sk_181`,x=`_stickyLeft_176sk_186`,S={scroller:e,root:t,caption:n,columnHeader:r,group:i,bottom:a,corner:o,rowHeader:s,toggle:c,chevron:l,open:u,columnToggle:d,columnLeafLabel:f,leafLabel:p,value:m,groupRow:h,aggregate:g,groupStart:_,totalRow:v,gap:y,stickyTop:b,stickyLeft:x};exports.aggregate=g,exports.bottom=a,exports.caption=n,exports.chevron=l,exports.columnHeader=r,exports.columnLeafLabel=f,exports.columnToggle=d,exports.corner=o,exports.default=S,exports.gap=y,exports.group=i,exports.groupRow=h,exports.groupStart=_,exports.leafLabel=p,exports.open=u,exports.root=t,exports.rowHeader=s,exports.scroller=e,exports.stickyLeft=x,exports.stickyTop=b,exports.toggle=c,exports.totalRow=v,exports.value=m;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/data-display/PivotTable/pivot-table.module.scss
3
- var e = "_scroller_1kzph_7", t = "_root_1kzph_22", n = "_caption_1kzph_34", r = "_columnHeader_1kzph_41", i = "_group_1kzph_55", a = "_bottom_1kzph_62", o = "_corner_1kzph_65", s = "_rowHeader_1kzph_68", c = "_toggle_1kzph_83", l = "_chevron_1kzph_102", u = "_open_1kzph_118", d = "_leafLabel_1kzph_122", f = "_value_1kzph_129", p = "_groupRow_1kzph_135", m = "_aggregate_1kzph_140", h = "_groupStart_1kzph_144", g = "_totalRow_1kzph_147", _ = "_gap_1kzph_152", v = "_stickyTop_1kzph_161", y = "_stickyLeft_1kzph_166", b = {
3
+ var e = "_scroller_176sk_7", t = "_root_176sk_22", n = "_caption_176sk_34", r = "_columnHeader_176sk_41", i = "_group_176sk_55", a = "_bottom_176sk_62", o = "_corner_176sk_65", s = "_rowHeader_176sk_68", c = "_toggle_176sk_83", l = "_chevron_176sk_102", u = "_open_176sk_118", d = "_columnToggle_176sk_123", f = "_columnLeafLabel_176sk_132", p = "_leafLabel_176sk_142", m = "_value_176sk_149", h = "_groupRow_176sk_155", g = "_aggregate_176sk_160", _ = "_groupStart_176sk_164", v = "_totalRow_176sk_167", y = "_gap_176sk_172", b = "_stickyTop_176sk_181", x = "_stickyLeft_176sk_186", S = {
4
4
  scroller: e,
5
5
  root: t,
6
6
  caption: n,
@@ -12,15 +12,17 @@ var e = "_scroller_1kzph_7", t = "_root_1kzph_22", n = "_caption_1kzph_34", r =
12
12
  toggle: c,
13
13
  chevron: l,
14
14
  open: u,
15
- leafLabel: d,
16
- value: f,
17
- groupRow: p,
18
- aggregate: m,
19
- groupStart: h,
20
- totalRow: g,
21
- gap: _,
22
- stickyTop: v,
23
- stickyLeft: y
15
+ columnToggle: d,
16
+ columnLeafLabel: f,
17
+ leafLabel: p,
18
+ value: m,
19
+ groupRow: h,
20
+ aggregate: g,
21
+ groupStart: _,
22
+ totalRow: v,
23
+ gap: y,
24
+ stickyTop: b,
25
+ stickyLeft: x
24
26
  };
25
27
  //#endregion
26
- export { m as aggregate, a as bottom, n as caption, l as chevron, r as columnHeader, o as corner, b as default, _ as gap, i as group, p as groupRow, h as groupStart, d as leafLabel, u as open, t as root, s as rowHeader, e as scroller, y as stickyLeft, v as stickyTop, c as toggle, g as totalRow, f as value };
28
+ export { g as aggregate, a as bottom, n as caption, l as chevron, r as columnHeader, f as columnLeafLabel, d as columnToggle, o as corner, S as default, y as gap, i as group, h as groupRow, _ as groupStart, p as leafLabel, u as open, t as root, s as rowHeader, e as scroller, x as stickyLeft, b as stickyTop, c as toggle, v as totalRow, m as value };
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.46.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.47.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10
 
@@ -2496,13 +2496,19 @@ When omitted, both Backspace and Delete work.
2496
2496
  - `columns: PivotTableAxisNode[]` (required) — The column axis as a tree. Groups become headings that span their columns.
2497
2497
  - `getValue: (rowKey: string | null, columnKey: string | null) => React.ReactNode` (required) — Returns the content of one cell. The component does not aggregate: a group key asks
2498
2498
  for that group's subtotal and `null` asks for the grand total of that axis. Return
2499
- `null` or `undefined` for an empty cell.
2499
+ `null` or `undefined` for an empty cell. Group keys are asked on both axes: a row
2500
+ group for its own row, a column group for its subtotal column and for the single
2501
+ column it leaves when it is collapsed.
2500
2502
  - `rowAxisLabel: React.ReactNode` — Heading of the row axis, shown in the top-left corner.
2501
2503
  - `caption: React.ReactNode` — Visible title of the table, also its accessible name.
2502
- - `expandedValues: string[]` — Keys of the expanded row groups (controlled). A group that is not listed shows only
2504
+ - `expandedRowValues: string[]` — Keys of the expanded row groups (controlled). A group that is not listed shows only
2503
2505
  its own row, which carries its subtotal.
2504
- - `defaultExpandedValues: string[]` — Row groups expanded on first render (uncontrolled). Defaults to every group.
2505
- - `onExpandedChange: (values: string[]) => void` — Called with the new list of expanded row groups when a group is expanded or collapsed.
2506
+ - `defaultExpandedRowValues: string[]` — Row groups expanded on first render (uncontrolled). Defaults to every group.
2507
+ - `onExpandedRowChange: (values: string[]) => void` — Called with the new list of expanded row groups when a row group is expanded or collapsed.
2508
+ - `expandedColumnValues: string[]` — Keys of the expanded column groups (controlled). A group that is not listed shows a
2509
+ single column, which carries its subtotal: `getValue` receives the group's key.
2510
+ - `defaultExpandedColumnValues: string[]` — Column groups expanded on first render (uncontrolled). Defaults to every group.
2511
+ - `onExpandedColumnChange: (values: string[]) => void` — Called with the new list of expanded column groups when a column group is expanded or collapsed.
2506
2512
  - `maxHeight: string | number` — Maximum height of the table (a number is px). Past it the table scrolls vertically
2507
2513
  inside its own box.
2508
2514
  - `stickyHeader: boolean` = false — Keeps the column headings in view while the table scrolls vertically. Every heading
@@ -2513,7 +2519,7 @@ scrolls with the rest, so that the values stay readable.
2513
2519
  - `virtualized: boolean` = false — Renders only the rows in view (plus a few around them) and keeps the scroll height
2514
2520
  with empty spacer rows. Use it for tables with hundreds of rows, together with
2515
2521
  `maxHeight`. Rows must all have the same height, so keep labels and values on one line.
2516
- - `columnSubtotals: boolean` = false — Adds a subtotal column after the columns of each column group.
2522
+ - `columnSubtotals: boolean` = false — Adds a subtotal column after the columns of each expanded column group.
2517
2523
  - `totalRow: boolean` = false — Adds a grand total row at the bottom.
2518
2524
  - `totalColumn: boolean` = false — Adds a grand total column at the right edge.
2519
2525
  - `labels: { /** Heading of the grand total row / column and of each subtotal column. */ total?: string; }` — Text of the total headings, for when the built-in translations do not fit.
package/dist/llms.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.46.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.47.0 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10