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