@tanstack/svelte-table 8.0.0-beta.3 → 8.0.0-beta.4
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 +47 -13
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +68 -18
- 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 +63 -16
- 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;;;;"}
|
|
@@ -1535,6 +1535,12 @@ const Grouping = {
|
|
|
1535
1535
|
};
|
|
1536
1536
|
},
|
|
1537
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
|
+
|
|
1538
1544
|
return {
|
|
1539
1545
|
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
|
|
1540
1546
|
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
|
|
@@ -1544,15 +1550,19 @@ const Grouping = {
|
|
|
1544
1550
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1545
1551
|
},
|
|
1546
1552
|
renderAggregatedCell: () => {
|
|
1547
|
-
|
|
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
|
+
}
|
|
1548
1558
|
|
|
1549
|
-
const template =
|
|
1559
|
+
const template = column.columnDef.aggregatedCell || column.columnDef.cell;
|
|
1550
1560
|
return template ? instance._render(template, {
|
|
1551
1561
|
instance,
|
|
1552
1562
|
column,
|
|
1553
1563
|
row,
|
|
1554
1564
|
cell,
|
|
1555
|
-
getValue:
|
|
1565
|
+
getValue: getRenderValue
|
|
1556
1566
|
}) : null;
|
|
1557
1567
|
}
|
|
1558
1568
|
};
|
|
@@ -2535,8 +2545,10 @@ const Sorting = {
|
|
|
2535
2545
|
// })
|
|
2536
2546
|
// return
|
|
2537
2547
|
// }
|
|
2548
|
+
// this needs to be outside of instance.setSorting to be in sync with rerender
|
|
2549
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
2538
2550
|
instance.setSorting(old => {
|
|
2539
|
-
var
|
|
2551
|
+
var _instance$options$ena, _instance$options$ena2;
|
|
2540
2552
|
|
|
2541
2553
|
// Find any existing sorting for this column
|
|
2542
2554
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2561,30 +2573,29 @@ const Sorting = {
|
|
|
2561
2573
|
} else {
|
|
2562
2574
|
sortAction = 'replace';
|
|
2563
2575
|
}
|
|
2564
|
-
}
|
|
2576
|
+
} // Handle toggle states that will remove the sorting
|
|
2565
2577
|
|
|
2566
|
-
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
|
|
2567
2578
|
|
|
2568
2579
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2569
2580
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
2570
2581
|
!hasDescDefined && ( // Must not be setting desc
|
|
2571
|
-
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) &&
|
|
2572
|
-
|
|
2573
|
-
|
|
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
|
+
) {
|
|
2574
2585
|
sortAction = 'remove';
|
|
2575
2586
|
}
|
|
2576
2587
|
|
|
2577
2588
|
if (sortAction === 'replace') {
|
|
2578
2589
|
newSorting = [{
|
|
2579
2590
|
id: column.id,
|
|
2580
|
-
desc: hasDescDefined ? desc :
|
|
2591
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2581
2592
|
}];
|
|
2582
2593
|
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2583
2594
|
var _instance$options$max;
|
|
2584
2595
|
|
|
2585
2596
|
newSorting = [...old, {
|
|
2586
2597
|
id: column.id,
|
|
2587
|
-
desc: hasDescDefined ? desc :
|
|
2598
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2588
2599
|
}]; // Take latest n columns
|
|
2589
2600
|
|
|
2590
2601
|
newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
|
|
@@ -2593,7 +2604,7 @@ const Sorting = {
|
|
|
2593
2604
|
newSorting = old.map(d => {
|
|
2594
2605
|
if (d.id === column.id) {
|
|
2595
2606
|
return { ...d,
|
|
2596
|
-
desc: hasDescDefined ? desc :
|
|
2607
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2597
2608
|
};
|
|
2598
2609
|
}
|
|
2599
2610
|
|
|
@@ -2606,6 +2617,23 @@ const Sorting = {
|
|
|
2606
2617
|
return newSorting;
|
|
2607
2618
|
});
|
|
2608
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
|
+
},
|
|
2609
2637
|
getCanSort: () => {
|
|
2610
2638
|
var _column$columnDef$ena, _instance$options$ena3;
|
|
2611
2639
|
|
|
@@ -3055,6 +3083,12 @@ function createTable(_, __, options) {
|
|
|
3055
3083
|
}
|
|
3056
3084
|
|
|
3057
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
|
+
|
|
3058
3092
|
const cell = {
|
|
3059
3093
|
id: row.id + "_" + column.id,
|
|
3060
3094
|
row,
|
|
@@ -3066,7 +3100,7 @@ function createCell(instance, row, column, columnId) {
|
|
|
3066
3100
|
column,
|
|
3067
3101
|
row,
|
|
3068
3102
|
cell: cell,
|
|
3069
|
-
getValue:
|
|
3103
|
+
getValue: getRenderValue
|
|
3070
3104
|
}) : null;
|
|
3071
3105
|
}
|
|
3072
3106
|
};
|