intable 0.0.60 → 0.0.62
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/dist/__uno.css +1 -1
- package/dist/components/Tooltip.js +9 -8
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +118 -111
- package/dist/hooks/useSelector.d.ts +6 -1
- package/dist/hooks/useSelector.js +27 -23
- package/dist/index.d.ts +14 -6
- package/dist/index.js +219 -207
- package/dist/plugins/BranchGraphPlugin.d.ts +24 -0
- package/dist/plugins/BranchGraphPlugin.js +218 -0
- package/dist/plugins/ExpandPlugin.js +3 -2
- package/dist/plugins/ImportExportPlugin.js +8 -2
- package/dist/plugins/RenderPlugin/components.js +7 -3
- package/dist/plugins/RowSelectionPlugin.d.ts +1 -0
- package/dist/plugins/RowSelectionPlugin.js +3 -0
- package/dist/plugins/TooltipPlugin.d.ts +3 -3
- package/dist/plugins/TooltipPlugin.js +46 -35
- package/dist/style.css +2 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +41 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderComponent, solidComponent } from "./components/utils.js";
|
|
2
|
-
import { unFn } from "./utils.js";
|
|
2
|
+
import { pxsuffix, unFn } from "./utils.js";
|
|
3
3
|
import './style.css';;/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { CellSelectionPlugin } from "./plugins/CellSelectionPlugin.js";
|
|
@@ -25,6 +25,7 @@ import { ImportExportPlugin } from "./plugins/ImportExportPlugin.js";
|
|
|
25
25
|
import { TooltipPlugin } from "./plugins/TooltipPlugin.js";
|
|
26
26
|
import { KeyEachPlugin } from "./plugins/KeyEachPlugin.js";
|
|
27
27
|
import { PaginationPlugin } from "./plugins/PaginationPlugin.js";
|
|
28
|
+
import { BranchGraphPlugin } from "./plugins/BranchGraphPlugin.js";
|
|
28
29
|
import loading_bold_default from "./loading-bold.js";
|
|
29
30
|
import { className, createComponent, effect, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
|
|
30
31
|
import { $PROXY, For, batch, createComputed, createContext, createEffect, createMemo, createRenderEffect, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, onCleanup, onMount, runWithOwner, useContext } from "solid-js";
|
|
@@ -38,49 +39,49 @@ var _tmpl$ = /* @__PURE__ */ template("<div>"), _tmpl$2 = /* @__PURE__ */ templa
|
|
|
38
39
|
const Ctx = createContext({
|
|
39
40
|
props: {},
|
|
40
41
|
store: {}
|
|
41
|
-
}), Intable = (
|
|
42
|
-
|
|
43
|
-
let
|
|
42
|
+
}), Intable = (g) => {
|
|
43
|
+
g = mergeProps$1({ rowKey: "id" }, g);
|
|
44
|
+
let G = getOwner(), K = createMutable({
|
|
44
45
|
get rawProps() {
|
|
45
|
-
return
|
|
46
|
+
return g[$PROXY] ||= g;
|
|
46
47
|
},
|
|
47
48
|
get plugins() {
|
|
48
|
-
return
|
|
49
|
+
return Y();
|
|
49
50
|
},
|
|
50
51
|
owner: getOwner()
|
|
51
|
-
}),
|
|
52
|
-
let
|
|
52
|
+
}), J = memoize((g) => runWithOwner(G, () => unFn(g, K))), Y = createMemo((q) => {
|
|
53
|
+
let Y = uniq([
|
|
53
54
|
...defaultsPlugins,
|
|
54
|
-
...
|
|
55
|
+
...g.plugins || [],
|
|
55
56
|
RenderPlugin
|
|
56
|
-
].flat().map(
|
|
57
|
-
return runWithOwner(
|
|
58
|
-
|
|
59
|
-
}),
|
|
57
|
+
].flat().map(J).sort((g, G) => (G.priority || 0) - (g.priority || 0))), X = difference(Y, q);
|
|
58
|
+
return runWithOwner(G, () => {
|
|
59
|
+
X.forEach((g) => Object.assign(K, g.store?.(K)));
|
|
60
|
+
}), Y;
|
|
60
61
|
}, [], { equals: isEqual });
|
|
61
|
-
|
|
62
|
-
let
|
|
63
|
-
function
|
|
64
|
-
return createMemo(() =>
|
|
62
|
+
K.props = (() => {
|
|
63
|
+
let G = getOwner(), q = {}, J = (g) => q[g] ??= runWithOwner(G, () => createMemo(() => X(g)));
|
|
64
|
+
function X(G) {
|
|
65
|
+
return createMemo(() => Y().map((g) => g.rewriteProps?.[G]).filter((g) => g), void 0, { equals: isEqual })().reduce((g, q) => q({ [G]: g }, { store: K }), g[G]);
|
|
65
66
|
}
|
|
66
|
-
return new Proxy({}, { get(
|
|
67
|
-
return
|
|
67
|
+
return new Proxy({}, { get(g, G, K) {
|
|
68
|
+
return G == $PROXY ? K : J(G)();
|
|
68
69
|
} });
|
|
69
|
-
})(), createComputed(mapArray(
|
|
70
|
-
createEffect(mapArray(
|
|
70
|
+
})(), createComputed(mapArray(Y, (g) => g.onInit?.(K))), onMount(() => {
|
|
71
|
+
createEffect(mapArray(Y, (g) => g.onMount?.(K)));
|
|
71
72
|
});
|
|
72
|
-
let
|
|
73
|
-
props:
|
|
74
|
-
store:
|
|
73
|
+
let X = createMutable({
|
|
74
|
+
props: K.props,
|
|
75
|
+
store: K
|
|
75
76
|
});
|
|
76
|
-
return window.store =
|
|
77
|
-
let
|
|
78
|
-
|
|
77
|
+
return window.store = K, window.ctx = X, createRenderEffect(() => {
|
|
78
|
+
let g = K.props.store;
|
|
79
|
+
g && (typeof g == "function" ? g(K) : "value" in g ? g.value = K : "current" in g && (g.current = K));
|
|
79
80
|
}), createComponent(Ctx.Provider, {
|
|
80
|
-
value:
|
|
81
|
+
value: X,
|
|
81
82
|
get children() {
|
|
82
|
-
return createComponent(
|
|
83
|
-
return createComponent(
|
|
83
|
+
return createComponent(X.props.Scroll, { get children() {
|
|
84
|
+
return createComponent(X.props.Table, { get children() {
|
|
84
85
|
return [createComponent(THead, {}), createComponent(TBody, {})];
|
|
85
86
|
} });
|
|
86
87
|
} });
|
|
@@ -88,65 +89,65 @@ const Ctx = createContext({
|
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
91
|
var THead = () => {
|
|
91
|
-
let { props:
|
|
92
|
-
return createComponent(
|
|
93
|
-
return createComponent(
|
|
94
|
-
return createComponent(
|
|
92
|
+
let { props: G, store: K } = useContext(Ctx);
|
|
93
|
+
return createComponent(G.Thead, { get children() {
|
|
94
|
+
return createComponent(G.Tr, { get children() {
|
|
95
|
+
return createComponent(G.EachCells, {
|
|
95
96
|
get each() {
|
|
96
|
-
return
|
|
97
|
+
return G.columns || [];
|
|
97
98
|
},
|
|
98
|
-
children: (
|
|
99
|
+
children: (q, J) => createComponent(G.Th, {
|
|
99
100
|
get col() {
|
|
100
|
-
return
|
|
101
|
+
return q();
|
|
101
102
|
},
|
|
102
103
|
get x() {
|
|
103
|
-
return
|
|
104
|
+
return J();
|
|
104
105
|
},
|
|
105
106
|
get children() {
|
|
106
|
-
return renderComponent(
|
|
107
|
+
return renderComponent(q().name, void 0, K);
|
|
107
108
|
}
|
|
108
109
|
})
|
|
109
110
|
});
|
|
110
111
|
} });
|
|
111
112
|
} });
|
|
112
113
|
}, TBody = () => {
|
|
113
|
-
let { props:
|
|
114
|
-
return createComponent(
|
|
115
|
-
return createComponent(
|
|
114
|
+
let { props: g, store: G } = useContext(Ctx);
|
|
115
|
+
return createComponent(g.Tbody, { get children() {
|
|
116
|
+
return createComponent(g.EachRows, {
|
|
116
117
|
get each() {
|
|
117
|
-
return
|
|
118
|
+
return g.data;
|
|
118
119
|
},
|
|
119
|
-
children: (
|
|
120
|
+
children: (K, q) => createComponent(g.Tr, {
|
|
120
121
|
get y() {
|
|
121
|
-
return
|
|
122
|
+
return q();
|
|
122
123
|
},
|
|
123
124
|
get data() {
|
|
124
|
-
return
|
|
125
|
+
return K();
|
|
125
126
|
},
|
|
126
127
|
get children() {
|
|
127
|
-
return createComponent(
|
|
128
|
+
return createComponent(g.EachCells, {
|
|
128
129
|
get each() {
|
|
129
|
-
return
|
|
130
|
+
return g.columns;
|
|
130
131
|
},
|
|
131
|
-
children: (
|
|
132
|
+
children: (J, Y) => createComponent(g.Td, {
|
|
132
133
|
get col() {
|
|
133
|
-
return
|
|
134
|
+
return J();
|
|
134
135
|
},
|
|
135
136
|
get x() {
|
|
136
|
-
return
|
|
137
|
+
return Y();
|
|
137
138
|
},
|
|
138
139
|
get y() {
|
|
139
|
-
return
|
|
140
|
+
return q();
|
|
140
141
|
},
|
|
141
142
|
get data() {
|
|
142
|
-
return
|
|
143
|
+
return K();
|
|
143
144
|
},
|
|
144
145
|
get value() {
|
|
145
|
-
return
|
|
146
|
+
return K()[J().id];
|
|
146
147
|
},
|
|
147
|
-
onChange: (
|
|
148
|
-
...
|
|
149
|
-
[
|
|
148
|
+
onChange: (g) => G.commands.rowChange({
|
|
149
|
+
...K(),
|
|
150
|
+
[J().id]: g
|
|
150
151
|
})
|
|
151
152
|
})
|
|
152
153
|
});
|
|
@@ -156,60 +157,60 @@ var THead = () => {
|
|
|
156
157
|
} });
|
|
157
158
|
}, src_default = Intable;
|
|
158
159
|
function BasePlugin() {
|
|
159
|
-
let
|
|
160
|
+
let g = {
|
|
160
161
|
col: null,
|
|
161
162
|
data: null,
|
|
162
163
|
onChange: null
|
|
163
|
-
},
|
|
164
|
-
var
|
|
165
|
-
return spread(
|
|
166
|
-
})(), J = (
|
|
167
|
-
var
|
|
168
|
-
return spread(
|
|
169
|
-
})(), Y = (
|
|
170
|
-
var
|
|
171
|
-
return spread(
|
|
172
|
-
})(), X = (
|
|
173
|
-
var
|
|
174
|
-
return spread(
|
|
175
|
-
})(), Z = (
|
|
176
|
-
var
|
|
177
|
-
return spread(
|
|
178
|
-
})(), Q = (
|
|
179
|
-
var
|
|
180
|
-
return spread(
|
|
181
|
-
})(), $ = (
|
|
182
|
-
var
|
|
183
|
-
return spread(
|
|
164
|
+
}, G = (g) => (() => {
|
|
165
|
+
var G = _tmpl$();
|
|
166
|
+
return spread(G, g, !1, !1), G;
|
|
167
|
+
})(), J = (g) => (() => {
|
|
168
|
+
var G = _tmpl$2();
|
|
169
|
+
return spread(G, g, !1, !1), G;
|
|
170
|
+
})(), Y = (g) => (() => {
|
|
171
|
+
var G = _tmpl$3();
|
|
172
|
+
return spread(G, g, !1, !1), G;
|
|
173
|
+
})(), X = (g) => (() => {
|
|
174
|
+
var G = _tmpl$4();
|
|
175
|
+
return spread(G, g, !1, !1), G;
|
|
176
|
+
})(), Z = (G) => (() => {
|
|
177
|
+
var K = _tmpl$5();
|
|
178
|
+
return spread(K, mergeProps(G, g), !1, !1), K;
|
|
179
|
+
})(), Q = (G) => (() => {
|
|
180
|
+
var K = _tmpl$6();
|
|
181
|
+
return spread(K, mergeProps(G, g), !1, !1), K;
|
|
182
|
+
})(), $ = (G) => (() => {
|
|
183
|
+
var K = _tmpl$7();
|
|
184
|
+
return spread(K, mergeProps(G, g), !1, !1), K;
|
|
184
185
|
})();
|
|
185
186
|
return {
|
|
186
187
|
name: "base",
|
|
187
188
|
priority: Infinity,
|
|
188
|
-
store: (
|
|
189
|
-
let
|
|
189
|
+
store: (g) => {
|
|
190
|
+
let G = makeResizeObserver((G) => {
|
|
190
191
|
batch(() => {
|
|
191
|
-
for (let
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
width:
|
|
195
|
-
height:
|
|
192
|
+
for (let K of G) {
|
|
193
|
+
let G = K.target, { inlineSize: q, blockSize: J } = K.borderBoxSize[0], Y = G.getAttribute("x");
|
|
194
|
+
Y >= 0 && G.parentElement && (g.thSizes[Y] = {
|
|
195
|
+
width: q,
|
|
196
|
+
height: J
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
199
|
});
|
|
199
|
-
}),
|
|
200
|
+
}), K = makeResizeObserver((G) => {
|
|
200
201
|
batch(() => {
|
|
201
|
-
for (let
|
|
202
|
-
let
|
|
203
|
-
|
|
204
|
-
width:
|
|
205
|
-
height:
|
|
202
|
+
for (let K of G) {
|
|
203
|
+
let G = K.target, { inlineSize: q, blockSize: J } = K.borderBoxSize[0], Y = G.getAttribute("y");
|
|
204
|
+
Y >= 0 && G.parentElement && (g.trSizes[Y] = {
|
|
205
|
+
width: q,
|
|
206
|
+
height: J
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
210
|
});
|
|
210
211
|
return {
|
|
211
|
-
thObs:
|
|
212
|
-
trObs:
|
|
212
|
+
thObs: G,
|
|
213
|
+
trObs: K,
|
|
213
214
|
ths: [],
|
|
214
215
|
thSizes: [],
|
|
215
216
|
trs: [],
|
|
@@ -220,139 +221,149 @@ function BasePlugin() {
|
|
|
220
221
|
};
|
|
221
222
|
},
|
|
222
223
|
rewriteProps: {
|
|
223
|
-
data: ({ data:
|
|
224
|
-
columns: ({ columns:
|
|
225
|
-
newRow: ({ newRow:
|
|
226
|
-
let
|
|
227
|
-
return
|
|
224
|
+
data: ({ data: g = [] }) => g,
|
|
225
|
+
columns: ({ columns: g = [] }) => g,
|
|
226
|
+
newRow: ({ newRow: g }, { store: G }) => function() {
|
|
227
|
+
let K = g?.(...arguments) || {};
|
|
228
|
+
return K[G.props.rowKey] ??= Symbol(), K;
|
|
228
229
|
},
|
|
229
|
-
Scroll: ({ Scroll:
|
|
230
|
-
let
|
|
231
|
-
let
|
|
232
|
-
if (!
|
|
233
|
-
let
|
|
234
|
-
return
|
|
230
|
+
Scroll: ({ Scroll: g = G }, { store: K }) => (G) => {
|
|
231
|
+
let q = createScrollPosition(() => K.scroll_el), J = createElementSize(() => K.scroll_el), Y = createMemo(() => {
|
|
232
|
+
let g = K.scroll_el;
|
|
233
|
+
if (!g) return;
|
|
234
|
+
let G = q.x == 0, Y = q.x >= g.scrollWidth - (J.width || 0);
|
|
235
|
+
return G && Y ? "" : !G && !Y ? "is-scroll-mid" : G ? "is-scroll-left" : Y ? "is-scroll-right" : "";
|
|
235
236
|
});
|
|
236
|
-
|
|
237
|
-
return `data-table data-table--${
|
|
237
|
+
G = combineProps(G, { get class() {
|
|
238
|
+
return `data-table data-table--${K.props.size} flex flex-col`;
|
|
238
239
|
} }, {
|
|
239
240
|
get class() {
|
|
240
|
-
return
|
|
241
|
+
return K.props.class;
|
|
241
242
|
},
|
|
242
243
|
get style() {
|
|
243
|
-
return
|
|
244
|
+
return K.props.style;
|
|
244
245
|
}
|
|
245
246
|
}, { get class() {
|
|
246
|
-
return
|
|
247
|
+
return Y();
|
|
247
248
|
} });
|
|
248
|
-
let
|
|
249
|
-
return createComponent(
|
|
249
|
+
let X = mapArray(() => K.plugins.flatMap((g) => g.layers ?? []), (g) => createComponent(g, K));
|
|
250
|
+
return createComponent(g, mergeProps({ tabindex: -1 }, G, { get children() {
|
|
250
251
|
return [
|
|
251
|
-
createComponent(
|
|
252
|
+
createComponent(K.props.Header, {}),
|
|
252
253
|
(() => {
|
|
253
|
-
var
|
|
254
|
-
return insert(
|
|
254
|
+
var g = _tmpl$8();
|
|
255
|
+
return insert(g, X), g;
|
|
255
256
|
})(),
|
|
256
257
|
(() => {
|
|
257
|
-
var
|
|
258
|
-
return use((
|
|
259
|
-
var
|
|
260
|
-
return () =>
|
|
261
|
-
})(), null), effect(() => className(
|
|
258
|
+
var g = _tmpl$();
|
|
259
|
+
return use((g) => K.scroll_el = g, g), insert(g, () => G.children, null), insert(g, createComponent(K.props.ScrollFooter, {}), null), insert(g, (() => {
|
|
260
|
+
var g = memo(() => !K.props.data.length);
|
|
261
|
+
return () => g() && _tmpl$9();
|
|
262
|
+
})(), null), effect(() => className(g, `data-table--scroll-view relative h-full max-h-inherit flex-1 ${K.props.border && "data-table--border"}`)), g;
|
|
262
263
|
})(),
|
|
263
|
-
createComponent(
|
|
264
|
+
createComponent(K.props.Footer, {})
|
|
264
265
|
];
|
|
265
266
|
} }));
|
|
266
267
|
},
|
|
267
|
-
Header: ({ Header:
|
|
268
|
-
var
|
|
269
|
-
return spread(
|
|
270
|
-
})(), (
|
|
271
|
-
Footer: ({ Footer:
|
|
272
|
-
var
|
|
273
|
-
return spread(
|
|
274
|
-
})(), (
|
|
275
|
-
ScrollFooter: ({ ScrollFooter:
|
|
276
|
-
var
|
|
277
|
-
return spread(
|
|
278
|
-
})(), (
|
|
279
|
-
Table: ({ Table:
|
|
280
|
-
ref: (
|
|
281
|
-
class: "data-table--table"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
268
|
+
Header: ({ Header: g }) => (g ??= (g) => (() => {
|
|
269
|
+
var G = _tmpl$();
|
|
270
|
+
return spread(G, mergeProps(() => combineProps({ class: "data-table__header" }, g)), !1, !1), G;
|
|
271
|
+
})(), (G) => createComponent(g, G)),
|
|
272
|
+
Footer: ({ Footer: g }) => (g ??= (g) => (() => {
|
|
273
|
+
var G = _tmpl$();
|
|
274
|
+
return spread(G, mergeProps(() => combineProps({ class: "data-table__footer" }, g)), !1, !1), G;
|
|
275
|
+
})(), (G) => createComponent(g, G)),
|
|
276
|
+
ScrollFooter: ({ ScrollFooter: g }) => (g ??= (g) => (() => {
|
|
277
|
+
var G = _tmpl$();
|
|
278
|
+
return spread(G, mergeProps(() => combineProps({ class: "data-table__scroll__footer" }, g)), !1, !1), G;
|
|
279
|
+
})(), (G) => createComponent(g, G)),
|
|
280
|
+
Table: ({ Table: g = J }, { store: G }) => (q) => (q = combineProps({
|
|
281
|
+
ref: (g) => G.table = g,
|
|
282
|
+
class: "data-table--table",
|
|
283
|
+
style: `width: ${pxsuffix(G.scroll?.x) ?? ""}`
|
|
284
|
+
}, q), createComponent(g, q)),
|
|
285
|
+
Thead: ({ Thead: g = Y }, { store: G }) => (K) => (K = combineProps({ ref: (g) => G.thead = g }, K), createComponent(g, K)),
|
|
286
|
+
Tbody: ({ Tbody: g = X }, { store: G }) => (K) => (K = combineProps({ ref: (g) => G.tbody = g }, K), createComponent(g, K)),
|
|
287
|
+
Tr: ({ Tr: g = Z }, { store: G }) => (K) => {
|
|
288
|
+
let [J, Y] = createSignal(), X = combineProps({
|
|
289
|
+
ref: Y,
|
|
290
|
+
get class() {
|
|
291
|
+
return K.y == null ? "" : unFn(G.props.rowClass, K);
|
|
292
|
+
},
|
|
293
|
+
get style() {
|
|
294
|
+
return K.y == null ? "" : unFn(G.props.rowStyle, K);
|
|
295
|
+
},
|
|
296
|
+
onClick: (g) => K.y != null && G.props.onRowClick?.(K.data, K.y, g)
|
|
297
|
+
}, K);
|
|
298
|
+
return createEffect(() => {
|
|
299
|
+
let { y: g } = K;
|
|
300
|
+
g != null && (G.trs[g] = J(), G.trObs.observe(J()), onCleanup(() => {
|
|
301
|
+
G.trObs.unobserve(J()), G.trs[g] = void 0, !(G.props.data.length > g) && (G.trSizes[g] = void 0);
|
|
291
302
|
}));
|
|
292
|
-
}), createComponent(
|
|
303
|
+
}), createComponent(g, X);
|
|
293
304
|
},
|
|
294
|
-
Th: ({ Th:
|
|
295
|
-
let [
|
|
296
|
-
ref:
|
|
305
|
+
Th: ({ Th: g = Q }, { store: G }) => (K) => {
|
|
306
|
+
let [J, Y] = createSignal(), { props: X } = useContext(Ctx), Z = combineProps(K, {
|
|
307
|
+
ref: Y,
|
|
297
308
|
get class() {
|
|
298
|
-
return [unFn(
|
|
309
|
+
return [unFn(X.cellClass, K), K.col.class].filter(Boolean).join(" ");
|
|
299
310
|
},
|
|
300
311
|
get style() {
|
|
301
312
|
return [
|
|
302
|
-
unFn(
|
|
303
|
-
|
|
304
|
-
|
|
313
|
+
unFn(X.cellStyle, K),
|
|
314
|
+
K.col.style,
|
|
315
|
+
K.col.width && `width: ${K.col.width}px; min-width: ${K.col.width}px; max-width: ${K.col.width}px`
|
|
305
316
|
].filter(Boolean).join(";");
|
|
306
317
|
}
|
|
307
318
|
});
|
|
308
319
|
return createEffect(() => {
|
|
309
|
-
if (
|
|
310
|
-
let { x:
|
|
311
|
-
|
|
312
|
-
|
|
320
|
+
if (K.covered || (K.colspan ?? 1) != 1) return;
|
|
321
|
+
let { x: g } = K;
|
|
322
|
+
G.ths[g] = J(), G.thObs.observe(J()), onCleanup(() => {
|
|
323
|
+
G.thObs.unobserve(J()), G.ths[g] = void 0, !(G.props.columns.length > g) && (G.thSizes[g] = void 0);
|
|
313
324
|
});
|
|
314
|
-
}), createComponent(
|
|
315
|
-
return
|
|
325
|
+
}), createComponent(g, mergeProps(Z, { get children() {
|
|
326
|
+
return K.children;
|
|
316
327
|
} }));
|
|
317
328
|
},
|
|
318
|
-
Td: ({ Td:
|
|
319
|
-
let { props:
|
|
329
|
+
Td: ({ Td: g = $ }, { store: G }) => (G) => {
|
|
330
|
+
let { props: K } = useContext(Ctx), J = mergeProps$1(G, {
|
|
320
331
|
get class() {
|
|
321
332
|
return [
|
|
322
|
-
unFn(
|
|
323
|
-
|
|
324
|
-
|
|
333
|
+
unFn(K.cellClass, G),
|
|
334
|
+
G.col.class,
|
|
335
|
+
G.class
|
|
325
336
|
].filter(Boolean).join(" ");
|
|
326
337
|
},
|
|
327
338
|
get style() {
|
|
328
339
|
return [
|
|
329
|
-
unFn(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
340
|
+
unFn(K.cellStyle, G),
|
|
341
|
+
G.col.style,
|
|
342
|
+
G.col.width && `width: ${G.col.width}px; min-width: ${G.col.width}px; max-width: ${G.col.width}px`,
|
|
343
|
+
G.style
|
|
333
344
|
].filter(Boolean).join(";");
|
|
334
345
|
}
|
|
335
346
|
});
|
|
336
|
-
return createComponent(
|
|
347
|
+
return createComponent(g, J);
|
|
337
348
|
},
|
|
338
|
-
EachRows: ({ EachRows:
|
|
349
|
+
EachRows: ({ EachRows: g }) => g || ((g) => createComponent(For, {
|
|
339
350
|
get each() {
|
|
340
|
-
return
|
|
351
|
+
return g.each;
|
|
341
352
|
},
|
|
342
|
-
children: (
|
|
353
|
+
children: (G, K) => g.children(() => G, K)
|
|
343
354
|
})),
|
|
344
|
-
EachCells: ({ EachCells:
|
|
355
|
+
EachCells: ({ EachCells: g }) => g || ((g) => createComponent(For, {
|
|
345
356
|
get each() {
|
|
346
|
-
return
|
|
357
|
+
return g.each;
|
|
347
358
|
},
|
|
348
|
-
children: (
|
|
359
|
+
children: (G, K) => g.children(() => G, K)
|
|
349
360
|
})),
|
|
350
|
-
renderer: ({ renderer:
|
|
361
|
+
renderer: ({ renderer: g = (g) => g }) => g
|
|
351
362
|
},
|
|
352
|
-
layers: [function(
|
|
353
|
-
return memo(() => memo(() => !!
|
|
354
|
-
var
|
|
355
|
-
return insert(
|
|
363
|
+
layers: [function(g) {
|
|
364
|
+
return memo(() => memo(() => !!g.props.loading)() ? (() => {
|
|
365
|
+
var g = _tmpl$0();
|
|
366
|
+
return insert(g, createComponent(loading_bold_default, { class: "text-2xl animate-spin" })), g;
|
|
356
367
|
})() : null);
|
|
357
368
|
}]
|
|
358
369
|
};
|
|
@@ -364,30 +375,30 @@ const defaultsPlugins = [
|
|
|
364
375
|
CellSelectionPlugin,
|
|
365
376
|
{
|
|
366
377
|
name: "sticky-header",
|
|
367
|
-
rewriteProps: { Thead: ({ Thead:
|
|
368
|
-
let { props:
|
|
369
|
-
return
|
|
370
|
-
return
|
|
371
|
-
} },
|
|
378
|
+
rewriteProps: { Thead: ({ Thead: g }) => (G) => {
|
|
379
|
+
let { props: K } = useContext(Ctx);
|
|
380
|
+
return G = combineProps({ get class() {
|
|
381
|
+
return K.stickyHeader ? "sticky-header" : "";
|
|
382
|
+
} }, G), createComponent(g, G);
|
|
372
383
|
} }
|
|
373
384
|
},
|
|
374
385
|
HeaderGroupPlugin,
|
|
375
|
-
(
|
|
376
|
-
let
|
|
377
|
-
let
|
|
378
|
-
for (let [
|
|
379
|
-
return
|
|
380
|
-
}),
|
|
386
|
+
(g) => {
|
|
387
|
+
let G = createLazyMemo(() => {
|
|
388
|
+
let G = {};
|
|
389
|
+
for (let [K, q] of g.props.columns.entries()) q.fixed === "left" && (G[K] = sumBy(g.thSizes.slice(0, K), (g) => g?.width || 0)), q.fixed === "right" && (G[K] = sumBy(g.thSizes.slice(K + 1), (g) => g?.width || 0));
|
|
390
|
+
return G;
|
|
391
|
+
}), K = createLazyMemo(() => g.props.columns.filter((g) => g.fixed == "left").length - 1), J = createLazyMemo(() => g.props.columns.length - g.props.columns.filter((g) => g.fixed == "right").length);
|
|
381
392
|
return {
|
|
382
393
|
name: "fixed-column",
|
|
383
394
|
rewriteProps: {
|
|
384
|
-
columns: ({ columns:
|
|
385
|
-
...
|
|
386
|
-
...
|
|
387
|
-
...
|
|
395
|
+
columns: ({ columns: g }) => [
|
|
396
|
+
...g?.filter((g) => g.fixed == "left") || [],
|
|
397
|
+
...g?.filter((g) => !g.fixed) || [],
|
|
398
|
+
...g?.filter((g) => g.fixed == "right") || []
|
|
388
399
|
],
|
|
389
|
-
cellClass: ({ cellClass:
|
|
390
|
-
cellStyle: ({ cellStyle:
|
|
400
|
+
cellClass: ({ cellClass: g }) => (G) => (unFn(g, G) || "") + (G.col.fixed ? ` fixed-${G.col.fixed} ${G.x == K() ? "is-last" : ""} ${G.x == J() ? "is-first" : ""}` : ""),
|
|
401
|
+
cellStyle: ({ cellStyle: g }) => (K) => (unFn(g, K) || "") + (K.col.fixed ? `; ${K.col.fixed}: ${G()[K.x]}px` : "")
|
|
391
402
|
}
|
|
392
403
|
};
|
|
393
404
|
},
|
|
@@ -398,17 +409,17 @@ const defaultsPlugins = [
|
|
|
398
409
|
{
|
|
399
410
|
name: "index",
|
|
400
411
|
priority: -Infinity,
|
|
401
|
-
store: (
|
|
412
|
+
store: (g) => ({ $index: {
|
|
402
413
|
name: "",
|
|
403
414
|
id: Symbol("index"),
|
|
404
415
|
fixed: "left",
|
|
405
|
-
[
|
|
416
|
+
[g.internal]: 1,
|
|
406
417
|
width: 40,
|
|
407
418
|
style: "text-align: center",
|
|
408
419
|
class: "index",
|
|
409
|
-
render: solidComponent((
|
|
420
|
+
render: solidComponent((g) => memo(() => g.y + 1))
|
|
410
421
|
} }),
|
|
411
|
-
rewriteProps: { columns: ({ columns:
|
|
422
|
+
rewriteProps: { columns: ({ columns: g }, { store: G }) => G.props?.index ? [G.$index, ...g || []] : g }
|
|
412
423
|
},
|
|
413
424
|
FilterPlugin,
|
|
414
425
|
SortPlugin,
|
|
@@ -418,11 +429,11 @@ const defaultsPlugins = [
|
|
|
418
429
|
TreePlugin,
|
|
419
430
|
{
|
|
420
431
|
name: "fit-col-width",
|
|
421
|
-
rewriteProps: { Table: ({ Table:
|
|
422
|
-
let
|
|
423
|
-
return
|
|
424
|
-
return
|
|
425
|
-
} }), createComponent(
|
|
432
|
+
rewriteProps: { Table: ({ Table: g }, { store: G }) => (K) => {
|
|
433
|
+
let q = createMemo(() => G.props.columns.some((g) => !g.width));
|
|
434
|
+
return K = combineProps(K, { get style() {
|
|
435
|
+
return q() ? "min-width: 100%" : "min-width: unset";
|
|
436
|
+
} }), createComponent(g, K);
|
|
426
437
|
} }
|
|
427
438
|
},
|
|
428
439
|
RowGroupPlugin,
|
|
@@ -432,6 +443,7 @@ const defaultsPlugins = [
|
|
|
432
443
|
ImportExportPlugin,
|
|
433
444
|
TooltipPlugin,
|
|
434
445
|
KeyEachPlugin,
|
|
435
|
-
PaginationPlugin
|
|
446
|
+
PaginationPlugin,
|
|
447
|
+
BranchGraphPlugin
|
|
436
448
|
];
|
|
437
449
|
export { Ctx, Intable, src_default as default, defaultsPlugins };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Plugin$0 } from '../index';
|
|
2
|
+
declare module '../index' {
|
|
3
|
+
interface TableProps {
|
|
4
|
+
/**
|
|
5
|
+
* Render a git-style branch graph in a dedicated leading column.
|
|
6
|
+
*
|
|
7
|
+
* Each row links to its parent(s) via a `parentid` field (a single id or an
|
|
8
|
+
* array of ids for merge rows). Display order must be topological: a parent
|
|
9
|
+
* must appear above its children. The connecting lines are drawn as a single
|
|
10
|
+
* SVG overlay injected through `rewriteProps.Table`.
|
|
11
|
+
*/
|
|
12
|
+
branchGraph?: {
|
|
13
|
+
/** Field holding a row's parent id(s). Default `'parentid'`. */
|
|
14
|
+
parentField?: string;
|
|
15
|
+
/** Branch graph column width. Default `120`. */
|
|
16
|
+
width?: number;
|
|
17
|
+
/** Pixel gap between lanes. Default `18`. */
|
|
18
|
+
laneGap?: number;
|
|
19
|
+
/** Lane color palette (cycled by lane index). */
|
|
20
|
+
colors?: string[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare const BranchGraphPlugin: Plugin$0;
|