@tanstack/table-core 9.0.0-beta.10 → 9.0.0-beta.12
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/core/cells/coreCellsFeature.types.d.cts +3 -3
- package/dist/core/cells/coreCellsFeature.types.d.ts +3 -3
- package/dist/core/columns/coreColumnsFeature.types.d.cts +4 -4
- package/dist/core/columns/coreColumnsFeature.types.d.ts +4 -4
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +5 -5
- package/dist/core/headers/coreHeadersFeature.types.d.ts +5 -5
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -3
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -3
- package/dist/core/row-models/createCoreRowModel.cjs +1 -2
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +2 -2
- package/dist/core/row-models/createCoreRowModel.d.ts +2 -2
- package/dist/core/row-models/createCoreRowModel.js +1 -2
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
- package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +4 -4
- package/dist/core/table/coreTablesFeature.types.d.ts +4 -4
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +4 -4
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +4 -4
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +9 -9
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +9 -9
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -6
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -6
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +1 -4
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +1 -4
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +4 -4
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +4 -4
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +3 -3
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +3 -3
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +2 -2
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +2 -2
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +7 -7
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +7 -7
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +2 -2
- package/dist/helpers/columnHelper.d.ts +2 -2
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/types/Cell.d.cts +1 -1
- package/dist/types/Cell.d.ts +1 -1
- package/dist/types/Column.d.cts +4 -4
- package/dist/types/Column.d.ts +4 -4
- package/dist/types/ColumnDef.d.cts +3 -3
- package/dist/types/ColumnDef.d.ts +3 -3
- package/dist/types/Header.d.cts +1 -1
- package/dist/types/Header.d.ts +1 -1
- package/dist/types/HeaderGroup.d.cts +2 -2
- package/dist/types/HeaderGroup.d.ts +2 -2
- package/dist/types/Row.d.cts +2 -2
- package/dist/types/Row.d.ts +2 -2
- package/dist/types/RowModel.d.cts +2 -2
- package/dist/types/RowModel.d.ts +2 -2
- package/dist/types/RowModelFns.d.cts +2 -2
- package/dist/types/RowModelFns.d.ts +2 -2
- package/dist/types/Table.d.cts +21 -12
- package/dist/types/Table.d.ts +21 -12
- package/dist/types/TableOptions.d.cts +11 -5
- package/dist/types/TableOptions.d.ts +11 -5
- package/dist/types/TableState.d.cts +1 -1
- package/dist/types/TableState.d.ts +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +7 -2
- package/dist/utils.d.ts +7 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/cells/coreCellsFeature.types.ts +6 -6
- package/src/core/columns/coreColumnsFeature.types.ts +8 -8
- package/src/core/columns/coreColumnsFeature.utils.ts +1 -1
- package/src/core/headers/buildHeaderGroups.ts +3 -1
- package/src/core/headers/coreHeadersFeature.types.ts +10 -10
- package/src/core/row-models/coreRowModelsFeature.types.ts +6 -6
- package/src/core/row-models/createCoreRowModel.ts +5 -4
- package/src/core/rows/coreRowsFeature.types.ts +8 -8
- package/src/core/table/constructTable.ts +1 -1
- package/src/core/table/coreTablesFeature.types.ts +8 -8
- package/src/core/table/coreTablesFeature.utils.ts +8 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +8 -8
- package/src/features/column-filtering/columnFilteringFeature.types.ts +18 -18
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +1 -1
- package/src/features/column-grouping/columnGroupingFeature.types.ts +12 -12
- package/src/features/column-ordering/columnOrderingFeature.types.ts +2 -2
- package/src/features/column-pinning/columnPinningFeature.types.ts +4 -4
- package/src/features/column-pinning/columnPinningFeature.utils.ts +6 -14
- package/src/features/column-resizing/columnResizingFeature.types.ts +1 -4
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +1 -1
- package/src/features/row-expanding/rowExpandingFeature.types.ts +8 -8
- package/src/features/row-pagination/rowPaginationFeature.types.ts +6 -6
- package/src/features/row-pinning/rowPinningFeature.types.ts +4 -4
- package/src/features/row-selection/rowSelectionFeature.types.ts +4 -4
- package/src/features/row-sorting/rowSortingFeature.types.ts +14 -14
- package/src/helpers/columnHelper.ts +4 -4
- package/src/types/Cell.ts +2 -2
- package/src/types/Column.ts +8 -8
- package/src/types/ColumnDef.ts +6 -6
- package/src/types/Header.ts +2 -2
- package/src/types/HeaderGroup.ts +6 -6
- package/src/types/Row.ts +4 -4
- package/src/types/RowModel.ts +7 -7
- package/src/types/RowModelFns.ts +7 -7
- package/src/types/Table.ts +51 -25
- package/src/types/TableOptions.ts +54 -12
- package/src/types/TableState.ts +15 -1
- package/src/utils.ts +11 -2
package/dist/types/Column.d.cts
CHANGED
|
@@ -14,8 +14,8 @@ import { Column_ColumnFaceting } from "../features/column-faceting/columnFacetin
|
|
|
14
14
|
import { Column_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
15
15
|
|
|
16
16
|
//#region src/types/Column.d.ts
|
|
17
|
-
interface Column_Core<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
18
|
-
interface Column_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
17
|
+
interface Column_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
18
|
+
interface Column_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
19
19
|
columnFacetingFeature: Column_ColumnFaceting<TFeatures, TData>;
|
|
20
20
|
columnFilteringFeature: Column_ColumnFiltering<TFeatures, TData>;
|
|
21
21
|
columnGroupingFeature: Column_ColumnGrouping<TFeatures, TData>;
|
|
@@ -28,9 +28,9 @@ interface Column_FeatureMap<TFeatures extends TableFeatures, TData extends RowDa
|
|
|
28
28
|
rowSortingFeature: Column_RowSorting<TFeatures, TData>;
|
|
29
29
|
}
|
|
30
30
|
type Column<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown> = Column_Core<TFeatures, TData, TValue> & ExtractFeatureMapTypes<TFeatures, Column_FeatureMap<TFeatures, TData>>;
|
|
31
|
-
|
|
31
|
+
interface Column_Internal<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Omit<Column_Core<TFeatures, TData, TValue>, 'columnDef'> {
|
|
32
32
|
columnDef: ColumnDefBase_All<TFeatures, TData, TValue>;
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
//#endregion
|
|
35
35
|
export { Column, Column_Core, Column_FeatureMap, Column_Internal };
|
|
36
36
|
//# sourceMappingURL=Column.d.cts.map
|
package/dist/types/Column.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ import { Column_ColumnFaceting } from "../features/column-faceting/columnFacetin
|
|
|
14
14
|
import { Column_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
15
15
|
|
|
16
16
|
//#region src/types/Column.d.ts
|
|
17
|
-
interface Column_Core<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
18
|
-
interface Column_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
17
|
+
interface Column_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
18
|
+
interface Column_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
19
19
|
columnFacetingFeature: Column_ColumnFaceting<TFeatures, TData>;
|
|
20
20
|
columnFilteringFeature: Column_ColumnFiltering<TFeatures, TData>;
|
|
21
21
|
columnGroupingFeature: Column_ColumnGrouping<TFeatures, TData>;
|
|
@@ -28,9 +28,9 @@ interface Column_FeatureMap<TFeatures extends TableFeatures, TData extends RowDa
|
|
|
28
28
|
rowSortingFeature: Column_RowSorting<TFeatures, TData>;
|
|
29
29
|
}
|
|
30
30
|
type Column<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown> = Column_Core<TFeatures, TData, TValue> & ExtractFeatureMapTypes<TFeatures, Column_FeatureMap<TFeatures, TData>>;
|
|
31
|
-
|
|
31
|
+
interface Column_Internal<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Omit<Column_Core<TFeatures, TData, TValue>, 'columnDef'> {
|
|
32
32
|
columnDef: ColumnDefBase_All<TFeatures, TData, TValue>;
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
//#endregion
|
|
35
35
|
export { Column, Column_Core, Column_FeatureMap, Column_Internal };
|
|
36
36
|
//# sourceMappingURL=Column.d.ts.map
|
|
@@ -12,7 +12,7 @@ import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.cj
|
|
|
12
12
|
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
13
13
|
|
|
14
14
|
//#region src/types/ColumnDef.d.ts
|
|
15
|
-
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {}
|
|
15
|
+
interface ColumnMeta<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {}
|
|
16
16
|
/**
|
|
17
17
|
* Resolves the type of `columnDef.meta` for a feature set.
|
|
18
18
|
*
|
|
@@ -49,7 +49,7 @@ interface StringHeaderIdentifier {
|
|
|
49
49
|
*/
|
|
50
50
|
id?: string;
|
|
51
51
|
}
|
|
52
|
-
interface IdIdentifier<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
52
|
+
interface IdIdentifier<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
53
53
|
/**
|
|
54
54
|
* Explicit stable column id.
|
|
55
55
|
*/
|
|
@@ -83,7 +83,7 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
83
83
|
*/
|
|
84
84
|
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
85
85
|
}
|
|
86
|
-
interface ColumnDef_FeatureMap<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> {
|
|
86
|
+
interface ColumnDef_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData> {
|
|
87
87
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
88
88
|
columnPinningFeature: ColumnDef_ColumnPinning;
|
|
89
89
|
columnFilteringFeature: ColumnDef_ColumnFiltering<TFeatures, TData>;
|
|
@@ -12,7 +12,7 @@ import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.js
|
|
|
12
12
|
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
13
13
|
|
|
14
14
|
//#region src/types/ColumnDef.d.ts
|
|
15
|
-
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {}
|
|
15
|
+
interface ColumnMeta<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {}
|
|
16
16
|
/**
|
|
17
17
|
* Resolves the type of `columnDef.meta` for a feature set.
|
|
18
18
|
*
|
|
@@ -49,7 +49,7 @@ interface StringHeaderIdentifier {
|
|
|
49
49
|
*/
|
|
50
50
|
id?: string;
|
|
51
51
|
}
|
|
52
|
-
interface IdIdentifier<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
52
|
+
interface IdIdentifier<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
53
53
|
/**
|
|
54
54
|
* Explicit stable column id.
|
|
55
55
|
*/
|
|
@@ -83,7 +83,7 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
83
83
|
*/
|
|
84
84
|
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
85
85
|
}
|
|
86
|
-
interface ColumnDef_FeatureMap<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> {
|
|
86
|
+
interface ColumnDef_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData> {
|
|
87
87
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
88
88
|
columnPinningFeature: ColumnDef_ColumnPinning;
|
|
89
89
|
columnFilteringFeature: ColumnDef_ColumnFiltering<TFeatures, TData>;
|
package/dist/types/Header.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { Header_Header } from "../core/headers/coreHeadersFeature.types.cjs";
|
|
|
5
5
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/types/Header.d.ts
|
|
8
|
-
interface Header_Core<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Header_Header<TFeatures, TData, TValue> {}
|
|
8
|
+
interface Header_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Header_Header<TFeatures, TData, TValue> {}
|
|
9
9
|
interface Header_FeatureMap {
|
|
10
10
|
columnSizingFeature: Header_ColumnSizing;
|
|
11
11
|
columnResizingFeature: Header_ColumnResizing;
|
package/dist/types/Header.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Header_Header } from "../core/headers/coreHeadersFeature.types.js";
|
|
|
5
5
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/types/Header.d.ts
|
|
8
|
-
interface Header_Core<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Header_Header<TFeatures, TData, TValue> {}
|
|
8
|
+
interface Header_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Header_Header<TFeatures, TData, TValue> {}
|
|
9
9
|
interface Header_FeatureMap {
|
|
10
10
|
columnSizingFeature: Header_ColumnSizing;
|
|
11
11
|
columnResizingFeature: Header_ColumnResizing;
|
|
@@ -3,8 +3,8 @@ import { HeaderGroup_Header } from "../core/headers/coreHeadersFeature.types.cjs
|
|
|
3
3
|
import { TableFeatures } from "./TableFeatures.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/types/HeaderGroup.d.ts
|
|
6
|
-
interface HeaderGroup_Core<TFeatures extends TableFeatures, TData extends RowData> extends HeaderGroup_Header<TFeatures, TData> {}
|
|
7
|
-
|
|
6
|
+
interface HeaderGroup_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends HeaderGroup_Header<TFeatures, TData> {}
|
|
7
|
+
interface HeaderGroup<in out TFeatures extends TableFeatures, in out TData extends RowData> extends HeaderGroup_Core<TFeatures, TData> {}
|
|
8
8
|
//#endregion
|
|
9
9
|
export { HeaderGroup, HeaderGroup_Core };
|
|
10
10
|
//# sourceMappingURL=HeaderGroup.d.cts.map
|
|
@@ -3,8 +3,8 @@ import { HeaderGroup_Header } from "../core/headers/coreHeadersFeature.types.js"
|
|
|
3
3
|
import { TableFeatures } from "./TableFeatures.js";
|
|
4
4
|
|
|
5
5
|
//#region src/types/HeaderGroup.d.ts
|
|
6
|
-
interface HeaderGroup_Core<TFeatures extends TableFeatures, TData extends RowData> extends HeaderGroup_Header<TFeatures, TData> {}
|
|
7
|
-
|
|
6
|
+
interface HeaderGroup_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends HeaderGroup_Header<TFeatures, TData> {}
|
|
7
|
+
interface HeaderGroup<in out TFeatures extends TableFeatures, in out TData extends RowData> extends HeaderGroup_Core<TFeatures, TData> {}
|
|
8
8
|
//#endregion
|
|
9
9
|
export { HeaderGroup, HeaderGroup_Core };
|
|
10
10
|
//# sourceMappingURL=HeaderGroup.d.ts.map
|
package/dist/types/Row.d.cts
CHANGED
|
@@ -10,8 +10,8 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
|
10
10
|
import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
11
11
|
|
|
12
12
|
//#region src/types/Row.d.ts
|
|
13
|
-
interface Row_Core<TFeatures extends TableFeatures, TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
|
-
interface Row_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
13
|
+
interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
|
+
interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
15
15
|
columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
|
|
16
16
|
columnGroupingFeature: Row_ColumnGrouping;
|
|
17
17
|
columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
|
package/dist/types/Row.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
|
10
10
|
import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
11
11
|
|
|
12
12
|
//#region src/types/Row.d.ts
|
|
13
|
-
interface Row_Core<TFeatures extends TableFeatures, TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
|
-
interface Row_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
13
|
+
interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
|
+
interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
15
15
|
columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
|
|
16
16
|
columnGroupingFeature: Row_ColumnGrouping;
|
|
17
17
|
columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
|
|
@@ -9,7 +9,7 @@ import { CachedRowModel_Core, RowModel } from "../core/row-models/coreRowModelsF
|
|
|
9
9
|
import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
10
10
|
|
|
11
11
|
//#region src/types/RowModel.d.ts
|
|
12
|
-
interface CachedRowModels_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
|
+
interface CachedRowModels_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
13
13
|
columnFacetingFeature: CachedRowModel_Faceted<TFeatures, TData>;
|
|
14
14
|
columnFilteringFeature: CachedRowModel_Filtered<TFeatures, TData>;
|
|
15
15
|
rowExpandingFeature: CachedRowModel_Expanded<TFeatures, TData>;
|
|
@@ -20,7 +20,7 @@ interface CachedRowModels_FeatureMap<TFeatures extends TableFeatures, TData exte
|
|
|
20
20
|
type CachedRowModels<TFeatures extends TableFeatures, TData extends RowData> = {
|
|
21
21
|
CachedRowModel_Core: () => RowModel<TFeatures, TData>;
|
|
22
22
|
} & ExtractFeatureMapTypes<TFeatures, CachedRowModels_FeatureMap<TFeatures, TData>>;
|
|
23
|
-
|
|
23
|
+
interface CachedRowModel_All<in out TFeatures extends TableFeatures, in out TData extends RowData = any> extends Partial<CachedRowModel_Core<TFeatures, TData> & CachedRowModel_Expanded<TFeatures, TData> & CachedRowModel_Faceted<TFeatures, TData> & CachedRowModel_Filtered<TFeatures, TData> & CachedRowModel_Grouped<TFeatures, TData> & CachedRowModel_Paginated<TFeatures, TData> & CachedRowModel_Sorted<TFeatures, TData>> {}
|
|
24
24
|
//#endregion
|
|
25
25
|
export { CachedRowModel_All, CachedRowModels, CachedRowModels_FeatureMap };
|
|
26
26
|
//# sourceMappingURL=RowModel.d.cts.map
|
package/dist/types/RowModel.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { CachedRowModel_Core, RowModel } from "../core/row-models/coreRowModelsF
|
|
|
9
9
|
import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
10
10
|
|
|
11
11
|
//#region src/types/RowModel.d.ts
|
|
12
|
-
interface CachedRowModels_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
|
+
interface CachedRowModels_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
13
13
|
columnFacetingFeature: CachedRowModel_Faceted<TFeatures, TData>;
|
|
14
14
|
columnFilteringFeature: CachedRowModel_Filtered<TFeatures, TData>;
|
|
15
15
|
rowExpandingFeature: CachedRowModel_Expanded<TFeatures, TData>;
|
|
@@ -20,7 +20,7 @@ interface CachedRowModels_FeatureMap<TFeatures extends TableFeatures, TData exte
|
|
|
20
20
|
type CachedRowModels<TFeatures extends TableFeatures, TData extends RowData> = {
|
|
21
21
|
CachedRowModel_Core: () => RowModel<TFeatures, TData>;
|
|
22
22
|
} & ExtractFeatureMapTypes<TFeatures, CachedRowModels_FeatureMap<TFeatures, TData>>;
|
|
23
|
-
|
|
23
|
+
interface CachedRowModel_All<in out TFeatures extends TableFeatures, in out TData extends RowData = any> extends Partial<CachedRowModel_Core<TFeatures, TData> & CachedRowModel_Expanded<TFeatures, TData> & CachedRowModel_Faceted<TFeatures, TData> & CachedRowModel_Filtered<TFeatures, TData> & CachedRowModel_Grouped<TFeatures, TData> & CachedRowModel_Paginated<TFeatures, TData> & CachedRowModel_Sorted<TFeatures, TData>> {}
|
|
24
24
|
//#endregion
|
|
25
25
|
export { CachedRowModel_All, CachedRowModels, CachedRowModels_FeatureMap };
|
|
26
26
|
//# sourceMappingURL=RowModel.d.ts.map
|
|
@@ -6,13 +6,13 @@ import { RowModelFns_ColumnGrouping } from "../features/column-grouping/columnGr
|
|
|
6
6
|
|
|
7
7
|
//#region src/types/RowModelFns.d.ts
|
|
8
8
|
interface RowModelFns_Core {}
|
|
9
|
-
interface RowModelFns_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
9
|
+
interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
|
|
11
11
|
columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
|
|
12
12
|
rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
|
|
13
13
|
}
|
|
14
14
|
type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
|
|
15
|
-
|
|
15
|
+
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_ColumnGrouping<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
|
|
16
16
|
//#endregion
|
|
17
17
|
export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
|
|
18
18
|
//# sourceMappingURL=RowModelFns.d.cts.map
|
|
@@ -6,13 +6,13 @@ import { RowModelFns_ColumnGrouping } from "../features/column-grouping/columnGr
|
|
|
6
6
|
|
|
7
7
|
//#region src/types/RowModelFns.d.ts
|
|
8
8
|
interface RowModelFns_Core {}
|
|
9
|
-
interface RowModelFns_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
9
|
+
interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
|
|
11
11
|
columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
|
|
12
12
|
rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
|
|
13
13
|
}
|
|
14
14
|
type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
|
|
15
|
-
|
|
15
|
+
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_ColumnGrouping<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
|
|
16
16
|
//#endregion
|
|
17
17
|
export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
|
|
18
18
|
//# sourceMappingURL=RowModelFns.d.ts.map
|
package/dist/types/Table.d.cts
CHANGED
|
@@ -16,9 +16,9 @@ import { Table_ColumnFiltering } from "../features/column-filtering/columnFilter
|
|
|
16
16
|
import { Table_RowPagination } from "../features/row-pagination/rowPaginationFeature.types.cjs";
|
|
17
17
|
import { CachedRowModel_All } from "./RowModel.cjs";
|
|
18
18
|
import { RowModelFns_All } from "./RowModelFns.cjs";
|
|
19
|
-
import { TableState_All } from "./TableState.cjs";
|
|
20
|
-
import { TableOptions_All } from "./TableOptions.cjs";
|
|
21
|
-
import { Atoms_All, BaseAtoms_All, ExternalAtoms_All, Table_Table } from "../core/table/coreTablesFeature.types.cjs";
|
|
19
|
+
import { TableState, TableState_All } from "./TableState.cjs";
|
|
20
|
+
import { DebugOptions, TableOptions_All } from "./TableOptions.cjs";
|
|
21
|
+
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms_All, Table_Table } from "../core/table/coreTablesFeature.types.cjs";
|
|
22
22
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
23
23
|
import { Table_ColumnFaceting } from "../features/column-faceting/columnFacetingFeature.types.cjs";
|
|
24
24
|
import { Table_RowModels } from "../core/row-models/coreRowModelsFeature.types.cjs";
|
|
@@ -30,8 +30,8 @@ import { ReadonlyStore } from "@tanstack/store";
|
|
|
30
30
|
* The core table object that only includes the core table functionality such as column, header, row, and table APIS.
|
|
31
31
|
* No features are included.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
interface Table_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
33
|
+
interface Table_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Table_Table<TFeatures, TData>, Table_Columns<TFeatures, TData>, Table_Rows<TFeatures, TData>, Table_RowModels<TFeatures, TData>, Table_Headers<TFeatures, TData> {}
|
|
34
|
+
interface Table_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
35
35
|
columnFilteringFeature: Table_ColumnFiltering;
|
|
36
36
|
columnGroupingFeature: Table_ColumnGrouping<TFeatures, TData>;
|
|
37
37
|
columnOrderingFeature: Table_ColumnOrdering<TFeatures, TData>;
|
|
@@ -51,19 +51,28 @@ interface Table_FeatureMap<TFeatures extends TableFeatures, TData extends RowDat
|
|
|
51
51
|
* The table object that includes both the core table functionality and the features that are enabled via the `features` table option.
|
|
52
52
|
*/
|
|
53
53
|
type Table<TFeatures extends TableFeatures, TData extends RowData> = Table_Core<TFeatures, TData> & ExtractFeatureMapTypes<TFeatures, Table_FeatureMap<TFeatures, TData>>;
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* `Table_Table` members that `Table_Internal` re-declares with broadened
|
|
56
|
+
* (all-features) types so internal code can read any feature's slots and
|
|
57
|
+
* construction code can assign them.
|
|
58
|
+
*/
|
|
59
|
+
type Table_InternalBroadenedKeys = '_rowModels' | '_rowModelFns' | 'options' | 'initialState' | 'store';
|
|
60
|
+
/**
|
|
61
|
+
* Internal broad table shape used by feature implementations.
|
|
62
|
+
*/
|
|
63
|
+
interface Table_Internal<in out TFeatures extends TableFeatures, in out TData extends RowData = any> extends Omit<Table_Table<TFeatures, TData>, Table_InternalBroadenedKeys>, Table_Columns<TFeatures, TData>, Table_Rows<TFeatures, TData>, Table_RowModels<TFeatures, TData>, Table_Headers<TFeatures, TData> {
|
|
55
64
|
_rowModels: CachedRowModel_All<TFeatures, TData>;
|
|
56
65
|
_rowModelFns: RowModelFns_All<TFeatures, TData>;
|
|
57
|
-
options: TableOptions_All<TFeatures, TData> & {
|
|
66
|
+
options: DebugOptions<TableFeatures> & TableOptions_All<TFeatures, TData> & {
|
|
58
67
|
state?: TableState_All;
|
|
59
68
|
initialState?: TableState_All;
|
|
60
69
|
atoms?: ExternalAtoms_All;
|
|
61
70
|
};
|
|
62
|
-
initialState: TableState_All;
|
|
63
|
-
baseAtoms: BaseAtoms_All;
|
|
64
|
-
atoms: Atoms_All;
|
|
65
|
-
store: ReadonlyStore<TableState_All>;
|
|
66
|
-
}
|
|
71
|
+
initialState: TableState<TFeatures> & TableState_All;
|
|
72
|
+
baseAtoms: BaseAtoms<TFeatures> & BaseAtoms_All;
|
|
73
|
+
atoms: Atoms<TFeatures> & Atoms_All;
|
|
74
|
+
store: ReadonlyStore<TableState<TFeatures>> & ReadonlyStore<TableState_All>;
|
|
75
|
+
}
|
|
67
76
|
//#endregion
|
|
68
77
|
export { Table, Table_Core, Table_FeatureMap, Table_Internal };
|
|
69
78
|
//# sourceMappingURL=Table.d.cts.map
|
package/dist/types/Table.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ import { Table_ColumnFiltering } from "../features/column-filtering/columnFilter
|
|
|
16
16
|
import { Table_RowPagination } from "../features/row-pagination/rowPaginationFeature.types.js";
|
|
17
17
|
import { CachedRowModel_All } from "./RowModel.js";
|
|
18
18
|
import { RowModelFns_All } from "./RowModelFns.js";
|
|
19
|
-
import { TableState_All } from "./TableState.js";
|
|
20
|
-
import { TableOptions_All } from "./TableOptions.js";
|
|
21
|
-
import { Atoms_All, BaseAtoms_All, ExternalAtoms_All, Table_Table } from "../core/table/coreTablesFeature.types.js";
|
|
19
|
+
import { TableState, TableState_All } from "./TableState.js";
|
|
20
|
+
import { DebugOptions, TableOptions_All } from "./TableOptions.js";
|
|
21
|
+
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms_All, Table_Table } from "../core/table/coreTablesFeature.types.js";
|
|
22
22
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
23
23
|
import { Table_ColumnFaceting } from "../features/column-faceting/columnFacetingFeature.types.js";
|
|
24
24
|
import { Table_RowModels } from "../core/row-models/coreRowModelsFeature.types.js";
|
|
@@ -30,8 +30,8 @@ import { ReadonlyStore } from "@tanstack/store";
|
|
|
30
30
|
* The core table object that only includes the core table functionality such as column, header, row, and table APIS.
|
|
31
31
|
* No features are included.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
interface Table_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
33
|
+
interface Table_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Table_Table<TFeatures, TData>, Table_Columns<TFeatures, TData>, Table_Rows<TFeatures, TData>, Table_RowModels<TFeatures, TData>, Table_Headers<TFeatures, TData> {}
|
|
34
|
+
interface Table_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
35
35
|
columnFilteringFeature: Table_ColumnFiltering;
|
|
36
36
|
columnGroupingFeature: Table_ColumnGrouping<TFeatures, TData>;
|
|
37
37
|
columnOrderingFeature: Table_ColumnOrdering<TFeatures, TData>;
|
|
@@ -51,19 +51,28 @@ interface Table_FeatureMap<TFeatures extends TableFeatures, TData extends RowDat
|
|
|
51
51
|
* The table object that includes both the core table functionality and the features that are enabled via the `features` table option.
|
|
52
52
|
*/
|
|
53
53
|
type Table<TFeatures extends TableFeatures, TData extends RowData> = Table_Core<TFeatures, TData> & ExtractFeatureMapTypes<TFeatures, Table_FeatureMap<TFeatures, TData>>;
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* `Table_Table` members that `Table_Internal` re-declares with broadened
|
|
56
|
+
* (all-features) types so internal code can read any feature's slots and
|
|
57
|
+
* construction code can assign them.
|
|
58
|
+
*/
|
|
59
|
+
type Table_InternalBroadenedKeys = '_rowModels' | '_rowModelFns' | 'options' | 'initialState' | 'store';
|
|
60
|
+
/**
|
|
61
|
+
* Internal broad table shape used by feature implementations.
|
|
62
|
+
*/
|
|
63
|
+
interface Table_Internal<in out TFeatures extends TableFeatures, in out TData extends RowData = any> extends Omit<Table_Table<TFeatures, TData>, Table_InternalBroadenedKeys>, Table_Columns<TFeatures, TData>, Table_Rows<TFeatures, TData>, Table_RowModels<TFeatures, TData>, Table_Headers<TFeatures, TData> {
|
|
55
64
|
_rowModels: CachedRowModel_All<TFeatures, TData>;
|
|
56
65
|
_rowModelFns: RowModelFns_All<TFeatures, TData>;
|
|
57
|
-
options: TableOptions_All<TFeatures, TData> & {
|
|
66
|
+
options: DebugOptions<TableFeatures> & TableOptions_All<TFeatures, TData> & {
|
|
58
67
|
state?: TableState_All;
|
|
59
68
|
initialState?: TableState_All;
|
|
60
69
|
atoms?: ExternalAtoms_All;
|
|
61
70
|
};
|
|
62
|
-
initialState: TableState_All;
|
|
63
|
-
baseAtoms: BaseAtoms_All;
|
|
64
|
-
atoms: Atoms_All;
|
|
65
|
-
store: ReadonlyStore<TableState_All>;
|
|
66
|
-
}
|
|
71
|
+
initialState: TableState<TFeatures> & TableState_All;
|
|
72
|
+
baseAtoms: BaseAtoms<TFeatures> & BaseAtoms_All;
|
|
73
|
+
atoms: Atoms<TFeatures> & Atoms_All;
|
|
74
|
+
store: ReadonlyStore<TableState<TFeatures>> & ReadonlyStore<TableState_All>;
|
|
75
|
+
}
|
|
67
76
|
//#endregion
|
|
68
77
|
export { Table, Table_Core, Table_FeatureMap, Table_Internal };
|
|
69
78
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -24,7 +24,7 @@ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnG
|
|
|
24
24
|
* Core options that are always available on a table, before optional feature
|
|
25
25
|
* options are mixed in.
|
|
26
26
|
*/
|
|
27
|
-
interface TableOptions_Core<TFeatures extends TableFeatures, TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
27
|
+
interface TableOptions_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
28
28
|
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in Exclude<keyof TFeatures & string, NonFeatureKeys> as `debug${Capitalize<K>}`]?: boolean };
|
|
29
29
|
type DebugOptions<TFeatures extends TableFeatures> = {
|
|
30
30
|
debugAll?: boolean;
|
|
@@ -35,7 +35,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
|
|
|
35
35
|
debugRows?: boolean;
|
|
36
36
|
debugTable?: boolean;
|
|
37
37
|
} & DebugKeysFor<CoreFeatures & TFeatures>;
|
|
38
|
-
interface TableOptions_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
38
|
+
interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
39
39
|
columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
|
|
40
40
|
columnGroupingFeature: TableOptions_ColumnGrouping;
|
|
41
41
|
columnOrderingFeature: TableOptions_ColumnOrdering;
|
|
@@ -50,7 +50,13 @@ interface TableOptions_FeatureMap<TFeatures extends TableFeatures, TData extends
|
|
|
50
50
|
rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
|
|
51
51
|
rowSortingFeature: TableOptions_RowSorting;
|
|
52
52
|
}
|
|
53
|
-
type
|
|
53
|
+
type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
54
|
+
/**
|
|
55
|
+
* Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
|
|
56
|
+
* beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
|
|
57
|
+
* plugins are merged so the common case skips the union-to-intersection work.
|
|
58
|
+
*/
|
|
59
|
+
type TableOptions_PluginFeatureMapTypes<TFeatures extends TableFeatures, TData extends RowData> = [Exclude<keyof TableOptions_FeatureMap<TFeatures, TData>, TableOptions_StockFeatureKeys>] extends [never] ? unknown : UnionToIntersection<TableOptions_FeatureMap<TFeatures, TData>[Exclude<keyof TableOptions_FeatureMap<TFeatures, TData>, TableOptions_StockFeatureKeys>]>;
|
|
54
60
|
/**
|
|
55
61
|
* Complete table options for a specific feature set.
|
|
56
62
|
*
|
|
@@ -63,7 +69,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
|
|
|
63
69
|
* Internal broad option shape used where feature code may need to read options
|
|
64
70
|
* from features that are not present in the current generic feature set.
|
|
65
71
|
*/
|
|
66
|
-
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<
|
|
72
|
+
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
67
73
|
//#endregion
|
|
68
|
-
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap
|
|
74
|
+
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
|
|
69
75
|
//# sourceMappingURL=TableOptions.d.cts.map
|
|
@@ -24,7 +24,7 @@ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnG
|
|
|
24
24
|
* Core options that are always available on a table, before optional feature
|
|
25
25
|
* options are mixed in.
|
|
26
26
|
*/
|
|
27
|
-
interface TableOptions_Core<TFeatures extends TableFeatures, TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
27
|
+
interface TableOptions_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
28
28
|
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in Exclude<keyof TFeatures & string, NonFeatureKeys> as `debug${Capitalize<K>}`]?: boolean };
|
|
29
29
|
type DebugOptions<TFeatures extends TableFeatures> = {
|
|
30
30
|
debugAll?: boolean;
|
|
@@ -35,7 +35,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
|
|
|
35
35
|
debugRows?: boolean;
|
|
36
36
|
debugTable?: boolean;
|
|
37
37
|
} & DebugKeysFor<CoreFeatures & TFeatures>;
|
|
38
|
-
interface TableOptions_FeatureMap<TFeatures extends TableFeatures, TData extends RowData> {
|
|
38
|
+
interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
39
39
|
columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
|
|
40
40
|
columnGroupingFeature: TableOptions_ColumnGrouping;
|
|
41
41
|
columnOrderingFeature: TableOptions_ColumnOrdering;
|
|
@@ -50,7 +50,13 @@ interface TableOptions_FeatureMap<TFeatures extends TableFeatures, TData extends
|
|
|
50
50
|
rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
|
|
51
51
|
rowSortingFeature: TableOptions_RowSorting;
|
|
52
52
|
}
|
|
53
|
-
type
|
|
53
|
+
type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
54
|
+
/**
|
|
55
|
+
* Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
|
|
56
|
+
* beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
|
|
57
|
+
* plugins are merged so the common case skips the union-to-intersection work.
|
|
58
|
+
*/
|
|
59
|
+
type TableOptions_PluginFeatureMapTypes<TFeatures extends TableFeatures, TData extends RowData> = [Exclude<keyof TableOptions_FeatureMap<TFeatures, TData>, TableOptions_StockFeatureKeys>] extends [never] ? unknown : UnionToIntersection<TableOptions_FeatureMap<TFeatures, TData>[Exclude<keyof TableOptions_FeatureMap<TFeatures, TData>, TableOptions_StockFeatureKeys>]>;
|
|
54
60
|
/**
|
|
55
61
|
* Complete table options for a specific feature set.
|
|
56
62
|
*
|
|
@@ -63,7 +69,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
|
|
|
63
69
|
* Internal broad option shape used where feature code may need to read options
|
|
64
70
|
* from features that are not present in the current generic feature set.
|
|
65
71
|
*/
|
|
66
|
-
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<
|
|
72
|
+
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
67
73
|
//#endregion
|
|
68
|
-
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap
|
|
74
|
+
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
|
|
69
75
|
//# sourceMappingURL=TableOptions.d.ts.map
|
|
@@ -42,7 +42,7 @@ type TableState<TFeatures extends TableFeatures> = ExtractFeatureMapTypes<TFeatu
|
|
|
42
42
|
* Feature internals use this when they may need to inspect optional slices owned
|
|
43
43
|
* by other features.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
interface TableState_All extends Partial<TableState_ColumnFiltering & TableState_ColumnGrouping & TableState_ColumnOrdering & TableState_ColumnPinning & TableState_ColumnResizing & TableState_ColumnSizing & TableState_ColumnVisibility & TableState_GlobalFiltering & TableState_RowExpanding & TableState_RowPagination & TableState_RowPinning & TableState_RowSelection & TableState_RowSorting> {}
|
|
46
46
|
//#endregion
|
|
47
47
|
export { TableState, TableState_All, TableState_FeatureMap };
|
|
48
48
|
//# sourceMappingURL=TableState.d.cts.map
|
|
@@ -42,7 +42,7 @@ type TableState<TFeatures extends TableFeatures> = ExtractFeatureMapTypes<TFeatu
|
|
|
42
42
|
* Feature internals use this when they may need to inspect optional slices owned
|
|
43
43
|
* by other features.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
interface TableState_All extends Partial<TableState_ColumnFiltering & TableState_ColumnGrouping & TableState_ColumnOrdering & TableState_ColumnPinning & TableState_ColumnResizing & TableState_ColumnSizing & TableState_ColumnVisibility & TableState_GlobalFiltering & TableState_RowExpanding & TableState_RowPagination & TableState_RowPinning & TableState_RowSelection & TableState_RowSorting> {}
|
|
46
46
|
//#endregion
|
|
47
47
|
export { TableState, TableState_All, TableState_FeatureMap };
|
|
48
48
|
//# sourceMappingURL=TableState.d.ts.map
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { Table, Table_Internal } from './types/Table'\nimport type { NoInfer, RowData, Updater } from './types/type-utils'\nimport type { TableFeatures } from './types/TableFeatures'\nimport type { TableState, TableState_All } from './types/TableState'\n\n/**\n * Applies a TanStack updater to a value.\n *\n * If the updater is a function it is called with the previous value; otherwise the updater value is returned directly.\n */\nexport function functionalUpdate<T>(updater: Updater<T>, input: T): T {\n return typeof updater === 'function'\n ? (updater as (i: T) => T)(input)\n : updater\n}\n\n/**\n * Clones table state values while preserving non-plain objects.\n *\n * Plain objects and arrays are copied recursively so state updates can avoid mutating existing references.\n */\nexport function cloneState<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(cloneState) as T\n }\n\n if (value && typeof value === 'object') {\n const proto = Object.getPrototypeOf(value)\n\n if (proto !== Object.prototype && proto !== null) {\n return value\n }\n\n const copy: Record<string, unknown> = {}\n const keys = Object.keys(value)\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n copy[key] = cloneState((value as Record<string, unknown>)[key])\n }\n\n return copy as T\n }\n\n return value\n}\n\n/**\n * Creates a table state updater for a single state slice.\n *\n * The updater writes through the table base atom for the slice and supports both value and functional updater forms.\n */\nexport function makeStateUpdater<\n TFeatures extends TableFeatures,\n K extends (string & {}) | keyof TableState_All | keyof TableState<TFeatures>,\n>(key: K, instance: Table<TFeatures, any>) {\n return (updater: Updater<TableState<any>[K & keyof TableState<any>]>) => {\n const externalAtom = (instance.options as any).atoms?.[key]\n const targetAtom = externalAtom ?? (instance.baseAtoms as any)[key]\n targetAtom.set((old: any) => functionalUpdate(updater, old))\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\n/**\n * Returns whether a value is a function.\n */\nexport function isFunction<T extends AnyFunction>(d: any): d is T {\n return d instanceof Function\n}\n\n/**\n * Flattens a tree of nodes by recursively reading child nodes.\n *\n * The original nodes are preserved in depth-first order.\n */\nexport function flattenBy<TNode>(\n arr: Array<TNode>,\n getChildren: (item: TNode) => Array<TNode>,\n) {\n const flat: Array<TNode> = []\n\n const recurse = (subArr: Array<TNode>) => {\n subArr.forEach((item) => {\n flat.push(item)\n const children = getChildren(item)\n if (children.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\ninterface MemoOptions<TDeps extends ReadonlyArray<any>, TDepArgs, TResult> {\n fn: (...args: NoInfer<TDeps>) => TResult\n memoDeps?: (depArgs?: TDepArgs) => [...TDeps] | undefined\n onAfterCompare?: (depsChanged: boolean) => void\n onAfterUpdate?: (result: TResult) => void\n onBeforeCompare?: () => void\n onBeforeUpdate?: () => void\n}\n\n/**\n * Creates a dependency-tracked memoized function for table internals.\n *\n * The memo recomputes only when its dependency tuple changes and can emit debug timing information.\n */\nexport const memo = <TDeps extends ReadonlyArray<any>, TDepArgs, TResult>({\n fn,\n memoDeps,\n onAfterCompare,\n onAfterUpdate,\n onBeforeCompare,\n onBeforeUpdate,\n}: MemoOptions<TDeps, TDepArgs, TResult>): ((\n depArgs?: TDepArgs,\n) => TResult) => {\n let deps: Array<any> | undefined = []\n let result: TResult | undefined\n\n const memoizedFn = (depArgs?: TDepArgs): TResult => {\n onBeforeCompare?.()\n const newDeps = memoDeps?.(depArgs)\n let depsChanged = !newDeps || newDeps.length !== deps?.length\n if (!depsChanged && newDeps) {\n for (let i = 0; i < newDeps.length; i++) {\n if (newDeps[i] !== deps![i]) {\n depsChanged = true\n break\n }\n }\n }\n onAfterCompare?.(depsChanged)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n onBeforeUpdate?.()\n result = fn(...(newDeps ?? ([] as any)))\n onAfterUpdate?.(result)\n\n return result\n }\n\n return memoizedFn\n}\n\ninterface TableMemoOptions<\n TFeatures extends TableFeatures,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n TResult,\n> extends MemoOptions<TDeps, TDepArgs, TResult> {\n feature?: keyof TFeatures & string\n fnName: string\n objectId?: string\n onAfterUpdate?: () => void\n table: Table_Internal<TFeatures, any>\n}\n\nconst pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n}\n\n/**\n * Creates a table-aware memoized function.\n *\n * This wraps `memo` with table debug options and feature metadata so row models and derived APIs can share consistent diagnostics.\n */\nexport function tableMemo<\n TFeatures extends TableFeatures,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n TResult,\n>({\n feature,\n fnName,\n objectId,\n onAfterUpdate,\n table,\n ...memoOptions\n}: TableMemoOptions<TFeatures, TDeps, TDepArgs, TResult>) {\n let beforeCompareTime: number\n let afterCompareTime: number\n let startCalcTime: number\n let endCalcTime: number\n let runCount = 0\n let debug: boolean | undefined\n let debugCache: boolean | undefined\n\n if (process.env.NODE_ENV === 'development') {\n const { debugCache: _debugCache, debugAll } = table.options\n debugCache = _debugCache\n const { parentName } = getFunctionNameInfo(fnName, '.')\n\n const debugByParent =\n // @ts-expect-error\n table.options[\n `debug${(parentName != 'table' ? parentName + 's' : parentName).replace(\n parentName,\n parentName.charAt(0).toUpperCase() + parentName.slice(1),\n )}`\n ]\n const debugByFeature = feature\n ? // @ts-expect-error\n table.options[\n `debug${feature.charAt(0).toUpperCase() + feature.slice(1)}`\n ]\n : false\n\n debug = debugAll || debugByParent || debugByFeature\n }\n\n function logTime(time: number, depsChanged: boolean) {\n const runType =\n runCount === 0\n ? '(1st run)'\n : depsChanged\n ? '(rerun #' + runCount + ')'\n : '(cache)'\n runCount++\n\n console.groupCollapsed(\n `%c⏱ ${pad(`${time.toFixed(1)} ms`, 12)} %c${runType}%c ${fnName}%c ${objectId ? `(${fnName.split('.')[0]}Id: ${objectId})` : ''}`,\n `font-size: .6rem; font-weight: bold; ${\n depsChanged\n ? `color: hsl(\n ${Math.max(0, Math.min(120 - Math.log10(time) * 60, 120))}deg 100% 31%);`\n : ''\n } `,\n `color: ${runCount < 2 ? '#FF00FF' : '#FF1493'}`,\n 'color: #666',\n 'color: #87CEEB',\n )\n console.info({\n feature,\n state: table.store.state,\n deps: memoOptions.memoDeps?.toString(),\n })\n console.trace()\n console.groupEnd()\n }\n\n const onAfterUpdateHandler = () => {\n if (!onAfterUpdate) {\n return\n }\n\n const { schedule, untrack } = table._reactivity\n schedule(() => untrack(() => onAfterUpdate()))\n }\n\n const debugOptions =\n process.env.NODE_ENV === 'development'\n ? {\n onBeforeCompare: () => {\n if (debugCache) {\n beforeCompareTime = performance.now()\n }\n },\n onAfterCompare: (depsChanged: boolean) => {\n if (debugCache) {\n afterCompareTime = performance.now()\n const compareTime =\n Math.round((afterCompareTime - beforeCompareTime) * 100) / 100\n if (!depsChanged) {\n logTime(compareTime, depsChanged)\n }\n }\n },\n onBeforeUpdate: () => {\n if (debug) {\n startCalcTime = performance.now()\n }\n },\n onAfterUpdate: () => {\n if (debug) {\n endCalcTime = performance.now()\n const executionTime =\n Math.round((endCalcTime - startCalcTime) * 100) / 100\n logTime(executionTime, true)\n }\n onAfterUpdateHandler()\n },\n }\n : {\n onAfterUpdate: () => {\n onAfterUpdateHandler()\n },\n }\n\n return memo({\n ...memoOptions,\n ...debugOptions,\n })\n}\n\nexport interface API<TDeps extends ReadonlyArray<any>, TDepArgs> {\n fn: (...args: any) => any\n memoDeps?: (depArgs?: any) => [...any] | undefined\n}\n\nexport type APIObject<TDeps extends ReadonlyArray<any>, TDepArgs> = Record<\n string,\n API<TDeps, TDepArgs>\n>\n\n/**\n * Assumes that a function name is in the format of `parentName_fnKey` and returns the `fnKey` and `fnName` in the format of `parentName.fnKey`.\n */\nexport function getFunctionNameInfo(\n staticFnName: string,\n splitBy: '_' | '.' = '_',\n) {\n const [parentName, fnKey] = staticFnName.split(splitBy)\n const fnName = `${parentName}.${fnKey}`\n return { fnKey, fnName, parentName } as {\n fnKey: string\n fnName: string\n parentName: string\n }\n}\n\n/**\n * Assigns Table API methods directly to the table instance.\n * Unlike row/cell/column/header, the table is a singleton so methods are assigned directly.\n */\nexport function assignTableAPIs<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n>(\n feature: keyof TFeatures & string,\n table: Table_Internal<TFeatures, TData>,\n apis: APIObject<TDeps, NoInfer<TDepArgs>>,\n): void {\n for (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n const { fnKey, fnName } = getFunctionNameInfo(staticFnName)\n\n ;(table as Record<string, any>)[fnKey] = memoDeps\n ? tableMemo({\n memoDeps,\n fn,\n fnName,\n table,\n feature,\n })\n : fn\n }\n}\n\nexport interface PrototypeAPI<TDeps extends ReadonlyArray<any>, TDepArgs> {\n fn: (self: any, ...args: any) => any\n memoDeps?: (self: any, depArgs?: any) => [...any] | undefined\n}\n\nexport type PrototypeAPIObject<\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n> = Record<string, PrototypeAPI<TDeps, TDepArgs>>\n\n/**\n * Assigns API methods to a prototype object for memory-efficient method sharing.\n * All instances created with this prototype will share the same method references.\n *\n * For memoized methods, the memo state is lazily created and stored on each instance.\n * This provides the best of both worlds: shared method code + per-instance caching.\n */\nexport function assignPrototypeAPIs<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n>(\n feature: keyof TFeatures & string,\n prototype: Record<string, any>,\n table: Table_Internal<TFeatures, TData>,\n apis: PrototypeAPIObject<TDeps, NoInfer<TDepArgs>>,\n): void {\n for (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n const { fnKey, fnName } = getFunctionNameInfo(staticFnName)\n\n if (memoDeps) {\n // For memoized methods, create a function that lazily initializes\n // the memo on first access and stores it on the instance\n const memoKey = `_memo_${fnKey}`\n\n prototype[fnKey] = function (this: any, ...args: Array<any>) {\n // Lazily create memo on first access for this instance\n if (!this[memoKey]) {\n const self = this\n this[memoKey] = tableMemo({\n memoDeps: (depArgs) => memoDeps(self, depArgs),\n fn: (...deps) => fn(self, ...deps),\n fnName,\n objectId: self.id,\n table,\n feature,\n })\n }\n return this[memoKey](...args)\n }\n } else {\n // Non-memoized methods just call the static function with `this`\n prototype[fnKey] = function (this: any, ...args: Array<any>) {\n return fn(this, ...args)\n }\n }\n }\n}\n\n/**\n * Looks to run the memoized function with the builder pattern on the object if it exists, otherwise fallback to the static method passed in.\n */\nexport function callMemoOrStaticFn<\n TObject extends Record<string, any>,\n TArgs extends Array<any>,\n TReturn,\n>(\n obj: TObject,\n fnKey: string,\n staticFn: (obj: TObject, ...args: TArgs) => TReturn,\n ...args: TArgs\n): TReturn {\n return (\n (obj[fnKey] as Function | undefined)?.(...args) ?? staticFn(obj, ...args)\n )\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,iBAAoB,SAAqB,OAAa;CACpE,OAAO,OAAO,YAAY,aACrB,QAAwB,KAAK,IAC9B;AACN;;;;;;AAOA,SAAgB,WAAc,OAAa;CACzC,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,IAAI,UAAU;CAG7B,IAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,QAAQ,OAAO,eAAe,KAAK;EAEzC,IAAI,UAAU,OAAO,aAAa,UAAU,MAC1C,OAAO;EAGT,MAAM,OAAgC,CAAC;EACvC,MAAM,OAAO,OAAO,KAAK,KAAK;EAE9B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GACjB,KAAK,OAAO,WAAY,MAAkC,IAAI;EAChE;EAEA,OAAO;CACT;CAEA,OAAO;AACT;;;;;;AAOA,SAAgB,iBAGd,KAAQ,UAAiC;CACzC,QAAQ,YAAiE;;EAGvE,YAFsB,SAAS,QAAgB,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A,UAAU,KAAK;MACf;MACA;KACF,CAAC;IACH;IACA,OAAO,KAAK,QAAQ,CAAC,GAAG,IAAI;GAC9B;EACF,OAEE,UAAU,SAAS,SAAqB,GAAG,MAAkB;GAC3D,OAAO,GAAG,MAAM,GAAG,IAAI;EACzB;CAEJ;AACF;;;;AAKA,SAAgB,mBAKd,KACA,OACA,UACA,GAAG,MACM;;CACT,sBACG,IAAI,0EAAkC,GAAG,IAAI,MAAK,SAAS,KAAK,GAAG,IAAI;AAE5E"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { Table_Internal } from './types/Table'\nimport type { NoInfer, RowData, Updater } from './types/type-utils'\nimport type { TableFeatures } from './types/TableFeatures'\nimport type { TableState, TableState_All } from './types/TableState'\n\n/**\n * Applies a TanStack updater to a value.\n *\n * If the updater is a function it is called with the previous value; otherwise the updater value is returned directly.\n */\nexport function functionalUpdate<T>(updater: Updater<T>, input: T): T {\n return typeof updater === 'function'\n ? (updater as (i: T) => T)(input)\n : updater\n}\n\n/**\n * Clones table state values while preserving non-plain objects.\n *\n * Plain objects and arrays are copied recursively so state updates can avoid mutating existing references.\n */\nexport function cloneState<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(cloneState) as T\n }\n\n if (value && typeof value === 'object') {\n const proto = Object.getPrototypeOf(value)\n\n if (proto !== Object.prototype && proto !== null) {\n return value\n }\n\n const copy: Record<string, unknown> = {}\n const keys = Object.keys(value)\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n copy[key] = cloneState((value as Record<string, unknown>)[key])\n }\n\n return copy as T\n }\n\n return value\n}\n\n/**\n * Creates a table state updater for a single state slice.\n *\n * The updater writes through the table base atom for the slice and supports both value and functional updater forms.\n */\nexport function makeStateUpdater<\n TFeatures extends TableFeatures,\n K extends (string & {}) | keyof TableState_All | keyof TableState<TFeatures>,\n>(\n key: K,\n // Minimal structural shape so any table view (public `Table`,\n // `Table_Internal`, or a custom plugin table) can be passed without forcing\n // the compiler to relate the full table types.\n instance: {\n readonly options: { readonly atoms?: object | undefined }\n readonly baseAtoms: object\n },\n) {\n return (updater: Updater<TableState<any>[K & keyof TableState<any>]>) => {\n const externalAtom = (instance.options as any).atoms?.[key]\n const targetAtom = externalAtom ?? (instance.baseAtoms as any)[key]\n targetAtom.set((old: any) => functionalUpdate(updater, old))\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\n/**\n * Returns whether a value is a function.\n */\nexport function isFunction<T extends AnyFunction>(d: any): d is T {\n return d instanceof Function\n}\n\n/**\n * Flattens a tree of nodes by recursively reading child nodes.\n *\n * The original nodes are preserved in depth-first order.\n */\nexport function flattenBy<TNode>(\n arr: Array<TNode>,\n getChildren: (item: TNode) => Array<TNode>,\n) {\n const flat: Array<TNode> = []\n\n const recurse = (subArr: Array<TNode>) => {\n subArr.forEach((item) => {\n flat.push(item)\n const children = getChildren(item)\n if (children.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\ninterface MemoOptions<TDeps extends ReadonlyArray<any>, TDepArgs, TResult> {\n fn: (...args: NoInfer<TDeps>) => TResult\n memoDeps?: (depArgs?: TDepArgs) => [...TDeps] | undefined\n onAfterCompare?: (depsChanged: boolean) => void\n onAfterUpdate?: (result: TResult) => void\n onBeforeCompare?: () => void\n onBeforeUpdate?: () => void\n}\n\n/**\n * Creates a dependency-tracked memoized function for table internals.\n *\n * The memo recomputes only when its dependency tuple changes and can emit debug timing information.\n */\nexport const memo = <TDeps extends ReadonlyArray<any>, TDepArgs, TResult>({\n fn,\n memoDeps,\n onAfterCompare,\n onAfterUpdate,\n onBeforeCompare,\n onBeforeUpdate,\n}: MemoOptions<TDeps, TDepArgs, TResult>): ((\n depArgs?: TDepArgs,\n) => TResult) => {\n let deps: Array<any> | undefined = []\n let result: TResult | undefined\n\n const memoizedFn = (depArgs?: TDepArgs): TResult => {\n onBeforeCompare?.()\n const newDeps = memoDeps?.(depArgs)\n let depsChanged = !newDeps || newDeps.length !== deps?.length\n if (!depsChanged && newDeps) {\n for (let i = 0; i < newDeps.length; i++) {\n if (newDeps[i] !== deps![i]) {\n depsChanged = true\n break\n }\n }\n }\n onAfterCompare?.(depsChanged)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n onBeforeUpdate?.()\n result = fn(...(newDeps ?? ([] as any)))\n onAfterUpdate?.(result)\n\n return result\n }\n\n return memoizedFn\n}\n\ninterface TableMemoOptions<\n TFeatures extends TableFeatures,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n TResult,\n> extends MemoOptions<TDeps, TDepArgs, TResult> {\n feature?: keyof TFeatures & string\n fnName: string\n objectId?: string\n onAfterUpdate?: () => void\n table: Table_Internal<TFeatures, any>\n}\n\nconst pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n}\n\n/**\n * Creates a table-aware memoized function.\n *\n * This wraps `memo` with table debug options and feature metadata so row models and derived APIs can share consistent diagnostics.\n */\nexport function tableMemo<\n TFeatures extends TableFeatures,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n TResult,\n>({\n feature,\n fnName,\n objectId,\n onAfterUpdate,\n table,\n ...memoOptions\n}: TableMemoOptions<TFeatures, TDeps, TDepArgs, TResult>) {\n let beforeCompareTime: number\n let afterCompareTime: number\n let startCalcTime: number\n let endCalcTime: number\n let runCount = 0\n let debug: boolean | undefined\n let debugCache: boolean | undefined\n\n if (process.env.NODE_ENV === 'development') {\n const { debugCache: _debugCache, debugAll } = table.options\n debugCache = _debugCache\n const { parentName } = getFunctionNameInfo(fnName, '.')\n\n const debugByParent =\n // @ts-expect-error\n table.options[\n `debug${(parentName != 'table' ? parentName + 's' : parentName).replace(\n parentName,\n parentName.charAt(0).toUpperCase() + parentName.slice(1),\n )}`\n ]\n const debugByFeature = feature\n ? // @ts-expect-error\n table.options[\n `debug${feature.charAt(0).toUpperCase() + feature.slice(1)}`\n ]\n : false\n\n debug = debugAll || debugByParent || debugByFeature\n }\n\n function logTime(time: number, depsChanged: boolean) {\n const runType =\n runCount === 0\n ? '(1st run)'\n : depsChanged\n ? '(rerun #' + runCount + ')'\n : '(cache)'\n runCount++\n\n console.groupCollapsed(\n `%c⏱ ${pad(`${time.toFixed(1)} ms`, 12)} %c${runType}%c ${fnName}%c ${objectId ? `(${fnName.split('.')[0]}Id: ${objectId})` : ''}`,\n `font-size: .6rem; font-weight: bold; ${\n depsChanged\n ? `color: hsl(\n ${Math.max(0, Math.min(120 - Math.log10(time) * 60, 120))}deg 100% 31%);`\n : ''\n } `,\n `color: ${runCount < 2 ? '#FF00FF' : '#FF1493'}`,\n 'color: #666',\n 'color: #87CEEB',\n )\n console.info({\n feature,\n state: table.store.state,\n deps: memoOptions.memoDeps?.toString(),\n })\n console.trace()\n console.groupEnd()\n }\n\n const onAfterUpdateHandler = () => {\n if (!onAfterUpdate) {\n return\n }\n\n const { schedule, untrack } = table._reactivity\n schedule(() => untrack(() => onAfterUpdate()))\n }\n\n const debugOptions =\n process.env.NODE_ENV === 'development'\n ? {\n onBeforeCompare: () => {\n if (debugCache) {\n beforeCompareTime = performance.now()\n }\n },\n onAfterCompare: (depsChanged: boolean) => {\n if (debugCache) {\n afterCompareTime = performance.now()\n const compareTime =\n Math.round((afterCompareTime - beforeCompareTime) * 100) / 100\n if (!depsChanged) {\n logTime(compareTime, depsChanged)\n }\n }\n },\n onBeforeUpdate: () => {\n if (debug) {\n startCalcTime = performance.now()\n }\n },\n onAfterUpdate: () => {\n if (debug) {\n endCalcTime = performance.now()\n const executionTime =\n Math.round((endCalcTime - startCalcTime) * 100) / 100\n logTime(executionTime, true)\n }\n onAfterUpdateHandler()\n },\n }\n : {\n onAfterUpdate: () => {\n onAfterUpdateHandler()\n },\n }\n\n return memo({\n ...memoOptions,\n ...debugOptions,\n })\n}\n\nexport interface API<TDeps extends ReadonlyArray<any>, TDepArgs> {\n fn: (...args: any) => any\n memoDeps?: (depArgs?: any) => [...any] | undefined\n}\n\nexport type APIObject<TDeps extends ReadonlyArray<any>, TDepArgs> = Record<\n string,\n API<TDeps, TDepArgs>\n>\n\n/**\n * Assumes that a function name is in the format of `parentName_fnKey` and returns the `fnKey` and `fnName` in the format of `parentName.fnKey`.\n */\nexport function getFunctionNameInfo(\n staticFnName: string,\n splitBy: '_' | '.' = '_',\n) {\n const [parentName, fnKey] = staticFnName.split(splitBy)\n const fnName = `${parentName}.${fnKey}`\n return { fnKey, fnName, parentName } as {\n fnKey: string\n fnName: string\n parentName: string\n }\n}\n\n/**\n * Assigns Table API methods directly to the table instance.\n * Unlike row/cell/column/header, the table is a singleton so methods are assigned directly.\n */\nexport function assignTableAPIs<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n>(\n feature: keyof TFeatures & string,\n table: Table_Internal<TFeatures, TData>,\n apis: APIObject<TDeps, NoInfer<TDepArgs>>,\n): void {\n for (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n const { fnKey, fnName } = getFunctionNameInfo(staticFnName)\n\n ;(table as Record<string, any>)[fnKey] = memoDeps\n ? tableMemo({\n memoDeps,\n fn,\n fnName,\n table,\n feature,\n })\n : fn\n }\n}\n\nexport interface PrototypeAPI<TDeps extends ReadonlyArray<any>, TDepArgs> {\n fn: (self: any, ...args: any) => any\n memoDeps?: (self: any, depArgs?: any) => [...any] | undefined\n}\n\nexport type PrototypeAPIObject<\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n> = Record<string, PrototypeAPI<TDeps, TDepArgs>>\n\n/**\n * Assigns API methods to a prototype object for memory-efficient method sharing.\n * All instances created with this prototype will share the same method references.\n *\n * For memoized methods, the memo state is lazily created and stored on each instance.\n * This provides the best of both worlds: shared method code + per-instance caching.\n */\nexport function assignPrototypeAPIs<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TDeps extends ReadonlyArray<any>,\n TDepArgs,\n>(\n feature: keyof TFeatures & string,\n prototype: Record<string, any>,\n table: Table_Internal<TFeatures, TData>,\n apis: PrototypeAPIObject<TDeps, NoInfer<TDepArgs>>,\n): void {\n for (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n const { fnKey, fnName } = getFunctionNameInfo(staticFnName)\n\n if (memoDeps) {\n // For memoized methods, create a function that lazily initializes\n // the memo on first access and stores it on the instance\n const memoKey = `_memo_${fnKey}`\n\n prototype[fnKey] = function (this: any, ...args: Array<any>) {\n // Lazily create memo on first access for this instance\n if (!this[memoKey]) {\n const self = this\n this[memoKey] = tableMemo({\n memoDeps: (depArgs) => memoDeps(self, depArgs),\n fn: (...deps) => fn(self, ...deps),\n fnName,\n objectId: self.id,\n table,\n feature,\n })\n }\n return this[memoKey](...args)\n }\n } else {\n // Non-memoized methods just call the static function with `this`\n prototype[fnKey] = function (this: any, ...args: Array<any>) {\n return fn(this, ...args)\n }\n }\n }\n}\n\n/**\n * Looks to run the memoized function with the builder pattern on the object if it exists, otherwise fallback to the static method passed in.\n */\nexport function callMemoOrStaticFn<\n TObject extends Record<string, any>,\n TArgs extends Array<any>,\n TReturn,\n>(\n obj: TObject,\n fnKey: string,\n staticFn: (obj: TObject, ...args: TArgs) => TReturn,\n ...args: TArgs\n): TReturn {\n return (\n (obj[fnKey] as Function | undefined)?.(...args) ?? staticFn(obj, ...args)\n )\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,iBAAoB,SAAqB,OAAa;CACpE,OAAO,OAAO,YAAY,aACrB,QAAwB,KAAK,IAC9B;AACN;;;;;;AAOA,SAAgB,WAAc,OAAa;CACzC,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,IAAI,UAAU;CAG7B,IAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,QAAQ,OAAO,eAAe,KAAK;EAEzC,IAAI,UAAU,OAAO,aAAa,UAAU,MAC1C,OAAO;EAGT,MAAM,OAAgC,CAAC;EACvC,MAAM,OAAO,OAAO,KAAK,KAAK;EAE9B,KAAK,IAAI,IAAI,GAA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U,SAAS;GAEzB,UAAU,SAAS,SAAqB,GAAG,MAAkB;IAE3D,IAAI,CAAC,KAAK,UAAU;KAClB,MAAM,OAAO;KACb,KAAK,WAAW,UAAU;MACxB,WAAW,YAAY,SAAS,MAAM,OAAO;MAC7C,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI;MACjC;MACA,UAAU,KAAK;MACf;MACA;KACF,CAAC;IACH;IACA,OAAO,KAAK,QAAQ,CAAC,GAAG,IAAI;GAC9B;EACF,OAEE,UAAU,SAAS,SAAqB,GAAG,MAAkB;GAC3D,OAAO,GAAG,MAAM,GAAG,IAAI;EACzB;CAEJ;AACF;;;;AAKA,SAAgB,mBAKd,KACA,OACA,UACA,GAAG,MACM;;CACT,sBACG,IAAI,0EAAkC,GAAG,IAAI,MAAK,SAAS,KAAK,GAAG,IAAI;AAE5E"}
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NoInfer, RowData, Updater } from "./types/type-utils.cjs";
|
|
2
2
|
import { TableState, TableState_All } from "./types/TableState.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Table_Internal } from "./types/Table.cjs";
|
|
4
4
|
import { TableFeatures } from "./types/TableFeatures.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/utils.d.ts
|
|
@@ -21,7 +21,12 @@ declare function cloneState<T>(value: T): T;
|
|
|
21
21
|
*
|
|
22
22
|
* The updater writes through the table base atom for the slice and supports both value and functional updater forms.
|
|
23
23
|
*/
|
|
24
|
-
declare function makeStateUpdater<TFeatures extends TableFeatures, K extends (string & {}) | keyof TableState_All | keyof TableState<TFeatures>>(key: K, instance:
|
|
24
|
+
declare function makeStateUpdater<TFeatures extends TableFeatures, K extends (string & {}) | keyof TableState_All | keyof TableState<TFeatures>>(key: K, instance: {
|
|
25
|
+
readonly options: {
|
|
26
|
+
readonly atoms?: object | undefined;
|
|
27
|
+
};
|
|
28
|
+
readonly baseAtoms: object;
|
|
29
|
+
}): (updater: Updater<TableState<any>[K & keyof TableState<any>]>) => void;
|
|
25
30
|
type AnyFunction = (...args: any) => any;
|
|
26
31
|
/**
|
|
27
32
|
* Returns whether a value is a function.
|