@toolbox-web/grid-vue 0.8.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/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.d.ts +8 -6
- package/index.d.ts.map +1 -1
- package/index.js +613 -469
- 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 +24 -7
- package/lib/vue-column-config.d.ts.map +1 -1
- package/lib/vue-grid-adapter.d.ts +42 -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 se = 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 de = 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 t =
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
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 t =
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
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 t =
|
|
65
|
-
t && (
|
|
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 t =
|
|
73
|
-
t && (
|
|
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 t =
|
|
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
88
|
if ("__name" in t || typeof t.setup == "function") return !0;
|
|
89
89
|
}
|
|
90
90
|
return !1;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
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,9 +123,20 @@ 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
|
-
|
|
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(
|
|
136
|
+
t.loadingRenderer
|
|
137
|
+
) : R(t.loadingRenderer) && (e.loadingRenderer = this.createVNodeLoadingRenderer(
|
|
138
|
+
t.loadingRenderer
|
|
139
|
+
))), e;
|
|
129
140
|
}
|
|
130
141
|
/**
|
|
131
142
|
* Processes typeDefaults, converting Vue component/VNode references
|
|
@@ -134,19 +145,19 @@ class fe {
|
|
|
134
145
|
* @param typeDefaults - Vue type defaults with possible component references
|
|
135
146
|
* @returns Processed TypeDefault record
|
|
136
147
|
*/
|
|
137
|
-
processTypeDefaults(
|
|
148
|
+
processTypeDefaults(r) {
|
|
138
149
|
const t = {};
|
|
139
|
-
for (const [
|
|
140
|
-
const
|
|
141
|
-
editorParams:
|
|
150
|
+
for (const [e, n] of Object.entries(r)) {
|
|
151
|
+
const i = {
|
|
152
|
+
editorParams: n.editorParams
|
|
142
153
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
))),
|
|
146
|
-
|
|
147
|
-
) :
|
|
148
|
-
|
|
149
|
-
))),
|
|
154
|
+
n.renderer && (y(n.renderer) ? i.renderer = this.createConfigComponentRenderer(n.renderer) : R(n.renderer) && (i.renderer = this.createTypeRenderer(
|
|
155
|
+
n.renderer
|
|
156
|
+
))), n.editor && (y(n.editor) ? i.editor = this.createConfigComponentEditor(
|
|
157
|
+
n.editor
|
|
158
|
+
) : R(n.editor) && (i.editor = this.createTypeEditor(
|
|
159
|
+
n.editor
|
|
160
|
+
))), n.filterPanelRenderer && (i.filterPanelRenderer = this.createFilterPanelRenderer(n.filterPanelRenderer)), t[e] = i;
|
|
150
161
|
}
|
|
151
162
|
return t;
|
|
152
163
|
}
|
|
@@ -157,24 +168,46 @@ class fe {
|
|
|
157
168
|
* @param column - Vue column config
|
|
158
169
|
* @returns Processed ColumnConfig with DOM-returning functions
|
|
159
170
|
*/
|
|
160
|
-
processColumn(
|
|
161
|
-
const t = { ...
|
|
162
|
-
if (
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
} else if (
|
|
167
|
-
const
|
|
168
|
-
|
|
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;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
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;
|
|
169
189
|
}
|
|
170
190
|
}
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
} else if (
|
|
176
|
-
const
|
|
177
|
-
|
|
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)) {
|
|
196
|
+
const e = this.createConfigVNodeHeaderRenderer(
|
|
197
|
+
r.headerRenderer
|
|
198
|
+
);
|
|
199
|
+
e[f] = !0, t.headerRenderer = e;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
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)) {
|
|
207
|
+
const e = this.createConfigVNodeHeaderLabelRenderer(
|
|
208
|
+
r.headerLabelRenderer
|
|
209
|
+
);
|
|
210
|
+
e[f] = !0, t.headerLabelRenderer = e;
|
|
178
211
|
}
|
|
179
212
|
}
|
|
180
213
|
return t;
|
|
@@ -184,38 +217,38 @@ class fe {
|
|
|
184
217
|
* Used for config-based renderers (not slot-based).
|
|
185
218
|
* @internal
|
|
186
219
|
*/
|
|
187
|
-
createConfigComponentRenderer(
|
|
220
|
+
createConfigComponentRenderer(r) {
|
|
188
221
|
const t = /* @__PURE__ */ new WeakMap();
|
|
189
|
-
return (
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
let
|
|
198
|
-
const g =
|
|
222
|
+
return (e) => {
|
|
223
|
+
const n = e.cellEl;
|
|
224
|
+
if (n) {
|
|
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";
|
|
230
|
+
let p = e;
|
|
231
|
+
const g = r, w = u({
|
|
199
232
|
render() {
|
|
200
|
-
return
|
|
233
|
+
return V(g, { ...p });
|
|
201
234
|
}
|
|
202
235
|
});
|
|
203
|
-
return
|
|
204
|
-
app:
|
|
205
|
-
container:
|
|
206
|
-
update: (
|
|
207
|
-
|
|
236
|
+
return w.mount(d), t.set(n, {
|
|
237
|
+
app: w,
|
|
238
|
+
container: d,
|
|
239
|
+
update: (N) => {
|
|
240
|
+
p = N, w._instance?.update();
|
|
208
241
|
}
|
|
209
|
-
}),
|
|
242
|
+
}), d;
|
|
210
243
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const
|
|
244
|
+
const i = document.createElement("div");
|
|
245
|
+
i.className = "vue-cell-renderer", i.style.display = "contents";
|
|
246
|
+
const s = r, a = u({
|
|
214
247
|
render() {
|
|
215
|
-
return
|
|
248
|
+
return V(s, { ...e });
|
|
216
249
|
}
|
|
217
250
|
});
|
|
218
|
-
return
|
|
251
|
+
return a.mount(i), this.mountedViews.push({ app: a, container: i }), i;
|
|
219
252
|
};
|
|
220
253
|
}
|
|
221
254
|
/**
|
|
@@ -223,38 +256,38 @@ class fe {
|
|
|
223
256
|
* Used for config-based renderers (not slot-based).
|
|
224
257
|
* @internal
|
|
225
258
|
*/
|
|
226
|
-
createConfigVNodeRenderer(
|
|
259
|
+
createConfigVNodeRenderer(r) {
|
|
227
260
|
const t = /* @__PURE__ */ new WeakMap();
|
|
228
|
-
return (
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
let
|
|
237
|
-
const
|
|
261
|
+
return (e) => {
|
|
262
|
+
const n = e.cellEl;
|
|
263
|
+
if (n) {
|
|
264
|
+
const a = t.get(n);
|
|
265
|
+
if (a)
|
|
266
|
+
return a.update(e), a.container;
|
|
267
|
+
const c = document.createElement("div");
|
|
268
|
+
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
269
|
+
let d = e;
|
|
270
|
+
const p = u({
|
|
238
271
|
render() {
|
|
239
|
-
return
|
|
272
|
+
return r(d);
|
|
240
273
|
}
|
|
241
274
|
});
|
|
242
|
-
return
|
|
243
|
-
app:
|
|
244
|
-
container:
|
|
275
|
+
return p.mount(c), t.set(n, {
|
|
276
|
+
app: p,
|
|
277
|
+
container: c,
|
|
245
278
|
update: (g) => {
|
|
246
|
-
|
|
279
|
+
d = g, p._instance?.update();
|
|
247
280
|
}
|
|
248
|
-
}),
|
|
281
|
+
}), c;
|
|
249
282
|
}
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
const
|
|
283
|
+
const i = document.createElement("div");
|
|
284
|
+
i.className = "vue-cell-renderer", i.style.display = "contents";
|
|
285
|
+
const s = u({
|
|
253
286
|
render() {
|
|
254
|
-
return e
|
|
287
|
+
return r(e);
|
|
255
288
|
}
|
|
256
289
|
});
|
|
257
|
-
return
|
|
290
|
+
return s.mount(i), this.mountedViews.push({ app: s, container: i }), i;
|
|
258
291
|
};
|
|
259
292
|
}
|
|
260
293
|
/**
|
|
@@ -262,16 +295,16 @@ class fe {
|
|
|
262
295
|
* Used for config-based editors (not slot-based).
|
|
263
296
|
* @internal
|
|
264
297
|
*/
|
|
265
|
-
createConfigComponentEditor(
|
|
298
|
+
createConfigComponentEditor(r) {
|
|
266
299
|
return (t) => {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const
|
|
300
|
+
const e = document.createElement("div");
|
|
301
|
+
e.className = "vue-cell-editor", e.style.display = "contents";
|
|
302
|
+
const n = r, i = u({
|
|
270
303
|
render() {
|
|
271
|
-
return
|
|
304
|
+
return V(n, { ...t });
|
|
272
305
|
}
|
|
273
306
|
});
|
|
274
|
-
return
|
|
307
|
+
return i.mount(e), this.editorViews.push({ app: i, container: e }), e;
|
|
275
308
|
};
|
|
276
309
|
}
|
|
277
310
|
/**
|
|
@@ -279,16 +312,126 @@ class fe {
|
|
|
279
312
|
* Used for config-based editors (not slot-based).
|
|
280
313
|
* @internal
|
|
281
314
|
*/
|
|
282
|
-
createConfigVNodeEditor(
|
|
315
|
+
createConfigVNodeEditor(r) {
|
|
283
316
|
return (t) => {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const
|
|
317
|
+
const e = document.createElement("div");
|
|
318
|
+
e.className = "vue-cell-editor", e.style.display = "contents";
|
|
319
|
+
const n = u({
|
|
287
320
|
render() {
|
|
288
|
-
return
|
|
321
|
+
return r(t);
|
|
289
322
|
}
|
|
290
323
|
});
|
|
291
|
-
return
|
|
324
|
+
return n.mount(e), this.editorViews.push({ app: n, container: e }), e;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Creates a DOM-returning header renderer from a Vue component class.
|
|
329
|
+
* Used for config-based headerRenderer (not slot-based).
|
|
330
|
+
* @internal
|
|
331
|
+
*/
|
|
332
|
+
createConfigComponentHeaderRenderer(r) {
|
|
333
|
+
return (t) => {
|
|
334
|
+
const e = document.createElement("div");
|
|
335
|
+
e.className = "vue-header-renderer", e.style.display = "contents";
|
|
336
|
+
const n = r, i = u({
|
|
337
|
+
render() {
|
|
338
|
+
return V(n, {
|
|
339
|
+
column: t.column,
|
|
340
|
+
value: t.value,
|
|
341
|
+
sortState: t.sortState,
|
|
342
|
+
filterActive: t.filterActive,
|
|
343
|
+
renderSortIcon: t.renderSortIcon,
|
|
344
|
+
renderFilterButton: t.renderFilterButton
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
return i.mount(e), this.mountedViews.push({ app: i, container: e }), e;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Creates a DOM-returning header renderer from a VNode-returning render function.
|
|
353
|
+
* Used for config-based headerRenderer (not slot-based).
|
|
354
|
+
* @internal
|
|
355
|
+
*/
|
|
356
|
+
createConfigVNodeHeaderRenderer(r) {
|
|
357
|
+
return (t) => {
|
|
358
|
+
const e = document.createElement("div");
|
|
359
|
+
e.className = "vue-header-renderer", e.style.display = "contents";
|
|
360
|
+
const n = u({
|
|
361
|
+
render() {
|
|
362
|
+
return r(t);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Creates a DOM-returning header label renderer from a Vue component class.
|
|
370
|
+
* Used for config-based headerLabelRenderer (not slot-based).
|
|
371
|
+
* @internal
|
|
372
|
+
*/
|
|
373
|
+
createConfigComponentHeaderLabelRenderer(r) {
|
|
374
|
+
return (t) => {
|
|
375
|
+
const e = document.createElement("div");
|
|
376
|
+
e.className = "vue-header-label-renderer", e.style.display = "contents";
|
|
377
|
+
const n = r, i = u({
|
|
378
|
+
render() {
|
|
379
|
+
return V(n, {
|
|
380
|
+
column: t.column,
|
|
381
|
+
value: t.value
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
return i.mount(e), this.mountedViews.push({ app: i, container: e }), e;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Creates a DOM-returning header label renderer from a VNode-returning render function.
|
|
390
|
+
* Used for config-based headerLabelRenderer (not slot-based).
|
|
391
|
+
* @internal
|
|
392
|
+
*/
|
|
393
|
+
createConfigVNodeHeaderLabelRenderer(r) {
|
|
394
|
+
return (t) => {
|
|
395
|
+
const e = document.createElement("div");
|
|
396
|
+
e.className = "vue-header-label-renderer", e.style.display = "contents";
|
|
397
|
+
const n = u({
|
|
398
|
+
render() {
|
|
399
|
+
return r(t);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Creates a DOM-returning loading renderer from a Vue component class.
|
|
407
|
+
* @internal
|
|
408
|
+
*/
|
|
409
|
+
createComponentLoadingRenderer(r) {
|
|
410
|
+
return (t) => {
|
|
411
|
+
const e = document.createElement("div");
|
|
412
|
+
e.className = "vue-loading-renderer", e.style.display = "contents";
|
|
413
|
+
const n = r, i = u({
|
|
414
|
+
render() {
|
|
415
|
+
return V(n, { size: t.size });
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
return i.mount(e), this.mountedViews.push({ app: i, container: e }), e;
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Creates a DOM-returning loading renderer from a VNode-returning render function.
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
createVNodeLoadingRenderer(r) {
|
|
426
|
+
return (t) => {
|
|
427
|
+
const e = document.createElement("div");
|
|
428
|
+
e.className = "vue-loading-renderer", e.style.display = "contents";
|
|
429
|
+
const n = u({
|
|
430
|
+
render() {
|
|
431
|
+
return r(t);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
292
435
|
};
|
|
293
436
|
}
|
|
294
437
|
// #endregion
|
|
@@ -298,132 +441,132 @@ class fe {
|
|
|
298
441
|
*
|
|
299
442
|
* @internal
|
|
300
443
|
*/
|
|
301
|
-
setTypeDefaults(
|
|
302
|
-
this.typeDefaults =
|
|
444
|
+
setTypeDefaults(r) {
|
|
445
|
+
this.typeDefaults = r;
|
|
303
446
|
}
|
|
304
447
|
/**
|
|
305
448
|
* Determines if this adapter can handle the given element.
|
|
306
449
|
* Checks if a renderer or editor is registered for this element.
|
|
307
450
|
*/
|
|
308
|
-
canHandle(
|
|
309
|
-
const t =
|
|
310
|
-
let
|
|
311
|
-
if (!
|
|
312
|
-
const
|
|
313
|
-
|
|
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));
|
|
314
457
|
}
|
|
315
|
-
const
|
|
316
|
-
return
|
|
458
|
+
const n = e?.renderer !== void 0, i = e?.editor !== void 0;
|
|
459
|
+
return e !== void 0 && (n || i);
|
|
317
460
|
}
|
|
318
461
|
/**
|
|
319
462
|
* Creates a view renderer function that renders a Vue component
|
|
320
463
|
* and returns its container DOM element.
|
|
321
464
|
*/
|
|
322
|
-
createRenderer(
|
|
323
|
-
const t =
|
|
465
|
+
createRenderer(r) {
|
|
466
|
+
const t = te(r);
|
|
324
467
|
if (!t)
|
|
325
468
|
return;
|
|
326
|
-
const
|
|
327
|
-
return (
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
if (
|
|
332
|
-
return
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
let
|
|
336
|
-
const g =
|
|
469
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
470
|
+
return (n) => {
|
|
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";
|
|
478
|
+
let p = n;
|
|
479
|
+
const g = u({
|
|
337
480
|
render() {
|
|
338
|
-
return t(
|
|
481
|
+
return t(p);
|
|
339
482
|
}
|
|
340
483
|
});
|
|
341
|
-
return g.mount(
|
|
484
|
+
return g.mount(d), e.set(i, {
|
|
342
485
|
app: g,
|
|
343
|
-
container:
|
|
344
|
-
update: (
|
|
345
|
-
|
|
486
|
+
container: d,
|
|
487
|
+
update: (w) => {
|
|
488
|
+
p = w, g._instance?.update();
|
|
346
489
|
}
|
|
347
|
-
}),
|
|
490
|
+
}), d;
|
|
348
491
|
}
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
492
|
+
const s = document.createElement("div");
|
|
493
|
+
s.className = "vue-cell-renderer", s.style.display = "contents";
|
|
494
|
+
const a = u({
|
|
352
495
|
render() {
|
|
353
|
-
return t(
|
|
496
|
+
return t(n);
|
|
354
497
|
}
|
|
355
498
|
});
|
|
356
|
-
return
|
|
499
|
+
return a.mount(s), this.mountedViews.push({ app: a, container: s }), s;
|
|
357
500
|
};
|
|
358
501
|
}
|
|
359
502
|
/**
|
|
360
503
|
* Creates an editor spec that renders a Vue component for cell editing.
|
|
361
504
|
* Returns a function that creates the editor DOM element.
|
|
362
505
|
*/
|
|
363
|
-
createEditor(
|
|
364
|
-
const t =
|
|
506
|
+
createEditor(r) {
|
|
507
|
+
const t = re(r);
|
|
365
508
|
if (t)
|
|
366
|
-
return (
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const
|
|
509
|
+
return (e) => {
|
|
510
|
+
const n = document.createElement("div");
|
|
511
|
+
n.className = "vue-cell-editor", n.style.display = "contents";
|
|
512
|
+
const i = u({
|
|
370
513
|
render() {
|
|
371
|
-
return t(
|
|
514
|
+
return t(e);
|
|
372
515
|
}
|
|
373
516
|
});
|
|
374
|
-
return
|
|
517
|
+
return i.mount(n), this.editorViews.push({ app: i, container: n }), n;
|
|
375
518
|
};
|
|
376
519
|
}
|
|
377
520
|
/**
|
|
378
521
|
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
379
522
|
* Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
|
|
380
523
|
*/
|
|
381
|
-
parseDetailElement(
|
|
382
|
-
const t =
|
|
524
|
+
parseDetailElement(r) {
|
|
525
|
+
const t = r.closest("tbw-grid");
|
|
383
526
|
if (!t) return;
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
return (
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
393
|
-
const
|
|
527
|
+
const e = t.querySelector("tbw-grid-detail");
|
|
528
|
+
if (!e) return;
|
|
529
|
+
const n = $.get(e);
|
|
530
|
+
if (n)
|
|
531
|
+
return (i, s) => {
|
|
532
|
+
const a = document.createElement("div");
|
|
533
|
+
a.className = "vue-detail-panel";
|
|
534
|
+
const d = n({ row: i, rowIndex: s });
|
|
535
|
+
if (d && d.length > 0) {
|
|
536
|
+
const p = u({
|
|
394
537
|
render() {
|
|
395
|
-
return
|
|
538
|
+
return d;
|
|
396
539
|
}
|
|
397
540
|
});
|
|
398
|
-
|
|
541
|
+
p.mount(a), this.mountedViews.push({ app: p, container: a });
|
|
399
542
|
}
|
|
400
|
-
return
|
|
543
|
+
return a;
|
|
401
544
|
};
|
|
402
545
|
}
|
|
403
546
|
/**
|
|
404
547
|
* Framework adapter hook called by ResponsivePlugin during attach().
|
|
405
548
|
* Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
|
|
406
549
|
*/
|
|
407
|
-
parseResponsiveCardElement(
|
|
408
|
-
const t =
|
|
550
|
+
parseResponsiveCardElement(r) {
|
|
551
|
+
const t = r.closest("tbw-grid");
|
|
409
552
|
if (!t) return;
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
return (
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
419
|
-
const
|
|
553
|
+
const e = t.querySelector("tbw-grid-responsive-card");
|
|
554
|
+
if (!e) return;
|
|
555
|
+
const n = q.get(e);
|
|
556
|
+
if (n)
|
|
557
|
+
return (i, s) => {
|
|
558
|
+
const a = document.createElement("div");
|
|
559
|
+
a.className = "vue-responsive-card";
|
|
560
|
+
const d = n({ row: i, rowIndex: s });
|
|
561
|
+
if (d && d.length > 0) {
|
|
562
|
+
const p = u({
|
|
420
563
|
render() {
|
|
421
|
-
return
|
|
564
|
+
return d;
|
|
422
565
|
}
|
|
423
566
|
});
|
|
424
|
-
|
|
567
|
+
p.mount(a), this.mountedViews.push({ app: p, container: a });
|
|
425
568
|
}
|
|
426
|
-
return
|
|
569
|
+
return a;
|
|
427
570
|
};
|
|
428
571
|
}
|
|
429
572
|
// #region Type Defaults Support
|
|
@@ -455,47 +598,47 @@ class fe {
|
|
|
455
598
|
* </template>
|
|
456
599
|
* ```
|
|
457
600
|
*/
|
|
458
|
-
getTypeDefault(
|
|
601
|
+
getTypeDefault(r) {
|
|
459
602
|
if (!this.typeDefaults)
|
|
460
603
|
return;
|
|
461
|
-
const t = this.typeDefaults[
|
|
604
|
+
const t = this.typeDefaults[r];
|
|
462
605
|
if (!t)
|
|
463
606
|
return;
|
|
464
|
-
const
|
|
607
|
+
const e = {
|
|
465
608
|
editorParams: t.editorParams
|
|
466
609
|
};
|
|
467
|
-
return t.renderer && (
|
|
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;
|
|
468
611
|
}
|
|
469
612
|
/**
|
|
470
613
|
* Creates a renderer function from a Vue render function for type defaults.
|
|
471
614
|
* @internal
|
|
472
615
|
*/
|
|
473
|
-
createTypeRenderer(
|
|
616
|
+
createTypeRenderer(r) {
|
|
474
617
|
return (t) => {
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const
|
|
618
|
+
const e = document.createElement("span");
|
|
619
|
+
e.style.display = "contents";
|
|
620
|
+
const n = u({
|
|
478
621
|
render() {
|
|
479
|
-
return
|
|
622
|
+
return r(t);
|
|
480
623
|
}
|
|
481
624
|
});
|
|
482
|
-
return
|
|
625
|
+
return n.mount(e), this.mountedViews.push({ app: n, container: e }), e;
|
|
483
626
|
};
|
|
484
627
|
}
|
|
485
628
|
/**
|
|
486
629
|
* Creates an editor function from a Vue render function for type defaults.
|
|
487
630
|
* @internal
|
|
488
631
|
*/
|
|
489
|
-
createTypeEditor(
|
|
632
|
+
createTypeEditor(r) {
|
|
490
633
|
return (t) => {
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
634
|
+
const e = document.createElement("span");
|
|
635
|
+
e.style.display = "contents";
|
|
636
|
+
const n = u({
|
|
494
637
|
render() {
|
|
495
|
-
return
|
|
638
|
+
return r(t);
|
|
496
639
|
}
|
|
497
640
|
});
|
|
498
|
-
return
|
|
641
|
+
return n.mount(e), this.editorViews.push({ app: n, container: e }), e;
|
|
499
642
|
};
|
|
500
643
|
}
|
|
501
644
|
/**
|
|
@@ -505,16 +648,16 @@ class fe {
|
|
|
505
648
|
* imperative `(container, params) => void` signature expected by the core grid.
|
|
506
649
|
* @internal
|
|
507
650
|
*/
|
|
508
|
-
createFilterPanelRenderer(
|
|
509
|
-
return (t,
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
651
|
+
createFilterPanelRenderer(r) {
|
|
652
|
+
return (t, e) => {
|
|
653
|
+
const n = document.createElement("div");
|
|
654
|
+
n.style.display = "contents";
|
|
655
|
+
const i = u({
|
|
513
656
|
render() {
|
|
514
|
-
return e
|
|
657
|
+
return r(e);
|
|
515
658
|
}
|
|
516
659
|
});
|
|
517
|
-
|
|
660
|
+
i.mount(n), this.mountedViews.push({ app: i, container: n }), t.appendChild(n);
|
|
518
661
|
};
|
|
519
662
|
}
|
|
520
663
|
// #endregion
|
|
@@ -522,15 +665,15 @@ class fe {
|
|
|
522
665
|
* Cleanup all mounted Vue apps.
|
|
523
666
|
*/
|
|
524
667
|
cleanup() {
|
|
525
|
-
for (const { app:
|
|
668
|
+
for (const { app: r, container: t } of this.mountedViews)
|
|
526
669
|
try {
|
|
527
|
-
|
|
670
|
+
r.unmount(), t.remove();
|
|
528
671
|
} catch {
|
|
529
672
|
}
|
|
530
673
|
this.mountedViews = [];
|
|
531
|
-
for (const { app:
|
|
674
|
+
for (const { app: r, container: t } of this.editorViews)
|
|
532
675
|
try {
|
|
533
|
-
|
|
676
|
+
r.unmount(), t.remove();
|
|
534
677
|
} catch {
|
|
535
678
|
}
|
|
536
679
|
this.editorViews = [];
|
|
@@ -540,12 +683,12 @@ class fe {
|
|
|
540
683
|
* Finds the matching entry in mountedViews by container reference
|
|
541
684
|
* and properly destroys the Vue app to prevent memory leaks.
|
|
542
685
|
*/
|
|
543
|
-
unmount(
|
|
686
|
+
unmount(r) {
|
|
544
687
|
for (let t = this.mountedViews.length - 1; t >= 0; t--) {
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
688
|
+
const e = this.mountedViews[t];
|
|
689
|
+
if (e.container === r || r.contains(e.container)) {
|
|
547
690
|
try {
|
|
548
|
-
|
|
691
|
+
e.app.unmount();
|
|
549
692
|
} catch {
|
|
550
693
|
}
|
|
551
694
|
this.mountedViews.splice(t, 1);
|
|
@@ -557,12 +700,12 @@ class fe {
|
|
|
557
700
|
* Called when a cell's content is about to be wiped.
|
|
558
701
|
* Destroys editor Vue apps whose container is inside the cell.
|
|
559
702
|
*/
|
|
560
|
-
releaseCell(
|
|
703
|
+
releaseCell(r) {
|
|
561
704
|
for (let t = this.editorViews.length - 1; t >= 0; t--) {
|
|
562
|
-
const { app:
|
|
563
|
-
if (
|
|
705
|
+
const { app: e, container: n } = this.editorViews[t];
|
|
706
|
+
if (r.contains(n)) {
|
|
564
707
|
try {
|
|
565
|
-
|
|
708
|
+
e.unmount(), n.remove();
|
|
566
709
|
} catch {
|
|
567
710
|
}
|
|
568
711
|
this.editorViews.splice(t, 1);
|
|
@@ -570,7 +713,7 @@ class fe {
|
|
|
570
713
|
}
|
|
571
714
|
}
|
|
572
715
|
}
|
|
573
|
-
const
|
|
716
|
+
const oe = ne, me = /* @__PURE__ */ h({
|
|
574
717
|
__name: "TbwGrid",
|
|
575
718
|
props: {
|
|
576
719
|
/** Row data to display */
|
|
@@ -621,7 +764,7 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
621
764
|
type: [Boolean, String, Object],
|
|
622
765
|
default: void 0
|
|
623
766
|
},
|
|
624
|
-
/** @deprecated Use multiSort instead */
|
|
767
|
+
/** @deprecated Use multiSort instead. Will be removed in v2. */
|
|
625
768
|
sorting: {
|
|
626
769
|
type: [Boolean, String, Object],
|
|
627
770
|
default: void 0
|
|
@@ -636,7 +779,7 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
636
779
|
type: [Boolean, Object],
|
|
637
780
|
default: void 0
|
|
638
781
|
},
|
|
639
|
-
/** @deprecated Use `reorderColumns` instead */
|
|
782
|
+
/** @deprecated Use `reorderColumns` instead. Will be removed in v2. */
|
|
640
783
|
reorder: {
|
|
641
784
|
type: [Boolean, Object],
|
|
642
785
|
default: void 0
|
|
@@ -666,7 +809,7 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
666
809
|
type: [Boolean, Object],
|
|
667
810
|
default: void 0
|
|
668
811
|
},
|
|
669
|
-
/** @deprecated Use `reorderRows` instead */
|
|
812
|
+
/** @deprecated Use `reorderRows` instead. Will be removed in v2. */
|
|
670
813
|
rowReorder: {
|
|
671
814
|
type: [Boolean, Object],
|
|
672
815
|
default: void 0
|
|
@@ -722,16 +865,41 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
722
865
|
default: void 0
|
|
723
866
|
}
|
|
724
867
|
},
|
|
725
|
-
emits: ["cell-
|
|
726
|
-
setup(
|
|
727
|
-
let
|
|
728
|
-
function
|
|
729
|
-
return
|
|
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 }) {
|
|
870
|
+
let e = !1, n = null;
|
|
871
|
+
function i() {
|
|
872
|
+
return e || (n = new oe(), K.registerAdapter(n), e = !0), n;
|
|
730
873
|
}
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
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 = [
|
|
735
903
|
"selection",
|
|
736
904
|
"editing",
|
|
737
905
|
"clipboard",
|
|
@@ -760,115 +928,76 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
760
928
|
"pivot",
|
|
761
929
|
"serverSide"
|
|
762
930
|
];
|
|
763
|
-
function
|
|
764
|
-
const
|
|
765
|
-
for (const
|
|
766
|
-
const b =
|
|
931
|
+
function N() {
|
|
932
|
+
const l = [];
|
|
933
|
+
for (const m of w) {
|
|
934
|
+
const b = s[m];
|
|
767
935
|
if (b !== void 0) {
|
|
768
|
-
const
|
|
769
|
-
|
|
936
|
+
const E = Y(m, b);
|
|
937
|
+
E && l.push(E);
|
|
770
938
|
}
|
|
771
939
|
}
|
|
772
|
-
return
|
|
940
|
+
return l;
|
|
773
941
|
}
|
|
774
|
-
const
|
|
775
|
-
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;
|
|
776
944
|
return {
|
|
777
|
-
...
|
|
778
|
-
...
|
|
779
|
-
...
|
|
780
|
-
...
|
|
945
|
+
...l,
|
|
946
|
+
...s.columns ? { columns: s.columns } : {},
|
|
947
|
+
...E.length > 0 ? { plugins: E } : {},
|
|
948
|
+
...O ? { icons: O } : {}
|
|
781
949
|
};
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
l
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
l
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
l(
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
function x(o) {
|
|
799
|
-
l("row-toggle", o);
|
|
800
|
-
}
|
|
801
|
-
function $(o) {
|
|
802
|
-
l("sort-change", o);
|
|
803
|
-
}
|
|
804
|
-
function z(o) {
|
|
805
|
-
l("ready", o);
|
|
806
|
-
}
|
|
807
|
-
function Z(o, p) {
|
|
808
|
-
const b = Object.getPrototypeOf(o), m = Object.getOwnPropertyDescriptor(b, "gridConfig");
|
|
809
|
-
if (!m?.set || !m?.get) return;
|
|
810
|
-
const j = m.set, te = m.get;
|
|
811
|
-
Object.defineProperty(o, "gridConfig", {
|
|
812
|
-
get() {
|
|
813
|
-
return te.call(this);
|
|
814
|
-
},
|
|
815
|
-
set(S) {
|
|
816
|
-
S && p ? j.call(this, p.processGridConfig(S)) : j.call(this, S);
|
|
817
|
-
},
|
|
818
|
-
configurable: !0
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
function ee(o) {
|
|
822
|
-
delete o.gridConfig;
|
|
823
|
-
}
|
|
824
|
-
return O(() => {
|
|
825
|
-
const o = a.value;
|
|
826
|
-
if (!o) return;
|
|
827
|
-
const p = s();
|
|
828
|
-
o.__frameworkAdapter = p, p.setTypeDefaults(c ?? null), Z(o, p), o.addEventListener("cell-commit", M), o.addEventListener("row-commit", N), o.addEventListener("cell-click", A), o.addEventListener("cell-dblclick", W), o.addEventListener("selection-change", I), o.addEventListener("row-toggle", x), o.addEventListener("sort-change", $), o.addEventListener("ready", z), d.rows.length > 0 && (o.rows = d.rows), V.value && (o.gridConfig = V.value), d.fitMode && (o.fitMode = d.fitMode);
|
|
829
|
-
}), q(() => {
|
|
830
|
-
const o = a.value;
|
|
831
|
-
o && (ee(o), o.removeEventListener("cell-commit", M), o.removeEventListener("row-commit", N), o.removeEventListener("cell-click", A), o.removeEventListener("cell-dblclick", W), o.removeEventListener("selection-change", I), o.removeEventListener("row-toggle", x), o.removeEventListener("sort-change", $), o.removeEventListener("ready", z));
|
|
832
|
-
}), D(
|
|
833
|
-
() => d.rows,
|
|
834
|
-
(o) => {
|
|
835
|
-
a.value && (a.value.rows = o);
|
|
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(
|
|
962
|
+
() => s.rows,
|
|
963
|
+
(l) => {
|
|
964
|
+
d.value && (d.value.rows = l);
|
|
836
965
|
},
|
|
837
966
|
{ deep: !0 }
|
|
838
|
-
),
|
|
839
|
-
|
|
840
|
-
(
|
|
841
|
-
|
|
967
|
+
), B(
|
|
968
|
+
S,
|
|
969
|
+
(l) => {
|
|
970
|
+
d.value && l && (d.value.gridConfig = l);
|
|
842
971
|
},
|
|
843
972
|
{ deep: !0 }
|
|
844
|
-
),
|
|
845
|
-
() =>
|
|
846
|
-
(
|
|
847
|
-
|
|
973
|
+
), B(
|
|
974
|
+
() => s.fitMode,
|
|
975
|
+
(l) => {
|
|
976
|
+
d.value && l && (d.value.fitMode = l);
|
|
848
977
|
}
|
|
849
|
-
),
|
|
850
|
-
() =>
|
|
851
|
-
(
|
|
852
|
-
|
|
978
|
+
), B(
|
|
979
|
+
() => p,
|
|
980
|
+
(l) => {
|
|
981
|
+
i().setTypeDefaults(l ?? null);
|
|
853
982
|
},
|
|
854
983
|
{ deep: !0 }
|
|
855
|
-
),
|
|
984
|
+
), r({
|
|
856
985
|
/** The underlying grid element */
|
|
857
|
-
gridElement:
|
|
986
|
+
gridElement: d,
|
|
858
987
|
/** Force a layout recalculation */
|
|
859
|
-
forceLayout: () =>
|
|
988
|
+
forceLayout: () => d.value?.forceLayout(),
|
|
860
989
|
/** Get current grid configuration */
|
|
861
|
-
getConfig: () =>
|
|
990
|
+
getConfig: () => d.value?.getConfig(),
|
|
862
991
|
/** Wait for grid to be ready */
|
|
863
|
-
ready: () =>
|
|
864
|
-
}), (
|
|
992
|
+
ready: () => d.value?.ready()
|
|
993
|
+
}), (l, m) => (j(), P("tbw-grid", {
|
|
865
994
|
ref_key: "gridRef",
|
|
866
|
-
ref:
|
|
995
|
+
ref: d
|
|
867
996
|
}, [
|
|
868
|
-
|
|
997
|
+
W(l.$slots, "default")
|
|
869
998
|
], 512));
|
|
870
999
|
}
|
|
871
|
-
}),
|
|
1000
|
+
}), ie = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"], ge = /* @__PURE__ */ h({
|
|
872
1001
|
__name: "TbwGridColumn",
|
|
873
1002
|
props: {
|
|
874
1003
|
field: {},
|
|
@@ -883,91 +1012,91 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
883
1012
|
align: {},
|
|
884
1013
|
hidden: { type: Boolean }
|
|
885
1014
|
},
|
|
886
|
-
setup(
|
|
887
|
-
const
|
|
888
|
-
return
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
if (!
|
|
895
|
-
const
|
|
896
|
-
value:
|
|
897
|
-
row:
|
|
898
|
-
column:
|
|
1015
|
+
setup(o) {
|
|
1016
|
+
const r = G(), t = _(null);
|
|
1017
|
+
return D(() => {
|
|
1018
|
+
const e = t.value;
|
|
1019
|
+
if (!e) return;
|
|
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({
|
|
1025
|
+
value: s.value,
|
|
1026
|
+
row: s.row,
|
|
1027
|
+
column: s.column
|
|
899
1028
|
});
|
|
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:
|
|
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({
|
|
1034
|
+
value: s.value,
|
|
1035
|
+
row: s.row,
|
|
1036
|
+
column: s.column,
|
|
1037
|
+
field: s.field,
|
|
1038
|
+
rowId: s.rowId ?? "",
|
|
1039
|
+
commit: s.commit,
|
|
1040
|
+
cancel: s.cancel,
|
|
1041
|
+
updateRow: s.updateRow,
|
|
1042
|
+
onValueChange: s.onValueChange
|
|
914
1043
|
});
|
|
915
|
-
return
|
|
1044
|
+
return T("div", { style: "display: contents" }, c);
|
|
916
1045
|
});
|
|
917
|
-
}), (
|
|
1046
|
+
}), (e, n) => (j(), P("tbw-grid-column", {
|
|
918
1047
|
ref_key: "columnRef",
|
|
919
1048
|
ref: t,
|
|
920
|
-
field:
|
|
921
|
-
header:
|
|
922
|
-
width:
|
|
923
|
-
"min-width":
|
|
924
|
-
"max-width":
|
|
925
|
-
sortable:
|
|
926
|
-
resizable:
|
|
927
|
-
editable:
|
|
928
|
-
type:
|
|
929
|
-
align:
|
|
930
|
-
hidden:
|
|
931
|
-
}, null, 8,
|
|
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));
|
|
932
1061
|
}
|
|
933
|
-
}),
|
|
1062
|
+
}), se = ["show-expand-column", "animation"], he = /* @__PURE__ */ h({
|
|
934
1063
|
__name: "TbwGridDetailPanel",
|
|
935
1064
|
props: {
|
|
936
1065
|
showExpandColumn: { type: Boolean, default: !0 },
|
|
937
1066
|
animation: { type: [String, Boolean], default: "slide" }
|
|
938
1067
|
},
|
|
939
|
-
setup(
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
const
|
|
943
|
-
!
|
|
944
|
-
}), (
|
|
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", {
|
|
945
1074
|
ref_key: "detailRef",
|
|
946
|
-
ref:
|
|
947
|
-
"show-expand-column":
|
|
948
|
-
animation:
|
|
949
|
-
}, null, 8,
|
|
1075
|
+
ref: r,
|
|
1076
|
+
"show-expand-column": o.showExpandColumn,
|
|
1077
|
+
animation: o.animation
|
|
1078
|
+
}, null, 8, se));
|
|
950
1079
|
}
|
|
951
|
-
}),
|
|
1080
|
+
}), ye = /* @__PURE__ */ h({
|
|
952
1081
|
__name: "TbwGridResponsiveCard",
|
|
953
|
-
setup(
|
|
954
|
-
const
|
|
955
|
-
return
|
|
956
|
-
const
|
|
957
|
-
!
|
|
958
|
-
}), (
|
|
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", {
|
|
959
1088
|
ref_key: "cardRef",
|
|
960
|
-
ref:
|
|
1089
|
+
ref: r
|
|
961
1090
|
}, null, 512));
|
|
962
1091
|
}
|
|
963
|
-
}),
|
|
1092
|
+
}), ve = /* @__PURE__ */ h({
|
|
964
1093
|
__name: "TbwGridToolButtons",
|
|
965
|
-
setup(
|
|
966
|
-
return (
|
|
967
|
-
|
|
1094
|
+
setup(o) {
|
|
1095
|
+
return (r, t) => (j(), P("tbw-grid-tool-buttons", null, [
|
|
1096
|
+
W(r.$slots, "default")
|
|
968
1097
|
]));
|
|
969
1098
|
}
|
|
970
|
-
}),
|
|
1099
|
+
}), de = /* @__PURE__ */ new WeakMap(), ae = ["id", "label", "icon", "position", "width"], we = /* @__PURE__ */ h({
|
|
971
1100
|
__name: "TbwGridToolPanel",
|
|
972
1101
|
props: {
|
|
973
1102
|
id: {},
|
|
@@ -976,35 +1105,42 @@ const pe = fe, Re = /* @__PURE__ */ y({
|
|
|
976
1105
|
position: { default: "right" },
|
|
977
1106
|
width: { default: "250px" }
|
|
978
1107
|
},
|
|
979
|
-
setup(
|
|
980
|
-
const
|
|
981
|
-
return
|
|
982
|
-
const
|
|
983
|
-
!
|
|
984
|
-
}), (
|
|
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", {
|
|
985
1114
|
ref_key: "panelRef",
|
|
986
|
-
ref:
|
|
987
|
-
id:
|
|
988
|
-
label:
|
|
989
|
-
icon:
|
|
990
|
-
position:
|
|
991
|
-
width:
|
|
992
|
-
}, 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));
|
|
993
1122
|
}
|
|
994
1123
|
});
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
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));
|
|
1132
|
+
let n = null;
|
|
1133
|
+
D(() => {
|
|
1134
|
+
const i = e.value;
|
|
1135
|
+
i && (n = i.on(
|
|
1136
|
+
o,
|
|
1137
|
+
(s, a) => r(a)
|
|
1138
|
+
));
|
|
1139
|
+
}), M(() => {
|
|
1140
|
+
n?.();
|
|
1005
1141
|
});
|
|
1006
1142
|
}
|
|
1007
|
-
const
|
|
1143
|
+
const Re = h({
|
|
1008
1144
|
name: "GridProvider",
|
|
1009
1145
|
props: {
|
|
1010
1146
|
/**
|
|
@@ -1022,39 +1158,47 @@ const De = y({
|
|
|
1022
1158
|
default: void 0
|
|
1023
1159
|
}
|
|
1024
1160
|
},
|
|
1025
|
-
setup(
|
|
1161
|
+
setup(o, { slots: r }) {
|
|
1026
1162
|
return () => {
|
|
1027
|
-
let t =
|
|
1028
|
-
|
|
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;
|
|
1029
1173
|
};
|
|
1030
1174
|
}
|
|
1031
1175
|
});
|
|
1032
1176
|
export {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
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
|
|
1059
1203
|
};
|
|
1060
1204
|
//# sourceMappingURL=index.js.map
|