@affino/datagrid-vue-app 0.1.1 → 0.1.2
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/dist/DataGrid.d.ts +9 -9
- package/dist/DataGridTableStage.vue.d.ts +112 -0
- package/dist/chunks/useDataGridAppRowModel-CcTL-h8L.js +11251 -0
- package/dist/gantt/DataGridGanttStage.vue.d.ts +21 -0
- package/dist/host/DataGridDefaultRenderer.d.ts +3 -3
- package/dist/host/DataGridRuntimeHost.d.ts +1 -1
- package/dist/index.js +1125 -4
- package/dist/internal.js +37 -14
- package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridAggregationsPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridCellComboboxEditor.vue.d.ts +29 -0
- package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +51 -0
- package/dist/overlays/DataGridColumnMenu.vue.d.ts +65 -0
- package/dist/overlays/DataGridFilterableCombobox.vue.d.ts +76 -0
- package/dist/stage/DataGridTableStage.vue.d.ts +115 -0
- package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +121 -0
- package/dist/stage/DataGridTableStageFillActionMenu.vue.d.ts +30 -0
- package/dist/stage/DataGridTableStageHeader.vue.d.ts +84 -0
- package/dist/stage/DataGridTableStageOverlayLayer.vue.d.ts +34 -0
- package/dist/stage/DataGridTableStagePinnedPane.vue.d.ts +43 -0
- package/package.json +8 -5
- package/dist/DataGrid.js +0 -565
- package/dist/DataGridDefaultRenderer.js +0 -2
- package/dist/DataGridModuleHost.js +0 -2
- package/dist/DataGridRuntimeHost.js +0 -1
- package/dist/config/dataGridAdvancedFilter.js +0 -21
- package/dist/config/dataGridAggregations.js +0 -21
- package/dist/config/dataGridColumnLayout.js +0 -21
- package/dist/config/dataGridFormulaOptions.js +0 -137
- package/dist/config/dataGridPublicProps.js +0 -58
- package/dist/config/dataGridSavedView.js +0 -73
- package/dist/config/dataGridVirtualization.js +0 -32
- package/dist/dataGridAdvancedFilter.js +0 -1
- package/dist/dataGridAggregations.js +0 -1
- package/dist/dataGridAppContext.js +0 -1
- package/dist/dataGridCellComboboxState.d.ts +0 -10
- package/dist/dataGridCellComboboxState.js +0 -67
- package/dist/dataGridColumnLayout.js +0 -1
- package/dist/dataGridColumnMenu.d.ts +0 -9
- package/dist/dataGridColumnMenu.js +0 -21
- package/dist/dataGridEditability.js +0 -1
- package/dist/dataGridFilterableCombobox.js +0 -1
- package/dist/dataGridFormulaOptions.js +0 -1
- package/dist/dataGridGantt.d.ts +0 -3
- package/dist/dataGridGantt.js +0 -1
- package/dist/dataGridGanttDependencySelection.d.ts +0 -7
- package/dist/dataGridGanttDependencySelection.js +0 -46
- package/dist/dataGridGanttLabel.d.ts +0 -2
- package/dist/dataGridGanttLabel.js +0 -30
- package/dist/dataGridGanttSplit.d.ts +0 -20
- package/dist/dataGridGanttSplit.js +0 -31
- package/dist/dataGridGanttWheel.d.ts +0 -10
- package/dist/dataGridGanttWheel.js +0 -30
- package/dist/dataGridOverlayThemeVars.d.ts +0 -1
- package/dist/dataGridOverlayThemeVars.js +0 -32
- package/dist/dataGridPublicProps.js +0 -1
- package/dist/dataGridTableStage.types.js +0 -1
- package/dist/dataGridTableStageBody.types.js +0 -1
- package/dist/dataGridTableStageContext.js +0 -1
- package/dist/dataGridTheme.js +0 -1
- package/dist/dataGridVirtualization.js +0 -1
- package/dist/ensureDataGridAppStyles.js +0 -1
- package/dist/gantt/dataGridGantt.js +0 -1
- package/dist/gantt/dataGridGanttDependencySelection.js +0 -46
- package/dist/gantt/dataGridGanttLabel.js +0 -30
- package/dist/gantt/dataGridGanttSplit.js +0 -31
- package/dist/gantt/dataGridGanttWheel.js +0 -30
- package/dist/host/DataGridDefaultRenderer.js +0 -1847
- package/dist/host/DataGridModuleHost.js +0 -23
- package/dist/host/DataGridRuntimeHost.js +0 -174
- package/dist/overlays/dataGridCellComboboxState.js +0 -67
- package/dist/overlays/dataGridColumnMenu.js +0 -190
- package/dist/overlays/dataGridContextMenu.js +0 -218
- package/dist/overlays/dataGridFilterableCombobox.js +0 -74
- package/dist/overlays/dataGridOverlayThemeVars.js +0 -32
- package/dist/stage/dataGridTableStage.types.js +0 -1
- package/dist/stage/dataGridTableStageBody.types.js +0 -1
- package/dist/stage/dataGridTableStageContext.js +0 -88
- package/dist/stage/useDataGridTableStageBindings.js +0 -162
- package/dist/stage/useDataGridTableStageCellIo.js +0 -62
- package/dist/stage/useDataGridTableStageColumns.js +0 -124
- package/dist/stage/useDataGridTableStageFillAction.js +0 -28
- package/dist/stage/useDataGridTableStageHistory.js +0 -46
- package/dist/stage/useDataGridTableStageRowSelection.js +0 -107
- package/dist/stage/useDataGridTableStageRuntime.js +0 -526
- package/dist/stage/useDataGridTableStageScrollSync.js +0 -49
- package/dist/stage/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/stage/useDataGridTableStageVisualSelection.js +0 -83
- package/dist/theme/dataGridTheme.js +0 -84
- package/dist/theme/ensureDataGridAppStyles.js +0 -2656
- package/dist/useDataGridAppControlledState.js +0 -390
- package/dist/useDataGridAppRowModel.js +0 -85
- package/dist/useDataGridTableStageBindings.js +0 -1
- package/dist/useDataGridTableStageCellIo.d.ts +0 -28
- package/dist/useDataGridTableStageCellIo.js +0 -62
- package/dist/useDataGridTableStageColumns.d.ts +0 -21
- package/dist/useDataGridTableStageColumns.js +0 -122
- package/dist/useDataGridTableStageFillAction.d.ts +0 -19
- package/dist/useDataGridTableStageFillAction.js +0 -28
- package/dist/useDataGridTableStageHistory.d.ts +0 -31
- package/dist/useDataGridTableStageHistory.js +0 -46
- package/dist/useDataGridTableStageRowSelection.d.ts +0 -28
- package/dist/useDataGridTableStageRowSelection.js +0 -103
- package/dist/useDataGridTableStageRuntime.js +0 -1
- package/dist/useDataGridTableStageScrollSync.d.ts +0 -17
- package/dist/useDataGridTableStageScrollSync.js +0 -49
- package/dist/useDataGridTableStageViewportKeyboard.d.ts +0 -20
- package/dist/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/useDataGridTableStageVisualSelection.d.ts +0 -24
- package/dist/useDataGridTableStageVisualSelection.js +0 -70
package/dist/index.js
CHANGED
|
@@ -1,4 +1,1125 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineComponent as ae, ref as X, provide as ge, computed as g, watch as w, onBeforeUnmount as Z, h as Y, mergeProps as ve, toRef as te } from "vue";
|
|
2
|
+
import { useDataGridRuntime as ye, useDataGridAppSelection as pe, useDataGridAppRowSelection as we } from "@affino/datagrid-vue";
|
|
3
|
+
import { f as Se, z as he, A as be, B as Re, h as Me, C as Oe, u as Be, D as Ae } from "./chunks/useDataGridAppRowModel-CcTL-h8L.js";
|
|
4
|
+
import { applyGridTheme as Ce, resolveGridThemeTokens as Pe, defaultStyleConfig as B, sugarTheme as ie, industrialNeutralTheme as oe } from "@affino/datagrid-theme";
|
|
5
|
+
const Ge = {
|
|
6
|
+
default: B,
|
|
7
|
+
"industrial-neutral": oe,
|
|
8
|
+
industrialNeutral: oe,
|
|
9
|
+
sugar: ie
|
|
10
|
+
};
|
|
11
|
+
function De(e, t) {
|
|
12
|
+
if (!e && !t)
|
|
13
|
+
return;
|
|
14
|
+
const r = {
|
|
15
|
+
...e ?? {}
|
|
16
|
+
};
|
|
17
|
+
for (const [n, f] of Object.entries(t ?? {}))
|
|
18
|
+
r[n] = {
|
|
19
|
+
...r[n] ?? {},
|
|
20
|
+
...f
|
|
21
|
+
};
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
function _(e, t) {
|
|
25
|
+
return {
|
|
26
|
+
...e,
|
|
27
|
+
...t,
|
|
28
|
+
grid: { ...e.grid ?? {}, ...t.grid ?? {} },
|
|
29
|
+
header: { ...e.header ?? {}, ...t.header ?? {} },
|
|
30
|
+
body: { ...e.body ?? {}, ...t.body ?? {} },
|
|
31
|
+
group: { ...e.group ?? {}, ...t.group ?? {} },
|
|
32
|
+
summary: { ...e.summary ?? {}, ...t.summary ?? {} },
|
|
33
|
+
state: { ...e.state ?? {}, ...t.state ?? {} },
|
|
34
|
+
tokens: { ...e.tokens ?? {}, ...t.tokens ?? {} },
|
|
35
|
+
tokenVariants: De(e.tokenVariants, t.tokenVariants)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function xe(e) {
|
|
39
|
+
return !e || typeof e != "object" ? !1 : "tokens" in e || "tokenVariants" in e || "activeTokenVariant" in e || "defaultTokenVariant" in e || "inheritThemeFromDocument" in e || "documentDarkClass" in e || "grid" in e || "header" in e || "body" in e || "group" in e || "summary" in e || "state" in e;
|
|
40
|
+
}
|
|
41
|
+
function Ie(e) {
|
|
42
|
+
return e == null ? B : typeof e == "string" ? e === "sugar" ? _(B, ie) : Ge[e] ?? B : xe(e) ? _(B, e) : _(B, {
|
|
43
|
+
tokens: e
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function Le(e) {
|
|
47
|
+
const t = Ie(e);
|
|
48
|
+
return Pe(t ?? B, {
|
|
49
|
+
document: typeof document > "u" ? void 0 : document
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function ne(e, t) {
|
|
53
|
+
const r = Le(t);
|
|
54
|
+
return Ce(e, r), r;
|
|
55
|
+
}
|
|
56
|
+
function re(e, t) {
|
|
57
|
+
return Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t;
|
|
58
|
+
}
|
|
59
|
+
function le(e, t) {
|
|
60
|
+
return Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : t;
|
|
61
|
+
}
|
|
62
|
+
function je(e) {
|
|
63
|
+
if (e !== void 0) {
|
|
64
|
+
if (e == null)
|
|
65
|
+
return null;
|
|
66
|
+
if (typeof e == "string") {
|
|
67
|
+
const t = e.trim();
|
|
68
|
+
return t ? { fields: [t], expandedByDefault: !0 } : null;
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(e)) {
|
|
71
|
+
const t = e.map((r) => r.trim()).filter((r) => r.length > 0);
|
|
72
|
+
return t.length > 0 ? { fields: [...t], expandedByDefault: !0 } : null;
|
|
73
|
+
}
|
|
74
|
+
return e;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function Ke(e, t) {
|
|
78
|
+
return t === !0 || t && typeof t == "object" ? "pagination" : e ?? "virtualization";
|
|
79
|
+
}
|
|
80
|
+
function Fe(e, t, r, n) {
|
|
81
|
+
if (t !== "pagination")
|
|
82
|
+
return null;
|
|
83
|
+
const f = 100, u = le(r, f), p = re(n, 0);
|
|
84
|
+
return e === !0 || e === !1 || e == null ? {
|
|
85
|
+
pageSize: u,
|
|
86
|
+
currentPage: p
|
|
87
|
+
} : {
|
|
88
|
+
pageSize: le(r ?? e.pageSize, f),
|
|
89
|
+
currentPage: re(n ?? e.currentPage, 0)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const J = "Advanced filter";
|
|
93
|
+
function Te(e) {
|
|
94
|
+
return typeof e == "boolean" ? {
|
|
95
|
+
enabled: e,
|
|
96
|
+
buttonLabel: J
|
|
97
|
+
} : e ? {
|
|
98
|
+
enabled: e.enabled ?? !0,
|
|
99
|
+
buttonLabel: typeof e.buttonLabel == "string" && e.buttonLabel.trim().length > 0 ? e.buttonLabel.trim() : J
|
|
100
|
+
} : {
|
|
101
|
+
enabled: !1,
|
|
102
|
+
buttonLabel: J
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function We(e) {
|
|
106
|
+
return typeof e == "object" && e !== null;
|
|
107
|
+
}
|
|
108
|
+
function ue(e, t, r) {
|
|
109
|
+
const n = We(e) ? e : null, f = t(n && "state" in n ? n.state : e, r);
|
|
110
|
+
if (!f)
|
|
111
|
+
return null;
|
|
112
|
+
const u = n?.viewMode, p = u === "gantt" ? "gantt" : u === "table" ? "table" : void 0;
|
|
113
|
+
return {
|
|
114
|
+
state: f,
|
|
115
|
+
...p ? { viewMode: p } : {}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function ze(e) {
|
|
119
|
+
return JSON.stringify(e);
|
|
120
|
+
}
|
|
121
|
+
function Ve(e, t, r) {
|
|
122
|
+
if (typeof e != "string" || e.trim().length === 0)
|
|
123
|
+
return null;
|
|
124
|
+
try {
|
|
125
|
+
return ue(JSON.parse(e), t, r);
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function tt(e, t, r) {
|
|
131
|
+
if (!e || typeof t != "string" || t.trim().length === 0)
|
|
132
|
+
return !1;
|
|
133
|
+
try {
|
|
134
|
+
return e.setItem(t, ze(r)), !0;
|
|
135
|
+
} catch {
|
|
136
|
+
return !1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function ot(e, t, r, n) {
|
|
140
|
+
if (!e || typeof t != "string" || t.trim().length === 0)
|
|
141
|
+
return null;
|
|
142
|
+
try {
|
|
143
|
+
const f = e.getItem(t);
|
|
144
|
+
return f ? Ve(f, r, n) : null;
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function nt(e, t) {
|
|
150
|
+
if (!e || typeof t != "string" || t.trim().length === 0)
|
|
151
|
+
return !1;
|
|
152
|
+
try {
|
|
153
|
+
return e.removeItem(t), !0;
|
|
154
|
+
} catch {
|
|
155
|
+
return !1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const $ = "Columns";
|
|
159
|
+
function He(e) {
|
|
160
|
+
return typeof e == "boolean" ? {
|
|
161
|
+
enabled: e,
|
|
162
|
+
buttonLabel: $
|
|
163
|
+
} : e ? {
|
|
164
|
+
enabled: e.enabled ?? !0,
|
|
165
|
+
buttonLabel: typeof e.buttonLabel == "string" && e.buttonLabel.trim().length > 0 ? e.buttonLabel.trim() : $
|
|
166
|
+
} : {
|
|
167
|
+
enabled: !1,
|
|
168
|
+
buttonLabel: $
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const q = "Aggregations";
|
|
172
|
+
function Ee(e) {
|
|
173
|
+
return typeof e == "boolean" ? {
|
|
174
|
+
enabled: e,
|
|
175
|
+
buttonLabel: q
|
|
176
|
+
} : e ? {
|
|
177
|
+
enabled: e.enabled ?? !0,
|
|
178
|
+
buttonLabel: typeof e.buttonLabel == "string" && e.buttonLabel.trim().length > 0 ? e.buttonLabel.trim() : q
|
|
179
|
+
} : {
|
|
180
|
+
enabled: !1,
|
|
181
|
+
buttonLabel: q
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function T(e, t) {
|
|
185
|
+
return Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t;
|
|
186
|
+
}
|
|
187
|
+
function ke(e, t) {
|
|
188
|
+
const r = {
|
|
189
|
+
rows: !0,
|
|
190
|
+
columns: !1,
|
|
191
|
+
rowOverscan: 8,
|
|
192
|
+
columnOverscan: 2
|
|
193
|
+
};
|
|
194
|
+
if (e === !0)
|
|
195
|
+
r.columns = !0;
|
|
196
|
+
else if (e === !1)
|
|
197
|
+
r.rows = !1, r.columns = !1;
|
|
198
|
+
else if (e && typeof e == "object") {
|
|
199
|
+
r.rows = e.rows ?? r.rows, r.columns = e.columns ?? r.columns;
|
|
200
|
+
const n = T(e.overscan, r.rowOverscan);
|
|
201
|
+
r.rowOverscan = T(e.rowOverscan, n), r.columnOverscan = T(e.columnOverscan, T(e.overscan, r.columnOverscan));
|
|
202
|
+
}
|
|
203
|
+
return t === "pagination" && (r.rows = !1), r;
|
|
204
|
+
}
|
|
205
|
+
const Ne = ae({
|
|
206
|
+
name: "DataGridRuntimeHost",
|
|
207
|
+
inheritAttrs: !1,
|
|
208
|
+
props: {
|
|
209
|
+
rows: {
|
|
210
|
+
type: Array,
|
|
211
|
+
default: () => []
|
|
212
|
+
},
|
|
213
|
+
rowModel: {
|
|
214
|
+
type: Object,
|
|
215
|
+
default: void 0
|
|
216
|
+
},
|
|
217
|
+
columns: {
|
|
218
|
+
type: Array,
|
|
219
|
+
default: () => []
|
|
220
|
+
},
|
|
221
|
+
theme: {
|
|
222
|
+
type: [String, Object],
|
|
223
|
+
default: void 0
|
|
224
|
+
},
|
|
225
|
+
plugins: {
|
|
226
|
+
type: Array,
|
|
227
|
+
default: () => []
|
|
228
|
+
},
|
|
229
|
+
services: {
|
|
230
|
+
type: Object,
|
|
231
|
+
default: void 0
|
|
232
|
+
},
|
|
233
|
+
startupOrder: {
|
|
234
|
+
type: Array,
|
|
235
|
+
default: void 0
|
|
236
|
+
},
|
|
237
|
+
autoStart: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: !0
|
|
240
|
+
},
|
|
241
|
+
renderMode: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: "virtualization"
|
|
244
|
+
},
|
|
245
|
+
pagination: {
|
|
246
|
+
type: Object,
|
|
247
|
+
default: null
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
emits: ["cell-change", "selection-change"],
|
|
251
|
+
setup(e, { attrs: t, slots: r, emit: n, expose: f }) {
|
|
252
|
+
const u = X(null);
|
|
253
|
+
ge(Se, u);
|
|
254
|
+
let p = null;
|
|
255
|
+
const a = ye({
|
|
256
|
+
rows: g(() => e.rows),
|
|
257
|
+
rowModel: e.rowModel,
|
|
258
|
+
columns: g(() => e.columns),
|
|
259
|
+
plugins: e.plugins,
|
|
260
|
+
services: e.services,
|
|
261
|
+
startupOrder: e.startupOrder,
|
|
262
|
+
autoStart: e.autoStart
|
|
263
|
+
}), h = a, b = {
|
|
264
|
+
api: a.api,
|
|
265
|
+
syncBodyRowsInRange: a.syncBodyRowsInRange,
|
|
266
|
+
rowPartition: a.rowPartition,
|
|
267
|
+
virtualWindow: a.virtualWindow,
|
|
268
|
+
columnSnapshot: a.columnSnapshot,
|
|
269
|
+
getBodyRowAtIndex: h.getBodyRowAtIndex,
|
|
270
|
+
resolveBodyRowIndexById: h.resolveBodyRowIndexById
|
|
271
|
+
}, M = () => {
|
|
272
|
+
if (e.renderMode === "pagination") {
|
|
273
|
+
const y = e.pagination ?? { pageSize: 100, currentPage: 0 };
|
|
274
|
+
a.api.rows.setPagination({
|
|
275
|
+
pageSize: Math.max(1, Math.trunc(y.pageSize)),
|
|
276
|
+
currentPage: Math.max(0, Math.trunc(y.currentPage))
|
|
277
|
+
});
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
a.api.rows.setPagination(null);
|
|
281
|
+
};
|
|
282
|
+
w(
|
|
283
|
+
() => e.renderMode,
|
|
284
|
+
() => {
|
|
285
|
+
M();
|
|
286
|
+
},
|
|
287
|
+
{ immediate: !0 }
|
|
288
|
+
), w(
|
|
289
|
+
() => e.pagination,
|
|
290
|
+
() => {
|
|
291
|
+
M();
|
|
292
|
+
},
|
|
293
|
+
{ immediate: !0, deep: !0 }
|
|
294
|
+
), typeof document < "u" && (p = new MutationObserver(() => {
|
|
295
|
+
const y = u.value;
|
|
296
|
+
y && ne(y, e.theme);
|
|
297
|
+
}), p.observe(document.documentElement, {
|
|
298
|
+
attributes: !0,
|
|
299
|
+
attributeFilter: ["class", "data-theme"]
|
|
300
|
+
})), w(
|
|
301
|
+
[() => e.theme, u],
|
|
302
|
+
() => {
|
|
303
|
+
const y = u.value;
|
|
304
|
+
y && ne(y, e.theme);
|
|
305
|
+
},
|
|
306
|
+
{ immediate: !0, deep: !0 }
|
|
307
|
+
);
|
|
308
|
+
const A = a.api.events.on("rows:changed", (y) => {
|
|
309
|
+
n("cell-change", y);
|
|
310
|
+
}), C = a.api.events.on("selection:changed", (y) => {
|
|
311
|
+
n("selection-change", y);
|
|
312
|
+
});
|
|
313
|
+
Z(() => {
|
|
314
|
+
A(), C(), p?.disconnect(), p = null;
|
|
315
|
+
});
|
|
316
|
+
const v = g(() => {
|
|
317
|
+
const y = a.virtualWindow.value;
|
|
318
|
+
return {
|
|
319
|
+
...y ?? {},
|
|
320
|
+
rowTotal: y?.rowTotal ?? a.rowPartition.value.bodyRowCount,
|
|
321
|
+
colTotal: a.columnSnapshot.value.visibleColumns.length
|
|
322
|
+
};
|
|
323
|
+
});
|
|
324
|
+
return f({
|
|
325
|
+
api: a.api,
|
|
326
|
+
core: a.core,
|
|
327
|
+
runtime: b,
|
|
328
|
+
rowModel: a.rowModel,
|
|
329
|
+
columnModel: a.columnModel,
|
|
330
|
+
columnSnapshot: a.columnSnapshot,
|
|
331
|
+
rowPartition: a.rowPartition,
|
|
332
|
+
setRows: a.setRows,
|
|
333
|
+
syncBodyRowsInRange: a.syncBodyRowsInRange,
|
|
334
|
+
getBodyRowAtIndex: h.getBodyRowAtIndex,
|
|
335
|
+
resolveBodyRowIndexById: h.resolveBodyRowIndexById,
|
|
336
|
+
virtualWindow: a.virtualWindow,
|
|
337
|
+
start: a.start,
|
|
338
|
+
stop: a.stop
|
|
339
|
+
}), () => Y(
|
|
340
|
+
"div",
|
|
341
|
+
ve(t, {
|
|
342
|
+
ref: u,
|
|
343
|
+
class: "affino-datagrid-app-root",
|
|
344
|
+
style: {
|
|
345
|
+
display: "flex",
|
|
346
|
+
flex: "1 1 auto",
|
|
347
|
+
width: "100%",
|
|
348
|
+
height: "100%",
|
|
349
|
+
minHeight: "0",
|
|
350
|
+
minWidth: "0"
|
|
351
|
+
}
|
|
352
|
+
}),
|
|
353
|
+
r.default?.({
|
|
354
|
+
api: a.api,
|
|
355
|
+
core: a.core,
|
|
356
|
+
runtime: b,
|
|
357
|
+
grid: b,
|
|
358
|
+
rowModel: a.rowModel,
|
|
359
|
+
columnModel: a.columnModel,
|
|
360
|
+
columnSnapshot: a.columnSnapshot.value,
|
|
361
|
+
rowPartition: a.rowPartition.value,
|
|
362
|
+
setRows: a.setRows,
|
|
363
|
+
syncBodyRowsInRange: a.syncBodyRowsInRange,
|
|
364
|
+
getBodyRowAtIndex: h.getBodyRowAtIndex,
|
|
365
|
+
resolveBodyRowIndexById: h.resolveBodyRowIndexById,
|
|
366
|
+
virtualWindow: v.value
|
|
367
|
+
}) ?? []
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
function Q(e) {
|
|
372
|
+
return Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : null;
|
|
373
|
+
}
|
|
374
|
+
function R(e) {
|
|
375
|
+
try {
|
|
376
|
+
return JSON.stringify(e);
|
|
377
|
+
} catch {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function Ue(e) {
|
|
382
|
+
return e ? {
|
|
383
|
+
fields: [...e.fields],
|
|
384
|
+
expandedByDefault: e.expandedByDefault
|
|
385
|
+
} : null;
|
|
386
|
+
}
|
|
387
|
+
function _e(e) {
|
|
388
|
+
let t = null, r = null, n = !1, f = null, u = null, p = null, a = null, h = null, b = null, M = null;
|
|
389
|
+
const A = () => {
|
|
390
|
+
t?.(), r?.(), t = null, r = null;
|
|
391
|
+
}, C = () => {
|
|
392
|
+
const o = e.gridRef.value?.api.columns;
|
|
393
|
+
if (!o)
|
|
394
|
+
return null;
|
|
395
|
+
const d = o.getSnapshot(), i = {}, s = {}, S = {};
|
|
396
|
+
for (const c of d.columns)
|
|
397
|
+
i[c.key] = c.visible, s[c.key] = c.width, S[c.key] = c.pin;
|
|
398
|
+
return {
|
|
399
|
+
order: [...d.order],
|
|
400
|
+
visibility: i,
|
|
401
|
+
widths: s,
|
|
402
|
+
pins: S
|
|
403
|
+
};
|
|
404
|
+
}, v = () => {
|
|
405
|
+
n || (n = !0, queueMicrotask(() => {
|
|
406
|
+
n = !1;
|
|
407
|
+
const o = C(), d = e.gridRef.value?.api;
|
|
408
|
+
if (o) {
|
|
409
|
+
const i = R(o);
|
|
410
|
+
b = i, i !== p && (p = i, e.emit.columnState(o), e.emit.columnOrder(o.order), e.emit.hiddenColumnKeys(
|
|
411
|
+
Object.entries(o.visibility).filter(([, s]) => !s).map(([s]) => s)
|
|
412
|
+
), e.emit.columnWidths(o.widths), e.emit.columnPins(o.pins));
|
|
413
|
+
}
|
|
414
|
+
if (d) {
|
|
415
|
+
const i = Ue(d.rows.getSnapshot().groupBy), s = R(i);
|
|
416
|
+
s !== h && (h = s, e.emit.groupBy(i));
|
|
417
|
+
const S = d.state.get(), c = R(S);
|
|
418
|
+
M = c, c !== a && (a = c, e.emit.state(S));
|
|
419
|
+
}
|
|
420
|
+
}));
|
|
421
|
+
}, y = () => {
|
|
422
|
+
const o = e.gridRef.value?.api;
|
|
423
|
+
!o || e.props.sortModel === void 0 && e.props.filterModel === void 0 || o.rows.setSortAndFilterModel({
|
|
424
|
+
sortModel: e.props.sortModel ?? [],
|
|
425
|
+
filterModel: e.props.filterModel ?? null
|
|
426
|
+
});
|
|
427
|
+
}, P = () => {
|
|
428
|
+
const o = e.gridRef.value?.api;
|
|
429
|
+
!o || e.props.groupBy === void 0 || o.rows.setGroupBy(e.props.groupBy ?? null);
|
|
430
|
+
}, x = () => {
|
|
431
|
+
const o = e.gridRef.value?.api;
|
|
432
|
+
!o || e.props.aggregationModel === void 0 || o.rows.setAggregationModel(e.props.aggregationModel ?? null);
|
|
433
|
+
}, O = () => {
|
|
434
|
+
const o = e.gridRef.value?.api;
|
|
435
|
+
!o || e.props.pivotModel === void 0 || o.pivot.setModel(e.props.pivotModel ?? null);
|
|
436
|
+
}, G = () => {
|
|
437
|
+
const o = e.gridRef.value?.api;
|
|
438
|
+
if (!o || e.props.columnState === void 0 && e.props.columnOrder === void 0 && e.props.hiddenColumnKeys === void 0 && e.props.columnWidths === void 0 && e.props.columnPins === void 0)
|
|
439
|
+
return;
|
|
440
|
+
const d = R({
|
|
441
|
+
columnState: e.props.columnState,
|
|
442
|
+
columnOrder: e.props.columnOrder,
|
|
443
|
+
hiddenColumnKeys: e.props.hiddenColumnKeys,
|
|
444
|
+
columnWidths: e.props.columnWidths,
|
|
445
|
+
columnPins: e.props.columnPins
|
|
446
|
+
});
|
|
447
|
+
if (d !== f) {
|
|
448
|
+
if (e.props.columnState && !e.props.columnOrder && !e.props.hiddenColumnKeys && !e.props.columnWidths && !e.props.columnPins && R(e.props.columnState) === b) {
|
|
449
|
+
f = d;
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (e.props.columnState) {
|
|
453
|
+
o.columns.setOrder(e.props.columnState.order);
|
|
454
|
+
for (const [i, s] of Object.entries(e.props.columnState.visibility))
|
|
455
|
+
o.columns.setVisibility(i, s);
|
|
456
|
+
for (const [i, s] of Object.entries(e.props.columnState.widths))
|
|
457
|
+
o.columns.setWidth(i, Q(s));
|
|
458
|
+
for (const [i, s] of Object.entries(e.props.columnState.pins))
|
|
459
|
+
o.columns.setPin(i, s);
|
|
460
|
+
}
|
|
461
|
+
if (e.props.columnOrder && o.columns.setOrder(e.props.columnOrder), e.props.hiddenColumnKeys) {
|
|
462
|
+
const i = new Set(e.props.hiddenColumnKeys), s = o.columns.getSnapshot();
|
|
463
|
+
for (const S of s.columns)
|
|
464
|
+
o.columns.setVisibility(S.key, !i.has(S.key));
|
|
465
|
+
}
|
|
466
|
+
if (e.props.columnWidths)
|
|
467
|
+
for (const [i, s] of Object.entries(e.props.columnWidths))
|
|
468
|
+
o.columns.setWidth(i, Q(s));
|
|
469
|
+
if (e.props.columnPins)
|
|
470
|
+
for (const [i, s] of Object.entries(e.props.columnPins))
|
|
471
|
+
o.columns.setPin(i, s);
|
|
472
|
+
f = d;
|
|
473
|
+
}
|
|
474
|
+
}, I = () => {
|
|
475
|
+
const o = e.gridRef.value?.api;
|
|
476
|
+
if (!o || e.props.state == null)
|
|
477
|
+
return;
|
|
478
|
+
const d = R(e.props.state);
|
|
479
|
+
if (d === u)
|
|
480
|
+
return;
|
|
481
|
+
if (d === M) {
|
|
482
|
+
u = d;
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const i = o.state.migrate(e.props.state, { strict: e.props.stateOptions?.strict });
|
|
486
|
+
i && (o.state.set(i, e.props.stateOptions ?? {}), u = d);
|
|
487
|
+
}, D = () => {
|
|
488
|
+
const o = e.gridRef.value?.api;
|
|
489
|
+
o && (o.view.setRowHeightMode(e.props.rowHeightMode), o.view.setBaseRowHeight(Math.max(24, Math.trunc(e.props.baseRowHeight))));
|
|
490
|
+
}, L = () => {
|
|
491
|
+
const o = e.gridRef.value;
|
|
492
|
+
o && (f = null, u = null, A(), t = o.rowModel.subscribe(() => {
|
|
493
|
+
v();
|
|
494
|
+
}), r = o.columnModel.subscribe(() => {
|
|
495
|
+
v();
|
|
496
|
+
}), I(), G(), y(), P(), x(), O(), D(), v(), e.emit.ready({ api: o.api }));
|
|
497
|
+
}, z = () => e.gridRef.value?.api.state.get() ?? null, V = (o, d) => e.gridRef.value?.api.state.migrate(o, d) ?? null, H = (o) => {
|
|
498
|
+
const d = e.gridRef.value?.api;
|
|
499
|
+
if (!d)
|
|
500
|
+
return !1;
|
|
501
|
+
f = R({
|
|
502
|
+
columnState: o,
|
|
503
|
+
columnOrder: null,
|
|
504
|
+
hiddenColumnKeys: null,
|
|
505
|
+
columnWidths: null,
|
|
506
|
+
columnPins: null
|
|
507
|
+
}), d.columns.setOrder(o.order);
|
|
508
|
+
for (const [i, s] of Object.entries(o.visibility))
|
|
509
|
+
d.columns.setVisibility(i, s);
|
|
510
|
+
for (const [i, s] of Object.entries(o.widths))
|
|
511
|
+
d.columns.setWidth(i, Q(s));
|
|
512
|
+
for (const [i, s] of Object.entries(o.pins))
|
|
513
|
+
d.columns.setPin(i, s);
|
|
514
|
+
return v(), !0;
|
|
515
|
+
}, E = (o, d) => {
|
|
516
|
+
const i = e.gridRef.value?.api;
|
|
517
|
+
if (!i)
|
|
518
|
+
return !1;
|
|
519
|
+
const s = i.state.migrate(o, { strict: d?.strict });
|
|
520
|
+
return s ? (i.state.set(s, d), u = R(o), v(), !0) : !1;
|
|
521
|
+
}, k = () => e.gridRef.value?.api.pivot.exportLayout() ?? null, N = () => e.gridRef.value?.api.pivot.exportInterop() ?? null, U = (o, d) => {
|
|
522
|
+
const i = e.gridRef.value?.api;
|
|
523
|
+
return i ? (i.pivot.importLayout(o, d), v(), !0) : !1;
|
|
524
|
+
}, j = () => {
|
|
525
|
+
e.gridRef.value?.api.rows.expandAllGroups(), v();
|
|
526
|
+
}, K = () => {
|
|
527
|
+
e.gridRef.value?.api.rows.collapseAllGroups(), v();
|
|
528
|
+
};
|
|
529
|
+
w(
|
|
530
|
+
() => e.gridRef.value,
|
|
531
|
+
() => {
|
|
532
|
+
L();
|
|
533
|
+
},
|
|
534
|
+
{ immediate: !0 }
|
|
535
|
+
), w(
|
|
536
|
+
() => e.props.columns,
|
|
537
|
+
() => {
|
|
538
|
+
f = null, u = null, I(), G(), v();
|
|
539
|
+
},
|
|
540
|
+
{ deep: !0 }
|
|
541
|
+
), w(
|
|
542
|
+
() => [e.props.state, e.props.stateOptions],
|
|
543
|
+
() => {
|
|
544
|
+
I(), G(), y(), P(), x(), O(), D(), v();
|
|
545
|
+
},
|
|
546
|
+
{ deep: !0 }
|
|
547
|
+
), w(
|
|
548
|
+
() => [
|
|
549
|
+
e.props.columnState,
|
|
550
|
+
e.props.columnOrder,
|
|
551
|
+
e.props.hiddenColumnKeys,
|
|
552
|
+
e.props.columnWidths,
|
|
553
|
+
e.props.columnPins
|
|
554
|
+
],
|
|
555
|
+
() => {
|
|
556
|
+
G(), v();
|
|
557
|
+
},
|
|
558
|
+
{ deep: !0 }
|
|
559
|
+
), w(
|
|
560
|
+
() => [e.props.sortModel, e.props.filterModel],
|
|
561
|
+
() => {
|
|
562
|
+
y(), v();
|
|
563
|
+
},
|
|
564
|
+
{ deep: !0 }
|
|
565
|
+
), w(
|
|
566
|
+
() => e.props.groupBy,
|
|
567
|
+
() => {
|
|
568
|
+
P(), v();
|
|
569
|
+
},
|
|
570
|
+
{ deep: !0 }
|
|
571
|
+
), w(
|
|
572
|
+
() => e.props.aggregationModel,
|
|
573
|
+
() => {
|
|
574
|
+
x(), v();
|
|
575
|
+
},
|
|
576
|
+
{ deep: !0 }
|
|
577
|
+
), w(
|
|
578
|
+
() => e.props.pivotModel,
|
|
579
|
+
() => {
|
|
580
|
+
O(), v();
|
|
581
|
+
},
|
|
582
|
+
{ deep: !0 }
|
|
583
|
+
), w(
|
|
584
|
+
() => [e.props.rowHeightMode, e.props.baseRowHeight],
|
|
585
|
+
() => {
|
|
586
|
+
D(), v();
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
const F = () => {
|
|
590
|
+
A();
|
|
591
|
+
};
|
|
592
|
+
return Z(() => {
|
|
593
|
+
F();
|
|
594
|
+
}), {
|
|
595
|
+
emitSnapshotUpdates: v,
|
|
596
|
+
handleGridReady: L,
|
|
597
|
+
dispose: F,
|
|
598
|
+
getColumnState: C,
|
|
599
|
+
getState: z,
|
|
600
|
+
migrateState: V,
|
|
601
|
+
applyColumnState: H,
|
|
602
|
+
applyState: E,
|
|
603
|
+
exportPivotLayout: k,
|
|
604
|
+
exportPivotInterop: N,
|
|
605
|
+
importPivotLayout: U,
|
|
606
|
+
expandAllGroups: j,
|
|
607
|
+
collapseAllGroups: K
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
function Je() {
|
|
611
|
+
return {
|
|
612
|
+
name: "selection",
|
|
613
|
+
getRowSelectionSnapshot: () => null,
|
|
614
|
+
setRowSelectionSnapshot: () => {
|
|
615
|
+
},
|
|
616
|
+
clearRowSelection: () => {
|
|
617
|
+
},
|
|
618
|
+
getFocusedRow: () => null,
|
|
619
|
+
setFocusedRow: () => {
|
|
620
|
+
},
|
|
621
|
+
getSelectedRows: () => [],
|
|
622
|
+
isRowSelected: () => !1,
|
|
623
|
+
setRowSelected: () => {
|
|
624
|
+
},
|
|
625
|
+
selectRows: () => {
|
|
626
|
+
},
|
|
627
|
+
deselectRows: () => {
|
|
628
|
+
},
|
|
629
|
+
clearSelectedRows: () => {
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function W(e, t) {
|
|
634
|
+
const r = t.map((n) => n?.[e]).filter((n) => typeof n == "function");
|
|
635
|
+
if (r.length !== 0)
|
|
636
|
+
return async (n) => {
|
|
637
|
+
for (const f of r)
|
|
638
|
+
await f(n);
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
function $e(e) {
|
|
642
|
+
const {
|
|
643
|
+
userSelectionService: t,
|
|
644
|
+
cellSelectionService: r,
|
|
645
|
+
rowSelectionService: n
|
|
646
|
+
} = e;
|
|
647
|
+
return {
|
|
648
|
+
name: "selection",
|
|
649
|
+
init: W("init", [t, r, n]),
|
|
650
|
+
start: W("start", [t, r, n]),
|
|
651
|
+
stop: W("stop", [t, r, n]),
|
|
652
|
+
dispose: W("dispose", [t, r, n]),
|
|
653
|
+
getSelectionSnapshot: r.getSelectionSnapshot,
|
|
654
|
+
setSelectionSnapshot: r.setSelectionSnapshot,
|
|
655
|
+
clearSelection: r.clearSelection,
|
|
656
|
+
getRowSelectionSnapshot: n.getRowSelectionSnapshot,
|
|
657
|
+
setRowSelectionSnapshot: n.setRowSelectionSnapshot,
|
|
658
|
+
clearRowSelection: n.clearRowSelection,
|
|
659
|
+
getFocusedRow: n.getFocusedRow,
|
|
660
|
+
setFocusedRow: n.setFocusedRow,
|
|
661
|
+
getSelectedRows: n.getSelectedRows,
|
|
662
|
+
isRowSelected: n.isRowSelected,
|
|
663
|
+
setRowSelected: n.setRowSelected,
|
|
664
|
+
selectRows: n.selectRows,
|
|
665
|
+
deselectRows: n.deselectRows,
|
|
666
|
+
clearSelectedRows: n.clearSelectedRows
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
const qe = ae({
|
|
670
|
+
name: "DataGrid",
|
|
671
|
+
inheritAttrs: !1,
|
|
672
|
+
props: {
|
|
673
|
+
rows: {
|
|
674
|
+
type: Array,
|
|
675
|
+
default: () => []
|
|
676
|
+
},
|
|
677
|
+
rowModel: {
|
|
678
|
+
type: Object,
|
|
679
|
+
default: void 0
|
|
680
|
+
},
|
|
681
|
+
clientRowModelOptions: {
|
|
682
|
+
type: Object,
|
|
683
|
+
default: void 0
|
|
684
|
+
},
|
|
685
|
+
computedFields: {
|
|
686
|
+
type: Array,
|
|
687
|
+
default: void 0
|
|
688
|
+
},
|
|
689
|
+
formulas: {
|
|
690
|
+
type: Array,
|
|
691
|
+
default: void 0
|
|
692
|
+
},
|
|
693
|
+
formulaFunctions: {
|
|
694
|
+
type: Object,
|
|
695
|
+
default: void 0
|
|
696
|
+
},
|
|
697
|
+
columns: {
|
|
698
|
+
type: Array,
|
|
699
|
+
default: () => []
|
|
700
|
+
},
|
|
701
|
+
theme: {
|
|
702
|
+
type: [String, Object],
|
|
703
|
+
default: void 0
|
|
704
|
+
},
|
|
705
|
+
aggregationModel: {
|
|
706
|
+
type: Object,
|
|
707
|
+
default: void 0
|
|
708
|
+
},
|
|
709
|
+
renderMode: {
|
|
710
|
+
type: String,
|
|
711
|
+
default: void 0
|
|
712
|
+
},
|
|
713
|
+
virtualization: {
|
|
714
|
+
type: [Boolean, Object],
|
|
715
|
+
default: void 0
|
|
716
|
+
},
|
|
717
|
+
pagination: {
|
|
718
|
+
type: [Boolean, Object],
|
|
719
|
+
default: void 0
|
|
720
|
+
},
|
|
721
|
+
columnMenu: {
|
|
722
|
+
type: [Boolean, Object],
|
|
723
|
+
default: void 0
|
|
724
|
+
},
|
|
725
|
+
cellMenu: {
|
|
726
|
+
type: [Boolean, Object],
|
|
727
|
+
default: void 0
|
|
728
|
+
},
|
|
729
|
+
rowIndexMenu: {
|
|
730
|
+
type: [Boolean, Object],
|
|
731
|
+
default: void 0
|
|
732
|
+
},
|
|
733
|
+
columnLayout: {
|
|
734
|
+
type: [Boolean, Object],
|
|
735
|
+
default: void 0
|
|
736
|
+
},
|
|
737
|
+
aggregations: {
|
|
738
|
+
type: [Boolean, Object],
|
|
739
|
+
default: void 0
|
|
740
|
+
},
|
|
741
|
+
advancedFilter: {
|
|
742
|
+
type: [Boolean, Object],
|
|
743
|
+
default: void 0
|
|
744
|
+
},
|
|
745
|
+
showRowIndex: {
|
|
746
|
+
type: Boolean,
|
|
747
|
+
default: !0
|
|
748
|
+
},
|
|
749
|
+
rowSelection: {
|
|
750
|
+
type: Boolean,
|
|
751
|
+
default: !0
|
|
752
|
+
},
|
|
753
|
+
pageSize: {
|
|
754
|
+
type: Number,
|
|
755
|
+
default: void 0
|
|
756
|
+
},
|
|
757
|
+
currentPage: {
|
|
758
|
+
type: Number,
|
|
759
|
+
default: void 0
|
|
760
|
+
},
|
|
761
|
+
plugins: {
|
|
762
|
+
type: Array,
|
|
763
|
+
default: () => []
|
|
764
|
+
},
|
|
765
|
+
services: {
|
|
766
|
+
type: Object,
|
|
767
|
+
default: void 0
|
|
768
|
+
},
|
|
769
|
+
startupOrder: {
|
|
770
|
+
type: Array,
|
|
771
|
+
default: void 0
|
|
772
|
+
},
|
|
773
|
+
autoStart: {
|
|
774
|
+
type: Boolean,
|
|
775
|
+
default: !0
|
|
776
|
+
},
|
|
777
|
+
sortModel: {
|
|
778
|
+
type: Array,
|
|
779
|
+
default: void 0
|
|
780
|
+
},
|
|
781
|
+
filterModel: {
|
|
782
|
+
type: Object,
|
|
783
|
+
default: void 0
|
|
784
|
+
},
|
|
785
|
+
groupBy: {
|
|
786
|
+
type: [String, Array, Object],
|
|
787
|
+
default: void 0
|
|
788
|
+
},
|
|
789
|
+
pivotModel: {
|
|
790
|
+
type: Object,
|
|
791
|
+
default: void 0
|
|
792
|
+
},
|
|
793
|
+
columnState: {
|
|
794
|
+
type: Object,
|
|
795
|
+
default: void 0
|
|
796
|
+
},
|
|
797
|
+
columnOrder: {
|
|
798
|
+
type: Array,
|
|
799
|
+
default: void 0
|
|
800
|
+
},
|
|
801
|
+
hiddenColumnKeys: {
|
|
802
|
+
type: Array,
|
|
803
|
+
default: void 0
|
|
804
|
+
},
|
|
805
|
+
columnWidths: {
|
|
806
|
+
type: Object,
|
|
807
|
+
default: void 0
|
|
808
|
+
},
|
|
809
|
+
columnPins: {
|
|
810
|
+
type: Object,
|
|
811
|
+
default: void 0
|
|
812
|
+
},
|
|
813
|
+
state: {
|
|
814
|
+
type: Object,
|
|
815
|
+
default: void 0
|
|
816
|
+
},
|
|
817
|
+
stateOptions: {
|
|
818
|
+
type: Object,
|
|
819
|
+
default: void 0
|
|
820
|
+
},
|
|
821
|
+
rowHeightMode: {
|
|
822
|
+
type: String,
|
|
823
|
+
default: "fixed"
|
|
824
|
+
},
|
|
825
|
+
baseRowHeight: {
|
|
826
|
+
type: Number,
|
|
827
|
+
default: 31
|
|
828
|
+
},
|
|
829
|
+
rowHover: {
|
|
830
|
+
type: Boolean,
|
|
831
|
+
default: !1
|
|
832
|
+
},
|
|
833
|
+
stripedRows: {
|
|
834
|
+
type: Boolean,
|
|
835
|
+
default: !1
|
|
836
|
+
},
|
|
837
|
+
isCellEditable: {
|
|
838
|
+
type: Function,
|
|
839
|
+
default: void 0
|
|
840
|
+
},
|
|
841
|
+
viewMode: {
|
|
842
|
+
type: String,
|
|
843
|
+
default: void 0
|
|
844
|
+
},
|
|
845
|
+
gantt: {
|
|
846
|
+
type: [Boolean, Object],
|
|
847
|
+
default: void 0
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
emits: [
|
|
851
|
+
"cell-change",
|
|
852
|
+
"selection-change",
|
|
853
|
+
"row-select",
|
|
854
|
+
"update:columnState",
|
|
855
|
+
"update:columnOrder",
|
|
856
|
+
"update:hiddenColumnKeys",
|
|
857
|
+
"update:columnWidths",
|
|
858
|
+
"update:columnPins",
|
|
859
|
+
"update:groupBy",
|
|
860
|
+
"update:viewMode",
|
|
861
|
+
"update:state",
|
|
862
|
+
"ready"
|
|
863
|
+
],
|
|
864
|
+
setup(e, { attrs: t, slots: r, emit: n, expose: f }) {
|
|
865
|
+
const u = X(null), p = X("table"), a = g(() => Ke(e.renderMode, e.pagination)), h = g(() => Fe(
|
|
866
|
+
e.pagination,
|
|
867
|
+
a.value,
|
|
868
|
+
e.pageSize,
|
|
869
|
+
e.currentPage
|
|
870
|
+
)), b = g(() => he(e.columnMenu)), M = g(() => be(e.cellMenu)), A = g(() => Re(e.rowIndexMenu)), C = g(() => He(e.columnLayout)), v = g(() => Ee(e.aggregations)), y = g(() => Te(e.advancedFilter)), P = g(() => je(e.groupBy)), x = g(() => ke(e.virtualization, a.value)), O = g(() => Me({
|
|
871
|
+
columns: e.columns,
|
|
872
|
+
clientRowModelOptions: e.clientRowModelOptions,
|
|
873
|
+
computedFields: e.computedFields,
|
|
874
|
+
formulas: e.formulas,
|
|
875
|
+
formulaFunctions: e.formulaFunctions
|
|
876
|
+
})), G = g(() => Oe(e.columns)), I = {
|
|
877
|
+
get state() {
|
|
878
|
+
return e.state;
|
|
879
|
+
},
|
|
880
|
+
get stateOptions() {
|
|
881
|
+
return e.stateOptions;
|
|
882
|
+
},
|
|
883
|
+
get columnState() {
|
|
884
|
+
return e.columnState;
|
|
885
|
+
},
|
|
886
|
+
get columnOrder() {
|
|
887
|
+
return e.columnOrder;
|
|
888
|
+
},
|
|
889
|
+
get hiddenColumnKeys() {
|
|
890
|
+
return e.hiddenColumnKeys;
|
|
891
|
+
},
|
|
892
|
+
get columnWidths() {
|
|
893
|
+
return e.columnWidths;
|
|
894
|
+
},
|
|
895
|
+
get columnPins() {
|
|
896
|
+
return e.columnPins;
|
|
897
|
+
},
|
|
898
|
+
get sortModel() {
|
|
899
|
+
return e.sortModel;
|
|
900
|
+
},
|
|
901
|
+
get filterModel() {
|
|
902
|
+
return e.filterModel;
|
|
903
|
+
},
|
|
904
|
+
get groupBy() {
|
|
905
|
+
return P.value;
|
|
906
|
+
},
|
|
907
|
+
get aggregationModel() {
|
|
908
|
+
return e.aggregationModel;
|
|
909
|
+
},
|
|
910
|
+
get pivotModel() {
|
|
911
|
+
return e.pivotModel;
|
|
912
|
+
},
|
|
913
|
+
get rowHeightMode() {
|
|
914
|
+
return e.rowHeightMode;
|
|
915
|
+
},
|
|
916
|
+
get baseRowHeight() {
|
|
917
|
+
return e.baseRowHeight;
|
|
918
|
+
},
|
|
919
|
+
get columns() {
|
|
920
|
+
return e.columns;
|
|
921
|
+
}
|
|
922
|
+
}, D = g(() => e.pivotModel ? "pivot" : O.value && "initialTreeData" in O.value ? "tree" : "base"), L = g(() => u.value?.api.columns.getSnapshot().visibleColumns ?? []), z = g(() => u.value?.api.rows.getCount() ?? 0), V = {
|
|
923
|
+
mode: g(() => D.value),
|
|
924
|
+
resolveRuntime: () => u.value,
|
|
925
|
+
visibleColumns: L,
|
|
926
|
+
totalRows: z,
|
|
927
|
+
showRowSelection: g(() => e.rowSelection)
|
|
928
|
+
}, {
|
|
929
|
+
selectionSnapshot: H,
|
|
930
|
+
selectionAnchor: E,
|
|
931
|
+
syncSelectionSnapshotFromRuntime: k,
|
|
932
|
+
selectionService: N,
|
|
933
|
+
selectionAggregatesLabel: U
|
|
934
|
+
} = pe(V), {
|
|
935
|
+
rowSelectionSnapshot: j,
|
|
936
|
+
syncRowSelectionSnapshotFromRuntime: K,
|
|
937
|
+
reconcileRowSelectionFromRuntime: F,
|
|
938
|
+
selectionService: o
|
|
939
|
+
} = we({
|
|
940
|
+
resolveRuntime: () => u.value
|
|
941
|
+
}), d = g(() => e.rowSelection ? o : Je()), i = g(() => ({
|
|
942
|
+
...e.services ?? {},
|
|
943
|
+
selection: $e({
|
|
944
|
+
userSelectionService: e.services?.selection,
|
|
945
|
+
cellSelectionService: N,
|
|
946
|
+
rowSelectionService: d.value
|
|
947
|
+
})
|
|
948
|
+
})), {
|
|
949
|
+
dataGridInstanceKey: s,
|
|
950
|
+
resolvedRowModel: S
|
|
951
|
+
} = Be({
|
|
952
|
+
rows: te(e, "rows"),
|
|
953
|
+
rowModel: te(e, "rowModel"),
|
|
954
|
+
clientRowModelOptions: O,
|
|
955
|
+
onOwnedRowModelRecreated: () => {
|
|
956
|
+
c.dispose();
|
|
957
|
+
}
|
|
958
|
+
}), c = _e({
|
|
959
|
+
gridRef: u,
|
|
960
|
+
props: I,
|
|
961
|
+
emit: {
|
|
962
|
+
columnState: (l) => n("update:columnState", l),
|
|
963
|
+
columnOrder: (l) => n("update:columnOrder", l),
|
|
964
|
+
hiddenColumnKeys: (l) => n("update:hiddenColumnKeys", l),
|
|
965
|
+
columnWidths: (l) => n("update:columnWidths", l),
|
|
966
|
+
columnPins: (l) => n("update:columnPins", l),
|
|
967
|
+
groupBy: (l) => n("update:groupBy", l),
|
|
968
|
+
state: (l) => n("update:state", l),
|
|
969
|
+
ready: (l) => n("ready", {
|
|
970
|
+
api: l.api,
|
|
971
|
+
rowModel: S.value
|
|
972
|
+
})
|
|
973
|
+
}
|
|
974
|
+
}), se = (l) => {
|
|
975
|
+
F(), n("cell-change", l), c.emitSnapshotUpdates();
|
|
976
|
+
}, de = (l) => {
|
|
977
|
+
n("selection-change", l);
|
|
978
|
+
};
|
|
979
|
+
w(
|
|
980
|
+
j,
|
|
981
|
+
(l) => {
|
|
982
|
+
n("row-select", l);
|
|
983
|
+
},
|
|
984
|
+
{ deep: !0 }
|
|
985
|
+
), w(
|
|
986
|
+
() => e.rowSelection,
|
|
987
|
+
(l) => {
|
|
988
|
+
if (l) {
|
|
989
|
+
K();
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
o.clearRowSelection?.();
|
|
993
|
+
},
|
|
994
|
+
{ immediate: !0 }
|
|
995
|
+
), w(
|
|
996
|
+
() => e.viewMode,
|
|
997
|
+
(l) => {
|
|
998
|
+
p.value = l === "gantt" ? "gantt" : "table";
|
|
999
|
+
},
|
|
1000
|
+
{ immediate: !0 }
|
|
1001
|
+
);
|
|
1002
|
+
const ee = (l) => {
|
|
1003
|
+
const m = l === "gantt" ? "gantt" : "table";
|
|
1004
|
+
p.value = m, n("update:viewMode", m);
|
|
1005
|
+
}, ce = () => {
|
|
1006
|
+
const l = c.getState();
|
|
1007
|
+
return l ? {
|
|
1008
|
+
state: l,
|
|
1009
|
+
viewMode: p.value
|
|
1010
|
+
} : null;
|
|
1011
|
+
}, me = (l, m) => ue(l, c.migrateState, m), fe = (l, m) => c.applyState(l.state, m) ? (l.viewMode && ee(l.viewMode), !0) : !1;
|
|
1012
|
+
return Z(() => {
|
|
1013
|
+
c.dispose();
|
|
1014
|
+
}), f({
|
|
1015
|
+
grid: u,
|
|
1016
|
+
rowModel: S,
|
|
1017
|
+
getApi: () => u.value?.api ?? null,
|
|
1018
|
+
getRuntime: () => u.value?.runtime ?? null,
|
|
1019
|
+
getCore: () => u.value?.core ?? null,
|
|
1020
|
+
getColumnState: () => c.getColumnState(),
|
|
1021
|
+
getColumnSnapshot: () => u.value?.api.columns.getSnapshot() ?? null,
|
|
1022
|
+
getSelectionAggregatesLabel: () => U.value,
|
|
1023
|
+
getSelectionSummary: () => u.value?.api.selection.summarize() ?? null,
|
|
1024
|
+
getView: () => p.value,
|
|
1025
|
+
setView: ee,
|
|
1026
|
+
getSavedView: ce,
|
|
1027
|
+
migrateSavedView: me,
|
|
1028
|
+
applySavedView: fe,
|
|
1029
|
+
applyColumnState: c.applyColumnState,
|
|
1030
|
+
getState: c.getState,
|
|
1031
|
+
migrateState: c.migrateState,
|
|
1032
|
+
applyState: c.applyState,
|
|
1033
|
+
exportPivotLayout: c.exportPivotLayout,
|
|
1034
|
+
exportPivotInterop: c.exportPivotInterop,
|
|
1035
|
+
importPivotLayout: c.importPivotLayout,
|
|
1036
|
+
expandAllGroups: c.expandAllGroups,
|
|
1037
|
+
collapseAllGroups: c.collapseAllGroups,
|
|
1038
|
+
insertRowsAt: (l, m) => u.value?.api.rows.insertDataAt(l, m) ?? !1,
|
|
1039
|
+
insertRowBefore: (l, m) => u.value?.api.rows.insertDataBefore(l, m) ?? !1,
|
|
1040
|
+
insertRowAfter: (l, m) => u.value?.api.rows.insertDataAfter(l, m) ?? !1,
|
|
1041
|
+
insertColumnsAt: (l, m) => u.value?.api.columns.insertAt(l, m) ?? !1,
|
|
1042
|
+
insertColumnBefore: (l, m) => u.value?.api.columns.insertBefore(l, m) ?? !1,
|
|
1043
|
+
insertColumnAfter: (l, m) => u.value?.api.columns.insertAfter(l, m) ?? !1
|
|
1044
|
+
}), () => {
|
|
1045
|
+
const l = {
|
|
1046
|
+
mode: D.value,
|
|
1047
|
+
rows: e.rows,
|
|
1048
|
+
runtime: u.value?.runtime ?? null,
|
|
1049
|
+
runtimeRowModel: u.value?.rowModel ?? null,
|
|
1050
|
+
selectionSnapshot: H,
|
|
1051
|
+
selectionAnchor: E,
|
|
1052
|
+
rowSelectionSnapshot: j,
|
|
1053
|
+
syncSelectionSnapshotFromRuntime: k,
|
|
1054
|
+
syncRowSelectionSnapshotFromRuntime: K,
|
|
1055
|
+
sortModel: e.sortModel,
|
|
1056
|
+
filterModel: e.filterModel,
|
|
1057
|
+
groupBy: P.value,
|
|
1058
|
+
pivotModel: e.pivotModel,
|
|
1059
|
+
renderMode: a.value,
|
|
1060
|
+
virtualization: x.value,
|
|
1061
|
+
columnMenu: b.value,
|
|
1062
|
+
cellMenu: M.value,
|
|
1063
|
+
rowIndexMenu: A.value,
|
|
1064
|
+
columnLayout: C.value,
|
|
1065
|
+
aggregations: v.value,
|
|
1066
|
+
advancedFilter: y.value,
|
|
1067
|
+
rowHeightMode: e.rowHeightMode,
|
|
1068
|
+
baseRowHeight: e.baseRowHeight,
|
|
1069
|
+
rowHover: e.rowHover,
|
|
1070
|
+
stripedRows: e.stripedRows,
|
|
1071
|
+
isCellEditable: e.isCellEditable,
|
|
1072
|
+
showRowIndex: e.showRowIndex,
|
|
1073
|
+
rowSelection: e.rowSelection,
|
|
1074
|
+
viewMode: p.value,
|
|
1075
|
+
gantt: e.gantt
|
|
1076
|
+
};
|
|
1077
|
+
return Y(
|
|
1078
|
+
Ne,
|
|
1079
|
+
{
|
|
1080
|
+
...t,
|
|
1081
|
+
ref: u,
|
|
1082
|
+
key: s.value,
|
|
1083
|
+
rows: e.rows,
|
|
1084
|
+
rowModel: S.value,
|
|
1085
|
+
columns: G.value,
|
|
1086
|
+
theme: e.theme,
|
|
1087
|
+
renderMode: a.value,
|
|
1088
|
+
pagination: h.value,
|
|
1089
|
+
plugins: e.plugins,
|
|
1090
|
+
services: i.value,
|
|
1091
|
+
startupOrder: e.startupOrder,
|
|
1092
|
+
autoStart: e.autoStart,
|
|
1093
|
+
onCellChange: se,
|
|
1094
|
+
onSelectionChange: de
|
|
1095
|
+
},
|
|
1096
|
+
r.default ? {
|
|
1097
|
+
default: (m) => r.default?.({
|
|
1098
|
+
...m,
|
|
1099
|
+
defaultRendererProps: {
|
|
1100
|
+
...l,
|
|
1101
|
+
runtime: m.runtime,
|
|
1102
|
+
runtimeRowModel: m.rowModel
|
|
1103
|
+
}
|
|
1104
|
+
})
|
|
1105
|
+
} : {
|
|
1106
|
+
default: (m) => Y(Ae, {
|
|
1107
|
+
...l,
|
|
1108
|
+
runtime: m.runtime,
|
|
1109
|
+
runtimeRowModel: m.rowModel
|
|
1110
|
+
})
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
}), rt = qe;
|
|
1116
|
+
export {
|
|
1117
|
+
rt as DataGrid,
|
|
1118
|
+
nt as clearDataGridSavedViewInStorage,
|
|
1119
|
+
qe as default,
|
|
1120
|
+
ue as migrateDataGridSavedView,
|
|
1121
|
+
Ve as parseDataGridSavedView,
|
|
1122
|
+
ot as readDataGridSavedViewFromStorage,
|
|
1123
|
+
ze as serializeDataGridSavedView,
|
|
1124
|
+
tt as writeDataGridSavedViewToStorage
|
|
1125
|
+
};
|