@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/DataGrid.js
DELETED
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
import { computed, defineComponent, h, onBeforeUnmount, ref, toRef, watch, } from "vue";
|
|
2
|
-
import { useDataGridAppRowSelection, useDataGridAppSelection, } from "@affino/datagrid-vue";
|
|
3
|
-
import DataGridDefaultRenderer from "./host/DataGridDefaultRenderer";
|
|
4
|
-
import { resolveDataGridColumns, resolveDataGridFormulaRowModelOptions, } from "./config/dataGridFormulaOptions";
|
|
5
|
-
import {} from "./theme/dataGridTheme";
|
|
6
|
-
import { resolveDataGridGroupBy, resolveDataGridPagination, resolveDataGridRenderMode, } from "./config/dataGridPublicProps";
|
|
7
|
-
import { resolveDataGridAdvancedFilter, } from "./config/dataGridAdvancedFilter";
|
|
8
|
-
import { migrateDataGridSavedView, } from "./config/dataGridSavedView";
|
|
9
|
-
import { resolveDataGridColumnLayout, } from "./config/dataGridColumnLayout";
|
|
10
|
-
import { resolveDataGridAggregations, } from "./config/dataGridAggregations";
|
|
11
|
-
import { resolveDataGridColumnMenu, } from "./overlays/dataGridColumnMenu";
|
|
12
|
-
import { resolveDataGridCellMenu, resolveDataGridRowIndexMenu, } from "./overlays/dataGridContextMenu";
|
|
13
|
-
import { resolveDataGridVirtualization } from "./config/dataGridVirtualization";
|
|
14
|
-
import DataGridRuntimeHost from "./host/DataGridRuntimeHost";
|
|
15
|
-
import { useDataGridAppControlledState, } from "./useDataGridAppControlledState";
|
|
16
|
-
import { useDataGridAppRowModel } from "./useDataGridAppRowModel";
|
|
17
|
-
function createDisabledRowSelectionService() {
|
|
18
|
-
return {
|
|
19
|
-
name: "selection",
|
|
20
|
-
getRowSelectionSnapshot: () => null,
|
|
21
|
-
setRowSelectionSnapshot: () => undefined,
|
|
22
|
-
clearRowSelection: () => undefined,
|
|
23
|
-
getFocusedRow: () => null,
|
|
24
|
-
setFocusedRow: () => undefined,
|
|
25
|
-
getSelectedRows: () => [],
|
|
26
|
-
isRowSelected: () => false,
|
|
27
|
-
setRowSelected: () => undefined,
|
|
28
|
-
selectRows: () => undefined,
|
|
29
|
-
deselectRows: () => undefined,
|
|
30
|
-
clearSelectedRows: () => undefined,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function composeSelectionLifecycle(hook, services) {
|
|
34
|
-
const handlers = services
|
|
35
|
-
.map(service => service?.[hook])
|
|
36
|
-
.filter((handler) => typeof handler === "function");
|
|
37
|
-
if (handlers.length === 0) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
return async (context) => {
|
|
41
|
-
for (const handler of handlers) {
|
|
42
|
-
await handler(context);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function composeSelectionService(options) {
|
|
47
|
-
const { userSelectionService, cellSelectionService, rowSelectionService, } = options;
|
|
48
|
-
return {
|
|
49
|
-
name: "selection",
|
|
50
|
-
init: composeSelectionLifecycle("init", [userSelectionService, cellSelectionService, rowSelectionService]),
|
|
51
|
-
start: composeSelectionLifecycle("start", [userSelectionService, cellSelectionService, rowSelectionService]),
|
|
52
|
-
stop: composeSelectionLifecycle("stop", [userSelectionService, cellSelectionService, rowSelectionService]),
|
|
53
|
-
dispose: composeSelectionLifecycle("dispose", [userSelectionService, cellSelectionService, rowSelectionService]),
|
|
54
|
-
getSelectionSnapshot: cellSelectionService.getSelectionSnapshot,
|
|
55
|
-
setSelectionSnapshot: cellSelectionService.setSelectionSnapshot,
|
|
56
|
-
clearSelection: cellSelectionService.clearSelection,
|
|
57
|
-
getRowSelectionSnapshot: rowSelectionService.getRowSelectionSnapshot,
|
|
58
|
-
setRowSelectionSnapshot: rowSelectionService.setRowSelectionSnapshot,
|
|
59
|
-
clearRowSelection: rowSelectionService.clearRowSelection,
|
|
60
|
-
getFocusedRow: rowSelectionService.getFocusedRow,
|
|
61
|
-
setFocusedRow: rowSelectionService.setFocusedRow,
|
|
62
|
-
getSelectedRows: rowSelectionService.getSelectedRows,
|
|
63
|
-
isRowSelected: rowSelectionService.isRowSelected,
|
|
64
|
-
setRowSelected: rowSelectionService.setRowSelected,
|
|
65
|
-
selectRows: rowSelectionService.selectRows,
|
|
66
|
-
deselectRows: rowSelectionService.deselectRows,
|
|
67
|
-
clearSelectedRows: rowSelectionService.clearSelectedRows,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export default defineComponent({
|
|
71
|
-
name: "DataGrid",
|
|
72
|
-
inheritAttrs: false,
|
|
73
|
-
props: {
|
|
74
|
-
rows: {
|
|
75
|
-
type: Array,
|
|
76
|
-
default: () => [],
|
|
77
|
-
},
|
|
78
|
-
rowModel: {
|
|
79
|
-
type: Object,
|
|
80
|
-
default: undefined,
|
|
81
|
-
},
|
|
82
|
-
clientRowModelOptions: {
|
|
83
|
-
type: Object,
|
|
84
|
-
default: undefined,
|
|
85
|
-
},
|
|
86
|
-
computedFields: {
|
|
87
|
-
type: Array,
|
|
88
|
-
default: undefined,
|
|
89
|
-
},
|
|
90
|
-
formulas: {
|
|
91
|
-
type: Array,
|
|
92
|
-
default: undefined,
|
|
93
|
-
},
|
|
94
|
-
formulaFunctions: {
|
|
95
|
-
type: Object,
|
|
96
|
-
default: undefined,
|
|
97
|
-
},
|
|
98
|
-
columns: {
|
|
99
|
-
type: Array,
|
|
100
|
-
default: () => [],
|
|
101
|
-
},
|
|
102
|
-
theme: {
|
|
103
|
-
type: [String, Object],
|
|
104
|
-
default: undefined,
|
|
105
|
-
},
|
|
106
|
-
aggregationModel: {
|
|
107
|
-
type: Object,
|
|
108
|
-
default: undefined,
|
|
109
|
-
},
|
|
110
|
-
renderMode: {
|
|
111
|
-
type: String,
|
|
112
|
-
default: undefined,
|
|
113
|
-
},
|
|
114
|
-
virtualization: {
|
|
115
|
-
type: [Boolean, Object],
|
|
116
|
-
default: undefined,
|
|
117
|
-
},
|
|
118
|
-
pagination: {
|
|
119
|
-
type: [Boolean, Object],
|
|
120
|
-
default: undefined,
|
|
121
|
-
},
|
|
122
|
-
columnMenu: {
|
|
123
|
-
type: [Boolean, Object],
|
|
124
|
-
default: undefined,
|
|
125
|
-
},
|
|
126
|
-
cellMenu: {
|
|
127
|
-
type: [Boolean, Object],
|
|
128
|
-
default: undefined,
|
|
129
|
-
},
|
|
130
|
-
rowIndexMenu: {
|
|
131
|
-
type: [Boolean, Object],
|
|
132
|
-
default: undefined,
|
|
133
|
-
},
|
|
134
|
-
columnLayout: {
|
|
135
|
-
type: [Boolean, Object],
|
|
136
|
-
default: undefined,
|
|
137
|
-
},
|
|
138
|
-
aggregations: {
|
|
139
|
-
type: [Boolean, Object],
|
|
140
|
-
default: undefined,
|
|
141
|
-
},
|
|
142
|
-
advancedFilter: {
|
|
143
|
-
type: [Boolean, Object],
|
|
144
|
-
default: undefined,
|
|
145
|
-
},
|
|
146
|
-
showRowIndex: {
|
|
147
|
-
type: Boolean,
|
|
148
|
-
default: true,
|
|
149
|
-
},
|
|
150
|
-
rowSelection: {
|
|
151
|
-
type: Boolean,
|
|
152
|
-
default: true,
|
|
153
|
-
},
|
|
154
|
-
pageSize: {
|
|
155
|
-
type: Number,
|
|
156
|
-
default: undefined,
|
|
157
|
-
},
|
|
158
|
-
currentPage: {
|
|
159
|
-
type: Number,
|
|
160
|
-
default: undefined,
|
|
161
|
-
},
|
|
162
|
-
plugins: {
|
|
163
|
-
type: Array,
|
|
164
|
-
default: () => [],
|
|
165
|
-
},
|
|
166
|
-
services: {
|
|
167
|
-
type: Object,
|
|
168
|
-
default: undefined,
|
|
169
|
-
},
|
|
170
|
-
startupOrder: {
|
|
171
|
-
type: Array,
|
|
172
|
-
default: undefined,
|
|
173
|
-
},
|
|
174
|
-
autoStart: {
|
|
175
|
-
type: Boolean,
|
|
176
|
-
default: true,
|
|
177
|
-
},
|
|
178
|
-
sortModel: {
|
|
179
|
-
type: Array,
|
|
180
|
-
default: undefined,
|
|
181
|
-
},
|
|
182
|
-
filterModel: {
|
|
183
|
-
type: Object,
|
|
184
|
-
default: undefined,
|
|
185
|
-
},
|
|
186
|
-
groupBy: {
|
|
187
|
-
type: [String, Array, Object],
|
|
188
|
-
default: undefined,
|
|
189
|
-
},
|
|
190
|
-
pivotModel: {
|
|
191
|
-
type: Object,
|
|
192
|
-
default: undefined,
|
|
193
|
-
},
|
|
194
|
-
columnState: {
|
|
195
|
-
type: Object,
|
|
196
|
-
default: undefined,
|
|
197
|
-
},
|
|
198
|
-
columnOrder: {
|
|
199
|
-
type: Array,
|
|
200
|
-
default: undefined,
|
|
201
|
-
},
|
|
202
|
-
hiddenColumnKeys: {
|
|
203
|
-
type: Array,
|
|
204
|
-
default: undefined,
|
|
205
|
-
},
|
|
206
|
-
columnWidths: {
|
|
207
|
-
type: Object,
|
|
208
|
-
default: undefined,
|
|
209
|
-
},
|
|
210
|
-
columnPins: {
|
|
211
|
-
type: Object,
|
|
212
|
-
default: undefined,
|
|
213
|
-
},
|
|
214
|
-
state: {
|
|
215
|
-
type: Object,
|
|
216
|
-
default: undefined,
|
|
217
|
-
},
|
|
218
|
-
stateOptions: {
|
|
219
|
-
type: Object,
|
|
220
|
-
default: undefined,
|
|
221
|
-
},
|
|
222
|
-
rowHeightMode: {
|
|
223
|
-
type: String,
|
|
224
|
-
default: "fixed",
|
|
225
|
-
},
|
|
226
|
-
baseRowHeight: {
|
|
227
|
-
type: Number,
|
|
228
|
-
default: 31,
|
|
229
|
-
},
|
|
230
|
-
rowHover: {
|
|
231
|
-
type: Boolean,
|
|
232
|
-
default: false,
|
|
233
|
-
},
|
|
234
|
-
stripedRows: {
|
|
235
|
-
type: Boolean,
|
|
236
|
-
default: false,
|
|
237
|
-
},
|
|
238
|
-
isCellEditable: {
|
|
239
|
-
type: Function,
|
|
240
|
-
default: undefined,
|
|
241
|
-
},
|
|
242
|
-
viewMode: {
|
|
243
|
-
type: String,
|
|
244
|
-
default: undefined,
|
|
245
|
-
},
|
|
246
|
-
gantt: {
|
|
247
|
-
type: [Boolean, Object],
|
|
248
|
-
default: undefined,
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
emits: [
|
|
252
|
-
"cell-change",
|
|
253
|
-
"selection-change",
|
|
254
|
-
"row-select",
|
|
255
|
-
"update:columnState",
|
|
256
|
-
"update:columnOrder",
|
|
257
|
-
"update:hiddenColumnKeys",
|
|
258
|
-
"update:columnWidths",
|
|
259
|
-
"update:columnPins",
|
|
260
|
-
"update:groupBy",
|
|
261
|
-
"update:viewMode",
|
|
262
|
-
"update:state",
|
|
263
|
-
"ready",
|
|
264
|
-
],
|
|
265
|
-
setup(props, { attrs, slots, emit, expose }) {
|
|
266
|
-
const dataGridRef = ref(null);
|
|
267
|
-
const currentViewMode = ref("table");
|
|
268
|
-
const resolvedRenderMode = computed(() => {
|
|
269
|
-
return resolveDataGridRenderMode(props.renderMode, props.pagination);
|
|
270
|
-
});
|
|
271
|
-
const resolvedPagination = computed(() => {
|
|
272
|
-
return resolveDataGridPagination(props.pagination, resolvedRenderMode.value, props.pageSize, props.currentPage);
|
|
273
|
-
});
|
|
274
|
-
const resolvedColumnMenu = computed(() => {
|
|
275
|
-
return resolveDataGridColumnMenu(props.columnMenu);
|
|
276
|
-
});
|
|
277
|
-
const resolvedCellMenu = computed(() => {
|
|
278
|
-
return resolveDataGridCellMenu(props.cellMenu);
|
|
279
|
-
});
|
|
280
|
-
const resolvedRowIndexMenu = computed(() => {
|
|
281
|
-
return resolveDataGridRowIndexMenu(props.rowIndexMenu);
|
|
282
|
-
});
|
|
283
|
-
const resolvedColumnLayout = computed(() => {
|
|
284
|
-
return resolveDataGridColumnLayout(props.columnLayout);
|
|
285
|
-
});
|
|
286
|
-
const resolvedAggregations = computed(() => {
|
|
287
|
-
return resolveDataGridAggregations(props.aggregations);
|
|
288
|
-
});
|
|
289
|
-
const resolvedAdvancedFilter = computed(() => {
|
|
290
|
-
return resolveDataGridAdvancedFilter(props.advancedFilter);
|
|
291
|
-
});
|
|
292
|
-
const resolvedGroupBy = computed(() => {
|
|
293
|
-
return resolveDataGridGroupBy(props.groupBy);
|
|
294
|
-
});
|
|
295
|
-
const resolvedVirtualization = computed(() => {
|
|
296
|
-
return resolveDataGridVirtualization(props.virtualization, resolvedRenderMode.value);
|
|
297
|
-
});
|
|
298
|
-
const resolvedClientRowModelOptions = computed(() => {
|
|
299
|
-
return resolveDataGridFormulaRowModelOptions({
|
|
300
|
-
columns: props.columns,
|
|
301
|
-
clientRowModelOptions: props.clientRowModelOptions,
|
|
302
|
-
computedFields: props.computedFields,
|
|
303
|
-
formulas: props.formulas,
|
|
304
|
-
formulaFunctions: props.formulaFunctions,
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
const resolvedColumns = computed(() => resolveDataGridColumns(props.columns));
|
|
308
|
-
const controlledProps = {
|
|
309
|
-
get state() {
|
|
310
|
-
return props.state;
|
|
311
|
-
},
|
|
312
|
-
get stateOptions() {
|
|
313
|
-
return props.stateOptions;
|
|
314
|
-
},
|
|
315
|
-
get columnState() {
|
|
316
|
-
return props.columnState;
|
|
317
|
-
},
|
|
318
|
-
get columnOrder() {
|
|
319
|
-
return props.columnOrder;
|
|
320
|
-
},
|
|
321
|
-
get hiddenColumnKeys() {
|
|
322
|
-
return props.hiddenColumnKeys;
|
|
323
|
-
},
|
|
324
|
-
get columnWidths() {
|
|
325
|
-
return props.columnWidths;
|
|
326
|
-
},
|
|
327
|
-
get columnPins() {
|
|
328
|
-
return props.columnPins;
|
|
329
|
-
},
|
|
330
|
-
get sortModel() {
|
|
331
|
-
return props.sortModel;
|
|
332
|
-
},
|
|
333
|
-
get filterModel() {
|
|
334
|
-
return props.filterModel;
|
|
335
|
-
},
|
|
336
|
-
get groupBy() {
|
|
337
|
-
return resolvedGroupBy.value;
|
|
338
|
-
},
|
|
339
|
-
get aggregationModel() {
|
|
340
|
-
return props.aggregationModel;
|
|
341
|
-
},
|
|
342
|
-
get pivotModel() {
|
|
343
|
-
return props.pivotModel;
|
|
344
|
-
},
|
|
345
|
-
get rowHeightMode() {
|
|
346
|
-
return props.rowHeightMode;
|
|
347
|
-
},
|
|
348
|
-
get baseRowHeight() {
|
|
349
|
-
return props.baseRowHeight;
|
|
350
|
-
},
|
|
351
|
-
get columns() {
|
|
352
|
-
return props.columns;
|
|
353
|
-
},
|
|
354
|
-
};
|
|
355
|
-
const inferredMode = computed(() => {
|
|
356
|
-
if (props.pivotModel) {
|
|
357
|
-
return "pivot";
|
|
358
|
-
}
|
|
359
|
-
if (resolvedClientRowModelOptions.value && "initialTreeData" in resolvedClientRowModelOptions.value) {
|
|
360
|
-
return "tree";
|
|
361
|
-
}
|
|
362
|
-
return "base";
|
|
363
|
-
});
|
|
364
|
-
const visibleColumns = computed(() => dataGridRef.value?.api.columns.getSnapshot().visibleColumns ?? []);
|
|
365
|
-
const totalRows = computed(() => dataGridRef.value?.api.rows.getCount() ?? 0);
|
|
366
|
-
const selectionOptions = {
|
|
367
|
-
mode: computed(() => inferredMode.value),
|
|
368
|
-
resolveRuntime: () => dataGridRef.value,
|
|
369
|
-
visibleColumns,
|
|
370
|
-
totalRows,
|
|
371
|
-
showRowSelection: computed(() => props.rowSelection),
|
|
372
|
-
};
|
|
373
|
-
const { selectionSnapshot, selectionAnchor, syncSelectionSnapshotFromRuntime, selectionService, selectionAggregatesLabel, } = useDataGridAppSelection(selectionOptions);
|
|
374
|
-
const { rowSelectionSnapshot, syncRowSelectionSnapshotFromRuntime, reconcileRowSelectionFromRuntime, selectionService: rowSelectionService, } = useDataGridAppRowSelection({
|
|
375
|
-
resolveRuntime: () => dataGridRef.value,
|
|
376
|
-
});
|
|
377
|
-
const resolvedRowSelectionService = computed(() => {
|
|
378
|
-
return props.rowSelection ? rowSelectionService : createDisabledRowSelectionService();
|
|
379
|
-
});
|
|
380
|
-
const resolvedServices = computed(() => ({
|
|
381
|
-
...(props.services ?? {}),
|
|
382
|
-
selection: composeSelectionService({
|
|
383
|
-
userSelectionService: props.services?.selection,
|
|
384
|
-
cellSelectionService: selectionService,
|
|
385
|
-
rowSelectionService: resolvedRowSelectionService.value,
|
|
386
|
-
}),
|
|
387
|
-
}));
|
|
388
|
-
const { dataGridInstanceKey, resolvedRowModel, } = useDataGridAppRowModel({
|
|
389
|
-
rows: toRef(props, "rows"),
|
|
390
|
-
rowModel: toRef(props, "rowModel"),
|
|
391
|
-
clientRowModelOptions: resolvedClientRowModelOptions,
|
|
392
|
-
onOwnedRowModelRecreated: () => {
|
|
393
|
-
controlledState.dispose();
|
|
394
|
-
},
|
|
395
|
-
});
|
|
396
|
-
const controlledState = useDataGridAppControlledState({
|
|
397
|
-
gridRef: dataGridRef,
|
|
398
|
-
props: controlledProps,
|
|
399
|
-
emit: {
|
|
400
|
-
columnState: payload => emit("update:columnState", payload),
|
|
401
|
-
columnOrder: payload => emit("update:columnOrder", payload),
|
|
402
|
-
hiddenColumnKeys: payload => emit("update:hiddenColumnKeys", payload),
|
|
403
|
-
columnWidths: payload => emit("update:columnWidths", payload),
|
|
404
|
-
columnPins: payload => emit("update:columnPins", payload),
|
|
405
|
-
groupBy: payload => emit("update:groupBy", payload),
|
|
406
|
-
state: payload => emit("update:state", payload),
|
|
407
|
-
ready: payload => emit("ready", {
|
|
408
|
-
api: payload.api,
|
|
409
|
-
rowModel: resolvedRowModel.value,
|
|
410
|
-
}),
|
|
411
|
-
},
|
|
412
|
-
});
|
|
413
|
-
const handleCellChange = (payload) => {
|
|
414
|
-
reconcileRowSelectionFromRuntime();
|
|
415
|
-
emit("cell-change", payload);
|
|
416
|
-
controlledState.emitSnapshotUpdates();
|
|
417
|
-
};
|
|
418
|
-
const handleSelectionChange = (payload) => {
|
|
419
|
-
emit("selection-change", payload);
|
|
420
|
-
};
|
|
421
|
-
watch(rowSelectionSnapshot, (snapshot) => {
|
|
422
|
-
emit("row-select", snapshot);
|
|
423
|
-
}, { deep: true });
|
|
424
|
-
watch(() => props.rowSelection, enabled => {
|
|
425
|
-
if (enabled) {
|
|
426
|
-
syncRowSelectionSnapshotFromRuntime();
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
rowSelectionService.clearRowSelection?.();
|
|
430
|
-
}, { immediate: true });
|
|
431
|
-
watch(() => props.viewMode, nextViewMode => {
|
|
432
|
-
currentViewMode.value = nextViewMode === "gantt" ? "gantt" : "table";
|
|
433
|
-
}, { immediate: true });
|
|
434
|
-
const setView = (nextViewMode) => {
|
|
435
|
-
const normalized = nextViewMode === "gantt" ? "gantt" : "table";
|
|
436
|
-
currentViewMode.value = normalized;
|
|
437
|
-
emit("update:viewMode", normalized);
|
|
438
|
-
};
|
|
439
|
-
const getSavedView = () => {
|
|
440
|
-
const state = controlledState.getState();
|
|
441
|
-
if (!state) {
|
|
442
|
-
return null;
|
|
443
|
-
}
|
|
444
|
-
return {
|
|
445
|
-
state,
|
|
446
|
-
viewMode: currentViewMode.value,
|
|
447
|
-
};
|
|
448
|
-
};
|
|
449
|
-
const migrateSavedView = (savedView, options) => {
|
|
450
|
-
return migrateDataGridSavedView(savedView, controlledState.migrateState, options);
|
|
451
|
-
};
|
|
452
|
-
const applySavedView = (savedView, options) => {
|
|
453
|
-
const applied = controlledState.applyState(savedView.state, options);
|
|
454
|
-
if (!applied) {
|
|
455
|
-
return false;
|
|
456
|
-
}
|
|
457
|
-
if (savedView.viewMode) {
|
|
458
|
-
setView(savedView.viewMode);
|
|
459
|
-
}
|
|
460
|
-
return true;
|
|
461
|
-
};
|
|
462
|
-
onBeforeUnmount(() => {
|
|
463
|
-
controlledState.dispose();
|
|
464
|
-
});
|
|
465
|
-
expose({
|
|
466
|
-
grid: dataGridRef,
|
|
467
|
-
rowModel: resolvedRowModel,
|
|
468
|
-
getApi: () => dataGridRef.value?.api ?? null,
|
|
469
|
-
getRuntime: () => dataGridRef.value?.runtime ?? null,
|
|
470
|
-
getCore: () => dataGridRef.value?.core ?? null,
|
|
471
|
-
getColumnState: () => controlledState.getColumnState(),
|
|
472
|
-
getColumnSnapshot: () => dataGridRef.value?.api.columns.getSnapshot() ?? null,
|
|
473
|
-
getSelectionAggregatesLabel: () => selectionAggregatesLabel.value,
|
|
474
|
-
getSelectionSummary: () => dataGridRef.value?.api.selection.summarize() ?? null,
|
|
475
|
-
getView: () => currentViewMode.value,
|
|
476
|
-
setView,
|
|
477
|
-
getSavedView,
|
|
478
|
-
migrateSavedView,
|
|
479
|
-
applySavedView,
|
|
480
|
-
applyColumnState: controlledState.applyColumnState,
|
|
481
|
-
getState: controlledState.getState,
|
|
482
|
-
migrateState: controlledState.migrateState,
|
|
483
|
-
applyState: controlledState.applyState,
|
|
484
|
-
exportPivotLayout: controlledState.exportPivotLayout,
|
|
485
|
-
exportPivotInterop: controlledState.exportPivotInterop,
|
|
486
|
-
importPivotLayout: controlledState.importPivotLayout,
|
|
487
|
-
expandAllGroups: controlledState.expandAllGroups,
|
|
488
|
-
collapseAllGroups: controlledState.collapseAllGroups,
|
|
489
|
-
insertRowsAt: (index, rows) => dataGridRef.value?.api.rows.insertDataAt(index, rows) ?? false,
|
|
490
|
-
insertRowBefore: (rowId, rows) => dataGridRef.value?.api.rows.insertDataBefore(rowId, rows) ?? false,
|
|
491
|
-
insertRowAfter: (rowId, rows) => dataGridRef.value?.api.rows.insertDataAfter(rowId, rows) ?? false,
|
|
492
|
-
insertColumnsAt: (index, columns) => dataGridRef.value?.api.columns.insertAt(index, columns) ?? false,
|
|
493
|
-
insertColumnBefore: (columnKey, columns) => dataGridRef.value?.api.columns.insertBefore(columnKey, columns) ?? false,
|
|
494
|
-
insertColumnAfter: (columnKey, columns) => dataGridRef.value?.api.columns.insertAfter(columnKey, columns) ?? false,
|
|
495
|
-
});
|
|
496
|
-
return () => {
|
|
497
|
-
const defaultRendererProps = {
|
|
498
|
-
mode: inferredMode.value,
|
|
499
|
-
rows: props.rows,
|
|
500
|
-
runtime: dataGridRef.value?.runtime ?? null,
|
|
501
|
-
runtimeRowModel: dataGridRef.value?.rowModel ?? null,
|
|
502
|
-
selectionSnapshot,
|
|
503
|
-
selectionAnchor,
|
|
504
|
-
rowSelectionSnapshot,
|
|
505
|
-
syncSelectionSnapshotFromRuntime,
|
|
506
|
-
syncRowSelectionSnapshotFromRuntime,
|
|
507
|
-
sortModel: props.sortModel,
|
|
508
|
-
filterModel: props.filterModel,
|
|
509
|
-
groupBy: resolvedGroupBy.value,
|
|
510
|
-
pivotModel: props.pivotModel,
|
|
511
|
-
renderMode: resolvedRenderMode.value,
|
|
512
|
-
virtualization: resolvedVirtualization.value,
|
|
513
|
-
columnMenu: resolvedColumnMenu.value,
|
|
514
|
-
cellMenu: resolvedCellMenu.value,
|
|
515
|
-
rowIndexMenu: resolvedRowIndexMenu.value,
|
|
516
|
-
columnLayout: resolvedColumnLayout.value,
|
|
517
|
-
aggregations: resolvedAggregations.value,
|
|
518
|
-
advancedFilter: resolvedAdvancedFilter.value,
|
|
519
|
-
rowHeightMode: props.rowHeightMode,
|
|
520
|
-
baseRowHeight: props.baseRowHeight,
|
|
521
|
-
rowHover: props.rowHover,
|
|
522
|
-
stripedRows: props.stripedRows,
|
|
523
|
-
isCellEditable: props.isCellEditable,
|
|
524
|
-
showRowIndex: props.showRowIndex,
|
|
525
|
-
rowSelection: props.rowSelection,
|
|
526
|
-
viewMode: currentViewMode.value,
|
|
527
|
-
gantt: props.gantt,
|
|
528
|
-
};
|
|
529
|
-
return h(DataGridRuntimeHost, {
|
|
530
|
-
...attrs,
|
|
531
|
-
ref: dataGridRef,
|
|
532
|
-
key: dataGridInstanceKey.value,
|
|
533
|
-
rows: props.rows,
|
|
534
|
-
rowModel: resolvedRowModel.value,
|
|
535
|
-
columns: resolvedColumns.value,
|
|
536
|
-
theme: props.theme,
|
|
537
|
-
renderMode: resolvedRenderMode.value,
|
|
538
|
-
pagination: resolvedPagination.value,
|
|
539
|
-
plugins: props.plugins,
|
|
540
|
-
services: resolvedServices.value,
|
|
541
|
-
startupOrder: props.startupOrder,
|
|
542
|
-
autoStart: props.autoStart,
|
|
543
|
-
onCellChange: handleCellChange,
|
|
544
|
-
onSelectionChange: handleSelectionChange,
|
|
545
|
-
}, slots.default
|
|
546
|
-
? {
|
|
547
|
-
default: (slotProps) => slots.default?.({
|
|
548
|
-
...slotProps,
|
|
549
|
-
defaultRendererProps: {
|
|
550
|
-
...defaultRendererProps,
|
|
551
|
-
runtime: slotProps.runtime,
|
|
552
|
-
runtimeRowModel: slotProps.rowModel,
|
|
553
|
-
},
|
|
554
|
-
}),
|
|
555
|
-
}
|
|
556
|
-
: {
|
|
557
|
-
default: (slotProps) => h(DataGridDefaultRenderer, {
|
|
558
|
-
...defaultRendererProps,
|
|
559
|
-
runtime: slotProps.runtime,
|
|
560
|
-
runtimeRowModel: slotProps.rowModel,
|
|
561
|
-
}),
|
|
562
|
-
});
|
|
563
|
-
};
|
|
564
|
-
},
|
|
565
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./host/DataGridRuntimeHost";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const DEFAULT_BUTTON_LABEL = "Advanced filter";
|
|
2
|
-
export function resolveDataGridAdvancedFilter(input) {
|
|
3
|
-
if (typeof input === "boolean") {
|
|
4
|
-
return {
|
|
5
|
-
enabled: input,
|
|
6
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (!input) {
|
|
10
|
-
return {
|
|
11
|
-
enabled: false,
|
|
12
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
enabled: input.enabled ?? true,
|
|
17
|
-
buttonLabel: typeof input.buttonLabel === "string" && input.buttonLabel.trim().length > 0
|
|
18
|
-
? input.buttonLabel.trim()
|
|
19
|
-
: DEFAULT_BUTTON_LABEL,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const DEFAULT_BUTTON_LABEL = "Aggregations";
|
|
2
|
-
export function resolveDataGridAggregations(input) {
|
|
3
|
-
if (typeof input === "boolean") {
|
|
4
|
-
return {
|
|
5
|
-
enabled: input,
|
|
6
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (!input) {
|
|
10
|
-
return {
|
|
11
|
-
enabled: false,
|
|
12
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
enabled: input.enabled ?? true,
|
|
17
|
-
buttonLabel: typeof input.buttonLabel === "string" && input.buttonLabel.trim().length > 0
|
|
18
|
-
? input.buttonLabel.trim()
|
|
19
|
-
: DEFAULT_BUTTON_LABEL,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const DEFAULT_BUTTON_LABEL = "Columns";
|
|
2
|
-
export function resolveDataGridColumnLayout(input) {
|
|
3
|
-
if (typeof input === "boolean") {
|
|
4
|
-
return {
|
|
5
|
-
enabled: input,
|
|
6
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (!input) {
|
|
10
|
-
return {
|
|
11
|
-
enabled: false,
|
|
12
|
-
buttonLabel: DEFAULT_BUTTON_LABEL,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
enabled: input.enabled ?? true,
|
|
17
|
-
buttonLabel: typeof input.buttonLabel === "string" && input.buttonLabel.trim().length > 0
|
|
18
|
-
? input.buttonLabel.trim()
|
|
19
|
-
: DEFAULT_BUTTON_LABEL,
|
|
20
|
-
};
|
|
21
|
-
}
|