@toolbox-web/grid-vue 0.0.0 → 0.1.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 +673 -0
- package/index.js.map +1 -0
- package/lib/TbwGrid.vue.d.ts +98 -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 +317 -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 +94 -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,673 @@
|
|
|
1
|
+
import { defineComponent as f, provide as T, inject as _, ref as v, createApp as B, computed as H, onMounted as b, onBeforeUnmount as W, watch as G, createElementBlock as w, openBlock as h, renderSlot as $, useSlots as j, h as y } from "vue";
|
|
2
|
+
import { DataGridElement as Y } from "@toolbox-web/grid";
|
|
3
|
+
import { c as K } from "./chunks/feature-registry-BgEOysSJ.js";
|
|
4
|
+
import { a as Ce, g as Be, b as Oe, i as _e, r as je } from "./chunks/feature-registry-BgEOysSJ.js";
|
|
5
|
+
const I = /* @__PURE__ */ Symbol("grid-icons");
|
|
6
|
+
function J() {
|
|
7
|
+
return _(I, void 0);
|
|
8
|
+
}
|
|
9
|
+
const Q = f({
|
|
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(e, { slots: n }) {
|
|
21
|
+
return T(I, e.icons), () => n.default?.();
|
|
22
|
+
}
|
|
23
|
+
}), z = /* @__PURE__ */ Symbol("grid-type-defaults");
|
|
24
|
+
function N() {
|
|
25
|
+
return _(z, void 0);
|
|
26
|
+
}
|
|
27
|
+
function ue(e) {
|
|
28
|
+
return N()?.[e];
|
|
29
|
+
}
|
|
30
|
+
const X = f({
|
|
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(e, { slots: n }) {
|
|
42
|
+
return T(z, e.defaults), () => n.default?.();
|
|
43
|
+
}
|
|
44
|
+
}), L = /* @__PURE__ */ Symbol("tbw-grid");
|
|
45
|
+
function fe() {
|
|
46
|
+
const e = _(L, v(null));
|
|
47
|
+
return {
|
|
48
|
+
gridElement: e,
|
|
49
|
+
forceLayout: async () => {
|
|
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);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function ee(e, n) {
|
|
68
|
+
const o = e.getAttribute("field"), r = g.get(e) ?? {};
|
|
69
|
+
if (r.editor = n, g.set(e, r), o) {
|
|
70
|
+
const i = p.get(o) ?? {};
|
|
71
|
+
i.editor = n, p.set(o, i);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function te(e) {
|
|
75
|
+
let n = g.get(e)?.renderer;
|
|
76
|
+
if (!n) {
|
|
77
|
+
const o = e.getAttribute("field");
|
|
78
|
+
o && (n = p.get(o)?.renderer);
|
|
79
|
+
}
|
|
80
|
+
return n;
|
|
81
|
+
}
|
|
82
|
+
function ne(e) {
|
|
83
|
+
let n = g.get(e)?.editor;
|
|
84
|
+
if (!n) {
|
|
85
|
+
const o = e.getAttribute("field");
|
|
86
|
+
o && (n = p.get(o)?.editor);
|
|
87
|
+
}
|
|
88
|
+
return n;
|
|
89
|
+
}
|
|
90
|
+
class oe {
|
|
91
|
+
mountedViews = [];
|
|
92
|
+
/**
|
|
93
|
+
* Determines if this adapter can handle the given element.
|
|
94
|
+
* Checks if a renderer or editor is registered for this element.
|
|
95
|
+
*/
|
|
96
|
+
canHandle(n) {
|
|
97
|
+
const o = n.getAttribute("field");
|
|
98
|
+
let r = g.get(n);
|
|
99
|
+
if (!r && o) {
|
|
100
|
+
const l = p.get(o);
|
|
101
|
+
l && (l.renderer || l.editor) && (r = l, g.set(n, r));
|
|
102
|
+
}
|
|
103
|
+
const i = r?.renderer !== void 0, s = r?.editor !== void 0;
|
|
104
|
+
return r !== void 0 && (i || s);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Creates a view renderer function that renders a Vue component
|
|
108
|
+
* and returns its container DOM element.
|
|
109
|
+
*/
|
|
110
|
+
createRenderer(n) {
|
|
111
|
+
const o = te(n);
|
|
112
|
+
if (!o)
|
|
113
|
+
return;
|
|
114
|
+
const r = /* @__PURE__ */ new WeakMap();
|
|
115
|
+
return (i) => {
|
|
116
|
+
const s = i.cellEl;
|
|
117
|
+
if (s) {
|
|
118
|
+
const a = r.get(s);
|
|
119
|
+
if (a)
|
|
120
|
+
return a.update(i), a.container;
|
|
121
|
+
const c = document.createElement("div");
|
|
122
|
+
c.className = "vue-cell-renderer", c.style.display = "contents";
|
|
123
|
+
let u = i;
|
|
124
|
+
const E = B({
|
|
125
|
+
render() {
|
|
126
|
+
return o(u);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return E.mount(c), r.set(s, {
|
|
130
|
+
app: E,
|
|
131
|
+
container: c,
|
|
132
|
+
update: (R) => {
|
|
133
|
+
u = R, E._instance?.update();
|
|
134
|
+
}
|
|
135
|
+
}), c;
|
|
136
|
+
}
|
|
137
|
+
const l = document.createElement("div");
|
|
138
|
+
l.className = "vue-cell-renderer", l.style.display = "contents";
|
|
139
|
+
const d = B({
|
|
140
|
+
render() {
|
|
141
|
+
return o(i);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return d.mount(l), this.mountedViews.push({ app: d, container: l }), l;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Creates an editor spec that renders a Vue component for cell editing.
|
|
149
|
+
* Returns a function that creates the editor DOM element.
|
|
150
|
+
*/
|
|
151
|
+
createEditor(n) {
|
|
152
|
+
const o = ne(n);
|
|
153
|
+
if (o)
|
|
154
|
+
return (r) => {
|
|
155
|
+
const i = document.createElement("div");
|
|
156
|
+
i.className = "vue-cell-editor", i.style.display = "contents";
|
|
157
|
+
const s = B({
|
|
158
|
+
render() {
|
|
159
|
+
return o(r);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return s.mount(i), this.mountedViews.push({ app: s, container: i }), i;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
167
|
+
* Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
|
|
168
|
+
*/
|
|
169
|
+
parseDetailElement(n) {
|
|
170
|
+
const o = n.closest("tbw-grid");
|
|
171
|
+
if (!o) return;
|
|
172
|
+
const r = o.querySelector("tbw-grid-detail");
|
|
173
|
+
if (!r) return;
|
|
174
|
+
const i = q.get(r);
|
|
175
|
+
if (i)
|
|
176
|
+
return (s, l) => {
|
|
177
|
+
const d = document.createElement("div");
|
|
178
|
+
d.className = "vue-detail-panel";
|
|
179
|
+
const c = i({ row: s, rowIndex: l });
|
|
180
|
+
if (c && c.length > 0) {
|
|
181
|
+
const u = B({
|
|
182
|
+
render() {
|
|
183
|
+
return c;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
u.mount(d), this.mountedViews.push({ app: u, container: d });
|
|
187
|
+
}
|
|
188
|
+
return d;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Framework adapter hook called by ResponsivePlugin during attach().
|
|
193
|
+
* Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
|
|
194
|
+
*/
|
|
195
|
+
parseResponsiveCardElement(n) {
|
|
196
|
+
const o = n.closest("tbw-grid");
|
|
197
|
+
if (!o) return;
|
|
198
|
+
const r = o.querySelector("tbw-grid-responsive-card");
|
|
199
|
+
if (!r) return;
|
|
200
|
+
const i = U.get(r);
|
|
201
|
+
if (i)
|
|
202
|
+
return (s, l) => {
|
|
203
|
+
const d = document.createElement("div");
|
|
204
|
+
d.className = "vue-responsive-card";
|
|
205
|
+
const c = i({ row: s, rowIndex: l });
|
|
206
|
+
if (c && c.length > 0) {
|
|
207
|
+
const u = B({
|
|
208
|
+
render() {
|
|
209
|
+
return c;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
u.mount(d), this.mountedViews.push({ app: u, container: d });
|
|
213
|
+
}
|
|
214
|
+
return d;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Cleanup all mounted Vue apps.
|
|
219
|
+
*/
|
|
220
|
+
cleanup() {
|
|
221
|
+
for (const { app: n, container: o } of this.mountedViews)
|
|
222
|
+
try {
|
|
223
|
+
n.unmount(), o.remove();
|
|
224
|
+
} catch {
|
|
225
|
+
}
|
|
226
|
+
this.mountedViews = [];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const ge = /* @__PURE__ */ f({
|
|
230
|
+
__name: "TbwGrid",
|
|
231
|
+
props: {
|
|
232
|
+
/** Row data to display */
|
|
233
|
+
rows: {
|
|
234
|
+
type: Array,
|
|
235
|
+
default: () => []
|
|
236
|
+
},
|
|
237
|
+
/** Column definitions (shorthand for gridConfig.columns) */
|
|
238
|
+
columns: {
|
|
239
|
+
type: Array,
|
|
240
|
+
default: void 0
|
|
241
|
+
},
|
|
242
|
+
/** Full grid configuration */
|
|
243
|
+
gridConfig: {
|
|
244
|
+
type: Object,
|
|
245
|
+
default: void 0
|
|
246
|
+
},
|
|
247
|
+
/** Fit mode shorthand */
|
|
248
|
+
fitMode: {
|
|
249
|
+
type: String,
|
|
250
|
+
default: void 0
|
|
251
|
+
},
|
|
252
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
253
|
+
// FEATURE PROPS - Declarative plugin configuration
|
|
254
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
255
|
+
/** Enable cell/row/range selection */
|
|
256
|
+
selection: {
|
|
257
|
+
type: [String, Object],
|
|
258
|
+
default: void 0
|
|
259
|
+
},
|
|
260
|
+
/** Enable inline cell editing */
|
|
261
|
+
editing: {
|
|
262
|
+
type: [Boolean, String],
|
|
263
|
+
default: void 0
|
|
264
|
+
},
|
|
265
|
+
/** Enable clipboard copy/paste */
|
|
266
|
+
clipboard: {
|
|
267
|
+
type: [Boolean, Object],
|
|
268
|
+
default: void 0
|
|
269
|
+
},
|
|
270
|
+
/** Enable right-click context menu */
|
|
271
|
+
contextMenu: {
|
|
272
|
+
type: [Boolean, Object],
|
|
273
|
+
default: void 0
|
|
274
|
+
},
|
|
275
|
+
/** Enable multi-column sorting */
|
|
276
|
+
multiSort: {
|
|
277
|
+
type: [Boolean, String, Object],
|
|
278
|
+
default: void 0
|
|
279
|
+
},
|
|
280
|
+
/** @deprecated Use multiSort instead */
|
|
281
|
+
sorting: {
|
|
282
|
+
type: [Boolean, String, Object],
|
|
283
|
+
default: void 0
|
|
284
|
+
},
|
|
285
|
+
/** Enable column filtering */
|
|
286
|
+
filtering: {
|
|
287
|
+
type: [Boolean, Object],
|
|
288
|
+
default: void 0
|
|
289
|
+
},
|
|
290
|
+
/** Enable column drag-to-reorder */
|
|
291
|
+
reorder: {
|
|
292
|
+
type: [Boolean, Object],
|
|
293
|
+
default: void 0
|
|
294
|
+
},
|
|
295
|
+
/** Enable column visibility toggle panel */
|
|
296
|
+
visibility: {
|
|
297
|
+
type: [Boolean, Object],
|
|
298
|
+
default: void 0
|
|
299
|
+
},
|
|
300
|
+
/** Enable pinned/sticky columns */
|
|
301
|
+
pinnedColumns: {
|
|
302
|
+
type: Boolean,
|
|
303
|
+
default: void 0
|
|
304
|
+
},
|
|
305
|
+
/** Enable multi-level column headers */
|
|
306
|
+
groupingColumns: {
|
|
307
|
+
type: [Boolean, Object],
|
|
308
|
+
default: void 0
|
|
309
|
+
},
|
|
310
|
+
/** Enable horizontal column virtualization */
|
|
311
|
+
columnVirtualization: {
|
|
312
|
+
type: [Boolean, Object],
|
|
313
|
+
default: void 0
|
|
314
|
+
},
|
|
315
|
+
/** Enable row drag-to-reorder */
|
|
316
|
+
rowReorder: {
|
|
317
|
+
type: [Boolean, Object],
|
|
318
|
+
default: void 0
|
|
319
|
+
},
|
|
320
|
+
/** Enable row grouping by field values */
|
|
321
|
+
groupingRows: {
|
|
322
|
+
type: Object,
|
|
323
|
+
default: void 0
|
|
324
|
+
},
|
|
325
|
+
/** Enable pinned rows */
|
|
326
|
+
pinnedRows: {
|
|
327
|
+
type: [Boolean, Object],
|
|
328
|
+
default: void 0
|
|
329
|
+
},
|
|
330
|
+
/** Enable hierarchical tree view */
|
|
331
|
+
tree: {
|
|
332
|
+
type: [Boolean, Object],
|
|
333
|
+
default: void 0
|
|
334
|
+
},
|
|
335
|
+
/** Enable master-detail expandable rows */
|
|
336
|
+
masterDetail: {
|
|
337
|
+
type: Object,
|
|
338
|
+
default: void 0
|
|
339
|
+
},
|
|
340
|
+
/** Enable responsive card layout */
|
|
341
|
+
responsive: {
|
|
342
|
+
type: [Boolean, Object],
|
|
343
|
+
default: void 0
|
|
344
|
+
},
|
|
345
|
+
/** Enable undo/redo for cell edits */
|
|
346
|
+
undoRedo: {
|
|
347
|
+
type: [Boolean, Object],
|
|
348
|
+
default: void 0
|
|
349
|
+
},
|
|
350
|
+
/** Enable CSV/JSON export */
|
|
351
|
+
export: {
|
|
352
|
+
type: [Boolean, Object],
|
|
353
|
+
default: void 0
|
|
354
|
+
},
|
|
355
|
+
/** Enable print functionality */
|
|
356
|
+
print: {
|
|
357
|
+
type: [Boolean, Object],
|
|
358
|
+
default: void 0
|
|
359
|
+
},
|
|
360
|
+
/** Enable pivot table functionality */
|
|
361
|
+
pivot: {
|
|
362
|
+
type: Object,
|
|
363
|
+
default: void 0
|
|
364
|
+
},
|
|
365
|
+
/** Enable server-side data operations */
|
|
366
|
+
serverSide: {
|
|
367
|
+
type: Object,
|
|
368
|
+
default: void 0
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
emits: ["cell-commit", "row-commit", "cell-click", "cell-dblclick", "selection-change", "row-toggle", "sort-change", "ready"],
|
|
372
|
+
setup(e, { expose: n, emit: o }) {
|
|
373
|
+
let r = !1, i = null;
|
|
374
|
+
function s() {
|
|
375
|
+
return r || (i = new oe(), Y.registerAdapter(i), r = !0), i;
|
|
376
|
+
}
|
|
377
|
+
s();
|
|
378
|
+
const l = e, d = o, a = v(null);
|
|
379
|
+
T(L, a), N();
|
|
380
|
+
const c = J(), u = [
|
|
381
|
+
"selection",
|
|
382
|
+
"editing",
|
|
383
|
+
"clipboard",
|
|
384
|
+
"contextMenu",
|
|
385
|
+
"multiSort",
|
|
386
|
+
"sorting",
|
|
387
|
+
"filtering",
|
|
388
|
+
"reorder",
|
|
389
|
+
"visibility",
|
|
390
|
+
"pinnedColumns",
|
|
391
|
+
"groupingColumns",
|
|
392
|
+
"columnVirtualization",
|
|
393
|
+
"rowReorder",
|
|
394
|
+
"groupingRows",
|
|
395
|
+
"pinnedRows",
|
|
396
|
+
"tree",
|
|
397
|
+
"masterDetail",
|
|
398
|
+
"responsive",
|
|
399
|
+
"undoRedo",
|
|
400
|
+
"export",
|
|
401
|
+
"print",
|
|
402
|
+
"pivot",
|
|
403
|
+
"serverSide"
|
|
404
|
+
];
|
|
405
|
+
function E() {
|
|
406
|
+
const t = [];
|
|
407
|
+
for (const m of u) {
|
|
408
|
+
const O = l[m];
|
|
409
|
+
if (O !== void 0) {
|
|
410
|
+
const C = K(m, O);
|
|
411
|
+
C && t.push(C);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return t;
|
|
415
|
+
}
|
|
416
|
+
const R = H(() => {
|
|
417
|
+
const t = l.gridConfig ?? {}, m = E(), O = t.plugins ?? [], C = [...m, ...O], V = c ? { ...t.icons, ...c } : t.icons;
|
|
418
|
+
return {
|
|
419
|
+
...t,
|
|
420
|
+
...l.columns ? { columns: l.columns } : {},
|
|
421
|
+
...C.length > 0 ? { plugins: C } : {},
|
|
422
|
+
...V ? { icons: V } : {}
|
|
423
|
+
};
|
|
424
|
+
});
|
|
425
|
+
function S(t) {
|
|
426
|
+
d("cell-commit", t);
|
|
427
|
+
}
|
|
428
|
+
function k(t) {
|
|
429
|
+
d("row-commit", t);
|
|
430
|
+
}
|
|
431
|
+
function P(t) {
|
|
432
|
+
d("cell-click", t);
|
|
433
|
+
}
|
|
434
|
+
function x(t) {
|
|
435
|
+
d("cell-dblclick", t);
|
|
436
|
+
}
|
|
437
|
+
function D(t) {
|
|
438
|
+
d("selection-change", t);
|
|
439
|
+
}
|
|
440
|
+
function F(t) {
|
|
441
|
+
d("row-toggle", t);
|
|
442
|
+
}
|
|
443
|
+
function A(t) {
|
|
444
|
+
d("sort-change", t);
|
|
445
|
+
}
|
|
446
|
+
function M(t) {
|
|
447
|
+
d("ready", t);
|
|
448
|
+
}
|
|
449
|
+
return b(() => {
|
|
450
|
+
const t = a.value;
|
|
451
|
+
if (!t) return;
|
|
452
|
+
const m = s();
|
|
453
|
+
t.__frameworkAdapter = m, t.addEventListener("cell-commit", S), t.addEventListener("row-commit", k), t.addEventListener("cell-click", P), t.addEventListener("cell-dblclick", x), t.addEventListener("selection-change", D), t.addEventListener("row-toggle", F), t.addEventListener("sort-change", A), t.addEventListener("ready", M), l.rows.length > 0 && (t.rows = l.rows), R.value && (t.gridConfig = R.value), l.fitMode && (t.fitMode = l.fitMode);
|
|
454
|
+
}), W(() => {
|
|
455
|
+
const t = a.value;
|
|
456
|
+
t && (t.removeEventListener("cell-commit", S), t.removeEventListener("row-commit", k), t.removeEventListener("cell-click", P), t.removeEventListener("cell-dblclick", x), t.removeEventListener("selection-change", D), t.removeEventListener("row-toggle", F), t.removeEventListener("sort-change", A), t.removeEventListener("ready", M));
|
|
457
|
+
}), G(
|
|
458
|
+
() => l.rows,
|
|
459
|
+
(t) => {
|
|
460
|
+
a.value && (a.value.rows = t);
|
|
461
|
+
},
|
|
462
|
+
{ deep: !0 }
|
|
463
|
+
), G(
|
|
464
|
+
R,
|
|
465
|
+
(t) => {
|
|
466
|
+
a.value && t && (a.value.gridConfig = t);
|
|
467
|
+
},
|
|
468
|
+
{ deep: !0 }
|
|
469
|
+
), G(
|
|
470
|
+
() => l.fitMode,
|
|
471
|
+
(t) => {
|
|
472
|
+
a.value && t && (a.value.fitMode = t);
|
|
473
|
+
}
|
|
474
|
+
), n({
|
|
475
|
+
/** The underlying grid element */
|
|
476
|
+
gridElement: a,
|
|
477
|
+
/** Force a layout recalculation */
|
|
478
|
+
forceLayout: () => a.value?.forceLayout(),
|
|
479
|
+
/** Get current grid configuration */
|
|
480
|
+
getConfig: () => a.value?.getConfig(),
|
|
481
|
+
/** Wait for grid to be ready */
|
|
482
|
+
ready: () => a.value?.ready()
|
|
483
|
+
}), (t, m) => (h(), w("tbw-grid", {
|
|
484
|
+
ref_key: "gridRef",
|
|
485
|
+
ref: a
|
|
486
|
+
}, [
|
|
487
|
+
$(t.$slots, "default")
|
|
488
|
+
], 512));
|
|
489
|
+
}
|
|
490
|
+
}), re = ["field", "header", "width", "min-width", "max-width", "sortable", "resizable", "editable", "type", "align", "hidden"], me = /* @__PURE__ */ f({
|
|
491
|
+
__name: "TbwGridColumn",
|
|
492
|
+
props: {
|
|
493
|
+
field: {},
|
|
494
|
+
header: {},
|
|
495
|
+
width: {},
|
|
496
|
+
minWidth: {},
|
|
497
|
+
maxWidth: {},
|
|
498
|
+
sortable: { type: Boolean },
|
|
499
|
+
resizable: { type: Boolean },
|
|
500
|
+
editable: { type: Boolean },
|
|
501
|
+
type: {},
|
|
502
|
+
align: {},
|
|
503
|
+
hidden: { type: Boolean }
|
|
504
|
+
},
|
|
505
|
+
setup(e) {
|
|
506
|
+
const n = j(), o = v(null);
|
|
507
|
+
return b(() => {
|
|
508
|
+
const r = o.value;
|
|
509
|
+
if (!r) return;
|
|
510
|
+
const i = !!n.cell, s = !!n.editor;
|
|
511
|
+
i && Z(r, (l) => {
|
|
512
|
+
const d = n.cell;
|
|
513
|
+
if (!d) return y("span");
|
|
514
|
+
const a = d({
|
|
515
|
+
value: l.value,
|
|
516
|
+
row: l.row,
|
|
517
|
+
column: l.column
|
|
518
|
+
});
|
|
519
|
+
return y("div", { style: "display: contents" }, a);
|
|
520
|
+
}), s && ee(r, (l) => {
|
|
521
|
+
const d = n.editor;
|
|
522
|
+
if (!d) return y("span");
|
|
523
|
+
const a = d({
|
|
524
|
+
value: l.value,
|
|
525
|
+
row: l.row,
|
|
526
|
+
column: l.column,
|
|
527
|
+
commit: l.commit,
|
|
528
|
+
cancel: l.cancel
|
|
529
|
+
});
|
|
530
|
+
return y("div", { style: "display: contents" }, a);
|
|
531
|
+
});
|
|
532
|
+
}), (r, i) => (h(), w("tbw-grid-column", {
|
|
533
|
+
ref_key: "columnRef",
|
|
534
|
+
ref: o,
|
|
535
|
+
field: e.field,
|
|
536
|
+
header: e.header,
|
|
537
|
+
width: e.width,
|
|
538
|
+
"min-width": e.minWidth,
|
|
539
|
+
"max-width": e.maxWidth,
|
|
540
|
+
sortable: e.sortable,
|
|
541
|
+
resizable: e.resizable,
|
|
542
|
+
editable: e.editable,
|
|
543
|
+
type: e.type,
|
|
544
|
+
align: e.align,
|
|
545
|
+
hidden: e.hidden
|
|
546
|
+
}, null, 8, re));
|
|
547
|
+
}
|
|
548
|
+
}), ie = ["show-expand-column", "animation"], pe = /* @__PURE__ */ f({
|
|
549
|
+
__name: "TbwGridDetailPanel",
|
|
550
|
+
props: {
|
|
551
|
+
showExpandColumn: { type: Boolean, default: !0 },
|
|
552
|
+
animation: { type: [String, Boolean], default: "slide" }
|
|
553
|
+
},
|
|
554
|
+
setup(e) {
|
|
555
|
+
const n = v(null), o = j();
|
|
556
|
+
return b(() => {
|
|
557
|
+
const r = n.value;
|
|
558
|
+
!r || !o.default || q.set(r, (i) => o.default?.(i));
|
|
559
|
+
}), (r, i) => (h(), w("tbw-grid-detail", {
|
|
560
|
+
ref_key: "detailRef",
|
|
561
|
+
ref: n,
|
|
562
|
+
"show-expand-column": e.showExpandColumn,
|
|
563
|
+
animation: e.animation
|
|
564
|
+
}, null, 8, ie));
|
|
565
|
+
}
|
|
566
|
+
}), ve = /* @__PURE__ */ f({
|
|
567
|
+
__name: "TbwGridResponsiveCard",
|
|
568
|
+
setup(e) {
|
|
569
|
+
const n = v(null), o = j();
|
|
570
|
+
return b(() => {
|
|
571
|
+
const r = n.value;
|
|
572
|
+
!r || !o.default || U.set(r, (i) => o.default?.(i));
|
|
573
|
+
}), (r, i) => (h(), w("tbw-grid-responsive-card", {
|
|
574
|
+
ref_key: "cardRef",
|
|
575
|
+
ref: n
|
|
576
|
+
}, null, 512));
|
|
577
|
+
}
|
|
578
|
+
}), ye = /* @__PURE__ */ f({
|
|
579
|
+
__name: "TbwGridToolButtons",
|
|
580
|
+
setup(e) {
|
|
581
|
+
return (n, o) => (h(), w("tbw-grid-tool-buttons", null, [
|
|
582
|
+
$(n.$slots, "default")
|
|
583
|
+
]));
|
|
584
|
+
}
|
|
585
|
+
}), le = /* @__PURE__ */ new WeakMap(), de = ["id", "label", "icon", "position", "width"], be = /* @__PURE__ */ f({
|
|
586
|
+
__name: "TbwGridToolPanel",
|
|
587
|
+
props: {
|
|
588
|
+
id: {},
|
|
589
|
+
label: {},
|
|
590
|
+
icon: {},
|
|
591
|
+
position: { default: "right" },
|
|
592
|
+
width: { default: "250px" }
|
|
593
|
+
},
|
|
594
|
+
setup(e) {
|
|
595
|
+
const n = v(null), o = j();
|
|
596
|
+
return b(() => {
|
|
597
|
+
const r = n.value;
|
|
598
|
+
!r || !o.default || le.set(r, (i) => o.default?.(i));
|
|
599
|
+
}), (r, i) => (h(), w("tbw-grid-tool-panel", {
|
|
600
|
+
ref_key: "panelRef",
|
|
601
|
+
ref: n,
|
|
602
|
+
id: e.id,
|
|
603
|
+
label: e.label,
|
|
604
|
+
icon: e.icon,
|
|
605
|
+
position: e.position,
|
|
606
|
+
width: e.width
|
|
607
|
+
}, null, 8, de));
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
function we(e, n, o) {
|
|
611
|
+
const r = o ?? _(L, v(null));
|
|
612
|
+
let i = null;
|
|
613
|
+
b(() => {
|
|
614
|
+
const s = r.value;
|
|
615
|
+
if (!s) return;
|
|
616
|
+
const l = n;
|
|
617
|
+
s.addEventListener(e, l), i = () => s.removeEventListener(e, l);
|
|
618
|
+
}), W(() => {
|
|
619
|
+
i?.();
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
const he = f({
|
|
623
|
+
name: "GridProvider",
|
|
624
|
+
props: {
|
|
625
|
+
/**
|
|
626
|
+
* Type defaults to provide to all descendant grids.
|
|
627
|
+
*/
|
|
628
|
+
typeDefaults: {
|
|
629
|
+
type: Object,
|
|
630
|
+
default: void 0
|
|
631
|
+
},
|
|
632
|
+
/**
|
|
633
|
+
* Icon overrides to provide to all descendant grids.
|
|
634
|
+
*/
|
|
635
|
+
icons: {
|
|
636
|
+
type: Object,
|
|
637
|
+
default: void 0
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
setup(e, { slots: n }) {
|
|
641
|
+
return () => {
|
|
642
|
+
let o = n.default?.();
|
|
643
|
+
return e.typeDefaults && (o = y(X, { defaults: e.typeDefaults }, () => o)), e.icons && (o = y(Q, { icons: e.icons }, () => o)), o;
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
export {
|
|
648
|
+
L as GRID_ELEMENT_KEY,
|
|
649
|
+
I as GRID_ICONS,
|
|
650
|
+
z as GRID_TYPE_DEFAULTS,
|
|
651
|
+
Q as GridIconProvider,
|
|
652
|
+
he as GridProvider,
|
|
653
|
+
X as GridTypeProvider,
|
|
654
|
+
ge as TbwGrid,
|
|
655
|
+
me as TbwGridColumn,
|
|
656
|
+
pe as TbwGridDetailPanel,
|
|
657
|
+
ve as TbwGridResponsiveCard,
|
|
658
|
+
ye as TbwGridToolButtons,
|
|
659
|
+
be as TbwGridToolPanel,
|
|
660
|
+
oe as VueGridAdapter,
|
|
661
|
+
Ce as clearFeatureRegistry,
|
|
662
|
+
K as createPluginFromFeature,
|
|
663
|
+
Be as getFeatureFactory,
|
|
664
|
+
Oe as getRegisteredFeatures,
|
|
665
|
+
_e as isFeatureRegistered,
|
|
666
|
+
je as registerFeature,
|
|
667
|
+
fe as useGrid,
|
|
668
|
+
we as useGridEvent,
|
|
669
|
+
J as useGridIcons,
|
|
670
|
+
N as useGridTypeDefaults,
|
|
671
|
+
ue as useTypeDefault
|
|
672
|
+
};
|
|
673
|
+
//# sourceMappingURL=index.js.map
|