schummar-table 0.42.0 → 0.43.1
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/{chunk-E2DUBLYQ.js → chunk-FTCKJOPQ.js} +5 -5
- package/dist/chunk-FTCKJOPQ.js.map +1 -0
- package/dist/index.cjs +99 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +89 -42
- package/dist/index.js.map +1 -1
- package/dist/mui4Theme.cjs +4 -4
- package/dist/mui4Theme.cjs.map +1 -1
- package/dist/mui4Theme.d.cts +1 -1
- package/dist/mui4Theme.d.ts +1 -1
- package/dist/mui4Theme.js +1 -1
- package/dist/mui5Theme.cjs +4 -4
- package/dist/mui5Theme.cjs.map +1 -1
- package/dist/mui5Theme.d.cts +1 -1
- package/dist/mui5Theme.d.ts +1 -1
- package/dist/mui5Theme.js +1 -1
- package/dist/{types-DcnzwYBU.d.ts → types-C_rP1nwr.d.ts} +13 -2
- package/dist/{types-xTAreHv_.d.cts → types-CkiMjwT9.d.cts} +13 -2
- package/package.json +1 -1
- package/dist/chunk-E2DUBLYQ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-
|
|
5
|
-
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-CkiMjwT9.cjs';
|
|
5
|
+
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-CkiMjwT9.cjs';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.cjs';
|
|
8
8
|
import '@emotion/react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-
|
|
5
|
-
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-C_rP1nwr.js';
|
|
5
|
+
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-C_rP1nwr.js';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.js';
|
|
8
8
|
import '@emotion/react';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
defaultClasses,
|
|
9
9
|
globalTableTheme,
|
|
10
10
|
mergeThemes
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FTCKJOPQ.js";
|
|
12
12
|
import "./chunk-WFCJ3D3G.js";
|
|
13
13
|
import {
|
|
14
14
|
__async,
|
|
@@ -606,17 +606,21 @@ function useTheme(selector) {
|
|
|
606
606
|
const memo4 = useTableMemo();
|
|
607
607
|
const _globalTableTheme = globalTableTheme.useState();
|
|
608
608
|
const process = (t) => {
|
|
609
|
-
var _a2, _b2, _c, _d;
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
const
|
|
613
|
-
const
|
|
609
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
610
|
+
const rowClass = (_a2 = t.classes) == null ? void 0 : _a2.row;
|
|
611
|
+
const rowStyles = (_b2 = t.styles) == null ? void 0 : _b2.row;
|
|
612
|
+
const cellClass = (_c = t.classes) == null ? void 0 : _c.cell;
|
|
613
|
+
const cellStyles = (_d = t.styles) == null ? void 0 : _d.cell;
|
|
614
|
+
const detailsClass = (_e = t.classes) == null ? void 0 : _e.details;
|
|
615
|
+
const detailsStyles = (_f = t.styles) == null ? void 0 : _f.details;
|
|
614
616
|
return __spreadProps(__spreadValues({}, t), {
|
|
615
617
|
classes: __spreadProps(__spreadValues({}, t.classes), {
|
|
618
|
+
row: rowClass instanceof Function || Array.isArray(rowClass) ? memo4("theme.classes.row", rowClass) : rowClass,
|
|
616
619
|
cell: cellClass instanceof Function || Array.isArray(cellClass) ? memo4("theme.classes.cell", cellClass) : cellClass,
|
|
617
620
|
details: detailsClass instanceof Function || Array.isArray(detailsClass) ? memo4("theme.classes.details", detailsClass) : detailsClass
|
|
618
621
|
}),
|
|
619
622
|
styles: __spreadProps(__spreadValues({}, t.styles), {
|
|
623
|
+
row: rowStyles instanceof Function || Array.isArray(rowStyles) ? memo4("theme.styles.row", rowStyles) : rowStyles,
|
|
620
624
|
cell: cellStyles instanceof Function || Array.isArray(cellStyles) ? memo4("theme.styles.cell", cellStyles) : cellStyles,
|
|
621
625
|
details: detailsStyles instanceof Function || Array.isArray(detailsStyles) ? memo4("theme.styles.details", detailsStyles) : detailsStyles
|
|
622
626
|
}),
|
|
@@ -2205,7 +2209,7 @@ function SelectFilter(_a) {
|
|
|
2205
2209
|
}
|
|
2206
2210
|
|
|
2207
2211
|
// src/components/table.tsx
|
|
2208
|
-
import { memo as memo3, useEffect as
|
|
2212
|
+
import { memo as memo3, useEffect as useEffect14, useLayoutEffect as useLayoutEffect6, useState as useState14 } from "react";
|
|
2209
2213
|
|
|
2210
2214
|
// src/internalState/tableStateStorage.ts
|
|
2211
2215
|
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
@@ -2625,6 +2629,7 @@ function calcProps(props) {
|
|
|
2625
2629
|
};
|
|
2626
2630
|
};
|
|
2627
2631
|
const columns = inputColumns.map(mapColumn);
|
|
2632
|
+
const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
|
|
2628
2633
|
const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
|
|
2629
2634
|
const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
|
|
2630
2635
|
const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
|
|
@@ -2633,6 +2638,7 @@ function calcProps(props) {
|
|
|
2633
2638
|
parentId,
|
|
2634
2639
|
columns,
|
|
2635
2640
|
columnProps,
|
|
2641
|
+
wrapRow,
|
|
2636
2642
|
wrapCell,
|
|
2637
2643
|
rowAction,
|
|
2638
2644
|
rowDetails,
|
|
@@ -3463,6 +3469,7 @@ function Export2() {
|
|
|
3463
3469
|
}
|
|
3464
3470
|
|
|
3465
3471
|
// src/components/row.tsx
|
|
3472
|
+
import { ClassNames as ClassNames2 } from "@emotion/react";
|
|
3466
3473
|
import { memo as memo2, useLayoutEffect as useLayoutEffect4, useRef as useRef5 } from "react";
|
|
3467
3474
|
|
|
3468
3475
|
// src/misc/calcClassNames.ts
|
|
@@ -3662,18 +3669,24 @@ function SelectComponent({ itemId }) {
|
|
|
3662
3669
|
}
|
|
3663
3670
|
|
|
3664
3671
|
// src/components/row.tsx
|
|
3665
|
-
import { jsx as jsx31, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
|
|
3672
|
+
import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
|
|
3666
3673
|
var Row = memo2(function Row2({
|
|
3667
3674
|
itemId,
|
|
3668
3675
|
rowIndex
|
|
3669
3676
|
}) {
|
|
3677
|
+
var _a;
|
|
3670
3678
|
const table = useTableContext();
|
|
3671
3679
|
const divRef = useRef5(null);
|
|
3672
3680
|
const detailsDivRef = useRef5(null);
|
|
3673
3681
|
const classes = useTheme((t) => t.classes);
|
|
3674
3682
|
const styles = useTheme((t) => t.styles);
|
|
3683
|
+
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
3684
|
+
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ jsx31("div", __spreadValues({}, props));
|
|
3685
|
+
const rowClassName = (classes == null ? void 0 : classes.row) instanceof Function ? classes.row(item == null ? void 0 : item.value, rowIndex) : classes == null ? void 0 : classes.row;
|
|
3686
|
+
const rowStyles = (styles == null ? void 0 : styles.row) instanceof Function ? styles.row(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.row;
|
|
3687
|
+
const subgrid = table.useState((state) => state.props.subgrid);
|
|
3675
3688
|
const {
|
|
3676
|
-
|
|
3689
|
+
cellClassName,
|
|
3677
3690
|
css_,
|
|
3678
3691
|
indent,
|
|
3679
3692
|
hasChildren,
|
|
@@ -3683,18 +3696,18 @@ var Row = memo2(function Row2({
|
|
|
3683
3696
|
rowAction,
|
|
3684
3697
|
hasDetails
|
|
3685
3698
|
} = table.useState((state) => {
|
|
3686
|
-
var
|
|
3687
|
-
const
|
|
3699
|
+
var _a2, _b;
|
|
3700
|
+
const item2 = state.activeItemsById.get(itemId);
|
|
3688
3701
|
return {
|
|
3689
|
-
|
|
3690
|
-
css_: calcCss(styles,
|
|
3691
|
-
indent:
|
|
3692
|
-
hasChildren: !!(
|
|
3693
|
-
hasDeferredChildren:
|
|
3702
|
+
cellClassName: cx(...calcClassNames(classes, item2 == null ? void 0 : item2.value, rowIndex)),
|
|
3703
|
+
css_: calcCss(styles, item2 == null ? void 0 : item2.value, rowIndex),
|
|
3704
|
+
indent: item2 ? getAncestors(state.activeItemsById, item2).size : 0,
|
|
3705
|
+
hasChildren: !!(item2 == null ? void 0 : item2.children.length),
|
|
3706
|
+
hasDeferredChildren: item2 && ((_b = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a2, item2.value)),
|
|
3694
3707
|
columnIds: state.activeColumns.map((column) => column.id),
|
|
3695
3708
|
enableSelection: state.props.enableSelection,
|
|
3696
|
-
rowAction: state.props.rowAction instanceof Function ?
|
|
3697
|
-
hasDetails: state.props.rowDetails instanceof Function ?
|
|
3709
|
+
rowAction: state.props.rowAction instanceof Function ? item2 ? state.props.rowAction(item2.value, rowIndex) : null : state.props.rowAction,
|
|
3710
|
+
hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
|
|
3698
3711
|
};
|
|
3699
3712
|
});
|
|
3700
3713
|
useLayoutEffect4(() => {
|
|
@@ -3719,25 +3732,59 @@ var Row = memo2(function Row2({
|
|
|
3719
3732
|
};
|
|
3720
3733
|
}, [table, itemId, divRef.current, detailsDivRef.current]);
|
|
3721
3734
|
useLayoutEffect4(() => {
|
|
3722
|
-
var
|
|
3723
|
-
return (_b = (
|
|
3735
|
+
var _a2, _b;
|
|
3736
|
+
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
|
|
3724
3737
|
});
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3738
|
+
if (!item) {
|
|
3739
|
+
return null;
|
|
3740
|
+
}
|
|
3741
|
+
return /* @__PURE__ */ jsx31(ClassNames2, { children: ({ css: css3 }) => /* @__PURE__ */ jsx31(Fragment7, { children: wrapRow(
|
|
3742
|
+
{
|
|
3743
|
+
className: css3([
|
|
3744
|
+
subgrid ? {
|
|
3745
|
+
gridColumn: `1 / -1`,
|
|
3746
|
+
display: "grid",
|
|
3747
|
+
gridTemplateColumns: "subgrid"
|
|
3748
|
+
} : {
|
|
3749
|
+
display: "contents"
|
|
3750
|
+
},
|
|
3751
|
+
rowClassName,
|
|
3752
|
+
rowStyles
|
|
3753
|
+
]),
|
|
3754
|
+
children: /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
3755
|
+
/* @__PURE__ */ jsx31(
|
|
3756
|
+
"div",
|
|
3757
|
+
{
|
|
3758
|
+
className: cellClassName,
|
|
3759
|
+
css: [defaultClasses.cellFill, css_],
|
|
3760
|
+
ref: divRef
|
|
3761
|
+
}
|
|
3762
|
+
),
|
|
3763
|
+
/* @__PURE__ */ jsxs17(
|
|
3764
|
+
"div",
|
|
3765
|
+
{
|
|
3766
|
+
className: cellClassName,
|
|
3767
|
+
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
3768
|
+
children: [
|
|
3769
|
+
indent > 0 && /* @__PURE__ */ jsx31("div", { css: { width: indent * 20 } }),
|
|
3770
|
+
enableSelection && /* @__PURE__ */ jsx31(SelectComponent, { itemId }),
|
|
3771
|
+
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ jsx31(ExpandControl, { itemId, hasDeferredChildren }),
|
|
3772
|
+
rowAction
|
|
3773
|
+
]
|
|
3774
|
+
}
|
|
3775
|
+
),
|
|
3776
|
+
columnIds.map((columnId) => /* @__PURE__ */ jsx31(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx31(Cell, { itemId, rowIndex }) }, columnId)),
|
|
3777
|
+
/* @__PURE__ */ jsx31("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
|
|
3778
|
+
/* @__PURE__ */ jsx31(Details, { ref: detailsDivRef, itemId, rowIndex })
|
|
3779
|
+
] })
|
|
3780
|
+
},
|
|
3781
|
+
item.value,
|
|
3782
|
+
rowIndex
|
|
3783
|
+
) }) });
|
|
3737
3784
|
});
|
|
3738
3785
|
|
|
3739
3786
|
// src/components/virtualized.tsx
|
|
3740
|
-
import { useEffect as
|
|
3787
|
+
import { useEffect as useEffect13, useLayoutEffect as useLayoutEffect5, useMemo as useMemo10, useRef as useRef6, useState as useState13 } from "react";
|
|
3741
3788
|
import { jsx as jsx32, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
3742
3789
|
var findScrollRoot = (x) => {
|
|
3743
3790
|
const parent = x.parentElement;
|
|
@@ -3817,7 +3864,7 @@ function Virtualized(_a) {
|
|
|
3817
3864
|
);
|
|
3818
3865
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
3819
3866
|
const update = useMemo10(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
3820
|
-
|
|
3867
|
+
useEffect13(() => {
|
|
3821
3868
|
if (!virtual || !probeRef.current) return;
|
|
3822
3869
|
window.addEventListener("scroll", update, true);
|
|
3823
3870
|
window.addEventListener("resize", update, true);
|
|
@@ -3826,7 +3873,7 @@ function Virtualized(_a) {
|
|
|
3826
3873
|
window.removeEventListener("resize", update, true);
|
|
3827
3874
|
};
|
|
3828
3875
|
}, [update, virtual]);
|
|
3829
|
-
|
|
3876
|
+
useEffect13(() => update.cancel, [update]);
|
|
3830
3877
|
useLayoutEffect5(
|
|
3831
3878
|
() => {
|
|
3832
3879
|
var _a3, _b3;
|
|
@@ -3843,7 +3890,7 @@ function Virtualized(_a) {
|
|
|
3843
3890
|
}
|
|
3844
3891
|
|
|
3845
3892
|
// src/components/table.tsx
|
|
3846
|
-
import { Fragment as
|
|
3893
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
3847
3894
|
function Table(props) {
|
|
3848
3895
|
const [table, resetState] = useTableState(props);
|
|
3849
3896
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
@@ -3862,11 +3909,11 @@ function Table(props) {
|
|
|
3862
3909
|
function TableLoadingState({ isHydrated }) {
|
|
3863
3910
|
const loadingText = useTheme((t) => t.text.loading);
|
|
3864
3911
|
const [showLoading, setShowLoading] = useState14(false);
|
|
3865
|
-
|
|
3912
|
+
useEffect14(() => {
|
|
3866
3913
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
3867
3914
|
return () => clearTimeout(handle);
|
|
3868
3915
|
});
|
|
3869
|
-
return /* @__PURE__ */ jsxs19(
|
|
3916
|
+
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
3870
3917
|
!isHydrated && showLoading && /* @__PURE__ */ jsx33("div", { children: loadingText }),
|
|
3871
3918
|
/* @__PURE__ */ jsx33(TableInner, { hidden: !isHydrated })
|
|
3872
3919
|
] });
|
|
@@ -3923,7 +3970,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
3923
3970
|
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
3924
3971
|
].join(" ")
|
|
3925
3972
|
},
|
|
3926
|
-
header: /* @__PURE__ */ jsxs19(
|
|
3973
|
+
header: /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
3927
3974
|
/* @__PURE__ */ jsx33(
|
|
3928
3975
|
"div",
|
|
3929
3976
|
{
|
|
@@ -3950,7 +3997,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
3950
3997
|
enableSelection && /* @__PURE__ */ jsx33(SelectComponent, {}),
|
|
3951
3998
|
enableColumnSelection && /* @__PURE__ */ jsx33(ColumnSelection, {}),
|
|
3952
3999
|
enableExport && /* @__PURE__ */ jsx33(Export2, {}),
|
|
3953
|
-
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(
|
|
4000
|
+
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
3954
4001
|
/* @__PURE__ */ jsx33("div", { css: { flex: 1 } }),
|
|
3955
4002
|
/* @__PURE__ */ jsx33(ResizeHandleView, {})
|
|
3956
4003
|
] })
|
|
@@ -3971,9 +4018,9 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
3971
4018
|
}
|
|
3972
4019
|
)
|
|
3973
4020
|
] }),
|
|
3974
|
-
footer: /* @__PURE__ */ jsxs19(
|
|
4021
|
+
footer: /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
3975
4022
|
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ jsx33(ClearFiltersButton, {}),
|
|
3976
|
-
hasFooter && /* @__PURE__ */ jsxs19(
|
|
4023
|
+
hasFooter && /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
3977
4024
|
/* @__PURE__ */ jsx33(
|
|
3978
4025
|
"div",
|
|
3979
4026
|
{
|