@tanstack/svelte-table 8.0.0-alpha.74 → 8.0.0-alpha.78
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 +38 -9
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +12 -6
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +49 -15
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +48 -42
- package/build/types/index.d.ts +1 -1
- package/build/umd/index.development.js +49 -15
- 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/index.ts +39 -7
package/build/esm/index.js
CHANGED
|
@@ -2689,8 +2689,10 @@ const Headers = {
|
|
|
2689
2689
|
},
|
|
2690
2690
|
// Header Groups
|
|
2691
2691
|
getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
2692
|
-
|
|
2693
|
-
|
|
2692
|
+
var _left$map$filter, _right$map$filter;
|
|
2693
|
+
|
|
2694
|
+
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
2695
|
+
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
2694
2696
|
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
2695
2697
|
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
|
|
2696
2698
|
return headerGroups;
|
|
@@ -2714,8 +2716,10 @@ const Headers = {
|
|
|
2714
2716
|
}
|
|
2715
2717
|
}),
|
|
2716
2718
|
getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
+
var _left$map$filter2;
|
|
2720
|
+
|
|
2721
|
+
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
2722
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
|
|
2719
2723
|
}, {
|
|
2720
2724
|
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
|
|
2721
2725
|
debug: () => {
|
|
@@ -2725,8 +2729,10 @@ const Headers = {
|
|
|
2725
2729
|
}
|
|
2726
2730
|
}),
|
|
2727
2731
|
getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
2728
|
-
|
|
2729
|
-
|
|
2732
|
+
var _right$map$filter2;
|
|
2733
|
+
|
|
2734
|
+
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
2735
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
|
|
2730
2736
|
}, {
|
|
2731
2737
|
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
|
|
2732
2738
|
debug: () => {
|
|
@@ -4002,18 +4008,46 @@ function renderServer(Comp, props) {
|
|
|
4002
4008
|
|
|
4003
4009
|
const renderComponent = typeof window === 'undefined' ? renderServer : renderClient;
|
|
4004
4010
|
|
|
4005
|
-
function
|
|
4006
|
-
|
|
4011
|
+
function isSvelteServerComponent(component) {
|
|
4012
|
+
return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
|
|
4013
|
+
}
|
|
4014
|
+
|
|
4015
|
+
function isSvelteClientComponent(component) {
|
|
4016
|
+
return component.prototype instanceof SvelteComponent;
|
|
4017
|
+
}
|
|
4007
4018
|
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
return
|
|
4019
|
+
function isSvelteComponent(component) {
|
|
4020
|
+
if (typeof document === 'undefined') {
|
|
4021
|
+
return isSvelteServerComponent(component);
|
|
4011
4022
|
} else {
|
|
4012
|
-
return
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4023
|
+
return isSvelteClientComponent(component);
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
|
|
4027
|
+
function wrapInPlaceholder(content) {
|
|
4028
|
+
return renderComponent(Placeholder, {
|
|
4029
|
+
content
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
function render(component, props) {
|
|
4034
|
+
if (!component) return null;
|
|
4035
|
+
|
|
4036
|
+
if (isSvelteComponent(component)) {
|
|
4037
|
+
return renderComponent(component, props);
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
if (typeof component === 'function') {
|
|
4041
|
+
const result = component(props);
|
|
4042
|
+
|
|
4043
|
+
if (isSvelteComponent(result)) {
|
|
4044
|
+
return result;
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
return wrapInPlaceholder(result);
|
|
4048
|
+
}
|
|
4016
4049
|
|
|
4050
|
+
return wrapInPlaceholder(component);
|
|
4017
4051
|
}
|
|
4018
4052
|
const createTable = createTableFactory({
|
|
4019
4053
|
render
|