intable 0.0.3 → 0.0.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/README.md +2 -1
- package/dist/__uno.css +1 -1
- package/dist/chevron-right.js +3 -5
- package/dist/components/Columns.js +50 -84
- package/dist/components/DocTree.js +21 -29
- package/dist/components/Menu.js +81 -105
- package/dist/components/Popover.js +23 -31
- package/dist/components/Render.js +10 -11
- package/dist/components/Split.js +34 -46
- package/dist/components/Tree.js +38 -57
- package/dist/components/utils.js +4 -6
- package/dist/hooks/index.js +91 -128
- package/dist/hooks/useDir.js +22 -39
- package/dist/hooks/useSort.js +47 -70
- package/dist/hooks/useVirtualizer.js +43 -68
- package/dist/index.js +158 -213
- package/dist/loading.js +3 -5
- package/dist/plugins/CellMergePlugin.d.ts +0 -2
- package/dist/plugins/CellSelectionPlugin.js +77 -117
- package/dist/plugins/CommandPlugin.js +3 -6
- package/dist/plugins/CopyPastePlugin.js +24 -37
- package/dist/plugins/DiffPlugin.js +33 -45
- package/dist/plugins/DragPlugin.d.ts +2 -2
- package/dist/plugins/DragPlugin.js +29 -45
- package/dist/plugins/EditablePlugin.js +88 -139
- package/dist/plugins/ExpandPlugin.js +26 -30
- package/dist/plugins/HistoryPlugin.js +16 -21
- package/dist/plugins/MenuPlugin.js +51 -76
- package/dist/plugins/RenderPlugin/components.js +45 -63
- package/dist/plugins/RenderPlugin/index.js +29 -42
- package/dist/plugins/ResizePlugin.js +44 -80
- package/dist/plugins/RowGroupPlugin.js +57 -73
- package/dist/plugins/RowSelectionPlugin.js +31 -42
- package/dist/plugins/VirtualScrollPlugin.js +54 -79
- package/dist/plus.js +3 -5
- package/dist/style.css +2 -192
- package/dist/utils.js +44 -65
- package/dist/wc.js +11 -11
- package/dist/x.js +3 -5
- package/package.json +2 -1
- package/dist/plugins/DragColumnPlugin.d.ts +0 -2
- package/dist/plugins/DragColumnPlugin.js +0 -4
package/dist/index.js
CHANGED
|
@@ -19,109 +19,100 @@ import { combineProps } from "@solid-primitives/props";
|
|
|
19
19
|
import { difference, mapValues, sumBy } from "es-toolkit";
|
|
20
20
|
import { createElementSize, createResizeObserver } from "@solid-primitives/resize-observer";
|
|
21
21
|
import { createScrollPosition } from "@solid-primitives/scroll";
|
|
22
|
-
var _tmpl$ = /* @__PURE__ */ template(
|
|
22
|
+
var _tmpl$ = /* @__PURE__ */ template("<table>"), _tmpl$2 = /* @__PURE__ */ template("<thead>"), _tmpl$3 = /* @__PURE__ */ template("<tbody>"), _tmpl$4 = /* @__PURE__ */ template("<tr>"), _tmpl$5 = /* @__PURE__ */ template("<th>"), _tmpl$6 = /* @__PURE__ */ template("<td>"), _tmpl$7 = /* @__PURE__ */ template("<div><div class=data-table__layers></div><table class=data-table--table>");
|
|
23
23
|
const Ctx = createContext({
|
|
24
24
|
props: {},
|
|
25
25
|
store: {}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const plugins = createMemo(() => [
|
|
26
|
+
}), Intable = (g) => {
|
|
27
|
+
g = mergeProps$1({ rowKey: "id" }, g);
|
|
28
|
+
let q = createMemo(() => [
|
|
30
29
|
...defaultsPlugins,
|
|
31
|
-
...
|
|
30
|
+
...g.plugins || [],
|
|
32
31
|
RenderPlugin
|
|
33
|
-
].sort((
|
|
34
|
-
const store = createMutable({
|
|
32
|
+
].sort((g, G) => (G.priority || 0) - (g.priority || 0))), J = createMutable({
|
|
35
33
|
get rawProps() {
|
|
36
|
-
return
|
|
34
|
+
return g;
|
|
37
35
|
},
|
|
38
36
|
get plugins() {
|
|
39
|
-
return
|
|
37
|
+
return q();
|
|
40
38
|
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
return plugins();
|
|
39
|
+
}), Y = getOwner();
|
|
40
|
+
createComputed((g) => {
|
|
41
|
+
let G = difference(q(), g);
|
|
42
|
+
return runWithOwner(Y, () => {
|
|
43
|
+
G.forEach((g) => Object.assign(J, g.store?.(J)));
|
|
44
|
+
}), q();
|
|
49
45
|
}, []);
|
|
50
|
-
|
|
51
|
-
createComputed(mapArray(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
pluginsProps()[i()][1](ret);
|
|
46
|
+
let X = mapArray(q, () => createSignal({}));
|
|
47
|
+
createComputed(mapArray(q, (q, Y) => {
|
|
48
|
+
let Z = () => X()[Y() - 1]?.[0]() || g, Q = mergeProps$1(Z, toReactive(mapValues(q.rewriteProps || {}, (g) => useMemo(() => g(Z(), { store: J })))));
|
|
49
|
+
X()[Y()][1](Q);
|
|
55
50
|
}));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
createEffect(mapArray(plugins, (e) => e.onMount?.(store)));
|
|
51
|
+
let Q = toReactive(() => X()[X().length - 1][0]());
|
|
52
|
+
J.props = Q, onMount(() => {
|
|
53
|
+
createEffect(mapArray(q, (g) => g.onMount?.(J)));
|
|
60
54
|
});
|
|
61
|
-
|
|
62
|
-
props:
|
|
63
|
-
store
|
|
55
|
+
let $ = createMutable({
|
|
56
|
+
props: Q,
|
|
57
|
+
store: J
|
|
64
58
|
});
|
|
65
|
-
window.store =
|
|
66
|
-
|
|
67
|
-
return createComponent(Ctx.Provider, {
|
|
68
|
-
value: ctx,
|
|
59
|
+
return window.store = J, window.ctx = $, createComponent(Ctx.Provider, {
|
|
60
|
+
value: $,
|
|
69
61
|
get children() {
|
|
70
|
-
return createComponent(
|
|
62
|
+
return createComponent($.props.Table, { get children() {
|
|
71
63
|
return [createComponent(THead, {}), createComponent(TBody, {})];
|
|
72
64
|
} });
|
|
73
65
|
}
|
|
74
66
|
});
|
|
75
67
|
};
|
|
76
68
|
var THead = () => {
|
|
77
|
-
|
|
78
|
-
return createComponent(
|
|
79
|
-
return createComponent(
|
|
80
|
-
return createComponent(
|
|
69
|
+
let { props: g } = useContext(Ctx);
|
|
70
|
+
return createComponent(g.Thead, { get children() {
|
|
71
|
+
return createComponent(g.Tr, { get children() {
|
|
72
|
+
return createComponent(g.EachCells, {
|
|
81
73
|
get each() {
|
|
82
|
-
return
|
|
74
|
+
return g.columns || [];
|
|
83
75
|
},
|
|
84
|
-
children: (
|
|
85
|
-
col,
|
|
76
|
+
children: (G, K) => createComponent(g.Th, {
|
|
77
|
+
col: G,
|
|
86
78
|
get x() {
|
|
87
|
-
return
|
|
79
|
+
return K();
|
|
88
80
|
},
|
|
89
81
|
get children() {
|
|
90
|
-
return
|
|
82
|
+
return G.name;
|
|
91
83
|
}
|
|
92
84
|
})
|
|
93
85
|
});
|
|
94
86
|
} });
|
|
95
87
|
} });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return createComponent(props.EachRows, {
|
|
88
|
+
}, TBody = () => {
|
|
89
|
+
let { props: g } = useContext(Ctx);
|
|
90
|
+
return createComponent(g.Tbody, { get children() {
|
|
91
|
+
return createComponent(g.EachRows, {
|
|
101
92
|
get each() {
|
|
102
|
-
return
|
|
93
|
+
return g.data;
|
|
103
94
|
},
|
|
104
|
-
children: (
|
|
95
|
+
children: (G, K) => createComponent(g.Tr, {
|
|
105
96
|
get y() {
|
|
106
|
-
return
|
|
97
|
+
return K();
|
|
107
98
|
},
|
|
108
|
-
data:
|
|
99
|
+
data: G,
|
|
109
100
|
get children() {
|
|
110
|
-
return createComponent(
|
|
101
|
+
return createComponent(g.EachCells, {
|
|
111
102
|
get each() {
|
|
112
|
-
return
|
|
103
|
+
return g.columns;
|
|
113
104
|
},
|
|
114
|
-
children: (
|
|
115
|
-
col,
|
|
105
|
+
children: (q, J) => createComponent(g.Td, {
|
|
106
|
+
col: q,
|
|
116
107
|
get x() {
|
|
117
|
-
return
|
|
108
|
+
return J();
|
|
118
109
|
},
|
|
119
110
|
get y() {
|
|
120
|
-
return
|
|
111
|
+
return K();
|
|
121
112
|
},
|
|
122
|
-
data:
|
|
113
|
+
data: G,
|
|
123
114
|
get children() {
|
|
124
|
-
return
|
|
115
|
+
return G[q.id];
|
|
125
116
|
}
|
|
126
117
|
})
|
|
127
118
|
});
|
|
@@ -129,46 +120,33 @@ var TBody = () => {
|
|
|
129
120
|
})
|
|
130
121
|
});
|
|
131
122
|
} });
|
|
132
|
-
};
|
|
133
|
-
var src_default = Intable;
|
|
123
|
+
}, src_default = Intable;
|
|
134
124
|
function BasePlugin() {
|
|
135
|
-
|
|
125
|
+
let G = {
|
|
136
126
|
col: null,
|
|
137
127
|
data: null
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
spread(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return
|
|
153
|
-
})()
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
spread(_el$4, mergeProps(o, omits), false, false);
|
|
157
|
-
return _el$4;
|
|
158
|
-
})();
|
|
159
|
-
const th = (o) => (() => {
|
|
160
|
-
var _el$5 = _tmpl$5();
|
|
161
|
-
spread(_el$5, mergeProps(o, omits), false, false);
|
|
162
|
-
return _el$5;
|
|
163
|
-
})();
|
|
164
|
-
const td = (o) => (() => {
|
|
165
|
-
var _el$6 = _tmpl$6();
|
|
166
|
-
spread(_el$6, mergeProps(o, omits), false, false);
|
|
167
|
-
return _el$6;
|
|
128
|
+
}, K = (g) => (() => {
|
|
129
|
+
var G = _tmpl$();
|
|
130
|
+
return spread(G, g, !1, !1), G;
|
|
131
|
+
})(), q = (g) => (() => {
|
|
132
|
+
var G = _tmpl$2();
|
|
133
|
+
return spread(G, g, !1, !1), G;
|
|
134
|
+
})(), J = (g) => (() => {
|
|
135
|
+
var G = _tmpl$3();
|
|
136
|
+
return spread(G, g, !1, !1), G;
|
|
137
|
+
})(), Y = (g) => (() => {
|
|
138
|
+
var K = _tmpl$4();
|
|
139
|
+
return spread(K, mergeProps(g, G), !1, !1), K;
|
|
140
|
+
})(), X = (g) => (() => {
|
|
141
|
+
var K = _tmpl$5();
|
|
142
|
+
return spread(K, mergeProps(g, G), !1, !1), K;
|
|
143
|
+
})(), Z = (g) => (() => {
|
|
144
|
+
var K = _tmpl$6();
|
|
145
|
+
return spread(K, mergeProps(g, G), !1, !1), K;
|
|
168
146
|
})();
|
|
169
147
|
return {
|
|
170
148
|
priority: Infinity,
|
|
171
|
-
store: (
|
|
149
|
+
store: (g) => ({
|
|
172
150
|
ths: [],
|
|
173
151
|
thSizes: [],
|
|
174
152
|
trs: [],
|
|
@@ -177,182 +155,149 @@ function BasePlugin() {
|
|
|
177
155
|
raw: Symbol("raw")
|
|
178
156
|
}),
|
|
179
157
|
rewriteProps: {
|
|
180
|
-
data: ({ data = [] }) =>
|
|
181
|
-
columns: ({ columns = [] }) =>
|
|
182
|
-
newRow: ({ newRow = () => ({}) }) =>
|
|
183
|
-
Table: ({ Table =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
ref: setEl,
|
|
158
|
+
data: ({ data: g = [] }) => g,
|
|
159
|
+
columns: ({ columns: g = [] }) => g,
|
|
160
|
+
newRow: ({ newRow: g = () => ({}) }) => g,
|
|
161
|
+
Table: ({ Table: g = K }, { store: G }) => (G) => {
|
|
162
|
+
let [K, q] = createSignal(), { props: J } = useContext(Ctx);
|
|
163
|
+
return G = combineProps({
|
|
164
|
+
ref: q,
|
|
188
165
|
get class() {
|
|
189
|
-
return `data-table ${
|
|
166
|
+
return `data-table ${J.class} ${J.border && "data-table--border"} data-table--${J.size}`;
|
|
190
167
|
},
|
|
191
168
|
get style() {
|
|
192
|
-
return
|
|
169
|
+
return J.style;
|
|
193
170
|
}
|
|
194
|
-
},
|
|
195
|
-
return createComponent(Table, o);
|
|
196
|
-
},
|
|
197
|
-
Thead: ({ Thead = thead }, { store }) => (o) => {
|
|
198
|
-
o = combineProps({ ref: (el) => store.thead = el }, o);
|
|
199
|
-
return createComponent(Thead, o);
|
|
171
|
+
}, G), createComponent(g, G);
|
|
200
172
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
173
|
+
Thead: ({ Thead: g = q }, { store: G }) => (K) => (K = combineProps({ ref: (g) => G.thead = g }, K), createComponent(g, K)),
|
|
174
|
+
Tbody: ({ Tbody: g = J }, { store: G }) => (K) => (K = combineProps({ ref: (g) => G.tbody = g }, K), createComponent(g, K)),
|
|
175
|
+
Tr: ({ Tr: g = Y }, { store: G }) => (K) => {
|
|
176
|
+
let [q, J] = createSignal();
|
|
177
|
+
return K = combineProps({ ref: J }, K), createEffect(() => {
|
|
178
|
+
let { y: g } = K;
|
|
179
|
+
G.trs[g] = q(), G.trSizes[g] = createElementSize(q()), onCleanup(() => G.trSizes[g] = G.trs[g] = void 0);
|
|
180
|
+
}), createComponent(g, K);
|
|
204
181
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
o = combineProps({ ref: setEl }, o);
|
|
208
|
-
createEffect(() => {
|
|
209
|
-
const { y } = o;
|
|
210
|
-
store.trs[y] = el();
|
|
211
|
-
store.trSizes[y] = createElementSize(el());
|
|
212
|
-
onCleanup(() => store.trSizes[y] = store.trs[y] = void 0);
|
|
213
|
-
});
|
|
214
|
-
return createComponent(Tr, o);
|
|
215
|
-
},
|
|
216
|
-
Th: ({ Th = th }, { store }) => (o) => {
|
|
217
|
-
const [el, setEl] = createSignal();
|
|
218
|
-
const { props } = useContext(Ctx);
|
|
219
|
-
const mProps = combineProps(o, { ref: setEl }, {
|
|
182
|
+
Th: ({ Th: G = X }, { store: K }) => (q) => {
|
|
183
|
+
let [J, Y] = createSignal(), { props: X } = useContext(Ctx), Z = combineProps(q, { ref: Y }, {
|
|
220
184
|
get class() {
|
|
221
|
-
return unFn(
|
|
185
|
+
return unFn(X.cellClass, q);
|
|
222
186
|
},
|
|
223
187
|
get style() {
|
|
224
|
-
return unFn(
|
|
188
|
+
return unFn(X.cellStyle, q);
|
|
225
189
|
}
|
|
226
190
|
}, {
|
|
227
191
|
get class() {
|
|
228
|
-
return
|
|
192
|
+
return q.col.class;
|
|
229
193
|
},
|
|
230
194
|
get style() {
|
|
231
|
-
return
|
|
195
|
+
return q.col.style;
|
|
232
196
|
}
|
|
233
197
|
}, { get style() {
|
|
234
|
-
return
|
|
198
|
+
return q.col.width ? `width: ${q.col.width}px` : "";
|
|
235
199
|
} });
|
|
236
|
-
createEffect(() => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
});
|
|
242
|
-
return createComponent(Th, mergeProps(mProps, { get children() {
|
|
243
|
-
return o.children;
|
|
200
|
+
return createEffect(() => {
|
|
201
|
+
let { x: g } = q;
|
|
202
|
+
K.ths[g] = J(), K.thSizes[g] = createElementSize(J()), onCleanup(() => K.thSizes[g] = K.ths[g] = void 0);
|
|
203
|
+
}), createComponent(G, mergeProps(Z, { get children() {
|
|
204
|
+
return q.children;
|
|
244
205
|
} }));
|
|
245
206
|
},
|
|
246
|
-
Td: ({ Td =
|
|
247
|
-
|
|
248
|
-
const mProps = combineProps(o, {
|
|
207
|
+
Td: ({ Td: G = Z }, { store: K }) => (K) => {
|
|
208
|
+
let { props: q } = useContext(Ctx), J = combineProps(K, {
|
|
249
209
|
get class() {
|
|
250
|
-
return unFn(
|
|
210
|
+
return unFn(q.cellClass, K);
|
|
251
211
|
},
|
|
252
212
|
get style() {
|
|
253
|
-
return unFn(
|
|
213
|
+
return unFn(q.cellStyle, K);
|
|
254
214
|
}
|
|
255
215
|
}, {
|
|
256
216
|
get class() {
|
|
257
|
-
return
|
|
217
|
+
return K.col.class;
|
|
258
218
|
},
|
|
259
219
|
get style() {
|
|
260
|
-
return
|
|
220
|
+
return K.col.style;
|
|
261
221
|
}
|
|
262
222
|
}, { get style() {
|
|
263
|
-
return
|
|
223
|
+
return K.col.width ? `width: ${K.col.width}px` : "";
|
|
264
224
|
} });
|
|
265
|
-
return createComponent(
|
|
266
|
-
return
|
|
225
|
+
return createComponent(G, mergeProps(J, { get children() {
|
|
226
|
+
return K.children;
|
|
267
227
|
} }));
|
|
268
228
|
},
|
|
269
|
-
EachRows: ({ EachRows }) =>
|
|
270
|
-
EachCells: ({ EachCells }) =>
|
|
271
|
-
renderer: ({ renderer = (
|
|
229
|
+
EachRows: ({ EachRows: g }) => g || For,
|
|
230
|
+
EachCells: ({ EachCells: g }) => g || For,
|
|
231
|
+
renderer: ({ renderer: g = (g) => g }) => g
|
|
272
232
|
}
|
|
273
233
|
};
|
|
274
234
|
}
|
|
275
235
|
var IndexPlugin = {
|
|
276
|
-
store: (
|
|
236
|
+
store: (g) => ({ $index: {
|
|
277
237
|
name: "",
|
|
278
238
|
id: Symbol("index"),
|
|
279
239
|
fixed: "left",
|
|
280
|
-
[
|
|
240
|
+
[g.internal]: 1,
|
|
281
241
|
width: 40,
|
|
282
242
|
style: "text-align: center",
|
|
283
243
|
class: "index",
|
|
284
|
-
render: solidComponent((
|
|
244
|
+
render: solidComponent((g) => memo(() => g.y + 1))
|
|
285
245
|
} }),
|
|
286
|
-
rewriteProps: { columns: (
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
...columns?.filter((e) => e.fixed == "left") || [],
|
|
298
|
-
...columns?.filter((e) => !e.fixed) || [],
|
|
299
|
-
...columns?.filter((e) => e.fixed == "right") || []
|
|
246
|
+
rewriteProps: { columns: (g, { store: G }) => G.props?.index ? [G.$index, ...g.columns || []] : g.columns }
|
|
247
|
+
}, StickyHeaderPlugin = { rewriteProps: { Thead: ({ Thead: g }) => (G) => {
|
|
248
|
+
let { props: K } = useContext(Ctx);
|
|
249
|
+
return G = combineProps({ get class() {
|
|
250
|
+
return K.stickyHeader ? "sticky-header" : "";
|
|
251
|
+
} }, G), createComponent(g, G);
|
|
252
|
+
} } }, FixedColumnPlugin = { rewriteProps: {
|
|
253
|
+
columns: ({ columns: g }) => [
|
|
254
|
+
...g?.filter((g) => g.fixed == "left") || [],
|
|
255
|
+
...g?.filter((g) => !g.fixed) || [],
|
|
256
|
+
...g?.filter((g) => g.fixed == "right") || []
|
|
300
257
|
],
|
|
301
|
-
cellClass: ({ cellClass }) => (
|
|
302
|
-
cellStyle: ({ cellStyle }, { store }) => (
|
|
303
|
-
} }
|
|
304
|
-
var FitColWidthPlugin = {
|
|
258
|
+
cellClass: ({ cellClass: G }) => (K) => (unFn(G, K) || "") + (K.col.fixed ? ` fixed-${K.col.fixed}` : ""),
|
|
259
|
+
cellStyle: ({ cellStyle: G }, { store: K }) => (q) => (unFn(G, q) || "") + (q.col.fixed ? `; ${q.col.fixed}: ${sumBy(K.thSizes.slice(q.col.fixed == "left" ? 0 : q.x + 1, q.col.fixed == "left" ? q.x : Infinity), (g) => g?.width || 0)}px` : "")
|
|
260
|
+
} }, FitColWidthPlugin = {
|
|
305
261
|
priority: -Infinity,
|
|
306
262
|
rewriteProps: {
|
|
307
|
-
Table: (
|
|
308
|
-
|
|
309
|
-
createResizeObserver(() =>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
store.__fit_col_width__cols_temp = store.props.columns.map((e, i) => e.width ? null : { width: Math.max((store.ths[i]?.getBoundingClientRect().width || 0) + gap, 80) });
|
|
316
|
-
}));
|
|
317
|
-
return createComponent(prev.Table, o);
|
|
263
|
+
Table: (g, { store: G }) => (K) => {
|
|
264
|
+
let q = createMutable({ width: 0 });
|
|
265
|
+
return createResizeObserver(() => G.scroll_el, (g, G, K) => q.width = K.contentBoxSize[0].inlineSize), createEffect(on(() => [q.width, g.columns.map((g) => g.width)], async () => {
|
|
266
|
+
if (!q.width) return;
|
|
267
|
+
G.__fit_col_width__cols_temp = null, await Promise.resolve();
|
|
268
|
+
let g = (q.width - G.table.getBoundingClientRect().width) / G.props.columns.filter((g) => !g.width).length;
|
|
269
|
+
G.__fit_col_width__cols_temp = G.props.columns.map((K, q) => K.width ? null : { width: Math.max((G.ths[q]?.getBoundingClientRect().width || 0) + g, 80) });
|
|
270
|
+
})), createComponent(g.Table, K);
|
|
318
271
|
},
|
|
319
|
-
columns: ({ columns }, { store }) => (
|
|
320
|
-
...
|
|
321
|
-
...
|
|
322
|
-
[
|
|
323
|
-
})), untrack(() => batch(() => reconcile(
|
|
272
|
+
columns: ({ columns: g }, { store: G }) => (g = g.map((g, K) => ({
|
|
273
|
+
...g,
|
|
274
|
+
...G.__fit_col_width__cols_temp?.[K],
|
|
275
|
+
[G.raw]: g[G.raw] ?? g
|
|
276
|
+
})), untrack(() => batch(() => reconcile(g, { key: G.raw })(G.__fit_col_width__cols ??= []))))
|
|
324
277
|
}
|
|
325
278
|
};
|
|
326
279
|
const ScrollPlugin = {
|
|
327
280
|
priority: Infinity,
|
|
328
|
-
rewriteProps: { Table: (
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const isleft = pos.x == 0;
|
|
335
|
-
const isright = pos.x >= el.scrollWidth - (size.width || 0);
|
|
336
|
-
return isleft && isright ? "" : !isleft && !isright ? "is-scroll-mid" : isleft ? "is-scroll-left" : isright ? "is-scroll-right" : "";
|
|
281
|
+
rewriteProps: { Table: (g, { store: G }) => (g) => {
|
|
282
|
+
let K = createScrollPosition(() => G.scroll_el), q = createElementSize(() => G.scroll_el), J = createMemo(() => {
|
|
283
|
+
let g = G.scroll_el;
|
|
284
|
+
if (!g) return;
|
|
285
|
+
let J = K.x == 0, Y = K.x >= g.scrollWidth - (q.width || 0);
|
|
286
|
+
return J && Y ? "" : !J && !Y ? "is-scroll-mid" : J ? "is-scroll-left" : Y ? "is-scroll-right" : "";
|
|
337
287
|
});
|
|
338
|
-
|
|
339
|
-
ref: (
|
|
288
|
+
g = combineProps(g, {
|
|
289
|
+
ref: (g) => G.scroll_el = g,
|
|
340
290
|
class: "data-table--scroll-view"
|
|
341
291
|
}, { get class() {
|
|
342
|
-
return
|
|
292
|
+
return J();
|
|
343
293
|
} });
|
|
344
|
-
|
|
294
|
+
let Y = mapArray(() => G.plugins.flatMap((g) => g.layers ?? []), (g) => createComponent(g, G));
|
|
345
295
|
return (() => {
|
|
346
|
-
var
|
|
347
|
-
spread(
|
|
348
|
-
insert(_el$8, layers);
|
|
349
|
-
use((el) => store.table = el, _el$9);
|
|
350
|
-
insert(_el$9, () => o.children);
|
|
351
|
-
return _el$7;
|
|
296
|
+
var K = _tmpl$7(), q = K.firstChild, J = q.nextSibling;
|
|
297
|
+
return spread(K, g, !1, !0), insert(q, Y), use((g) => G.table = g, J), insert(J, () => g.children), K;
|
|
352
298
|
})();
|
|
353
299
|
} }
|
|
354
|
-
}
|
|
355
|
-
const defaultsPlugins = [
|
|
300
|
+
}, defaultsPlugins = [
|
|
356
301
|
ScrollPlugin,
|
|
357
302
|
BasePlugin(),
|
|
358
303
|
CommandPlugin,
|
package/dist/loading.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { spread, template } from "solid-js/web";
|
|
2
|
-
var _tmpl$ = /* @__PURE__ */ template(
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
spread(_el$, props, true, true);
|
|
6
|
-
return _el$;
|
|
2
|
+
var _tmpl$ = /* @__PURE__ */ template("<svg width=1.2em height=1.2em xmlns=http://www.w3.org/2000/svg viewBox=\"0 0 24 24\"><g><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.14></rect><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.29 transform=\"rotate(30 12 12)\"></rect><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.43 transform=\"rotate(60 12 12)\"></rect><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.57 transform=\"rotate(90 12 12)\"></rect><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.71 transform=\"rotate(120 12 12)\"></rect><rect width=2 height=5 x=11 y=1 fill=currentColor opacity=.86 transform=\"rotate(150 12 12)\"></rect><rect width=2 height=5 x=11 y=1 fill=currentColor transform=\"rotate(180 12 12)\"></rect><animateTransform attributeName=transform calcMode=discrete dur=0.75s repeatCount=indefinite type=rotate values=\"0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12\">"), loading_default = (n = {}) => (() => {
|
|
3
|
+
var r = _tmpl$();
|
|
4
|
+
return spread(r, n, !0, !0), r;
|
|
7
5
|
})();
|
|
8
6
|
export { loading_default as default };
|