@tanstack/react-table 8.0.0-alpha.82 → 8.0.0-alpha.83
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/build/cjs/react-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +62 -49
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +62 -49
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +17 -17
- package/build/types/index.d.ts +2 -2
- package/build/umd/index.development.js +62 -49
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +3 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\n// const useIsomorphicLayoutEffect =\n// typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n createTableInstance,\n TableOptions,\n TableInstance,\n Table,\n TableGenerics,\n createTableFactory,\n Overwrite,\n PartialKeys,\n TableOptionsResolved,\n} from '@tanstack/table-core'\n\nexport type Renderable<TProps> =\n | React.ReactNode\n | React.FunctionComponent<TProps>\n | React.Component<TProps>\n\nexport type Render = <TProps extends {}>(\n Comp: Renderable<TProps>,\n props: TProps\n) => React.ReactNode | JSX.Element\n\nexport type ReactTableGenerics = Overwrite<\n TableGenerics,\n { Renderer: Render; Rendered: ReturnType<Render> }\n>\n\n//\n\nexport const render: Render = (Comp, props) =>\n !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp\n\nfunction isReactComponent(component: unknown): component is React.FC {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport const createTable = createTableFactory({ render })\n\n// const useIsomorphicLayoutEffect =\n// typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type UseTableInstanceOptions<TGenerics extends ReactTableGenerics> =\n TableOptions<TGenerics>\n\nexport function useTableInstance<TGenerics extends ReactTableGenerics>(\n table: Table<TGenerics>,\n options: UseTableInstanceOptions<TGenerics>\n): TableInstance<TGenerics> {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n ...options,\n }\n\n // Create a new table instance and store it in state\n const [instanceRef] = React.useState(() => ({\n current: createTableInstance<TGenerics>(resolvedOptions),\n }))\n\n // By default, manage table state here using the instance's initial state\n const [state, setState] = React.useState(\n () => instanceRef.current.initialState\n )\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n instanceRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return instanceRef.current\n}\n"],"names":["render","Comp","props","isReactComponent","React","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","createTable","createTableFactory","useTableInstance","table","options","resolvedOptions","state","onStateChange","instanceRef","useState","current","createTableInstance","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA;AAEO,MAAMA,MAAc,GAAG,CAACC,IAAD,EAAOC,KAAP,KAC5B,CAACD,IAAD,GAAQ,IAAR,GAAeE,gBAAgB,CAACF,IAAD,CAAhB,gBAAyBG,gBAAA,CAAA,aAAA,CAAC,IAAD,EAAUF,KAAV,CAAzB,GAA+CD,KADzD;;AAGP,SAASE,gBAAT,CAA0BE,SAA1B,EAAqE;AACnE,EAAA,OACEC,gBAAgB,CAACD,SAAD,CAAhB,IACA,OAAOA,SAAP,KAAqB,UADrB,IAEAE,iBAAiB,CAACF,SAAD,CAHnB,CAAA;AAKD,CAAA;;AAED,SAASC,gBAAT,CAA0BD,SAA1B,EAA0C;AACxC,EAAA,OACE,OAAOA,SAAP,KAAqB,UAArB,IACA,CAAC,MAAM;AACL,IAAA,MAAMG,KAAK,GAAGC,MAAM,CAACC,cAAP,CAAsBL,SAAtB,CAAd,CAAA;AACA,IAAOG,OAAAA,KAAK,CAACG,SAAN,IAAmBH,KAAK,CAACG,SAAN,CAAgBR,gBAA1C,CAAA;AACD,GAHD,GAFF,CAAA;AAOD,CAAA;;AAED,SAASI,iBAAT,CAA2BF,SAA3B,EAA2C;AACzC,EACE,OAAA,OAAOA,SAAP,KAAqB,QAArB,IACA,OAAOA,SAAS,CAACO,QAAjB,KAA8B,QAD9B,IAEA,CAAC,YAAD,EAAe,mBAAf,CAAA,CAAoCC,QAApC,CAA6CR,SAAS,CAACO,QAAV,CAAmBE,WAAhE,CAHF,CAAA;AAKD,CAAA;;AAEYC,MAAAA,WAAW,GAAGC,wBAAkB,CAAC;AAAEhB,EAAAA,MAAAA;AAAF,CAAD;AAG7C;;AAKO,SAASiB,gBAAT,CACLC,KADK,EAELC,OAFK,EAGqB;AAC1B;AACA,EAAA,MAAMC,eAAgD,GAAG,EACvD,GAAGF,KAAK,CAACC,OAD8C;AAEvDE,IAAAA,KAAK,EAAE,EAFgD;AAE5C;AACXC,IAAAA,aAAa,EAAE,MAAM,EAHkC;AAG9B;AACzBtB,IAAAA,MAJuD;AAKvD,IAAGmB,GAAAA,OAAAA;AALoD,GAAzD,CAF0B;;AAW1B,EAAA,MAAM,CAACI,WAAD,CAAA,GAAgBnB,gBAAK,CAACoB,QAAN,CAAe,OAAO;AAC1CC,IAAAA,OAAO,EAAEC,yBAAmB,CAAYN,eAAZ,CAAA;AADc,GAAP,CAAf,CAAtB,CAX0B;;AAgB1B,EAAA,MAAM,CAACC,KAAD,EAAQM,QAAR,CAAA,GAAoBvB,gBAAK,CAACoB,QAAN,CACxB,MAAMD,WAAW,CAACE,OAAZ,CAAoBG,YADF,CAA1B,CAhB0B;AAqB1B;;AACAL,EAAAA,WAAW,CAACE,OAAZ,CAAoBI,UAApB,CAA+BC,IAAI,KAAK,EACtC,GAAGA,IADmC;AAEtC,IAAA,GAAGX,OAFmC;AAGtCE,IAAAA,KAAK,EAAE,EACL,GAAGA,KADE;AAEL,MAAA,GAAGF,OAAO,CAACE,KAAAA;AAFN,KAH+B;AAOtC;AACA;AACAC,IAAAA,aAAa,EAAES,OAAO,IAAI;AACxBJ,MAAAA,QAAQ,CAACI,OAAD,CAAR,CAAA;AACAZ,MAAAA,OAAO,CAACG,aAAR,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAH,OAAO,CAACG,aAAR,CAAwBS,OAAxB,CAAA,CAAA;AACD,KAAA;AAZqC,GAAL,CAAnC,CAAA,CAAA;AAeA,EAAOR,OAAAA,WAAW,CAACE,OAAnB,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -103,7 +103,7 @@ function memo(getDeps, fn, opts) {
|
|
|
103
103
|
const Columns = {
|
|
104
104
|
createInstance: instance => {
|
|
105
105
|
return {
|
|
106
|
-
|
|
106
|
+
getDefaultColumnDef: memo(() => [instance.options.defaultColumnDef], defaultColumn => {
|
|
107
107
|
var _defaultColumn;
|
|
108
108
|
|
|
109
109
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
@@ -116,7 +116,7 @@ const Columns = {
|
|
|
116
116
|
return (_props$getValue$toStr = (_props$getValue$toStr2 = (_props$getValue = props.getValue()).toString) == null ? void 0 : _props$getValue$toStr2.call(_props$getValue)) != null ? _props$getValue$toStr : null;
|
|
117
117
|
},
|
|
118
118
|
...instance._features.reduce((obj, feature) => {
|
|
119
|
-
return Object.assign(obj, feature.
|
|
119
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
120
120
|
}, {}),
|
|
121
121
|
...defaultColumn
|
|
122
122
|
};
|
|
@@ -126,13 +126,16 @@ const Columns = {
|
|
|
126
126
|
|
|
127
127
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
|
|
128
128
|
},
|
|
129
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
129
|
+
key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
|
|
130
130
|
}),
|
|
131
131
|
getColumnDefs: () => instance.options.columns,
|
|
132
132
|
createColumn: (columnDef, depth, parent) => {
|
|
133
133
|
var _ref, _columnDef$id;
|
|
134
134
|
|
|
135
|
-
const
|
|
135
|
+
const defaultColumnDef = instance.getDefaultColumnDef();
|
|
136
|
+
columnDef = { ...defaultColumnDef,
|
|
137
|
+
...columnDef
|
|
138
|
+
};
|
|
136
139
|
let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
|
|
137
140
|
let accessorFn;
|
|
138
141
|
|
|
@@ -150,8 +153,7 @@ const Columns = {
|
|
|
150
153
|
throw new Error();
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
let column = { ...
|
|
154
|
-
...columnDef,
|
|
156
|
+
let column = { ...columnDef,
|
|
155
157
|
id: "" + id,
|
|
156
158
|
accessorFn,
|
|
157
159
|
parent: parent,
|
|
@@ -387,7 +389,7 @@ const Cells = {
|
|
|
387
389
|
row,
|
|
388
390
|
column,
|
|
389
391
|
getValue: () => row.getValue(columnId),
|
|
390
|
-
renderCell: () => column.cell ? instance._render(column.cell, {
|
|
392
|
+
renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
391
393
|
instance,
|
|
392
394
|
column,
|
|
393
395
|
row,
|
|
@@ -446,7 +448,7 @@ const getDefaultColumnSizingInfoState = () => ({
|
|
|
446
448
|
});
|
|
447
449
|
|
|
448
450
|
const ColumnSizing = {
|
|
449
|
-
|
|
451
|
+
getDefaultColumnDef: () => {
|
|
450
452
|
return defaultColumnSizing;
|
|
451
453
|
},
|
|
452
454
|
getInitialState: state => {
|
|
@@ -466,10 +468,10 @@ const ColumnSizing = {
|
|
|
466
468
|
createColumn: (column, instance) => {
|
|
467
469
|
return {
|
|
468
470
|
getSize: () => {
|
|
469
|
-
var _column$
|
|
471
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
470
472
|
|
|
471
473
|
const columnSize = instance.getState().columnSizing[column.id];
|
|
472
|
-
return Math.min(Math.max((_column$
|
|
474
|
+
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
473
475
|
},
|
|
474
476
|
getStart: position => {
|
|
475
477
|
const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
|
|
@@ -492,9 +494,9 @@ const ColumnSizing = {
|
|
|
492
494
|
});
|
|
493
495
|
},
|
|
494
496
|
getCanResize: () => {
|
|
495
|
-
var _column$
|
|
497
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
496
498
|
|
|
497
|
-
return ((_column$
|
|
499
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
|
|
498
500
|
},
|
|
499
501
|
getIsResizing: () => {
|
|
500
502
|
return instance.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
@@ -951,7 +953,7 @@ function testFalsey(val) {
|
|
|
951
953
|
|
|
952
954
|
//
|
|
953
955
|
const Filters = {
|
|
954
|
-
|
|
956
|
+
getDefaultColumnDef: () => {
|
|
955
957
|
return {
|
|
956
958
|
filterFn: 'auto'
|
|
957
959
|
};
|
|
@@ -994,6 +996,10 @@ const Filters = {
|
|
|
994
996
|
return filterFns.inNumberRange;
|
|
995
997
|
}
|
|
996
998
|
|
|
999
|
+
if (typeof value === 'boolean') {
|
|
1000
|
+
return filterFns.equals;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
997
1003
|
if (value !== null && typeof value === 'object') {
|
|
998
1004
|
return filterFns.equals;
|
|
999
1005
|
}
|
|
@@ -1011,14 +1017,14 @@ const Filters = {
|
|
|
1011
1017
|
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
1012
1018
|
},
|
|
1013
1019
|
getCanFilter: () => {
|
|
1014
|
-
var _column$
|
|
1020
|
+
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
1015
1021
|
|
|
1016
|
-
return ((_column$
|
|
1022
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
|
|
1017
1023
|
},
|
|
1018
1024
|
getCanGlobalFilter: () => {
|
|
1019
|
-
var _column$
|
|
1025
|
+
var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
|
|
1020
1026
|
|
|
1021
|
-
return ((_column$
|
|
1027
|
+
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
|
|
1022
1028
|
},
|
|
1023
1029
|
getIsFiltered: () => column.getFilterIndex() > -1,
|
|
1024
1030
|
getFilterValue: () => {
|
|
@@ -1296,7 +1302,7 @@ function count(getLeafValues) {
|
|
|
1296
1302
|
|
|
1297
1303
|
//
|
|
1298
1304
|
const Grouping = {
|
|
1299
|
-
|
|
1305
|
+
getDefaultColumnDef: () => {
|
|
1300
1306
|
return {
|
|
1301
1307
|
aggregationFn: 'auto'
|
|
1302
1308
|
};
|
|
@@ -1326,9 +1332,9 @@ const Grouping = {
|
|
|
1326
1332
|
});
|
|
1327
1333
|
},
|
|
1328
1334
|
getCanGroup: () => {
|
|
1329
|
-
var _ref, _ref2, _ref3, _column$
|
|
1335
|
+
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1330
1336
|
|
|
1331
|
-
return (_ref = (_ref2 = (_ref3 = (_column$
|
|
1337
|
+
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
|
|
1332
1338
|
},
|
|
1333
1339
|
getIsGrouped: () => {
|
|
1334
1340
|
var _instance$getState$gr;
|
|
@@ -1412,9 +1418,9 @@ const Grouping = {
|
|
|
1412
1418
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1413
1419
|
},
|
|
1414
1420
|
renderAggregatedCell: () => {
|
|
1415
|
-
var _column$
|
|
1421
|
+
var _column$columnDef$agg;
|
|
1416
1422
|
|
|
1417
|
-
const template = (_column$
|
|
1423
|
+
const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
|
|
1418
1424
|
return template ? instance._render(template, {
|
|
1419
1425
|
instance,
|
|
1420
1426
|
column,
|
|
@@ -1721,9 +1727,9 @@ const Pinning = {
|
|
|
1721
1727
|
getCanPin: () => {
|
|
1722
1728
|
const leafColumns = column.getLeafColumns();
|
|
1723
1729
|
return leafColumns.some(d => {
|
|
1724
|
-
var _d$
|
|
1730
|
+
var _d$columnDef$enablePi, _instance$options$ena;
|
|
1725
1731
|
|
|
1726
|
-
return ((_d$
|
|
1732
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
|
|
1727
1733
|
});
|
|
1728
1734
|
},
|
|
1729
1735
|
getIsPinned: () => {
|
|
@@ -1793,12 +1799,18 @@ const Pinning = {
|
|
|
1793
1799
|
|
|
1794
1800
|
return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
|
|
1795
1801
|
},
|
|
1796
|
-
getIsSomeColumnsPinned:
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
+
getIsSomeColumnsPinned: position => {
|
|
1803
|
+
var _pinningState$positio;
|
|
1804
|
+
|
|
1805
|
+
const pinningState = instance.getState().columnPinning;
|
|
1806
|
+
|
|
1807
|
+
if (!position) {
|
|
1808
|
+
var _pinningState$left, _pinningState$right;
|
|
1809
|
+
|
|
1810
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1802
1814
|
},
|
|
1803
1815
|
getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
|
|
1804
1816
|
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
@@ -2324,7 +2336,7 @@ const Sorting = {
|
|
|
2324
2336
|
...state
|
|
2325
2337
|
};
|
|
2326
2338
|
},
|
|
2327
|
-
|
|
2339
|
+
getDefaultColumnDef: () => {
|
|
2328
2340
|
return {
|
|
2329
2341
|
sortingFn: 'auto'
|
|
2330
2342
|
};
|
|
@@ -2384,7 +2396,7 @@ const Sorting = {
|
|
|
2384
2396
|
throw new Error();
|
|
2385
2397
|
}
|
|
2386
2398
|
|
|
2387
|
-
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
|
|
2399
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.columnDef.sortingFn]) != null ? _ref : sortingFns[column.columnDef.sortingFn];
|
|
2388
2400
|
},
|
|
2389
2401
|
toggleSorting: (desc, multi) => {
|
|
2390
2402
|
// if (column.columns.length) {
|
|
@@ -2396,7 +2408,7 @@ const Sorting = {
|
|
|
2396
2408
|
// return
|
|
2397
2409
|
// }
|
|
2398
2410
|
instance.setSorting(old => {
|
|
2399
|
-
var _ref2, _column$
|
|
2411
|
+
var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
|
|
2400
2412
|
|
|
2401
2413
|
// Find any existing sorting for this column
|
|
2402
2414
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2423,7 +2435,7 @@ const Sorting = {
|
|
|
2423
2435
|
}
|
|
2424
2436
|
}
|
|
2425
2437
|
|
|
2426
|
-
const sortDescFirst = (_ref2 = (_column$
|
|
2438
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
|
|
2427
2439
|
|
|
2428
2440
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2429
2441
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
@@ -2467,14 +2479,14 @@ const Sorting = {
|
|
|
2467
2479
|
});
|
|
2468
2480
|
},
|
|
2469
2481
|
getCanSort: () => {
|
|
2470
|
-
var _column$
|
|
2482
|
+
var _column$columnDef$ena, _instance$options$ena3;
|
|
2471
2483
|
|
|
2472
|
-
return ((_column$
|
|
2484
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
|
|
2473
2485
|
},
|
|
2474
2486
|
getCanMultiSort: () => {
|
|
2475
|
-
var _ref3, _column$
|
|
2487
|
+
var _ref3, _column$columnDef$ena2;
|
|
2476
2488
|
|
|
2477
|
-
return (_ref3 = (_column$
|
|
2489
|
+
return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
|
|
2478
2490
|
},
|
|
2479
2491
|
getIsSorted: () => {
|
|
2480
2492
|
var _instance$getState$so;
|
|
@@ -2538,7 +2550,7 @@ const Visibility = {
|
|
|
2538
2550
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2539
2551
|
};
|
|
2540
2552
|
},
|
|
2541
|
-
|
|
2553
|
+
getDefaultColumnDef: () => {
|
|
2542
2554
|
return {
|
|
2543
2555
|
defaultIsVisible: true
|
|
2544
2556
|
};
|
|
@@ -2558,9 +2570,9 @@ const Visibility = {
|
|
|
2558
2570
|
return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
|
|
2559
2571
|
},
|
|
2560
2572
|
getCanHide: () => {
|
|
2561
|
-
var _column$
|
|
2573
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
2562
2574
|
|
|
2563
|
-
return ((_column$
|
|
2575
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
|
|
2564
2576
|
},
|
|
2565
2577
|
getToggleVisibilityHandler: () => {
|
|
2566
2578
|
return e => {
|
|
@@ -2671,12 +2683,12 @@ const Headers = {
|
|
|
2671
2683
|
recurseHeader(header);
|
|
2672
2684
|
return leafHeaders;
|
|
2673
2685
|
},
|
|
2674
|
-
renderHeader: () => column.header ? instance._render(column.header, {
|
|
2686
|
+
renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
|
|
2675
2687
|
instance,
|
|
2676
2688
|
header: header,
|
|
2677
2689
|
column
|
|
2678
2690
|
}) : null,
|
|
2679
|
-
renderFooter: () => column.footer ? instance._render(column.footer, {
|
|
2691
|
+
renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
|
|
2680
2692
|
instance,
|
|
2681
2693
|
header: header,
|
|
2682
2694
|
column
|
|
@@ -3184,7 +3196,7 @@ function createTable(_, __, options) {
|
|
|
3184
3196
|
throw new Error('');
|
|
3185
3197
|
})()
|
|
3186
3198
|
},
|
|
3187
|
-
setGenerics: () => table,
|
|
3199
|
+
// setGenerics: () => table as any,
|
|
3188
3200
|
setRowType: () => table,
|
|
3189
3201
|
setTableMetaType: () => table,
|
|
3190
3202
|
setColumnMetaType: () => table,
|
|
@@ -3220,7 +3232,8 @@ function createTable(_, __, options) {
|
|
|
3220
3232
|
}
|
|
3221
3233
|
|
|
3222
3234
|
throw new Error('Invalid accessor');
|
|
3223
|
-
}
|
|
3235
|
+
},
|
|
3236
|
+
createOptions: options => options
|
|
3224
3237
|
};
|
|
3225
3238
|
return table;
|
|
3226
3239
|
}
|
|
@@ -3617,8 +3630,8 @@ function getSortedRowModel() {
|
|
|
3617
3630
|
availableSorting.forEach(sortEntry => {
|
|
3618
3631
|
const column = instance.getColumn(sortEntry.id);
|
|
3619
3632
|
columnInfoById[sortEntry.id] = {
|
|
3620
|
-
sortUndefined: column.sortUndefined,
|
|
3621
|
-
invertSorting: column.invertSorting,
|
|
3633
|
+
sortUndefined: column.columnDef.sortUndefined,
|
|
3634
|
+
invertSorting: column.columnDef.invertSorting,
|
|
3622
3635
|
sortingFn: column.getSortingFn()
|
|
3623
3636
|
};
|
|
3624
3637
|
});
|
|
@@ -3766,8 +3779,8 @@ function getGroupedRowModel() {
|
|
|
3766
3779
|
row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
|
|
3767
3780
|
let columnValue = row.getValue(columnId);
|
|
3768
3781
|
|
|
3769
|
-
if (!depth && column.aggregateValue) {
|
|
3770
|
-
columnValue = column.aggregateValue(columnValue);
|
|
3782
|
+
if (!depth && column.columnDef.aggregateValue) {
|
|
3783
|
+
columnValue = column.columnDef.aggregateValue(columnValue);
|
|
3771
3784
|
}
|
|
3772
3785
|
|
|
3773
3786
|
return columnValue;
|