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