@toolbox-web/grid-vue 0.1.0 → 0.2.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.js +336 -247
- package/index.js.map +1 -1
- package/lib/TbwGrid.vue.d.ts +46 -44
- package/lib/TbwGrid.vue.d.ts.map +1 -1
- package/lib/feature-props.d.ts +5 -1
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/grid-provider.d.ts +1 -1
- package/lib/vue-grid-adapter.d.ts +49 -1
- package/lib/vue-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { DataGridElement as
|
|
3
|
-
import { c as
|
|
4
|
-
import { a as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return
|
|
1
|
+
import { defineComponent as p, provide as G, inject as O, ref as y, createApp as g, computed as Y, onMounted as b, onBeforeUnmount as $, watch as B, createElementBlock as w, openBlock as E, renderSlot as I, useSlots as _, h } from "vue";
|
|
2
|
+
import { DataGridElement as K } from "@toolbox-web/grid";
|
|
3
|
+
import { c as J } from "./chunks/feature-registry-BgEOysSJ.js";
|
|
4
|
+
import { a as Te, g as Be, b as Oe, i as _e, r as je } from "./chunks/feature-registry-BgEOysSJ.js";
|
|
5
|
+
const z = /* @__PURE__ */ Symbol("grid-icons");
|
|
6
|
+
function Q() {
|
|
7
|
+
return O(z, void 0);
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const X = p({
|
|
10
10
|
name: "GridIconProvider",
|
|
11
11
|
props: {
|
|
12
12
|
/**
|
|
@@ -17,17 +17,17 @@ const Q = f({
|
|
|
17
17
|
required: !0
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
return
|
|
20
|
+
setup(n, { slots: t }) {
|
|
21
|
+
return G(z, n.icons), () => t.default?.();
|
|
22
22
|
}
|
|
23
|
-
}),
|
|
24
|
-
function
|
|
25
|
-
return
|
|
23
|
+
}), N = /* @__PURE__ */ Symbol("grid-type-defaults");
|
|
24
|
+
function q() {
|
|
25
|
+
return O(N, void 0);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function fe(n) {
|
|
28
|
+
return q()?.[n];
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const Z = p({
|
|
31
31
|
name: "GridTypeProvider",
|
|
32
32
|
props: {
|
|
33
33
|
/**
|
|
@@ -38,107 +38,117 @@ const X = f({
|
|
|
38
38
|
required: !0
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
setup(
|
|
42
|
-
return
|
|
41
|
+
setup(n, { slots: t }) {
|
|
42
|
+
return G(N, n.defaults), () => t.default?.();
|
|
43
43
|
}
|
|
44
44
|
}), L = /* @__PURE__ */ Symbol("tbw-grid");
|
|
45
|
-
function
|
|
46
|
-
const
|
|
45
|
+
function pe() {
|
|
46
|
+
const n = O(L, y(null));
|
|
47
47
|
return {
|
|
48
|
-
gridElement:
|
|
48
|
+
gridElement: n,
|
|
49
49
|
forceLayout: async () => {
|
|
50
|
-
await
|
|
50
|
+
await n.value?.forceLayout();
|
|
51
51
|
},
|
|
52
|
-
getConfig: () =>
|
|
52
|
+
getConfig: () => n.value?.getConfig(),
|
|
53
53
|
ready: async () => {
|
|
54
|
-
await
|
|
54
|
+
await n.value?.ready();
|
|
55
55
|
},
|
|
56
|
-
getPlugin: (
|
|
56
|
+
getPlugin: (t) => n.value?.getPlugin(t)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
if (r.renderer =
|
|
63
|
-
const i =
|
|
64
|
-
i.renderer =
|
|
59
|
+
const U = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map();
|
|
60
|
+
function ee(n, t) {
|
|
61
|
+
const e = n.getAttribute("field"), r = m.get(n) ?? {};
|
|
62
|
+
if (r.renderer = t, m.set(n, r), e) {
|
|
63
|
+
const i = v.get(e) ?? {};
|
|
64
|
+
i.renderer = t, v.set(e, i);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
if (r.editor =
|
|
70
|
-
const i =
|
|
71
|
-
i.editor =
|
|
67
|
+
function te(n, t) {
|
|
68
|
+
const e = n.getAttribute("field"), r = m.get(n) ?? {};
|
|
69
|
+
if (r.editor = t, m.set(n, r), e) {
|
|
70
|
+
const i = v.get(e) ?? {};
|
|
71
|
+
i.editor = t, v.set(e, i);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
let
|
|
76
|
-
if (!
|
|
77
|
-
const
|
|
78
|
-
|
|
74
|
+
function ne(n) {
|
|
75
|
+
let t = m.get(n)?.renderer;
|
|
76
|
+
if (!t) {
|
|
77
|
+
const e = n.getAttribute("field");
|
|
78
|
+
e && (t = v.get(e)?.renderer);
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return t;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
let
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
|
|
82
|
+
function re(n) {
|
|
83
|
+
let t = m.get(n)?.editor;
|
|
84
|
+
if (!t) {
|
|
85
|
+
const e = n.getAttribute("field");
|
|
86
|
+
e && (t = v.get(e)?.editor);
|
|
87
87
|
}
|
|
88
|
-
return
|
|
88
|
+
return t;
|
|
89
89
|
}
|
|
90
90
|
class oe {
|
|
91
91
|
mountedViews = [];
|
|
92
|
+
typeDefaults = null;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the type defaults map for this adapter.
|
|
95
|
+
* Called by TbwGrid when it receives type defaults from context.
|
|
96
|
+
*
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
setTypeDefaults(t) {
|
|
100
|
+
this.typeDefaults = t;
|
|
101
|
+
}
|
|
92
102
|
/**
|
|
93
103
|
* Determines if this adapter can handle the given element.
|
|
94
104
|
* Checks if a renderer or editor is registered for this element.
|
|
95
105
|
*/
|
|
96
|
-
canHandle(
|
|
97
|
-
const
|
|
98
|
-
let r =
|
|
99
|
-
if (!r &&
|
|
100
|
-
const l =
|
|
101
|
-
l && (l.renderer || l.editor) && (r = l,
|
|
106
|
+
canHandle(t) {
|
|
107
|
+
const e = t.getAttribute("field");
|
|
108
|
+
let r = m.get(t);
|
|
109
|
+
if (!r && e) {
|
|
110
|
+
const l = v.get(e);
|
|
111
|
+
l && (l.renderer || l.editor) && (r = l, m.set(t, r));
|
|
102
112
|
}
|
|
103
|
-
const i = r?.renderer !== void 0,
|
|
104
|
-
return r !== void 0 && (i ||
|
|
113
|
+
const i = r?.renderer !== void 0, a = r?.editor !== void 0;
|
|
114
|
+
return r !== void 0 && (i || a);
|
|
105
115
|
}
|
|
106
116
|
/**
|
|
107
117
|
* Creates a view renderer function that renders a Vue component
|
|
108
118
|
* and returns its container DOM element.
|
|
109
119
|
*/
|
|
110
|
-
createRenderer(
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
120
|
+
createRenderer(t) {
|
|
121
|
+
const e = ne(t);
|
|
122
|
+
if (!e)
|
|
113
123
|
return;
|
|
114
124
|
const r = /* @__PURE__ */ new WeakMap();
|
|
115
125
|
return (i) => {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
return
|
|
126
|
+
const a = i.cellEl;
|
|
127
|
+
if (a) {
|
|
128
|
+
const s = r.get(a);
|
|
129
|
+
if (s)
|
|
130
|
+
return s.update(i), s.container;
|
|
121
131
|
const c = document.createElement("div");
|
|
122
132
|
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
123
133
|
let u = i;
|
|
124
|
-
const
|
|
134
|
+
const R = g({
|
|
125
135
|
render() {
|
|
126
|
-
return
|
|
136
|
+
return e(u);
|
|
127
137
|
}
|
|
128
138
|
});
|
|
129
|
-
return
|
|
130
|
-
app:
|
|
139
|
+
return R.mount(c), r.set(a, {
|
|
140
|
+
app: R,
|
|
131
141
|
container: c,
|
|
132
|
-
update: (
|
|
133
|
-
u =
|
|
142
|
+
update: (j) => {
|
|
143
|
+
u = j, R._instance?.update();
|
|
134
144
|
}
|
|
135
145
|
}), c;
|
|
136
146
|
}
|
|
137
147
|
const l = document.createElement("div");
|
|
138
148
|
l.className = "vue-cell-renderer", l.style.display = "contents";
|
|
139
|
-
const d =
|
|
149
|
+
const d = g({
|
|
140
150
|
render() {
|
|
141
|
-
return
|
|
151
|
+
return e(i);
|
|
142
152
|
}
|
|
143
153
|
});
|
|
144
154
|
return d.mount(l), this.mountedViews.push({ app: d, container: l }), l;
|
|
@@ -148,37 +158,37 @@ class oe {
|
|
|
148
158
|
* Creates an editor spec that renders a Vue component for cell editing.
|
|
149
159
|
* Returns a function that creates the editor DOM element.
|
|
150
160
|
*/
|
|
151
|
-
createEditor(
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
161
|
+
createEditor(t) {
|
|
162
|
+
const e = re(t);
|
|
163
|
+
if (e)
|
|
154
164
|
return (r) => {
|
|
155
165
|
const i = document.createElement("div");
|
|
156
166
|
i.className = "vue-cell-editor", i.style.display = "contents";
|
|
157
|
-
const
|
|
167
|
+
const a = g({
|
|
158
168
|
render() {
|
|
159
|
-
return
|
|
169
|
+
return e(r);
|
|
160
170
|
}
|
|
161
171
|
});
|
|
162
|
-
return
|
|
172
|
+
return a.mount(i), this.mountedViews.push({ app: a, container: i }), i;
|
|
163
173
|
};
|
|
164
174
|
}
|
|
165
175
|
/**
|
|
166
176
|
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
167
177
|
* Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
|
|
168
178
|
*/
|
|
169
|
-
parseDetailElement(
|
|
170
|
-
const
|
|
171
|
-
if (!
|
|
172
|
-
const r =
|
|
179
|
+
parseDetailElement(t) {
|
|
180
|
+
const e = t.closest("tbw-grid");
|
|
181
|
+
if (!e) return;
|
|
182
|
+
const r = e.querySelector("tbw-grid-detail");
|
|
173
183
|
if (!r) return;
|
|
174
|
-
const i =
|
|
184
|
+
const i = U.get(r);
|
|
175
185
|
if (i)
|
|
176
|
-
return (
|
|
186
|
+
return (a, l) => {
|
|
177
187
|
const d = document.createElement("div");
|
|
178
188
|
d.className = "vue-detail-panel";
|
|
179
|
-
const c = i({ row:
|
|
189
|
+
const c = i({ row: a, rowIndex: l });
|
|
180
190
|
if (c && c.length > 0) {
|
|
181
|
-
const u =
|
|
191
|
+
const u = g({
|
|
182
192
|
render() {
|
|
183
193
|
return c;
|
|
184
194
|
}
|
|
@@ -192,19 +202,19 @@ class oe {
|
|
|
192
202
|
* Framework adapter hook called by ResponsivePlugin during attach().
|
|
193
203
|
* Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
|
|
194
204
|
*/
|
|
195
|
-
parseResponsiveCardElement(
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
const r =
|
|
205
|
+
parseResponsiveCardElement(t) {
|
|
206
|
+
const e = t.closest("tbw-grid");
|
|
207
|
+
if (!e) return;
|
|
208
|
+
const r = e.querySelector("tbw-grid-responsive-card");
|
|
199
209
|
if (!r) return;
|
|
200
|
-
const i =
|
|
210
|
+
const i = H.get(r);
|
|
201
211
|
if (i)
|
|
202
|
-
return (
|
|
212
|
+
return (a, l) => {
|
|
203
213
|
const d = document.createElement("div");
|
|
204
214
|
d.className = "vue-responsive-card";
|
|
205
|
-
const c = i({ row:
|
|
215
|
+
const c = i({ row: a, rowIndex: l });
|
|
206
216
|
if (c && c.length > 0) {
|
|
207
|
-
const u =
|
|
217
|
+
const u = g({
|
|
208
218
|
render() {
|
|
209
219
|
return c;
|
|
210
220
|
}
|
|
@@ -214,19 +224,92 @@ class oe {
|
|
|
214
224
|
return d;
|
|
215
225
|
};
|
|
216
226
|
}
|
|
227
|
+
// #region Type Defaults Support
|
|
228
|
+
/**
|
|
229
|
+
* Gets type-level defaults from the type defaults map.
|
|
230
|
+
*
|
|
231
|
+
* This enables application-wide type defaults configured via GridTypeProvider.
|
|
232
|
+
* The returned TypeDefault contains renderer/editor functions that render
|
|
233
|
+
* Vue components into the grid's cells.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```vue
|
|
237
|
+
* <script setup>
|
|
238
|
+
* import { GridTypeProvider } from '@toolbox-web/grid-vue';
|
|
239
|
+
* import { h } from 'vue';
|
|
240
|
+
* import CountryBadge from './CountryBadge.vue';
|
|
241
|
+
*
|
|
242
|
+
* const typeDefaults = {
|
|
243
|
+
* country: {
|
|
244
|
+
* renderer: (ctx) => h(CountryBadge, { code: ctx.value }),
|
|
245
|
+
* },
|
|
246
|
+
* };
|
|
247
|
+
* <\/script>
|
|
248
|
+
*
|
|
249
|
+
* <template>
|
|
250
|
+
* <GridTypeProvider :defaults="typeDefaults">
|
|
251
|
+
* <App />
|
|
252
|
+
* </GridTypeProvider>
|
|
253
|
+
* </template>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
getTypeDefault(t) {
|
|
257
|
+
if (!this.typeDefaults)
|
|
258
|
+
return;
|
|
259
|
+
const e = this.typeDefaults[t];
|
|
260
|
+
if (!e)
|
|
261
|
+
return;
|
|
262
|
+
const r = {
|
|
263
|
+
editorParams: e.editorParams
|
|
264
|
+
};
|
|
265
|
+
return e.renderer && (r.renderer = this.createTypeRenderer(e.renderer)), e.editor && (r.editor = this.createTypeEditor(e.editor)), r;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Creates a renderer function from a Vue render function for type defaults.
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
createTypeRenderer(t) {
|
|
272
|
+
return (e) => {
|
|
273
|
+
const r = document.createElement("span");
|
|
274
|
+
r.style.display = "contents";
|
|
275
|
+
const i = g({
|
|
276
|
+
render() {
|
|
277
|
+
return t(e);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
return i.mount(r), this.mountedViews.push({ app: i, container: r }), r;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Creates an editor function from a Vue render function for type defaults.
|
|
285
|
+
* @internal
|
|
286
|
+
*/
|
|
287
|
+
createTypeEditor(t) {
|
|
288
|
+
return (e) => {
|
|
289
|
+
const r = document.createElement("span");
|
|
290
|
+
r.style.display = "contents";
|
|
291
|
+
const i = g({
|
|
292
|
+
render() {
|
|
293
|
+
return t(e);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
return i.mount(r), this.mountedViews.push({ app: i, container: r }), r;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
// #endregion
|
|
217
300
|
/**
|
|
218
301
|
* Cleanup all mounted Vue apps.
|
|
219
302
|
*/
|
|
220
303
|
cleanup() {
|
|
221
|
-
for (const { app:
|
|
304
|
+
for (const { app: t, container: e } of this.mountedViews)
|
|
222
305
|
try {
|
|
223
|
-
|
|
306
|
+
t.unmount(), e.remove();
|
|
224
307
|
} catch {
|
|
225
308
|
}
|
|
226
309
|
this.mountedViews = [];
|
|
227
310
|
}
|
|
228
311
|
}
|
|
229
|
-
const
|
|
312
|
+
const me = /* @__PURE__ */ p({
|
|
230
313
|
__name: "TbwGrid",
|
|
231
314
|
props: {
|
|
232
315
|
/** Row data to display */
|
|
@@ -369,15 +452,15 @@ const ge = /* @__PURE__ */ f({
|
|
|
369
452
|
}
|
|
370
453
|
},
|
|
371
454
|
emits: ["cell-commit", "row-commit", "cell-click", "cell-dblclick", "selection-change", "row-toggle", "sort-change", "ready"],
|
|
372
|
-
setup(
|
|
455
|
+
setup(n, { expose: t, emit: e }) {
|
|
373
456
|
let r = !1, i = null;
|
|
374
|
-
function
|
|
375
|
-
return r || (i = new oe(),
|
|
457
|
+
function a() {
|
|
458
|
+
return r || (i = new oe(), K.registerAdapter(i), r = !0), i;
|
|
376
459
|
}
|
|
377
|
-
|
|
378
|
-
const l =
|
|
379
|
-
|
|
380
|
-
const c =
|
|
460
|
+
a();
|
|
461
|
+
const l = n, d = e, s = y(null);
|
|
462
|
+
G(L, s);
|
|
463
|
+
const c = q(), u = Q(), R = [
|
|
381
464
|
"selection",
|
|
382
465
|
"editing",
|
|
383
466
|
"clipboard",
|
|
@@ -402,92 +485,98 @@ const ge = /* @__PURE__ */ f({
|
|
|
402
485
|
"pivot",
|
|
403
486
|
"serverSide"
|
|
404
487
|
];
|
|
405
|
-
function
|
|
406
|
-
const
|
|
407
|
-
for (const
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const C =
|
|
411
|
-
C &&
|
|
488
|
+
function j() {
|
|
489
|
+
const o = [];
|
|
490
|
+
for (const f of R) {
|
|
491
|
+
const T = l[f];
|
|
492
|
+
if (T !== void 0) {
|
|
493
|
+
const C = J(f, T);
|
|
494
|
+
C && o.push(C);
|
|
412
495
|
}
|
|
413
496
|
}
|
|
414
|
-
return
|
|
497
|
+
return o;
|
|
415
498
|
}
|
|
416
|
-
const
|
|
417
|
-
const
|
|
499
|
+
const D = Y(() => {
|
|
500
|
+
const o = l.gridConfig ?? {}, f = j(), T = o.plugins ?? [], C = [...f, ...T], W = u ? { ...o.icons, ...u } : o.icons;
|
|
418
501
|
return {
|
|
419
|
-
...
|
|
502
|
+
...o,
|
|
420
503
|
...l.columns ? { columns: l.columns } : {},
|
|
421
504
|
...C.length > 0 ? { plugins: C } : {},
|
|
422
|
-
...
|
|
505
|
+
...W ? { icons: W } : {}
|
|
423
506
|
};
|
|
424
507
|
});
|
|
425
|
-
function S(
|
|
426
|
-
d("cell-commit",
|
|
508
|
+
function S(o) {
|
|
509
|
+
d("cell-commit", o);
|
|
427
510
|
}
|
|
428
|
-
function k(
|
|
429
|
-
d("row-commit",
|
|
511
|
+
function k(o) {
|
|
512
|
+
d("row-commit", o);
|
|
430
513
|
}
|
|
431
|
-
function P(
|
|
432
|
-
d("cell-click",
|
|
514
|
+
function P(o) {
|
|
515
|
+
d("cell-click", o);
|
|
433
516
|
}
|
|
434
|
-
function x(
|
|
435
|
-
d("cell-dblclick",
|
|
517
|
+
function x(o) {
|
|
518
|
+
d("cell-dblclick", o);
|
|
436
519
|
}
|
|
437
|
-
function
|
|
438
|
-
d("selection-change",
|
|
520
|
+
function F(o) {
|
|
521
|
+
d("selection-change", o);
|
|
439
522
|
}
|
|
440
|
-
function
|
|
441
|
-
d("row-toggle",
|
|
523
|
+
function A(o) {
|
|
524
|
+
d("row-toggle", o);
|
|
442
525
|
}
|
|
443
|
-
function
|
|
444
|
-
d("sort-change",
|
|
526
|
+
function M(o) {
|
|
527
|
+
d("sort-change", o);
|
|
445
528
|
}
|
|
446
|
-
function
|
|
447
|
-
d("ready",
|
|
529
|
+
function V(o) {
|
|
530
|
+
d("ready", o);
|
|
448
531
|
}
|
|
449
532
|
return b(() => {
|
|
450
|
-
const
|
|
451
|
-
if (!
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
}),
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
}),
|
|
533
|
+
const o = s.value;
|
|
534
|
+
if (!o) return;
|
|
535
|
+
const f = a();
|
|
536
|
+
o.__frameworkAdapter = f, f.setTypeDefaults(c ?? null), o.addEventListener("cell-commit", S), o.addEventListener("row-commit", k), o.addEventListener("cell-click", P), o.addEventListener("cell-dblclick", x), o.addEventListener("selection-change", F), o.addEventListener("row-toggle", A), o.addEventListener("sort-change", M), o.addEventListener("ready", V), l.rows.length > 0 && (o.rows = l.rows), D.value && (o.gridConfig = D.value), l.fitMode && (o.fitMode = l.fitMode);
|
|
537
|
+
}), $(() => {
|
|
538
|
+
const o = s.value;
|
|
539
|
+
o && (o.removeEventListener("cell-commit", S), o.removeEventListener("row-commit", k), o.removeEventListener("cell-click", P), o.removeEventListener("cell-dblclick", x), o.removeEventListener("selection-change", F), o.removeEventListener("row-toggle", A), o.removeEventListener("sort-change", M), o.removeEventListener("ready", V));
|
|
540
|
+
}), B(
|
|
458
541
|
() => l.rows,
|
|
459
|
-
(
|
|
460
|
-
|
|
542
|
+
(o) => {
|
|
543
|
+
s.value && (s.value.rows = o);
|
|
461
544
|
},
|
|
462
545
|
{ deep: !0 }
|
|
463
|
-
),
|
|
464
|
-
|
|
465
|
-
(
|
|
466
|
-
|
|
546
|
+
), B(
|
|
547
|
+
D,
|
|
548
|
+
(o) => {
|
|
549
|
+
s.value && o && (s.value.gridConfig = o);
|
|
467
550
|
},
|
|
468
551
|
{ deep: !0 }
|
|
469
|
-
),
|
|
552
|
+
), B(
|
|
470
553
|
() => l.fitMode,
|
|
471
|
-
(
|
|
472
|
-
|
|
554
|
+
(o) => {
|
|
555
|
+
s.value && o && (s.value.fitMode = o);
|
|
473
556
|
}
|
|
474
|
-
),
|
|
557
|
+
), B(
|
|
558
|
+
() => c,
|
|
559
|
+
(o) => {
|
|
560
|
+
a().setTypeDefaults(o ?? null);
|
|
561
|
+
},
|
|
562
|
+
{ deep: !0 }
|
|
563
|
+
), t({
|
|
475
564
|
/** The underlying grid element */
|
|
476
|
-
gridElement:
|
|
565
|
+
gridElement: s,
|
|
477
566
|
/** Force a layout recalculation */
|
|
478
|
-
forceLayout: () =>
|
|
567
|
+
forceLayout: () => s.value?.forceLayout(),
|
|
479
568
|
/** Get current grid configuration */
|
|
480
|
-
getConfig: () =>
|
|
569
|
+
getConfig: () => s.value?.getConfig(),
|
|
481
570
|
/** Wait for grid to be ready */
|
|
482
|
-
ready: () =>
|
|
483
|
-
}), (
|
|
571
|
+
ready: () => s.value?.ready()
|
|
572
|
+
}), (o, f) => (E(), w("tbw-grid", {
|
|
484
573
|
ref_key: "gridRef",
|
|
485
|
-
ref:
|
|
574
|
+
ref: s
|
|
486
575
|
}, [
|
|
487
|
-
|
|
576
|
+
I(o.$slots, "default")
|
|
488
577
|
], 512));
|
|
489
578
|
}
|
|
490
|
-
}),
|
|
579
|
+
}), ie = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"], ge = /* @__PURE__ */ p({
|
|
491
580
|
__name: "TbwGridColumn",
|
|
492
581
|
props: {
|
|
493
582
|
field: {},
|
|
@@ -502,87 +591,87 @@ const ge = /* @__PURE__ */ f({
|
|
|
502
591
|
align: {},
|
|
503
592
|
hidden: { type: Boolean }
|
|
504
593
|
},
|
|
505
|
-
setup(
|
|
506
|
-
const
|
|
594
|
+
setup(n) {
|
|
595
|
+
const t = _(), e = y(null);
|
|
507
596
|
return b(() => {
|
|
508
|
-
const r =
|
|
597
|
+
const r = e.value;
|
|
509
598
|
if (!r) return;
|
|
510
|
-
const i = !!
|
|
511
|
-
i &&
|
|
512
|
-
const d =
|
|
513
|
-
if (!d) return
|
|
514
|
-
const
|
|
599
|
+
const i = !!t.cell, a = !!t.editor;
|
|
600
|
+
i && ee(r, (l) => {
|
|
601
|
+
const d = t.cell;
|
|
602
|
+
if (!d) return h("span");
|
|
603
|
+
const s = d({
|
|
515
604
|
value: l.value,
|
|
516
605
|
row: l.row,
|
|
517
606
|
column: l.column
|
|
518
607
|
});
|
|
519
|
-
return
|
|
520
|
-
}),
|
|
521
|
-
const d =
|
|
522
|
-
if (!d) return
|
|
523
|
-
const
|
|
608
|
+
return h("div", { style: "display: contents" }, s);
|
|
609
|
+
}), a && te(r, (l) => {
|
|
610
|
+
const d = t.editor;
|
|
611
|
+
if (!d) return h("span");
|
|
612
|
+
const s = d({
|
|
524
613
|
value: l.value,
|
|
525
614
|
row: l.row,
|
|
526
615
|
column: l.column,
|
|
527
616
|
commit: l.commit,
|
|
528
617
|
cancel: l.cancel
|
|
529
618
|
});
|
|
530
|
-
return
|
|
619
|
+
return h("div", { style: "display: contents" }, s);
|
|
531
620
|
});
|
|
532
|
-
}), (r, i) => (
|
|
621
|
+
}), (r, i) => (E(), w("tbw-grid-column", {
|
|
533
622
|
ref_key: "columnRef",
|
|
534
|
-
ref:
|
|
535
|
-
field:
|
|
536
|
-
header:
|
|
537
|
-
width:
|
|
538
|
-
"min-width":
|
|
539
|
-
"max-width":
|
|
540
|
-
sortable:
|
|
541
|
-
resizable:
|
|
542
|
-
editable:
|
|
543
|
-
type:
|
|
544
|
-
align:
|
|
545
|
-
hidden:
|
|
546
|
-
}, null, 8,
|
|
623
|
+
ref: e,
|
|
624
|
+
field: n.field,
|
|
625
|
+
header: n.header,
|
|
626
|
+
width: n.width,
|
|
627
|
+
"min-width": n.minWidth,
|
|
628
|
+
"max-width": n.maxWidth,
|
|
629
|
+
sortable: n.sortable,
|
|
630
|
+
resizable: n.resizable,
|
|
631
|
+
editable: n.editable,
|
|
632
|
+
type: n.type,
|
|
633
|
+
align: n.align,
|
|
634
|
+
hidden: n.hidden
|
|
635
|
+
}, null, 8, ie));
|
|
547
636
|
}
|
|
548
|
-
}),
|
|
637
|
+
}), le = ["show-expand-column", "animation"], ve = /* @__PURE__ */ p({
|
|
549
638
|
__name: "TbwGridDetailPanel",
|
|
550
639
|
props: {
|
|
551
640
|
showExpandColumn: { type: Boolean, default: !0 },
|
|
552
641
|
animation: { type: [String, Boolean], default: "slide" }
|
|
553
642
|
},
|
|
554
|
-
setup(
|
|
555
|
-
const
|
|
643
|
+
setup(n) {
|
|
644
|
+
const t = y(null), e = _();
|
|
556
645
|
return b(() => {
|
|
557
|
-
const r =
|
|
558
|
-
!r || !
|
|
559
|
-
}), (r, i) => (
|
|
646
|
+
const r = t.value;
|
|
647
|
+
!r || !e.default || U.set(r, (i) => e.default?.(i));
|
|
648
|
+
}), (r, i) => (E(), w("tbw-grid-detail", {
|
|
560
649
|
ref_key: "detailRef",
|
|
561
|
-
ref:
|
|
562
|
-
"show-expand-column":
|
|
563
|
-
animation:
|
|
564
|
-
}, null, 8,
|
|
650
|
+
ref: t,
|
|
651
|
+
"show-expand-column": n.showExpandColumn,
|
|
652
|
+
animation: n.animation
|
|
653
|
+
}, null, 8, le));
|
|
565
654
|
}
|
|
566
|
-
}),
|
|
655
|
+
}), ye = /* @__PURE__ */ p({
|
|
567
656
|
__name: "TbwGridResponsiveCard",
|
|
568
|
-
setup(
|
|
569
|
-
const
|
|
657
|
+
setup(n) {
|
|
658
|
+
const t = y(null), e = _();
|
|
570
659
|
return b(() => {
|
|
571
|
-
const r =
|
|
572
|
-
!r || !
|
|
573
|
-
}), (r, i) => (
|
|
660
|
+
const r = t.value;
|
|
661
|
+
!r || !e.default || H.set(r, (i) => e.default?.(i));
|
|
662
|
+
}), (r, i) => (E(), w("tbw-grid-responsive-card", {
|
|
574
663
|
ref_key: "cardRef",
|
|
575
|
-
ref:
|
|
664
|
+
ref: t
|
|
576
665
|
}, null, 512));
|
|
577
666
|
}
|
|
578
|
-
}),
|
|
667
|
+
}), he = /* @__PURE__ */ p({
|
|
579
668
|
__name: "TbwGridToolButtons",
|
|
580
|
-
setup(
|
|
581
|
-
return (
|
|
582
|
-
|
|
669
|
+
setup(n) {
|
|
670
|
+
return (t, e) => (E(), w("tbw-grid-tool-buttons", null, [
|
|
671
|
+
I(t.$slots, "default")
|
|
583
672
|
]));
|
|
584
673
|
}
|
|
585
|
-
}),
|
|
674
|
+
}), de = /* @__PURE__ */ new WeakMap(), se = ["id", "label", "icon", "position", "width"], be = /* @__PURE__ */ p({
|
|
586
675
|
__name: "TbwGridToolPanel",
|
|
587
676
|
props: {
|
|
588
677
|
id: {},
|
|
@@ -591,35 +680,35 @@ const ge = /* @__PURE__ */ f({
|
|
|
591
680
|
position: { default: "right" },
|
|
592
681
|
width: { default: "250px" }
|
|
593
682
|
},
|
|
594
|
-
setup(
|
|
595
|
-
const
|
|
683
|
+
setup(n) {
|
|
684
|
+
const t = y(null), e = _();
|
|
596
685
|
return b(() => {
|
|
597
|
-
const r =
|
|
598
|
-
!r || !
|
|
599
|
-
}), (r, i) => (
|
|
686
|
+
const r = t.value;
|
|
687
|
+
!r || !e.default || de.set(r, (i) => e.default?.(i));
|
|
688
|
+
}), (r, i) => (E(), w("tbw-grid-tool-panel", {
|
|
600
689
|
ref_key: "panelRef",
|
|
601
|
-
ref:
|
|
602
|
-
id:
|
|
603
|
-
label:
|
|
604
|
-
icon:
|
|
605
|
-
position:
|
|
606
|
-
width:
|
|
607
|
-
}, null, 8,
|
|
690
|
+
ref: t,
|
|
691
|
+
id: n.id,
|
|
692
|
+
label: n.label,
|
|
693
|
+
icon: n.icon,
|
|
694
|
+
position: n.position,
|
|
695
|
+
width: n.width
|
|
696
|
+
}, null, 8, se));
|
|
608
697
|
}
|
|
609
698
|
});
|
|
610
|
-
function we(
|
|
611
|
-
const r =
|
|
699
|
+
function we(n, t, e) {
|
|
700
|
+
const r = e ?? O(L, y(null));
|
|
612
701
|
let i = null;
|
|
613
702
|
b(() => {
|
|
614
|
-
const
|
|
615
|
-
if (!
|
|
616
|
-
const l =
|
|
617
|
-
|
|
618
|
-
}),
|
|
703
|
+
const a = r.value;
|
|
704
|
+
if (!a) return;
|
|
705
|
+
const l = t;
|
|
706
|
+
a.addEventListener(n, l), i = () => a.removeEventListener(n, l);
|
|
707
|
+
}), $(() => {
|
|
619
708
|
i?.();
|
|
620
709
|
});
|
|
621
710
|
}
|
|
622
|
-
const
|
|
711
|
+
const Ee = p({
|
|
623
712
|
name: "GridProvider",
|
|
624
713
|
props: {
|
|
625
714
|
/**
|
|
@@ -637,37 +726,37 @@ const he = f({
|
|
|
637
726
|
default: void 0
|
|
638
727
|
}
|
|
639
728
|
},
|
|
640
|
-
setup(
|
|
729
|
+
setup(n, { slots: t }) {
|
|
641
730
|
return () => {
|
|
642
|
-
let
|
|
643
|
-
return
|
|
731
|
+
let e = t.default?.();
|
|
732
|
+
return n.typeDefaults && (e = h(Z, { defaults: n.typeDefaults }, () => e)), n.icons && (e = h(X, { icons: n.icons }, () => e)), e;
|
|
644
733
|
};
|
|
645
734
|
}
|
|
646
735
|
});
|
|
647
736
|
export {
|
|
648
737
|
L as GRID_ELEMENT_KEY,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
738
|
+
z as GRID_ICONS,
|
|
739
|
+
N as GRID_TYPE_DEFAULTS,
|
|
740
|
+
X as GridIconProvider,
|
|
741
|
+
Ee as GridProvider,
|
|
742
|
+
Z as GridTypeProvider,
|
|
743
|
+
me as TbwGrid,
|
|
744
|
+
ge as TbwGridColumn,
|
|
745
|
+
ve as TbwGridDetailPanel,
|
|
746
|
+
ye as TbwGridResponsiveCard,
|
|
747
|
+
he as TbwGridToolButtons,
|
|
659
748
|
be as TbwGridToolPanel,
|
|
660
749
|
oe as VueGridAdapter,
|
|
661
|
-
|
|
662
|
-
|
|
750
|
+
Te as clearFeatureRegistry,
|
|
751
|
+
J as createPluginFromFeature,
|
|
663
752
|
Be as getFeatureFactory,
|
|
664
753
|
Oe as getRegisteredFeatures,
|
|
665
754
|
_e as isFeatureRegistered,
|
|
666
755
|
je as registerFeature,
|
|
667
|
-
|
|
756
|
+
pe as useGrid,
|
|
668
757
|
we as useGridEvent,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
758
|
+
Q as useGridIcons,
|
|
759
|
+
q as useGridTypeDefaults,
|
|
760
|
+
fe as useTypeDefault
|
|
672
761
|
};
|
|
673
762
|
//# sourceMappingURL=index.js.map
|