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