wimui 0.44.0 → 0.45.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.
- package/dist/components/data-display/PivotTable/PivotTable.cjs +1 -1
- package/dist/components/data-display/PivotTable/PivotTable.d.ts +58 -1
- package/dist/components/data-display/PivotTable/PivotTable.js +140 -78
- package/dist/components/data-display/PivotTable/layoutPivot.cjs +1 -1
- package/dist/components/data-display/PivotTable/layoutPivot.d.ts +7 -2
- package/dist/components/data-display/PivotTable/layoutPivot.js +13 -12
- package/dist/components/data-display/PivotTable/pivot-table.module.cjs +1 -1
- package/dist/components/data-display/PivotTable/pivot-table.module.js +13 -7
- package/dist/components/media/Video/hooks/useVideoPlayer.cjs +1 -1
- package/dist/components/media/Video/hooks/useVideoPlayer.js +83 -71
- package/dist/llms-full.txt +12 -1
- package/dist/llms.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/chevron-right.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../../hooks/useMergedRef.cjs"),a=require("../Table/Table.cjs"),o=require("./layoutPivot.cjs"),s=require("./pivot-table.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=(e,t=[])=>{for(let n of e)n.children?.length&&(t.push(n.key),d(n.children,t));return t},f=c.default.forwardRef(({rows:e,columns:f,getValue:p,rowAxisLabel:m,caption:h,expandedValues:g,defaultExpandedValues:_,onExpandedChange:v,maxHeight:y,stickyHeader:b=!1,stickyRowHeaders:ee=!1,columnSubtotals:x=!1,totalRow:te=!1,totalColumn:S=!1,labels:C,className:w,...T},ne)=>{let{t:re}=t.useWimTranslation(`components`),E=c.default.useId(),D=C?.total??re(`pivottable.total`),O=(0,c.useMemo)(()=>o.layoutPivotColumns(f,{subtotals:x,total:S}),[f,x,S]),[k,A]=(0,c.useState)(()=>_??d(e)),j=g??k,M=(0,c.useMemo)(()=>new Set(j),[j]),N=(0,c.useCallback)(e=>{let t=M.has(e)?j.filter(t=>t!==e):[...j,e];g===void 0&&A(t),v?.(t)},[j,M,g,v]),P=(0,c.useMemo)(()=>o.layoutPivotRows(e,e=>M.has(e)),[e,M]),F=(0,c.useMemo)(()=>d(e).length>0,[e]),I=m!=null&&m!==!1,L=`${E}corner`,ie=e=>`${E}c${e}`,R=e=>`${E}r${e}`,z=`${E}total`,B=(0,c.useMemo)(()=>O.columns.map(e=>e.headerIds.map(e=>`${E}c${e}`).join(` `)),[O,E]),V=c.default.useRef(null),H=c.default.useRef(null),[U,W]=c.default.useState(!1),[G,K]=c.default.useState(!0);c.default.useLayoutEffect(()=>{let e=V.current,t=H.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=()=>{W(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight);let n=t.rows[0]?.cells[0];K(!n||n.offsetWidth<=e.clientWidth/2)};n();let r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[]);let q=i.useMergedRef(ne,H),J=ee&&G,Y=c.default.useRef([]),[ae,oe]=(0,c.useState)([]),X=O.depth;c.default.useLayoutEffect(()=>{if(!b)return;let e=Y.current.slice(0,X),t=()=>{let t=0,n=e.map(e=>{let n=t;return t+=e?.getBoundingClientRect().height??0,n});oe(e=>e.length===n.length&&e.every((e,t)=>e===n[t])?e:n)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return e.forEach(e=>e&&n.observe(e)),()=>n.disconnect()},[b,X]);let Z=(e,t=!1)=>b?{top:Math.floor(ae[e]??0),zIndex:10+X-e+ +!!t}:void 0,Q=`${E}caption`,$=h?{"aria-labelledby":Q}:T[`aria-label`]?{"aria-label":T[`aria-label`]}:T[`aria-labelledby`]?{"aria-labelledby":T[`aria-labelledby`]}:null;return(0,u.jsx)(`div`,{ref:V,className:s.default.scroller,style:y===void 0?void 0:{maxHeight:y},tabIndex:U?0:void 0,...U&&$?{role:`region`,...$}:null,children:(0,u.jsxs)(`table`,{ref:q,className:(0,l.default)(`wim-pivot-table`,s.default.root,w),...T,children:[h&&(0,u.jsx)(`caption`,{id:Q,className:s.default.caption,children:h}),(0,u.jsx)(`colgroup`,{}),O.groupSpans.map((e,t)=>(0,u.jsx)(`colgroup`,{span:e},t)),(0,u.jsx)(a.Table.Header,{children:O.headerRows.map((e,t)=>(0,u.jsxs)(`tr`,{ref:e=>{Y.current[t]=e},children:[t===0&&(I?(0,u.jsx)(`th`,{id:L,scope:`col`,rowSpan:O.depth,className:(0,l.default)(s.default.columnHeader,s.default.corner,s.default.bottom,b&&s.default.stickyTop,J&&s.default.stickyLeft),style:Z(0,!0),children:m}):(0,u.jsx)(`td`,{rowSpan:O.depth,className:(0,l.default)(s.default.columnHeader,s.default.bottom,b&&s.default.stickyTop,J&&s.default.stickyLeft),style:Z(0,!0)})),e.map((e,n)=>(0,u.jsx)(`th`,{id:ie(e.id),scope:e.kind===`group`&&e.topLevel?`colgroup`:`col`,colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,className:(0,l.default)(s.default.columnHeader,e.kind===`group`&&s.default.group,e.reachesBottom&&s.default.bottom,e.startsGroup&&!(J&&n===0)&&s.default.groupStart,b&&s.default.stickyTop),style:Z(t),children:e.kind===`group`||e.kind===`leaf`?e.node?.label:D},e.id))]},t))}),(0,u.jsx)(a.Table.Body,{children:P.map((e,t)=>{let i=[...e.ancestors.map(R),R(t)].join(` `),o=[...I?[L]:[],...e.ancestors.map(R)].join(` `);return(0,u.jsxs)(a.Table.Row,{className:(0,l.default)(e.hasChildren&&s.default.groupRow),children:[(0,u.jsx)(`th`,{id:R(t),scope:`row`,headers:o||void 0,className:(0,l.default)(s.default.rowHeader,J&&s.default.stickyLeft),style:{"--wim-pivot-table-depth":e.depth},children:e.hasChildren?(0,u.jsxs)(`button`,{type:`button`,className:s.default.toggle,"aria-expanded":e.expanded,onClick:()=>N(e.key),children:[(0,u.jsx)(`span`,{className:(0,l.default)(s.default.chevron,e.expanded&&s.default.open),"aria-hidden":`true`,children:(0,u.jsx)(r.Icon,{component:n.default,size:`sm`})}),e.node.label]}):(0,u.jsx)(`span`,{className:(0,l.default)(F&&s.default.leafLabel),children:e.node.label})}),O.columns.map((t,n)=>(0,u.jsx)(a.Table.Cell,{headers:`${i} ${B[n]}`,className:(0,l.default)(s.default.value,t.kind!==`leaf`&&s.default.aggregate,t.startsGroup&&!(J&&n===0)&&s.default.groupStart),children:p(e.key,t.key)},n))]},e.key)})}),te&&(0,u.jsx)(a.Table.Footer,{children:(0,u.jsxs)(a.Table.Row,{className:s.default.totalRow,children:[(0,u.jsx)(`th`,{id:z,scope:`row`,headers:I?L:void 0,className:(0,l.default)(s.default.rowHeader,J&&s.default.stickyLeft),children:(0,u.jsx)(`span`,{className:(0,l.default)(F&&s.default.leafLabel),children:D})}),O.columns.map((e,t)=>(0,u.jsx)(a.Table.Cell,{headers:`${z} ${B[t]}`,className:(0,l.default)(s.default.value,e.startsGroup&&!(J&&t===0)&&s.default.groupStart),children:p(null,e.key)},t))]})})]})})});f.displayName=`PivotTable`,exports.PivotTable=f;
|
|
@@ -2,7 +2,10 @@ import { default as React } from 'react';
|
|
|
2
2
|
export type PivotTableAxisNode = {
|
|
3
3
|
/** Unique within its axis. Passed back to `getValue`. */
|
|
4
4
|
key: string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Heading shown for this row or column. On the row axis the label of a group is drawn
|
|
7
|
+
* inside its expand / collapse button, so it must not contain links or other controls.
|
|
8
|
+
*/
|
|
6
9
|
label: React.ReactNode;
|
|
7
10
|
/** Nested headings. A node with children is a group; its own value is the subtotal. */
|
|
8
11
|
children?: PivotTableAxisNode[];
|
|
@@ -26,6 +29,31 @@ export type PivotTableProps = Omit<React.ComponentPropsWithoutRef<"table">, "chi
|
|
|
26
29
|
rowAxisLabel?: React.ReactNode;
|
|
27
30
|
/** Visible title of the table, also its accessible name. */
|
|
28
31
|
caption?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Keys of the expanded row groups (controlled). A group that is not listed shows only
|
|
34
|
+
* its own row, which carries its subtotal.
|
|
35
|
+
*/
|
|
36
|
+
expandedValues?: string[];
|
|
37
|
+
/** Row groups expanded on first render (uncontrolled). Defaults to every group. */
|
|
38
|
+
defaultExpandedValues?: string[];
|
|
39
|
+
/** Called with the new list of expanded row groups when a group is expanded or collapsed. */
|
|
40
|
+
onExpandedChange?: (values: string[]) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum height of the table (a number is px). Past it the table scrolls vertically
|
|
43
|
+
* inside its own box.
|
|
44
|
+
*/
|
|
45
|
+
maxHeight?: string | number;
|
|
46
|
+
/**
|
|
47
|
+
* Keeps the column headings in view while the table scrolls vertically. Every heading
|
|
48
|
+
* level stays, stacked in order. Only has an effect together with `maxHeight`.
|
|
49
|
+
*/
|
|
50
|
+
stickyHeader?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Keeps the row headings in view while the table scrolls sideways. The column is only
|
|
53
|
+
* pinned while it takes at most half of the visible width; in a narrower container it
|
|
54
|
+
* scrolls with the rest, so that the values stay readable.
|
|
55
|
+
*/
|
|
56
|
+
stickyRowHeaders?: boolean;
|
|
29
57
|
/** Adds a subtotal column after the columns of each column group. */
|
|
30
58
|
columnSubtotals?: boolean;
|
|
31
59
|
/** Adds a grand total row at the bottom. */
|
|
@@ -40,6 +68,10 @@ export type PivotTableProps = Omit<React.ComponentPropsWithoutRef<"table">, "chi
|
|
|
40
68
|
* headings, subtotals and grand totals. It only draws: grouping and summing stay with the
|
|
41
69
|
* caller, who answers `getValue(rowKey, columnKey)` for every cell.
|
|
42
70
|
*
|
|
71
|
+
* Row groups can be collapsed to their subtotal row with the button in their heading
|
|
72
|
+
* (Enter or Space). The button is named by the group label, so the heading still reads as
|
|
73
|
+
* the plain label when a cell announces it.
|
|
74
|
+
*
|
|
43
75
|
* Every cell lists the headings it belongs to in its `headers` attribute, so a screen
|
|
44
76
|
* reader announces the full row path and column path of a value.
|
|
45
77
|
*
|
|
@@ -65,6 +97,31 @@ export declare const PivotTable: React.ForwardRefExoticComponent<Omit<Omit<React
|
|
|
65
97
|
rowAxisLabel?: React.ReactNode;
|
|
66
98
|
/** Visible title of the table, also its accessible name. */
|
|
67
99
|
caption?: React.ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Keys of the expanded row groups (controlled). A group that is not listed shows only
|
|
102
|
+
* its own row, which carries its subtotal.
|
|
103
|
+
*/
|
|
104
|
+
expandedValues?: string[];
|
|
105
|
+
/** Row groups expanded on first render (uncontrolled). Defaults to every group. */
|
|
106
|
+
defaultExpandedValues?: string[];
|
|
107
|
+
/** Called with the new list of expanded row groups when a group is expanded or collapsed. */
|
|
108
|
+
onExpandedChange?: (values: string[]) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Maximum height of the table (a number is px). Past it the table scrolls vertically
|
|
111
|
+
* inside its own box.
|
|
112
|
+
*/
|
|
113
|
+
maxHeight?: string | number;
|
|
114
|
+
/**
|
|
115
|
+
* Keeps the column headings in view while the table scrolls vertically. Every heading
|
|
116
|
+
* level stays, stacked in order. Only has an effect together with `maxHeight`.
|
|
117
|
+
*/
|
|
118
|
+
stickyHeader?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Keeps the row headings in view while the table scrolls sideways. The column is only
|
|
121
|
+
* pinned while it takes at most half of the visible width; in a narrower container it
|
|
122
|
+
* scrolls with the rest, so that the values stay readable.
|
|
123
|
+
*/
|
|
124
|
+
stickyRowHeaders?: boolean;
|
|
68
125
|
/** Adds a subtotal column after the columns of each column group. */
|
|
69
126
|
columnSubtotals?: boolean;
|
|
70
127
|
/** Adds a grand total row at the bottom. */
|
|
@@ -1,104 +1,166 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
3
|
+
import t from "../../../icon/chevron-right.js";
|
|
4
|
+
import { Icon as n } from "../../media/Icon/Icon.js";
|
|
5
|
+
import { useMergedRef as r } from "../../../hooks/useMergedRef.js";
|
|
6
|
+
import { Table as i } from "../Table/Table.js";
|
|
7
|
+
import { layoutPivotColumns as a, layoutPivotRows as o } from "./layoutPivot.js";
|
|
8
|
+
import s from "./pivot-table.module.js";
|
|
9
|
+
import c, { useCallback as ee, useMemo as l, useState as u } from "react";
|
|
10
|
+
import d from "classnames";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
12
|
//#region src/components/data-display/PivotTable/PivotTable.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var m = (e, t = []) => {
|
|
14
|
+
for (let n of e) n.children?.length && (t.push(n.key), m(n.children, t));
|
|
15
|
+
return t;
|
|
16
|
+
}, h = c.forwardRef(({ rows: h, columns: g, getValue: _, rowAxisLabel: v, caption: y, expandedValues: b, defaultExpandedValues: x, onExpandedChange: S, maxHeight: C, stickyHeader: w = !1, stickyRowHeaders: te = !1, columnSubtotals: T = !1, totalRow: ne = !1, totalColumn: E = !1, labels: D, className: re, ...O }, ie) => {
|
|
17
|
+
let { t: k } = e("components"), A = c.useId(), j = D?.total ?? k("pivottable.total"), M = l(() => a(g, {
|
|
18
|
+
subtotals: T,
|
|
19
|
+
total: E
|
|
15
20
|
}), [
|
|
16
|
-
f,
|
|
17
21
|
g,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
+
T,
|
|
23
|
+
E
|
|
24
|
+
]), [N, P] = u(() => x ?? m(h)), F = b ?? N, I = l(() => new Set(F), [F]), L = ee((e) => {
|
|
25
|
+
let t = I.has(e) ? F.filter((t) => t !== e) : [...F, e];
|
|
26
|
+
b === void 0 && P(t), S?.(t);
|
|
27
|
+
}, [
|
|
28
|
+
F,
|
|
29
|
+
I,
|
|
30
|
+
b,
|
|
31
|
+
S
|
|
32
|
+
]), R = l(() => o(h, (e) => I.has(e)), [h, I]), z = l(() => m(h).length > 0, [h]), B = v != null && v !== !1, V = `${A}corner`, ae = (e) => `${A}c${e}`, H = (e) => `${A}r${e}`, U = `${A}total`, W = l(() => M.columns.map((e) => e.headerIds.map((e) => `${A}c${e}`).join(" ")), [M, A]), G = c.useRef(null), K = c.useRef(null), [q, oe] = c.useState(!1), [se, ce] = c.useState(!0);
|
|
33
|
+
c.useLayoutEffect(() => {
|
|
34
|
+
let e = G.current, t = K.current;
|
|
22
35
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
23
|
-
let n = () =>
|
|
36
|
+
let n = () => {
|
|
37
|
+
oe(e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight);
|
|
38
|
+
let n = t.rows[0]?.cells[0];
|
|
39
|
+
ce(!n || n.offsetWidth <= e.clientWidth / 2);
|
|
40
|
+
};
|
|
24
41
|
n();
|
|
25
42
|
let r = new ResizeObserver(n);
|
|
26
43
|
return r.observe(e), r.observe(t), () => r.disconnect();
|
|
27
44
|
}, []);
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
let le = r(ie, K), J = te && se, Y = c.useRef([]), [ue, de] = u([]), X = M.depth;
|
|
46
|
+
c.useLayoutEffect(() => {
|
|
47
|
+
if (!w) return;
|
|
48
|
+
let e = Y.current.slice(0, X), t = () => {
|
|
49
|
+
let t = 0, n = e.map((e) => {
|
|
50
|
+
let n = t;
|
|
51
|
+
return t += e?.getBoundingClientRect().height ?? 0, n;
|
|
52
|
+
});
|
|
53
|
+
de((e) => e.length === n.length && e.every((e, t) => e === n[t]) ? e : n);
|
|
54
|
+
};
|
|
55
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
56
|
+
let n = new ResizeObserver(t);
|
|
57
|
+
return e.forEach((e) => e && n.observe(e)), () => n.disconnect();
|
|
58
|
+
}, [w, X]);
|
|
59
|
+
let Z = (e, t = !1) => w ? {
|
|
60
|
+
top: Math.floor(ue[e] ?? 0),
|
|
61
|
+
zIndex: 10 + X - e + +!!t
|
|
62
|
+
} : void 0, Q = `${A}caption`, $ = y ? { "aria-labelledby": Q } : O["aria-label"] ? { "aria-label": O["aria-label"] } : O["aria-labelledby"] ? { "aria-labelledby": O["aria-labelledby"] } : null;
|
|
63
|
+
return /* @__PURE__ */ f("div", {
|
|
64
|
+
ref: G,
|
|
65
|
+
className: s.scroller,
|
|
66
|
+
style: C === void 0 ? void 0 : { maxHeight: C },
|
|
67
|
+
tabIndex: q ? 0 : void 0,
|
|
68
|
+
...q && $ ? {
|
|
34
69
|
role: "region",
|
|
35
|
-
|
|
70
|
+
...$
|
|
36
71
|
} : null,
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
40
|
-
...
|
|
72
|
+
children: /* @__PURE__ */ p("table", {
|
|
73
|
+
ref: le,
|
|
74
|
+
className: d("wim-pivot-table", s.root, re),
|
|
75
|
+
...O,
|
|
41
76
|
children: [
|
|
42
|
-
|
|
43
|
-
id:
|
|
44
|
-
className:
|
|
45
|
-
children:
|
|
77
|
+
y && /* @__PURE__ */ f("caption", {
|
|
78
|
+
id: Q,
|
|
79
|
+
className: s.caption,
|
|
80
|
+
children: y
|
|
46
81
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className:
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
/* @__PURE__ */ f("colgroup", {}),
|
|
83
|
+
M.groupSpans.map((e, t) => /* @__PURE__ */ f("colgroup", { span: e }, t)),
|
|
84
|
+
/* @__PURE__ */ f(i.Header, { children: M.headerRows.map((e, t) => /* @__PURE__ */ p("tr", {
|
|
85
|
+
ref: (e) => {
|
|
86
|
+
Y.current[t] = e;
|
|
87
|
+
},
|
|
88
|
+
children: [t === 0 && (B ? /* @__PURE__ */ f("th", {
|
|
89
|
+
id: V,
|
|
90
|
+
scope: "col",
|
|
91
|
+
rowSpan: M.depth,
|
|
92
|
+
className: d(s.columnHeader, s.corner, s.bottom, w && s.stickyTop, J && s.stickyLeft),
|
|
93
|
+
style: Z(0, !0),
|
|
94
|
+
children: v
|
|
95
|
+
}) : /* @__PURE__ */ f("td", {
|
|
96
|
+
rowSpan: M.depth,
|
|
97
|
+
className: d(s.columnHeader, s.bottom, w && s.stickyTop, J && s.stickyLeft),
|
|
98
|
+
style: Z(0, !0)
|
|
99
|
+
})), e.map((e, n) => /* @__PURE__ */ f("th", {
|
|
100
|
+
id: ae(e.id),
|
|
101
|
+
scope: e.kind === "group" && e.topLevel ? "colgroup" : "col",
|
|
102
|
+
colSpan: e.colSpan > 1 ? e.colSpan : void 0,
|
|
103
|
+
rowSpan: e.rowSpan > 1 ? e.rowSpan : void 0,
|
|
104
|
+
className: d(s.columnHeader, e.kind === "group" && s.group, e.reachesBottom && s.bottom, e.startsGroup && !(J && n === 0) && s.groupStart, w && s.stickyTop),
|
|
105
|
+
style: Z(t),
|
|
106
|
+
children: e.kind === "group" || e.kind === "leaf" ? e.node?.label : j
|
|
107
|
+
}, e.id))]
|
|
108
|
+
}, t)) }),
|
|
109
|
+
/* @__PURE__ */ f(i.Body, { children: R.map((e, r) => {
|
|
110
|
+
let a = [...e.ancestors.map(H), H(r)].join(" "), o = [...B ? [V] : [], ...e.ancestors.map(H)].join(" ");
|
|
111
|
+
return /* @__PURE__ */ p(i.Row, {
|
|
112
|
+
className: d(e.hasChildren && s.groupRow),
|
|
113
|
+
children: [/* @__PURE__ */ f("th", {
|
|
114
|
+
id: H(r),
|
|
72
115
|
scope: "row",
|
|
73
|
-
headers:
|
|
74
|
-
className:
|
|
116
|
+
headers: o || void 0,
|
|
117
|
+
className: d(s.rowHeader, J && s.stickyLeft),
|
|
75
118
|
style: { "--wim-pivot-table-depth": e.depth },
|
|
76
|
-
children: e.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
119
|
+
children: e.hasChildren ? /* @__PURE__ */ p("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
className: s.toggle,
|
|
122
|
+
"aria-expanded": e.expanded,
|
|
123
|
+
onClick: () => L(e.key),
|
|
124
|
+
children: [/* @__PURE__ */ f("span", {
|
|
125
|
+
className: d(s.chevron, e.expanded && s.open),
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
children: /* @__PURE__ */ f(n, {
|
|
128
|
+
component: t,
|
|
129
|
+
size: "sm"
|
|
130
|
+
})
|
|
131
|
+
}), e.node.label]
|
|
132
|
+
}) : /* @__PURE__ */ f("span", {
|
|
133
|
+
className: d(z && s.leafLabel),
|
|
134
|
+
children: e.node.label
|
|
135
|
+
})
|
|
136
|
+
}), M.columns.map((t, n) => /* @__PURE__ */ f(i.Cell, {
|
|
137
|
+
headers: `${a} ${W[n]}`,
|
|
138
|
+
className: d(s.value, t.kind !== "leaf" && s.aggregate, t.startsGroup && !(J && n === 0) && s.groupStart),
|
|
139
|
+
children: _(e.key, t.key)
|
|
140
|
+
}, n))]
|
|
82
141
|
}, e.key);
|
|
83
142
|
}) }),
|
|
84
|
-
|
|
85
|
-
className:
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
-
id:
|
|
143
|
+
ne && /* @__PURE__ */ f(i.Footer, { children: /* @__PURE__ */ p(i.Row, {
|
|
144
|
+
className: s.totalRow,
|
|
145
|
+
children: [/* @__PURE__ */ f("th", {
|
|
146
|
+
id: U,
|
|
88
147
|
scope: "row",
|
|
89
|
-
headers:
|
|
90
|
-
className:
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
148
|
+
headers: B ? V : void 0,
|
|
149
|
+
className: d(s.rowHeader, J && s.stickyLeft),
|
|
150
|
+
children: /* @__PURE__ */ f("span", {
|
|
151
|
+
className: d(z && s.leafLabel),
|
|
152
|
+
children: j
|
|
153
|
+
})
|
|
154
|
+
}), M.columns.map((e, t) => /* @__PURE__ */ f(i.Cell, {
|
|
155
|
+
headers: `${U} ${W[t]}`,
|
|
156
|
+
className: d(s.value, e.startsGroup && !(J && t === 0) && s.groupStart),
|
|
157
|
+
children: _(null, e.key)
|
|
96
158
|
}, t))]
|
|
97
159
|
}) })
|
|
98
160
|
]
|
|
99
161
|
})
|
|
100
162
|
});
|
|
101
163
|
});
|
|
102
|
-
|
|
164
|
+
h.displayName = "PivotTable";
|
|
103
165
|
//#endregion
|
|
104
|
-
export {
|
|
166
|
+
export { h as PivotTable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=e=>!!e.children?.length,t=n=>n.reduce((n,r)=>Math.max(n,1+(e(r)?t(r.children):0)),0);function n(n,r={}){let i=Math.max(1,t(n)),a=Array.from({length:i},()=>[]),o=[],s=[],c=0,l=(e,t,n,r,s,l)=>{let u=c++,d=e?.key??null;a[n].push({id:u,key:d,node:e,kind:t,colSpan:1,rowSpan:i-n,reachesBottom:!0,startsGroup:l,topLevel:s}),o.push({key:d,kind:t,headerIds:[...r,u],startsGroup:l})},u=(t,n,i,o)=>{let s=n===0;if(!e(t))return l(t,`leaf`,n,i,s,o),1;let d={id:c++,key:t.key,node:t,kind:`group`,colSpan:0,rowSpan:1,reachesBottom:!1,startsGroup:o,topLevel:s};a[n].push(d);let f=[...i,d.id],p=0;return t.children.forEach((e,t)=>{p+=u(e,n+1,f,o&&t===0)}),r.subtotals&&(l(t,`subtotal`,n+1,f,!1,!1),p+=1),d.colSpan=p,p};for(let e of n)s.push(u(e,0,[],!0));return r.total&&(l(null,`total`,0,[],!0,!0),s.push(1)),{headerRows:a,columns:o,depth:i,groupSpans:s}}function r(t){let
|
|
2
|
+
var e=e=>!!e.children?.length,t=n=>n.reduce((n,r)=>Math.max(n,1+(e(r)?t(r.children):0)),0);function n(n,r={}){let i=Math.max(1,t(n)),a=Array.from({length:i},()=>[]),o=[],s=[],c=0,l=(e,t,n,r,s,l)=>{let u=c++,d=e?.key??null;a[n].push({id:u,key:d,node:e,kind:t,colSpan:1,rowSpan:i-n,reachesBottom:!0,startsGroup:l,topLevel:s}),o.push({key:d,kind:t,headerIds:[...r,u],startsGroup:l})},u=(t,n,i,o)=>{let s=n===0;if(!e(t))return l(t,`leaf`,n,i,s,o),1;let d={id:c++,key:t.key,node:t,kind:`group`,colSpan:0,rowSpan:1,reachesBottom:!1,startsGroup:o,topLevel:s};a[n].push(d);let f=[...i,d.id],p=0;return t.children.forEach((e,t)=>{p+=u(e,n+1,f,o&&t===0)}),r.subtotals&&(l(t,`subtotal`,n+1,f,!1,!1),p+=1),d.colSpan=p,p};for(let e of n)s.push(u(e,0,[],!0));return r.total&&(l(null,`total`,0,[],!0,!0),s.push(1)),{headerRows:a,columns:o,depth:i,groupSpans:s}}function r(t,n=()=>!0){let r=[],i=(t,a,o)=>{for(let s of t){let t=r.length,c=e(s),l=c&&n(s.key);r.push({key:s.key,node:s,depth:a,hasChildren:c,expanded:l,ancestors:o}),l&&i(s.children,a+1,[...o,t])}};return i(t,0,[]),r}exports.layoutPivotColumns=n,exports.layoutPivotRows=r;
|
|
@@ -44,6 +44,8 @@ export type PivotRow<T extends PivotAxisInput = PivotAxisInput> = {
|
|
|
44
44
|
node: T;
|
|
45
45
|
depth: number;
|
|
46
46
|
hasChildren: boolean;
|
|
47
|
+
/** 子の行が出ているか(グループでない行は常に `false`)。 */
|
|
48
|
+
expanded: boolean;
|
|
47
49
|
/** 祖先の行の番号(返り値の配列の中の位置。根から順)。 */
|
|
48
50
|
ancestors: number[];
|
|
49
51
|
};
|
|
@@ -58,5 +60,8 @@ export declare function layoutPivotColumns<T extends PivotAxisInput>(nodes: T[],
|
|
|
58
60
|
subtotals?: boolean;
|
|
59
61
|
total?: boolean;
|
|
60
62
|
}): PivotColumnLayout<T>;
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
+
/**
|
|
64
|
+
* 行の軸の木を、深さ優先で 1 行ずつに並べる(アウトライン形式: グループも 1 行を持つ)。
|
|
65
|
+
* 折りたたまれたグループは自分の行だけを出し、配下の行は出さない。
|
|
66
|
+
*/
|
|
67
|
+
export declare function layoutPivotRows<T extends PivotAxisInput>(nodes: T[], isExpanded?: (key: string) => boolean): PivotRow<T>[];
|
|
@@ -48,20 +48,21 @@ function n(n, r = {}) {
|
|
|
48
48
|
groupSpans: s
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function r(t) {
|
|
52
|
-
let
|
|
53
|
-
for (let
|
|
54
|
-
let t =
|
|
55
|
-
|
|
56
|
-
key:
|
|
57
|
-
node:
|
|
58
|
-
depth:
|
|
59
|
-
hasChildren:
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
function r(t, n = () => !0) {
|
|
52
|
+
let r = [], i = (t, a, o) => {
|
|
53
|
+
for (let s of t) {
|
|
54
|
+
let t = r.length, c = e(s), l = c && n(s.key);
|
|
55
|
+
r.push({
|
|
56
|
+
key: s.key,
|
|
57
|
+
node: s,
|
|
58
|
+
depth: a,
|
|
59
|
+
hasChildren: c,
|
|
60
|
+
expanded: l,
|
|
61
|
+
ancestors: o
|
|
62
|
+
}), l && i(s.children, a + 1, [...o, t]);
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
|
-
return
|
|
65
|
+
return i(t, 0, []), r;
|
|
65
66
|
}
|
|
66
67
|
//#endregion
|
|
67
68
|
export { n as layoutPivotColumns, r as layoutPivotRows };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_scroller_1xfhj_7`,t=`_root_1xfhj_22`,n=`_caption_1xfhj_34`,r=`_columnHeader_1xfhj_41`,i=`_group_1xfhj_55`,a=`_bottom_1xfhj_62`,o=`_corner_1xfhj_65`,s=`_rowHeader_1xfhj_68`,c=`_toggle_1xfhj_81`,l=`_chevron_1xfhj_100`,u=`_open_1xfhj_116`,d=`_leafLabel_1xfhj_120`,f=`_value_1xfhj_127`,p=`_groupRow_1xfhj_133`,m=`_aggregate_1xfhj_138`,h=`_groupStart_1xfhj_142`,g=`_totalRow_1xfhj_145`,_=`_stickyTop_1xfhj_154`,v=`_stickyLeft_1xfhj_159`,y={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,stickyTop:_,stickyLeft:v};exports.aggregate=m,exports.bottom=a,exports.caption=n,exports.chevron=l,exports.columnHeader=r,exports.corner=o,exports.default=y,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=v,exports.stickyTop=_,exports.toggle=c,exports.totalRow=g,exports.value=f;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/PivotTable/pivot-table.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_scroller_1xfhj_7", t = "_root_1xfhj_22", n = "_caption_1xfhj_34", r = "_columnHeader_1xfhj_41", i = "_group_1xfhj_55", a = "_bottom_1xfhj_62", o = "_corner_1xfhj_65", s = "_rowHeader_1xfhj_68", c = "_toggle_1xfhj_81", l = "_chevron_1xfhj_100", u = "_open_1xfhj_116", d = "_leafLabel_1xfhj_120", f = "_value_1xfhj_127", p = "_groupRow_1xfhj_133", m = "_aggregate_1xfhj_138", h = "_groupStart_1xfhj_142", g = "_totalRow_1xfhj_145", _ = "_stickyTop_1xfhj_154", v = "_stickyLeft_1xfhj_159", y = {
|
|
4
4
|
scroller: e,
|
|
5
5
|
root: t,
|
|
6
6
|
caption: n,
|
|
@@ -9,11 +9,17 @@ var e = "_scroller_x2q1s_7", t = "_root_x2q1s_20", n = "_caption_x2q1s_27", r =
|
|
|
9
9
|
bottom: a,
|
|
10
10
|
corner: o,
|
|
11
11
|
rowHeader: s,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
toggle: c,
|
|
13
|
+
chevron: l,
|
|
14
|
+
open: u,
|
|
15
|
+
leafLabel: d,
|
|
16
|
+
value: f,
|
|
17
|
+
groupRow: p,
|
|
18
|
+
aggregate: m,
|
|
19
|
+
groupStart: h,
|
|
20
|
+
totalRow: g,
|
|
21
|
+
stickyTop: _,
|
|
22
|
+
stickyLeft: v
|
|
17
23
|
};
|
|
18
24
|
//#endregion
|
|
19
|
-
export {
|
|
25
|
+
export { m as aggregate, a as bottom, n as caption, l as chevron, r as columnHeader, o as corner, y as default, i as group, p as groupRow, h as groupStart, d as leafLabel, u as open, t as root, s as rowHeader, e as scroller, v as stickyLeft, _ as stickyTop, c as toggle, g as totalRow, f as value };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n({src:e,autoPlay:n,loop:r,muted:i,fit:a,videoId:o,resumePlayback:s,playlist:c,autoPlayNext:l,qualities:u,customControls:d,advancedControls:f,poster:p,containerRef:m}){let h=t.default.useRef(null),g=t.default.useRef(null),_=m??g,
|
|
2
|
+
const e=require("../../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n({src:e,autoPlay:n,loop:r,muted:i,fit:a,videoId:o,resumePlayback:s,playlist:c,autoPlayNext:l,qualities:u,customControls:d,advancedControls:f,poster:p,containerRef:m}){let h=t.default.useRef(null),g=t.default.useRef(null),_=m??g,v=t.default.useRef(new Set),y=(0,t.useCallback)((e,t)=>{let n=setTimeout(()=>{v.current.delete(n),e()},t);v.current.add(n)},[]);(0,t.useEffect)(()=>{let e=v.current;return()=>{e.forEach(clearTimeout),e.clear()}},[]);let[b,x]=(0,t.useState)(!1),[S,C]=(0,t.useState)(0),[w,T]=(0,t.useState)(0),[E,D]=(0,t.useState)(1),[O,k]=(0,t.useState)(i),[A,j]=(0,t.useState)(!1),[M,N]=(0,t.useState)(1),[P,F]=(0,t.useState)(a),[I,L]=(0,t.useState)(0),[R,z]=(0,t.useState)(0),[B,V]=(0,t.useState)(null),[H,U]=(0,t.useState)(null),[W,G]=(0,t.useState)({show:!1,direction:`forward`}),K=u&&u.length>0?u[R].src:c&&c.length>0?c[I].src:e,q=c&&c.length>0&&c[I].poster||p,J=!(d||f);(0,t.useEffect)(()=>{if(o&&s&&h.current){let e=c&&c.length>0?`${o}-${I}`:o,t=localStorage.getItem(`wimui-video-resume-${e}`);t&&(h.current.currentTime=parseFloat(t))}},[o,s,I,c]),(0,t.useEffect)(()=>{n&&h.current&&h.current.play().catch(e=>{})},[n,K]),(0,t.useEffect)(()=>{h.current&&(h.current.volume=E,h.current.muted=O,h.current.playbackRate=M,h.current.loop=r&&(!c||c.length<=1))},[E,O,M,r,c]),(0,t.useEffect)(()=>{let e=()=>{j(!!document.fullscreenElement)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let Y=(0,t.useCallback)(e=>{if(h.current){let t=Math.max(0,Math.min(h.current.currentTime+e,w));h.current.currentTime=t,C(t)}},[w]),X=(0,t.useCallback)(()=>{h.current&&(b?h.current.pause():h.current.play(),x(!b))},[b]),Z=(0,t.useCallback)(()=>{k(!O)},[O]),Q=(0,t.useCallback)(()=>{_.current&&(document.fullscreenElement?(document.exitFullscreen(),j(!1)):(_.current.requestFullscreen().catch(e=>{}),j(!0)))},[_]),$=(0,t.useCallback)(async()=>{if(h.current)try{document.pictureInPictureElement?await document.exitPictureInPicture():document.pictureInPictureEnabled&&await h.current.requestPictureInPicture()}catch{}},[]),ee=e=>{if(!h.current)return;let t=h.current.currentTime,n=!h.current.paused;z(e),y(()=>{h.current&&(h.current.currentTime=t,n&&h.current.play())},50),V(`main`)},te=(0,t.useCallback)(e=>{L(e),h.current&&(h.current.currentTime=0,y(()=>h.current?.play(),100))},[y]);return(0,t.useEffect)(()=>{let e=e=>{if(![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&(d||f)&&(_.current?.contains(document.activeElement)||document.fullscreenElement===_.current||document.activeElement===document.body))switch(e.key.toLowerCase()){case` `:case`k`:e.preventDefault(),X();break;case`arrowright`:e.preventDefault(),Y(10);break;case`arrowleft`:e.preventDefault(),Y(-10);break;case`arrowup`:{e.preventDefault();let t=Math.min(1,E+.1);D(t),t>0&&k(!1);break}case`arrowdown`:{e.preventDefault();let t=Math.max(0,E-.1);D(t);break}case`m`:e.preventDefault(),Z();break;case`f`:e.preventDefault(),Q();break;case`p`:e.preventDefault(),$()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,E,w,d,f,Y,Z,X,Q,$,_]),{videoRef:h,containerRef:_,isPlaying:b,currentTime:S,duration:w,volume:E,isMuted:O,isFullscreen:A,playbackRate:M,activeFit:P,currentPlayIndex:I,currentQualityIndex:R,activeMenu:B,skipIndicator:W,activeSrc:K,activePoster:q,showNativeControls:J,setVolume:D,setIsMuted:k,setPlaybackRate:N,setActiveFit:F,setCurrentPlayIndex:L,setActiveMenu:V,togglePlay:X,toggleMute:Z,toggleFullscreen:Q,togglePiP:$,skip:Y,handleQualityChange:ee,playPlaylistItem:te,handleTimeUpdate:()=>{if(h.current){let e=h.current.currentTime;if(C(e),o&&s&&Math.floor(e)%5==0&&w>0&&e<w-2){let t=c&&c.length>0?`${o}-${I}`:o;localStorage.setItem(`wimui-video-resume-${t}`,e.toString())}}},handleLoadedMetadata:()=>{h.current&&T(h.current.duration)},handleEnded:()=>{if(o&&s){let e=c&&c.length>0?`${o}-${I}`:o;localStorage.removeItem(`wimui-video-resume-${e}`)}c&&c.length>0&&l&&I<c.length-1?(L(e=>e+1),h.current&&y(()=>{h.current?.play()},100)):x(!1)},handleSeek:e=>{let t=parseFloat(e.target.value);h.current&&(h.current.currentTime=t,C(t))},handleVolumeChange:e=>{let t=parseFloat(e.target.value);D(t),t>0&&k(!1)},handleVideoClick:e=>{if(!d&&!f)return;let t=new Date().getTime(),n=e.currentTarget.getBoundingClientRect(),r=e.clientX-n.left,i=n.width;H&&t-H.time<300?(r>i/2?(Y(10),G({show:!0,direction:`forward`})):(Y(-10),G({show:!0,direction:`backward`})),y(()=>G({show:!1,direction:`forward`}),600),U(null)):(U({time:t,x:r}),y(()=>{Date.now()-t>=290&&X()},300))},formatTime:e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}}exports.useVideoPlayer=n;
|