@tanstack/table-core 8.0.0-alpha.85 → 8.0.0-alpha.88
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/core/cell.js +9 -7
- package/build/cjs/core/cell.js.map +1 -1
- package/build/cjs/core/column.js +1 -1
- package/build/cjs/core/column.js.map +1 -1
- package/build/cjs/features/Expanding.js +6 -3
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +2 -7
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/sortingFns.js +53 -51
- package/build/cjs/sortingFns.js.map +1 -1
- package/build/cjs/utils/getCoreRowModel.js +4 -8
- package/build/cjs/utils/getCoreRowModel.js.map +1 -1
- package/build/cjs/utils/getExpandedRowModel.js +2 -2
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getPaginationRowModel.js +1 -1
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/esm/index.js +78 -80
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +322 -322
- package/build/types/features/Expanding.d.ts +0 -1
- package/build/types/features/Sorting.d.ts +3 -3
- package/build/types/features/Visibility.d.ts +5 -6
- package/build/types/index.d.ts +0 -2
- package/build/types/sortingFns.d.ts +7 -14
- package/build/umd/index.development.js +78 -80
- 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 +4 -4
- package/src/core/cell.ts +4 -3
- package/src/core/column.ts +0 -1
- package/src/features/Expanding.ts +6 -4
- package/src/features/Sorting.ts +4 -4
- package/src/features/Visibility.ts +10 -25
- package/src/index.ts +0 -2
- package/src/sortingFns.ts +59 -81
- package/src/utils/getCoreRowModel.ts +8 -11
- package/src/utils/getExpandedRowModel.ts +1 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCoreRowModel.js","sources":["../../../src/utils/getCoreRowModel.ts"],"sourcesContent":["import { createRow } from '../core/row'\nimport { TableInstance, Row, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\n\nexport function getCoreRowModel<TGenerics extends TableGenerics>(): (\n instance: TableInstance<TGenerics>\n) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [instance.options.data],\n (\n data\n ): {\n rows: Row<TGenerics>[]\n flatRows: Row<TGenerics>[]\n rowsById: Record<string, Row<TGenerics>>\n } => {\n const rowModel: RowModel<TGenerics> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n
|
|
1
|
+
{"version":3,"file":"getCoreRowModel.js","sources":["../../../src/utils/getCoreRowModel.ts"],"sourcesContent":["import { createRow } from '../core/row'\nimport { TableInstance, Row, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\n\nexport function getCoreRowModel<TGenerics extends TableGenerics>(): (\n instance: TableInstance<TGenerics>\n) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [instance.options.data],\n (\n data\n ): {\n rows: Row<TGenerics>[]\n flatRows: Row<TGenerics>[]\n rowsById: Record<string, Row<TGenerics>>\n } => {\n const rowModel: RowModel<TGenerics> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TGenerics['Row'][],\n depth = 0,\n parent?: Row<TGenerics>\n ): Row<TGenerics>[] => {\n const rows = [] as Row<TGenerics>[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n instance,\n instance._getRowId(originalRows[i], i, parent),\n originalRows[i],\n i,\n depth\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push instance row into parent\n rows.push(row)\n\n // Get the original subrows\n if (instance.options.getSubRows) {\n row.originalSubRows = instance.options.getSubRows(\n originalRows[i],\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRowModel',\n debug: () => instance.options.debugAll ?? instance.options.debugTable,\n onChange: () => {\n instance._autoResetPageIndex()\n },\n }\n )\n}\n"],"names":["getCoreRowModel","instance","memo","options","data","rowModel","rows","flatRows","rowsById","accessRows","originalRows","depth","parent","i","length","row","createRow","_getRowId","push","id","getSubRows","originalSubRows","subRows","key","process","env","NODE_ENV","debug","debugAll","debugTable","onChange","_autoResetPageIndex"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,eAAT,GAEwB;AAC7B,EAAA,OAAOC,QAAQ,IACbC,UAAI,CACF,MAAM,CAACD,QAAQ,CAACE,OAAT,CAAiBC,IAAlB,CADJ,EAGAA,IADF,IAMK;AACH,IAAA,MAAMC,QAA6B,GAAG;AACpCC,MAAAA,IAAI,EAAE,EAD8B;AAEpCC,MAAAA,QAAQ,EAAE,EAF0B;AAGpCC,MAAAA,QAAQ,EAAE,EAAA;AAH0B,KAAtC,CAAA;;AAMA,IAAMC,MAAAA,UAAU,GAAG,UACjBC,YADiB,EAEjBC,KAFiB,EAGjBC,MAHiB,EAII;AAAA,MAAA,IAFrBD,KAEqB,KAAA,KAAA,CAAA,EAAA;AAFrBA,QAAAA,KAEqB,GAFb,CAEa,CAAA;AAAA,OAAA;;AACrB,MAAML,MAAAA,IAAI,GAAG,EAAb,CAAA;;AAEA,MAAA,KAAK,IAAIO,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,YAAY,CAACI,MAAjC,EAAyCD,CAAC,EAA1C,EAA8C;AAC5C;AACA;AACA;AACA;AACA;AACA;AAEA;AACA,QAAA,MAAME,KAAG,GAAGC,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MAAA,IAAA,qBAAA,CAAA;;AAAA,MAAM1B,OAAAA,CAAAA,qBAAAA,GAAAA,QAAQ,CAACE,OAAT,CAAiByB,QAAvB,oCAAmC3B,QAAQ,CAACE,OAAT,CAAiB0B,UAApD,CAAA;AAAA,KAFT;AAGEC,IAAAA,QAAQ,EAAE,MAAM;AACd7B,MAAAA,QAAQ,CAAC8B,mBAAT,EAAA,CAAA;AACD,KAAA;AALH,GAnEE,CADN,CAAA;AA4ED;;;;"}
|
|
@@ -21,7 +21,7 @@ function getExpandedRowModel() {
|
|
|
21
21
|
return rowModel;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
return expandRows(rowModel
|
|
24
|
+
return expandRows(rowModel);
|
|
25
25
|
}, {
|
|
26
26
|
key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',
|
|
27
27
|
debug: () => {
|
|
@@ -39,7 +39,7 @@ function expandRows(rowModel, instance) {
|
|
|
39
39
|
|
|
40
40
|
expandedRows.push(row);
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
|
|
43
43
|
row.subRows.forEach(handleRow);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExpandedRowModel.js","sources":["../../../src/utils/getExpandedRowModel.ts"],"sourcesContent":["import { TableInstance, Row, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\n\nexport function getExpandedRowModel<TGenerics extends TableGenerics>(): (\n instance: TableInstance<TGenerics>\n) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [\n instance.getState().expanded,\n instance.getPreExpandedRowModel(),\n instance.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n // Do not expand if rows are not included in pagination\n !paginateExpandedRows ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n return expandRows(rowModel, instance)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',\n debug: () => instance.options.debugAll ?? instance.options.debugTable,\n }\n )\n}\n\nexport function expandRows<TGenerics extends TableGenerics>(\n rowModel: RowModel<TGenerics>,\n instance: TableInstance<TGenerics>\n) {\n const expandedRows: Row<TGenerics>[] = []\n\n const handleRow = (row: Row<TGenerics>) => {\n expandedRows.push(row)\n\n if (
|
|
1
|
+
{"version":3,"file":"getExpandedRowModel.js","sources":["../../../src/utils/getExpandedRowModel.ts"],"sourcesContent":["import { TableInstance, Row, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\n\nexport function getExpandedRowModel<TGenerics extends TableGenerics>(): (\n instance: TableInstance<TGenerics>\n) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [\n instance.getState().expanded,\n instance.getPreExpandedRowModel(),\n instance.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n // Do not expand if rows are not included in pagination\n !paginateExpandedRows ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n return expandRows(rowModel, instance)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',\n debug: () => instance.options.debugAll ?? instance.options.debugTable,\n }\n )\n}\n\nexport function expandRows<TGenerics extends TableGenerics>(\n rowModel: RowModel<TGenerics>,\n instance: TableInstance<TGenerics>\n) {\n const expandedRows: Row<TGenerics>[] = []\n\n const handleRow = (row: Row<TGenerics>) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n"],"names":["getExpandedRowModel","instance","memo","getState","expanded","getPreExpandedRowModel","options","paginateExpandedRows","rowModel","rows","length","Object","keys","expandRows","key","process","env","NODE_ENV","debug","deb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B,CAAA,CAAA;;AAEA,IAAI,IAAA,CAAA,YAAA,GAAAA,GAAG,CAACE,OAAJ,KAAA,IAAA,IAAA,YAAA,CAAaf,MAAb,IAAuBa,GAAG,CAACG,aAAJ,EAA3B,EAAgD;AAC9CH,MAAAA,GAAG,CAACE,OAAJ,CAAYE,OAAZ,CAAoBL,SAApB,CAAA,CAAA;AACD,KAAA;AACF,GAND,CAAA;;AAQAd,EAAAA,QAAQ,CAACC,IAAT,CAAckB,OAAd,CAAsBL,SAAtB,CAAA,CAAA;AAEA,EAAO,OAAA;AACLb,IAAAA,IAAI,EAAEY,YADD;AAELO,IAAAA,QAAQ,EAAEpB,QAAQ,CAACoB,QAFd;AAGLC,IAAAA,QAAQ,EAAErB,QAAQ,CAACqB,QAAAA;AAHd,GAAP,CAAA;AAKD;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPaginationRowModel.js","sources":["../../../src/utils/getPaginationRowModel.ts"],"sourcesContent":["import { TableInstance, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel<TGenerics extends TableGenerics>(opts?: {\n initialSync: boolean\n}): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [\n instance.getState().pagination,\n instance.getPrePaginationRowModel(),\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n if (!instance.options.paginateExpandedRows) {\n return expandRows(\n {\n rows,\n flatRows,\n rowsById,\n },\n instance\n )\n }\n\n return {\n rows,\n flatRows,\n rowsById,\n }\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',\n debug: () => instance.options.debugAll ?? instance.options.debugTable,\n }\n )\n}\n"],"names":["getPaginationRowModel","opts","instance","memo","getState","pagination","getPrePaginationRowModel","rowModel","rows","length","pageSize","pageIndex","flatRows","rowsById","pageStart","pageEnd","slice","options","paginateExpandedRows","expandRows","key","process","env","NODE_ENV","debug","debugAll","debugTable"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,qBAAT,CAAgEC,IAAhE,EAE+D;AACpE,EAAOC,OAAAA,QAAQ,IACbC,UAAI,CACF,MAAM,CACJD,QAAQ,CAACE,QAAT,EAAoBC,CAAAA,UADhB,EAEJH,QAAQ,CAACI,wBAAT,EAFI,CADJ,EAKF,CAACD,UAAD,EAAaE,QAAb,KAA0B;AACxB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAT,CAAcC,MAAnB,EAA2B;AACzB,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;AAED,IAAM,MAAA;AAAEG,MAAAA,QAAF;AAAYC,MAAAA,SAAAA;AAAZ,KAAA,GAA0BN,UAAhC,CAAA;AACA,IAAI,IAAA;AAAEG,MAAAA,IAAF;AAAQI,MAAAA,QAAR;AAAkBC,MAAAA,QAAAA;AAAlB,KAAA,GAA+BN,QAAnC,CAAA;AACA,IAAA,MAAMO,SAAS,GAAGJ,QAAQ,GAAGC,SAA7B,CAAA;AACA,IAAA,MAAMI,OAAO,GAAGD,SAAS,GAAGJ,QAA5B,CAAA;AAEAF,IAAAA,IAAI,GAAGA,IAAI,CAACQ,KAAL,CAAWF,SAAX,EAAsBC,OAAtB,CAAP,CAAA;;AAEA,IAAA,IAAI,CAACb,QAAQ,CAACe,OAAT,CAAiBC,oBAAtB,EAA4C;AAC1C,MAAA,OAAOC,8BAAU,CACf;AACEX,QAAAA,IADF;AAEEI,QAAAA,QAFF;AAGEC,QAAAA,QAAAA;AAHF,OADe,
|
|
1
|
+
{"version":3,"file":"getPaginationRowModel.js","sources":["../../../src/utils/getPaginationRowModel.ts"],"sourcesContent":["import { TableInstance, RowModel, TableGenerics } from '../types'\nimport { memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel<TGenerics extends TableGenerics>(opts?: {\n initialSync: boolean\n}): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {\n return instance =>\n memo(\n () => [\n instance.getState().pagination,\n instance.getPrePaginationRowModel(),\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n if (!instance.options.paginateExpandedRows) {\n return expandRows(\n {\n rows,\n flatRows,\n rowsById,\n },\n instance\n )\n }\n\n return {\n rows,\n flatRows,\n rowsById,\n }\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',\n debug: () => instance.options.debugAll ?? instance.options.debugTable,\n }\n )\n}\n"],"names":["getPaginationRowModel","opts","instance","memo","getState","pagination","getPrePaginationRowModel","rowModel","rows","length","pageSize","pageIndex","flatRows","rowsById","pageStart","pageEnd","slice","options","paginateExpandedRows","expandRows","key","process","env","NODE_ENV","debug","debugAll","debugTable"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,qBAAT,CAAgEC,IAAhE,EAE+D;AACpE,EAAOC,OAAAA,QAAQ,IACbC,UAAI,CACF,MAAM,CACJD,QAAQ,CAACE,QAAT,EAAoBC,CAAAA,UADhB,EAEJH,QAAQ,CAACI,wBAAT,EAFI,CADJ,EAKF,CAACD,UAAD,EAAaE,QAAb,KAA0B;AACxB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAT,CAAcC,MAAnB,EAA2B;AACzB,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;AAED,IAAM,MAAA;AAAEG,MAAAA,QAAF;AAAYC,MAAAA,SAAAA;AAAZ,KAAA,GAA0BN,UAAhC,CAAA;AACA,IAAI,IAAA;AAAEG,MAAAA,IAAF;AAAQI,MAAAA,QAAR;AAAkBC,MAAAA,QAAAA;AAAlB,KAAA,GAA+BN,QAAnC,CAAA;AACA,IAAA,MAAMO,SAAS,GAAGJ,QAAQ,GAAGC,SAA7B,CAAA;AACA,IAAA,MAAMI,OAAO,GAAGD,SAAS,GAAGJ,QAA5B,CAAA;AAEAF,IAAAA,IAAI,GAAGA,IAAI,CAACQ,KAAL,CAAWF,SAAX,EAAsBC,OAAtB,CAAP,CAAA;;AAEA,IAAA,IAAI,CAACb,QAAQ,CAACe,OAAT,CAAiBC,oBAAtB,EAA4C;AAC1C,MAAA,OAAOC,8BAAU,CACf;AACEX,QAAAA,IADF;AAEEI,QAAAA,QAFF;AAGEC,QAAAA,QAAAA;AAHF,OADe,CAAjB,CAAA;AAQD,KAAA;;AAED,IAAO,OAAA;AACLL,MAAAA,IADK;AAELI,MAAAA,QAFK;AAGLC,MAAAA,QAAAA;AAHK,KAAP,CAAA;AAKD,GAjCC,EAkCF;AACEO,IAAAA,GAAG,EAAEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAzB,IAA0C,uBADjD;AAEEC,IAAAA,KAAK,EAAE,MAAA;AAAA,MAAA,IAAA,qBAAA,CAAA;;AAAA,MAAMtB,OAAAA,CAAAA,qBAAAA,GAAAA,QAAQ,CAACe,OAAT,CAAiBQ,QAAvB,oCAAmCvB,QAAQ,CAACe,OAAT,CAAiBS,UAApD,CAAA;AAAA,KAAA;AAFT,GAlCE,CADN,CAAA;AAwCD;;;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function createColumn(instance, columnDef, depth, parent) {
|
|
|
110
110
|
throw new Error();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
let column = {
|
|
113
|
+
let column = {
|
|
114
114
|
id: "" + id,
|
|
115
115
|
accessorFn,
|
|
116
116
|
parent: parent,
|
|
@@ -815,7 +815,6 @@ const Expanding = {
|
|
|
815
815
|
return {
|
|
816
816
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
817
817
|
autoResetExpanded: true,
|
|
818
|
-
expandSubRows: true,
|
|
819
818
|
paginateExpandedRows: true
|
|
820
819
|
};
|
|
821
820
|
},
|
|
@@ -875,8 +874,12 @@ const Expanding = {
|
|
|
875
874
|
getIsAllRowsExpanded: () => {
|
|
876
875
|
const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
|
|
877
876
|
|
|
878
|
-
if (expanded ===
|
|
879
|
-
return true;
|
|
877
|
+
if (typeof expanded === 'boolean') {
|
|
878
|
+
return expanded === true;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
if (!Object.keys(expanded).length) {
|
|
882
|
+
return false;
|
|
880
883
|
} // If any row is not expanded, return false
|
|
881
884
|
|
|
882
885
|
|
|
@@ -2331,21 +2334,54 @@ function isRowSelected(row, selection, instance) {
|
|
|
2331
2334
|
}
|
|
2332
2335
|
|
|
2333
2336
|
const reSplitAlphaNumeric = /([0-9]+)/gm;
|
|
2334
|
-
const sortingFns = {
|
|
2335
|
-
alphanumeric,
|
|
2336
|
-
alphanumericCaseSensitive,
|
|
2337
|
-
text,
|
|
2338
|
-
textCaseSensitive,
|
|
2339
|
-
datetime,
|
|
2340
|
-
basic
|
|
2341
|
-
};
|
|
2342
2337
|
|
|
2343
|
-
|
|
2338
|
+
const alphanumeric = (rowA, rowB, columnId) => {
|
|
2344
2339
|
return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
2345
|
-
}
|
|
2340
|
+
};
|
|
2346
2341
|
|
|
2347
|
-
|
|
2342
|
+
const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
|
|
2348
2343
|
return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
2344
|
+
}; // The text filter is more basic (less numeric support)
|
|
2345
|
+
// but is much faster
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
const text = (rowA, rowB, columnId) => {
|
|
2349
|
+
return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
2350
|
+
}; // The text filter is more basic (less numeric support)
|
|
2351
|
+
// but is much faster
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
const textCaseSensitive = (rowA, rowB, columnId) => {
|
|
2355
|
+
return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
const datetime = (rowA, rowB, columnId) => {
|
|
2359
|
+
return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2362
|
+
const basic = (rowA, rowB, columnId) => {
|
|
2363
|
+
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
2364
|
+
}; // Utils
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
function compareBasic(a, b) {
|
|
2368
|
+
return a === b ? 0 : a > b ? 1 : -1;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
function toString(a) {
|
|
2372
|
+
if (typeof a === 'number') {
|
|
2373
|
+
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
2374
|
+
return '';
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
return String(a);
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
if (typeof a === 'string') {
|
|
2381
|
+
return a;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
return '';
|
|
2349
2385
|
} // Mixed sorting is slow, but very inclusive of many edge cases.
|
|
2350
2386
|
// It handles numbers, mixed alphanumeric combinations, and even
|
|
2351
2387
|
// null, undefined, and Infinity
|
|
@@ -2392,48 +2428,17 @@ function compareAlphanumeric(aStr, bStr) {
|
|
|
2392
2428
|
}
|
|
2393
2429
|
|
|
2394
2430
|
return a.length - b.length;
|
|
2395
|
-
} //
|
|
2396
|
-
// but is much faster
|
|
2431
|
+
} // Exports
|
|
2397
2432
|
|
|
2398
2433
|
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
function datetime(rowA, rowB, columnId) {
|
|
2410
|
-
return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
function basic(rowA, rowB, columnId) {
|
|
2414
|
-
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
2415
|
-
} // Utils
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
function compareBasic(a, b) {
|
|
2419
|
-
return a === b ? 0 : a > b ? 1 : -1;
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
function toString(a) {
|
|
2423
|
-
if (typeof a === 'number') {
|
|
2424
|
-
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
2425
|
-
return '';
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
return String(a);
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
if (typeof a === 'string') {
|
|
2432
|
-
return a;
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
return '';
|
|
2436
|
-
}
|
|
2434
|
+
const sortingFns = {
|
|
2435
|
+
alphanumeric,
|
|
2436
|
+
alphanumericCaseSensitive,
|
|
2437
|
+
text,
|
|
2438
|
+
textCaseSensitive,
|
|
2439
|
+
datetime,
|
|
2440
|
+
basic
|
|
2441
|
+
};
|
|
2437
2442
|
|
|
2438
2443
|
//
|
|
2439
2444
|
const Sorting = {
|
|
@@ -2657,11 +2662,6 @@ const Visibility = {
|
|
|
2657
2662
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2658
2663
|
};
|
|
2659
2664
|
},
|
|
2660
|
-
getDefaultColumnDef: () => {
|
|
2661
|
-
return {
|
|
2662
|
-
defaultIsVisible: true
|
|
2663
|
-
};
|
|
2664
|
-
},
|
|
2665
2665
|
createColumn: (column, instance) => {
|
|
2666
2666
|
return {
|
|
2667
2667
|
toggleVisibility: value => {
|
|
@@ -2690,8 +2690,8 @@ const Visibility = {
|
|
|
2690
2690
|
},
|
|
2691
2691
|
createRow: (row, instance) => {
|
|
2692
2692
|
return {
|
|
2693
|
-
_getAllVisibleCells: memo(() => [row.getAllCells()
|
|
2694
|
-
return
|
|
2693
|
+
_getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
|
|
2694
|
+
return cells.filter(cell => cell.column.getIsVisible());
|
|
2695
2695
|
}, {
|
|
2696
2696
|
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
|
|
2697
2697
|
debug: () => {
|
|
@@ -3044,13 +3044,15 @@ function createCell(instance, row, column, columnId) {
|
|
|
3044
3044
|
row,
|
|
3045
3045
|
column,
|
|
3046
3046
|
getValue: () => row.getValue(columnId),
|
|
3047
|
-
renderCell: () =>
|
|
3048
|
-
instance,
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3047
|
+
renderCell: () => {
|
|
3048
|
+
return column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
3049
|
+
instance,
|
|
3050
|
+
column,
|
|
3051
|
+
row,
|
|
3052
|
+
cell: cell,
|
|
3053
|
+
getValue: cell.getValue
|
|
3054
|
+
}) : null;
|
|
3055
|
+
}
|
|
3054
3056
|
};
|
|
3055
3057
|
|
|
3056
3058
|
instance._features.forEach(feature => {
|
|
@@ -3125,27 +3127,23 @@ function getCoreRowModel() {
|
|
|
3125
3127
|
flatRows: [],
|
|
3126
3128
|
rowsById: {}
|
|
3127
3129
|
};
|
|
3128
|
-
let rows;
|
|
3129
|
-
let row;
|
|
3130
|
-
let originalRow;
|
|
3131
3130
|
|
|
3132
3131
|
const accessRows = function (originalRows, depth, parent) {
|
|
3133
3132
|
if (depth === void 0) {
|
|
3134
3133
|
depth = 0;
|
|
3135
3134
|
}
|
|
3136
3135
|
|
|
3137
|
-
rows = [];
|
|
3136
|
+
const rows = [];
|
|
3138
3137
|
|
|
3139
3138
|
for (let i = 0; i < originalRows.length; i++) {
|
|
3140
|
-
|
|
3139
|
+
// This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
3141
3140
|
// if (!id) {
|
|
3142
3141
|
// if (process.env.NODE_ENV !== 'production') {
|
|
3143
3142
|
// throw new Error(`getRowId expected an ID, but got ${id}`)
|
|
3144
3143
|
// }
|
|
3145
3144
|
// }
|
|
3146
3145
|
// Make the row
|
|
3147
|
-
|
|
3148
|
-
row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3146
|
+
const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
|
|
3149
3147
|
|
|
3150
3148
|
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3151
3149
|
|
|
@@ -3156,7 +3154,7 @@ function getCoreRowModel() {
|
|
|
3156
3154
|
if (instance.options.getSubRows) {
|
|
3157
3155
|
var _row$originalSubRows;
|
|
3158
3156
|
|
|
3159
|
-
row.originalSubRows = instance.options.getSubRows(
|
|
3157
|
+
row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
|
|
3160
3158
|
|
|
3161
3159
|
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
3162
3160
|
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
@@ -3737,7 +3735,7 @@ function getExpandedRowModel() {
|
|
|
3737
3735
|
return rowModel;
|
|
3738
3736
|
}
|
|
3739
3737
|
|
|
3740
|
-
return expandRows(rowModel
|
|
3738
|
+
return expandRows(rowModel);
|
|
3741
3739
|
}, {
|
|
3742
3740
|
key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',
|
|
3743
3741
|
debug: () => {
|
|
@@ -3755,7 +3753,7 @@ function expandRows(rowModel, instance) {
|
|
|
3755
3753
|
|
|
3756
3754
|
expandedRows.push(row);
|
|
3757
3755
|
|
|
3758
|
-
if (
|
|
3756
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
|
|
3759
3757
|
row.subRows.forEach(handleRow);
|
|
3760
3758
|
}
|
|
3761
3759
|
};
|
|
@@ -3792,7 +3790,7 @@ function getPaginationRowModel(opts) {
|
|
|
3792
3790
|
rows,
|
|
3793
3791
|
flatRows,
|
|
3794
3792
|
rowsById
|
|
3795
|
-
}
|
|
3793
|
+
});
|
|
3796
3794
|
}
|
|
3797
3795
|
|
|
3798
3796
|
return {
|