Skip to content

Commit d6ef043

Browse files
committed
fix webpack error, no longer fn.name
1 parent b241718 commit d6ef043

37 files changed

+901
-469
lines changed

examples/angular/basic/src/app/app.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ const defaultData: Array<Person> = [
4242
},
4343
]
4444

45-
const defaultColumns: Array<ColumnDef<any, Person>> = [
45+
const _features = tableFeatures({})
46+
47+
const defaultColumns: Array<ColumnDef<typeof _features, Person>> = [
4648
{
4749
accessorKey: 'firstName',
4850
cell: (info) => info.getValue(),
@@ -86,10 +88,8 @@ const defaultColumns: Array<ColumnDef<any, Person>> = [
8688
export class AppComponent {
8789
readonly data = signal<Array<Person>>(defaultData)
8890

89-
readonly tableFeatures = tableFeatures({})
90-
9191
table = injectTable(() => ({
92-
_features: this.tableFeatures, // new required option in V9. Tell the table which features you are importing and using (better tree-shaking)
92+
_features, // new required option in V9. Tell the table which features you are importing and using (better tree-shaking)
9393
_rowModels: {}, // `Core` row model is now included by default, but you can still override it here
9494
data: this.data(),
9595
columns: defaultColumns,

examples/react/basic/src/main.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ const columns: Array<ColumnDef<typeof _features, Person>> = [
8181
id: 'age',
8282
header: () => 'Age',
8383
cell: (info) => {
84-
console.log('info test value')
8584
return info.renderValue()
8685
},
8786
},

packages/table-core/src/core/cells/coreCellsFeature.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ export const coreCellsFeature: TableFeature<{
1414
assignAPIs(cell, [
1515
{
1616
fn: () => cell_getValue(cell),
17+
fnName: 'cell_getValue',
1718
},
1819
{
1920
fn: () => cell_renderValue(cell),
21+
fnName: 'cell_renderValue',
2022
},
2123
{
2224
fn: () => cell_getContext(cell),
25+
fnName: 'cell_getContext',
2326
memoDeps: () => [cell],
2427
},
2528
])

packages/table-core/src/core/columns/coreColumnsFeature.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ export const coreColumnsFeature: TableFeature<{
2222
assignAPIs(column, [
2323
{
2424
fn: () => column_getFlatColumns(column),
25+
fnName: 'column_getFlatColumns',
2526
memoDeps: () => [table.options.columns],
2627
},
2728
{
2829
fn: () => column_getLeafColumns(column),
30+
fnName: 'column_getLeafColumns',
2931
memoDeps: () => [
3032
table.options.state?.columnOrder,
3133
table.options.state?.grouping,
@@ -40,22 +42,27 @@ export const coreColumnsFeature: TableFeature<{
4042
assignAPIs(table, [
4143
{
4244
fn: () => table_getDefaultColumnDef(table),
45+
fnName: 'table_getDefaultColumnDef',
4346
memoDeps: () => [table.options.defaultColumn],
4447
},
4548
{
4649
fn: () => table_getAllColumns(table),
50+
fnName: 'table_getAllColumns',
4751
memoDeps: () => [table.options.columns],
4852
},
4953
{
5054
fn: () => table_getAllFlatColumns(table),
55+
fnName: 'table_getAllFlatColumns',
5156
memoDeps: () => [table.options.columns],
5257
},
5358
{
5459
fn: () => table_getAllFlatColumnsById(table),
60+
fnName: 'table_getAllFlatColumnsById',
5561
memoDeps: () => [table.options.columns],
5662
},
5763
{
5864
fn: () => table_getAllLeafColumns(table),
65+
fnName: 'table_getAllLeafColumns',
5966
memoDeps: () => [
6067
table.options.state?.columnOrder,
6168
table.options.state?.grouping,
@@ -65,6 +72,7 @@ export const coreColumnsFeature: TableFeature<{
6572
},
6673
{
6774
fn: (columnId) => table_getColumn(table, columnId),
75+
fnName: 'table_getColumn',
6876
},
6977
])
7078
},

packages/table-core/src/core/columns/coreColumnsFeature.utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function column_getLeafColumns<
3535

3636
return callMemoOrStaticFn(
3737
column._table,
38+
'getOrderColumns',
3839
table_getOrderColumnsFn,
3940
)(leafColumns as any) as any
4041
}
@@ -137,6 +138,7 @@ export function table_getAllLeafColumns<
137138
)
138139
return callMemoOrStaticFn(
139140
table,
141+
'getOrderColumns',
140142
table_getOrderColumnsFn,
141143
)(leafColumns as any) as any
142144
}

packages/table-core/src/core/headers/buildHeaderGroups.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export function buildHeaderGroups<
3333
maxDepth = Math.max(maxDepth, depth)
3434

3535
columns
36-
.filter((column) => callMemoOrStaticFn(column, column_getIsVisible))
36+
.filter((column) =>
37+
callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),
38+
)
3739
.forEach((column) => {
3840
if (column.columns.length) {
3941
findMaxDepth(column.columns, depth + 1)
@@ -136,7 +138,11 @@ export function buildHeaderGroups<
136138
headers: Array<Header<TFeatures, TData, TValue>>,
137139
): Array<{ colSpan: number; rowSpan: number }> => {
138140
const filteredHeaders = headers.filter((header) =>
139-
callMemoOrStaticFn(header.column, column_getIsVisible),
141+
callMemoOrStaticFn(
142+
header.column,
143+
'getIsVisible',
144+
column_getIsVisible,
145+
),
140146
)
141147

142148
return filteredHeaders.map((header) => {

packages/table-core/src/core/headers/coreHeadersFeature.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export const coreHeadersFeature: TableFeature<{
2424
assignAPIs(header, [
2525
{
2626
fn: () => header_getLeafHeaders(header),
27+
fnName: 'header_getLeafHeaders',
2728
memoDeps: () => [header.column._table.options.columns],
2829
},
2930
{
3031
fn: () => header_getContext(header),
32+
fnName: 'header_getContext',
3133
memoDeps: () => [header.column._table.options.columns],
3234
},
3335
])
@@ -37,6 +39,7 @@ export const coreHeadersFeature: TableFeature<{
3739
assignAPIs(table, [
3840
{
3941
fn: () => table_getHeaderGroups(table),
42+
fnName: 'table_getHeaderGroups',
4043
memoDeps: () => [
4144
table.options.columns,
4245
table.options.state?.columnOrder,
@@ -47,18 +50,21 @@ export const coreHeadersFeature: TableFeature<{
4750
},
4851
{
4952
fn: () => table_getFooterGroups(table),
53+
fnName: 'table_getFooterGroups',
5054
memoDeps: () => [table.getHeaderGroups()],
5155
},
5256
{
5357
fn: () => table_getFlatHeaders(table),
58+
fnName: 'table_getFlatHeaders',
5459
memoDeps: () => [table.getHeaderGroups()],
5560
},
5661
{
5762
fn: () => table_getLeafHeaders(table),
63+
fnName: 'table_getLeafHeaders',
5864
memoDeps: () => [
59-
callMemoOrStaticFn(table, table_getLeftHeaderGroups),
60-
callMemoOrStaticFn(table, table_getCenterHeaderGroups),
61-
callMemoOrStaticFn(table, table_getRightHeaderGroups),
65+
callMemoOrStaticFn(table, 'getLeftHeaderGroups', table_getLeftHeaderGroups),
66+
callMemoOrStaticFn(table, 'getCenterHeaderGroups', table_getCenterHeaderGroups),
67+
callMemoOrStaticFn(table, 'getRightHeaderGroups', table_getRightHeaderGroups),
6268
],
6369
},
6470
])

packages/table-core/src/core/headers/coreHeadersFeature.utils.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function table_getHeaderGroups<
5454
const allColumns = table.getAllColumns()
5555
const leafColumns = callMemoOrStaticFn(
5656
table,
57+
'getVisibleLeafColumns',
5758
table_getVisibleLeafColumns,
5859
) as unknown as Array<Column<TFeatures, TData, unknown>>
5960

@@ -102,9 +103,21 @@ export function table_getLeafHeaders<
102103
TFeatures extends TableFeatures,
103104
TData extends RowData,
104105
>(table: Table_Internal<TFeatures, TData>) {
105-
const left = callMemoOrStaticFn(table, table_getLeftHeaderGroups)
106-
const center = callMemoOrStaticFn(table, table_getCenterHeaderGroups)
107-
const right = callMemoOrStaticFn(table, table_getRightHeaderGroups)
106+
const left = callMemoOrStaticFn(
107+
table,
108+
'getLeftHeaderGroups',
109+
table_getLeftHeaderGroups,
110+
)
111+
const center = callMemoOrStaticFn(
112+
table,
113+
'getCenterHeaderGroups',
114+
table_getCenterHeaderGroups,
115+
)
116+
const right = callMemoOrStaticFn(
117+
table,
118+
'getRightHeaderGroups',
119+
table_getRightHeaderGroups,
120+
)
108121

109122
return [
110123
...(left[0]?.headers ?? []),

packages/table-core/src/core/row-models/coreRowModelsFeature.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,51 @@ export const coreRowModelsFeature: TableFeature<{
2424
assignAPIs(table, [
2525
{
2626
fn: () => table_getCoreRowModel(table),
27+
fnName: 'table_getCoreRowModel',
2728
},
2829
{
2930
fn: () => table_getPreFilteredRowModel(table),
31+
fnName: 'table_getPreFilteredRowModel',
3032
},
3133
{
3234
fn: () => table_getFilteredRowModel(table),
35+
fnName: 'table_getFilteredRowModel',
3336
},
3437
{
3538
fn: () => table_getPreGroupedRowModel(table),
39+
fnName: 'table_getPreGroupedRowModel',
3640
},
3741
{
3842
fn: () => table_getGroupedRowModel(table),
43+
fnName: 'table_getGroupedRowModel',
3944
},
4045
{
4146
fn: () => table_getPreSortedRowModel(table),
47+
fnName: 'table_getPreSortedRowModel',
4248
},
4349
{
4450
fn: () => table_getSortedRowModel(table),
51+
fnName: 'table_getSortedRowModel',
4552
},
4653
{
4754
fn: () => table_getPreExpandedRowModel(table),
55+
fnName: 'table_getPreExpandedRowModel',
4856
},
4957
{
5058
fn: () => table_getExpandedRowModel(table),
59+
fnName: 'table_getExpandedRowModel',
5160
},
5261
{
5362
fn: () => table_getPrePaginatedRowModel(table),
63+
fnName: 'table_getPrePaginatedRowModel',
5464
},
5565
{
5666
fn: () => table_getPaginatedRowModel(table),
67+
fnName: 'table_getPaginatedRowModel',
5768
},
5869
{
5970
fn: () => table_getRowModel(table),
71+
fnName: 'table_getRowModel',
6072
},
6173
])
6274
},

packages/table-core/src/core/rows/coreRowsFeature.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,37 @@ export const coreRowsFeature: TableFeature<{
2323
assignAPIs(row, [
2424
{
2525
fn: () => row_getAllCellsByColumnId(row),
26+
fnName: 'row_getAllCellsByColumnId',
2627
memoDeps: () => [row.getAllCells()],
2728
},
2829
{
2930
fn: () => row_getAllCells(row),
31+
fnName: 'row_getAllCells',
3032
memoDeps: () => [row._table.getAllLeafColumns()],
3133
},
3234
{
3335
fn: () => row_getLeafRows(row),
36+
fnName: 'row_getLeafRows',
3437
},
3538
{
3639
fn: () => row_getParentRow(row),
40+
fnName: 'row_getParentRow',
3741
},
3842
{
3943
fn: () => row_getParentRows(row),
44+
fnName: 'row_getParentRows',
4045
},
4146
{
4247
fn: (columnId) => row_getUniqueValues(row, columnId),
48+
fnName: 'row_getUniqueValues',
4349
},
4450
{
4551
fn: (columnId) => row_getValue(row, columnId),
52+
fnName: 'row_getValue',
4653
},
4754
{
4855
fn: (columnId) => row_renderValue(row, columnId),
56+
fnName: 'row_renderValue',
4957
},
5058
])
5159
},
@@ -54,11 +62,13 @@ export const coreRowsFeature: TableFeature<{
5462
assignAPIs(table, [
5563
{
5664
fn: (row, index, parent) => table_getRowId(row, table, index, parent),
65+
fnName: 'table_getRowId',
5766
},
5867
{
5968
// in next version, we should just pass in the row model as the optional 3rd arg
6069
fn: (id: string, searchAll?: boolean) =>
6170
table_getRow(table, id, searchAll),
71+
fnName: 'table_getRow',
6272
},
6373
])
6474
},

0 commit comments

Comments
 (0)