schummar-table 0.45.3 → 0.46.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 +108 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +47 -2
- 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-cAzUt-yT.d.ts → types-CIq7O-SN.d.ts} +11 -1
- package/dist/{types-DKqBJ_4v.d.cts → types-CJnecNQy.d.cts} +11 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3335,10 +3335,53 @@ function SelectFilter(_a) {
|
|
|
3335
3335
|
}
|
|
3336
3336
|
|
|
3337
3337
|
// src/components/table.tsx
|
|
3338
|
-
var
|
|
3338
|
+
var import_react43 = require("react");
|
|
3339
3339
|
|
|
3340
|
-
// src/
|
|
3340
|
+
// src/hooks/useTableRef.ts
|
|
3341
3341
|
var import_react23 = require("react");
|
|
3342
|
+
function useTableRef(table, ref) {
|
|
3343
|
+
(0, import_react23.useImperativeHandle)(
|
|
3344
|
+
ref,
|
|
3345
|
+
() => ({
|
|
3346
|
+
getSort() {
|
|
3347
|
+
return table.getState().sort;
|
|
3348
|
+
},
|
|
3349
|
+
setSort(sort) {
|
|
3350
|
+
table.update((state) => {
|
|
3351
|
+
state.sort = sort;
|
|
3352
|
+
});
|
|
3353
|
+
},
|
|
3354
|
+
getSelection() {
|
|
3355
|
+
return table.getState().selection;
|
|
3356
|
+
},
|
|
3357
|
+
setSelection(selection) {
|
|
3358
|
+
table.update((state) => {
|
|
3359
|
+
state.selection = selection;
|
|
3360
|
+
});
|
|
3361
|
+
},
|
|
3362
|
+
getExpanded() {
|
|
3363
|
+
return table.getState().expanded;
|
|
3364
|
+
},
|
|
3365
|
+
setExpanded(expanded) {
|
|
3366
|
+
table.update((state) => {
|
|
3367
|
+
state.expanded = expanded;
|
|
3368
|
+
});
|
|
3369
|
+
},
|
|
3370
|
+
getHiddenColumns() {
|
|
3371
|
+
return table.getState().hiddenColumns;
|
|
3372
|
+
},
|
|
3373
|
+
setHiddenColumns(hidden) {
|
|
3374
|
+
table.update((state) => {
|
|
3375
|
+
state.hiddenColumns = hidden;
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
}),
|
|
3379
|
+
[table]
|
|
3380
|
+
);
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
// src/internalState/tableStateStorage.ts
|
|
3384
|
+
var import_react24 = require("react");
|
|
3342
3385
|
|
|
3343
3386
|
// src/misc/queue.ts
|
|
3344
3387
|
var Queue = class {
|
|
@@ -3422,9 +3465,9 @@ function parse(value) {
|
|
|
3422
3465
|
});
|
|
3423
3466
|
}
|
|
3424
3467
|
function useTableStateStorage(table) {
|
|
3425
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
3426
|
-
const [q2] = (0,
|
|
3427
|
-
(0,
|
|
3468
|
+
const [isHydrated, setIsHydrated] = (0, import_react24.useState)(false);
|
|
3469
|
+
const [q2] = (0, import_react24.useState)(() => new Queue());
|
|
3470
|
+
(0, import_react24.useEffect)(() => {
|
|
3428
3471
|
const { persist } = table.getState().props;
|
|
3429
3472
|
if (!persist) {
|
|
3430
3473
|
setIsHydrated(true);
|
|
@@ -3484,7 +3527,7 @@ function useTableStateStorage(table) {
|
|
|
3484
3527
|
isCanceled = true;
|
|
3485
3528
|
};
|
|
3486
3529
|
}, [table]);
|
|
3487
|
-
(0,
|
|
3530
|
+
(0, import_react24.useEffect)(() => {
|
|
3488
3531
|
if (!isHydrated) return;
|
|
3489
3532
|
return table.subscribe(
|
|
3490
3533
|
(state) => {
|
|
@@ -3545,13 +3588,13 @@ function useTableStateStorage(table) {
|
|
|
3545
3588
|
|
|
3546
3589
|
// src/internalState/useTableState.ts
|
|
3547
3590
|
var import_immer6 = require("immer");
|
|
3548
|
-
var
|
|
3591
|
+
var import_react32 = require("react");
|
|
3549
3592
|
|
|
3550
3593
|
// src/internalState/calcItems.ts
|
|
3551
3594
|
var import_immer4 = require("immer");
|
|
3552
|
-
var
|
|
3595
|
+
var import_react25 = require("react");
|
|
3553
3596
|
function calcItems(state) {
|
|
3554
|
-
(0,
|
|
3597
|
+
(0, import_react25.useEffect)(
|
|
3555
3598
|
() => state.addReaction(
|
|
3556
3599
|
(state2) => [
|
|
3557
3600
|
state2.props.items,
|
|
@@ -3670,7 +3713,7 @@ function calcItems(state) {
|
|
|
3670
3713
|
}
|
|
3671
3714
|
|
|
3672
3715
|
// src/internalState/calcProps.ts
|
|
3673
|
-
var
|
|
3716
|
+
var import_react26 = require("react");
|
|
3674
3717
|
|
|
3675
3718
|
// src/exporters/serializer.ts
|
|
3676
3719
|
function defaultSerializer(x) {
|
|
@@ -3719,7 +3762,7 @@ var defaultProps = {
|
|
|
3719
3762
|
};
|
|
3720
3763
|
function calcProps(props) {
|
|
3721
3764
|
const cache = useTableMemo();
|
|
3722
|
-
return (0,
|
|
3765
|
+
return (0, import_react26.useMemo)(
|
|
3723
3766
|
() => overrides(defaultProps, calc(props, cache)),
|
|
3724
3767
|
[props]
|
|
3725
3768
|
);
|
|
@@ -3827,9 +3870,9 @@ function calc(props, cache) {
|
|
|
3827
3870
|
}
|
|
3828
3871
|
|
|
3829
3872
|
// src/internalState/cleanupState.ts
|
|
3830
|
-
var
|
|
3873
|
+
var import_react27 = require("react");
|
|
3831
3874
|
function cleanupState(state) {
|
|
3832
|
-
(0,
|
|
3875
|
+
(0, import_react27.useEffect)(
|
|
3833
3876
|
() => state.addReaction(
|
|
3834
3877
|
(state2) => [
|
|
3835
3878
|
state2.props.columns,
|
|
@@ -3889,9 +3932,9 @@ function cleanupState(state) {
|
|
|
3889
3932
|
}
|
|
3890
3933
|
|
|
3891
3934
|
// src/internalState/filterColumns.ts
|
|
3892
|
-
var
|
|
3935
|
+
var import_react28 = require("react");
|
|
3893
3936
|
function filterColumns(state) {
|
|
3894
|
-
(0,
|
|
3937
|
+
(0, import_react28.useEffect)(
|
|
3895
3938
|
() => state.addReaction(
|
|
3896
3939
|
(state2) => [
|
|
3897
3940
|
state2.props.columns,
|
|
@@ -3919,9 +3962,9 @@ function filterColumns(state) {
|
|
|
3919
3962
|
}
|
|
3920
3963
|
|
|
3921
3964
|
// src/internalState/normalizeExpanded.ts
|
|
3922
|
-
var
|
|
3965
|
+
var import_react29 = require("react");
|
|
3923
3966
|
function normalizeExpanded(table) {
|
|
3924
|
-
(0,
|
|
3967
|
+
(0, import_react29.useEffect)(
|
|
3925
3968
|
() => table.addReaction(
|
|
3926
3969
|
(state) => [state.props.expandOnlyOne, state.expanded, state.itemsById],
|
|
3927
3970
|
([expandOnlyOne, , itemsById], state) => {
|
|
@@ -3965,9 +4008,9 @@ function normalizeExpanded(table) {
|
|
|
3965
4008
|
}
|
|
3966
4009
|
|
|
3967
4010
|
// src/internalState/syncSelections.ts
|
|
3968
|
-
var
|
|
4011
|
+
var import_react30 = require("react");
|
|
3969
4012
|
function syncSelections(table) {
|
|
3970
|
-
(0,
|
|
4013
|
+
(0, import_react30.useEffect)(
|
|
3971
4014
|
() => table.addReaction(
|
|
3972
4015
|
(state) => [state.props.selectSyncChildren, state.selection, state.activeItems],
|
|
3973
4016
|
([selectSyncChildren, selection, activeItems], state) => {
|
|
@@ -3994,13 +4037,13 @@ function syncSelections(table) {
|
|
|
3994
4037
|
|
|
3995
4038
|
// src/internalState/watchDisplaySize.ts
|
|
3996
4039
|
var import_immer5 = require("immer");
|
|
3997
|
-
var
|
|
4040
|
+
var import_react31 = require("react");
|
|
3998
4041
|
var DEFAULT_DISPLAY_SIZES = {
|
|
3999
4042
|
mobile: 400,
|
|
4000
4043
|
desktop: Infinity
|
|
4001
4044
|
};
|
|
4002
4045
|
function watchDisplaySize(state) {
|
|
4003
|
-
(0,
|
|
4046
|
+
(0, import_react31.useEffect)(
|
|
4004
4047
|
() => state.addReaction(
|
|
4005
4048
|
(state2) => ({
|
|
4006
4049
|
displaySizePx: state2.displaySizePx,
|
|
@@ -4022,7 +4065,7 @@ function watchDisplaySize(state) {
|
|
|
4022
4065
|
),
|
|
4023
4066
|
[state]
|
|
4024
4067
|
);
|
|
4025
|
-
(0,
|
|
4068
|
+
(0, import_react31.useEffect)(
|
|
4026
4069
|
() => state.addReaction(
|
|
4027
4070
|
(state2) => ({
|
|
4028
4071
|
props: state2.normalizedProps,
|
|
@@ -4041,7 +4084,7 @@ function watchDisplaySize(state) {
|
|
|
4041
4084
|
|
|
4042
4085
|
// src/internalState/useTableState.ts
|
|
4043
4086
|
function useTableState(_props) {
|
|
4044
|
-
const [key, setKey] = (0,
|
|
4087
|
+
const [key, setKey] = (0, import_react32.useState)({});
|
|
4045
4088
|
const props = calcProps(_props);
|
|
4046
4089
|
function reset() {
|
|
4047
4090
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -4060,7 +4103,7 @@ function useTableState(_props) {
|
|
|
4060
4103
|
}
|
|
4061
4104
|
(_i = props.onReset) == null ? void 0 : _i.call(props, "table");
|
|
4062
4105
|
}
|
|
4063
|
-
const state = (0,
|
|
4106
|
+
const state = (0, import_react32.useMemo)(
|
|
4064
4107
|
() => {
|
|
4065
4108
|
var _a, _b, _c, _d;
|
|
4066
4109
|
return new Store2({
|
|
@@ -4096,7 +4139,7 @@ function useTableState(_props) {
|
|
|
4096
4139
|
syncSelections(state);
|
|
4097
4140
|
cleanupState(state);
|
|
4098
4141
|
watchDisplaySize(state);
|
|
4099
|
-
(0,
|
|
4142
|
+
(0, import_react32.useEffect)(() => {
|
|
4100
4143
|
state.update((state2) => {
|
|
4101
4144
|
state2.normalizedProps = (0, import_immer6.castDraft)(props);
|
|
4102
4145
|
if (props.sort) state2.sort = props.sort;
|
|
@@ -4190,7 +4233,7 @@ function ColumnFooter() {
|
|
|
4190
4233
|
|
|
4191
4234
|
// src/components/columnHeader.tsx
|
|
4192
4235
|
var import_immer7 = require("immer");
|
|
4193
|
-
var
|
|
4236
|
+
var import_react34 = require("react");
|
|
4194
4237
|
|
|
4195
4238
|
// src/components/resizeHandle.tsx
|
|
4196
4239
|
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
@@ -4364,7 +4407,7 @@ var ColumnHeaderContext = new StoreScope({
|
|
|
4364
4407
|
items: /* @__PURE__ */ new Map()
|
|
4365
4408
|
});
|
|
4366
4409
|
function ColumnHeader() {
|
|
4367
|
-
const ref = (0,
|
|
4410
|
+
const ref = (0, import_react34.useRef)(null);
|
|
4368
4411
|
const columnId = useColumnContext();
|
|
4369
4412
|
const table = useTableContext();
|
|
4370
4413
|
const enabled = table.useState((state) => state.props.enableColumnReorder);
|
|
@@ -4390,9 +4433,9 @@ function ColumnHeader() {
|
|
|
4390
4433
|
};
|
|
4391
4434
|
});
|
|
4392
4435
|
const store = ColumnHeaderContext.useStore();
|
|
4393
|
-
const draggingStart = (0,
|
|
4394
|
-
const clone = (0,
|
|
4395
|
-
(0,
|
|
4436
|
+
const draggingStart = (0, import_react34.useRef)();
|
|
4437
|
+
const clone = (0, import_react34.useRef)();
|
|
4438
|
+
(0, import_react34.useEffect)(() => {
|
|
4396
4439
|
const div = ref.current;
|
|
4397
4440
|
if (!div) return;
|
|
4398
4441
|
store.update((state) => {
|
|
@@ -4532,7 +4575,7 @@ function ColumnHeader() {
|
|
|
4532
4575
|
}
|
|
4533
4576
|
|
|
4534
4577
|
// src/components/columnSelection.tsx
|
|
4535
|
-
var
|
|
4578
|
+
var import_react36 = require("react");
|
|
4536
4579
|
var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
|
|
4537
4580
|
function ColumnSelection() {
|
|
4538
4581
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
@@ -4547,10 +4590,10 @@ function ColumnSelection() {
|
|
|
4547
4590
|
const classes = useTheme((t2) => t2.classes);
|
|
4548
4591
|
const cssVariables = useCssVariables();
|
|
4549
4592
|
const table = useTableContext();
|
|
4550
|
-
const reset = (0,
|
|
4593
|
+
const reset = (0, import_react36.useContext)(TableResetContext);
|
|
4551
4594
|
const columns = table.useState((state) => state.props.columns);
|
|
4552
4595
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
4553
|
-
const [anchorElement, setAnchorElement] = (0,
|
|
4596
|
+
const [anchorElement, setAnchorElement] = (0, import_react36.useState)(null);
|
|
4554
4597
|
const toggle2 = (column, state) => {
|
|
4555
4598
|
const {
|
|
4556
4599
|
props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
|
|
@@ -4613,10 +4656,10 @@ function ColumnSelection() {
|
|
|
4613
4656
|
}
|
|
4614
4657
|
|
|
4615
4658
|
// src/components/export.tsx
|
|
4616
|
-
var
|
|
4659
|
+
var import_react37 = require("react");
|
|
4617
4660
|
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
4618
4661
|
function Export2() {
|
|
4619
|
-
const { exporters: contextExporters } = (0,
|
|
4662
|
+
const { exporters: contextExporters } = (0, import_react37.useContext)(TableSettingsContext);
|
|
4620
4663
|
const table = useTableContext();
|
|
4621
4664
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
4622
4665
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
@@ -4637,7 +4680,7 @@ function Export2() {
|
|
|
4637
4680
|
}
|
|
4638
4681
|
return state.props.enableExport;
|
|
4639
4682
|
});
|
|
4640
|
-
const [anchor, setAnchor] = (0,
|
|
4683
|
+
const [anchor, setAnchor] = (0, import_react37.useState)(null);
|
|
4641
4684
|
function execute({ action, exporter }) {
|
|
4642
4685
|
const { activeColumns, activeItems, items } = table.getState();
|
|
4643
4686
|
const columns = activeColumns.map((column) => column.exportHeader);
|
|
@@ -4707,8 +4750,8 @@ function Export2() {
|
|
|
4707
4750
|
}
|
|
4708
4751
|
|
|
4709
4752
|
// src/components/row.tsx
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4753
|
+
var import_react40 = require("@emotion/react");
|
|
4754
|
+
var import_react41 = require("react");
|
|
4712
4755
|
|
|
4713
4756
|
// src/misc/calcClassNames.ts
|
|
4714
4757
|
function calcClassNames(classes, item, index) {
|
|
@@ -4727,7 +4770,7 @@ function calcCss(styles, item, index) {
|
|
|
4727
4770
|
}
|
|
4728
4771
|
|
|
4729
4772
|
// src/components/cell.tsx
|
|
4730
|
-
var
|
|
4773
|
+
var import_react38 = require("react");
|
|
4731
4774
|
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
4732
4775
|
var defaultWrapCell = (content) => {
|
|
4733
4776
|
if (typeof content === "string") {
|
|
@@ -4735,7 +4778,7 @@ var defaultWrapCell = (content) => {
|
|
|
4735
4778
|
}
|
|
4736
4779
|
return content;
|
|
4737
4780
|
};
|
|
4738
|
-
var Cell = (0,
|
|
4781
|
+
var Cell = (0, import_react38.memo)(function Cell2({ itemId, rowIndex }) {
|
|
4739
4782
|
var _a;
|
|
4740
4783
|
const table = useTableContext();
|
|
4741
4784
|
const columnId = useColumnContext();
|
|
@@ -4751,7 +4794,7 @@ var Cell = (0, import_react37.memo)(function Cell2({ itemId, rowIndex }) {
|
|
|
4751
4794
|
const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
|
|
4752
4795
|
throttle: 16
|
|
4753
4796
|
});
|
|
4754
|
-
(0,
|
|
4797
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
4755
4798
|
var _a2, _b;
|
|
4756
4799
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
|
|
4757
4800
|
});
|
|
@@ -4763,9 +4806,9 @@ var Cell = (0, import_react37.memo)(function Cell2({ itemId, rowIndex }) {
|
|
|
4763
4806
|
});
|
|
4764
4807
|
|
|
4765
4808
|
// src/components/details.tsx
|
|
4766
|
-
var
|
|
4809
|
+
var import_react39 = require("react");
|
|
4767
4810
|
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
4768
|
-
var Details = (0,
|
|
4811
|
+
var Details = (0, import_react39.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
|
|
4769
4812
|
const table = useTableContext();
|
|
4770
4813
|
const classes = useTheme((t2) => t2.classes);
|
|
4771
4814
|
const styles = useTheme((t2) => t2.styles);
|
|
@@ -4910,14 +4953,14 @@ function SelectComponent({ itemId }) {
|
|
|
4910
4953
|
|
|
4911
4954
|
// src/components/row.tsx
|
|
4912
4955
|
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4913
|
-
var Row = (0,
|
|
4956
|
+
var Row = (0, import_react41.memo)(function Row2({
|
|
4914
4957
|
itemId,
|
|
4915
4958
|
rowIndex
|
|
4916
4959
|
}) {
|
|
4917
4960
|
var _a;
|
|
4918
4961
|
const table = useTableContext();
|
|
4919
|
-
const divRef = (0,
|
|
4920
|
-
const detailsDivRef = (0,
|
|
4962
|
+
const divRef = (0, import_react41.useRef)(null);
|
|
4963
|
+
const detailsDivRef = (0, import_react41.useRef)(null);
|
|
4921
4964
|
const classes = useTheme((t2) => t2.classes);
|
|
4922
4965
|
const styles = useTheme((t2) => t2.styles);
|
|
4923
4966
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
@@ -4950,7 +4993,7 @@ var Row = (0, import_react40.memo)(function Row2({
|
|
|
4950
4993
|
hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
|
|
4951
4994
|
};
|
|
4952
4995
|
});
|
|
4953
|
-
(0,
|
|
4996
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
4954
4997
|
function update() {
|
|
4955
4998
|
table.update((state) => {
|
|
4956
4999
|
if (!divRef.current) {
|
|
@@ -4971,14 +5014,14 @@ var Row = (0, import_react40.memo)(function Row2({
|
|
|
4971
5014
|
handles.forEach((h2) => h2());
|
|
4972
5015
|
};
|
|
4973
5016
|
}, [table, itemId, divRef.current, detailsDivRef.current]);
|
|
4974
|
-
(0,
|
|
5017
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
4975
5018
|
var _a2, _b;
|
|
4976
5019
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
|
|
4977
5020
|
});
|
|
4978
5021
|
if (!item) {
|
|
4979
5022
|
return null;
|
|
4980
5023
|
}
|
|
4981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react40.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: wrapRow(
|
|
4982
5025
|
{
|
|
4983
5026
|
className: css4([
|
|
4984
5027
|
subgrid ? {
|
|
@@ -5024,7 +5067,7 @@ var Row = (0, import_react40.memo)(function Row2({
|
|
|
5024
5067
|
});
|
|
5025
5068
|
|
|
5026
5069
|
// src/components/virtualized.tsx
|
|
5027
|
-
var
|
|
5070
|
+
var import_react42 = require("react");
|
|
5028
5071
|
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
5029
5072
|
var findScrollRoot = (x) => {
|
|
5030
5073
|
const parent = x.parentElement;
|
|
@@ -5051,8 +5094,8 @@ function Virtualized(_a) {
|
|
|
5051
5094
|
var _a2, _b2;
|
|
5052
5095
|
const table = useTableContext();
|
|
5053
5096
|
const virtual = table.useState((state) => state.props.virtual);
|
|
5054
|
-
const probeRef = (0,
|
|
5055
|
-
const [, setId] = (0,
|
|
5097
|
+
const probeRef = (0, import_react42.useRef)(null);
|
|
5098
|
+
const [, setId] = (0, import_react42.useState)({});
|
|
5056
5099
|
const {
|
|
5057
5100
|
itemIds = [],
|
|
5058
5101
|
from = 0,
|
|
@@ -5104,8 +5147,8 @@ function Virtualized(_a) {
|
|
|
5104
5147
|
{ throttle: 16 }
|
|
5105
5148
|
);
|
|
5106
5149
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
5107
|
-
const update = (0,
|
|
5108
|
-
(0,
|
|
5150
|
+
const update = (0, import_react42.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
5151
|
+
(0, import_react42.useEffect)(() => {
|
|
5109
5152
|
var _a3;
|
|
5110
5153
|
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
5111
5154
|
if (!tableElem) return;
|
|
@@ -5122,7 +5165,7 @@ function Virtualized(_a) {
|
|
|
5122
5165
|
window.removeEventListener("resize", update2, true);
|
|
5123
5166
|
};
|
|
5124
5167
|
}, [table, probeRef.current]);
|
|
5125
|
-
(0,
|
|
5168
|
+
(0, import_react42.useEffect)(() => {
|
|
5126
5169
|
if (!virtual || !probeRef.current) return;
|
|
5127
5170
|
window.addEventListener("scroll", update, true);
|
|
5128
5171
|
window.addEventListener("resize", update, true);
|
|
@@ -5131,8 +5174,8 @@ function Virtualized(_a) {
|
|
|
5131
5174
|
window.removeEventListener("resize", update, true);
|
|
5132
5175
|
};
|
|
5133
5176
|
}, [update, virtual]);
|
|
5134
|
-
(0,
|
|
5135
|
-
(0,
|
|
5177
|
+
(0, import_react42.useEffect)(() => update.cancel, [update]);
|
|
5178
|
+
(0, import_react42.useLayoutEffect)(
|
|
5136
5179
|
() => {
|
|
5137
5180
|
var _a3, _b3;
|
|
5138
5181
|
return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
|
|
@@ -5149,16 +5192,18 @@ function Virtualized(_a) {
|
|
|
5149
5192
|
|
|
5150
5193
|
// src/components/table.tsx
|
|
5151
5194
|
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
5152
|
-
|
|
5195
|
+
var Table = (0, import_react43.forwardRef)(_Table);
|
|
5196
|
+
function _Table(props, ref) {
|
|
5153
5197
|
const [table, resetState] = useTableState(props);
|
|
5154
5198
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
5199
|
+
useTableRef(table, ref);
|
|
5155
5200
|
function reset() {
|
|
5156
5201
|
return __async(this, null, function* () {
|
|
5157
5202
|
yield clearStorage();
|
|
5158
5203
|
resetState();
|
|
5159
5204
|
});
|
|
5160
5205
|
}
|
|
5161
|
-
(0,
|
|
5206
|
+
(0, import_react43.useLayoutEffect)(() => {
|
|
5162
5207
|
var _a, _b;
|
|
5163
5208
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
5164
5209
|
});
|
|
@@ -5166,8 +5211,8 @@ function Table(props) {
|
|
|
5166
5211
|
}
|
|
5167
5212
|
function TableLoadingState({ isHydrated }) {
|
|
5168
5213
|
const loadingText = useTheme((t2) => t2.text.loading);
|
|
5169
|
-
const [showLoading, setShowLoading] = (0,
|
|
5170
|
-
(0,
|
|
5214
|
+
const [showLoading, setShowLoading] = (0, import_react43.useState)(false);
|
|
5215
|
+
(0, import_react43.useEffect)(() => {
|
|
5171
5216
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
5172
5217
|
return () => clearTimeout(handle);
|
|
5173
5218
|
});
|
|
@@ -5176,7 +5221,7 @@ function TableLoadingState({ isHydrated }) {
|
|
|
5176
5221
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableInner, { hidden: !isHydrated })
|
|
5177
5222
|
] });
|
|
5178
5223
|
}
|
|
5179
|
-
var TableInner = (0,
|
|
5224
|
+
var TableInner = (0, import_react43.memo)(function TableInner2({ hidden }) {
|
|
5180
5225
|
const table = useTableContext();
|
|
5181
5226
|
const fullWidth = table.useState((state) => state.props.fullWidth);
|
|
5182
5227
|
const visibleColumns = table.useState(
|
|
@@ -5210,7 +5255,7 @@ var TableInner = (0, import_react42.memo)(function TableInner2({ hidden }) {
|
|
|
5210
5255
|
);
|
|
5211
5256
|
const cssVariables = useCssVariables();
|
|
5212
5257
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
5213
|
-
(0,
|
|
5258
|
+
(0, import_react43.useLayoutEffect)(() => {
|
|
5214
5259
|
var _a, _b;
|
|
5215
5260
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
5216
5261
|
});
|