wimui 0.44.0 → 0.46.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 +70 -1
- package/dist/components/data-display/PivotTable/PivotTable.js +238 -83
- package/dist/components/data-display/PivotTable/layoutPivot.cjs +1 -1
- package/dist/components/data-display/PivotTable/layoutPivot.d.ts +36 -2
- package/dist/components/data-display/PivotTable/layoutPivot.js +42 -13
- package/dist/components/data-display/PivotTable/pivot-table.module.cjs +1 -1
- package/dist/components/data-display/PivotTable/pivot-table.module.js +14 -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 +15 -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 +2 -2
|
@@ -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("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../../../icon/chevron-right.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../Table/Table.cjs"),s=require("./layoutPivot.cjs"),c=require("./pivot-table.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=40,ee=8,te=30,p=(e,t=[])=>{for(let n of e)n.children?.length&&(t.push(n.key),p(n.children,t));return t},m=l.default.forwardRef(({rows:e,columns:m,getValue:h,rowAxisLabel:g,caption:_,expandedValues:v,defaultExpandedValues:ne,onExpandedChange:re,maxHeight:ie,stickyHeader:y=!1,stickyRowHeaders:ae=!1,virtualized:b=!1,columnSubtotals:x=!1,totalRow:S=!1,totalColumn:C=!1,labels:oe,className:se,...w},ce)=>{let{t:le}=t.useWimTranslation(`components`),T=l.default.useId(),E=oe?.total??le(`pivottable.total`),D=(0,l.useMemo)(()=>s.layoutPivotColumns(m,{subtotals:x,total:C}),[m,x,C]),[ue,de]=(0,l.useState)(()=>ne??p(e)),O=v??ue,k=(0,l.useMemo)(()=>new Set(O),[O]),fe=(0,l.useCallback)(e=>{let t=k.has(e)?O.filter(t=>t!==e):[...O,e];v===void 0&&de(t),re?.(t)},[O,k,v,re]),A=(0,l.useMemo)(()=>s.layoutPivotRows(e,e=>k.has(e)),[e,k]),j=(0,l.useMemo)(()=>p(e).length>0,[e]),M=g!=null&&g!==!1,N=`${T}corner`,pe=e=>`${T}c${e}`,P=e=>`${T}r${e}`,F=`${T}total`,I=(0,l.useMemo)(()=>D.columns.map(e=>e.headerIds.map(e=>`${T}c${e}`).join(` `)),[D,T]),L=l.default.useRef(null),R=l.default.useRef(null),[z,me]=l.default.useState(!1),[he,ge]=l.default.useState(!0);l.default.useLayoutEffect(()=>{let e=L.current,t=R.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=()=>{me(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight);let n=t.rows[0]?.cells[0];ge(!n||n.offsetWidth<=e.clientWidth/2)};n();let r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[]);let _e=a.useMergedRef(ce,R),B=ae&&he,V=l.default.useRef([]),[ve,ye]=(0,l.useState)([]),H=D.depth;l.default.useLayoutEffect(()=>{if(!y)return;let e=V.current.slice(0,H),t=()=>{let t=0,n=e.map(e=>{let n=t;return t+=e?.getBoundingClientRect().height??0,n});ye(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()},[y,H]);let U=l.default.useRef(null),[W,be]=(0,l.useState)(0),[G,xe]=(0,l.useState)(null),[K,q]=(0,l.useState)(null),[J,Se]=(0,l.useState)([]),Ce=l.default.useRef(0),Y=(0,l.useCallback)(()=>{let e=L.current,t=U.current,n=R.current;if(!e||!t||!n)return;let r=t.querySelector(`tr[data-row-index]`)?.getBoundingClientRect().height??0;r>0&&be(e=>Math.abs(e-r)<.01?e:r);let i={scrollTop:e.scrollTop,height:e.clientHeight,bodyOffset:t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop};xe(e=>e&&e.scrollTop===i.scrollTop&&e.height===i.height&&e.bodyOffset===i.bodyOffset?e:i);let a=Array.from(n.querySelectorAll(`thead [data-column-index]`)).reduce((e,t)=>(e[Number(t.dataset.columnIndex)]=t.getBoundingClientRect().width,e),[]),o=Ce.current!==e.clientWidth;Ce.current=e.clientWidth,Se(e=>{let t=o?[]:e,n=a.map((e,n)=>(e||0)>(t[n]??0)+.01?e:t[n]??0);return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n})},[]),X=A.length,we=D.columns.length;l.default.useLayoutEffect(()=>{if(!b||(Y(),typeof ResizeObserver>`u`))return;let e=new ResizeObserver(Y);return L.current&&e.observe(L.current),()=>e.disconnect()},[b,Y,X,we]);let Te=(0,l.useMemo)(()=>new Map(A.map((e,t)=>[e.key,t])),[A]),Ee=(0,l.useMemo)(()=>b?G?s.pivotRowWindow({rowCount:X,rowHeight:W||f,scrollTop:G.scrollTop,viewportHeight:G.height,bodyOffset:G.bodyOffset,overscan:ee,keep:K===null?null:Te.get(K)??null}):s.pivotRowWindow({rowCount:X,rowHeight:f,scrollTop:0,viewportHeight:Math.min(X,te)*f,bodyOffset:0,overscan:0}):null,[b,G,X,W,K,Te]),De=(0,l.useMemo)(()=>new Map(D.columns.map((e,t)=>[e.headerIds[e.headerIds.length-1],t])),[D]),Z=e=>b&&e!==void 0?{"data-column-index":e,style:J[e]?{minWidth:J[e]}:void 0}:null,Q=(e,t=!1)=>y?{top:Math.floor(ve[e]??0),zIndex:10+H-e+ +!!t}:void 0,Oe=`${T}caption`,$=_?{"aria-labelledby":Oe}:w[`aria-label`]?{"aria-label":w[`aria-label`]}:w[`aria-labelledby`]?{"aria-labelledby":w[`aria-labelledby`]}:null,ke=(e,t)=>{let a=b?P(t):[...e.ancestors.map(P),P(t)].join(` `),s=[...M?[N]:[],...b?[]:e.ancestors.map(P)].join(` `);return(0,d.jsxs)(o.Table.Row,{className:(0,u.default)(e.hasChildren&&c.default.groupRow),"data-row-index":b?t:void 0,"data-row-key":b?e.key:void 0,"aria-rowindex":b?H+t+1:void 0,children:[(0,d.jsxs)(`th`,{id:P(t),scope:`row`,headers:s||void 0,className:(0,u.default)(c.default.rowHeader,B&&c.default.stickyLeft),style:{"--wim-pivot-table-depth":e.depth},children:[b&&e.ancestors.length>0&&(0,d.jsx)(n.VisuallyHidden,{children:e.ancestors.map(e=>(0,d.jsxs)(l.default.Fragment,{children:[A[e].node.label,`, `]},e))}),e.hasChildren?(0,d.jsxs)(`button`,{type:`button`,className:c.default.toggle,"aria-expanded":e.expanded,onClick:()=>fe(e.key),children:[(0,d.jsx)(`span`,{className:(0,u.default)(c.default.chevron,e.expanded&&c.default.open),"aria-hidden":`true`,children:(0,d.jsx)(i.Icon,{component:r.default,size:`sm`})}),e.node.label]}):(0,d.jsx)(`span`,{className:(0,u.default)(j&&c.default.leafLabel),children:e.node.label})]}),D.columns.map((t,n)=>(0,d.jsx)(o.Table.Cell,{headers:`${a} ${I[n]}`,className:(0,u.default)(c.default.value,t.kind!==`leaf`&&c.default.aggregate,t.startsGroup&&!(B&&n===0)&&c.default.groupStart),children:h(e.key,t.key)},n))]},e.key)};return(0,d.jsx)(`div`,{ref:L,className:c.default.scroller,style:ie===void 0?void 0:{maxHeight:ie},tabIndex:z?0:void 0,onScroll:b?Y:void 0,...z&&$?{role:`region`,...$}:null,children:(0,d.jsxs)(`table`,{ref:_e,className:(0,u.default)(`wim-pivot-table`,c.default.root,se),"aria-rowcount":b?H+X+ +!!S:void 0,...w,children:[_&&(0,d.jsx)(`caption`,{id:Oe,className:c.default.caption,children:_}),(0,d.jsx)(`colgroup`,{}),D.groupSpans.map((e,t)=>(0,d.jsx)(`colgroup`,{span:e},t)),(0,d.jsx)(o.Table.Header,{children:D.headerRows.map((e,t)=>(0,d.jsxs)(`tr`,{"aria-rowindex":b?t+1:void 0,ref:e=>{V.current[t]=e},children:[t===0&&(M?(0,d.jsx)(`th`,{id:N,scope:`col`,rowSpan:D.depth,className:(0,u.default)(c.default.columnHeader,c.default.corner,c.default.bottom,y&&c.default.stickyTop,B&&c.default.stickyLeft),...Z(0),style:{...Q(0,!0),...Z(0)?.style},children:g}):(0,d.jsx)(`td`,{rowSpan:D.depth,className:(0,u.default)(c.default.columnHeader,c.default.bottom,y&&c.default.stickyTop,B&&c.default.stickyLeft),...Z(0),style:{...Q(0,!0),...Z(0)?.style}})),e.map((e,n)=>(0,d.jsx)(`th`,{id:pe(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,u.default)(c.default.columnHeader,e.kind===`group`&&c.default.group,e.reachesBottom&&c.default.bottom,e.startsGroup&&!(B&&n===0)&&c.default.groupStart,y&&c.default.stickyTop),...e.reachesBottom?Z((De.get(e.id)??-1)+1):null,style:{...Q(t),...e.reachesBottom?Z((De.get(e.id)??-1)+1)?.style:null},children:e.kind===`group`||e.kind===`leaf`?e.node?.label:E},e.id))]},t))}),(0,d.jsx)(o.Table.Body,{ref:U,onFocus:b?e=>{let t=e.target.closest(`tr`)?.dataset.rowKey;t!==void 0&&q(t)}:void 0,onBlur:b?e=>{e.currentTarget.contains(e.relatedTarget)||q(null)}:void 0,children:(Ee??[{kind:`rows`,from:0,to:X}]).map((e,t)=>e.kind===`gap`?(0,d.jsx)(`tr`,{"aria-hidden":`true`,className:c.default.gap,children:(0,d.jsx)(`td`,{colSpan:we+1,style:{height:e.count*(W||f)}})},`gap-${t}`):A.slice(e.from,e.to).map((t,n)=>ke(t,e.from+n)))}),S&&(0,d.jsx)(o.Table.Footer,{children:(0,d.jsxs)(o.Table.Row,{className:c.default.totalRow,"aria-rowindex":b?H+X+1:void 0,children:[(0,d.jsx)(`th`,{id:F,scope:`row`,headers:M?N:void 0,className:(0,u.default)(c.default.rowHeader,B&&c.default.stickyLeft),children:(0,d.jsx)(`span`,{className:(0,u.default)(j&&c.default.leafLabel),children:E})}),D.columns.map((e,t)=>(0,d.jsx)(o.Table.Cell,{headers:`${F} ${I[t]}`,className:(0,u.default)(c.default.value,e.startsGroup&&!(B&&t===0)&&c.default.groupStart),children:h(null,e.key)},t))]})})]})})});m.displayName=`PivotTable`,exports.PivotTable=m;
|
|
@@ -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,37 @@ 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;
|
|
57
|
+
/**
|
|
58
|
+
* Renders only the rows in view (plus a few around them) and keeps the scroll height
|
|
59
|
+
* with empty spacer rows. Use it for tables with hundreds of rows, together with
|
|
60
|
+
* `maxHeight`. Rows must all have the same height, so keep labels and values on one line.
|
|
61
|
+
*/
|
|
62
|
+
virtualized?: boolean;
|
|
29
63
|
/** Adds a subtotal column after the columns of each column group. */
|
|
30
64
|
columnSubtotals?: boolean;
|
|
31
65
|
/** Adds a grand total row at the bottom. */
|
|
@@ -40,6 +74,10 @@ export type PivotTableProps = Omit<React.ComponentPropsWithoutRef<"table">, "chi
|
|
|
40
74
|
* headings, subtotals and grand totals. It only draws: grouping and summing stay with the
|
|
41
75
|
* caller, who answers `getValue(rowKey, columnKey)` for every cell.
|
|
42
76
|
*
|
|
77
|
+
* Row groups can be collapsed to their subtotal row with the button in their heading
|
|
78
|
+
* (Enter or Space). The button is named by the group label, so the heading still reads as
|
|
79
|
+
* the plain label when a cell announces it.
|
|
80
|
+
*
|
|
43
81
|
* Every cell lists the headings it belongs to in its `headers` attribute, so a screen
|
|
44
82
|
* reader announces the full row path and column path of a value.
|
|
45
83
|
*
|
|
@@ -65,6 +103,37 @@ export declare const PivotTable: React.ForwardRefExoticComponent<Omit<Omit<React
|
|
|
65
103
|
rowAxisLabel?: React.ReactNode;
|
|
66
104
|
/** Visible title of the table, also its accessible name. */
|
|
67
105
|
caption?: React.ReactNode;
|
|
106
|
+
/**
|
|
107
|
+
* Keys of the expanded row groups (controlled). A group that is not listed shows only
|
|
108
|
+
* its own row, which carries its subtotal.
|
|
109
|
+
*/
|
|
110
|
+
expandedValues?: string[];
|
|
111
|
+
/** Row groups expanded on first render (uncontrolled). Defaults to every group. */
|
|
112
|
+
defaultExpandedValues?: string[];
|
|
113
|
+
/** Called with the new list of expanded row groups when a group is expanded or collapsed. */
|
|
114
|
+
onExpandedChange?: (values: string[]) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Maximum height of the table (a number is px). Past it the table scrolls vertically
|
|
117
|
+
* inside its own box.
|
|
118
|
+
*/
|
|
119
|
+
maxHeight?: string | number;
|
|
120
|
+
/**
|
|
121
|
+
* Keeps the column headings in view while the table scrolls vertically. Every heading
|
|
122
|
+
* level stays, stacked in order. Only has an effect together with `maxHeight`.
|
|
123
|
+
*/
|
|
124
|
+
stickyHeader?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Keeps the row headings in view while the table scrolls sideways. The column is only
|
|
127
|
+
* pinned while it takes at most half of the visible width; in a narrower container it
|
|
128
|
+
* scrolls with the rest, so that the values stay readable.
|
|
129
|
+
*/
|
|
130
|
+
stickyRowHeaders?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Renders only the rows in view (plus a few around them) and keeps the scroll height
|
|
133
|
+
* with empty spacer rows. Use it for tables with hundreds of rows, together with
|
|
134
|
+
* `maxHeight`. Rows must all have the same height, so keep labels and values on one line.
|
|
135
|
+
*/
|
|
136
|
+
virtualized?: boolean;
|
|
68
137
|
/** Adds a subtotal column after the columns of each column group. */
|
|
69
138
|
columnSubtotals?: boolean;
|
|
70
139
|
/** Adds a grand total row at the bottom. */
|
|
@@ -1,104 +1,259 @@
|
|
|
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 { VisuallyHidden as t } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
4
|
+
import n from "../../../icon/chevron-right.js";
|
|
5
|
+
import { Icon as r } from "../../media/Icon/Icon.js";
|
|
6
|
+
import { useMergedRef as i } from "../../../hooks/useMergedRef.js";
|
|
7
|
+
import { Table as a } from "../Table/Table.js";
|
|
8
|
+
import { layoutPivotColumns as o, layoutPivotRows as s, pivotRowWindow as ee } from "./layoutPivot.js";
|
|
9
|
+
import c from "./pivot-table.module.js";
|
|
10
|
+
import l, { useCallback as te, useMemo as u, useState as d } from "react";
|
|
11
|
+
import f from "classnames";
|
|
12
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
13
|
//#region src/components/data-display/PivotTable/PivotTable.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
var h = 40, ne = 8, re = 30, g = (e, t = []) => {
|
|
15
|
+
for (let n of e) n.children?.length && (t.push(n.key), g(n.children, t));
|
|
16
|
+
return t;
|
|
17
|
+
}, _ = l.forwardRef(({ rows: _, columns: ie, getValue: ae, rowAxisLabel: v, caption: y, expandedValues: b, defaultExpandedValues: oe, onExpandedChange: x, maxHeight: S, stickyHeader: C = !1, stickyRowHeaders: se = !1, virtualized: w = !1, columnSubtotals: T = !1, totalRow: E = !1, totalColumn: ce = !1, labels: le, className: ue, ...D }, de) => {
|
|
18
|
+
let { t: fe } = e("components"), O = l.useId(), pe = le?.total ?? fe("pivottable.total"), k = u(() => o(ie, {
|
|
19
|
+
subtotals: T,
|
|
20
|
+
total: ce
|
|
15
21
|
}), [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
]),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
ie,
|
|
23
|
+
T,
|
|
24
|
+
ce
|
|
25
|
+
]), [me, he] = d(() => oe ?? g(_)), A = b ?? me, j = u(() => new Set(A), [A]), ge = te((e) => {
|
|
26
|
+
let t = j.has(e) ? A.filter((t) => t !== e) : [...A, e];
|
|
27
|
+
b === void 0 && he(t), x?.(t);
|
|
28
|
+
}, [
|
|
29
|
+
A,
|
|
30
|
+
j,
|
|
31
|
+
b,
|
|
32
|
+
x
|
|
33
|
+
]), M = u(() => s(_, (e) => j.has(e)), [_, j]), N = u(() => g(_).length > 0, [_]), P = v != null && v !== !1, F = `${O}corner`, _e = (e) => `${O}c${e}`, I = (e) => `${O}r${e}`, L = `${O}total`, R = u(() => k.columns.map((e) => e.headerIds.map((e) => `${O}c${e}`).join(" ")), [k, O]), z = l.useRef(null), B = l.useRef(null), [V, ve] = l.useState(!1), [ye, be] = l.useState(!0);
|
|
34
|
+
l.useLayoutEffect(() => {
|
|
35
|
+
let e = z.current, t = B.current;
|
|
22
36
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
23
|
-
let n = () =>
|
|
37
|
+
let n = () => {
|
|
38
|
+
ve(e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight);
|
|
39
|
+
let n = t.rows[0]?.cells[0];
|
|
40
|
+
be(!n || n.offsetWidth <= e.clientWidth / 2);
|
|
41
|
+
};
|
|
24
42
|
n();
|
|
25
43
|
let r = new ResizeObserver(n);
|
|
26
44
|
return r.observe(e), r.observe(t), () => r.disconnect();
|
|
27
45
|
}, []);
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
let xe = i(de, B), H = se && ye, U = l.useRef([]), [Se, Ce] = d([]), W = k.depth;
|
|
47
|
+
l.useLayoutEffect(() => {
|
|
48
|
+
if (!C) return;
|
|
49
|
+
let e = U.current.slice(0, W), t = () => {
|
|
50
|
+
let t = 0, n = e.map((e) => {
|
|
51
|
+
let n = t;
|
|
52
|
+
return t += e?.getBoundingClientRect().height ?? 0, n;
|
|
53
|
+
});
|
|
54
|
+
Ce((e) => e.length === n.length && e.every((e, t) => e === n[t]) ? e : n);
|
|
55
|
+
};
|
|
56
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
57
|
+
let n = new ResizeObserver(t);
|
|
58
|
+
return e.forEach((e) => e && n.observe(e)), () => n.disconnect();
|
|
59
|
+
}, [C, W]);
|
|
60
|
+
let we = l.useRef(null), [G, Te] = d(0), [K, Ee] = d(null), [q, De] = d(null), [Oe, ke] = d([]), Ae = l.useRef(0), J = te(() => {
|
|
61
|
+
let e = z.current, t = we.current, n = B.current;
|
|
62
|
+
if (!e || !t || !n) return;
|
|
63
|
+
let r = t.querySelector("tr[data-row-index]")?.getBoundingClientRect().height ?? 0;
|
|
64
|
+
r > 0 && Te((e) => Math.abs(e - r) < .01 ? e : r);
|
|
65
|
+
let i = {
|
|
66
|
+
scrollTop: e.scrollTop,
|
|
67
|
+
height: e.clientHeight,
|
|
68
|
+
bodyOffset: t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop
|
|
69
|
+
};
|
|
70
|
+
Ee((e) => e && e.scrollTop === i.scrollTop && e.height === i.height && e.bodyOffset === i.bodyOffset ? e : i);
|
|
71
|
+
let a = Array.from(n.querySelectorAll("thead [data-column-index]")).reduce((e, t) => (e[Number(t.dataset.columnIndex)] = t.getBoundingClientRect().width, e), []), o = Ae.current !== e.clientWidth;
|
|
72
|
+
Ae.current = e.clientWidth, ke((e) => {
|
|
73
|
+
let t = o ? [] : e, n = a.map((e, n) => (e || 0) > (t[n] ?? 0) + .01 ? e : t[n] ?? 0);
|
|
74
|
+
return n.length === e.length && n.every((t, n) => t === e[n]) ? e : n;
|
|
75
|
+
});
|
|
76
|
+
}, []), Y = M.length, X = k.columns.length;
|
|
77
|
+
l.useLayoutEffect(() => {
|
|
78
|
+
if (!w || (J(), typeof ResizeObserver > "u")) return;
|
|
79
|
+
let e = new ResizeObserver(J);
|
|
80
|
+
return z.current && e.observe(z.current), () => e.disconnect();
|
|
81
|
+
}, [
|
|
82
|
+
w,
|
|
83
|
+
J,
|
|
84
|
+
Y,
|
|
85
|
+
X
|
|
86
|
+
]);
|
|
87
|
+
let je = u(() => new Map(M.map((e, t) => [e.key, t])), [M]), Me = u(() => w ? ee(K ? {
|
|
88
|
+
rowCount: Y,
|
|
89
|
+
rowHeight: G || h,
|
|
90
|
+
scrollTop: K.scrollTop,
|
|
91
|
+
viewportHeight: K.height,
|
|
92
|
+
bodyOffset: K.bodyOffset,
|
|
93
|
+
overscan: ne,
|
|
94
|
+
keep: q === null ? null : je.get(q) ?? null
|
|
95
|
+
} : {
|
|
96
|
+
rowCount: Y,
|
|
97
|
+
rowHeight: h,
|
|
98
|
+
scrollTop: 0,
|
|
99
|
+
viewportHeight: Math.min(Y, re) * h,
|
|
100
|
+
bodyOffset: 0,
|
|
101
|
+
overscan: 0
|
|
102
|
+
}) : null, [
|
|
103
|
+
w,
|
|
104
|
+
K,
|
|
105
|
+
Y,
|
|
106
|
+
G,
|
|
107
|
+
q,
|
|
108
|
+
je
|
|
109
|
+
]), Ne = u(() => new Map(k.columns.map((e, t) => [e.headerIds[e.headerIds.length - 1], t])), [k]), Z = (e) => w && e !== void 0 ? {
|
|
110
|
+
"data-column-index": e,
|
|
111
|
+
style: Oe[e] ? { minWidth: Oe[e] } : void 0
|
|
112
|
+
} : null, Q = (e, t = !1) => C ? {
|
|
113
|
+
top: Math.floor(Se[e] ?? 0),
|
|
114
|
+
zIndex: 10 + W - e + +!!t
|
|
115
|
+
} : void 0, Pe = `${O}caption`, $ = y ? { "aria-labelledby": Pe } : D["aria-label"] ? { "aria-label": D["aria-label"] } : D["aria-labelledby"] ? { "aria-labelledby": D["aria-labelledby"] } : null, Fe = (e, i) => {
|
|
116
|
+
let o = w ? I(i) : [...e.ancestors.map(I), I(i)].join(" "), s = [...P ? [F] : [], ...w ? [] : e.ancestors.map(I)].join(" ");
|
|
117
|
+
return /* @__PURE__ */ m(a.Row, {
|
|
118
|
+
className: f(e.hasChildren && c.groupRow),
|
|
119
|
+
"data-row-index": w ? i : void 0,
|
|
120
|
+
"data-row-key": w ? e.key : void 0,
|
|
121
|
+
"aria-rowindex": w ? W + i + 1 : void 0,
|
|
122
|
+
children: [/* @__PURE__ */ m("th", {
|
|
123
|
+
id: I(i),
|
|
124
|
+
scope: "row",
|
|
125
|
+
headers: s || void 0,
|
|
126
|
+
className: f(c.rowHeader, H && c.stickyLeft),
|
|
127
|
+
style: { "--wim-pivot-table-depth": e.depth },
|
|
128
|
+
children: [w && e.ancestors.length > 0 && /* @__PURE__ */ p(t, { children: e.ancestors.map((e) => /* @__PURE__ */ m(l.Fragment, { children: [M[e].node.label, ", "] }, e)) }), e.hasChildren ? /* @__PURE__ */ m("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
className: c.toggle,
|
|
131
|
+
"aria-expanded": e.expanded,
|
|
132
|
+
onClick: () => ge(e.key),
|
|
133
|
+
children: [/* @__PURE__ */ p("span", {
|
|
134
|
+
className: f(c.chevron, e.expanded && c.open),
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: /* @__PURE__ */ p(r, {
|
|
137
|
+
component: n,
|
|
138
|
+
size: "sm"
|
|
139
|
+
})
|
|
140
|
+
}), e.node.label]
|
|
141
|
+
}) : /* @__PURE__ */ p("span", {
|
|
142
|
+
className: f(N && c.leafLabel),
|
|
143
|
+
children: e.node.label
|
|
144
|
+
})]
|
|
145
|
+
}), k.columns.map((t, n) => /* @__PURE__ */ p(a.Cell, {
|
|
146
|
+
headers: `${o} ${R[n]}`,
|
|
147
|
+
className: f(c.value, t.kind !== "leaf" && c.aggregate, t.startsGroup && !(H && n === 0) && c.groupStart),
|
|
148
|
+
children: ae(e.key, t.key)
|
|
149
|
+
}, n))]
|
|
150
|
+
}, e.key);
|
|
151
|
+
};
|
|
152
|
+
return /* @__PURE__ */ p("div", {
|
|
153
|
+
ref: z,
|
|
154
|
+
className: c.scroller,
|
|
155
|
+
style: S === void 0 ? void 0 : { maxHeight: S },
|
|
156
|
+
tabIndex: V ? 0 : void 0,
|
|
157
|
+
onScroll: w ? J : void 0,
|
|
158
|
+
...V && $ ? {
|
|
34
159
|
role: "region",
|
|
35
|
-
|
|
160
|
+
...$
|
|
36
161
|
} : null,
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
40
|
-
|
|
162
|
+
children: /* @__PURE__ */ m("table", {
|
|
163
|
+
ref: xe,
|
|
164
|
+
className: f("wim-pivot-table", c.root, ue),
|
|
165
|
+
"aria-rowcount": w ? W + Y + +!!E : void 0,
|
|
166
|
+
...D,
|
|
41
167
|
children: [
|
|
42
|
-
|
|
43
|
-
id:
|
|
44
|
-
className:
|
|
45
|
-
children:
|
|
168
|
+
y && /* @__PURE__ */ p("caption", {
|
|
169
|
+
id: Pe,
|
|
170
|
+
className: c.caption,
|
|
171
|
+
children: y
|
|
46
172
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
children:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
173
|
+
/* @__PURE__ */ p("colgroup", {}),
|
|
174
|
+
k.groupSpans.map((e, t) => /* @__PURE__ */ p("colgroup", { span: e }, t)),
|
|
175
|
+
/* @__PURE__ */ p(a.Header, { children: k.headerRows.map((e, t) => /* @__PURE__ */ m("tr", {
|
|
176
|
+
"aria-rowindex": w ? t + 1 : void 0,
|
|
177
|
+
ref: (e) => {
|
|
178
|
+
U.current[t] = e;
|
|
179
|
+
},
|
|
180
|
+
children: [t === 0 && (P ? /* @__PURE__ */ p("th", {
|
|
181
|
+
id: F,
|
|
182
|
+
scope: "col",
|
|
183
|
+
rowSpan: k.depth,
|
|
184
|
+
className: f(c.columnHeader, c.corner, c.bottom, C && c.stickyTop, H && c.stickyLeft),
|
|
185
|
+
...Z(0),
|
|
186
|
+
style: {
|
|
187
|
+
...Q(0, !0),
|
|
188
|
+
...Z(0)?.style
|
|
189
|
+
},
|
|
190
|
+
children: v
|
|
191
|
+
}) : /* @__PURE__ */ p("td", {
|
|
192
|
+
rowSpan: k.depth,
|
|
193
|
+
className: f(c.columnHeader, c.bottom, C && c.stickyTop, H && c.stickyLeft),
|
|
194
|
+
...Z(0),
|
|
195
|
+
style: {
|
|
196
|
+
...Q(0, !0),
|
|
197
|
+
...Z(0)?.style
|
|
198
|
+
}
|
|
199
|
+
})), e.map((e, n) => /* @__PURE__ */ p("th", {
|
|
200
|
+
id: _e(e.id),
|
|
201
|
+
scope: e.kind === "group" && e.topLevel ? "colgroup" : "col",
|
|
202
|
+
colSpan: e.colSpan > 1 ? e.colSpan : void 0,
|
|
203
|
+
rowSpan: e.rowSpan > 1 ? e.rowSpan : void 0,
|
|
204
|
+
className: f(c.columnHeader, e.kind === "group" && c.group, e.reachesBottom && c.bottom, e.startsGroup && !(H && n === 0) && c.groupStart, C && c.stickyTop),
|
|
205
|
+
...e.reachesBottom ? Z((Ne.get(e.id) ?? -1) + 1) : null,
|
|
206
|
+
style: {
|
|
207
|
+
...Q(t),
|
|
208
|
+
...e.reachesBottom ? Z((Ne.get(e.id) ?? -1) + 1)?.style : null
|
|
209
|
+
},
|
|
210
|
+
children: e.kind === "group" || e.kind === "leaf" ? e.node?.label : pe
|
|
211
|
+
}, e.id))]
|
|
212
|
+
}, t)) }),
|
|
213
|
+
/* @__PURE__ */ p(a.Body, {
|
|
214
|
+
ref: we,
|
|
215
|
+
onFocus: w ? (e) => {
|
|
216
|
+
let t = e.target.closest("tr")?.dataset.rowKey;
|
|
217
|
+
t !== void 0 && De(t);
|
|
218
|
+
} : void 0,
|
|
219
|
+
onBlur: w ? (e) => {
|
|
220
|
+
e.currentTarget.contains(e.relatedTarget) || De(null);
|
|
221
|
+
} : void 0,
|
|
222
|
+
children: (Me ?? [{
|
|
223
|
+
kind: "rows",
|
|
224
|
+
from: 0,
|
|
225
|
+
to: Y
|
|
226
|
+
}]).map((e, t) => e.kind === "gap" ? /* @__PURE__ */ p("tr", {
|
|
227
|
+
"aria-hidden": "true",
|
|
228
|
+
className: c.gap,
|
|
229
|
+
children: /* @__PURE__ */ p("td", {
|
|
230
|
+
colSpan: X + 1,
|
|
231
|
+
style: { height: e.count * (G || h) }
|
|
232
|
+
})
|
|
233
|
+
}, `gap-${t}`) : M.slice(e.from, e.to).map((t, n) => Fe(t, e.from + n)))
|
|
234
|
+
}),
|
|
235
|
+
E && /* @__PURE__ */ p(a.Footer, { children: /* @__PURE__ */ m(a.Row, {
|
|
236
|
+
className: c.totalRow,
|
|
237
|
+
"aria-rowindex": w ? W + Y + 1 : void 0,
|
|
238
|
+
children: [/* @__PURE__ */ p("th", {
|
|
239
|
+
id: L,
|
|
88
240
|
scope: "row",
|
|
89
|
-
headers:
|
|
90
|
-
className:
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
241
|
+
headers: P ? F : void 0,
|
|
242
|
+
className: f(c.rowHeader, H && c.stickyLeft),
|
|
243
|
+
children: /* @__PURE__ */ p("span", {
|
|
244
|
+
className: f(N && c.leafLabel),
|
|
245
|
+
children: pe
|
|
246
|
+
})
|
|
247
|
+
}), k.columns.map((e, t) => /* @__PURE__ */ p(a.Cell, {
|
|
248
|
+
headers: `${L} ${R[t]}`,
|
|
249
|
+
className: f(c.value, e.startsGroup && !(H && t === 0) && c.groupStart),
|
|
250
|
+
children: ae(null, e.key)
|
|
96
251
|
}, t))]
|
|
97
252
|
}) })
|
|
98
253
|
]
|
|
99
254
|
})
|
|
100
255
|
});
|
|
101
256
|
});
|
|
102
|
-
|
|
257
|
+
_.displayName = "PivotTable";
|
|
103
258
|
//#endregion
|
|
104
|
-
export {
|
|
259
|
+
export { _ 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}function i(e){let{rowCount:t,rowHeight:n,scrollTop:r,viewportHeight:i,bodyOffset:a,overscan:o,keep:s}=e;if(t<=0)return[];if(n<=0)return[{kind:`rows`,from:0,to:t}];let c=(e,t,n)=>Math.min(Math.max(e,t),n),l=r-a,u=c(Math.floor(l/n)-o,0,t-1),d=c(Math.ceil((l+i)/n)+o,u+1,t),f=[],p=e=>{e>0&&f.push({kind:`gap`,count:e})},m=s!=null&&s>=0&&s<t?s:null;return m!==null&&m<u?(p(m),f.push({kind:`rows`,from:m,to:m+1}),p(u-m-1)):p(u),f.push({kind:`rows`,from:u,to:d}),m!==null&&m>=d?(p(m-d),f.push({kind:`rows`,from:m,to:m+1}),p(t-m-1)):p(t-d),f}exports.layoutPivotColumns=n,exports.layoutPivotRows=r,exports.pivotRowWindow=i;
|
|
@@ -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,37 @@ 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>[];
|
|
68
|
+
/** 仮想化したときに描く行の並び。`gap` は、描かない行を 1 つの空の行でまとめた分。 */
|
|
69
|
+
export type PivotRowSegment = {
|
|
70
|
+
kind: "rows";
|
|
71
|
+
from: number;
|
|
72
|
+
to: number;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "gap";
|
|
75
|
+
count: number;
|
|
76
|
+
};
|
|
77
|
+
export type PivotRowWindowInput = {
|
|
78
|
+
rowCount: number;
|
|
79
|
+
/** 1 行の高さ(全行が同じ高さの前提)。0 以下なら全部描く。 */
|
|
80
|
+
rowHeight: number;
|
|
81
|
+
/** スクロールの器の `scrollTop`。 */
|
|
82
|
+
scrollTop: number;
|
|
83
|
+
/** スクロールの器の見えている高さ。 */
|
|
84
|
+
viewportHeight: number;
|
|
85
|
+
/** 器の中身の先頭から、最初の行までの距離(caption と見出しの高さ)。 */
|
|
86
|
+
bodyOffset: number;
|
|
87
|
+
/** 見えている範囲の上下に、余分に描いておく行の数。 */
|
|
88
|
+
overscan: number;
|
|
89
|
+
/** 範囲の外でも描いたままにする行(フォーカスを持つ行)。 */
|
|
90
|
+
keep?: number | null;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* 見えている行(と上下の余分)だけを描くための並びを返す。描かない行は `gap` にまとめ、
|
|
94
|
+
* 行の総数ぶんの高さが保たれるようにする。`keep` の行は、範囲の外にあっても 1 行だけ描く。
|
|
95
|
+
*/
|
|
96
|
+
export declare function pivotRowWindow(input: PivotRowWindowInput): PivotRowSegment[];
|
|
@@ -48,20 +48,49 @@ 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;
|
|
66
|
+
}
|
|
67
|
+
function i(e) {
|
|
68
|
+
let { rowCount: t, rowHeight: n, scrollTop: r, viewportHeight: i, bodyOffset: a, overscan: o, keep: s } = e;
|
|
69
|
+
if (t <= 0) return [];
|
|
70
|
+
if (n <= 0) return [{
|
|
71
|
+
kind: "rows",
|
|
72
|
+
from: 0,
|
|
73
|
+
to: t
|
|
74
|
+
}];
|
|
75
|
+
let c = (e, t, n) => Math.min(Math.max(e, t), n), l = r - a, u = c(Math.floor(l / n) - o, 0, t - 1), d = c(Math.ceil((l + i) / n) + o, u + 1, t), f = [], p = (e) => {
|
|
76
|
+
e > 0 && f.push({
|
|
77
|
+
kind: "gap",
|
|
78
|
+
count: e
|
|
79
|
+
});
|
|
80
|
+
}, m = s != null && s >= 0 && s < t ? s : null;
|
|
81
|
+
return m !== null && m < u ? (p(m), f.push({
|
|
82
|
+
kind: "rows",
|
|
83
|
+
from: m,
|
|
84
|
+
to: m + 1
|
|
85
|
+
}), p(u - m - 1)) : p(u), f.push({
|
|
86
|
+
kind: "rows",
|
|
87
|
+
from: u,
|
|
88
|
+
to: d
|
|
89
|
+
}), m !== null && m >= d ? (p(m - d), f.push({
|
|
90
|
+
kind: "rows",
|
|
91
|
+
from: m,
|
|
92
|
+
to: m + 1
|
|
93
|
+
}), p(t - m - 1)) : p(t - d), f;
|
|
65
94
|
}
|
|
66
95
|
//#endregion
|
|
67
|
-
export { n as layoutPivotColumns, r as layoutPivotRows };
|
|
96
|
+
export { n as layoutPivotColumns, r as layoutPivotRows, i as pivotRowWindow };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
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;
|