@toolbox-web/grid-vue 0.8.0 → 0.9.0
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/features/grouping-columns.d.ts +32 -0
- package/features/grouping-columns.d.ts.map +1 -1
- package/features/grouping-columns.js +22 -1
- package/features/grouping-columns.js.map +1 -1
- package/features/grouping-rows.d.ts +31 -0
- package/features/grouping-rows.d.ts.map +1 -1
- package/features/grouping-rows.js +22 -1
- package/features/grouping-rows.js.map +1 -1
- package/features/index.js +3 -3
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +25 -0
- package/features/pinned-rows.js.map +1 -1
- package/index.js +535 -399
- package/index.js.map +1 -1
- package/lib/vue-column-config.d.ts +20 -3
- package/lib/vue-column-config.d.ts.map +1 -1
- package/lib/vue-grid-adapter.d.ts +34 -0
- package/lib/vue-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as y, provide as
|
|
2
|
-
import { DataGridElement as
|
|
1
|
+
import { defineComponent as y, provide as N, inject as k, createApp as u, createVNode as V, ref as O, computed as re, onMounted as P, onBeforeUnmount as q, watch as G, createElementBlock as T, openBlock as j, renderSlot as x, useSlots as B, h as L } from "vue";
|
|
2
|
+
import { DataGridElement as ne } from "@toolbox-web/grid";
|
|
3
3
|
import { createPluginFromFeature as oe } from "@toolbox-web/grid/features/registry";
|
|
4
|
-
import { clearFeatureRegistry as
|
|
5
|
-
import { G as
|
|
4
|
+
import { clearFeatureRegistry as Be, createPluginFromFeature as Se, getFeatureFactory as Ne, getRegisteredFeatures as ke, isFeatureRegistered as Fe, registerFeature as Ae } from "@toolbox-web/grid/features/registry";
|
|
5
|
+
import { G as U } from "./chunks/use-grid-B59B6XdD.js";
|
|
6
6
|
import { u as We } from "./chunks/use-grid-B59B6XdD.js";
|
|
7
7
|
const K = /* @__PURE__ */ Symbol("grid-icons");
|
|
8
8
|
function ie() {
|
|
9
|
-
return
|
|
9
|
+
return k(K, void 0);
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const de = y({
|
|
12
12
|
name: "GridIconProvider",
|
|
13
13
|
props: {
|
|
14
14
|
/**
|
|
@@ -19,17 +19,17 @@ const se = y({
|
|
|
19
19
|
required: !0
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
setup(i, { slots:
|
|
23
|
-
return
|
|
22
|
+
setup(i, { slots: t }) {
|
|
23
|
+
return N(K, i.icons), () => t.default?.();
|
|
24
24
|
}
|
|
25
25
|
}), Y = /* @__PURE__ */ Symbol("grid-type-defaults");
|
|
26
26
|
function J() {
|
|
27
|
-
return
|
|
27
|
+
return k(Y, void 0);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ce(i) {
|
|
30
30
|
return J()?.[i];
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const se = y({
|
|
33
33
|
name: "GridTypeProvider",
|
|
34
34
|
props: {
|
|
35
35
|
/**
|
|
@@ -40,60 +40,60 @@ const de = y({
|
|
|
40
40
|
required: !0
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
setup(i, { slots:
|
|
44
|
-
return
|
|
43
|
+
setup(i, { slots: t }) {
|
|
44
|
+
return N(Y, i.defaults), () => t.default?.();
|
|
45
45
|
}
|
|
46
|
-
}), Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(),
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
46
|
+
}), Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new Map();
|
|
47
|
+
function ae(i, t) {
|
|
48
|
+
const r = i.getAttribute("field"), e = w.get(i) ?? {};
|
|
49
|
+
if (e.renderer = t, w.set(i, e), r) {
|
|
50
|
+
const n = C.get(r) ?? {};
|
|
51
|
+
n.renderer = t, C.set(r, n);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
54
|
+
function le(i, t) {
|
|
55
|
+
const r = i.getAttribute("field"), e = w.get(i) ?? {};
|
|
56
|
+
if (e.editor = t, w.set(i, e), r) {
|
|
57
|
+
const n = C.get(r) ?? {};
|
|
58
|
+
n.editor = t, C.set(r, n);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
function ce(i) {
|
|
62
|
-
let
|
|
63
|
-
if (!
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
let t = w.get(i)?.renderer;
|
|
63
|
+
if (!t) {
|
|
64
|
+
const r = i.getAttribute("field");
|
|
65
|
+
r && (t = C.get(r)?.renderer);
|
|
66
66
|
}
|
|
67
|
-
return
|
|
67
|
+
return t;
|
|
68
68
|
}
|
|
69
69
|
function ue(i) {
|
|
70
|
-
let
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
73
|
-
|
|
70
|
+
let t = w.get(i)?.editor;
|
|
71
|
+
if (!t) {
|
|
72
|
+
const r = i.getAttribute("field");
|
|
73
|
+
r && (t = C.get(r)?.editor);
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return t;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function v(i) {
|
|
78
78
|
if (i == null || typeof i == "function" && i.prototype === void 0)
|
|
79
79
|
return !1;
|
|
80
80
|
if (typeof i == "object") {
|
|
81
|
-
const
|
|
82
|
-
if ("__name" in
|
|
81
|
+
const t = i;
|
|
82
|
+
if ("__name" in t || typeof t.setup == "function" || typeof t.render == "function") return !0;
|
|
83
83
|
}
|
|
84
84
|
if (typeof i == "function") {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
if ("__name" in
|
|
85
|
+
const t = Function.prototype.toString.call(i);
|
|
86
|
+
if (t.startsWith("class ") || t.startsWith("class{")) return !0;
|
|
87
|
+
const r = i;
|
|
88
|
+
if ("__name" in r || typeof r.setup == "function") return !0;
|
|
89
89
|
}
|
|
90
90
|
return !1;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
return typeof i == "function" && !
|
|
92
|
+
function R(i) {
|
|
93
|
+
return typeof i == "function" && !v(i);
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
class
|
|
95
|
+
const m = /* @__PURE__ */ Symbol.for("tbw:vue-processed");
|
|
96
|
+
class pe {
|
|
97
97
|
mountedViews = [];
|
|
98
98
|
/** Editor-specific views tracked separately for per-cell cleanup via releaseCell. */
|
|
99
99
|
editorViews = [];
|
|
@@ -123,9 +123,13 @@ class fe {
|
|
|
123
123
|
* @param config - Vue grid config with possible component/VNode references
|
|
124
124
|
* @returns Processed config with DOM-returning functions
|
|
125
125
|
*/
|
|
126
|
-
processGridConfig(
|
|
127
|
-
const
|
|
128
|
-
return
|
|
126
|
+
processGridConfig(t) {
|
|
127
|
+
const r = { ...t };
|
|
128
|
+
return t.columns && (r.columns = t.columns.map((e) => this.processColumn(e))), t.typeDefaults && (r.typeDefaults = this.processTypeDefaults(t.typeDefaults)), t.loadingRenderer && (v(t.loadingRenderer) ? r.loadingRenderer = this.createComponentLoadingRenderer(
|
|
129
|
+
t.loadingRenderer
|
|
130
|
+
) : R(t.loadingRenderer) && (r.loadingRenderer = this.createVNodeLoadingRenderer(
|
|
131
|
+
t.loadingRenderer
|
|
132
|
+
))), r;
|
|
129
133
|
}
|
|
130
134
|
/**
|
|
131
135
|
* Processes typeDefaults, converting Vue component/VNode references
|
|
@@ -134,21 +138,21 @@ class fe {
|
|
|
134
138
|
* @param typeDefaults - Vue type defaults with possible component references
|
|
135
139
|
* @returns Processed TypeDefault record
|
|
136
140
|
*/
|
|
137
|
-
processTypeDefaults(
|
|
138
|
-
const
|
|
139
|
-
for (const [
|
|
140
|
-
const
|
|
141
|
-
editorParams:
|
|
141
|
+
processTypeDefaults(t) {
|
|
142
|
+
const r = {};
|
|
143
|
+
for (const [e, n] of Object.entries(t)) {
|
|
144
|
+
const d = {
|
|
145
|
+
editorParams: n.editorParams
|
|
142
146
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
))),
|
|
146
|
-
|
|
147
|
-
) :
|
|
148
|
-
|
|
149
|
-
))),
|
|
147
|
+
n.renderer && (v(n.renderer) ? d.renderer = this.createConfigComponentRenderer(n.renderer) : R(n.renderer) && (d.renderer = this.createTypeRenderer(
|
|
148
|
+
n.renderer
|
|
149
|
+
))), n.editor && (v(n.editor) ? d.editor = this.createConfigComponentEditor(
|
|
150
|
+
n.editor
|
|
151
|
+
) : R(n.editor) && (d.editor = this.createTypeEditor(
|
|
152
|
+
n.editor
|
|
153
|
+
))), n.filterPanelRenderer && (d.filterPanelRenderer = this.createFilterPanelRenderer(n.filterPanelRenderer)), r[e] = d;
|
|
150
154
|
}
|
|
151
|
-
return
|
|
155
|
+
return r;
|
|
152
156
|
}
|
|
153
157
|
/**
|
|
154
158
|
* Processes a single column configuration, converting Vue component references
|
|
@@ -157,65 +161,87 @@ class fe {
|
|
|
157
161
|
* @param column - Vue column config
|
|
158
162
|
* @returns Processed ColumnConfig with DOM-returning functions
|
|
159
163
|
*/
|
|
160
|
-
processColumn(
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
} else if (
|
|
167
|
-
const
|
|
168
|
-
|
|
164
|
+
processColumn(t) {
|
|
165
|
+
const r = { ...t };
|
|
166
|
+
if (t.renderer && !t.renderer[m]) {
|
|
167
|
+
if (v(t.renderer)) {
|
|
168
|
+
const e = this.createConfigComponentRenderer(t.renderer);
|
|
169
|
+
e[m] = !0, r.renderer = e;
|
|
170
|
+
} else if (R(t.renderer)) {
|
|
171
|
+
const e = this.createConfigVNodeRenderer(t.renderer);
|
|
172
|
+
e[m] = !0, r.renderer = e;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (t.editor && !t.editor[m]) {
|
|
176
|
+
if (v(t.editor)) {
|
|
177
|
+
const e = this.createConfigComponentEditor(t.editor);
|
|
178
|
+
e[m] = !0, r.editor = e;
|
|
179
|
+
} else if (R(t.editor)) {
|
|
180
|
+
const e = this.createConfigVNodeEditor(t.editor);
|
|
181
|
+
e[m] = !0, r.editor = e;
|
|
169
182
|
}
|
|
170
183
|
}
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
} else if (
|
|
176
|
-
const
|
|
177
|
-
|
|
184
|
+
if (t.headerRenderer && !t.headerRenderer[m]) {
|
|
185
|
+
if (v(t.headerRenderer)) {
|
|
186
|
+
const e = this.createConfigComponentHeaderRenderer(t.headerRenderer);
|
|
187
|
+
e[m] = !0, r.headerRenderer = e;
|
|
188
|
+
} else if (R(t.headerRenderer)) {
|
|
189
|
+
const e = this.createConfigVNodeHeaderRenderer(
|
|
190
|
+
t.headerRenderer
|
|
191
|
+
);
|
|
192
|
+
e[m] = !0, r.headerRenderer = e;
|
|
178
193
|
}
|
|
179
194
|
}
|
|
180
|
-
|
|
195
|
+
if (t.headerLabelRenderer && !t.headerLabelRenderer[m]) {
|
|
196
|
+
if (v(t.headerLabelRenderer)) {
|
|
197
|
+
const e = this.createConfigComponentHeaderLabelRenderer(t.headerLabelRenderer);
|
|
198
|
+
e[m] = !0, r.headerLabelRenderer = e;
|
|
199
|
+
} else if (R(t.headerLabelRenderer)) {
|
|
200
|
+
const e = this.createConfigVNodeHeaderLabelRenderer(
|
|
201
|
+
t.headerLabelRenderer
|
|
202
|
+
);
|
|
203
|
+
e[m] = !0, r.headerLabelRenderer = e;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return r;
|
|
181
207
|
}
|
|
182
208
|
/**
|
|
183
209
|
* Creates a DOM-returning renderer from a Vue component class.
|
|
184
210
|
* Used for config-based renderers (not slot-based).
|
|
185
211
|
* @internal
|
|
186
212
|
*/
|
|
187
|
-
createConfigComponentRenderer(
|
|
188
|
-
const
|
|
189
|
-
return (
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
213
|
+
createConfigComponentRenderer(t) {
|
|
214
|
+
const r = /* @__PURE__ */ new WeakMap();
|
|
215
|
+
return (e) => {
|
|
216
|
+
const n = e.cellEl;
|
|
217
|
+
if (n) {
|
|
218
|
+
const l = r.get(n);
|
|
219
|
+
if (l)
|
|
220
|
+
return l.update(e), l.container;
|
|
195
221
|
const c = document.createElement("div");
|
|
196
222
|
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
197
|
-
let
|
|
198
|
-
const
|
|
223
|
+
let p = e;
|
|
224
|
+
const h = t, b = u({
|
|
199
225
|
render() {
|
|
200
|
-
return
|
|
226
|
+
return V(h, { ...p });
|
|
201
227
|
}
|
|
202
228
|
});
|
|
203
|
-
return
|
|
204
|
-
app:
|
|
229
|
+
return b.mount(c), r.set(n, {
|
|
230
|
+
app: b,
|
|
205
231
|
container: c,
|
|
206
|
-
update: (
|
|
207
|
-
|
|
232
|
+
update: (_) => {
|
|
233
|
+
p = _, b._instance?.update();
|
|
208
234
|
}
|
|
209
235
|
}), c;
|
|
210
236
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const
|
|
237
|
+
const d = document.createElement("div");
|
|
238
|
+
d.className = "vue-cell-renderer", d.style.display = "contents";
|
|
239
|
+
const s = t, a = u({
|
|
214
240
|
render() {
|
|
215
|
-
return
|
|
241
|
+
return V(s, { ...e });
|
|
216
242
|
}
|
|
217
243
|
});
|
|
218
|
-
return
|
|
244
|
+
return a.mount(d), this.mountedViews.push({ app: a, container: d }), d;
|
|
219
245
|
};
|
|
220
246
|
}
|
|
221
247
|
/**
|
|
@@ -223,38 +249,38 @@ class fe {
|
|
|
223
249
|
* Used for config-based renderers (not slot-based).
|
|
224
250
|
* @internal
|
|
225
251
|
*/
|
|
226
|
-
createConfigVNodeRenderer(
|
|
227
|
-
const
|
|
228
|
-
return (
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
let c =
|
|
237
|
-
const
|
|
252
|
+
createConfigVNodeRenderer(t) {
|
|
253
|
+
const r = /* @__PURE__ */ new WeakMap();
|
|
254
|
+
return (e) => {
|
|
255
|
+
const n = e.cellEl;
|
|
256
|
+
if (n) {
|
|
257
|
+
const a = r.get(n);
|
|
258
|
+
if (a)
|
|
259
|
+
return a.update(e), a.container;
|
|
260
|
+
const l = document.createElement("div");
|
|
261
|
+
l.className = "vue-cell-renderer", l.style.display = "contents";
|
|
262
|
+
let c = e;
|
|
263
|
+
const p = u({
|
|
238
264
|
render() {
|
|
239
|
-
return
|
|
265
|
+
return t(c);
|
|
240
266
|
}
|
|
241
267
|
});
|
|
242
|
-
return
|
|
243
|
-
app:
|
|
244
|
-
container:
|
|
245
|
-
update: (
|
|
246
|
-
c =
|
|
268
|
+
return p.mount(l), r.set(n, {
|
|
269
|
+
app: p,
|
|
270
|
+
container: l,
|
|
271
|
+
update: (h) => {
|
|
272
|
+
c = h, p._instance?.update();
|
|
247
273
|
}
|
|
248
|
-
}),
|
|
274
|
+
}), l;
|
|
249
275
|
}
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
const
|
|
276
|
+
const d = document.createElement("div");
|
|
277
|
+
d.className = "vue-cell-renderer", d.style.display = "contents";
|
|
278
|
+
const s = u({
|
|
253
279
|
render() {
|
|
254
|
-
return e
|
|
280
|
+
return t(e);
|
|
255
281
|
}
|
|
256
282
|
});
|
|
257
|
-
return
|
|
283
|
+
return s.mount(d), this.mountedViews.push({ app: s, container: d }), d;
|
|
258
284
|
};
|
|
259
285
|
}
|
|
260
286
|
/**
|
|
@@ -262,16 +288,16 @@ class fe {
|
|
|
262
288
|
* Used for config-based editors (not slot-based).
|
|
263
289
|
* @internal
|
|
264
290
|
*/
|
|
265
|
-
createConfigComponentEditor(
|
|
266
|
-
return (
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const
|
|
291
|
+
createConfigComponentEditor(t) {
|
|
292
|
+
return (r) => {
|
|
293
|
+
const e = document.createElement("div");
|
|
294
|
+
e.className = "vue-cell-editor", e.style.display = "contents";
|
|
295
|
+
const n = t, d = u({
|
|
270
296
|
render() {
|
|
271
|
-
return
|
|
297
|
+
return V(n, { ...r });
|
|
272
298
|
}
|
|
273
299
|
});
|
|
274
|
-
return
|
|
300
|
+
return d.mount(e), this.editorViews.push({ app: d, container: e }), e;
|
|
275
301
|
};
|
|
276
302
|
}
|
|
277
303
|
/**
|
|
@@ -279,16 +305,126 @@ class fe {
|
|
|
279
305
|
* Used for config-based editors (not slot-based).
|
|
280
306
|
* @internal
|
|
281
307
|
*/
|
|
282
|
-
createConfigVNodeEditor(
|
|
283
|
-
return (
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const
|
|
308
|
+
createConfigVNodeEditor(t) {
|
|
309
|
+
return (r) => {
|
|
310
|
+
const e = document.createElement("div");
|
|
311
|
+
e.className = "vue-cell-editor", e.style.display = "contents";
|
|
312
|
+
const n = u({
|
|
313
|
+
render() {
|
|
314
|
+
return t(r);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
return n.mount(e), this.editorViews.push({ app: n, container: e }), e;
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Creates a DOM-returning header renderer from a Vue component class.
|
|
322
|
+
* Used for config-based headerRenderer (not slot-based).
|
|
323
|
+
* @internal
|
|
324
|
+
*/
|
|
325
|
+
createConfigComponentHeaderRenderer(t) {
|
|
326
|
+
return (r) => {
|
|
327
|
+
const e = document.createElement("div");
|
|
328
|
+
e.className = "vue-header-renderer", e.style.display = "contents";
|
|
329
|
+
const n = t, d = u({
|
|
330
|
+
render() {
|
|
331
|
+
return V(n, {
|
|
332
|
+
column: r.column,
|
|
333
|
+
value: r.value,
|
|
334
|
+
sortState: r.sortState,
|
|
335
|
+
filterActive: r.filterActive,
|
|
336
|
+
renderSortIcon: r.renderSortIcon,
|
|
337
|
+
renderFilterButton: r.renderFilterButton
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
return d.mount(e), this.mountedViews.push({ app: d, container: e }), e;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Creates a DOM-returning header renderer from a VNode-returning render function.
|
|
346
|
+
* Used for config-based headerRenderer (not slot-based).
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
createConfigVNodeHeaderRenderer(t) {
|
|
350
|
+
return (r) => {
|
|
351
|
+
const e = document.createElement("div");
|
|
352
|
+
e.className = "vue-header-renderer", e.style.display = "contents";
|
|
353
|
+
const n = u({
|
|
354
|
+
render() {
|
|
355
|
+
return t(r);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Creates a DOM-returning header label renderer from a Vue component class.
|
|
363
|
+
* Used for config-based headerLabelRenderer (not slot-based).
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
createConfigComponentHeaderLabelRenderer(t) {
|
|
367
|
+
return (r) => {
|
|
368
|
+
const e = document.createElement("div");
|
|
369
|
+
e.className = "vue-header-label-renderer", e.style.display = "contents";
|
|
370
|
+
const n = t, d = u({
|
|
287
371
|
render() {
|
|
288
|
-
return
|
|
372
|
+
return V(n, {
|
|
373
|
+
column: r.column,
|
|
374
|
+
value: r.value
|
|
375
|
+
});
|
|
289
376
|
}
|
|
290
377
|
});
|
|
291
|
-
return
|
|
378
|
+
return d.mount(e), this.mountedViews.push({ app: d, container: e }), e;
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Creates a DOM-returning header label renderer from a VNode-returning render function.
|
|
383
|
+
* Used for config-based headerLabelRenderer (not slot-based).
|
|
384
|
+
* @internal
|
|
385
|
+
*/
|
|
386
|
+
createConfigVNodeHeaderLabelRenderer(t) {
|
|
387
|
+
return (r) => {
|
|
388
|
+
const e = document.createElement("div");
|
|
389
|
+
e.className = "vue-header-label-renderer", e.style.display = "contents";
|
|
390
|
+
const n = u({
|
|
391
|
+
render() {
|
|
392
|
+
return t(r);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Creates a DOM-returning loading renderer from a Vue component class.
|
|
400
|
+
* @internal
|
|
401
|
+
*/
|
|
402
|
+
createComponentLoadingRenderer(t) {
|
|
403
|
+
return (r) => {
|
|
404
|
+
const e = document.createElement("div");
|
|
405
|
+
e.className = "vue-loading-renderer", e.style.display = "contents";
|
|
406
|
+
const n = t, d = u({
|
|
407
|
+
render() {
|
|
408
|
+
return V(n, { size: r.size });
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
return d.mount(e), this.mountedViews.push({ app: d, container: e }), e;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Creates a DOM-returning loading renderer from a VNode-returning render function.
|
|
416
|
+
* @internal
|
|
417
|
+
*/
|
|
418
|
+
createVNodeLoadingRenderer(t) {
|
|
419
|
+
return (r) => {
|
|
420
|
+
const e = document.createElement("div");
|
|
421
|
+
e.className = "vue-loading-renderer", e.style.display = "contents";
|
|
422
|
+
const n = u({
|
|
423
|
+
render() {
|
|
424
|
+
return t(r);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
292
428
|
};
|
|
293
429
|
}
|
|
294
430
|
// #endregion
|
|
@@ -298,132 +434,132 @@ class fe {
|
|
|
298
434
|
*
|
|
299
435
|
* @internal
|
|
300
436
|
*/
|
|
301
|
-
setTypeDefaults(
|
|
302
|
-
this.typeDefaults =
|
|
437
|
+
setTypeDefaults(t) {
|
|
438
|
+
this.typeDefaults = t;
|
|
303
439
|
}
|
|
304
440
|
/**
|
|
305
441
|
* Determines if this adapter can handle the given element.
|
|
306
442
|
* Checks if a renderer or editor is registered for this element.
|
|
307
443
|
*/
|
|
308
|
-
canHandle(
|
|
309
|
-
const
|
|
310
|
-
let
|
|
311
|
-
if (!
|
|
312
|
-
const
|
|
313
|
-
|
|
444
|
+
canHandle(t) {
|
|
445
|
+
const r = t.getAttribute("field");
|
|
446
|
+
let e = w.get(t);
|
|
447
|
+
if (!e && r) {
|
|
448
|
+
const s = C.get(r);
|
|
449
|
+
s && (s.renderer || s.editor) && (e = s, w.set(t, e));
|
|
314
450
|
}
|
|
315
|
-
const
|
|
316
|
-
return
|
|
451
|
+
const n = e?.renderer !== void 0, d = e?.editor !== void 0;
|
|
452
|
+
return e !== void 0 && (n || d);
|
|
317
453
|
}
|
|
318
454
|
/**
|
|
319
455
|
* Creates a view renderer function that renders a Vue component
|
|
320
456
|
* and returns its container DOM element.
|
|
321
457
|
*/
|
|
322
|
-
createRenderer(
|
|
323
|
-
const
|
|
324
|
-
if (!
|
|
458
|
+
createRenderer(t) {
|
|
459
|
+
const r = ce(t);
|
|
460
|
+
if (!r)
|
|
325
461
|
return;
|
|
326
|
-
const
|
|
327
|
-
return (
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
if (
|
|
332
|
-
return
|
|
462
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
463
|
+
return (n) => {
|
|
464
|
+
const d = n.cellEl;
|
|
465
|
+
if (d) {
|
|
466
|
+
const l = e.get(d);
|
|
467
|
+
if (l)
|
|
468
|
+
return l.update(n), l.container;
|
|
333
469
|
const c = document.createElement("div");
|
|
334
470
|
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
335
|
-
let
|
|
336
|
-
const
|
|
471
|
+
let p = n;
|
|
472
|
+
const h = u({
|
|
337
473
|
render() {
|
|
338
|
-
return
|
|
474
|
+
return r(p);
|
|
339
475
|
}
|
|
340
476
|
});
|
|
341
|
-
return
|
|
342
|
-
app:
|
|
477
|
+
return h.mount(c), e.set(d, {
|
|
478
|
+
app: h,
|
|
343
479
|
container: c,
|
|
344
|
-
update: (
|
|
345
|
-
|
|
480
|
+
update: (b) => {
|
|
481
|
+
p = b, h._instance?.update();
|
|
346
482
|
}
|
|
347
483
|
}), c;
|
|
348
484
|
}
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
485
|
+
const s = document.createElement("div");
|
|
486
|
+
s.className = "vue-cell-renderer", s.style.display = "contents";
|
|
487
|
+
const a = u({
|
|
352
488
|
render() {
|
|
353
|
-
return
|
|
489
|
+
return r(n);
|
|
354
490
|
}
|
|
355
491
|
});
|
|
356
|
-
return
|
|
492
|
+
return a.mount(s), this.mountedViews.push({ app: a, container: s }), s;
|
|
357
493
|
};
|
|
358
494
|
}
|
|
359
495
|
/**
|
|
360
496
|
* Creates an editor spec that renders a Vue component for cell editing.
|
|
361
497
|
* Returns a function that creates the editor DOM element.
|
|
362
498
|
*/
|
|
363
|
-
createEditor(
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
return (
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const
|
|
499
|
+
createEditor(t) {
|
|
500
|
+
const r = ue(t);
|
|
501
|
+
if (r)
|
|
502
|
+
return (e) => {
|
|
503
|
+
const n = document.createElement("div");
|
|
504
|
+
n.className = "vue-cell-editor", n.style.display = "contents";
|
|
505
|
+
const d = u({
|
|
370
506
|
render() {
|
|
371
|
-
return
|
|
507
|
+
return r(e);
|
|
372
508
|
}
|
|
373
509
|
});
|
|
374
|
-
return
|
|
510
|
+
return d.mount(n), this.editorViews.push({ app: d, container: n }), n;
|
|
375
511
|
};
|
|
376
512
|
}
|
|
377
513
|
/**
|
|
378
514
|
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
379
515
|
* Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
|
|
380
516
|
*/
|
|
381
|
-
parseDetailElement(
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
return (
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
const c =
|
|
517
|
+
parseDetailElement(t) {
|
|
518
|
+
const r = t.closest("tbw-grid");
|
|
519
|
+
if (!r) return;
|
|
520
|
+
const e = r.querySelector("tbw-grid-detail");
|
|
521
|
+
if (!e) return;
|
|
522
|
+
const n = Q.get(e);
|
|
523
|
+
if (n)
|
|
524
|
+
return (d, s) => {
|
|
525
|
+
const a = document.createElement("div");
|
|
526
|
+
a.className = "vue-detail-panel";
|
|
527
|
+
const c = n({ row: d, rowIndex: s });
|
|
392
528
|
if (c && c.length > 0) {
|
|
393
|
-
const
|
|
529
|
+
const p = u({
|
|
394
530
|
render() {
|
|
395
531
|
return c;
|
|
396
532
|
}
|
|
397
533
|
});
|
|
398
|
-
|
|
534
|
+
p.mount(a), this.mountedViews.push({ app: p, container: a });
|
|
399
535
|
}
|
|
400
|
-
return
|
|
536
|
+
return a;
|
|
401
537
|
};
|
|
402
538
|
}
|
|
403
539
|
/**
|
|
404
540
|
* Framework adapter hook called by ResponsivePlugin during attach().
|
|
405
541
|
* Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
|
|
406
542
|
*/
|
|
407
|
-
parseResponsiveCardElement(
|
|
408
|
-
const
|
|
409
|
-
if (!
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
return (
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const c =
|
|
543
|
+
parseResponsiveCardElement(t) {
|
|
544
|
+
const r = t.closest("tbw-grid");
|
|
545
|
+
if (!r) return;
|
|
546
|
+
const e = r.querySelector("tbw-grid-responsive-card");
|
|
547
|
+
if (!e) return;
|
|
548
|
+
const n = X.get(e);
|
|
549
|
+
if (n)
|
|
550
|
+
return (d, s) => {
|
|
551
|
+
const a = document.createElement("div");
|
|
552
|
+
a.className = "vue-responsive-card";
|
|
553
|
+
const c = n({ row: d, rowIndex: s });
|
|
418
554
|
if (c && c.length > 0) {
|
|
419
|
-
const
|
|
555
|
+
const p = u({
|
|
420
556
|
render() {
|
|
421
557
|
return c;
|
|
422
558
|
}
|
|
423
559
|
});
|
|
424
|
-
|
|
560
|
+
p.mount(a), this.mountedViews.push({ app: p, container: a });
|
|
425
561
|
}
|
|
426
|
-
return
|
|
562
|
+
return a;
|
|
427
563
|
};
|
|
428
564
|
}
|
|
429
565
|
// #region Type Defaults Support
|
|
@@ -455,47 +591,47 @@ class fe {
|
|
|
455
591
|
* </template>
|
|
456
592
|
* ```
|
|
457
593
|
*/
|
|
458
|
-
getTypeDefault(
|
|
594
|
+
getTypeDefault(t) {
|
|
459
595
|
if (!this.typeDefaults)
|
|
460
596
|
return;
|
|
461
|
-
const
|
|
462
|
-
if (!
|
|
597
|
+
const r = this.typeDefaults[t];
|
|
598
|
+
if (!r)
|
|
463
599
|
return;
|
|
464
|
-
const
|
|
465
|
-
editorParams:
|
|
600
|
+
const e = {
|
|
601
|
+
editorParams: r.editorParams
|
|
466
602
|
};
|
|
467
|
-
return
|
|
603
|
+
return r.renderer && (e.renderer = this.createTypeRenderer(r.renderer)), r.editor && (e.editor = this.createTypeEditor(r.editor)), r.filterPanelRenderer && (e.filterPanelRenderer = this.createFilterPanelRenderer(r.filterPanelRenderer)), e;
|
|
468
604
|
}
|
|
469
605
|
/**
|
|
470
606
|
* Creates a renderer function from a Vue render function for type defaults.
|
|
471
607
|
* @internal
|
|
472
608
|
*/
|
|
473
|
-
createTypeRenderer(
|
|
474
|
-
return (
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const
|
|
609
|
+
createTypeRenderer(t) {
|
|
610
|
+
return (r) => {
|
|
611
|
+
const e = document.createElement("span");
|
|
612
|
+
e.style.display = "contents";
|
|
613
|
+
const n = u({
|
|
478
614
|
render() {
|
|
479
|
-
return
|
|
615
|
+
return t(r);
|
|
480
616
|
}
|
|
481
617
|
});
|
|
482
|
-
return
|
|
618
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
483
619
|
};
|
|
484
620
|
}
|
|
485
621
|
/**
|
|
486
622
|
* Creates an editor function from a Vue render function for type defaults.
|
|
487
623
|
* @internal
|
|
488
624
|
*/
|
|
489
|
-
createTypeEditor(
|
|
490
|
-
return (
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
625
|
+
createTypeEditor(t) {
|
|
626
|
+
return (r) => {
|
|
627
|
+
const e = document.createElement("span");
|
|
628
|
+
e.style.display = "contents";
|
|
629
|
+
const n = u({
|
|
494
630
|
render() {
|
|
495
|
-
return
|
|
631
|
+
return t(r);
|
|
496
632
|
}
|
|
497
633
|
});
|
|
498
|
-
return
|
|
634
|
+
return n.mount(e), this.editorViews.push({ app: n, container: e }), e;
|
|
499
635
|
};
|
|
500
636
|
}
|
|
501
637
|
/**
|
|
@@ -505,16 +641,16 @@ class fe {
|
|
|
505
641
|
* imperative `(container, params) => void` signature expected by the core grid.
|
|
506
642
|
* @internal
|
|
507
643
|
*/
|
|
508
|
-
createFilterPanelRenderer(
|
|
509
|
-
return (
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
644
|
+
createFilterPanelRenderer(t) {
|
|
645
|
+
return (r, e) => {
|
|
646
|
+
const n = document.createElement("div");
|
|
647
|
+
n.style.display = "contents";
|
|
648
|
+
const d = u({
|
|
513
649
|
render() {
|
|
514
|
-
return e
|
|
650
|
+
return t(e);
|
|
515
651
|
}
|
|
516
652
|
});
|
|
517
|
-
|
|
653
|
+
d.mount(n), this.mountedViews.push({ app: d, container: n }), r.appendChild(n);
|
|
518
654
|
};
|
|
519
655
|
}
|
|
520
656
|
// #endregion
|
|
@@ -522,15 +658,15 @@ class fe {
|
|
|
522
658
|
* Cleanup all mounted Vue apps.
|
|
523
659
|
*/
|
|
524
660
|
cleanup() {
|
|
525
|
-
for (const { app:
|
|
661
|
+
for (const { app: t, container: r } of this.mountedViews)
|
|
526
662
|
try {
|
|
527
|
-
|
|
663
|
+
t.unmount(), r.remove();
|
|
528
664
|
} catch {
|
|
529
665
|
}
|
|
530
666
|
this.mountedViews = [];
|
|
531
|
-
for (const { app:
|
|
667
|
+
for (const { app: t, container: r } of this.editorViews)
|
|
532
668
|
try {
|
|
533
|
-
|
|
669
|
+
t.unmount(), r.remove();
|
|
534
670
|
} catch {
|
|
535
671
|
}
|
|
536
672
|
this.editorViews = [];
|
|
@@ -540,15 +676,15 @@ class fe {
|
|
|
540
676
|
* Finds the matching entry in mountedViews by container reference
|
|
541
677
|
* and properly destroys the Vue app to prevent memory leaks.
|
|
542
678
|
*/
|
|
543
|
-
unmount(
|
|
544
|
-
for (let
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
679
|
+
unmount(t) {
|
|
680
|
+
for (let r = this.mountedViews.length - 1; r >= 0; r--) {
|
|
681
|
+
const e = this.mountedViews[r];
|
|
682
|
+
if (e.container === t || t.contains(e.container)) {
|
|
547
683
|
try {
|
|
548
|
-
|
|
684
|
+
e.app.unmount();
|
|
549
685
|
} catch {
|
|
550
686
|
}
|
|
551
|
-
this.mountedViews.splice(
|
|
687
|
+
this.mountedViews.splice(r, 1);
|
|
552
688
|
return;
|
|
553
689
|
}
|
|
554
690
|
}
|
|
@@ -557,20 +693,20 @@ class fe {
|
|
|
557
693
|
* Called when a cell's content is about to be wiped.
|
|
558
694
|
* Destroys editor Vue apps whose container is inside the cell.
|
|
559
695
|
*/
|
|
560
|
-
releaseCell(
|
|
561
|
-
for (let
|
|
562
|
-
const { app:
|
|
563
|
-
if (
|
|
696
|
+
releaseCell(t) {
|
|
697
|
+
for (let r = this.editorViews.length - 1; r >= 0; r--) {
|
|
698
|
+
const { app: e, container: n } = this.editorViews[r];
|
|
699
|
+
if (t.contains(n)) {
|
|
564
700
|
try {
|
|
565
|
-
|
|
701
|
+
e.unmount(), n.remove();
|
|
566
702
|
} catch {
|
|
567
703
|
}
|
|
568
|
-
this.editorViews.splice(
|
|
704
|
+
this.editorViews.splice(r, 1);
|
|
569
705
|
}
|
|
570
706
|
}
|
|
571
707
|
}
|
|
572
708
|
}
|
|
573
|
-
const
|
|
709
|
+
const fe = pe, Ee = /* @__PURE__ */ y({
|
|
574
710
|
__name: "TbwGrid",
|
|
575
711
|
props: {
|
|
576
712
|
/** Row data to display */
|
|
@@ -723,15 +859,15 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
723
859
|
}
|
|
724
860
|
},
|
|
725
861
|
emits: ["cell-commit", "row-commit", "cell-click", "cell-dblclick", "selection-change", "row-toggle", "sort-change", "ready"],
|
|
726
|
-
setup(i, { expose:
|
|
727
|
-
let
|
|
728
|
-
function
|
|
729
|
-
return
|
|
862
|
+
setup(i, { expose: t, emit: r }) {
|
|
863
|
+
let e = !1, n = null;
|
|
864
|
+
function d() {
|
|
865
|
+
return e || (n = new fe(), ne.registerAdapter(n), e = !0), n;
|
|
730
866
|
}
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
const c = J(),
|
|
867
|
+
d();
|
|
868
|
+
const s = i, a = r, l = O(null);
|
|
869
|
+
N(U, l);
|
|
870
|
+
const c = J(), p = ie(), h = [
|
|
735
871
|
"selection",
|
|
736
872
|
"editing",
|
|
737
873
|
"clipboard",
|
|
@@ -760,60 +896,60 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
760
896
|
"pivot",
|
|
761
897
|
"serverSide"
|
|
762
898
|
];
|
|
763
|
-
function
|
|
899
|
+
function b() {
|
|
764
900
|
const o = [];
|
|
765
|
-
for (const
|
|
766
|
-
const
|
|
767
|
-
if (
|
|
768
|
-
const
|
|
769
|
-
|
|
901
|
+
for (const f of h) {
|
|
902
|
+
const E = s[f];
|
|
903
|
+
if (E !== void 0) {
|
|
904
|
+
const g = oe(f, E);
|
|
905
|
+
g && o.push(g);
|
|
770
906
|
}
|
|
771
907
|
}
|
|
772
908
|
return o;
|
|
773
909
|
}
|
|
774
|
-
const
|
|
775
|
-
const o =
|
|
910
|
+
const _ = re(() => {
|
|
911
|
+
const o = s.gridConfig ?? {}, f = b(), E = o.plugins ?? [], g = [...f, ...E], D = p ? { ...o.icons, ...p } : o.icons;
|
|
776
912
|
return {
|
|
777
913
|
...o,
|
|
778
|
-
...
|
|
779
|
-
...
|
|
780
|
-
...
|
|
914
|
+
...s.columns ? { columns: s.columns } : {},
|
|
915
|
+
...g.length > 0 ? { plugins: g } : {},
|
|
916
|
+
...D ? { icons: D } : {}
|
|
781
917
|
};
|
|
782
918
|
});
|
|
783
|
-
function
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
function N(o) {
|
|
787
|
-
l("row-commit", o);
|
|
919
|
+
function F(o) {
|
|
920
|
+
a("cell-commit", o);
|
|
788
921
|
}
|
|
789
922
|
function A(o) {
|
|
790
|
-
|
|
923
|
+
a("row-commit", o);
|
|
924
|
+
}
|
|
925
|
+
function M(o) {
|
|
926
|
+
a("cell-click", o);
|
|
791
927
|
}
|
|
792
928
|
function W(o) {
|
|
793
|
-
|
|
929
|
+
a("cell-dblclick", o);
|
|
794
930
|
}
|
|
795
931
|
function I(o) {
|
|
796
|
-
|
|
932
|
+
a("selection-change", o);
|
|
797
933
|
}
|
|
798
|
-
function
|
|
799
|
-
|
|
934
|
+
function H(o) {
|
|
935
|
+
a("row-toggle", o);
|
|
800
936
|
}
|
|
801
937
|
function $(o) {
|
|
802
|
-
|
|
938
|
+
a("sort-change", o);
|
|
803
939
|
}
|
|
804
940
|
function z(o) {
|
|
805
|
-
|
|
941
|
+
a("ready", o);
|
|
806
942
|
}
|
|
807
|
-
function Z(o,
|
|
808
|
-
const
|
|
809
|
-
if (!
|
|
810
|
-
const
|
|
943
|
+
function Z(o, f) {
|
|
944
|
+
const E = Object.getPrototypeOf(o), g = Object.getOwnPropertyDescriptor(E, "gridConfig");
|
|
945
|
+
if (!g?.set || !g?.get) return;
|
|
946
|
+
const D = g.set, te = g.get;
|
|
811
947
|
Object.defineProperty(o, "gridConfig", {
|
|
812
948
|
get() {
|
|
813
949
|
return te.call(this);
|
|
814
950
|
},
|
|
815
951
|
set(S) {
|
|
816
|
-
S &&
|
|
952
|
+
S && f ? D.call(this, f.processGridConfig(S)) : D.call(this, S);
|
|
817
953
|
},
|
|
818
954
|
configurable: !0
|
|
819
955
|
});
|
|
@@ -821,54 +957,54 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
821
957
|
function ee(o) {
|
|
822
958
|
delete o.gridConfig;
|
|
823
959
|
}
|
|
824
|
-
return
|
|
825
|
-
const o =
|
|
960
|
+
return P(() => {
|
|
961
|
+
const o = l.value;
|
|
826
962
|
if (!o) return;
|
|
827
|
-
const
|
|
828
|
-
o.__frameworkAdapter =
|
|
963
|
+
const f = d();
|
|
964
|
+
o.__frameworkAdapter = f, f.setTypeDefaults(c ?? null), Z(o, f), o.addEventListener("cell-commit", F), o.addEventListener("row-commit", A), o.addEventListener("cell-click", M), o.addEventListener("cell-dblclick", W), o.addEventListener("selection-change", I), o.addEventListener("row-toggle", H), o.addEventListener("sort-change", $), o.addEventListener("ready", z), s.rows.length > 0 && (o.rows = s.rows), _.value && (o.gridConfig = _.value), s.fitMode && (o.fitMode = s.fitMode);
|
|
829
965
|
}), q(() => {
|
|
830
|
-
const o =
|
|
831
|
-
o && (ee(o), o.removeEventListener("cell-commit",
|
|
832
|
-
}),
|
|
833
|
-
() =>
|
|
966
|
+
const o = l.value;
|
|
967
|
+
o && (ee(o), o.removeEventListener("cell-commit", F), o.removeEventListener("row-commit", A), o.removeEventListener("cell-click", M), o.removeEventListener("cell-dblclick", W), o.removeEventListener("selection-change", I), o.removeEventListener("row-toggle", H), o.removeEventListener("sort-change", $), o.removeEventListener("ready", z));
|
|
968
|
+
}), G(
|
|
969
|
+
() => s.rows,
|
|
834
970
|
(o) => {
|
|
835
|
-
|
|
971
|
+
l.value && (l.value.rows = o);
|
|
836
972
|
},
|
|
837
973
|
{ deep: !0 }
|
|
838
|
-
),
|
|
839
|
-
|
|
974
|
+
), G(
|
|
975
|
+
_,
|
|
840
976
|
(o) => {
|
|
841
|
-
|
|
977
|
+
l.value && o && (l.value.gridConfig = o);
|
|
842
978
|
},
|
|
843
979
|
{ deep: !0 }
|
|
844
|
-
),
|
|
845
|
-
() =>
|
|
980
|
+
), G(
|
|
981
|
+
() => s.fitMode,
|
|
846
982
|
(o) => {
|
|
847
|
-
|
|
983
|
+
l.value && o && (l.value.fitMode = o);
|
|
848
984
|
}
|
|
849
|
-
),
|
|
985
|
+
), G(
|
|
850
986
|
() => c,
|
|
851
987
|
(o) => {
|
|
852
|
-
|
|
988
|
+
d().setTypeDefaults(o ?? null);
|
|
853
989
|
},
|
|
854
990
|
{ deep: !0 }
|
|
855
|
-
),
|
|
991
|
+
), t({
|
|
856
992
|
/** The underlying grid element */
|
|
857
|
-
gridElement:
|
|
993
|
+
gridElement: l,
|
|
858
994
|
/** Force a layout recalculation */
|
|
859
|
-
forceLayout: () =>
|
|
995
|
+
forceLayout: () => l.value?.forceLayout(),
|
|
860
996
|
/** Get current grid configuration */
|
|
861
|
-
getConfig: () =>
|
|
997
|
+
getConfig: () => l.value?.getConfig(),
|
|
862
998
|
/** Wait for grid to be ready */
|
|
863
|
-
ready: () =>
|
|
864
|
-
}), (o,
|
|
999
|
+
ready: () => l.value?.ready()
|
|
1000
|
+
}), (o, f) => (j(), T("tbw-grid", {
|
|
865
1001
|
ref_key: "gridRef",
|
|
866
|
-
ref:
|
|
1002
|
+
ref: l
|
|
867
1003
|
}, [
|
|
868
|
-
|
|
1004
|
+
x(o.$slots, "default")
|
|
869
1005
|
], 512));
|
|
870
1006
|
}
|
|
871
|
-
}), me = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"],
|
|
1007
|
+
}), me = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"], Ve = /* @__PURE__ */ y({
|
|
872
1008
|
__name: "TbwGridColumn",
|
|
873
1009
|
props: {
|
|
874
1010
|
field: {},
|
|
@@ -884,39 +1020,39 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
884
1020
|
hidden: { type: Boolean }
|
|
885
1021
|
},
|
|
886
1022
|
setup(i) {
|
|
887
|
-
const
|
|
888
|
-
return
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
if (!
|
|
895
|
-
const
|
|
896
|
-
value:
|
|
897
|
-
row:
|
|
898
|
-
column:
|
|
1023
|
+
const t = B(), r = O(null);
|
|
1024
|
+
return P(() => {
|
|
1025
|
+
const e = r.value;
|
|
1026
|
+
if (!e) return;
|
|
1027
|
+
const n = !!t.cell, d = !!t.editor;
|
|
1028
|
+
n && ae(e, (s) => {
|
|
1029
|
+
const a = t.cell;
|
|
1030
|
+
if (!a) return L("span");
|
|
1031
|
+
const l = a({
|
|
1032
|
+
value: s.value,
|
|
1033
|
+
row: s.row,
|
|
1034
|
+
column: s.column
|
|
899
1035
|
});
|
|
900
|
-
return
|
|
901
|
-
}),
|
|
902
|
-
const
|
|
903
|
-
if (!
|
|
904
|
-
const
|
|
905
|
-
value:
|
|
906
|
-
row:
|
|
907
|
-
column:
|
|
908
|
-
field:
|
|
909
|
-
rowId:
|
|
910
|
-
commit:
|
|
911
|
-
cancel:
|
|
912
|
-
updateRow:
|
|
913
|
-
onValueChange:
|
|
1036
|
+
return L("div", { style: "display: contents" }, l);
|
|
1037
|
+
}), d && le(e, (s) => {
|
|
1038
|
+
const a = t.editor;
|
|
1039
|
+
if (!a) return L("span");
|
|
1040
|
+
const l = a({
|
|
1041
|
+
value: s.value,
|
|
1042
|
+
row: s.row,
|
|
1043
|
+
column: s.column,
|
|
1044
|
+
field: s.field,
|
|
1045
|
+
rowId: s.rowId ?? "",
|
|
1046
|
+
commit: s.commit,
|
|
1047
|
+
cancel: s.cancel,
|
|
1048
|
+
updateRow: s.updateRow,
|
|
1049
|
+
onValueChange: s.onValueChange
|
|
914
1050
|
});
|
|
915
|
-
return
|
|
1051
|
+
return L("div", { style: "display: contents" }, l);
|
|
916
1052
|
});
|
|
917
|
-
}), (
|
|
1053
|
+
}), (e, n) => (j(), T("tbw-grid-column", {
|
|
918
1054
|
ref_key: "columnRef",
|
|
919
|
-
ref:
|
|
1055
|
+
ref: r,
|
|
920
1056
|
field: i.field,
|
|
921
1057
|
header: i.header,
|
|
922
1058
|
width: i.width,
|
|
@@ -930,44 +1066,44 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
930
1066
|
hidden: i.hidden
|
|
931
1067
|
}, null, 8, me));
|
|
932
1068
|
}
|
|
933
|
-
}), ge = ["show-expand-column", "animation"],
|
|
1069
|
+
}), ge = ["show-expand-column", "animation"], Le = /* @__PURE__ */ y({
|
|
934
1070
|
__name: "TbwGridDetailPanel",
|
|
935
1071
|
props: {
|
|
936
1072
|
showExpandColumn: { type: Boolean, default: !0 },
|
|
937
1073
|
animation: { type: [String, Boolean], default: "slide" }
|
|
938
1074
|
},
|
|
939
1075
|
setup(i) {
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
const
|
|
943
|
-
!
|
|
944
|
-
}), (
|
|
1076
|
+
const t = O(null), r = B();
|
|
1077
|
+
return P(() => {
|
|
1078
|
+
const e = t.value;
|
|
1079
|
+
!e || !r.default || Q.set(e, (n) => r.default?.(n));
|
|
1080
|
+
}), (e, n) => (j(), T("tbw-grid-detail", {
|
|
945
1081
|
ref_key: "detailRef",
|
|
946
|
-
ref:
|
|
1082
|
+
ref: t,
|
|
947
1083
|
"show-expand-column": i.showExpandColumn,
|
|
948
1084
|
animation: i.animation
|
|
949
1085
|
}, null, 8, ge));
|
|
950
1086
|
}
|
|
951
|
-
}),
|
|
1087
|
+
}), Oe = /* @__PURE__ */ y({
|
|
952
1088
|
__name: "TbwGridResponsiveCard",
|
|
953
1089
|
setup(i) {
|
|
954
|
-
const
|
|
955
|
-
return
|
|
956
|
-
const
|
|
957
|
-
!
|
|
958
|
-
}), (
|
|
1090
|
+
const t = O(null), r = B();
|
|
1091
|
+
return P(() => {
|
|
1092
|
+
const e = t.value;
|
|
1093
|
+
!e || !r.default || X.set(e, (n) => r.default?.(n));
|
|
1094
|
+
}), (e, n) => (j(), T("tbw-grid-responsive-card", {
|
|
959
1095
|
ref_key: "cardRef",
|
|
960
|
-
ref:
|
|
1096
|
+
ref: t
|
|
961
1097
|
}, null, 512));
|
|
962
1098
|
}
|
|
963
|
-
}),
|
|
1099
|
+
}), Pe = /* @__PURE__ */ y({
|
|
964
1100
|
__name: "TbwGridToolButtons",
|
|
965
1101
|
setup(i) {
|
|
966
|
-
return (
|
|
967
|
-
|
|
1102
|
+
return (t, r) => (j(), T("tbw-grid-tool-buttons", null, [
|
|
1103
|
+
x(t.$slots, "default")
|
|
968
1104
|
]));
|
|
969
1105
|
}
|
|
970
|
-
}),
|
|
1106
|
+
}), he = /* @__PURE__ */ new WeakMap(), ye = ["id", "label", "icon", "position", "width"], Te = /* @__PURE__ */ y({
|
|
971
1107
|
__name: "TbwGridToolPanel",
|
|
972
1108
|
props: {
|
|
973
1109
|
id: {},
|
|
@@ -977,34 +1113,34 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
977
1113
|
width: { default: "250px" }
|
|
978
1114
|
},
|
|
979
1115
|
setup(i) {
|
|
980
|
-
const
|
|
981
|
-
return
|
|
982
|
-
const
|
|
983
|
-
!
|
|
984
|
-
}), (
|
|
1116
|
+
const t = O(null), r = B();
|
|
1117
|
+
return P(() => {
|
|
1118
|
+
const e = t.value;
|
|
1119
|
+
!e || !r.default || he.set(e, (n) => r.default?.(n));
|
|
1120
|
+
}), (e, n) => (j(), T("tbw-grid-tool-panel", {
|
|
985
1121
|
ref_key: "panelRef",
|
|
986
|
-
ref:
|
|
1122
|
+
ref: t,
|
|
987
1123
|
id: i.id,
|
|
988
1124
|
label: i.label,
|
|
989
1125
|
icon: i.icon,
|
|
990
1126
|
position: i.position,
|
|
991
1127
|
width: i.width
|
|
992
|
-
}, null, 8,
|
|
1128
|
+
}, null, 8, ye));
|
|
993
1129
|
}
|
|
994
1130
|
});
|
|
995
|
-
function
|
|
996
|
-
const
|
|
997
|
-
let
|
|
998
|
-
|
|
999
|
-
const
|
|
1000
|
-
if (!
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1131
|
+
function je(i, t, r) {
|
|
1132
|
+
const e = r ?? k(U, O(null));
|
|
1133
|
+
let n = null;
|
|
1134
|
+
P(() => {
|
|
1135
|
+
const d = e.value;
|
|
1136
|
+
if (!d) return;
|
|
1137
|
+
const s = t;
|
|
1138
|
+
d.addEventListener(i, s), n = () => d.removeEventListener(i, s);
|
|
1003
1139
|
}), q(() => {
|
|
1004
|
-
|
|
1140
|
+
n?.();
|
|
1005
1141
|
});
|
|
1006
1142
|
}
|
|
1007
|
-
const
|
|
1143
|
+
const _e = y({
|
|
1008
1144
|
name: "GridProvider",
|
|
1009
1145
|
props: {
|
|
1010
1146
|
/**
|
|
@@ -1022,39 +1158,39 @@ const De = y({
|
|
|
1022
1158
|
default: void 0
|
|
1023
1159
|
}
|
|
1024
1160
|
},
|
|
1025
|
-
setup(i, { slots:
|
|
1161
|
+
setup(i, { slots: t }) {
|
|
1026
1162
|
return () => {
|
|
1027
|
-
let
|
|
1028
|
-
return i.typeDefaults && (
|
|
1163
|
+
let r = t.default?.();
|
|
1164
|
+
return i.typeDefaults && (r = L(se, { defaults: i.typeDefaults }, () => r)), i.icons && (r = L(de, { icons: i.icons }, () => r)), r;
|
|
1029
1165
|
};
|
|
1030
1166
|
}
|
|
1031
1167
|
});
|
|
1032
1168
|
export {
|
|
1033
|
-
|
|
1169
|
+
U as GRID_ELEMENT_KEY,
|
|
1034
1170
|
K as GRID_ICONS,
|
|
1035
1171
|
Y as GRID_TYPE_DEFAULTS,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1172
|
+
pe as GridAdapter,
|
|
1173
|
+
de as GridIconProvider,
|
|
1174
|
+
_e as GridProvider,
|
|
1175
|
+
se as GridTypeProvider,
|
|
1176
|
+
Ee as TbwGrid,
|
|
1177
|
+
Ve as TbwGridColumn,
|
|
1178
|
+
Le as TbwGridDetailPanel,
|
|
1179
|
+
Oe as TbwGridResponsiveCard,
|
|
1180
|
+
Pe as TbwGridToolButtons,
|
|
1181
|
+
Te as TbwGridToolPanel,
|
|
1182
|
+
fe as VueGridAdapter,
|
|
1183
|
+
Be as clearFeatureRegistry,
|
|
1184
|
+
Se as createPluginFromFeature,
|
|
1185
|
+
Ne as getFeatureFactory,
|
|
1186
|
+
ke as getRegisteredFeatures,
|
|
1187
|
+
Fe as isFeatureRegistered,
|
|
1188
|
+
v as isVueComponent,
|
|
1189
|
+
Ae as registerFeature,
|
|
1054
1190
|
We as useGrid,
|
|
1055
|
-
|
|
1191
|
+
je as useGridEvent,
|
|
1056
1192
|
ie as useGridIcons,
|
|
1057
1193
|
J as useGridTypeDefaults,
|
|
1058
|
-
|
|
1194
|
+
Ce as useTypeDefault
|
|
1059
1195
|
};
|
|
1060
1196
|
//# sourceMappingURL=index.js.map
|