schummar-table 0.43.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/index.cjs +59 -58
- 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 +40 -39
- package/dist/index.js.map +1 -1
- package/dist/mui4Theme.d.cts +1 -1
- package/dist/mui4Theme.d.ts +1 -1
- package/dist/mui5Theme.d.cts +1 -1
- package/dist/mui5Theme.d.ts +1 -1
- package/dist/{types-C_rX6bDQ.d.ts → types-C_rP1nwr.d.ts} +9 -4
- package/dist/{types-B8KLTUz2.d.cts → types-CkiMjwT9.d.cts} +9 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3101,7 +3101,7 @@ function SelectFilter(_a) {
|
|
|
3101
3101
|
}
|
|
3102
3102
|
|
|
3103
3103
|
// src/components/table.tsx
|
|
3104
|
-
var
|
|
3104
|
+
var import_react40 = require("react");
|
|
3105
3105
|
|
|
3106
3106
|
// src/internalState/tableStateStorage.ts
|
|
3107
3107
|
var import_react22 = require("react");
|
|
@@ -4361,7 +4361,8 @@ function Export2() {
|
|
|
4361
4361
|
}
|
|
4362
4362
|
|
|
4363
4363
|
// src/components/row.tsx
|
|
4364
|
-
var import_react37 = require("react");
|
|
4364
|
+
var import_react37 = require("@emotion/react");
|
|
4365
|
+
var import_react38 = require("react");
|
|
4365
4366
|
|
|
4366
4367
|
// src/misc/calcClassNames.ts
|
|
4367
4368
|
function calcClassNames(classes, item, index) {
|
|
@@ -4561,21 +4562,18 @@ function SelectComponent({ itemId }) {
|
|
|
4561
4562
|
|
|
4562
4563
|
// src/components/row.tsx
|
|
4563
4564
|
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
4564
|
-
var
|
|
4565
|
-
return content;
|
|
4566
|
-
};
|
|
4567
|
-
var Row = (0, import_react37.memo)(function Row2({
|
|
4565
|
+
var Row = (0, import_react38.memo)(function Row2({
|
|
4568
4566
|
itemId,
|
|
4569
4567
|
rowIndex
|
|
4570
4568
|
}) {
|
|
4571
4569
|
var _a;
|
|
4572
4570
|
const table = useTableContext();
|
|
4573
|
-
const divRef = (0,
|
|
4574
|
-
const detailsDivRef = (0,
|
|
4571
|
+
const divRef = (0, import_react38.useRef)(null);
|
|
4572
|
+
const detailsDivRef = (0, import_react38.useRef)(null);
|
|
4575
4573
|
const classes = useTheme((t2) => t2.classes);
|
|
4576
4574
|
const styles = useTheme((t2) => t2.styles);
|
|
4577
4575
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
4578
|
-
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a :
|
|
4576
|
+
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", __spreadValues({}, props));
|
|
4579
4577
|
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;
|
|
4580
4578
|
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;
|
|
4581
4579
|
const subgrid = table.useState((state) => state.props.subgrid);
|
|
@@ -4604,7 +4602,7 @@ var Row = (0, import_react37.memo)(function Row2({
|
|
|
4604
4602
|
hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
|
|
4605
4603
|
};
|
|
4606
4604
|
});
|
|
4607
|
-
(0,
|
|
4605
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
4608
4606
|
function update() {
|
|
4609
4607
|
table.update((state) => {
|
|
4610
4608
|
if (!divRef.current) {
|
|
@@ -4625,57 +4623,60 @@ var Row = (0, import_react37.memo)(function Row2({
|
|
|
4625
4623
|
handles.forEach((h2) => h2());
|
|
4626
4624
|
};
|
|
4627
4625
|
}, [table, itemId, divRef.current, detailsDivRef.current]);
|
|
4628
|
-
(0,
|
|
4626
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
4629
4627
|
var _a2, _b;
|
|
4630
4628
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
|
|
4631
4629
|
});
|
|
4632
4630
|
if (!item) {
|
|
4633
4631
|
return null;
|
|
4634
4632
|
}
|
|
4635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4636
|
-
"div",
|
|
4633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react37.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: wrapRow(
|
|
4637
4634
|
{
|
|
4638
|
-
|
|
4639
|
-
{
|
|
4640
|
-
|
|
4641
|
-
},
|
|
4642
|
-
subgrid && {
|
|
4643
|
-
gridColumn: "1 / -1",
|
|
4635
|
+
className: css4([
|
|
4636
|
+
subgrid ? {
|
|
4637
|
+
gridColumn: `1 / -1`,
|
|
4644
4638
|
display: "grid",
|
|
4645
4639
|
gridTemplateColumns: "subgrid"
|
|
4640
|
+
} : {
|
|
4641
|
+
display: "contents"
|
|
4646
4642
|
},
|
|
4643
|
+
rowClassName,
|
|
4647
4644
|
rowStyles
|
|
4648
|
-
],
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
rowIndex
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4645
|
+
]),
|
|
4646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4648
|
+
"div",
|
|
4649
|
+
{
|
|
4650
|
+
className: cellClassName,
|
|
4651
|
+
css: [defaultClasses.cellFill, css_],
|
|
4652
|
+
ref: divRef
|
|
4653
|
+
}
|
|
4654
|
+
),
|
|
4655
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4656
|
+
"div",
|
|
4657
|
+
{
|
|
4658
|
+
className: cellClassName,
|
|
4659
|
+
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
4660
|
+
children: [
|
|
4661
|
+
indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
|
|
4662
|
+
enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
|
|
4663
|
+
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
|
|
4664
|
+
rowAction
|
|
4665
|
+
]
|
|
4666
|
+
}
|
|
4667
|
+
),
|
|
4668
|
+
columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
|
|
4669
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
|
|
4670
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
|
|
4671
|
+
] })
|
|
4672
|
+
},
|
|
4673
|
+
item.value,
|
|
4674
|
+
rowIndex
|
|
4675
|
+
) }) });
|
|
4675
4676
|
});
|
|
4676
4677
|
|
|
4677
4678
|
// src/components/virtualized.tsx
|
|
4678
|
-
var
|
|
4679
|
+
var import_react39 = require("react");
|
|
4679
4680
|
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4680
4681
|
var findScrollRoot = (x) => {
|
|
4681
4682
|
const parent = x.parentElement;
|
|
@@ -4702,8 +4703,8 @@ function Virtualized(_a) {
|
|
|
4702
4703
|
var _a2, _b2;
|
|
4703
4704
|
const table = useTableContext();
|
|
4704
4705
|
const virtual = table.useState((state) => state.props.virtual);
|
|
4705
|
-
const probeRef = (0,
|
|
4706
|
-
const [, setId] = (0,
|
|
4706
|
+
const probeRef = (0, import_react39.useRef)(null);
|
|
4707
|
+
const [, setId] = (0, import_react39.useState)({});
|
|
4707
4708
|
const {
|
|
4708
4709
|
itemIds = [],
|
|
4709
4710
|
from = 0,
|
|
@@ -4754,8 +4755,8 @@ function Virtualized(_a) {
|
|
|
4754
4755
|
{ throttle: 16 }
|
|
4755
4756
|
);
|
|
4756
4757
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
4757
|
-
const update = (0,
|
|
4758
|
-
(0,
|
|
4758
|
+
const update = (0, import_react39.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
4759
|
+
(0, import_react39.useEffect)(() => {
|
|
4759
4760
|
if (!virtual || !probeRef.current) return;
|
|
4760
4761
|
window.addEventListener("scroll", update, true);
|
|
4761
4762
|
window.addEventListener("resize", update, true);
|
|
@@ -4764,8 +4765,8 @@ function Virtualized(_a) {
|
|
|
4764
4765
|
window.removeEventListener("resize", update, true);
|
|
4765
4766
|
};
|
|
4766
4767
|
}, [update, virtual]);
|
|
4767
|
-
(0,
|
|
4768
|
-
(0,
|
|
4768
|
+
(0, import_react39.useEffect)(() => update.cancel, [update]);
|
|
4769
|
+
(0, import_react39.useLayoutEffect)(
|
|
4769
4770
|
() => {
|
|
4770
4771
|
var _a3, _b3;
|
|
4771
4772
|
return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
|
|
@@ -4791,7 +4792,7 @@ function Table(props) {
|
|
|
4791
4792
|
resetState();
|
|
4792
4793
|
});
|
|
4793
4794
|
}
|
|
4794
|
-
(0,
|
|
4795
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4795
4796
|
var _a, _b;
|
|
4796
4797
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
4797
4798
|
});
|
|
@@ -4799,8 +4800,8 @@ function Table(props) {
|
|
|
4799
4800
|
}
|
|
4800
4801
|
function TableLoadingState({ isHydrated }) {
|
|
4801
4802
|
const loadingText = useTheme((t2) => t2.text.loading);
|
|
4802
|
-
const [showLoading, setShowLoading] = (0,
|
|
4803
|
-
(0,
|
|
4803
|
+
const [showLoading, setShowLoading] = (0, import_react40.useState)(false);
|
|
4804
|
+
(0, import_react40.useEffect)(() => {
|
|
4804
4805
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
4805
4806
|
return () => clearTimeout(handle);
|
|
4806
4807
|
});
|
|
@@ -4809,7 +4810,7 @@ function TableLoadingState({ isHydrated }) {
|
|
|
4809
4810
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableInner, { hidden: !isHydrated })
|
|
4810
4811
|
] });
|
|
4811
4812
|
}
|
|
4812
|
-
var TableInner = (0,
|
|
4813
|
+
var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
|
|
4813
4814
|
const table = useTableContext();
|
|
4814
4815
|
const fullWidth = table.useState((state) => state.props.fullWidth);
|
|
4815
4816
|
const activeColumns = table.useState(
|
|
@@ -4838,7 +4839,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
|
|
|
4838
4839
|
const enableExport = table.useState((state) => !!state.props.enableExport);
|
|
4839
4840
|
const cssVariables = useCssVariables();
|
|
4840
4841
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
4841
|
-
(0,
|
|
4842
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4842
4843
|
var _a, _b;
|
|
4843
4844
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
4844
4845
|
});
|