@toolbox-web/grid-vue 0.0.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/README.md +489 -1
- package/chunks/feature-registry-BgEOysSJ.js +38 -0
- package/chunks/feature-registry-BgEOysSJ.js.map +1 -0
- package/features/clipboard.d.ts +20 -0
- package/features/clipboard.d.ts.map +1 -0
- package/features/clipboard.js +4 -0
- package/features/clipboard.js.map +1 -0
- package/features/column-virtualization.d.ts +20 -0
- package/features/column-virtualization.d.ts.map +1 -0
- package/features/column-virtualization.js +4 -0
- package/features/column-virtualization.js.map +1 -0
- package/features/context-menu.d.ts +20 -0
- package/features/context-menu.d.ts.map +1 -0
- package/features/context-menu.js +4 -0
- package/features/context-menu.js.map +1 -0
- package/features/editing.d.ts +20 -0
- package/features/editing.d.ts.map +1 -0
- package/features/editing.js +4 -0
- package/features/editing.js.map +1 -0
- package/features/export.d.ts +20 -0
- package/features/export.d.ts.map +1 -0
- package/features/export.js +4 -0
- package/features/export.js.map +1 -0
- package/features/filtering.d.ts +20 -0
- package/features/filtering.d.ts.map +1 -0
- package/features/filtering.js +4 -0
- package/features/filtering.js.map +1 -0
- package/features/grouping-columns.d.ts +24 -0
- package/features/grouping-columns.d.ts.map +1 -0
- package/features/grouping-columns.js +4 -0
- package/features/grouping-columns.js.map +1 -0
- package/features/grouping-rows.d.ts +23 -0
- package/features/grouping-rows.d.ts.map +1 -0
- package/features/grouping-rows.js +4 -0
- package/features/grouping-rows.js.map +1 -0
- package/features/index.d.ts +1 -0
- package/features/index.d.ts.map +1 -0
- package/features/index.js +23 -0
- package/features/index.js.map +1 -0
- package/features/master-detail.d.ts +23 -0
- package/features/master-detail.d.ts.map +1 -0
- package/features/master-detail.js +4 -0
- package/features/master-detail.js.map +1 -0
- package/features/multi-sort.d.ts +20 -0
- package/features/multi-sort.d.ts.map +1 -0
- package/features/multi-sort.js +5 -0
- package/features/multi-sort.js.map +1 -0
- package/features/pinned-columns.d.ts +23 -0
- package/features/pinned-columns.d.ts.map +1 -0
- package/features/pinned-columns.js +4 -0
- package/features/pinned-columns.js.map +1 -0
- package/features/pinned-rows.d.ts +22 -0
- package/features/pinned-rows.d.ts.map +1 -0
- package/features/pinned-rows.js +4 -0
- package/features/pinned-rows.js.map +1 -0
- package/features/pivot.d.ts +24 -0
- package/features/pivot.d.ts.map +1 -0
- package/features/pivot.js +4 -0
- package/features/pivot.js.map +1 -0
- package/features/print.d.ts +20 -0
- package/features/print.d.ts.map +1 -0
- package/features/print.js +4 -0
- package/features/print.js.map +1 -0
- package/features/reorder.d.ts +20 -0
- package/features/reorder.d.ts.map +1 -0
- package/features/reorder.js +4 -0
- package/features/reorder.js.map +1 -0
- package/features/responsive.d.ts +24 -0
- package/features/responsive.d.ts.map +1 -0
- package/features/responsive.js +4 -0
- package/features/responsive.js.map +1 -0
- package/features/row-reorder.d.ts +20 -0
- package/features/row-reorder.d.ts.map +1 -0
- package/features/row-reorder.js +4 -0
- package/features/row-reorder.js.map +1 -0
- package/features/selection.d.ts +20 -0
- package/features/selection.d.ts.map +1 -0
- package/features/selection.js +4 -0
- package/features/selection.js.map +1 -0
- package/features/server-side.d.ts +22 -0
- package/features/server-side.d.ts.map +1 -0
- package/features/server-side.js +4 -0
- package/features/server-side.js.map +1 -0
- package/features/tree.d.ts +23 -0
- package/features/tree.d.ts.map +1 -0
- package/features/tree.js +4 -0
- package/features/tree.js.map +1 -0
- package/features/undo-redo.d.ts +20 -0
- package/features/undo-redo.d.ts.map +1 -0
- package/features/undo-redo.js +4 -0
- package/features/undo-redo.js.map +1 -0
- package/features/visibility.d.ts +20 -0
- package/features/visibility.d.ts.map +1 -0
- package/features/visibility.js +4 -0
- package/features/visibility.js.map +1 -0
- package/index.d.ts +67 -0
- package/index.d.ts.map +1 -0
- package/index.js +762 -0
- package/index.js.map +1 -0
- package/lib/TbwGrid.vue.d.ts +100 -0
- package/lib/TbwGrid.vue.d.ts.map +1 -0
- package/lib/TbwGridColumn.vue.d.ts +183 -0
- package/lib/TbwGridColumn.vue.d.ts.map +1 -0
- package/lib/TbwGridDetailPanel.vue.d.ts +36 -0
- package/lib/TbwGridDetailPanel.vue.d.ts.map +1 -0
- package/lib/TbwGridResponsiveCard.vue.d.ts +22 -0
- package/lib/TbwGridResponsiveCard.vue.d.ts.map +1 -0
- package/lib/TbwGridToolButtons.vue.d.ts +27 -0
- package/lib/TbwGridToolButtons.vue.d.ts.map +1 -0
- package/lib/TbwGridToolPanel.vue.d.ts +178 -0
- package/lib/TbwGridToolPanel.vue.d.ts.map +1 -0
- package/lib/detail-panel-registry.d.ts +20 -0
- package/lib/detail-panel-registry.d.ts.map +1 -0
- package/lib/feature-props.d.ts +321 -0
- package/lib/feature-props.d.ts.map +1 -0
- package/lib/feature-registry.d.ts +69 -0
- package/lib/feature-registry.d.ts.map +1 -0
- package/lib/grid-icon-registry.d.ts +66 -0
- package/lib/grid-icon-registry.d.ts.map +1 -0
- package/lib/grid-provider.d.ts +66 -0
- package/lib/grid-provider.d.ts.map +1 -0
- package/lib/grid-type-registry.d.ts +98 -0
- package/lib/grid-type-registry.d.ts.map +1 -0
- package/lib/responsive-card-registry.d.ts +20 -0
- package/lib/responsive-card-registry.d.ts.map +1 -0
- package/lib/slot-types.d.ts +50 -0
- package/lib/slot-types.d.ts.map +1 -0
- package/lib/tool-panel-registry.d.ts +18 -0
- package/lib/tool-panel-registry.d.ts.map +1 -0
- package/lib/use-grid-event.d.ts +68 -0
- package/lib/use-grid-event.d.ts.map +1 -0
- package/lib/use-grid.d.ts +39 -0
- package/lib/use-grid.d.ts.map +1 -0
- package/lib/vue-column-config.d.ts +69 -0
- package/lib/vue-column-config.d.ts.map +1 -0
- package/lib/vue-grid-adapter.d.ts +142 -0
- package/lib/vue-grid-adapter.d.ts.map +1 -0
- package/package.json +52 -3
- package/typedoc-entry.d.ts +31 -0
- package/typedoc-entry.d.ts.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,762 @@
|
|
|
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
|
+
}
|
|
9
|
+
const X = p({
|
|
10
|
+
name: "GridIconProvider",
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* Icon overrides to provide to all descendant grids.
|
|
14
|
+
*/
|
|
15
|
+
icons: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: !0
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(n, { slots: t }) {
|
|
21
|
+
return G(z, n.icons), () => t.default?.();
|
|
22
|
+
}
|
|
23
|
+
}), N = /* @__PURE__ */ Symbol("grid-type-defaults");
|
|
24
|
+
function q() {
|
|
25
|
+
return O(N, void 0);
|
|
26
|
+
}
|
|
27
|
+
function fe(n) {
|
|
28
|
+
return q()?.[n];
|
|
29
|
+
}
|
|
30
|
+
const Z = p({
|
|
31
|
+
name: "GridTypeProvider",
|
|
32
|
+
props: {
|
|
33
|
+
/**
|
|
34
|
+
* Type defaults to provide to all descendant grids.
|
|
35
|
+
*/
|
|
36
|
+
defaults: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: !0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(n, { slots: t }) {
|
|
42
|
+
return G(N, n.defaults), () => t.default?.();
|
|
43
|
+
}
|
|
44
|
+
}), L = /* @__PURE__ */ Symbol("tbw-grid");
|
|
45
|
+
function pe() {
|
|
46
|
+
const n = O(L, y(null));
|
|
47
|
+
return {
|
|
48
|
+
gridElement: n,
|
|
49
|
+
forceLayout: async () => {
|
|
50
|
+
await n.value?.forceLayout();
|
|
51
|
+
},
|
|
52
|
+
getConfig: () => n.value?.getConfig(),
|
|
53
|
+
ready: async () => {
|
|
54
|
+
await n.value?.ready();
|
|
55
|
+
},
|
|
56
|
+
getPlugin: (t) => n.value?.getPlugin(t)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
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
|
+
}
|
|
66
|
+
}
|
|
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
|
+
}
|
|
73
|
+
}
|
|
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
|
+
}
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
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
|
+
}
|
|
88
|
+
return t;
|
|
89
|
+
}
|
|
90
|
+
class oe {
|
|
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
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Determines if this adapter can handle the given element.
|
|
104
|
+
* Checks if a renderer or editor is registered for this element.
|
|
105
|
+
*/
|
|
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));
|
|
112
|
+
}
|
|
113
|
+
const i = r?.renderer !== void 0, a = r?.editor !== void 0;
|
|
114
|
+
return r !== void 0 && (i || a);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Creates a view renderer function that renders a Vue component
|
|
118
|
+
* and returns its container DOM element.
|
|
119
|
+
*/
|
|
120
|
+
createRenderer(t) {
|
|
121
|
+
const e = ne(t);
|
|
122
|
+
if (!e)
|
|
123
|
+
return;
|
|
124
|
+
const r = /* @__PURE__ */ new WeakMap();
|
|
125
|
+
return (i) => {
|
|
126
|
+
const a = i.cellEl;
|
|
127
|
+
if (a) {
|
|
128
|
+
const s = r.get(a);
|
|
129
|
+
if (s)
|
|
130
|
+
return s.update(i), s.container;
|
|
131
|
+
const c = document.createElement("div");
|
|
132
|
+
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
133
|
+
let u = i;
|
|
134
|
+
const R = g({
|
|
135
|
+
render() {
|
|
136
|
+
return e(u);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return R.mount(c), r.set(a, {
|
|
140
|
+
app: R,
|
|
141
|
+
container: c,
|
|
142
|
+
update: (j) => {
|
|
143
|
+
u = j, R._instance?.update();
|
|
144
|
+
}
|
|
145
|
+
}), c;
|
|
146
|
+
}
|
|
147
|
+
const l = document.createElement("div");
|
|
148
|
+
l.className = "vue-cell-renderer", l.style.display = "contents";
|
|
149
|
+
const d = g({
|
|
150
|
+
render() {
|
|
151
|
+
return e(i);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return d.mount(l), this.mountedViews.push({ app: d, container: l }), l;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Creates an editor spec that renders a Vue component for cell editing.
|
|
159
|
+
* Returns a function that creates the editor DOM element.
|
|
160
|
+
*/
|
|
161
|
+
createEditor(t) {
|
|
162
|
+
const e = re(t);
|
|
163
|
+
if (e)
|
|
164
|
+
return (r) => {
|
|
165
|
+
const i = document.createElement("div");
|
|
166
|
+
i.className = "vue-cell-editor", i.style.display = "contents";
|
|
167
|
+
const a = g({
|
|
168
|
+
render() {
|
|
169
|
+
return e(r);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return a.mount(i), this.mountedViews.push({ app: a, container: i }), i;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
177
|
+
* Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
|
|
178
|
+
*/
|
|
179
|
+
parseDetailElement(t) {
|
|
180
|
+
const e = t.closest("tbw-grid");
|
|
181
|
+
if (!e) return;
|
|
182
|
+
const r = e.querySelector("tbw-grid-detail");
|
|
183
|
+
if (!r) return;
|
|
184
|
+
const i = U.get(r);
|
|
185
|
+
if (i)
|
|
186
|
+
return (a, l) => {
|
|
187
|
+
const d = document.createElement("div");
|
|
188
|
+
d.className = "vue-detail-panel";
|
|
189
|
+
const c = i({ row: a, rowIndex: l });
|
|
190
|
+
if (c && c.length > 0) {
|
|
191
|
+
const u = g({
|
|
192
|
+
render() {
|
|
193
|
+
return c;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
u.mount(d), this.mountedViews.push({ app: u, container: d });
|
|
197
|
+
}
|
|
198
|
+
return d;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Framework adapter hook called by ResponsivePlugin during attach().
|
|
203
|
+
* Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
|
|
204
|
+
*/
|
|
205
|
+
parseResponsiveCardElement(t) {
|
|
206
|
+
const e = t.closest("tbw-grid");
|
|
207
|
+
if (!e) return;
|
|
208
|
+
const r = e.querySelector("tbw-grid-responsive-card");
|
|
209
|
+
if (!r) return;
|
|
210
|
+
const i = H.get(r);
|
|
211
|
+
if (i)
|
|
212
|
+
return (a, l) => {
|
|
213
|
+
const d = document.createElement("div");
|
|
214
|
+
d.className = "vue-responsive-card";
|
|
215
|
+
const c = i({ row: a, rowIndex: l });
|
|
216
|
+
if (c && c.length > 0) {
|
|
217
|
+
const u = g({
|
|
218
|
+
render() {
|
|
219
|
+
return c;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
u.mount(d), this.mountedViews.push({ app: u, container: d });
|
|
223
|
+
}
|
|
224
|
+
return d;
|
|
225
|
+
};
|
|
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
|
|
300
|
+
/**
|
|
301
|
+
* Cleanup all mounted Vue apps.
|
|
302
|
+
*/
|
|
303
|
+
cleanup() {
|
|
304
|
+
for (const { app: t, container: e } of this.mountedViews)
|
|
305
|
+
try {
|
|
306
|
+
t.unmount(), e.remove();
|
|
307
|
+
} catch {
|
|
308
|
+
}
|
|
309
|
+
this.mountedViews = [];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const me = /* @__PURE__ */ p({
|
|
313
|
+
__name: "TbwGrid",
|
|
314
|
+
props: {
|
|
315
|
+
/** Row data to display */
|
|
316
|
+
rows: {
|
|
317
|
+
type: Array,
|
|
318
|
+
default: () => []
|
|
319
|
+
},
|
|
320
|
+
/** Column definitions (shorthand for gridConfig.columns) */
|
|
321
|
+
columns: {
|
|
322
|
+
type: Array,
|
|
323
|
+
default: void 0
|
|
324
|
+
},
|
|
325
|
+
/** Full grid configuration */
|
|
326
|
+
gridConfig: {
|
|
327
|
+
type: Object,
|
|
328
|
+
default: void 0
|
|
329
|
+
},
|
|
330
|
+
/** Fit mode shorthand */
|
|
331
|
+
fitMode: {
|
|
332
|
+
type: String,
|
|
333
|
+
default: void 0
|
|
334
|
+
},
|
|
335
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
336
|
+
// FEATURE PROPS - Declarative plugin configuration
|
|
337
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
338
|
+
/** Enable cell/row/range selection */
|
|
339
|
+
selection: {
|
|
340
|
+
type: [String, Object],
|
|
341
|
+
default: void 0
|
|
342
|
+
},
|
|
343
|
+
/** Enable inline cell editing */
|
|
344
|
+
editing: {
|
|
345
|
+
type: [Boolean, String],
|
|
346
|
+
default: void 0
|
|
347
|
+
},
|
|
348
|
+
/** Enable clipboard copy/paste */
|
|
349
|
+
clipboard: {
|
|
350
|
+
type: [Boolean, Object],
|
|
351
|
+
default: void 0
|
|
352
|
+
},
|
|
353
|
+
/** Enable right-click context menu */
|
|
354
|
+
contextMenu: {
|
|
355
|
+
type: [Boolean, Object],
|
|
356
|
+
default: void 0
|
|
357
|
+
},
|
|
358
|
+
/** Enable multi-column sorting */
|
|
359
|
+
multiSort: {
|
|
360
|
+
type: [Boolean, String, Object],
|
|
361
|
+
default: void 0
|
|
362
|
+
},
|
|
363
|
+
/** @deprecated Use multiSort instead */
|
|
364
|
+
sorting: {
|
|
365
|
+
type: [Boolean, String, Object],
|
|
366
|
+
default: void 0
|
|
367
|
+
},
|
|
368
|
+
/** Enable column filtering */
|
|
369
|
+
filtering: {
|
|
370
|
+
type: [Boolean, Object],
|
|
371
|
+
default: void 0
|
|
372
|
+
},
|
|
373
|
+
/** Enable column drag-to-reorder */
|
|
374
|
+
reorder: {
|
|
375
|
+
type: [Boolean, Object],
|
|
376
|
+
default: void 0
|
|
377
|
+
},
|
|
378
|
+
/** Enable column visibility toggle panel */
|
|
379
|
+
visibility: {
|
|
380
|
+
type: [Boolean, Object],
|
|
381
|
+
default: void 0
|
|
382
|
+
},
|
|
383
|
+
/** Enable pinned/sticky columns */
|
|
384
|
+
pinnedColumns: {
|
|
385
|
+
type: Boolean,
|
|
386
|
+
default: void 0
|
|
387
|
+
},
|
|
388
|
+
/** Enable multi-level column headers */
|
|
389
|
+
groupingColumns: {
|
|
390
|
+
type: [Boolean, Object],
|
|
391
|
+
default: void 0
|
|
392
|
+
},
|
|
393
|
+
/** Enable horizontal column virtualization */
|
|
394
|
+
columnVirtualization: {
|
|
395
|
+
type: [Boolean, Object],
|
|
396
|
+
default: void 0
|
|
397
|
+
},
|
|
398
|
+
/** Enable row drag-to-reorder */
|
|
399
|
+
rowReorder: {
|
|
400
|
+
type: [Boolean, Object],
|
|
401
|
+
default: void 0
|
|
402
|
+
},
|
|
403
|
+
/** Enable row grouping by field values */
|
|
404
|
+
groupingRows: {
|
|
405
|
+
type: Object,
|
|
406
|
+
default: void 0
|
|
407
|
+
},
|
|
408
|
+
/** Enable pinned rows */
|
|
409
|
+
pinnedRows: {
|
|
410
|
+
type: [Boolean, Object],
|
|
411
|
+
default: void 0
|
|
412
|
+
},
|
|
413
|
+
/** Enable hierarchical tree view */
|
|
414
|
+
tree: {
|
|
415
|
+
type: [Boolean, Object],
|
|
416
|
+
default: void 0
|
|
417
|
+
},
|
|
418
|
+
/** Enable master-detail expandable rows */
|
|
419
|
+
masterDetail: {
|
|
420
|
+
type: Object,
|
|
421
|
+
default: void 0
|
|
422
|
+
},
|
|
423
|
+
/** Enable responsive card layout */
|
|
424
|
+
responsive: {
|
|
425
|
+
type: [Boolean, Object],
|
|
426
|
+
default: void 0
|
|
427
|
+
},
|
|
428
|
+
/** Enable undo/redo for cell edits */
|
|
429
|
+
undoRedo: {
|
|
430
|
+
type: [Boolean, Object],
|
|
431
|
+
default: void 0
|
|
432
|
+
},
|
|
433
|
+
/** Enable CSV/JSON export */
|
|
434
|
+
export: {
|
|
435
|
+
type: [Boolean, Object],
|
|
436
|
+
default: void 0
|
|
437
|
+
},
|
|
438
|
+
/** Enable print functionality */
|
|
439
|
+
print: {
|
|
440
|
+
type: [Boolean, Object],
|
|
441
|
+
default: void 0
|
|
442
|
+
},
|
|
443
|
+
/** Enable pivot table functionality */
|
|
444
|
+
pivot: {
|
|
445
|
+
type: Object,
|
|
446
|
+
default: void 0
|
|
447
|
+
},
|
|
448
|
+
/** Enable server-side data operations */
|
|
449
|
+
serverSide: {
|
|
450
|
+
type: Object,
|
|
451
|
+
default: void 0
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
emits: ["cell-commit", "row-commit", "cell-click", "cell-dblclick", "selection-change", "row-toggle", "sort-change", "ready"],
|
|
455
|
+
setup(n, { expose: t, emit: e }) {
|
|
456
|
+
let r = !1, i = null;
|
|
457
|
+
function a() {
|
|
458
|
+
return r || (i = new oe(), K.registerAdapter(i), r = !0), i;
|
|
459
|
+
}
|
|
460
|
+
a();
|
|
461
|
+
const l = n, d = e, s = y(null);
|
|
462
|
+
G(L, s);
|
|
463
|
+
const c = q(), u = Q(), R = [
|
|
464
|
+
"selection",
|
|
465
|
+
"editing",
|
|
466
|
+
"clipboard",
|
|
467
|
+
"contextMenu",
|
|
468
|
+
"multiSort",
|
|
469
|
+
"sorting",
|
|
470
|
+
"filtering",
|
|
471
|
+
"reorder",
|
|
472
|
+
"visibility",
|
|
473
|
+
"pinnedColumns",
|
|
474
|
+
"groupingColumns",
|
|
475
|
+
"columnVirtualization",
|
|
476
|
+
"rowReorder",
|
|
477
|
+
"groupingRows",
|
|
478
|
+
"pinnedRows",
|
|
479
|
+
"tree",
|
|
480
|
+
"masterDetail",
|
|
481
|
+
"responsive",
|
|
482
|
+
"undoRedo",
|
|
483
|
+
"export",
|
|
484
|
+
"print",
|
|
485
|
+
"pivot",
|
|
486
|
+
"serverSide"
|
|
487
|
+
];
|
|
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);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return o;
|
|
498
|
+
}
|
|
499
|
+
const D = Y(() => {
|
|
500
|
+
const o = l.gridConfig ?? {}, f = j(), T = o.plugins ?? [], C = [...f, ...T], W = u ? { ...o.icons, ...u } : o.icons;
|
|
501
|
+
return {
|
|
502
|
+
...o,
|
|
503
|
+
...l.columns ? { columns: l.columns } : {},
|
|
504
|
+
...C.length > 0 ? { plugins: C } : {},
|
|
505
|
+
...W ? { icons: W } : {}
|
|
506
|
+
};
|
|
507
|
+
});
|
|
508
|
+
function S(o) {
|
|
509
|
+
d("cell-commit", o);
|
|
510
|
+
}
|
|
511
|
+
function k(o) {
|
|
512
|
+
d("row-commit", o);
|
|
513
|
+
}
|
|
514
|
+
function P(o) {
|
|
515
|
+
d("cell-click", o);
|
|
516
|
+
}
|
|
517
|
+
function x(o) {
|
|
518
|
+
d("cell-dblclick", o);
|
|
519
|
+
}
|
|
520
|
+
function F(o) {
|
|
521
|
+
d("selection-change", o);
|
|
522
|
+
}
|
|
523
|
+
function A(o) {
|
|
524
|
+
d("row-toggle", o);
|
|
525
|
+
}
|
|
526
|
+
function M(o) {
|
|
527
|
+
d("sort-change", o);
|
|
528
|
+
}
|
|
529
|
+
function V(o) {
|
|
530
|
+
d("ready", o);
|
|
531
|
+
}
|
|
532
|
+
return b(() => {
|
|
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(
|
|
541
|
+
() => l.rows,
|
|
542
|
+
(o) => {
|
|
543
|
+
s.value && (s.value.rows = o);
|
|
544
|
+
},
|
|
545
|
+
{ deep: !0 }
|
|
546
|
+
), B(
|
|
547
|
+
D,
|
|
548
|
+
(o) => {
|
|
549
|
+
s.value && o && (s.value.gridConfig = o);
|
|
550
|
+
},
|
|
551
|
+
{ deep: !0 }
|
|
552
|
+
), B(
|
|
553
|
+
() => l.fitMode,
|
|
554
|
+
(o) => {
|
|
555
|
+
s.value && o && (s.value.fitMode = o);
|
|
556
|
+
}
|
|
557
|
+
), B(
|
|
558
|
+
() => c,
|
|
559
|
+
(o) => {
|
|
560
|
+
a().setTypeDefaults(o ?? null);
|
|
561
|
+
},
|
|
562
|
+
{ deep: !0 }
|
|
563
|
+
), t({
|
|
564
|
+
/** The underlying grid element */
|
|
565
|
+
gridElement: s,
|
|
566
|
+
/** Force a layout recalculation */
|
|
567
|
+
forceLayout: () => s.value?.forceLayout(),
|
|
568
|
+
/** Get current grid configuration */
|
|
569
|
+
getConfig: () => s.value?.getConfig(),
|
|
570
|
+
/** Wait for grid to be ready */
|
|
571
|
+
ready: () => s.value?.ready()
|
|
572
|
+
}), (o, f) => (E(), w("tbw-grid", {
|
|
573
|
+
ref_key: "gridRef",
|
|
574
|
+
ref: s
|
|
575
|
+
}, [
|
|
576
|
+
I(o.$slots, "default")
|
|
577
|
+
], 512));
|
|
578
|
+
}
|
|
579
|
+
}), ie = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"], ge = /* @__PURE__ */ p({
|
|
580
|
+
__name: "TbwGridColumn",
|
|
581
|
+
props: {
|
|
582
|
+
field: {},
|
|
583
|
+
header: {},
|
|
584
|
+
width: {},
|
|
585
|
+
minWidth: {},
|
|
586
|
+
maxWidth: {},
|
|
587
|
+
sortable: { type: Boolean },
|
|
588
|
+
resizable: { type: Boolean },
|
|
589
|
+
editable: { type: Boolean },
|
|
590
|
+
type: {},
|
|
591
|
+
align: {},
|
|
592
|
+
hidden: { type: Boolean }
|
|
593
|
+
},
|
|
594
|
+
setup(n) {
|
|
595
|
+
const t = _(), e = y(null);
|
|
596
|
+
return b(() => {
|
|
597
|
+
const r = e.value;
|
|
598
|
+
if (!r) return;
|
|
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({
|
|
604
|
+
value: l.value,
|
|
605
|
+
row: l.row,
|
|
606
|
+
column: l.column
|
|
607
|
+
});
|
|
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({
|
|
613
|
+
value: l.value,
|
|
614
|
+
row: l.row,
|
|
615
|
+
column: l.column,
|
|
616
|
+
commit: l.commit,
|
|
617
|
+
cancel: l.cancel
|
|
618
|
+
});
|
|
619
|
+
return h("div", { style: "display: contents" }, s);
|
|
620
|
+
});
|
|
621
|
+
}), (r, i) => (E(), w("tbw-grid-column", {
|
|
622
|
+
ref_key: "columnRef",
|
|
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));
|
|
636
|
+
}
|
|
637
|
+
}), le = ["show-expand-column", "animation"], ve = /* @__PURE__ */ p({
|
|
638
|
+
__name: "TbwGridDetailPanel",
|
|
639
|
+
props: {
|
|
640
|
+
showExpandColumn: { type: Boolean, default: !0 },
|
|
641
|
+
animation: { type: [String, Boolean], default: "slide" }
|
|
642
|
+
},
|
|
643
|
+
setup(n) {
|
|
644
|
+
const t = y(null), e = _();
|
|
645
|
+
return b(() => {
|
|
646
|
+
const r = t.value;
|
|
647
|
+
!r || !e.default || U.set(r, (i) => e.default?.(i));
|
|
648
|
+
}), (r, i) => (E(), w("tbw-grid-detail", {
|
|
649
|
+
ref_key: "detailRef",
|
|
650
|
+
ref: t,
|
|
651
|
+
"show-expand-column": n.showExpandColumn,
|
|
652
|
+
animation: n.animation
|
|
653
|
+
}, null, 8, le));
|
|
654
|
+
}
|
|
655
|
+
}), ye = /* @__PURE__ */ p({
|
|
656
|
+
__name: "TbwGridResponsiveCard",
|
|
657
|
+
setup(n) {
|
|
658
|
+
const t = y(null), e = _();
|
|
659
|
+
return b(() => {
|
|
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", {
|
|
663
|
+
ref_key: "cardRef",
|
|
664
|
+
ref: t
|
|
665
|
+
}, null, 512));
|
|
666
|
+
}
|
|
667
|
+
}), he = /* @__PURE__ */ p({
|
|
668
|
+
__name: "TbwGridToolButtons",
|
|
669
|
+
setup(n) {
|
|
670
|
+
return (t, e) => (E(), w("tbw-grid-tool-buttons", null, [
|
|
671
|
+
I(t.$slots, "default")
|
|
672
|
+
]));
|
|
673
|
+
}
|
|
674
|
+
}), de = /* @__PURE__ */ new WeakMap(), se = ["id", "label", "icon", "position", "width"], be = /* @__PURE__ */ p({
|
|
675
|
+
__name: "TbwGridToolPanel",
|
|
676
|
+
props: {
|
|
677
|
+
id: {},
|
|
678
|
+
label: {},
|
|
679
|
+
icon: {},
|
|
680
|
+
position: { default: "right" },
|
|
681
|
+
width: { default: "250px" }
|
|
682
|
+
},
|
|
683
|
+
setup(n) {
|
|
684
|
+
const t = y(null), e = _();
|
|
685
|
+
return b(() => {
|
|
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", {
|
|
689
|
+
ref_key: "panelRef",
|
|
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));
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
function we(n, t, e) {
|
|
700
|
+
const r = e ?? O(L, y(null));
|
|
701
|
+
let i = null;
|
|
702
|
+
b(() => {
|
|
703
|
+
const a = r.value;
|
|
704
|
+
if (!a) return;
|
|
705
|
+
const l = t;
|
|
706
|
+
a.addEventListener(n, l), i = () => a.removeEventListener(n, l);
|
|
707
|
+
}), $(() => {
|
|
708
|
+
i?.();
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
const Ee = p({
|
|
712
|
+
name: "GridProvider",
|
|
713
|
+
props: {
|
|
714
|
+
/**
|
|
715
|
+
* Type defaults to provide to all descendant grids.
|
|
716
|
+
*/
|
|
717
|
+
typeDefaults: {
|
|
718
|
+
type: Object,
|
|
719
|
+
default: void 0
|
|
720
|
+
},
|
|
721
|
+
/**
|
|
722
|
+
* Icon overrides to provide to all descendant grids.
|
|
723
|
+
*/
|
|
724
|
+
icons: {
|
|
725
|
+
type: Object,
|
|
726
|
+
default: void 0
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
setup(n, { slots: t }) {
|
|
730
|
+
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;
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
export {
|
|
737
|
+
L as GRID_ELEMENT_KEY,
|
|
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,
|
|
748
|
+
be as TbwGridToolPanel,
|
|
749
|
+
oe as VueGridAdapter,
|
|
750
|
+
Te as clearFeatureRegistry,
|
|
751
|
+
J as createPluginFromFeature,
|
|
752
|
+
Be as getFeatureFactory,
|
|
753
|
+
Oe as getRegisteredFeatures,
|
|
754
|
+
_e as isFeatureRegistered,
|
|
755
|
+
je as registerFeature,
|
|
756
|
+
pe as useGrid,
|
|
757
|
+
we as useGridEvent,
|
|
758
|
+
Q as useGridIcons,
|
|
759
|
+
q as useGridTypeDefaults,
|
|
760
|
+
fe as useTypeDefault
|
|
761
|
+
};
|
|
762
|
+
//# sourceMappingURL=index.js.map
|