@tanstack/svelte-table 8.0.0-beta.2 → 8.0.0-beta.5
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/svelte-table/src/index.js +6 -2
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/svelte-table/src/placeholder.js +24 -0
- package/build/cjs/svelte-table/src/placeholder.js.map +1 -0
- package/build/cjs/svelte-table/src/render-component.js +5 -1
- package/build/cjs/svelte-table/src/render-component.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +78 -33
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +99 -38
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +76 -44
- package/build/types/placeholder.d.ts +3 -0
- package/build/umd/index.development.js +94 -36
- 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.ts +10 -2
- package/src/placeholder.ts +15 -0
- package/src/render-component.ts +5 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
15
|
var index = require('../../table-core/build/esm/index.js');
|
|
16
|
-
var placeholder = require('./placeholder.
|
|
16
|
+
var placeholder = require('./placeholder.js');
|
|
17
17
|
var internal = require('svelte/internal');
|
|
18
18
|
var store = require('svelte/store');
|
|
19
19
|
var renderComponent = require('./render-component.js');
|
|
@@ -23,7 +23,10 @@ function isSvelteServerComponent(component) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function isSvelteClientComponent(component) {
|
|
26
|
-
|
|
26
|
+
var _component$name, _component$name2;
|
|
27
|
+
|
|
28
|
+
let isHMR = ('__SVELTE_HMR' in window);
|
|
29
|
+
return component.prototype instanceof internal.SvelteComponent || isHMR && ((_component$name = component.name) == null ? void 0 : _component$name.startsWith('Proxy<')) && ((_component$name2 = component.name) == null ? void 0 : _component$name2.endsWith('>'));
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
function isSvelteComponent(component) {
|
|
@@ -77,6 +80,7 @@ function createTableInstance(table, options) {
|
|
|
77
80
|
onStateChange: () => {},
|
|
78
81
|
// noop
|
|
79
82
|
render,
|
|
83
|
+
renderFallbackValue: null,
|
|
80
84
|
...store.get(optionsStore)
|
|
81
85
|
};
|
|
82
86
|
let instance = index.createTableInstance(resolvedOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/index.ts"],"sourcesContent":["import {\n createTableFactory,\n createTableInstance as coreCreateTableInstance,\n PartialKeys,\n Table,\n TableGenerics,\n TableOptions,\n TableOptionsResolved,\n} from '@tanstack/table-core'\nimport Placeholder from './placeholder
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/index.ts"],"sourcesContent":["import {\n createTableFactory,\n createTableInstance as coreCreateTableInstance,\n PartialKeys,\n Table,\n TableGenerics,\n TableOptions,\n TableOptionsResolved,\n} from '@tanstack/table-core'\nimport Placeholder from './placeholder'\nimport { SvelteComponent } from 'svelte/internal'\nimport { readable, writable, derived, Readable, get } from 'svelte/store'\nimport { renderComponent } from './render-component'\n\nexport { renderComponent } from './render-component'\n\nexport * from '@tanstack/table-core'\n\nfunction isSvelteServerComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$render === 'function' &&\n typeof component.render === 'function'\n )\n}\n\nfunction isSvelteClientComponent(component: any) {\n let isHMR = '__SVELTE_HMR' in window\n\n return (\n component.prototype instanceof SvelteComponent ||\n (isHMR &&\n component.name?.startsWith('Proxy<') &&\n component.name?.endsWith('>'))\n )\n}\n\nfunction isSvelteComponent(component: any) {\n if (typeof document === 'undefined') {\n return isSvelteServerComponent(component)\n } else {\n return isSvelteClientComponent(component)\n }\n}\n\nfunction wrapInPlaceholder(content: any) {\n return renderComponent(Placeholder, { content })\n}\n\nexport function render(component: any, props: any) {\n if (!component) return null\n\n if (isSvelteComponent(component)) {\n return renderComponent(component, props)\n }\n\n if (typeof component === 'function') {\n const result = component(props)\n\n if (isSvelteComponent(result)) {\n return result\n }\n\n return wrapInPlaceholder(result)\n }\n\n return wrapInPlaceholder(component)\n}\n\nexport const createTable = createTableFactory({ render })\n\ntype ReadableOrVal<T> = T | Readable<T>\n\nexport function createTableInstance<TGenerics extends TableGenerics>(\n table: Table<TGenerics>,\n options: ReadableOrVal<TableOptions<TGenerics>>\n) {\n let optionsStore: Readable<TableOptions<TGenerics>>\n\n if ('subscribe' in options) {\n optionsStore = options\n } else {\n optionsStore = readable(options)\n }\n\n let resolvedOptions: TableOptionsResolved<TGenerics> = {\n ...table.options,\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n render,\n renderFallbackValue: null,\n ...get(optionsStore),\n }\n\n let instance = coreCreateTableInstance(resolvedOptions)\n\n let stateStore = writable(/** @type {number} */ instance.initialState)\n // combine stores\n let stateOptionsStore = derived([stateStore, optionsStore], s => s)\n const instanceReadable = readable(instance, function start(set) {\n const unsubscribe = stateOptionsStore.subscribe(([state, options]) => {\n instance.setOptions(prev => {\n return {\n ...prev,\n ...options,\n state: { ...state, ...options.state },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n if (updater instanceof Function) {\n stateStore.update(updater)\n } else {\n stateStore.set(updater)\n }\n\n resolvedOptions.onStateChange?.(updater)\n },\n }\n })\n\n // it didn't seem to rerender without setting the instance\n set(instance)\n })\n\n return function stop() {\n unsubscribe()\n }\n })\n\n return instanceReadable\n}\n"],"names":["isSvelteServerComponent","component","$$render","render","isSvelteClientComponent","isHMR","window","prototype","SvelteComponent","name","startsWith","endsWith","isSvelteComponent","document","wrapInPlaceholder","content","renderComponent","Placeholder","props","result","createTable","createTableFactory","createTableInstance","table","options","optionsStore","readable","resolvedOptions","state","onStateChange","renderFallbackValue","get","instance","coreCreateTableInstance","stateStore","writable","initialState","stateOptionsStore","derived","s","instanceReadable","start","set","unsubscribe","subscribe","setOptions","prev","updater","Function","update","stop"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,SAASA,uBAAT,CAAiCC,SAAjC,EAAiD;AAC/C,EAAA,OACE,OAAOA,SAAP,KAAqB,QAArB,IACA,OAAOA,SAAS,CAACC,QAAjB,KAA8B,UAD9B,IAEA,OAAOD,SAAS,CAACE,MAAjB,KAA4B,UAH9B,CAAA;AAKD,CAAA;;AAED,SAASC,uBAAT,CAAiCH,SAAjC,EAAiD;AAAA,EAAA,IAAA,eAAA,EAAA,gBAAA,CAAA;;AAC/C,EAAA,IAAII,KAAK,IAAG,cAAkBC,IAAAA,MAArB,CAAT,CAAA;AAEA,EAAA,OACEL,SAAS,CAACM,SAAV,YAA+BC,wBAA/B,IACCH,KAAK,KAAA,CAAA,eAAA,GACJJ,SAAS,CAACQ,IADN,KAAA,IAAA,GAAA,KAAA,CAAA,GACJ,eAAgBC,CAAAA,UAAhB,CAA2B,QAA3B,CADI,CAAL,KAECT,CAAAA,gBAAAA,GAAAA,SAAS,CAACQ,IAFX,KAEC,IAAA,GAAA,KAAA,CAAA,GAAA,gBAAA,CAAgBE,QAAhB,CAAyB,GAAzB,CAFD,CAFH,CAAA;AAMD,CAAA;;AAED,SAASC,iBAAT,CAA2BX,SAA3B,EAA2C;AACzC,EAAA,IAAI,OAAOY,QAAP,KAAoB,WAAxB,EAAqC;AACnC,IAAOb,OAAAA,uBAAuB,CAACC,SAAD,CAA9B,CAAA;AACD,GAFD,MAEO;AACL,IAAOG,OAAAA,uBAAuB,CAACH,SAAD,CAA9B,CAAA;AACD,GAAA;AACF,CAAA;;AAED,SAASa,iBAAT,CAA2BC,OAA3B,EAAyC;AACvC,EAAOC,OAAAA,+BAAe,CAACC,sBAAD,EAAc;AAAEF,IAAAA,OAAAA;AAAF,GAAd,CAAtB,CAAA;AACD,CAAA;;AAEM,SAASZ,MAAT,CAAgBF,SAAhB,EAAgCiB,KAAhC,EAA4C;AACjD,EAAA,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CAAA;AAGD,GA5BgC,CAAjC,CAAA;AA8BA,EAAA,OAAOH,gBAAP,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* svelte-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
var internal = require('svelte/internal');
|
|
16
|
+
var placeholder = require('./placeholder.svelte.js');
|
|
17
|
+
|
|
18
|
+
const PlaceholderServer = internal.create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
19
|
+
return "" + internal.escape($$props.content);
|
|
20
|
+
});
|
|
21
|
+
var Placeholder = typeof document === 'undefined' ? PlaceholderServer : placeholder["default"];
|
|
22
|
+
|
|
23
|
+
exports["default"] = Placeholder;
|
|
24
|
+
//# sourceMappingURL=placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.js","sources":["../../../../src/placeholder.ts"],"sourcesContent":["import type { SvelteComponentDev } from 'svelte/internal'\nimport { create_ssr_component, escape } from 'svelte/internal'\nimport PlaceholderClient from './placeholder.svelte'\n\ntype X = typeof PlaceholderClient\n\nconst PlaceholderServer = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${escape($$props.content)}`\n }\n) as any as typeof SvelteComponentDev\n\nexport default typeof document === 'undefined'\n ? PlaceholderServer\n : PlaceholderClient\n"],"names":["PlaceholderServer","create_ssr_component","$$result","$$props","$$bindings","slots","escape","content","document","PlaceholderClient"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAMA,iBAAiB,GAAGC,6BAAoB,CAC5C,CAACC,QAAD,EAAgBC,OAAhB,EAA8BC,UAA9B,EAA+CC,KAA/C,KAA8D;AAC5D,EAAA,OAAA,EAAA,GAAUC,eAAM,CAACH,OAAO,CAACI,OAAT,CAAhB,CAAA;AACD,CAH2C,CAA9C,CAAA;AAMA,kBAAe,OAAOC,QAAP,KAAoB,WAApB,GACXR,iBADW,GAEXS,sBAFJ;;;;"}
|
|
@@ -26,6 +26,10 @@ function create_fragment(ctx, Comp, props) {
|
|
|
26
26
|
internal.create_component(c.$$.fragment);
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
+
l(nodes) {
|
|
30
|
+
internal.claim_component(c.$$.fragment, nodes);
|
|
31
|
+
},
|
|
32
|
+
|
|
29
33
|
m(target, anchor) {
|
|
30
34
|
// @ts-ignore
|
|
31
35
|
internal.mount_component(c, target, anchor);
|
|
@@ -64,7 +68,7 @@ function renderClient(Comp, props) {
|
|
|
64
68
|
|
|
65
69
|
function renderServer(Comp, props) {
|
|
66
70
|
const WrapperComp = internal.create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
67
|
-
return "" + internal.validate_component(Comp, '
|
|
71
|
+
return "" + internal.validate_component(Comp, 'TableComponent').$$render($$result, props, {}, {});
|
|
68
72
|
});
|
|
69
73
|
return WrapperComp;
|
|
70
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-component.js","sources":["../../../../src/render-component.ts"],"sourcesContent":["import {\n SvelteComponent,\n create_component,\n destroy_component,\n init,\n mount_component,\n noop,\n safe_not_equal,\n transition_in,\n transition_out,\n create_ssr_component,\n validate_component,\n} from 'svelte/internal'\n\nfunction create_fragment(ctx: any, Comp: any, props: any) {\n let c: any\n let current: any\n c = new Comp({ props, $$inline: true })\n\n return {\n c() {\n create_component(c.$$.fragment)\n },\n m(target: any, anchor: any) {\n // @ts-ignore\n mount_component(c, target, anchor)\n current = true\n },\n p: noop,\n i(local: any) {\n if (current) return\n transition_in(c.$$.fragment, local)\n current = true\n },\n o(local: any) {\n transition_out(c.$$.fragment, local)\n current = false\n },\n d(detaching: any) {\n destroy_component(c, detaching)\n },\n }\n}\n\nfunction renderClient(Comp: any, props: any): any {\n return class WrapperComp extends SvelteComponent {\n constructor(options: any) {\n super()\n init(\n this,\n options,\n null,\n (ctx: any) => create_fragment(ctx, Comp, props),\n safe_not_equal,\n {},\n undefined\n )\n }\n }\n}\n\nfunction renderServer(Comp: any, props: any) {\n const WrapperComp = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${validate_component(Comp, '
|
|
1
|
+
{"version":3,"file":"render-component.js","sources":["../../../../src/render-component.ts"],"sourcesContent":["import {\n SvelteComponent,\n claim_component,\n create_component,\n destroy_component,\n init,\n mount_component,\n noop,\n safe_not_equal,\n transition_in,\n transition_out,\n create_ssr_component,\n validate_component,\n} from 'svelte/internal'\n\nfunction create_fragment(ctx: any, Comp: any, props: any) {\n let c: any\n let current: any\n c = new Comp({ props, $$inline: true })\n\n return {\n c() {\n create_component(c.$$.fragment)\n },\n l(nodes: any) {\n claim_component(c.$$.fragment, nodes)\n },\n m(target: any, anchor: any) {\n // @ts-ignore\n mount_component(c, target, anchor)\n current = true\n },\n p: noop,\n i(local: any) {\n if (current) return\n transition_in(c.$$.fragment, local)\n current = true\n },\n o(local: any) {\n transition_out(c.$$.fragment, local)\n current = false\n },\n d(detaching: any) {\n destroy_component(c, detaching)\n },\n }\n}\n\nfunction renderClient(Comp: any, props: any): any {\n return class WrapperComp extends SvelteComponent {\n constructor(options: any) {\n super()\n init(\n this,\n options,\n null,\n (ctx: any) => create_fragment(ctx, Comp, props),\n safe_not_equal,\n {},\n undefined\n )\n }\n }\n}\n\nfunction renderServer(Comp: any, props: any) {\n const WrapperComp = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${validate_component(Comp, 'TableComponent').$$render(\n $$result,\n props,\n {},\n {}\n )}`\n }\n )\n\n return WrapperComp\n}\n\nexport const renderComponent =\n typeof window === 'undefined' ? renderServer : renderClient\n"],"names":["create_fragment","ctx","Comp","props","c","current","$$inline","create_component","$$","fragment","l","nodes","claim_component","m","target","anchor","mount_component","p","noop","i","local","transition_in","o","transition_out","d","detaching","destroy_component","renderClient","WrapperComp","SvelteComponent","constructor","options","init","safe_not_equal","undefined","renderServer","create_ssr_component","$$result","$$props","$$bindings","slots","validate_component","$$render","renderComponent","window"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAASA,eAAT,CAAyBC,GAAzB,EAAmCC,IAAnC,EAA8CC,KAA9C,EAA0D;AACxD,EAAA,IAAIC,CAAJ,CAAA;AACA,EAAA,IAAIC,OAAJ,CAAA;AACAD,EAAAA,CAAC,GAAG,IAAIF,IAAJ,CAAS;AAAEC,IAAAA,KAAF;AAASG,IAAAA,QAAQ,EAAE,IAAA;AAAnB,GAAT,CAAJ,CAAA;AAEA,EAAO,OAAA;AACLF,IAAAA,CAAC,GAAG;AACFG,MAAAA,yBAAgB,CAACH,CAAC,CAACI,EAAF,CAAKC,QAAN,CAAhB,CAAA;AACD,KAHI;;AAILC,IAAAA,CAAC,CAACC,KAAD,EAAa;AACZC,MAAAA,wBAAe,CAACR,CAAC,CAACI,EAAF,CAAKC,QAAN,EAAgBE,KAAhB,CAAf,CAAA;AACD,KANI;;AAOLE,IAAAA,CAAC,CAACC,MAAD,EAAcC,MAAd,EAA2B;AAC1B;AACAC,MAAAA,wBAAe,CAACZ,CAAD,EAAIU,MAAJ,EAAYC,MAAZ,CAAf,CAAA;AACAV,MAAAA,OAAO,GAAG,IAAV,CAAA;AACD,KAXI;;AAYLY,IAAAA,CAAC,EAAEC,aAZE;;AAaLC,IAAAA,CAAC,CAACC,KAAD,EAAa;AACZ,MAAA,IAAIf,OAAJ,EAAa,OAAA;AACbgB,MAAAA,sBAAa,CAACjB,CAAC,CAACI,EAAF,CAAKC,QAAN,EAAgBW,KAAhB,CAAb,CAAA;AACAf,MAA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B,GAAgCT,YAAhC,GAA+CR;;;;"}
|
|
@@ -1108,7 +1108,6 @@ const Filters = {
|
|
|
1108
1108
|
},
|
|
1109
1109
|
createColumn: (column, instance) => {
|
|
1110
1110
|
return {
|
|
1111
|
-
filterFn: column.filterFn,
|
|
1112
1111
|
getAutoFilterFn: () => {
|
|
1113
1112
|
const firstRow = instance.getCoreRowModel().flatRows[0];
|
|
1114
1113
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
@@ -1139,7 +1138,7 @@ const Filters = {
|
|
|
1139
1138
|
var _ref;
|
|
1140
1139
|
|
|
1141
1140
|
const userFilterFns = instance.options.filterFns;
|
|
1142
|
-
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
1141
|
+
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.columnDef.filterFn]) != null ? _ref : filterFns[column.columnDef.filterFn];
|
|
1143
1142
|
},
|
|
1144
1143
|
getCanFilter: () => {
|
|
1145
1144
|
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
@@ -1428,6 +1427,11 @@ const aggregationFns = {
|
|
|
1428
1427
|
const Grouping = {
|
|
1429
1428
|
getDefaultColumnDef: () => {
|
|
1430
1429
|
return {
|
|
1430
|
+
aggregatedCell: props => {
|
|
1431
|
+
var _props$getValue$toStr, _props$getValue;
|
|
1432
|
+
|
|
1433
|
+
return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
|
|
1434
|
+
},
|
|
1431
1435
|
aggregationFn: 'auto'
|
|
1432
1436
|
};
|
|
1433
1437
|
},
|
|
@@ -1488,8 +1492,6 @@ const Grouping = {
|
|
|
1488
1492
|
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
1489
1493
|
return aggregationFns.extent;
|
|
1490
1494
|
}
|
|
1491
|
-
|
|
1492
|
-
return aggregationFns.count;
|
|
1493
1495
|
},
|
|
1494
1496
|
getAggregationFn: () => {
|
|
1495
1497
|
var _ref4;
|
|
@@ -1500,7 +1502,7 @@ const Grouping = {
|
|
|
1500
1502
|
throw new Error();
|
|
1501
1503
|
}
|
|
1502
1504
|
|
|
1503
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref4 : aggregationFns[column.aggregationFn];
|
|
1505
|
+
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.columnDef.aggregationFn]) != null ? _ref4 : aggregationFns[column.columnDef.aggregationFn];
|
|
1504
1506
|
}
|
|
1505
1507
|
};
|
|
1506
1508
|
},
|
|
@@ -1533,6 +1535,12 @@ const Grouping = {
|
|
|
1533
1535
|
};
|
|
1534
1536
|
},
|
|
1535
1537
|
createCell: (cell, column, row, instance) => {
|
|
1538
|
+
const getRenderValue = () => {
|
|
1539
|
+
var _cell$getValue;
|
|
1540
|
+
|
|
1541
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1536
1544
|
return {
|
|
1537
1545
|
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
|
|
1538
1546
|
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
|
|
@@ -1542,15 +1550,19 @@ const Grouping = {
|
|
|
1542
1550
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1543
1551
|
},
|
|
1544
1552
|
renderAggregatedCell: () => {
|
|
1545
|
-
|
|
1553
|
+
if (process.env.NODE_ENV === 'development') {
|
|
1554
|
+
if (!column.columnDef.aggregatedCell) {
|
|
1555
|
+
console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1546
1558
|
|
|
1547
|
-
const template =
|
|
1559
|
+
const template = column.columnDef.aggregatedCell || column.columnDef.cell;
|
|
1548
1560
|
return template ? instance._render(template, {
|
|
1549
1561
|
instance,
|
|
1550
1562
|
column,
|
|
1551
1563
|
row,
|
|
1552
1564
|
cell,
|
|
1553
|
-
getValue:
|
|
1565
|
+
getValue: getRenderValue
|
|
1554
1566
|
}) : null;
|
|
1555
1567
|
}
|
|
1556
1568
|
};
|
|
@@ -2020,11 +2032,11 @@ const RowSelection = {
|
|
|
2020
2032
|
});
|
|
2021
2033
|
},
|
|
2022
2034
|
toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
|
|
2023
|
-
typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2035
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2024
2036
|
const rowSelection = { ...old
|
|
2025
2037
|
};
|
|
2026
2038
|
instance.getRowModel().rows.forEach(row => {
|
|
2027
|
-
mutateRowIsSelected(rowSelection, row.id,
|
|
2039
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
|
|
2028
2040
|
});
|
|
2029
2041
|
return rowSelection;
|
|
2030
2042
|
}),
|
|
@@ -2179,7 +2191,7 @@ const RowSelection = {
|
|
|
2179
2191
|
},
|
|
2180
2192
|
getIsSomePageRowsSelected: () => {
|
|
2181
2193
|
const paginationFlatRows = instance.getPaginationRowModel().flatRows;
|
|
2182
|
-
return instance.getIsAllPageRowsSelected() ? false :
|
|
2194
|
+
return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
2183
2195
|
},
|
|
2184
2196
|
getToggleAllRowsSelectedHandler: () => {
|
|
2185
2197
|
return e => {
|
|
@@ -2533,8 +2545,10 @@ const Sorting = {
|
|
|
2533
2545
|
// })
|
|
2534
2546
|
// return
|
|
2535
2547
|
// }
|
|
2548
|
+
// this needs to be outside of instance.setSorting to be in sync with rerender
|
|
2549
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
2536
2550
|
instance.setSorting(old => {
|
|
2537
|
-
var
|
|
2551
|
+
var _instance$options$ena, _instance$options$ena2;
|
|
2538
2552
|
|
|
2539
2553
|
// Find any existing sorting for this column
|
|
2540
2554
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2559,30 +2573,29 @@ const Sorting = {
|
|
|
2559
2573
|
} else {
|
|
2560
2574
|
sortAction = 'replace';
|
|
2561
2575
|
}
|
|
2562
|
-
}
|
|
2576
|
+
} // Handle toggle states that will remove the sorting
|
|
2563
2577
|
|
|
2564
|
-
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
|
|
2565
2578
|
|
|
2566
2579
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2567
2580
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
2568
2581
|
!hasDescDefined && ( // Must not be setting desc
|
|
2569
|
-
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) &&
|
|
2570
|
-
|
|
2571
|
-
|
|
2582
|
+
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
|
|
2583
|
+
!nextSortingOrder // Finally, detect if it should indeed be removed
|
|
2584
|
+
) {
|
|
2572
2585
|
sortAction = 'remove';
|
|
2573
2586
|
}
|
|
2574
2587
|
|
|
2575
2588
|
if (sortAction === 'replace') {
|
|
2576
2589
|
newSorting = [{
|
|
2577
2590
|
id: column.id,
|
|
2578
|
-
desc: hasDescDefined ? desc :
|
|
2591
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2579
2592
|
}];
|
|
2580
2593
|
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2581
2594
|
var _instance$options$max;
|
|
2582
2595
|
|
|
2583
2596
|
newSorting = [...old, {
|
|
2584
2597
|
id: column.id,
|
|
2585
|
-
desc: hasDescDefined ? desc :
|
|
2598
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2586
2599
|
}]; // Take latest n columns
|
|
2587
2600
|
|
|
2588
2601
|
newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
|
|
@@ -2591,7 +2604,7 @@ const Sorting = {
|
|
|
2591
2604
|
newSorting = old.map(d => {
|
|
2592
2605
|
if (d.id === column.id) {
|
|
2593
2606
|
return { ...d,
|
|
2594
|
-
desc: hasDescDefined ? desc :
|
|
2607
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2595
2608
|
};
|
|
2596
2609
|
}
|
|
2597
2610
|
|
|
@@ -2604,6 +2617,23 @@ const Sorting = {
|
|
|
2604
2617
|
return newSorting;
|
|
2605
2618
|
});
|
|
2606
2619
|
},
|
|
2620
|
+
getNextSortingOrder: () => {
|
|
2621
|
+
var _ref2, _column$columnDef$sor;
|
|
2622
|
+
|
|
2623
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
|
|
2624
|
+
const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
|
|
2625
|
+
const isSorted = column.getIsSorted();
|
|
2626
|
+
|
|
2627
|
+
if (!isSorted) {
|
|
2628
|
+
return firstSortDirection;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
if (isSorted === firstSortDirection) {
|
|
2632
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2633
|
+
} else {
|
|
2634
|
+
return false;
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2607
2637
|
getCanSort: () => {
|
|
2608
2638
|
var _column$columnDef$ena, _instance$options$ena3;
|
|
2609
2639
|
|
|
@@ -2897,9 +2927,9 @@ function createTableInstance(options) {
|
|
|
2897
2927
|
header: props => props.header.column.id,
|
|
2898
2928
|
footer: props => props.header.column.id,
|
|
2899
2929
|
cell: props => {
|
|
2900
|
-
var _props$getValue$toStr, _props$getValue
|
|
2930
|
+
var _props$getValue$toStr, _props$getValue;
|
|
2901
2931
|
|
|
2902
|
-
return (_props$getValue$toStr = (_props$getValue
|
|
2932
|
+
return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
|
|
2903
2933
|
},
|
|
2904
2934
|
...instance._features.reduce((obj, feature) => {
|
|
2905
2935
|
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
@@ -3053,6 +3083,12 @@ function createTable(_, __, options) {
|
|
|
3053
3083
|
}
|
|
3054
3084
|
|
|
3055
3085
|
function createCell(instance, row, column, columnId) {
|
|
3086
|
+
const getRenderValue = () => {
|
|
3087
|
+
var _cell$getValue;
|
|
3088
|
+
|
|
3089
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
3090
|
+
};
|
|
3091
|
+
|
|
3056
3092
|
const cell = {
|
|
3057
3093
|
id: row.id + "_" + column.id,
|
|
3058
3094
|
row,
|
|
@@ -3064,7 +3100,7 @@ function createCell(instance, row, column, columnId) {
|
|
|
3064
3100
|
column,
|
|
3065
3101
|
row,
|
|
3066
3102
|
cell: cell,
|
|
3067
|
-
getValue:
|
|
3103
|
+
getValue: getRenderValue
|
|
3068
3104
|
}) : null;
|
|
3069
3105
|
}
|
|
3070
3106
|
};
|
|
@@ -3670,11 +3706,6 @@ function getGroupedRowModel() {
|
|
|
3670
3706
|
if (aggregateFn) {
|
|
3671
3707
|
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3672
3708
|
return row._groupingValuesCache[columnId];
|
|
3673
|
-
} else if (column.aggregationFn) {
|
|
3674
|
-
console.info({
|
|
3675
|
-
column
|
|
3676
|
-
});
|
|
3677
|
-
throw new Error(process.env.NODE_ENV !== 'production' ? "Table: Invalid column.aggregateType option for column listed above" : '');
|
|
3678
3709
|
}
|
|
3679
3710
|
}
|
|
3680
3711
|
});
|
|
@@ -3798,20 +3829,34 @@ function getPaginationRowModel(opts) {
|
|
|
3798
3829
|
const pageStart = pageSize * pageIndex;
|
|
3799
3830
|
const pageEnd = pageStart + pageSize;
|
|
3800
3831
|
rows = rows.slice(pageStart, pageEnd);
|
|
3832
|
+
let paginatedRowModel;
|
|
3801
3833
|
|
|
3802
3834
|
if (!instance.options.paginateExpandedRows) {
|
|
3803
|
-
|
|
3835
|
+
paginatedRowModel = expandRows({
|
|
3804
3836
|
rows,
|
|
3805
3837
|
flatRows,
|
|
3806
3838
|
rowsById
|
|
3807
3839
|
});
|
|
3840
|
+
} else {
|
|
3841
|
+
paginatedRowModel = {
|
|
3842
|
+
rows,
|
|
3843
|
+
flatRows,
|
|
3844
|
+
rowsById
|
|
3845
|
+
};
|
|
3808
3846
|
}
|
|
3809
3847
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3848
|
+
paginatedRowModel.flatRows = [];
|
|
3849
|
+
|
|
3850
|
+
const handleRow = row => {
|
|
3851
|
+
paginatedRowModel.flatRows.push(row);
|
|
3852
|
+
|
|
3853
|
+
if (row.subRows.length) {
|
|
3854
|
+
row.subRows.forEach(handleRow);
|
|
3855
|
+
}
|
|
3814
3856
|
};
|
|
3857
|
+
|
|
3858
|
+
paginatedRowModel.rows.forEach(handleRow);
|
|
3859
|
+
return paginatedRowModel;
|
|
3815
3860
|
}, {
|
|
3816
3861
|
key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',
|
|
3817
3862
|
debug: () => {
|