@knime/kds-table 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.css +173 -167
- package/dist/index.js +921 -1565
- package/dist/index.js.map +1 -1
- package/dist/src/components/TableCore.vue.d.ts +5 -3
- package/dist/src/components/TableCore.vue.d.ts.map +1 -1
- package/dist/src/components/TableCoreVirtual.vue.d.ts +1 -1
- package/dist/src/components/TableCoreVirtual.vue.d.ts.map +1 -1
- package/dist/src/components/TableUI.vue.d.ts +1090 -1660
- package/dist/src/components/TableUI.vue.d.ts.map +1 -1
- package/dist/src/components/TableUIWithAutoSizeCalculation.vue.d.ts +2084 -8120
- package/dist/src/components/TableUIWithAutoSizeCalculation.vue.d.ts.map +1 -1
- package/dist/src/components/VirtualRow.vue.d.ts +1 -1
- package/dist/src/components/VirtualRow.vue.d.ts.map +1 -1
- package/dist/src/components/composables/useDataValueViews.d.ts +2 -2
- package/dist/src/components/composables/useDataValueViews.d.ts.map +1 -1
- package/dist/src/components/composables/useHeaderMenuItems.d.ts +4 -3
- package/dist/src/components/composables/useHeaderMenuItems.d.ts.map +1 -1
- package/dist/src/components/control/PageControls.vue.d.ts +29 -7
- package/dist/src/components/control/PageControls.vue.d.ts.map +1 -1
- package/dist/src/components/control/TableActionBar.vue.d.ts +24 -27
- package/dist/src/components/control/TableActionBar.vue.d.ts.map +1 -1
- package/dist/src/components/control/actionbar/FilterControl.vue.d.ts +12 -12
- package/dist/src/components/control/actionbar/FilterControl.vue.d.ts.map +1 -1
- package/dist/src/components/control/actionbar/FilterControlBody.vue.d.ts +5 -5
- package/dist/src/components/control/actionbar/FilterControlBody.vue.d.ts.map +1 -1
- package/dist/src/components/control/actionbar/SortControl.vue.d.ts +4 -4
- package/dist/src/components/control/actionbar/SortControl.vue.d.ts.map +1 -1
- package/dist/src/components/control/actionbar/filterConfigActive.d.ts +5 -5
- package/dist/src/components/control/actionbar/filterConfigActive.d.ts.map +1 -1
- package/dist/src/components/layout/Cell.vue.d.ts +0 -2
- package/dist/src/components/layout/Cell.vue.d.ts.map +1 -1
- package/dist/src/components/layout/CellProps.d.ts +3 -5
- package/dist/src/components/layout/CellProps.d.ts.map +1 -1
- package/dist/src/components/layout/CellRenderer.vue.d.ts.map +1 -1
- package/dist/src/components/layout/CellRendererProps.d.ts +0 -1
- package/dist/src/components/layout/CellRendererProps.d.ts.map +1 -1
- package/dist/src/components/layout/Header.vue.d.ts +194 -412
- package/dist/src/components/layout/Header.vue.d.ts.map +1 -1
- package/dist/src/components/layout/HeaderCell.vue.d.ts +72 -0
- package/dist/src/components/layout/HeaderCell.vue.d.ts.map +1 -0
- package/dist/src/components/layout/Row.vue.d.ts +4 -2
- package/dist/src/components/layout/Row.vue.d.ts.map +1 -1
- package/dist/src/components/ui/CellSelectionOverlay.vue.d.ts.map +1 -1
- package/dist/src/components/ui/CellSelectionOverlayProps.d.ts +1 -1
- package/dist/src/components/ui/CellSelectionOverlayProps.d.ts.map +1 -1
- package/dist/src/components/ui/EmptyRow.vue.d.ts +1 -1
- package/dist/src/components/ui/EmptyRow.vue.d.ts.map +1 -1
- package/dist/src/config/table.config.d.ts +11 -21
- package/dist/src/config/table.config.d.ts.map +1 -1
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/index.d.ts +14 -17
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/ActionConfig.d.ts +16 -0
- package/dist/src/types/ActionConfig.d.ts.map +1 -0
- package/dist/src/types/ColumnConfig.d.ts +44 -0
- package/dist/src/types/ColumnConfig.d.ts.map +1 -0
- package/dist/src/types/ColumnState.d.ts +17 -0
- package/dist/src/types/ColumnState.d.ts.map +1 -0
- package/dist/src/types/FilterConfig.d.ts +10 -3
- package/dist/src/types/FilterConfig.d.ts.map +1 -1
- package/dist/src/types/PageConfig.d.ts +13 -0
- package/dist/src/types/PageConfig.d.ts.map +1 -0
- package/dist/src/types/RowConfig.d.ts +15 -0
- package/dist/src/types/RowConfig.d.ts.map +1 -0
- package/dist/src/types/SubMenuConfig.d.ts +11 -0
- package/dist/src/types/SubMenuConfig.d.ts.map +1 -0
- package/dist/src/types/TableConfig.d.ts +35 -38
- package/dist/src/types/TableConfig.d.ts.map +1 -1
- package/dist/src/{util → utils}/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/src/config/time.config.d.ts +0 -53
- package/dist/src/config/time.config.d.ts.map +0 -1
- package/dist/src/types/DataConfig.d.ts +0 -40
- package/dist/src/types/DataConfig.d.ts.map +0 -1
- package/dist/src/util/constants.d.ts.map +0 -1
- package/dist/src/util/getColumnDomains.d.ts +0 -7
- package/dist/src/util/getColumnDomains.d.ts.map +0 -1
- package/dist/src/util/getFilterConfigs.d.ts +0 -11
- package/dist/src/util/getFilterConfigs.d.ts.map +0 -1
- package/dist/src/util/getNextPage.d.ts +0 -2
- package/dist/src/util/getNextPage.d.ts.map +0 -1
- package/dist/src/util/getWrappedArondNextElement.d.ts +0 -6
- package/dist/src/util/getWrappedArondNextElement.d.ts.map +0 -1
- package/dist/src/util/index.d.ts.map +0 -1
- package/dist/src/util/isSinglePage.d.ts +0 -3
- package/dist/src/util/isSinglePage.d.ts.map +0 -1
- package/dist/src/util/processSelection.d.ts +0 -2
- package/dist/src/util/processSelection.d.ts.map +0 -1
- package/dist/src/util/transform/filter.d.ts +0 -8
- package/dist/src/util/transform/filter.d.ts.map +0 -1
- package/dist/src/util/transform/group.d.ts +0 -7
- package/dist/src/util/transform/group.d.ts.map +0 -1
- package/dist/src/util/transform/paginate.d.ts +0 -4
- package/dist/src/util/transform/paginate.d.ts.map +0 -1
- package/dist/src/util/transform/search.d.ts +0 -3
- package/dist/src/util/transform/search.d.ts.map +0 -1
- package/dist/src/util/transform/sort.d.ts +0 -2
- package/dist/src/util/transform/sort.d.ts.map +0 -1
- /package/dist/src/{util/constants.d.ts → constants.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,74 +1,6 @@
|
|
|
1
1
|
import { computed, unref, watch, ref, isRef, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, inject, provide, defineComponent, openBlock, createElementBlock, withModifiers, renderSlot, shallowRef, toValue, readonly, createPropsRestProxy, useModel, createBlock, mergeProps, mergeModels, useTemplateRef, watchEffect, nextTick, withCtx, createVNode, useAttrs, useId, Fragment, createCommentVNode, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withKeys, normalizeStyle, renderList, onUnmounted, defineAsyncComponent, resolveDynamicComponent, h as h$1, useSlots, markRaw, createTextVNode, toRef, useCssVars, onBeforeUnmount, reactive, createSlots, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
2
|
|
|
3
|
-
import './index.css';const
|
|
4
|
-
const checkTimeFilter = (inDateString, timeFilterConfig) => {
|
|
5
|
-
try {
|
|
6
|
-
const now = /* @__PURE__ */ new Date();
|
|
7
|
-
if (typeof inDateString !== "string" || !("getFn" in timeFilterConfig) || !("setFn" in timeFilterConfig) || !("val" in timeFilterConfig)) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
const utcDateTime = inDateString.split(".")[0];
|
|
11
|
-
const di = new Date(utcDateTime);
|
|
12
|
-
if (!(di instanceof Date) || Number.isNaN(di.getTime())) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
const timeBoundsMs = now[timeFilterConfig.setFn](
|
|
16
|
-
now[timeFilterConfig.getFn]() - timeFilterConfig.val
|
|
17
|
-
);
|
|
18
|
-
return di.getTime() - timeBoundsMs >= 0;
|
|
19
|
-
} catch (_err) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const tableTimeFilters = {
|
|
24
|
-
"Last day": {
|
|
25
|
-
getFn: "getDate",
|
|
26
|
-
setFn: "setDate",
|
|
27
|
-
val: 1
|
|
28
|
-
},
|
|
29
|
-
"Last week": {
|
|
30
|
-
getFn: "getDate",
|
|
31
|
-
setFn: "setDate",
|
|
32
|
-
val: 7
|
|
33
|
-
},
|
|
34
|
-
"Last month": {
|
|
35
|
-
getFn: "getMonth",
|
|
36
|
-
setFn: "setMonth",
|
|
37
|
-
val: 1
|
|
38
|
-
},
|
|
39
|
-
"Last 3 months": {
|
|
40
|
-
getFn: "getMonth",
|
|
41
|
-
setFn: "setMonth",
|
|
42
|
-
val: 3
|
|
43
|
-
},
|
|
44
|
-
"Last 6 months": {
|
|
45
|
-
getFn: "getMonth",
|
|
46
|
-
setFn: "setMonth",
|
|
47
|
-
val: 6
|
|
48
|
-
},
|
|
49
|
-
"Last year": {
|
|
50
|
-
getFn: "getFullYear",
|
|
51
|
-
setFn: "setFullYear",
|
|
52
|
-
val: 1
|
|
53
|
-
},
|
|
54
|
-
"All time": {}
|
|
55
|
-
};
|
|
56
|
-
const months = {
|
|
57
|
-
1: "Jan.",
|
|
58
|
-
2: "Feb.",
|
|
59
|
-
3: "Mar.",
|
|
60
|
-
4: "Apr.",
|
|
61
|
-
5: "May",
|
|
62
|
-
6: "June",
|
|
63
|
-
7: "July",
|
|
64
|
-
8: "Aug.",
|
|
65
|
-
9: "Sept.",
|
|
66
|
-
10: "Oct.",
|
|
67
|
-
11: "Nov.",
|
|
68
|
-
12: "Dec."
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const defaultPageSize = 10;
|
|
3
|
+
import './index.css';const defaultPageSize = 10;
|
|
72
4
|
const tablePageSizes = [5, 10, 25, 50, 100];
|
|
73
5
|
const filterComponents = {
|
|
74
6
|
Multiselect: {
|
|
@@ -150,76 +82,12 @@ const columnSortText = {
|
|
|
150
82
|
descending: "Descending"
|
|
151
83
|
}
|
|
152
84
|
};
|
|
153
|
-
const valueTypeFormatters = {
|
|
154
|
-
Nominal: (val) => val,
|
|
155
|
-
String: (val) => val,
|
|
156
|
-
DateTime: (val) => {
|
|
157
|
-
try {
|
|
158
|
-
const separator = val.includes(".") ? "." : "+";
|
|
159
|
-
const utcDateTime = val.split(separator)[0];
|
|
160
|
-
const di = new Date(utcDateTime);
|
|
161
|
-
const hrdp = {
|
|
162
|
-
month: di.getMonth() + 1,
|
|
163
|
-
day: di.getDate(),
|
|
164
|
-
year: di.getFullYear(),
|
|
165
|
-
hour: di.getHours(),
|
|
166
|
-
minute: di.getMinutes()
|
|
167
|
-
};
|
|
168
|
-
if (Object.values(hrdp).some((part) => !part && part !== 0)) {
|
|
169
|
-
throw new SyntaxError("Can't parse date.");
|
|
170
|
-
}
|
|
171
|
-
const pad2 = (val2) => val2.toString().padStart(2, "0");
|
|
172
|
-
return (
|
|
173
|
-
// @ts-expect-error - we know that month is a valid index for the months array
|
|
174
|
-
`${months[hrdp.month]} ${pad2(hrdp.day)}, ${hrdp.year}, ${pad2(hrdp.hour)}:${pad2(hrdp.minute)}`
|
|
175
|
-
);
|
|
176
|
-
} catch (_error) {
|
|
177
|
-
return val;
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
Number: (val) => val?.toString(),
|
|
181
|
-
Boolean: (val) => val?.toString(),
|
|
182
|
-
Array: (val) => val?.length ? `${val.length} items` : "-",
|
|
183
|
-
Object: (val) => val ? `${Object.keys(val).length} items` : "-"
|
|
184
|
-
};
|
|
185
|
-
const typeFormatters = (type) => (val) => valueTypeFormatters[type](val);
|
|
186
|
-
|
|
187
|
-
const isNonEmptyObject = (val) => val !== null && typeof val === "object" && Object.getOwnPropertyNames(val).length > 0;
|
|
188
|
-
const isObjectRepresentation = (val) => {
|
|
189
|
-
const possibleKeys = ["value", "metadata", "color"];
|
|
190
|
-
return isNonEmptyObject(val) && Object.getOwnPropertyNames(val).every((key) => possibleKeys.includes(key));
|
|
191
|
-
};
|
|
192
|
-
const unpackObjectRepresentation = (val) => {
|
|
193
|
-
if (isObjectRepresentation(val)) {
|
|
194
|
-
if (val.hasOwnProperty("metadata") && !val.hasOwnProperty("value")) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
return val.value;
|
|
198
|
-
}
|
|
199
|
-
return val;
|
|
200
|
-
};
|
|
201
|
-
const getColor = (val) => {
|
|
202
|
-
if (isObjectRepresentation(val) && val.hasOwnProperty("color")) {
|
|
203
|
-
const color = val.color;
|
|
204
|
-
return typeof color === "undefined" ? null : color;
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
};
|
|
208
|
-
const isMissingValue = (val) => val === null || isObjectRepresentation(val) && val?.hasOwnProperty("metadata");
|
|
209
|
-
const getMissingValueMessage = (cellData) => {
|
|
210
|
-
const metadata = cellData?.metadata;
|
|
211
|
-
const missingValueMsg = typeof metadata === "string" ? ` (${metadata})` : "";
|
|
212
|
-
return `Missing Value${missingValueMsg}`;
|
|
213
|
-
};
|
|
214
|
-
const isEmpty = (val) => typeof unpackObjectRepresentation(val) === "undefined";
|
|
215
|
-
const getPropertiesFromColumns = (columnConfigs, key) => columnConfigs.map((colConfig) => colConfig[key]);
|
|
216
85
|
|
|
217
86
|
const kdsCoreBorderWidthXs = 1;
|
|
218
87
|
const kdsDimensionComponentHeight1p75x = 28;
|
|
219
88
|
const kdsDimensionComponentHeight2p5x = 40;
|
|
220
89
|
const kdsDimensionComponentWidth1x = 16;
|
|
221
90
|
const kdsDimensionComponentWidth2x = 32;
|
|
222
|
-
const kdsSpacingContainer0p10x = 1;
|
|
223
91
|
const kdsSpacingContainer0p37x = 6;
|
|
224
92
|
const kdsSpacingContainer0p5x = 8;
|
|
225
93
|
const kdsSpacingContainer0p75x = 12;
|
|
@@ -235,7 +103,6 @@ const COMPACT_ROW_PADDING_TOP_BOTTOM = kdsSpacingContainer0p37x;
|
|
|
235
103
|
const CELL_PADDING_HORIZONTAL = kdsSpacingContainer0p5x;
|
|
236
104
|
const MIN_ROW_HEIGHT = COMPACT_ROW_HEIGHT;
|
|
237
105
|
const HEADER_HEIGHT = kdsDimensionComponentHeight2p5x + 2 * kdsCoreBorderWidthXs;
|
|
238
|
-
const MAX_SUB_MENU_WIDTH = 160;
|
|
239
106
|
const ENABLE_SCROLL_AFTER_ROW_RESIZE_DELAY = 100;
|
|
240
107
|
const COLUMN_RESIZE_DRAG_HANDLE_WIDTH = 5;
|
|
241
108
|
const EXPAND_BUTTON_WIDTH = kdsDimensionComponentWidth1x;
|
|
@@ -248,6 +115,35 @@ const constants = {
|
|
|
248
115
|
CELL_PADDING_HORIZONTAL
|
|
249
116
|
};
|
|
250
117
|
|
|
118
|
+
const isNonEmptyObject = (val) => val !== null && typeof val === "object" && Object.getOwnPropertyNames(val).length > 0;
|
|
119
|
+
const isObjectRepresentation = (val) => {
|
|
120
|
+
const possibleKeys = ["value", "metadata", "color"];
|
|
121
|
+
return isNonEmptyObject(val) && Object.getOwnPropertyNames(val).every((key) => possibleKeys.includes(key));
|
|
122
|
+
};
|
|
123
|
+
const unpackObjectRepresentation = (val) => {
|
|
124
|
+
if (isObjectRepresentation(val)) {
|
|
125
|
+
if (val.hasOwnProperty("metadata") && !val.hasOwnProperty("value")) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return val.value;
|
|
129
|
+
}
|
|
130
|
+
return val;
|
|
131
|
+
};
|
|
132
|
+
const getColor = (val) => {
|
|
133
|
+
if (isObjectRepresentation(val) && val.hasOwnProperty("color")) {
|
|
134
|
+
const color = val.color;
|
|
135
|
+
return typeof color === "undefined" ? null : color;
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
};
|
|
139
|
+
const isMissingValue = (val) => val === null || isObjectRepresentation(val) && val?.hasOwnProperty("metadata");
|
|
140
|
+
const getMissingValueMessage = (cellData) => {
|
|
141
|
+
const metadata = cellData?.metadata;
|
|
142
|
+
const missingValueMsg = typeof metadata === "string" ? ` (${metadata})` : "";
|
|
143
|
+
return `Missing Value${missingValueMsg}`;
|
|
144
|
+
};
|
|
145
|
+
const getPropertiesFromColumns = (columnConfigs, key) => columnConfigs.map((colConfig) => colConfig[key]);
|
|
146
|
+
|
|
251
147
|
var B$1 = Object.defineProperty;
|
|
252
148
|
var b$1 = (t, e, r) => e in t ? B$1(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
|
|
253
149
|
var u$1 = (t, e, r) => b$1(t, typeof e != "symbol" ? e + "" : e, r);
|
|
@@ -507,8 +403,8 @@ const getMetaOrCtrlKey = () => {
|
|
|
507
403
|
|
|
508
404
|
const injectionKey$4 = /* @__PURE__ */ Symbol("dataValueViewsIsShown");
|
|
509
405
|
const useDataValueViews = () => inject(injectionKey$4);
|
|
510
|
-
const provideDataValueViewsIsShown = (
|
|
511
|
-
isShown: computed(() => Boolean(
|
|
406
|
+
const provideDataValueViewsIsShown = (tableState, closeDataValueView) => provide(injectionKey$4, {
|
|
407
|
+
isShown: computed(() => Boolean(tableState.value.dataValueViewIsShown)),
|
|
512
408
|
close: closeDataValueView
|
|
513
409
|
});
|
|
514
410
|
|
|
@@ -538,7 +434,7 @@ const useStartEditingKeydown = ({
|
|
|
538
434
|
return { onKeydown };
|
|
539
435
|
};
|
|
540
436
|
|
|
541
|
-
const _sfc_main$
|
|
437
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
542
438
|
__name: "TableBodyNavigatable",
|
|
543
439
|
emits: ["moveSelection", "clearSelection", "expandSelectedCell", "startEditing", "bodyFocusin", "bodyFocusout"],
|
|
544
440
|
setup(__props, { emit: __emit }) {
|
|
@@ -621,7 +517,7 @@ const _export_sfc$1 = (sfc, props) => {
|
|
|
621
517
|
return target;
|
|
622
518
|
};
|
|
623
519
|
|
|
624
|
-
const TableBodyNavigatable = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
520
|
+
const TableBodyNavigatable = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__scopeId", "data-v-70f2c330"]]);
|
|
625
521
|
|
|
626
522
|
//#endregion
|
|
627
523
|
//#region tryOnScopeDispose/index.ts
|
|
@@ -8241,7 +8137,7 @@ function applyDefaultFilter(v) {
|
|
|
8241
8137
|
return name + "(" + defaultValue + unit + ")";
|
|
8242
8138
|
}
|
|
8243
8139
|
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
|
|
8244
|
-
const filter
|
|
8140
|
+
const filter = {
|
|
8245
8141
|
...complex,
|
|
8246
8142
|
getAnimatableNone: (v) => {
|
|
8247
8143
|
const functions = v.match(functionRegex);
|
|
@@ -8371,8 +8267,8 @@ const defaultValueTypes = {
|
|
|
8371
8267
|
borderRightColor: color,
|
|
8372
8268
|
borderBottomColor: color,
|
|
8373
8269
|
borderLeftColor: color,
|
|
8374
|
-
filter
|
|
8375
|
-
WebkitFilter: filter
|
|
8270
|
+
filter,
|
|
8271
|
+
WebkitFilter: filter,
|
|
8376
8272
|
mask,
|
|
8377
8273
|
WebkitMask: mask,
|
|
8378
8274
|
};
|
|
@@ -8381,7 +8277,7 @@ const defaultValueTypes = {
|
|
|
8381
8277
|
*/
|
|
8382
8278
|
const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
8383
8279
|
|
|
8384
|
-
const customTypes = /*@__PURE__*/ new Set([filter
|
|
8280
|
+
const customTypes = /*@__PURE__*/ new Set([filter, mask]);
|
|
8385
8281
|
function getAnimatableNone(key, value) {
|
|
8386
8282
|
let defaultValueType = getDefaultValueType(key);
|
|
8387
8283
|
if (!customTypes.has(defaultValueType))
|
|
@@ -15428,24 +15324,24 @@ const useIndicesAndStylesFor = (data) => {
|
|
|
15428
15324
|
};
|
|
15429
15325
|
};
|
|
15430
15326
|
|
|
15431
|
-
const _hoisted_1$
|
|
15327
|
+
const _hoisted_1$d = {
|
|
15432
15328
|
key: 0,
|
|
15433
15329
|
class: "deletion-cell-spacer"
|
|
15434
15330
|
};
|
|
15435
|
-
const _sfc_main$
|
|
15331
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
15436
15332
|
__name: "EmptyRow",
|
|
15437
15333
|
props: {
|
|
15438
15334
|
width: {},
|
|
15439
15335
|
height: {},
|
|
15440
15336
|
compact: { type: Boolean },
|
|
15441
|
-
|
|
15337
|
+
colSizes: {},
|
|
15442
15338
|
specialColumnSizes: {},
|
|
15443
15339
|
tableConfig: {}
|
|
15444
15340
|
},
|
|
15445
15341
|
setup(__props) {
|
|
15446
15342
|
const props = __props;
|
|
15447
15343
|
const { indexedData: indexedRow, style: rowStyles } = useIndicesAndStylesFor(
|
|
15448
|
-
toRef(props, "
|
|
15344
|
+
toRef(props, "colSizes")
|
|
15449
15345
|
);
|
|
15450
15346
|
const paddingTopBottom = computed(
|
|
15451
15347
|
() => props.compact ? COMPACT_ROW_PADDING_TOP_BOTTOM : DEFAULT_ROW_PADDING_TOP_BOTTOM
|
|
@@ -15458,7 +15354,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
15458
15354
|
height: `${__props.height}px`
|
|
15459
15355
|
})
|
|
15460
15356
|
}, [
|
|
15461
|
-
__props.tableConfig.enableRowDeletion ? (openBlock(), createElementBlock("td", _hoisted_1$
|
|
15357
|
+
__props.tableConfig.enableRowDeletion ? (openBlock(), createElementBlock("td", _hoisted_1$d)) : createCommentVNode("", true),
|
|
15462
15358
|
__props.tableConfig.showSelection ? (openBlock(), createElementBlock("td", {
|
|
15463
15359
|
key: 1,
|
|
15464
15360
|
class: "select-cell",
|
|
@@ -15492,9 +15388,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
15492
15388
|
}
|
|
15493
15389
|
});
|
|
15494
15390
|
|
|
15495
|
-
const EmptyRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15391
|
+
const EmptyRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__scopeId", "data-v-640baae1"]]);
|
|
15496
15392
|
|
|
15497
|
-
const _sfc_main$
|
|
15393
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
15498
15394
|
__name: "PlaceholderRow",
|
|
15499
15395
|
props: {
|
|
15500
15396
|
height: {}
|
|
@@ -15511,16 +15407,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
15511
15407
|
}
|
|
15512
15408
|
});
|
|
15513
15409
|
|
|
15514
|
-
const PlaceholderRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15410
|
+
const PlaceholderRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__scopeId", "data-v-df158652"]]);
|
|
15515
15411
|
|
|
15516
|
-
const _sfc_main$
|
|
15412
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
15517
15413
|
__name: "VirtualRow",
|
|
15518
15414
|
props: {
|
|
15519
15415
|
dataItem: {},
|
|
15520
15416
|
rowHeight: {},
|
|
15521
15417
|
compact: { type: Boolean },
|
|
15522
15418
|
bodyWidth: {},
|
|
15523
|
-
|
|
15419
|
+
colSizes: {},
|
|
15524
15420
|
specialColumnSizes: {},
|
|
15525
15421
|
tableConfig: {}
|
|
15526
15422
|
},
|
|
@@ -15539,10 +15435,10 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
15539
15435
|
height: __props.rowHeight,
|
|
15540
15436
|
compact: __props.compact,
|
|
15541
15437
|
width: __props.bodyWidth,
|
|
15542
|
-
"
|
|
15438
|
+
"col-sizes": __props.colSizes,
|
|
15543
15439
|
"special-column-sizes": __props.specialColumnSizes,
|
|
15544
15440
|
"table-config": __props.tableConfig
|
|
15545
|
-
}, null, 8, ["height", "compact", "width", "
|
|
15441
|
+
}, null, 8, ["height", "compact", "width", "col-sizes", "special-column-sizes", "table-config"]));
|
|
15546
15442
|
};
|
|
15547
15443
|
}
|
|
15548
15444
|
});
|
|
@@ -15668,12 +15564,12 @@ const useResizeScrollSpacer = ({
|
|
|
15668
15564
|
};
|
|
15669
15565
|
};
|
|
15670
15566
|
|
|
15671
|
-
const _sfc_main$
|
|
15567
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
15672
15568
|
__name: "TableCoreVirtual",
|
|
15673
15569
|
props: {
|
|
15674
15570
|
scrollData: {},
|
|
15675
15571
|
scrollConfig: {},
|
|
15676
|
-
|
|
15572
|
+
colSizes: {},
|
|
15677
15573
|
specialColumnSizes: {},
|
|
15678
15574
|
currentBodyWidth: {},
|
|
15679
15575
|
tableConfig: {},
|
|
@@ -15697,7 +15593,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15697
15593
|
sizeManager
|
|
15698
15594
|
);
|
|
15699
15595
|
const columnSizeManager = withLeftSideSize(
|
|
15700
|
-
withRightSideSize(new Z$1(toRef(props, "
|
|
15596
|
+
withRightSideSize(new Z$1(toRef(props, "colSizes")))
|
|
15701
15597
|
);
|
|
15702
15598
|
const numRows = computed(
|
|
15703
15599
|
() => props.scrollData.length + props.scrollConfig.numRowsAbove + props.scrollConfig.numRowsBelow
|
|
@@ -15810,13 +15706,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15810
15706
|
style: normalizeStyle(__props.tableConfig.forceRenderAll ? {} : unref(verticalStyles))
|
|
15811
15707
|
}, [
|
|
15812
15708
|
(openBlock(true), createElementBlock(Fragment, null, renderList(renderedRowIndices.value, (rowInd) => {
|
|
15813
|
-
return openBlock(), createBlock(_sfc_main$
|
|
15709
|
+
return openBlock(), createBlock(_sfc_main$k, {
|
|
15814
15710
|
key: rowInd,
|
|
15815
15711
|
"row-height": __props.scrollConfig.itemSize,
|
|
15816
15712
|
compact: __props.scrollConfig.compact,
|
|
15817
15713
|
"body-width": __props.currentBodyWidth,
|
|
15818
15714
|
"data-item": __props.scrollData[rowInd - __props.scrollConfig.numRowsAbove],
|
|
15819
|
-
"
|
|
15715
|
+
"col-sizes": __props.colSizes,
|
|
15820
15716
|
"special-column-sizes": __props.specialColumnSizes,
|
|
15821
15717
|
"table-config": __props.tableConfig
|
|
15822
15718
|
}, {
|
|
@@ -15827,7 +15723,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15827
15723
|
}, void 0, true)
|
|
15828
15724
|
]),
|
|
15829
15725
|
_: 2
|
|
15830
|
-
}, 1032, ["row-height", "compact", "body-width", "data-item", "
|
|
15726
|
+
}, 1032, ["row-height", "compact", "body-width", "data-item", "col-sizes", "special-column-sizes", "table-config"]);
|
|
15831
15727
|
}), 128))
|
|
15832
15728
|
], 4)
|
|
15833
15729
|
]),
|
|
@@ -15854,7 +15750,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15854
15750
|
}
|
|
15855
15751
|
});
|
|
15856
15752
|
|
|
15857
|
-
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15753
|
+
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-a66c9aef"]]);
|
|
15858
15754
|
|
|
15859
15755
|
function getDefaultExportFromCjs (x) {
|
|
15860
15756
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -16010,14 +15906,15 @@ const useAvailableWidth = ({
|
|
|
16010
15906
|
return { innerWidthToBodyWidth, fitsInsideTotalWidth };
|
|
16011
15907
|
};
|
|
16012
15908
|
|
|
16013
|
-
const _sfc_main$
|
|
15909
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
16014
15910
|
__name: "TableCore",
|
|
16015
15911
|
props: {
|
|
16016
15912
|
scrollData: {},
|
|
16017
15913
|
scrollConfig: {},
|
|
16018
15914
|
tableConfig: {},
|
|
15915
|
+
subMenuConfig: {},
|
|
16019
15916
|
totalWidth: {},
|
|
16020
|
-
|
|
15917
|
+
colSizes: {},
|
|
16021
15918
|
currentRowHeight: {},
|
|
16022
15919
|
columnResize: {},
|
|
16023
15920
|
newColumnButtonWidth: {}
|
|
@@ -16042,7 +15939,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
16042
15939
|
() => props.tableConfig.enableRowDeletion ? SPECIAL_COLUMNS_SIZE : 0
|
|
16043
15940
|
);
|
|
16044
15941
|
const rightSideSize = computed(() => {
|
|
16045
|
-
const rowSubMenuSpace = (props.
|
|
15942
|
+
const rowSubMenuSpace = (props.subMenuConfig.subMenuItems ?? []).length > 0 || props.subMenuConfig.reserveSpaceForSubMenu === "always" ? SPECIAL_COLUMNS_SIZE : 0;
|
|
16046
15943
|
return rowSubMenuSpace + props.newColumnButtonWidth;
|
|
16047
15944
|
});
|
|
16048
15945
|
const scrolledElement = ref(null);
|
|
@@ -16055,7 +15952,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
16055
15952
|
totalWidth: toRef(props, "totalWidth")
|
|
16056
15953
|
});
|
|
16057
15954
|
const currentBodyWidth = computed(() => {
|
|
16058
|
-
const widthContentColumns = props.
|
|
15955
|
+
const widthContentColumns = props.colSizes.reduce(
|
|
16059
15956
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16060
15957
|
(prev, curr) => prev + curr,
|
|
16061
15958
|
0
|
|
@@ -16074,7 +15971,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
16074
15971
|
ref_key: "tableCoreVirtual",
|
|
16075
15972
|
ref: tableCoreVirtual,
|
|
16076
15973
|
"scroll-data": __props.scrollData[0],
|
|
16077
|
-
"
|
|
15974
|
+
"col-sizes": __props.colSizes,
|
|
16078
15975
|
"scroll-config": __props.scrollConfig,
|
|
16079
15976
|
"special-column-sizes": {
|
|
16080
15977
|
selectionSize: selectionSize.value,
|
|
@@ -16110,7 +16007,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
16110
16007
|
renderSlot(_ctx.$slots, "belowBody")
|
|
16111
16008
|
]),
|
|
16112
16009
|
_: 3
|
|
16113
|
-
}, 8, ["scroll-data", "
|
|
16010
|
+
}, 8, ["scroll-data", "col-sizes", "scroll-config", "special-column-sizes", "current-body-width", "table-config", "column-resize-active"]);
|
|
16114
16011
|
};
|
|
16115
16012
|
}
|
|
16116
16013
|
});
|
|
@@ -16365,126 +16262,14 @@ const createEditingCellKeydownHandler = ({
|
|
|
16365
16262
|
};
|
|
16366
16263
|
};
|
|
16367
16264
|
|
|
16368
|
-
const
|
|
16369
|
-
if (is === "ControlMultiselect") {
|
|
16370
|
-
return [];
|
|
16371
|
-
}
|
|
16372
|
-
return "";
|
|
16373
|
-
};
|
|
16374
|
-
const missingValueFor = (is) => {
|
|
16375
|
-
if (is === "ControlMultiselect") {
|
|
16376
|
-
return [null];
|
|
16377
|
-
}
|
|
16378
|
-
return null;
|
|
16379
|
-
};
|
|
16380
|
-
const isMissingMode = (config) => {
|
|
16381
|
-
if (config.is === "ControlMultiselect") {
|
|
16382
|
-
return Array.isArray(config.modelValue) && config.modelValue.length === 1 && config.modelValue[0] === null;
|
|
16383
|
-
}
|
|
16384
|
-
return config.modelValue === null;
|
|
16385
|
-
};
|
|
16386
|
-
const isActive = (config) => {
|
|
16387
|
-
if (!config) {
|
|
16388
|
-
return false;
|
|
16389
|
-
}
|
|
16390
|
-
if (isMissingMode(config)) {
|
|
16391
|
-
return true;
|
|
16392
|
-
}
|
|
16393
|
-
if (config.is === "ControlMultiselect") {
|
|
16394
|
-
return Array.isArray(config.modelValue) && config.modelValue.length > 0;
|
|
16395
|
-
}
|
|
16396
|
-
return config.modelValue !== void 0 && config.modelValue !== "";
|
|
16397
|
-
};
|
|
16398
|
-
|
|
16399
|
-
const useHeaderMenuItems = ({
|
|
16400
|
-
enableSorting,
|
|
16401
|
-
enableFiltering,
|
|
16402
|
-
filterConfig,
|
|
16403
|
-
sortDirection,
|
|
16404
|
-
headerSubMenuItems,
|
|
16405
|
-
sortTexts,
|
|
16406
|
-
onColumnSort,
|
|
16407
|
-
openFilterControl,
|
|
16408
|
-
clearFilter
|
|
16409
|
-
}) => {
|
|
16410
|
-
const staticItems = [];
|
|
16411
|
-
const hasDynamicItems = Boolean(headerSubMenuItems?.length);
|
|
16412
|
-
const showFilterItem = enableFiltering && filterConfig !== void 0;
|
|
16413
|
-
const filterIsActive = showFilterItem && isActive(filterConfig);
|
|
16414
|
-
if (enableSorting) {
|
|
16415
|
-
staticItems.push({
|
|
16416
|
-
id: "table-header-sort",
|
|
16417
|
-
text: "Sort this column",
|
|
16418
|
-
separator: !showFilterItem && hasDynamicItems,
|
|
16419
|
-
sectionHeadline: true,
|
|
16420
|
-
sectionHeadlineIcon: "sort-ascending"
|
|
16421
|
-
});
|
|
16422
|
-
staticItems.push({
|
|
16423
|
-
id: "sort-asc",
|
|
16424
|
-
text: sortTexts.ascending,
|
|
16425
|
-
handler: (_item, _event) => {
|
|
16426
|
-
onColumnSort(1);
|
|
16427
|
-
},
|
|
16428
|
-
trailingIcon: sortDirection === 1 ? "checkmark" : void 0
|
|
16429
|
-
});
|
|
16430
|
-
staticItems.push({
|
|
16431
|
-
id: "sort-desc",
|
|
16432
|
-
text: sortTexts.descending,
|
|
16433
|
-
handler: (_item, _event) => {
|
|
16434
|
-
onColumnSort(-1);
|
|
16435
|
-
},
|
|
16436
|
-
trailingIcon: sortDirection === -1 ? "checkmark" : void 0
|
|
16437
|
-
});
|
|
16438
|
-
staticItems.push({
|
|
16439
|
-
id: "sort-none",
|
|
16440
|
-
text: "No sorting",
|
|
16441
|
-
handler: (_item, _event) => {
|
|
16442
|
-
onColumnSort(0);
|
|
16443
|
-
},
|
|
16444
|
-
trailingIcon: sortDirection === 0 ? "checkmark" : void 0
|
|
16445
|
-
});
|
|
16446
|
-
}
|
|
16447
|
-
if (showFilterItem) {
|
|
16448
|
-
if (filterIsActive) {
|
|
16449
|
-
staticItems.push({
|
|
16450
|
-
id: "table-header-clear-filter",
|
|
16451
|
-
text: "Clear filter",
|
|
16452
|
-
separator: hasDynamicItems,
|
|
16453
|
-
accessory: {
|
|
16454
|
-
type: "icon",
|
|
16455
|
-
name: "filter"
|
|
16456
|
-
},
|
|
16457
|
-
handler: (_item, _event) => {
|
|
16458
|
-
clearFilter();
|
|
16459
|
-
}
|
|
16460
|
-
});
|
|
16461
|
-
} else {
|
|
16462
|
-
staticItems.push({
|
|
16463
|
-
id: "table-header-filter",
|
|
16464
|
-
text: "Filter by this column",
|
|
16465
|
-
separator: hasDynamicItems,
|
|
16466
|
-
accessory: {
|
|
16467
|
-
type: "icon",
|
|
16468
|
-
name: "filter"
|
|
16469
|
-
},
|
|
16470
|
-
handler: (_item, _event) => {
|
|
16471
|
-
openFilterControl();
|
|
16472
|
-
}
|
|
16473
|
-
});
|
|
16474
|
-
}
|
|
16475
|
-
}
|
|
16476
|
-
const menuItems = [...staticItems, ...headerSubMenuItems ?? []];
|
|
16477
|
-
return menuItems.length ? menuItems : void 0;
|
|
16478
|
-
};
|
|
16479
|
-
|
|
16480
|
-
const _hoisted_1$b = {
|
|
16265
|
+
const _hoisted_1$c = {
|
|
16481
16266
|
key: 0,
|
|
16482
16267
|
class: "page-navigation"
|
|
16483
16268
|
};
|
|
16484
16269
|
const _hoisted_2$8 = { class: "navigation-buttons" };
|
|
16485
16270
|
const _hoisted_3$5 = { class: "page-count" };
|
|
16486
16271
|
const _hoisted_4$3 = { class: "navigation-buttons" };
|
|
16487
|
-
const _sfc_main$
|
|
16272
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
16488
16273
|
__name: "PageNavigation",
|
|
16489
16274
|
props: {
|
|
16490
16275
|
currentItems: { default: 0 },
|
|
@@ -16507,7 +16292,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
16507
16292
|
emit("pageChange", newPageNumber);
|
|
16508
16293
|
};
|
|
16509
16294
|
return (_ctx, _cache) => {
|
|
16510
|
-
return hasNextPage.value || hasPreviousPage.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16295
|
+
return hasNextPage.value || hasPreviousPage.value ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
16511
16296
|
createElementVNode("div", _hoisted_2$8, [
|
|
16512
16297
|
createVNode(unref(_sfc_main$1s), {
|
|
16513
16298
|
variant: "transparent",
|
|
@@ -16550,9 +16335,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
16550
16335
|
}
|
|
16551
16336
|
});
|
|
16552
16337
|
|
|
16553
|
-
const PageNavigation = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16338
|
+
const PageNavigation = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-f8714af0"]]);
|
|
16554
16339
|
|
|
16555
|
-
const _hoisted_1$
|
|
16340
|
+
const _hoisted_1$b = {
|
|
16556
16341
|
key: 0,
|
|
16557
16342
|
class: "subtle"
|
|
16558
16343
|
};
|
|
@@ -16566,7 +16351,7 @@ const _hoisted_4$2 = {
|
|
|
16566
16351
|
class: "muted"
|
|
16567
16352
|
};
|
|
16568
16353
|
const _hoisted_5$1 = { class: "subtle" };
|
|
16569
|
-
const _sfc_main$
|
|
16354
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
16570
16355
|
__name: "PageRowRange",
|
|
16571
16356
|
props: {
|
|
16572
16357
|
currentItems: { default: 0 },
|
|
@@ -16588,7 +16373,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
16588
16373
|
() => hasMultiplePages.value && __props.currentItems ? `of ${__props.currentItems}` : __props.currentItems
|
|
16589
16374
|
);
|
|
16590
16375
|
return (_ctx, _cache) => {
|
|
16591
|
-
return __props.showTableSize && __props.currentItems === 0 ? (openBlock(), createElementBlock("span", _hoisted_1$
|
|
16376
|
+
return __props.showTableSize && __props.currentItems === 0 ? (openBlock(), createElementBlock("span", _hoisted_1$b, "No data")) : (openBlock(), createElementBlock("div", _hoisted_2$7, [
|
|
16592
16377
|
createElementVNode("span", _hoisted_3$4, toDisplayString(__props.rowLabel) + ":", 1),
|
|
16593
16378
|
hasMultiplePages.value && __props.currentItems ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(pageRangeStart.value) + "–" + toDisplayString(pageRangeEnd.value), 1)) : createCommentVNode("", true),
|
|
16594
16379
|
createElementVNode("span", _hoisted_5$1, toDisplayString(rowCountText.value), 1)
|
|
@@ -16597,25 +16382,34 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
16597
16382
|
}
|
|
16598
16383
|
});
|
|
16599
16384
|
|
|
16600
|
-
const PageRowRange = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16385
|
+
const PageRowRange = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__scopeId", "data-v-6cdf0c06"]]);
|
|
16601
16386
|
|
|
16602
|
-
const _sfc_main$
|
|
16387
|
+
const _sfc_main$f = {
|
|
16603
16388
|
components: {
|
|
16604
16389
|
PageNavigation,
|
|
16605
16390
|
PageRowRange,
|
|
16606
16391
|
KdsMenuButton: _sfc_main$1h
|
|
16607
16392
|
},
|
|
16608
16393
|
props: {
|
|
16394
|
+
tableConfig: {
|
|
16395
|
+
type: Object,
|
|
16396
|
+
required: true
|
|
16397
|
+
},
|
|
16609
16398
|
pageConfig: {
|
|
16610
16399
|
type: Object,
|
|
16611
|
-
|
|
16400
|
+
required: true
|
|
16401
|
+
},
|
|
16402
|
+
tableState: {
|
|
16403
|
+
type: Object,
|
|
16404
|
+
required: true
|
|
16405
|
+
},
|
|
16406
|
+
pageState: {
|
|
16407
|
+
type: Object,
|
|
16408
|
+
required: true
|
|
16612
16409
|
}
|
|
16613
16410
|
},
|
|
16614
16411
|
emits: ["pageSizeUpdate", "pageChange"],
|
|
16615
16412
|
computed: {
|
|
16616
|
-
showPageNavigationControls() {
|
|
16617
|
-
return this.pageConfig.showPageControls ?? true;
|
|
16618
|
-
},
|
|
16619
16413
|
pageSizeItems() {
|
|
16620
16414
|
return (this.pageConfig.possiblePageSizes ?? []).map((pageSize) => ({
|
|
16621
16415
|
id: pageSize.toString(),
|
|
@@ -16634,28 +16428,27 @@ const _sfc_main$e = {
|
|
|
16634
16428
|
}
|
|
16635
16429
|
};
|
|
16636
16430
|
|
|
16637
|
-
const _hoisted_1$
|
|
16431
|
+
const _hoisted_1$a = { class: "page-controls" };
|
|
16638
16432
|
const _hoisted_2$6 = { class: "page-size-menu" };
|
|
16639
16433
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16640
16434
|
const _component_PageRowRange = resolveComponent("PageRowRange");
|
|
16641
16435
|
const _component_PageNavigation = resolveComponent("PageNavigation");
|
|
16642
16436
|
const _component_KdsMenuButton = resolveComponent("KdsMenuButton");
|
|
16643
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
16437
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
16644
16438
|
createVNode(_component_PageRowRange, {
|
|
16645
16439
|
class: "page-row-range",
|
|
16646
|
-
"current-items": $props.
|
|
16440
|
+
"current-items": $props.tableState.currentSize,
|
|
16647
16441
|
"page-size": $props.pageConfig.pageSize,
|
|
16648
|
-
"current-page": $props.
|
|
16649
|
-
"show-table-size": $props.
|
|
16650
|
-
"row-label": $props.
|
|
16442
|
+
"current-page": $props.pageState.currentPage,
|
|
16443
|
+
"show-table-size": $props.tableConfig.showTableSize,
|
|
16444
|
+
"row-label": $props.tableConfig.rowLabel
|
|
16651
16445
|
}, null, 8, ["current-items", "page-size", "current-page", "show-table-size", "row-label"]),
|
|
16652
|
-
|
|
16653
|
-
|
|
16654
|
-
"current-items": $props.pageConfig.currentSize,
|
|
16446
|
+
createVNode(_component_PageNavigation, {
|
|
16447
|
+
"current-items": $props.tableState.currentSize,
|
|
16655
16448
|
"page-size": $props.pageConfig.pageSize,
|
|
16656
|
-
"current-page": $props.
|
|
16449
|
+
"current-page": $props.pageState.currentPage,
|
|
16657
16450
|
onPageChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("pageChange", $event))
|
|
16658
|
-
}, null, 8, ["current-items", "page-size", "current-page"])
|
|
16451
|
+
}, null, 8, ["current-items", "page-size", "current-page"]),
|
|
16659
16452
|
createElementVNode("div", _hoisted_2$6, [
|
|
16660
16453
|
createVNode(_component_KdsMenuButton, {
|
|
16661
16454
|
items: $options.pageSizeItems,
|
|
@@ -16668,9 +16461,40 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
16668
16461
|
])
|
|
16669
16462
|
]);
|
|
16670
16463
|
}
|
|
16671
|
-
const PageControls = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16464
|
+
const PageControls = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$4], ["__scopeId", "data-v-10c111ef"]]);
|
|
16465
|
+
|
|
16466
|
+
const defaultValueFor = (is) => {
|
|
16467
|
+
if (is === "ControlMultiselect") {
|
|
16468
|
+
return [];
|
|
16469
|
+
}
|
|
16470
|
+
return "";
|
|
16471
|
+
};
|
|
16472
|
+
const missingValueFor = (is) => {
|
|
16473
|
+
if (is === "ControlMultiselect") {
|
|
16474
|
+
return [null];
|
|
16475
|
+
}
|
|
16476
|
+
return null;
|
|
16477
|
+
};
|
|
16478
|
+
const isMissingMode = (config, value) => {
|
|
16479
|
+
if (config.is === "ControlMultiselect") {
|
|
16480
|
+
return Array.isArray(value) && value.length === 1 && value[0] === null;
|
|
16481
|
+
}
|
|
16482
|
+
return value === null;
|
|
16483
|
+
};
|
|
16484
|
+
const isActive = (config, value) => {
|
|
16485
|
+
if (!config) {
|
|
16486
|
+
return false;
|
|
16487
|
+
}
|
|
16488
|
+
if (isMissingMode(config, value)) {
|
|
16489
|
+
return true;
|
|
16490
|
+
}
|
|
16491
|
+
if (config.is === "ControlMultiselect") {
|
|
16492
|
+
return Array.isArray(value) && value.length > 0;
|
|
16493
|
+
}
|
|
16494
|
+
return value !== void 0 && value !== "";
|
|
16495
|
+
};
|
|
16672
16496
|
|
|
16673
|
-
const _hoisted_1$
|
|
16497
|
+
const _hoisted_1$9 = {
|
|
16674
16498
|
key: 0,
|
|
16675
16499
|
class: "rows"
|
|
16676
16500
|
};
|
|
@@ -16678,11 +16502,11 @@ const _hoisted_2$5 = {
|
|
|
16678
16502
|
key: 1,
|
|
16679
16503
|
class: "value"
|
|
16680
16504
|
};
|
|
16681
|
-
const _sfc_main$
|
|
16505
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
16682
16506
|
__name: "FilterControlBody",
|
|
16683
16507
|
props: {
|
|
16684
|
-
|
|
16685
|
-
|
|
16508
|
+
columns: {},
|
|
16509
|
+
colFilterValues: {}
|
|
16686
16510
|
},
|
|
16687
16511
|
emits: ["columnFilter"],
|
|
16688
16512
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16704,22 +16528,29 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16704
16528
|
return config;
|
|
16705
16529
|
};
|
|
16706
16530
|
const filterableColumnIndices = computed(
|
|
16707
|
-
() => (props.
|
|
16531
|
+
() => (props.columns ?? []).map((column, index) => ({ config: column.filterConfig, index })).filter(({ config }) => config !== void 0).map(({ index }) => index)
|
|
16708
16532
|
);
|
|
16709
16533
|
const trackedIndices = ref([]);
|
|
16710
16534
|
onMounted(() => {
|
|
16711
|
-
trackedIndices.value = (props.
|
|
16535
|
+
trackedIndices.value = (props.columns ?? []).map((column, index) => ({
|
|
16536
|
+
index,
|
|
16537
|
+
config: column.filterConfig,
|
|
16538
|
+
value: props.colFilterValues[column.id]
|
|
16539
|
+
})).filter(({ config, value }) => isActive(config, value)).map(({ index }) => index);
|
|
16712
16540
|
});
|
|
16713
16541
|
const visibleFilters = computed(
|
|
16714
16542
|
() => trackedIndices.value.map((index, rowPosition) => {
|
|
16715
|
-
const
|
|
16543
|
+
const column = props.columns?.[index];
|
|
16544
|
+
const config = column?.filterConfig;
|
|
16545
|
+
const value = props.colFilterValues[column.id];
|
|
16716
16546
|
if (!config) {
|
|
16717
16547
|
return null;
|
|
16718
16548
|
}
|
|
16719
16549
|
return {
|
|
16720
16550
|
rowPosition,
|
|
16721
16551
|
index,
|
|
16722
|
-
config: withFilteredPossibleValues(config)
|
|
16552
|
+
config: withFilteredPossibleValues(config),
|
|
16553
|
+
value
|
|
16723
16554
|
};
|
|
16724
16555
|
}).filter(
|
|
16725
16556
|
(entry) => entry !== null
|
|
@@ -16732,7 +16563,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16732
16563
|
(idx) => idx === currentIndex || !trackedIndices.value.includes(idx)
|
|
16733
16564
|
).map((idx) => ({
|
|
16734
16565
|
id: String(idx),
|
|
16735
|
-
text: props.
|
|
16566
|
+
text: props.columns?.[idx]?.header ?? ""
|
|
16736
16567
|
}));
|
|
16737
16568
|
const onColumnChange = (rowPosition, newIdAsString) => {
|
|
16738
16569
|
const newIndex = Number(newIdAsString);
|
|
@@ -16740,8 +16571,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16740
16571
|
if (oldIndex === newIndex) {
|
|
16741
16572
|
return;
|
|
16742
16573
|
}
|
|
16743
|
-
const
|
|
16744
|
-
|
|
16574
|
+
const oldColumn = props.columns?.[oldIndex];
|
|
16575
|
+
const oldConfig = oldColumn?.filterConfig;
|
|
16576
|
+
const oldValue = props.colFilterValues[oldColumn?.id];
|
|
16577
|
+
if (oldConfig && isActive(oldConfig, oldValue)) {
|
|
16745
16578
|
emit("columnFilter", oldIndex, defaultValueFor(oldConfig.is));
|
|
16746
16579
|
}
|
|
16747
16580
|
trackedIndices.value = trackedIndices.value.map(
|
|
@@ -16766,8 +16599,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16766
16599
|
};
|
|
16767
16600
|
const onDeleteRow = (rowPosition) => {
|
|
16768
16601
|
const index = trackedIndices.value[rowPosition];
|
|
16769
|
-
const
|
|
16770
|
-
|
|
16602
|
+
const column = props.columns?.[index];
|
|
16603
|
+
const config = column?.filterConfig;
|
|
16604
|
+
const value = props.colFilterValues[column?.id];
|
|
16605
|
+
if (isActive(config, value)) {
|
|
16771
16606
|
emit("columnFilter", index, defaultValueFor(config.is));
|
|
16772
16607
|
}
|
|
16773
16608
|
trackedIndices.value = trackedIndices.value.filter(
|
|
@@ -16798,8 +16633,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16798
16633
|
__expose({ addAndFocusColumn });
|
|
16799
16634
|
return (_ctx, _cache) => {
|
|
16800
16635
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
16801
|
-
visibleFilters.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16802
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFilters.value, ({ rowPosition, index, config }) => {
|
|
16636
|
+
visibleFilters.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
16637
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFilters.value, ({ rowPosition, index, config, value }) => {
|
|
16803
16638
|
return openBlock(), createElementBlock("div", {
|
|
16804
16639
|
key: index,
|
|
16805
16640
|
class: "row"
|
|
@@ -16814,19 +16649,19 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16814
16649
|
}, null, 8, ["model-value", "possible-values", "onUpdate:modelValue"]),
|
|
16815
16650
|
createVNode(unref(_sfc_main$z), {
|
|
16816
16651
|
class: "mode",
|
|
16817
|
-
"model-value": unref(isMissingMode)(config) ? "missing" : "contains",
|
|
16652
|
+
"model-value": unref(isMissingMode)(config, value) ? "missing" : "contains",
|
|
16818
16653
|
placeholder: "Mode",
|
|
16819
16654
|
"possible-values": MODE_OPTIONS,
|
|
16820
16655
|
ariaLabel: "Select filter mode",
|
|
16821
16656
|
"onUpdate:modelValue": ($event) => onModeChange(index, config, $event)
|
|
16822
16657
|
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
16823
|
-
!unref(isMissingMode)(config) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
16658
|
+
!unref(isMissingMode)(config, value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
16824
16659
|
config.is === "FilterInputField" ? (openBlock(), createBlock(unref(KdsTextInput), {
|
|
16825
16660
|
key: 0,
|
|
16826
16661
|
ref_for: true,
|
|
16827
16662
|
ref: (el) => setValueRef(index, el),
|
|
16828
16663
|
class: "value",
|
|
16829
|
-
"model-value":
|
|
16664
|
+
"model-value": value ?? "",
|
|
16830
16665
|
placeholder: "value",
|
|
16831
16666
|
ariaLabel: "Enter filter value",
|
|
16832
16667
|
"onUpdate:modelValue": ($event) => emit("columnFilter", index, $event)
|
|
@@ -16835,7 +16670,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16835
16670
|
ref_for: true,
|
|
16836
16671
|
ref: (el) => setValueRef(index, el),
|
|
16837
16672
|
class: "value",
|
|
16838
|
-
"model-value":
|
|
16673
|
+
"model-value": value ?? "",
|
|
16839
16674
|
placeholder: "value",
|
|
16840
16675
|
"possible-values": config.possibleValues,
|
|
16841
16676
|
ariaLabel: "Select filter value",
|
|
@@ -16845,7 +16680,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16845
16680
|
ref_for: true,
|
|
16846
16681
|
ref: (el) => setValueRef(index, el),
|
|
16847
16682
|
class: "value",
|
|
16848
|
-
"model-value":
|
|
16683
|
+
"model-value": value ?? [],
|
|
16849
16684
|
placeholder: "value",
|
|
16850
16685
|
"possible-values": config.possibleValues,
|
|
16851
16686
|
ariaLabel: "Select filter values",
|
|
@@ -16878,16 +16713,16 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16878
16713
|
}
|
|
16879
16714
|
});
|
|
16880
16715
|
|
|
16881
|
-
const FilterControlBody = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16716
|
+
const FilterControlBody = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__scopeId", "data-v-bd4cc5ec"]]);
|
|
16882
16717
|
|
|
16883
|
-
const _sfc_main$
|
|
16718
|
+
const _sfc_main$d = { };
|
|
16884
16719
|
|
|
16885
|
-
const _hoisted_1$
|
|
16720
|
+
const _hoisted_1$8 = { class: "popover" };
|
|
16886
16721
|
const _hoisted_2$4 = { class: "header" };
|
|
16887
16722
|
const _hoisted_3$3 = { class: "body" };
|
|
16888
16723
|
|
|
16889
16724
|
function _sfc_render$3(_ctx, _cache) {
|
|
16890
|
-
return (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16725
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
16891
16726
|
createElementVNode("span", _hoisted_2$4, [
|
|
16892
16727
|
renderSlot(_ctx.$slots, "header", {}, undefined, true)
|
|
16893
16728
|
]),
|
|
@@ -16896,7 +16731,7 @@ function _sfc_render$3(_ctx, _cache) {
|
|
|
16896
16731
|
])
|
|
16897
16732
|
]))
|
|
16898
16733
|
}
|
|
16899
|
-
const PopoverContainer = /*#__PURE__*/_export_sfc$1(_sfc_main$
|
|
16734
|
+
const PopoverContainer = /*#__PURE__*/_export_sfc$1(_sfc_main$d, [['render',_sfc_render$3],['__scopeId',"data-v-349cd3ba"]]);
|
|
16900
16735
|
|
|
16901
16736
|
const useButtonPopoverInteraction = ({
|
|
16902
16737
|
keepButtonActive
|
|
@@ -16927,11 +16762,11 @@ const useButtonPopoverInteraction = ({
|
|
|
16927
16762
|
};
|
|
16928
16763
|
};
|
|
16929
16764
|
|
|
16930
|
-
const _sfc_main$
|
|
16765
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
16931
16766
|
__name: "FilterControl",
|
|
16932
16767
|
props: {
|
|
16933
|
-
|
|
16934
|
-
|
|
16768
|
+
columns: {},
|
|
16769
|
+
colFilterValues: {}
|
|
16935
16770
|
},
|
|
16936
16771
|
emits: ["columnFilter"],
|
|
16937
16772
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16940,7 +16775,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
16940
16775
|
const filterPopoverRef = useTemplateRef("filterPopoverRef");
|
|
16941
16776
|
const filterBodyRef = useTemplateRef("filterBodyRef");
|
|
16942
16777
|
const hasActiveFilter = computed(
|
|
16943
|
-
() => props.
|
|
16778
|
+
() => props.columns?.some(
|
|
16779
|
+
(column) => isActive(column.filterConfig, props.colFilterValues[column.id])
|
|
16780
|
+
) ?? false
|
|
16944
16781
|
);
|
|
16945
16782
|
const {
|
|
16946
16783
|
buttonIsActive,
|
|
@@ -17001,10 +16838,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
17001
16838
|
createVNode(FilterControlBody, {
|
|
17002
16839
|
ref_key: "filterBodyRef",
|
|
17003
16840
|
ref: filterBodyRef,
|
|
17004
|
-
|
|
17005
|
-
"
|
|
16841
|
+
columns: __props.columns,
|
|
16842
|
+
"col-filter-values": __props.colFilterValues,
|
|
17006
16843
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => emit("columnFilter", colInd, value))
|
|
17007
|
-
}, null, 8, ["
|
|
16844
|
+
}, null, 8, ["columns", "col-filter-values"])
|
|
17008
16845
|
]),
|
|
17009
16846
|
_: 1
|
|
17010
16847
|
})
|
|
@@ -17016,14 +16853,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
17016
16853
|
}
|
|
17017
16854
|
});
|
|
17018
16855
|
|
|
17019
|
-
const FilterControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16856
|
+
const FilterControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__scopeId", "data-v-3cd94230"]]);
|
|
17020
16857
|
|
|
17021
|
-
const _hoisted_1$
|
|
16858
|
+
const _hoisted_1$7 = { class: "body" };
|
|
17022
16859
|
const NONE_COLUMN_VALUE = "None";
|
|
17023
|
-
const _sfc_main$
|
|
16860
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
17024
16861
|
__name: "SortControl",
|
|
17025
16862
|
props: {
|
|
17026
|
-
|
|
16863
|
+
colSortValues: {},
|
|
17027
16864
|
sortControlOptions: {}
|
|
17028
16865
|
},
|
|
17029
16866
|
emits: ["columnSort"],
|
|
@@ -17032,10 +16869,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17032
16869
|
const emit = __emit;
|
|
17033
16870
|
const sortPopoverRef = useTemplateRef("sortPopoverRef");
|
|
17034
16871
|
const selectedColumn = ref(
|
|
17035
|
-
props.
|
|
16872
|
+
props.colSortValues?.[0]?.id?.toString() ?? NONE_COLUMN_VALUE
|
|
17036
16873
|
);
|
|
17037
16874
|
watch(
|
|
17038
|
-
() => props.
|
|
16875
|
+
() => props.colSortValues?.[0]?.id,
|
|
17039
16876
|
(val) => {
|
|
17040
16877
|
if (val === void 0 && selectedColumn.value !== void 0) {
|
|
17041
16878
|
return;
|
|
@@ -17044,7 +16881,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17044
16881
|
}
|
|
17045
16882
|
);
|
|
17046
16883
|
const hasSortConfig = computed(
|
|
17047
|
-
() => props.
|
|
16884
|
+
() => props.colSortValues !== void 0 && props.colSortValues[0]?.id !== void 0 && props.colSortValues[0]?.direction !== void 0
|
|
17048
16885
|
);
|
|
17049
16886
|
const possibleColumns = computed(() => [
|
|
17050
16887
|
{ id: NONE_COLUMN_VALUE, text: NONE_COLUMN_VALUE },
|
|
@@ -17054,25 +16891,25 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17054
16891
|
() => selectedColumn.value === NONE_COLUMN_VALUE ? [] : props.sortControlOptions.selectableDirections[selectedColumn.value] ?? []
|
|
17055
16892
|
);
|
|
17056
16893
|
const selectedSortDirection = computed(
|
|
17057
|
-
() => props.
|
|
16894
|
+
() => props.colSortValues?.[0]?.direction?.toString() ?? ""
|
|
17058
16895
|
);
|
|
17059
16896
|
const { buttonIsActive, showPopover, onButtonClick, onPopoverToggle } = useButtonPopoverInteraction({ keepButtonActive: hasSortConfig });
|
|
17060
|
-
const onSortColumnChange = (
|
|
17061
|
-
selectedColumn.value =
|
|
17062
|
-
if (
|
|
16897
|
+
const onSortColumnChange = (columnId) => {
|
|
16898
|
+
selectedColumn.value = columnId;
|
|
16899
|
+
if (columnId === NONE_COLUMN_VALUE) {
|
|
17063
16900
|
emit("columnSort", void 0, 0);
|
|
17064
16901
|
return;
|
|
17065
16902
|
}
|
|
17066
16903
|
emit(
|
|
17067
16904
|
"columnSort",
|
|
17068
|
-
|
|
17069
|
-
props.
|
|
16905
|
+
columnId,
|
|
16906
|
+
props.colSortValues?.[0]?.direction || 1
|
|
17070
16907
|
);
|
|
17071
16908
|
};
|
|
17072
16909
|
const onSortDirectionChange = (direction) => {
|
|
17073
16910
|
emit(
|
|
17074
16911
|
"columnSort",
|
|
17075
|
-
|
|
16912
|
+
selectedColumn.value,
|
|
17076
16913
|
Number.parseInt(direction, 10)
|
|
17077
16914
|
);
|
|
17078
16915
|
};
|
|
@@ -17111,7 +16948,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17111
16948
|
_cache[0] || (_cache[0] = createTextVNode(" Sorting ", -1))
|
|
17112
16949
|
]),
|
|
17113
16950
|
body: withCtx(() => [
|
|
17114
|
-
createElementVNode("div", _hoisted_1$
|
|
16951
|
+
createElementVNode("div", _hoisted_1$7, [
|
|
17115
16952
|
createVNode(unref(_sfc_main$z), {
|
|
17116
16953
|
"model-value": selectedColumn.value,
|
|
17117
16954
|
"possible-values": possibleColumns.value,
|
|
@@ -17138,9 +16975,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17138
16975
|
}
|
|
17139
16976
|
});
|
|
17140
16977
|
|
|
17141
|
-
const SortControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16978
|
+
const SortControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__scopeId", "data-v-ad5ee20c"]]);
|
|
17142
16979
|
|
|
17143
|
-
const _hoisted_1$
|
|
16980
|
+
const _hoisted_1$6 = { class: "left" };
|
|
17144
16981
|
const _hoisted_2$3 = {
|
|
17145
16982
|
key: 0,
|
|
17146
16983
|
class: "title"
|
|
@@ -17150,7 +16987,7 @@ const _hoisted_3$2 = {
|
|
|
17150
16987
|
class: "dimension"
|
|
17151
16988
|
};
|
|
17152
16989
|
const _hoisted_4$1 = { class: "right" };
|
|
17153
|
-
const _sfc_main$
|
|
16990
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
17154
16991
|
__name: "TableActionBar",
|
|
17155
16992
|
props: {
|
|
17156
16993
|
allRowsCount: { default: 0 },
|
|
@@ -17160,19 +16997,17 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17160
16997
|
rowLabel: { default: "Rows" },
|
|
17161
16998
|
title: { default: "" },
|
|
17162
16999
|
showTableSize: { type: Boolean, default: true },
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17000
|
+
actionConfig: {},
|
|
17001
|
+
colSortValues: { default: () => [] },
|
|
17002
|
+
colFilterValues: {},
|
|
17166
17003
|
sortControlOptions: {},
|
|
17167
|
-
|
|
17168
|
-
columnHeaders: {},
|
|
17169
|
-
settingsItems: { default: () => [] }
|
|
17004
|
+
columns: {}
|
|
17170
17005
|
},
|
|
17171
17006
|
emits: ["resetTemporaryView", "columnFilter", "onColumnSort"],
|
|
17172
17007
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
17173
17008
|
const isTemporaryView = computed(() => __props.title === "Temporary view");
|
|
17174
17009
|
const hasContent = computed(
|
|
17175
|
-
() => Boolean(__props.title) || __props.showTableSize || __props.
|
|
17010
|
+
() => Boolean(__props.title) || __props.showTableSize || __props.actionConfig.enableSorting || __props.actionConfig.enableFilters
|
|
17176
17011
|
);
|
|
17177
17012
|
const hasRows = computed(() => __props.allRowsCount > 0);
|
|
17178
17013
|
const shouldAppendOfRows = computed(() => __props.filteredRowsCount < __props.allRowsCount);
|
|
@@ -17181,7 +17016,6 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17181
17016
|
const shouldAppendOfColumns = computed(
|
|
17182
17017
|
() => __props.filteredColumnsCount < __props.allColumnsCount
|
|
17183
17018
|
);
|
|
17184
|
-
const hasSettingsItems = computed(() => __props.settingsItems.length > 0);
|
|
17185
17019
|
const formatCount = (label, filteredCount, totalCount, appendTotal) => `${label}: ${filteredCount}${appendTotal ? ` of ${totalCount}` : ""}`;
|
|
17186
17020
|
const dimensionText = computed(() => {
|
|
17187
17021
|
if (!hasRows.value && !hasColumns.value) {
|
|
@@ -17217,32 +17051,32 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17217
17051
|
key: 0,
|
|
17218
17052
|
class: normalizeClass(["kds-table-action-bar", { "temporary-view": isTemporaryView.value }])
|
|
17219
17053
|
}, [
|
|
17220
|
-
createElementVNode("div", _hoisted_1$
|
|
17054
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
17221
17055
|
__props.title ? (openBlock(), createElementBlock("span", _hoisted_2$3, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
|
|
17222
17056
|
__props.showTableSize ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(dimensionText.value), 1)) : createCommentVNode("", true),
|
|
17223
|
-
__props.
|
|
17057
|
+
__props.actionConfig.enableSorting ? (openBlock(), createBlock(SortControl, {
|
|
17224
17058
|
key: 2,
|
|
17225
|
-
"sort-
|
|
17059
|
+
"col-sort-values": __props.colSortValues,
|
|
17226
17060
|
"sort-control-options": __props.sortControlOptions,
|
|
17227
|
-
onColumnSort: _cache[0] || (_cache[0] = (
|
|
17228
|
-
}, null, 8, ["sort-
|
|
17229
|
-
__props.
|
|
17061
|
+
onColumnSort: _cache[0] || (_cache[0] = (columnId, colDir) => emit("onColumnSort", columnId, colDir))
|
|
17062
|
+
}, null, 8, ["col-sort-values", "sort-control-options"])) : createCommentVNode("", true),
|
|
17063
|
+
__props.actionConfig.enableFilters ? (openBlock(), createBlock(FilterControl, {
|
|
17230
17064
|
key: 3,
|
|
17231
17065
|
ref_key: "filterControlRef",
|
|
17232
17066
|
ref: filterControlRef,
|
|
17233
|
-
|
|
17234
|
-
"
|
|
17067
|
+
columns: __props.columns,
|
|
17068
|
+
"col-filter-values": __props.colFilterValues,
|
|
17235
17069
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => emit("columnFilter", colInd, value))
|
|
17236
|
-
}, null, 8, ["
|
|
17070
|
+
}, null, 8, ["columns", "col-filter-values"])) : createCommentVNode("", true)
|
|
17237
17071
|
]),
|
|
17238
17072
|
createElementVNode("div", _hoisted_4$1, [
|
|
17239
|
-
|
|
17073
|
+
__props.actionConfig.settingsItems?.length ? (openBlock(), createBlock(unref(_sfc_main$1h), {
|
|
17240
17074
|
key: 0,
|
|
17241
17075
|
ariaLabel: "Table settings",
|
|
17242
17076
|
size: "small",
|
|
17243
17077
|
variant: "transparent",
|
|
17244
17078
|
"leading-icon": "parameter",
|
|
17245
|
-
items: __props.settingsItems
|
|
17079
|
+
items: __props.actionConfig.settingsItems
|
|
17246
17080
|
}, null, 8, ["items"])) : createCommentVNode("", true),
|
|
17247
17081
|
isTemporaryView.value ? (openBlock(), createBlock(unref(_sfc_main$1s), {
|
|
17248
17082
|
key: 1,
|
|
@@ -17258,18 +17092,100 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17258
17092
|
}
|
|
17259
17093
|
});
|
|
17260
17094
|
|
|
17261
|
-
const TableActionBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
17095
|
+
const TableActionBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__scopeId", "data-v-4a59722f"]]);
|
|
17262
17096
|
|
|
17263
|
-
const
|
|
17264
|
-
|
|
17265
|
-
|
|
17266
|
-
|
|
17267
|
-
|
|
17268
|
-
|
|
17269
|
-
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
|
|
17097
|
+
const useHeaderMenuItems = ({
|
|
17098
|
+
enableSorting,
|
|
17099
|
+
enableFilters,
|
|
17100
|
+
filterConfig,
|
|
17101
|
+
filterValue,
|
|
17102
|
+
sortDirection,
|
|
17103
|
+
headerSubMenuItems,
|
|
17104
|
+
sortTexts,
|
|
17105
|
+
onColumnSort,
|
|
17106
|
+
openFilterControl,
|
|
17107
|
+
clearFilter
|
|
17108
|
+
}) => {
|
|
17109
|
+
const staticItems = [];
|
|
17110
|
+
const hasDynamicItems = Boolean(headerSubMenuItems?.length);
|
|
17111
|
+
const showFilterItem = enableFilters && filterConfig !== void 0;
|
|
17112
|
+
const filterIsActive = showFilterItem && isActive(filterConfig, filterValue);
|
|
17113
|
+
if (enableSorting) {
|
|
17114
|
+
staticItems.push({
|
|
17115
|
+
id: "table-header-sort",
|
|
17116
|
+
text: "Sort this column",
|
|
17117
|
+
separator: !showFilterItem && hasDynamicItems,
|
|
17118
|
+
sectionHeadline: true,
|
|
17119
|
+
sectionHeadlineIcon: "sort-ascending"
|
|
17120
|
+
});
|
|
17121
|
+
staticItems.push({
|
|
17122
|
+
id: "sort-asc",
|
|
17123
|
+
text: sortTexts.ascending,
|
|
17124
|
+
handler: (_item, _event) => {
|
|
17125
|
+
onColumnSort(1);
|
|
17126
|
+
},
|
|
17127
|
+
trailingIcon: sortDirection === 1 ? "checkmark" : void 0
|
|
17128
|
+
});
|
|
17129
|
+
staticItems.push({
|
|
17130
|
+
id: "sort-desc",
|
|
17131
|
+
text: sortTexts.descending,
|
|
17132
|
+
handler: (_item, _event) => {
|
|
17133
|
+
onColumnSort(-1);
|
|
17134
|
+
},
|
|
17135
|
+
trailingIcon: sortDirection === -1 ? "checkmark" : void 0
|
|
17136
|
+
});
|
|
17137
|
+
staticItems.push({
|
|
17138
|
+
id: "sort-none",
|
|
17139
|
+
text: "No sorting",
|
|
17140
|
+
handler: (_item, _event) => {
|
|
17141
|
+
onColumnSort(0);
|
|
17142
|
+
},
|
|
17143
|
+
trailingIcon: sortDirection === 0 ? "checkmark" : void 0
|
|
17144
|
+
});
|
|
17145
|
+
}
|
|
17146
|
+
if (showFilterItem) {
|
|
17147
|
+
if (filterIsActive) {
|
|
17148
|
+
staticItems.push({
|
|
17149
|
+
id: "table-header-clear-filter",
|
|
17150
|
+
text: "Clear filter",
|
|
17151
|
+
separator: hasDynamicItems,
|
|
17152
|
+
accessory: {
|
|
17153
|
+
type: "icon",
|
|
17154
|
+
name: "filter"
|
|
17155
|
+
},
|
|
17156
|
+
handler: (_item, _event) => {
|
|
17157
|
+
clearFilter();
|
|
17158
|
+
}
|
|
17159
|
+
});
|
|
17160
|
+
} else {
|
|
17161
|
+
staticItems.push({
|
|
17162
|
+
id: "table-header-filter",
|
|
17163
|
+
text: "Filter by this column",
|
|
17164
|
+
separator: hasDynamicItems,
|
|
17165
|
+
accessory: {
|
|
17166
|
+
type: "icon",
|
|
17167
|
+
name: "filter"
|
|
17168
|
+
},
|
|
17169
|
+
handler: (_item, _event) => {
|
|
17170
|
+
openFilterControl();
|
|
17171
|
+
}
|
|
17172
|
+
});
|
|
17173
|
+
}
|
|
17174
|
+
}
|
|
17175
|
+
const menuItems = [...staticItems, ...headerSubMenuItems ?? []];
|
|
17176
|
+
return menuItems.length ? menuItems : void 0;
|
|
17177
|
+
};
|
|
17178
|
+
|
|
17179
|
+
const AUTO_SCROLL_EDGE_SIZE = 20;
|
|
17180
|
+
const AUTO_SCROLL_SPEED = 250;
|
|
17181
|
+
const useAutoScrollOnRightEdge = ({
|
|
17182
|
+
scrollContainer,
|
|
17183
|
+
autoScrollOffset,
|
|
17184
|
+
onAutoScroll
|
|
17185
|
+
}) => {
|
|
17186
|
+
let pointerClientX = 0;
|
|
17187
|
+
let scrollLeftBase = 0;
|
|
17188
|
+
const isInTriggerZone = () => {
|
|
17273
17189
|
const container = scrollContainer.value;
|
|
17274
17190
|
if (!container) {
|
|
17275
17191
|
return false;
|
|
@@ -17313,42 +17229,289 @@ const useAutoScrollOnRightEdge = ({
|
|
|
17313
17229
|
return { onPointerDown, onPointerMove, onPointerUp };
|
|
17314
17230
|
};
|
|
17315
17231
|
|
|
17232
|
+
const _hoisted_1$5 = ["tabindex"];
|
|
17233
|
+
const _hoisted_2$2 = ["title"];
|
|
17234
|
+
const _hoisted_3$1 = {
|
|
17235
|
+
key: 0,
|
|
17236
|
+
class: "sub-header-text-container"
|
|
17237
|
+
};
|
|
17238
|
+
const _hoisted_4 = {
|
|
17239
|
+
key: 0,
|
|
17240
|
+
class: "delete-column-button"
|
|
17241
|
+
};
|
|
17242
|
+
const _hoisted_5 = { key: 1 };
|
|
17243
|
+
const columnHeaderRef = "columnHeader";
|
|
17244
|
+
const contentRef = "contentRef";
|
|
17245
|
+
const mainHeaderRef = "mainHeader";
|
|
17246
|
+
const headerTextRef = "headerText";
|
|
17247
|
+
const columnDeleteButtonRef = "columnDeleteButton";
|
|
17248
|
+
const columnMenuButtonRef = "columnMenuButton";
|
|
17249
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
17250
|
+
__name: "HeaderCell",
|
|
17251
|
+
props: {
|
|
17252
|
+
column: {},
|
|
17253
|
+
colFilterValue: {},
|
|
17254
|
+
tableConfig: {},
|
|
17255
|
+
actionConfig: {},
|
|
17256
|
+
sortDirection: {},
|
|
17257
|
+
columnSize: {},
|
|
17258
|
+
focused: { type: Boolean },
|
|
17259
|
+
selected: { type: Boolean },
|
|
17260
|
+
otherColumnResizing: { type: Boolean },
|
|
17261
|
+
getDragHandleHeight: { type: Function }
|
|
17262
|
+
},
|
|
17263
|
+
emits: ["onColumnSort", "openActionBarFilterControl", "clearColumnFilter", "onHeaderCellFocus", "onHeaderCellBlur", "onHeaderClick", "onKeydownTab", "onKeydownLeft", "onKeydownRight", "onKeydownDown", "onHeaderCellKeydown", "onDeleteColumn", "columnResizeStart", "columnResizeEnd", "columnResize", "allColumnsResize"],
|
|
17264
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
17265
|
+
const props = __props;
|
|
17266
|
+
const emit = __emit;
|
|
17267
|
+
const columnHeader = useTemplateRef(columnHeaderRef);
|
|
17268
|
+
const content = useTemplateRef(contentRef);
|
|
17269
|
+
const mainHeader = useTemplateRef(mainHeaderRef);
|
|
17270
|
+
const headerText = useTemplateRef(headerTextRef);
|
|
17271
|
+
const columnDeleteButton = useTemplateRef(
|
|
17272
|
+
columnDeleteButtonRef
|
|
17273
|
+
);
|
|
17274
|
+
const columnMenuButton = useTemplateRef(columnMenuButtonRef);
|
|
17275
|
+
const subMenuItems = computed(
|
|
17276
|
+
() => useHeaderMenuItems({
|
|
17277
|
+
enableFilters: Boolean(props.actionConfig.enableFilters),
|
|
17278
|
+
filterConfig: props.column.filterConfig,
|
|
17279
|
+
filterValue: props.colFilterValue,
|
|
17280
|
+
enableSorting: Boolean(props.actionConfig.enableSorting) && !props.column.isNotSortable,
|
|
17281
|
+
sortDirection: props.sortDirection,
|
|
17282
|
+
sortTexts: columnSortText[props.column.type ?? "default"],
|
|
17283
|
+
headerSubMenuItems: props.column.headerSubMenuItems,
|
|
17284
|
+
onColumnSort: (direction) => emit("onColumnSort", direction),
|
|
17285
|
+
openFilterControl: () => emit("openActionBarFilterControl"),
|
|
17286
|
+
clearFilter: () => emit("clearColumnFilter")
|
|
17287
|
+
})
|
|
17288
|
+
);
|
|
17289
|
+
const hovered = ref(false);
|
|
17290
|
+
const onPointerOver = () => {
|
|
17291
|
+
hovered.value = true;
|
|
17292
|
+
};
|
|
17293
|
+
const onPointerLeave = () => {
|
|
17294
|
+
hovered.value = false;
|
|
17295
|
+
};
|
|
17296
|
+
const dragging = ref(false);
|
|
17297
|
+
let columnSizeOnDragStart = 0;
|
|
17298
|
+
let pageXOnDragStart = 0;
|
|
17299
|
+
let currentPageX = 0;
|
|
17300
|
+
let currentDragHandlerHeight = 0;
|
|
17301
|
+
const scrollContainer = useScrollContainer();
|
|
17302
|
+
const autoScrollOffset = ref(0);
|
|
17303
|
+
const emitColumnResize = () => {
|
|
17304
|
+
if (!dragging.value) {
|
|
17305
|
+
return;
|
|
17306
|
+
}
|
|
17307
|
+
const newColumnSize = columnSizeOnDragStart + (currentPageX - pageXOnDragStart) + autoScrollOffset.value;
|
|
17308
|
+
emit("columnResize", Math.max(newColumnSize, MIN_COLUMN_SIZE));
|
|
17309
|
+
};
|
|
17310
|
+
const {
|
|
17311
|
+
onPointerDown: startAutoScroll,
|
|
17312
|
+
onPointerMove: updateAutoScroll,
|
|
17313
|
+
onPointerUp: stopAutoScroll
|
|
17314
|
+
} = useAutoScrollOnRightEdge({
|
|
17315
|
+
scrollContainer,
|
|
17316
|
+
autoScrollOffset,
|
|
17317
|
+
onAutoScroll: emitColumnResize
|
|
17318
|
+
});
|
|
17319
|
+
const currentResizeDragHandleWidth = computed(
|
|
17320
|
+
() => props.tableConfig.enableColumnResizing ? COLUMN_RESIZE_DRAG_HANDLE_WIDTH : 0
|
|
17321
|
+
);
|
|
17322
|
+
const dragHandleHeight = (isDragging) => isDragging ? currentDragHandlerHeight : HEADER_HEIGHT;
|
|
17323
|
+
const onPointerDown = (event) => {
|
|
17324
|
+
consola.debug("Resize via drag triggered: ", event);
|
|
17325
|
+
event.stopPropagation();
|
|
17326
|
+
event.target.setPointerCapture(event.pointerId);
|
|
17327
|
+
dragging.value = true;
|
|
17328
|
+
currentDragHandlerHeight = props.getDragHandleHeight();
|
|
17329
|
+
columnSizeOnDragStart = props.columnSize ?? MIN_COLUMN_SIZE;
|
|
17330
|
+
pageXOnDragStart = event.pageX;
|
|
17331
|
+
currentPageX = event.pageX;
|
|
17332
|
+
emit("columnResizeStart");
|
|
17333
|
+
startAutoScroll(event.clientX);
|
|
17334
|
+
};
|
|
17335
|
+
const onPointerUp = (event) => {
|
|
17336
|
+
emit("columnResizeEnd");
|
|
17337
|
+
if (event.shiftKey) {
|
|
17338
|
+
const newColumnSize = columnSizeOnDragStart + event.pageX - pageXOnDragStart + autoScrollOffset.value;
|
|
17339
|
+
emit("allColumnsResize", Math.max(newColumnSize, MIN_COLUMN_SIZE));
|
|
17340
|
+
}
|
|
17341
|
+
stopAutoScroll();
|
|
17342
|
+
};
|
|
17343
|
+
const unthrottledOnPointerMove = (event) => {
|
|
17344
|
+
if (dragging.value) {
|
|
17345
|
+
consola.debug("Resize via drag ongoing: ", event);
|
|
17346
|
+
currentPageX = event.pageX;
|
|
17347
|
+
emitColumnResize();
|
|
17348
|
+
updateAutoScroll(event.clientX);
|
|
17349
|
+
}
|
|
17350
|
+
};
|
|
17351
|
+
const onPointerMove = throttle((event) => {
|
|
17352
|
+
unthrottledOnPointerMove(event);
|
|
17353
|
+
});
|
|
17354
|
+
const onLostPointerCapture = throttle((event) => {
|
|
17355
|
+
consola.debug("Resize via drag finished: ", event);
|
|
17356
|
+
stopAutoScroll();
|
|
17357
|
+
dragging.value = false;
|
|
17358
|
+
hovered.value = false;
|
|
17359
|
+
});
|
|
17360
|
+
const getHeaderCellWidth = () => {
|
|
17361
|
+
const widthCompleteHeader = Math.ceil(
|
|
17362
|
+
columnHeader.value.getBoundingClientRect().width
|
|
17363
|
+
);
|
|
17364
|
+
const widthMainHeader = Math.ceil(
|
|
17365
|
+
mainHeader.value.getBoundingClientRect().width
|
|
17366
|
+
);
|
|
17367
|
+
const widthHeaderText = headerText.value.getBoundingClientRect().width;
|
|
17368
|
+
return widthCompleteHeader - widthMainHeader + widthHeaderText + currentResizeDragHandleWidth.value;
|
|
17369
|
+
};
|
|
17370
|
+
const focus = () => {
|
|
17371
|
+
if (props.tableConfig.enableHeaderCellSelection || props.column.editable) {
|
|
17372
|
+
content.value?.focus();
|
|
17373
|
+
} else if (subMenuItems.value?.length) {
|
|
17374
|
+
columnMenuButton.value?.menuButtonEl?.$el?.focus();
|
|
17375
|
+
} else if (props.column.deletable) {
|
|
17376
|
+
columnDeleteButton.value?.$el?.focus();
|
|
17377
|
+
}
|
|
17378
|
+
};
|
|
17379
|
+
const isFocusable = () => Boolean(
|
|
17380
|
+
props.tableConfig.enableHeaderCellSelection || props.column.editable || subMenuItems.value?.length || props.column.deletable
|
|
17381
|
+
);
|
|
17382
|
+
__expose({ getHeaderCellWidth, focus, isFocusable });
|
|
17383
|
+
return (_ctx, _cache) => {
|
|
17384
|
+
return openBlock(), createElementBlock("th", {
|
|
17385
|
+
ref: columnHeaderRef,
|
|
17386
|
+
scope: "col",
|
|
17387
|
+
style: normalizeStyle({
|
|
17388
|
+
width: `calc(${__props.columnSize || unref(MIN_COLUMN_SIZE)}px)`,
|
|
17389
|
+
...__props.column.headerColor ? { "--data-cell-color": __props.column.headerColor } : {}
|
|
17390
|
+
}),
|
|
17391
|
+
class: normalizeClass([
|
|
17392
|
+
"column-header",
|
|
17393
|
+
{
|
|
17394
|
+
"colored-header": __props.column.headerColor,
|
|
17395
|
+
"header-focused": __props.focused || __props.selected
|
|
17396
|
+
}
|
|
17397
|
+
])
|
|
17398
|
+
}, [
|
|
17399
|
+
createElementVNode("div", {
|
|
17400
|
+
ref: contentRef,
|
|
17401
|
+
class: normalizeClass(["column-header-content", [
|
|
17402
|
+
{
|
|
17403
|
+
"with-button-in-header": subMenuItems.value?.length || __props.column.deletable
|
|
17404
|
+
}
|
|
17405
|
+
]]),
|
|
17406
|
+
tabindex: __props.tableConfig.enableHeaderCellSelection || __props.column.editable ? 0 : -1,
|
|
17407
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => emit("onHeaderCellFocus")),
|
|
17408
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => emit("onHeaderCellBlur")),
|
|
17409
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("onHeaderClick")),
|
|
17410
|
+
onKeydown: [
|
|
17411
|
+
_cache[3] || (_cache[3] = withKeys(($event) => emit("onHeaderClick"), ["space"])),
|
|
17412
|
+
_cache[4] || (_cache[4] = withKeys(($event) => emit("onKeydownTab"), ["tab"])),
|
|
17413
|
+
_cache[5] || (_cache[5] = withKeys(withModifiers(($event) => emit("onKeydownLeft"), ["prevent"]), ["left"])),
|
|
17414
|
+
_cache[6] || (_cache[6] = withKeys(withModifiers(($event) => emit("onKeydownRight"), ["prevent"]), ["right"])),
|
|
17415
|
+
_cache[7] || (_cache[7] = withKeys(withModifiers(($event) => emit("onKeydownDown"), ["self", "prevent"]), ["down"])),
|
|
17416
|
+
_cache[8] || (_cache[8] = ($event) => emit("onHeaderCellKeydown", $event))
|
|
17417
|
+
]
|
|
17418
|
+
}, [
|
|
17419
|
+
createElementVNode("div", {
|
|
17420
|
+
ref: mainHeaderRef,
|
|
17421
|
+
class: "main-header"
|
|
17422
|
+
}, [
|
|
17423
|
+
createElementVNode("div", {
|
|
17424
|
+
class: "header-text-container",
|
|
17425
|
+
title: __props.column.header
|
|
17426
|
+
}, [
|
|
17427
|
+
createElementVNode("span", { ref: headerTextRef }, toDisplayString(__props.column.header), 1)
|
|
17428
|
+
], 8, _hoisted_2$2)
|
|
17429
|
+
]),
|
|
17430
|
+
__props.column.subHeader ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
17431
|
+
renderSlot(_ctx.$slots, "subHeader", {
|
|
17432
|
+
subHeader: __props.column.subHeader
|
|
17433
|
+
}, () => [
|
|
17434
|
+
createTextVNode(toDisplayString(__props.column.subHeader), 1)
|
|
17435
|
+
], true)
|
|
17436
|
+
])) : createCommentVNode("", true)
|
|
17437
|
+
], 42, _hoisted_1$5),
|
|
17438
|
+
__props.column.deletable ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
17439
|
+
createVNode(unref(_sfc_main$1s), {
|
|
17440
|
+
ref: columnDeleteButtonRef,
|
|
17441
|
+
variant: "transparent",
|
|
17442
|
+
"leading-icon": "trash",
|
|
17443
|
+
size: "small",
|
|
17444
|
+
ariaLabel: "Delete column",
|
|
17445
|
+
onClick: _cache[9] || (_cache[9] = withModifiers(($event) => emit("onDeleteColumn"), ["stop"])),
|
|
17446
|
+
onKeydown: _cache[10] || (_cache[10] = withKeys(withModifiers(($event) => emit("onKeydownDown"), ["prevent", "stop"]), ["down"]))
|
|
17447
|
+
})
|
|
17448
|
+
])) : createCommentVNode("", true),
|
|
17449
|
+
subMenuItems.value?.length ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
17450
|
+
createVNode(unref(_sfc_main$1h), {
|
|
17451
|
+
ref: columnMenuButtonRef,
|
|
17452
|
+
ariaLabel: "Table column options",
|
|
17453
|
+
items: subMenuItems.value,
|
|
17454
|
+
size: "small",
|
|
17455
|
+
variant: "transparent",
|
|
17456
|
+
"leading-icon": "more-actions",
|
|
17457
|
+
onKeydown: _cache[11] || (_cache[11] = withKeys(withModifiers(($event) => emit("onKeydownDown"), ["prevent", "stop"]), ["down"]))
|
|
17458
|
+
}, null, 8, ["items"])
|
|
17459
|
+
])) : createCommentVNode("", true),
|
|
17460
|
+
__props.tableConfig.enableColumnResizing ? (openBlock(), createElementBlock("div", {
|
|
17461
|
+
key: 2,
|
|
17462
|
+
class: normalizeClass([
|
|
17463
|
+
"resize-handle-area",
|
|
17464
|
+
{ hover: hovered.value && !__props.otherColumnResizing, drag: dragging.value }
|
|
17465
|
+
]),
|
|
17466
|
+
style: normalizeStyle({
|
|
17467
|
+
height: `${dragHandleHeight(dragging.value)}px`
|
|
17468
|
+
}),
|
|
17469
|
+
onPointerover: onPointerOver,
|
|
17470
|
+
onPointerleave: onPointerLeave,
|
|
17471
|
+
onPointerdownPassive: _cache[12] || (_cache[12] = ($event) => onPointerDown($event)),
|
|
17472
|
+
onPointerupPassive: _cache[13] || (_cache[13] = ($event) => onPointerUp($event)),
|
|
17473
|
+
onPointermove: _cache[14] || (_cache[14] = //@ts-ignore
|
|
17474
|
+
(...args) => unref(onPointerMove) && unref(onPointerMove)(...args)),
|
|
17475
|
+
onLostpointercapture: _cache[15] || (_cache[15] = //@ts-ignore
|
|
17476
|
+
(...args) => unref(onLostPointerCapture) && unref(onLostPointerCapture)(...args))
|
|
17477
|
+
}, [..._cache[16] || (_cache[16] = [
|
|
17478
|
+
createElementVNode("span", { class: "resize-handle" }, null, -1)
|
|
17479
|
+
])], 38)) : createCommentVNode("", true)
|
|
17480
|
+
], 6);
|
|
17481
|
+
};
|
|
17482
|
+
}
|
|
17483
|
+
});
|
|
17484
|
+
|
|
17485
|
+
const HeaderCell = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-cc11c6b2"]]);
|
|
17486
|
+
|
|
17316
17487
|
const _sfc_main$8 = {
|
|
17317
17488
|
components: {
|
|
17318
17489
|
KdsCheckbox: _sfc_main$10,
|
|
17319
17490
|
KdsButton: _sfc_main$1s,
|
|
17320
|
-
|
|
17491
|
+
HeaderCell
|
|
17321
17492
|
},
|
|
17322
17493
|
props: {
|
|
17323
17494
|
tableConfig: {
|
|
17324
17495
|
type: Object,
|
|
17325
17496
|
default: () => ({})
|
|
17326
17497
|
},
|
|
17327
|
-
|
|
17328
|
-
type:
|
|
17329
|
-
default: () =>
|
|
17330
|
-
},
|
|
17331
|
-
columnSubHeaders: {
|
|
17332
|
-
type: Array,
|
|
17333
|
-
default: () => []
|
|
17334
|
-
},
|
|
17335
|
-
columnSizes: {
|
|
17336
|
-
type: Array,
|
|
17337
|
-
default: () => []
|
|
17498
|
+
actionConfig: {
|
|
17499
|
+
type: Object,
|
|
17500
|
+
default: () => ({})
|
|
17338
17501
|
},
|
|
17339
|
-
|
|
17502
|
+
columns: {
|
|
17340
17503
|
type: Array,
|
|
17341
17504
|
default: () => []
|
|
17342
17505
|
},
|
|
17343
|
-
|
|
17344
|
-
type:
|
|
17345
|
-
default: () =>
|
|
17506
|
+
colFilterValues: {
|
|
17507
|
+
type: Object,
|
|
17508
|
+
default: () => ({})
|
|
17346
17509
|
},
|
|
17347
|
-
|
|
17510
|
+
colSizes: {
|
|
17348
17511
|
type: Array,
|
|
17349
17512
|
default: () => []
|
|
17350
17513
|
},
|
|
17351
|
-
|
|
17514
|
+
colSortValues: {
|
|
17352
17515
|
type: Array,
|
|
17353
17516
|
default: () => []
|
|
17354
17517
|
},
|
|
@@ -17378,6 +17541,9 @@ const _sfc_main$8 = {
|
|
|
17378
17541
|
columnResizeEnd: () => true,
|
|
17379
17542
|
columnResizeStart: () => true,
|
|
17380
17543
|
allColumnsResize: (newSize) => true,
|
|
17544
|
+
columnSort: (index, direction) => true,
|
|
17545
|
+
openActionBarFilterControl: (index) => true,
|
|
17546
|
+
clearColumnFilter: (index) => true,
|
|
17381
17547
|
moveDownFromHeaderCell: (index) => true,
|
|
17382
17548
|
headerCellSelect: (index) => true,
|
|
17383
17549
|
"update:newColumnButtonWidth": (width) => true,
|
|
@@ -17389,33 +17555,7 @@ const _sfc_main$8 = {
|
|
|
17389
17555
|
deleteColumn: (index) => true
|
|
17390
17556
|
},
|
|
17391
17557
|
setup(props, { emit }) {
|
|
17392
|
-
const { indexedData:
|
|
17393
|
-
const scrollContainer = useScrollContainer();
|
|
17394
|
-
const dragIndex = ref(null);
|
|
17395
|
-
const columnSizeOnDragStart = ref(0);
|
|
17396
|
-
const pageXOnDragStart = ref(0);
|
|
17397
|
-
const currentPageX = ref(0);
|
|
17398
|
-
const autoScrollOffset = ref(0);
|
|
17399
|
-
const emitColumnResize = () => {
|
|
17400
|
-
if (dragIndex.value === null) {
|
|
17401
|
-
return;
|
|
17402
|
-
}
|
|
17403
|
-
const newColumnSize = columnSizeOnDragStart.value + (currentPageX.value - pageXOnDragStart.value) + autoScrollOffset.value;
|
|
17404
|
-
emit(
|
|
17405
|
-
"columnResize",
|
|
17406
|
-
dragIndex.value,
|
|
17407
|
-
Math.max(newColumnSize, MIN_COLUMN_SIZE)
|
|
17408
|
-
);
|
|
17409
|
-
};
|
|
17410
|
-
const {
|
|
17411
|
-
onPointerDown: startAutoScroll,
|
|
17412
|
-
onPointerMove: updateAutoScroll,
|
|
17413
|
-
onPointerUp: stopAutoScroll
|
|
17414
|
-
} = useAutoScrollOnRightEdge({
|
|
17415
|
-
scrollContainer,
|
|
17416
|
-
autoScrollOffset,
|
|
17417
|
-
onAutoScroll: emitColumnResize
|
|
17418
|
-
});
|
|
17558
|
+
const { indexedData: indexedColumns, style: headerStyles } = useIndicesAndStylesFor(toRef(props, "columns"));
|
|
17419
17559
|
let currentColumnIndex = 0;
|
|
17420
17560
|
const onStartEditing = (initialValue) => {
|
|
17421
17561
|
emit("headerCellStartEditing", currentColumnIndex, initialValue);
|
|
@@ -17428,51 +17568,20 @@ const _sfc_main$8 = {
|
|
|
17428
17568
|
currentColumnIndex = columnIndex;
|
|
17429
17569
|
startEditingKeydown(event);
|
|
17430
17570
|
};
|
|
17431
|
-
return {
|
|
17432
|
-
indexedColumnHeaders,
|
|
17433
|
-
headerStyles,
|
|
17434
|
-
onHeaderCellKeydown,
|
|
17435
|
-
scrollContainer,
|
|
17436
|
-
dragIndex,
|
|
17437
|
-
columnSizeOnDragStart,
|
|
17438
|
-
pageXOnDragStart,
|
|
17439
|
-
currentPageX,
|
|
17440
|
-
autoScrollOffset,
|
|
17441
|
-
emitColumnResize,
|
|
17442
|
-
startAutoScroll,
|
|
17443
|
-
updateAutoScroll,
|
|
17444
|
-
stopAutoScroll
|
|
17445
|
-
};
|
|
17571
|
+
return { indexedColumns, headerStyles, onHeaderCellKeydown };
|
|
17446
17572
|
},
|
|
17447
17573
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
17448
17574
|
data() {
|
|
17449
17575
|
return {
|
|
17450
|
-
hoverIndex: null,
|
|
17451
|
-
// the index of the column that is currently being hovered over; null during resize
|
|
17452
17576
|
minimumColumnWidth: MIN_COLUMN_SIZE,
|
|
17453
17577
|
// need to add this here since it is referenced in the template
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
borderTop: kdsSpacingContainer0p10x,
|
|
17578
|
+
resizingColumnIndex: null,
|
|
17579
|
+
// the index of the column that is currently being resized; null otherwise
|
|
17457
17580
|
focusedHeaderIndex: null
|
|
17458
17581
|
// the index of the currently focused header cell
|
|
17459
17582
|
};
|
|
17460
17583
|
},
|
|
17461
17584
|
computed: {
|
|
17462
|
-
enableColumnResizing() {
|
|
17463
|
-
const enableColumnResizingSetting = this.tableConfig.enableColumnResizing;
|
|
17464
|
-
if (enableColumnResizingSetting === void 0) {
|
|
17465
|
-
return true;
|
|
17466
|
-
} else {
|
|
17467
|
-
return enableColumnResizingSetting;
|
|
17468
|
-
}
|
|
17469
|
-
},
|
|
17470
|
-
hasSubHeaders() {
|
|
17471
|
-
return this.columnSubHeaders.some(Boolean);
|
|
17472
|
-
},
|
|
17473
|
-
currentResizeDragHandleWidth() {
|
|
17474
|
-
return this.enableColumnResizing ? COLUMN_RESIZE_DRAG_HANDLE_WIDTH : 0;
|
|
17475
|
-
},
|
|
17476
17585
|
headerSelectionOverlayStyle() {
|
|
17477
17586
|
const columnIndex = this.selectedHeaderIndex;
|
|
17478
17587
|
if (columnIndex === null || !this.tableConfig.enableHeaderCellSelection) {
|
|
@@ -17482,16 +17591,13 @@ const _sfc_main$8 = {
|
|
|
17482
17591
|
if (this.tableConfig.showSelection) {
|
|
17483
17592
|
left += SPECIAL_COLUMNS_SIZE;
|
|
17484
17593
|
}
|
|
17485
|
-
if (this.tableConfig.showCollapser) {
|
|
17486
|
-
left += SPECIAL_COLUMNS_SIZE;
|
|
17487
|
-
}
|
|
17488
17594
|
if (this.tableConfig.enableRowDeletion) {
|
|
17489
17595
|
left += SPECIAL_COLUMNS_SIZE;
|
|
17490
17596
|
}
|
|
17491
17597
|
for (let i = 0; i < columnIndex; i++) {
|
|
17492
|
-
left += this.
|
|
17598
|
+
left += this.columnSize(i);
|
|
17493
17599
|
}
|
|
17494
|
-
const width = this.
|
|
17600
|
+
const width = this.columnSize(columnIndex);
|
|
17495
17601
|
return {
|
|
17496
17602
|
left: `${left}px`,
|
|
17497
17603
|
width: `${width}px`
|
|
@@ -17499,8 +17605,15 @@ const _sfc_main$8 = {
|
|
|
17499
17605
|
}
|
|
17500
17606
|
},
|
|
17501
17607
|
methods: {
|
|
17608
|
+
columnSize(columnIndex) {
|
|
17609
|
+
return this.colSizes[columnIndex] ?? this.minimumColumnWidth;
|
|
17610
|
+
},
|
|
17611
|
+
sortDirection(columnIndex) {
|
|
17612
|
+
const columnId = this.columns[columnIndex].id;
|
|
17613
|
+
return this.colSortValues.find(({ id }) => id === columnId)?.direction ?? 0;
|
|
17614
|
+
},
|
|
17502
17615
|
onHeaderCellFocus(columnIndex) {
|
|
17503
|
-
if (!this.tableConfig.enableHeaderCellSelection && !this.
|
|
17616
|
+
if (!this.tableConfig.enableHeaderCellSelection && !this.columns[columnIndex].editable) {
|
|
17504
17617
|
return;
|
|
17505
17618
|
}
|
|
17506
17619
|
this.focusedHeaderIndex = columnIndex;
|
|
@@ -17508,7 +17621,7 @@ const _sfc_main$8 = {
|
|
|
17508
17621
|
},
|
|
17509
17622
|
onHeaderCellBlur(columnIndex) {
|
|
17510
17623
|
this.focusedHeaderIndex = null;
|
|
17511
|
-
if (!this.
|
|
17624
|
+
if (!this.columns[columnIndex].editable) {
|
|
17512
17625
|
this.$emit("headerCellDeselect");
|
|
17513
17626
|
}
|
|
17514
17627
|
},
|
|
@@ -17526,90 +17639,46 @@ const _sfc_main$8 = {
|
|
|
17526
17639
|
if (this.tableConfig.enableHeaderCellSelection && this.selectedHeaderIndex !== ind) {
|
|
17527
17640
|
this.$emit("headerCellSelect", ind);
|
|
17528
17641
|
}
|
|
17529
|
-
if (this.
|
|
17642
|
+
if (this.columns[ind].editable) {
|
|
17530
17643
|
this.$emit("headerCellStartEditing", ind);
|
|
17531
17644
|
}
|
|
17532
17645
|
},
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
if (this.dragIndex === null) {
|
|
17536
|
-
this.hoverIndex = columnIndex;
|
|
17537
|
-
}
|
|
17538
|
-
},
|
|
17539
|
-
onPointerLeave(event) {
|
|
17540
|
-
consola.debug("End hover over drag handle: ", event);
|
|
17541
|
-
if (this.dragIndex === null) {
|
|
17542
|
-
this.hoverIndex = null;
|
|
17543
|
-
}
|
|
17544
|
-
},
|
|
17545
|
-
onPointerDown(event, columnIndex) {
|
|
17546
|
-
consola.debug("Resize via drag triggered: ", event);
|
|
17547
|
-
event.stopPropagation();
|
|
17548
|
-
event.target.setPointerCapture(event.pointerId);
|
|
17549
|
-
this.dragIndex = columnIndex;
|
|
17550
|
-
this.currentDragHandlerHeight = this.getDragHandleHeight();
|
|
17551
|
-
this.columnSizeOnDragStart = this.columnSizes[columnIndex];
|
|
17552
|
-
this.pageXOnDragStart = event.pageX;
|
|
17553
|
-
this.currentPageX = event.pageX;
|
|
17646
|
+
onColumnResizeStart(columnIndex) {
|
|
17647
|
+
this.resizingColumnIndex = columnIndex;
|
|
17554
17648
|
this.$emit("columnResizeStart");
|
|
17555
|
-
this.startAutoScroll(event.clientX);
|
|
17556
17649
|
},
|
|
17557
|
-
|
|
17650
|
+
onColumnResizeEnd() {
|
|
17651
|
+
this.resizingColumnIndex = null;
|
|
17558
17652
|
this.$emit("columnResizeEnd");
|
|
17559
|
-
if (event.shiftKey) {
|
|
17560
|
-
const newColumnSize = this.columnSizeOnDragStart + event.pageX - this.pageXOnDragStart + this.autoScrollOffset;
|
|
17561
|
-
this.$emit(
|
|
17562
|
-
"allColumnsResize",
|
|
17563
|
-
Math.max(newColumnSize, this.minimumColumnWidth)
|
|
17564
|
-
);
|
|
17565
|
-
}
|
|
17566
|
-
this.stopAutoScroll();
|
|
17567
17653
|
},
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17654
|
+
onColumnResize(columnIndex, newSize) {
|
|
17655
|
+
this.$emit("columnResize", columnIndex, newSize);
|
|
17656
|
+
},
|
|
17657
|
+
onAllColumnsResize(newSize) {
|
|
17658
|
+
this.$emit("allColumnsResize", newSize);
|
|
17659
|
+
},
|
|
17660
|
+
onColumnSort(columnIndex, direction) {
|
|
17661
|
+
this.$emit("columnSort", columnIndex, direction);
|
|
17662
|
+
},
|
|
17663
|
+
onOpenActionBarFilterControl(columnIndex) {
|
|
17664
|
+
this.$emit("openActionBarFilterControl", columnIndex);
|
|
17665
|
+
},
|
|
17666
|
+
onClearColumnFilter(columnIndex) {
|
|
17667
|
+
this.$emit("clearColumnFilter", columnIndex);
|
|
17668
|
+
},
|
|
17572
17669
|
onNewColumnButtonClick(event) {
|
|
17573
17670
|
this.$emit("newColumnButtonClick", event);
|
|
17574
17671
|
},
|
|
17575
17672
|
onNewColumnButtonKeydownLeft(event) {
|
|
17576
17673
|
this.$emit("newColumnButtonKeydownLeft", event);
|
|
17577
17674
|
},
|
|
17578
|
-
unthrottledOnPointerMove(event) {
|
|
17579
|
-
if (this.dragIndex !== null) {
|
|
17580
|
-
consola.debug("Resize via drag ongoing: ", event);
|
|
17581
|
-
this.currentPageX = event.pageX;
|
|
17582
|
-
this.emitColumnResize();
|
|
17583
|
-
this.updateAutoScroll(event.clientX);
|
|
17584
|
-
}
|
|
17585
|
-
},
|
|
17586
|
-
/* The lostpointercapture event is triggered if the pointer capture is lost for any reason, including its
|
|
17587
|
-
orderly release via a pointerup event. Because the onPointerMove function is throttled we also need to throttle
|
|
17588
|
-
the onLostPointerCapture function to guarantee order of event handling. */
|
|
17589
|
-
onLostPointerCapture: throttle(function(event) {
|
|
17590
|
-
consola.debug("Resize via drag finished: ", event);
|
|
17591
|
-
this.stopAutoScroll();
|
|
17592
|
-
this.dragIndex = null;
|
|
17593
|
-
this.hoverIndex = null;
|
|
17594
|
-
}),
|
|
17595
|
-
/* eslint-enable no-invalid-this */
|
|
17596
|
-
dragHandleHeight(isDragging) {
|
|
17597
|
-
return isDragging ? this.currentDragHandlerHeight : HEADER_HEIGHT;
|
|
17598
|
-
},
|
|
17599
17675
|
onDeleteColumn(ind) {
|
|
17600
17676
|
this.$emit("deleteColumn", ind);
|
|
17601
17677
|
},
|
|
17602
17678
|
getHeaderCellWidths() {
|
|
17603
|
-
return this.
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
);
|
|
17607
|
-
const widthMainHeader = Math.ceil(
|
|
17608
|
-
this.$refs[`mainHeader-${columnIndex}`][0].getBoundingClientRect().width
|
|
17609
|
-
);
|
|
17610
|
-
const widthHeaderText = this.$refs[`headerText-${columnIndex}`][0].getBoundingClientRect().width;
|
|
17611
|
-
return widthCompleteHeader - widthMainHeader + widthHeaderText + this.currentResizeDragHandleWidth;
|
|
17612
|
-
});
|
|
17679
|
+
return this.columns.map(
|
|
17680
|
+
(_column, columnIndex) => this.$refs[`headerCell-${columnIndex}`][0].getHeaderCellWidth()
|
|
17681
|
+
);
|
|
17613
17682
|
},
|
|
17614
17683
|
/**
|
|
17615
17684
|
* We deliberately only react on Tab and not on blur since we do
|
|
@@ -17625,7 +17694,7 @@ const _sfc_main$8 = {
|
|
|
17625
17694
|
}
|
|
17626
17695
|
},
|
|
17627
17696
|
onKeydownRight(columnIndex) {
|
|
17628
|
-
if (columnIndex < this.
|
|
17697
|
+
if (columnIndex < this.columns.length - 1) {
|
|
17629
17698
|
this.focusHeaderCell(columnIndex + 1);
|
|
17630
17699
|
} else if (this.showNewColumnButton) {
|
|
17631
17700
|
if (this.tableConfig.enableHeaderCellSelection) {
|
|
@@ -17640,13 +17709,10 @@ const _sfc_main$8 = {
|
|
|
17640
17709
|
}
|
|
17641
17710
|
},
|
|
17642
17711
|
focusHeaderCell(cellInd) {
|
|
17643
|
-
|
|
17644
|
-
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
} else if (this.columnDeletables[cellInd]) {
|
|
17648
|
-
this.$refs[`columnDeleteButton-${cellInd}`]?.[0]?.$el?.focus();
|
|
17649
|
-
}
|
|
17712
|
+
this.$refs[`headerCell-${cellInd}`][0].focus();
|
|
17713
|
+
},
|
|
17714
|
+
isColumnHeaderFocusable(cellInd) {
|
|
17715
|
+
return this.$refs[`headerCell-${cellInd}`][0].isFocusable();
|
|
17650
17716
|
},
|
|
17651
17717
|
focusNewColumnButton() {
|
|
17652
17718
|
this.$refs["new-column-button"]?.$el.focus();
|
|
@@ -17663,22 +17729,10 @@ const _hoisted_1$4 = {
|
|
|
17663
17729
|
class: "deletion-cell-spacer",
|
|
17664
17730
|
"aria-label": "Delete row"
|
|
17665
17731
|
};
|
|
17666
|
-
const _hoisted_2$2 = ["tabindex", "onFocus", "onBlur", "onClick", "onKeydown"];
|
|
17667
|
-
const _hoisted_3$1 = ["title"];
|
|
17668
|
-
const _hoisted_4 = {
|
|
17669
|
-
key: 0,
|
|
17670
|
-
class: "sub-header-text-container"
|
|
17671
|
-
};
|
|
17672
|
-
const _hoisted_5 = {
|
|
17673
|
-
key: 0,
|
|
17674
|
-
class: "delete-column-button"
|
|
17675
|
-
};
|
|
17676
|
-
const _hoisted_6 = { key: 1 };
|
|
17677
|
-
const _hoisted_7 = ["onPointerover", "onPointerdownPassive"];
|
|
17678
17732
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17679
17733
|
const _component_KdsCheckbox = resolveComponent("KdsCheckbox");
|
|
17734
|
+
const _component_HeaderCell = resolveComponent("HeaderCell");
|
|
17680
17735
|
const _component_KdsButton = resolveComponent("KdsButton");
|
|
17681
|
-
const _component_KdsMenuButton = resolveComponent("KdsMenuButton");
|
|
17682
17736
|
return openBlock(), createElementBlock("thead", null, [
|
|
17683
17737
|
createElementVNode("tr", {
|
|
17684
17738
|
style: normalizeStyle({ ...$setup.headerStyles })
|
|
@@ -17699,112 +17753,43 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17699
17753
|
"onUpdate:modelValue": $options.onSelect
|
|
17700
17754
|
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
17701
17755
|
], 32)) : createCommentVNode("", true),
|
|
17702
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.
|
|
17703
|
-
return openBlock(),
|
|
17756
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.indexedColumns, ([column, ind]) => {
|
|
17757
|
+
return openBlock(), createBlock(_component_HeaderCell, {
|
|
17704
17758
|
key: ind,
|
|
17705
17759
|
ref_for: true,
|
|
17706
|
-
ref: `
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
]
|
|
17740
|
-
}, [
|
|
17741
|
-
createElementVNode("div", {
|
|
17742
|
-
ref_for: true,
|
|
17743
|
-
ref: `mainHeader-${ind}`,
|
|
17744
|
-
class: "main-header"
|
|
17745
|
-
}, [
|
|
17746
|
-
createElementVNode("div", {
|
|
17747
|
-
class: "header-text-container",
|
|
17748
|
-
title: header
|
|
17749
|
-
}, [
|
|
17750
|
-
createElementVNode("span", {
|
|
17751
|
-
ref_for: true,
|
|
17752
|
-
ref: `headerText-${ind}`
|
|
17753
|
-
}, toDisplayString(header), 513)
|
|
17754
|
-
], 8, _hoisted_3$1)
|
|
17755
|
-
], 512),
|
|
17756
|
-
$props.columnSubHeaders[ind] ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
17757
|
-
renderSlot(_ctx.$slots, "subHeader", {
|
|
17758
|
-
subHeader: $props.columnSubHeaders[ind],
|
|
17759
|
-
columnIndex: ind
|
|
17760
|
-
}, () => [
|
|
17761
|
-
createTextVNode(toDisplayString($props.columnSubHeaders[ind]), 1)
|
|
17762
|
-
], true)
|
|
17763
|
-
])) : createCommentVNode("", true)
|
|
17764
|
-
], 42, _hoisted_2$2),
|
|
17765
|
-
$props.columnDeletables[ind] ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
17766
|
-
createVNode(_component_KdsButton, {
|
|
17767
|
-
ref_for: true,
|
|
17768
|
-
ref: `columnDeleteButton-${ind}`,
|
|
17769
|
-
variant: "transparent",
|
|
17770
|
-
"leading-icon": "trash",
|
|
17771
|
-
size: "small",
|
|
17772
|
-
ariaLabel: "Delete column",
|
|
17773
|
-
onClick: withModifiers(($event) => $options.onDeleteColumn(ind), ["stop"]),
|
|
17774
|
-
onKeydown: withKeys(withModifiers(($event) => $options.onKeydownDown(ind), ["prevent", "stop"]), ["down"])
|
|
17775
|
-
}, null, 8, ["onClick", "onKeydown"])
|
|
17776
|
-
])) : createCommentVNode("", true),
|
|
17777
|
-
$props.columnSubMenuItems[ind]?.length ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
17778
|
-
createVNode(_component_KdsMenuButton, {
|
|
17779
|
-
ref_for: true,
|
|
17780
|
-
ref: `columnMenuButton-${ind}`,
|
|
17781
|
-
ariaLabel: "Table column options",
|
|
17782
|
-
items: $props.columnSubMenuItems[ind],
|
|
17783
|
-
size: "small",
|
|
17784
|
-
variant: "transparent",
|
|
17785
|
-
"leading-icon": "more-actions",
|
|
17786
|
-
onKeydown: withKeys(withModifiers(($event) => $options.onKeydownDown(ind), ["prevent", "stop"]), ["down"])
|
|
17787
|
-
}, null, 8, ["items", "onKeydown"])
|
|
17788
|
-
])) : createCommentVNode("", true),
|
|
17789
|
-
$options.enableColumnResizing ? (openBlock(), createElementBlock("div", {
|
|
17790
|
-
key: 2,
|
|
17791
|
-
class: normalizeClass([
|
|
17792
|
-
"resize-handle-area",
|
|
17793
|
-
{ hover: $data.hoverIndex === ind, drag: $setup.dragIndex === ind }
|
|
17794
|
-
]),
|
|
17795
|
-
style: normalizeStyle({
|
|
17796
|
-
height: `${$options.dragHandleHeight($setup.dragIndex === ind)}px`
|
|
17797
|
-
}),
|
|
17798
|
-
onPointerover: ($event) => $options.onPointerOver($event, ind),
|
|
17799
|
-
onPointerleave: _cache[2] || (_cache[2] = (...args) => $options.onPointerLeave && $options.onPointerLeave(...args)),
|
|
17800
|
-
onPointerdownPassive: ($event) => $options.onPointerDown($event, ind),
|
|
17801
|
-
onPointerupPassive: _cache[3] || (_cache[3] = ($event) => $options.onPointerUp($event)),
|
|
17802
|
-
onPointermove: _cache[4] || (_cache[4] = (...args) => $options.onPointerMove && $options.onPointerMove(...args)),
|
|
17803
|
-
onLostpointercapture: _cache[5] || (_cache[5] = (...args) => $options.onLostPointerCapture && $options.onLostPointerCapture(...args))
|
|
17804
|
-
}, [..._cache[7] || (_cache[7] = [
|
|
17805
|
-
createElementVNode("span", { class: "resize-handle" }, null, -1)
|
|
17806
|
-
])], 46, _hoisted_7)) : createCommentVNode("", true)
|
|
17807
|
-
], 6);
|
|
17760
|
+
ref: `headerCell-${ind}`,
|
|
17761
|
+
column,
|
|
17762
|
+
"col-filter-value": $props.colFilterValues[column.id],
|
|
17763
|
+
"table-config": $props.tableConfig,
|
|
17764
|
+
"action-config": $props.actionConfig,
|
|
17765
|
+
"sort-direction": $options.sortDirection(ind),
|
|
17766
|
+
"column-size": $options.columnSize(ind),
|
|
17767
|
+
focused: $data.focusedHeaderIndex === ind,
|
|
17768
|
+
selected: $props.selectedHeaderIndex === ind,
|
|
17769
|
+
"other-column-resizing": $data.resizingColumnIndex !== null && $data.resizingColumnIndex !== ind,
|
|
17770
|
+
"get-drag-handle-height": $props.getDragHandleHeight,
|
|
17771
|
+
onOnHeaderCellFocus: ($event) => $options.onHeaderCellFocus(ind),
|
|
17772
|
+
onOnHeaderCellBlur: ($event) => $options.onHeaderCellBlur(ind),
|
|
17773
|
+
onOnHeaderClick: ($event) => $options.onHeaderClick(ind),
|
|
17774
|
+
onOnKeydownTab: $options.onKeydownTab,
|
|
17775
|
+
onOnKeydownLeft: ($event) => $options.onKeydownLeft(ind),
|
|
17776
|
+
onOnKeydownRight: ($event) => $options.onKeydownRight(ind),
|
|
17777
|
+
onOnKeydownDown: ($event) => $options.onKeydownDown(ind),
|
|
17778
|
+
onOnHeaderCellKeydown: ($event) => $setup.onHeaderCellKeydown($event, ind),
|
|
17779
|
+
onOnDeleteColumn: ($event) => $options.onDeleteColumn(ind),
|
|
17780
|
+
onOnColumnSort: ($event) => $options.onColumnSort(ind, $event),
|
|
17781
|
+
onOpenActionBarFilterControl: ($event) => $options.onOpenActionBarFilterControl(ind),
|
|
17782
|
+
onClearColumnFilter: ($event) => $options.onClearColumnFilter(ind),
|
|
17783
|
+
onColumnResizeStart: ($event) => $options.onColumnResizeStart(ind),
|
|
17784
|
+
onColumnResizeEnd: $options.onColumnResizeEnd,
|
|
17785
|
+
onColumnResize: ($event) => $options.onColumnResize(ind, $event),
|
|
17786
|
+
onAllColumnsResize: $options.onAllColumnsResize
|
|
17787
|
+
}, {
|
|
17788
|
+
subHeader: withCtx((slotProps) => [
|
|
17789
|
+
renderSlot(_ctx.$slots, "subHeader", mergeProps({ ref_for: true }, slotProps, { columnIndex: ind }), void 0, true)
|
|
17790
|
+
]),
|
|
17791
|
+
_: 2
|
|
17792
|
+
}, 1032, ["column", "col-filter-value", "table-config", "action-config", "sort-direction", "column-size", "focused", "selected", "other-column-resizing", "get-drag-handle-height", "onOnHeaderCellFocus", "onOnHeaderCellBlur", "onOnHeaderClick", "onOnKeydownTab", "onOnKeydownLeft", "onOnKeydownRight", "onOnKeydownDown", "onOnHeaderCellKeydown", "onOnDeleteColumn", "onOnColumnSort", "onOpenActionBarFilterControl", "onClearColumnFilter", "onColumnResizeStart", "onColumnResizeEnd", "onColumnResize", "onAllColumnsResize"]);
|
|
17808
17793
|
}), 128)),
|
|
17809
17794
|
$props.showNewColumnButton ? (openBlock(), createElementBlock("th", {
|
|
17810
17795
|
key: 2,
|
|
@@ -17812,7 +17797,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17812
17797
|
scope: "col",
|
|
17813
17798
|
class: "new-column-head",
|
|
17814
17799
|
"aria-label": "Add column",
|
|
17815
|
-
onVnodeMounted: _cache[
|
|
17800
|
+
onVnodeMounted: _cache[1] || (_cache[1] = (...args) => $options.emitNewColumnButtonWidth && $options.emitNewColumnButtonWidth(...args))
|
|
17816
17801
|
}, [
|
|
17817
17802
|
createVNode(_component_KdsButton, {
|
|
17818
17803
|
ref: "new-column-button",
|
|
@@ -17834,7 +17819,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17834
17819
|
}, null, 6)) : createCommentVNode("", true)
|
|
17835
17820
|
]);
|
|
17836
17821
|
}
|
|
17837
|
-
const Header = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$2], ["__scopeId", "data-v-
|
|
17822
|
+
const Header = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$2], ["__scopeId", "data-v-e7068bdf"]]);
|
|
17838
17823
|
|
|
17839
17824
|
const _hoisted_1$3 = { class: "sticky-container" };
|
|
17840
17825
|
const buttonRef = "button";
|
|
@@ -17915,7 +17900,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
17915
17900
|
text: {},
|
|
17916
17901
|
title: {},
|
|
17917
17902
|
color: {},
|
|
17918
|
-
classes: {},
|
|
17919
17903
|
selectOnMove: { type: Boolean },
|
|
17920
17904
|
size: {},
|
|
17921
17905
|
defaultTopBottomPadding: {},
|
|
@@ -18037,7 +18021,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
18037
18021
|
return (_ctx, _cache) => {
|
|
18038
18022
|
return openBlock(), createElementBlock("td", {
|
|
18039
18023
|
class: normalizeClass([
|
|
18040
|
-
__props.classes,
|
|
18041
18024
|
"data-cell",
|
|
18042
18025
|
{
|
|
18043
18026
|
"colored-cell": __props.color,
|
|
@@ -18086,25 +18069,23 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
18086
18069
|
}
|
|
18087
18070
|
});
|
|
18088
18071
|
|
|
18089
|
-
const CellRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-
|
|
18072
|
+
const CellRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-2bf6d6ac"]]);
|
|
18090
18073
|
|
|
18091
18074
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
18092
18075
|
__name: "Cell",
|
|
18093
18076
|
props: {
|
|
18077
|
+
column: {},
|
|
18094
18078
|
cellData: {},
|
|
18095
18079
|
selectOnMove: { type: Boolean },
|
|
18096
|
-
isSlotted: { type: Boolean },
|
|
18097
18080
|
isSelected: { type: Boolean },
|
|
18098
18081
|
isInCellSelection: { type: Boolean },
|
|
18099
18082
|
isToBeExpanded: { type: Boolean },
|
|
18100
18083
|
size: {},
|
|
18101
|
-
classGenerators: {},
|
|
18102
|
-
formatter: { type: Function },
|
|
18103
18084
|
defaultTopBottomPadding: {},
|
|
18104
18085
|
defaultLeftRightPadding: {},
|
|
18105
|
-
hasDataValueView: { type: Boolean },
|
|
18106
18086
|
isEditing: { type: Boolean },
|
|
18107
|
-
inlineBlock: { type: Boolean }
|
|
18087
|
+
inlineBlock: { type: Boolean },
|
|
18088
|
+
enableDataValueView: { type: Boolean }
|
|
18108
18089
|
},
|
|
18109
18090
|
emits: ["click", "input", "select", "dataValueView"],
|
|
18110
18091
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -18115,35 +18096,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
18115
18096
|
const unpackedValue = computed(
|
|
18116
18097
|
() => unpackObjectRepresentation(props.cellData)
|
|
18117
18098
|
);
|
|
18118
|
-
const formattedValue = computed(
|
|
18119
|
-
() => props.formatter(unpackObjectRepresentation(unpackedValue.value))
|
|
18120
|
-
);
|
|
18121
18099
|
const title = computed(() => {
|
|
18122
18100
|
const { cellData } = props;
|
|
18123
18101
|
if (isMissingValue(cellData)) {
|
|
18124
18102
|
return getMissingValueMessage(cellData);
|
|
18125
18103
|
}
|
|
18126
|
-
if (
|
|
18104
|
+
if (unpackedValue.value === void 0) {
|
|
18127
18105
|
return null;
|
|
18128
18106
|
} else {
|
|
18129
|
-
return String(
|
|
18107
|
+
return String(unpackedValue.value);
|
|
18130
18108
|
}
|
|
18131
18109
|
});
|
|
18132
|
-
const classes = computed(() => {
|
|
18133
|
-
const { classGenerators } = props;
|
|
18134
|
-
if (classGenerators === void 0) {
|
|
18135
|
-
return [];
|
|
18136
|
-
}
|
|
18137
|
-
return classGenerators.map((classItem) => {
|
|
18138
|
-
if (typeof classItem === "function") {
|
|
18139
|
-
return unpackedValue.value === void 0 ? null : classItem(unpackedValue.value);
|
|
18140
|
-
}
|
|
18141
|
-
if (typeof classItem === "object") {
|
|
18142
|
-
return classItem[unpackedValue.value];
|
|
18143
|
-
}
|
|
18144
|
-
return classItem;
|
|
18145
|
-
}).filter((obj) => obj !== null);
|
|
18146
|
-
});
|
|
18147
18110
|
const cellRenderer = ref(null);
|
|
18148
18111
|
const getCellContentDimensions = () => cellRenderer.value?.getCellContentDimensions();
|
|
18149
18112
|
__expose({
|
|
@@ -18156,16 +18119,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
18156
18119
|
ref_key: "cellRenderer",
|
|
18157
18120
|
ref: cellRenderer,
|
|
18158
18121
|
"is-missing": isMissing.value,
|
|
18159
|
-
"is-slotted": __props.
|
|
18160
|
-
text:
|
|
18122
|
+
"is-slotted": __props.column.hasSlotContent ?? false,
|
|
18123
|
+
text: unpackedValue.value,
|
|
18161
18124
|
title: title.value,
|
|
18162
18125
|
color: color.value,
|
|
18163
|
-
classes: classes.value,
|
|
18164
18126
|
"select-on-move": __props.selectOnMove,
|
|
18165
18127
|
"default-top-bottom-padding": __props.defaultTopBottomPadding,
|
|
18166
18128
|
"default-left-right-padding": __props.defaultLeftRightPadding,
|
|
18129
|
+
"no-padding-left-right": __props.column.noPaddingLeftRight,
|
|
18130
|
+
"no-padding-top-bottom": __props.column.noPaddingTopBottom,
|
|
18167
18131
|
size: __props.size,
|
|
18168
|
-
"enable-expand": !isMissing.value &&
|
|
18132
|
+
"enable-expand": !isMissing.value && __props.enableDataValueView && __props.column.hasDataValueView,
|
|
18169
18133
|
"is-selected": __props.isSelected,
|
|
18170
18134
|
"is-in-cell-selection": __props.isInCellSelection,
|
|
18171
18135
|
"is-to-be-expanded": __props.isToBeExpanded,
|
|
@@ -18184,7 +18148,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
18184
18148
|
])
|
|
18185
18149
|
};
|
|
18186
18150
|
})
|
|
18187
|
-
]), 1032, ["is-missing", "is-slotted", "text", "title", "color", "
|
|
18151
|
+
]), 1032, ["is-missing", "is-slotted", "text", "title", "color", "select-on-move", "default-top-bottom-padding", "default-left-right-padding", "no-padding-left-right", "no-padding-top-bottom", "size", "enable-expand", "is-selected", "is-in-cell-selection", "is-to-be-expanded", "is-editing", "inline-block"]);
|
|
18188
18152
|
};
|
|
18189
18153
|
}
|
|
18190
18154
|
});
|
|
@@ -18203,7 +18167,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18203
18167
|
rowData: { default: () => ({}) },
|
|
18204
18168
|
row: { default: () => [] },
|
|
18205
18169
|
tableConfig: {},
|
|
18206
|
-
|
|
18170
|
+
subMenuConfig: {},
|
|
18171
|
+
columns: {},
|
|
18172
|
+
colSizes: {},
|
|
18207
18173
|
rowConfig: { default: () => ({}) },
|
|
18208
18174
|
rowHeight: { default: DEFAULT_ROW_HEIGHT },
|
|
18209
18175
|
isSelected: { type: Boolean, default: false },
|
|
@@ -18239,34 +18205,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18239
18205
|
const activeDrag = ref(false);
|
|
18240
18206
|
const rowHeightOnDragStart = ref(0);
|
|
18241
18207
|
const columnKeys = computed(
|
|
18242
|
-
() => getPropertiesFromColumns(props.
|
|
18243
|
-
);
|
|
18244
|
-
const columnSizes = computed(
|
|
18245
|
-
() => getPropertiesFromColumns(props.columnConfigs, "size")
|
|
18246
|
-
);
|
|
18247
|
-
const formatters = computed(
|
|
18248
|
-
() => getPropertiesFromColumns(props.columnConfigs, "formatter")
|
|
18249
|
-
);
|
|
18250
|
-
const classGenerators = computed(
|
|
18251
|
-
() => getPropertiesFromColumns(props.columnConfigs, "classGenerator")
|
|
18252
|
-
);
|
|
18253
|
-
const slottedColumns = computed(
|
|
18254
|
-
() => getPropertiesFromColumns(props.columnConfigs, "hasSlotContent")
|
|
18255
|
-
);
|
|
18256
|
-
const hasDataValueView = computed(
|
|
18257
|
-
() => getPropertiesFromColumns(props.columnConfigs, "hasDataValueView")
|
|
18258
|
-
);
|
|
18259
|
-
const noPaddingTopBottom = computed(
|
|
18260
|
-
() => getPropertiesFromColumns(props.columnConfigs, "noPaddingTopBottom")
|
|
18261
|
-
);
|
|
18262
|
-
const noPaddingLeftRight = computed(
|
|
18263
|
-
() => getPropertiesFromColumns(props.columnConfigs, "noPaddingLeftRight")
|
|
18208
|
+
() => getPropertiesFromColumns(props.columns, "key")
|
|
18264
18209
|
);
|
|
18265
18210
|
const filteredSubMenuItems = computed(() => {
|
|
18266
|
-
if (!props.
|
|
18211
|
+
if (!props.subMenuConfig.subMenuItems?.length && !props.rowData?.subMenuItemsForRow?.length) {
|
|
18267
18212
|
return [];
|
|
18268
18213
|
}
|
|
18269
|
-
return props.rowData?.subMenuItemsForRow?.length ? props.rowData?.subMenuItemsForRow : props.
|
|
18214
|
+
return props.rowData?.subMenuItemsForRow?.length ? props.rowData?.subMenuItemsForRow : props.subMenuConfig.subMenuItems;
|
|
18270
18215
|
});
|
|
18271
18216
|
const onDeleteRow = () => {
|
|
18272
18217
|
emit("deleteRow");
|
|
@@ -18449,20 +18394,16 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18449
18394
|
cells.value[ind] = el;
|
|
18450
18395
|
},
|
|
18451
18396
|
key: ind,
|
|
18397
|
+
column: __props.columns[ind],
|
|
18452
18398
|
"cell-data": cell,
|
|
18453
18399
|
"select-on-move": __props.selectCellsOnMove,
|
|
18454
18400
|
"is-selected": __props.selectedCellIndex === ind,
|
|
18455
18401
|
"is-in-cell-selection": __props.cellSelectionRange !== null && ind >= __props.cellSelectionRange.min && ind <= __props.cellSelectionRange.max,
|
|
18456
18402
|
"is-to-be-expanded": __props.toBeExpandedCellIndex === ind,
|
|
18457
|
-
"
|
|
18458
|
-
"has-data-value-view": __props.tableConfig.enableDataValueViews && Boolean(hasDataValueView.value[ind]),
|
|
18403
|
+
"enable-data-value-view": __props.tableConfig.enableDataValueViews,
|
|
18459
18404
|
"is-editing": __props.toBeEditedCellIndex === ind,
|
|
18460
|
-
"no-padding-top-bottom": noPaddingTopBottom.value[ind],
|
|
18461
|
-
"no-padding-left-right": noPaddingLeftRight.value[ind],
|
|
18462
18405
|
"inline-block": __props.tableConfig.cellRendererInlineBlock,
|
|
18463
|
-
size:
|
|
18464
|
-
"class-generators": classGenerators.value[ind],
|
|
18465
|
-
formatter: formatters.value[ind],
|
|
18406
|
+
size: __props.colSizes[ind] ?? 100,
|
|
18466
18407
|
"default-top-bottom-padding": paddingTopBottom.value,
|
|
18467
18408
|
"default-left-right-padding": unref(paddingLeftRight),
|
|
18468
18409
|
onClick: ($event) => onCellClick($event, ind, cell),
|
|
@@ -18486,7 +18427,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18486
18427
|
}, void 0, true)
|
|
18487
18428
|
]),
|
|
18488
18429
|
_: 2
|
|
18489
|
-
}, 1032, ["cell-data", "select-on-move", "is-selected", "is-in-cell-selection", "is-to-be-expanded", "
|
|
18430
|
+
}, 1032, ["column", "cell-data", "select-on-move", "is-selected", "is-in-cell-selection", "is-to-be-expanded", "enable-data-value-view", "is-editing", "inline-block", "size", "default-top-bottom-padding", "default-left-right-padding", "onClick", "onSelect", "onDataValueView"]);
|
|
18490
18431
|
}), 128)),
|
|
18491
18432
|
filteredSubMenuItems.value?.length ? (openBlock(), createElementBlock("td", _hoisted_2, [
|
|
18492
18433
|
createVNode(unref(_sfc_main$1h), {
|
|
@@ -18520,14 +18461,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18520
18461
|
}
|
|
18521
18462
|
});
|
|
18522
18463
|
|
|
18523
|
-
const Row = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-
|
|
18464
|
+
const Row = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-5dbf98c3"]]);
|
|
18524
18465
|
|
|
18525
18466
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
18526
18467
|
__name: "CellSelectionOverlay",
|
|
18527
18468
|
props: {
|
|
18528
18469
|
rect: {},
|
|
18529
18470
|
rowHeight: {},
|
|
18530
|
-
|
|
18471
|
+
colSizes: {},
|
|
18531
18472
|
rowResizeIndex: {},
|
|
18532
18473
|
rowResizeDelta: {},
|
|
18533
18474
|
tableConfig: {},
|
|
@@ -18557,14 +18498,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18557
18498
|
if (props.tableConfig.showSelection) {
|
|
18558
18499
|
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18559
18500
|
}
|
|
18560
|
-
if (props.tableConfig.showCollapser) {
|
|
18561
|
-
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18562
|
-
}
|
|
18563
18501
|
if (props.tableConfig.enableRowDeletion) {
|
|
18564
18502
|
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18565
18503
|
}
|
|
18566
18504
|
const offsets = [];
|
|
18567
|
-
props.
|
|
18505
|
+
props.colSizes.forEach((size) => {
|
|
18568
18506
|
offsets.push(currentOffset);
|
|
18569
18507
|
currentOffset += size;
|
|
18570
18508
|
});
|
|
@@ -18679,7 +18617,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18679
18617
|
}
|
|
18680
18618
|
});
|
|
18681
18619
|
|
|
18682
|
-
const CellSelectionOverlay = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-
|
|
18620
|
+
const CellSelectionOverlay = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-4eeb1626"]]);
|
|
18683
18621
|
|
|
18684
18622
|
const _sfc_main$1 = {
|
|
18685
18623
|
components: {
|
|
@@ -18688,21 +18626,17 @@ const _sfc_main$1 = {
|
|
|
18688
18626
|
Row,
|
|
18689
18627
|
// TablePopover,
|
|
18690
18628
|
CellSelectionOverlay,
|
|
18691
|
-
TableCore: _sfc_main$
|
|
18629
|
+
TableCore: _sfc_main$i,
|
|
18692
18630
|
NewRowButton,
|
|
18693
18631
|
TableActionBar
|
|
18694
18632
|
},
|
|
18695
18633
|
props: {
|
|
18696
18634
|
/**
|
|
18697
18635
|
* Data props.
|
|
18698
|
-
*/
|
|
18699
|
-
data: {
|
|
18700
|
-
type: Array,
|
|
18701
|
-
default: () => []
|
|
18702
|
-
},
|
|
18703
|
-
currentSelection: {
|
|
18636
|
+
*/
|
|
18637
|
+
data: {
|
|
18704
18638
|
type: Array,
|
|
18705
|
-
|
|
18639
|
+
required: true
|
|
18706
18640
|
},
|
|
18707
18641
|
/**
|
|
18708
18642
|
* It specifies how many (empty) rows should be simultated above the given rows in this.data[0]
|
|
@@ -18726,6 +18660,10 @@ const _sfc_main$1 = {
|
|
|
18726
18660
|
type: Array,
|
|
18727
18661
|
default: () => []
|
|
18728
18662
|
},
|
|
18663
|
+
currentSelection: {
|
|
18664
|
+
type: Array,
|
|
18665
|
+
default: () => []
|
|
18666
|
+
},
|
|
18729
18667
|
/**
|
|
18730
18668
|
* analogous to currentSelection but for the bottomData
|
|
18731
18669
|
*/
|
|
@@ -18733,53 +18671,69 @@ const _sfc_main$1 = {
|
|
|
18733
18671
|
type: Array,
|
|
18734
18672
|
default: () => []
|
|
18735
18673
|
},
|
|
18736
|
-
totalSelected: {
|
|
18737
|
-
type: Number,
|
|
18738
|
-
default: 0
|
|
18739
|
-
},
|
|
18740
18674
|
/**
|
|
18741
18675
|
* Config props.
|
|
18742
18676
|
*/
|
|
18743
|
-
|
|
18677
|
+
/** Stable per-column definitions. */
|
|
18678
|
+
columns: {
|
|
18679
|
+
type: Array,
|
|
18680
|
+
required: true
|
|
18681
|
+
},
|
|
18682
|
+
/** Per-column widths, keyed by column id. */
|
|
18683
|
+
colSizes: {
|
|
18684
|
+
type: Array,
|
|
18685
|
+
default: () => []
|
|
18686
|
+
},
|
|
18687
|
+
/** Per-column filter values, keyed by column id. */
|
|
18688
|
+
colFilterValues: {
|
|
18744
18689
|
type: Object,
|
|
18745
18690
|
default: () => ({})
|
|
18746
18691
|
},
|
|
18692
|
+
/** Active sorts, ordered by sort priority. */
|
|
18693
|
+
colSortValues: {
|
|
18694
|
+
type: Array,
|
|
18695
|
+
default: () => []
|
|
18696
|
+
},
|
|
18697
|
+
/** Feature switches for the table. */
|
|
18747
18698
|
tableConfig: {
|
|
18748
18699
|
type: Object,
|
|
18749
|
-
default: () => ({})
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18700
|
+
default: () => ({})
|
|
18701
|
+
},
|
|
18702
|
+
/** Runtime totals and flags for the table. */
|
|
18703
|
+
tableState: {
|
|
18704
|
+
type: Object,
|
|
18705
|
+
default: () => ({})
|
|
18706
|
+
},
|
|
18707
|
+
/** Pagination config; its presence enables pagination. */
|
|
18708
|
+
pageConfig: {
|
|
18709
|
+
type: Object,
|
|
18710
|
+
default: void 0
|
|
18711
|
+
},
|
|
18712
|
+
/** Runtime pagination state. */
|
|
18713
|
+
pageState: {
|
|
18714
|
+
type: Object,
|
|
18715
|
+
default: void 0
|
|
18716
|
+
},
|
|
18717
|
+
/** Action-bar config; its presence enables the action bar. */
|
|
18718
|
+
actionConfig: {
|
|
18719
|
+
type: Object,
|
|
18720
|
+
default: void 0
|
|
18721
|
+
},
|
|
18722
|
+
/** Runtime state of the action bar. */
|
|
18723
|
+
actionState: {
|
|
18724
|
+
type: Object,
|
|
18725
|
+
default: void 0,
|
|
18726
|
+
required: false
|
|
18727
|
+
},
|
|
18728
|
+
/** Per-row and per-group submenu config. */
|
|
18729
|
+
subMenuConfig: {
|
|
18730
|
+
type: Object,
|
|
18731
|
+
default: () => ({})
|
|
18732
|
+
},
|
|
18733
|
+
/** Appearance of the table's rows. */
|
|
18734
|
+
rowConfig: {
|
|
18735
|
+
type: Object,
|
|
18736
|
+
default: () => ({})
|
|
18783
18737
|
},
|
|
18784
18738
|
disableRowHeightTransition: {
|
|
18785
18739
|
type: Boolean,
|
|
@@ -18920,9 +18874,7 @@ const _sfc_main$1 = {
|
|
|
18920
18874
|
editingCellInitialValue.value = initialValue ?? null;
|
|
18921
18875
|
};
|
|
18922
18876
|
const isEditingEnabled = computed(
|
|
18923
|
-
() => getPropertiesFromColumns(props.
|
|
18924
|
-
Boolean
|
|
18925
|
-
)
|
|
18877
|
+
() => getPropertiesFromColumns(props.columns, "editable").some(Boolean)
|
|
18926
18878
|
);
|
|
18927
18879
|
const { handleCopyOnKeydown, handleDeleteSelection } = useCellCopyPaste({
|
|
18928
18880
|
focusWithin,
|
|
@@ -18944,13 +18896,13 @@ const _sfc_main$1 = {
|
|
|
18944
18896
|
};
|
|
18945
18897
|
const toBeShownCell = ref(null);
|
|
18946
18898
|
const closeDataValueView = () => {
|
|
18947
|
-
if (props.
|
|
18899
|
+
if (props.tableState.dataValueViewIsShown) {
|
|
18948
18900
|
emit("closeDataValueView");
|
|
18949
18901
|
}
|
|
18950
18902
|
toBeShownCell.value = null;
|
|
18951
18903
|
};
|
|
18952
18904
|
provideDataValueViewsIsShown(
|
|
18953
|
-
toRef(props, "
|
|
18905
|
+
toRef(props, "tableState"),
|
|
18954
18906
|
closeDataValueView
|
|
18955
18907
|
);
|
|
18956
18908
|
const showNewColumnAndRowButton = computed(
|
|
@@ -19023,102 +18975,22 @@ const _sfc_main$1 = {
|
|
|
19023
18975
|
},
|
|
19024
18976
|
computed: {
|
|
19025
18977
|
minRowHeight() {
|
|
19026
|
-
return this.
|
|
18978
|
+
return this.rowConfig.compactMode ? COMPACT_ROW_HEIGHT : DEFAULT_ROW_HEIGHT;
|
|
19027
18979
|
},
|
|
19028
18980
|
initialRowHeight() {
|
|
19029
|
-
return this.
|
|
18981
|
+
return this.rowConfig?.rowHeight || this.minRowHeight;
|
|
19030
18982
|
},
|
|
19031
18983
|
currentRowHeight() {
|
|
19032
18984
|
return this.resizedRowHeight ?? this.initialRowHeight;
|
|
19033
18985
|
},
|
|
19034
|
-
/*
|
|
19035
|
-
* Current table config. E.g. if 4/10 columns displayed, 'current' fields return values w/ length 4.
|
|
19036
|
-
*/
|
|
19037
|
-
columnHeaders() {
|
|
19038
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "header");
|
|
19039
|
-
},
|
|
19040
|
-
columnSubHeaders() {
|
|
19041
|
-
return getPropertiesFromColumns(
|
|
19042
|
-
this.dataConfig.columnConfigs,
|
|
19043
|
-
"subHeader"
|
|
19044
|
-
);
|
|
19045
|
-
},
|
|
19046
|
-
columnHeaderSubMenuItems() {
|
|
19047
|
-
return getPropertiesFromColumns(
|
|
19048
|
-
this.dataConfig.columnConfigs,
|
|
19049
|
-
"headerSubMenuItems"
|
|
19050
|
-
).map(
|
|
19051
|
-
(menuItems, index) => useHeaderMenuItems({
|
|
19052
|
-
enableFiltering: Boolean(this.tableConfig.showColumnFilters),
|
|
19053
|
-
filterConfig: this.columnFilterConfigs[index],
|
|
19054
|
-
enableSorting: Boolean(this.tableConfig.sortConfig) && Boolean(this.columnSortConfigs[index]),
|
|
19055
|
-
sortDirection: this.tableConfig.sortConfig?.sortColumn === index ? this.tableConfig.sortConfig?.sortDirection ?? 0 : 0,
|
|
19056
|
-
headerSubMenuItems: menuItems,
|
|
19057
|
-
sortTexts: columnSortText[this.columnTypes[index] ?? "default"],
|
|
19058
|
-
onColumnSort: (direction) => this.onColumnSort(index, direction),
|
|
19059
|
-
openFilterControl: () => this.openActionBarFilterControl(index),
|
|
19060
|
-
clearFilter: () => this.clearColumnFilter(index)
|
|
19061
|
-
})
|
|
19062
|
-
);
|
|
19063
|
-
},
|
|
19064
|
-
columnSizes() {
|
|
19065
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "size");
|
|
19066
|
-
},
|
|
19067
|
-
columnTypes() {
|
|
19068
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "type");
|
|
19069
|
-
},
|
|
19070
18986
|
selectedHeaderIndex() {
|
|
19071
18987
|
return this.selectedCell?.y === -1 ? this.selectedCell.x : null;
|
|
19072
18988
|
},
|
|
19073
|
-
columnKeys() {
|
|
19074
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "key");
|
|
19075
|
-
},
|
|
19076
|
-
columnSortConfigs() {
|
|
19077
|
-
return getPropertiesFromColumns(
|
|
19078
|
-
this.dataConfig.columnConfigs,
|
|
19079
|
-
"isSortable"
|
|
19080
|
-
).map((isSortable) => isSortable ?? true);
|
|
19081
|
-
},
|
|
19082
|
-
columnFilterConfigs() {
|
|
19083
|
-
return getPropertiesFromColumns(
|
|
19084
|
-
this.dataConfig.columnConfigs,
|
|
19085
|
-
"filterConfig"
|
|
19086
|
-
);
|
|
19087
|
-
},
|
|
19088
|
-
columnHeaderColors() {
|
|
19089
|
-
return getPropertiesFromColumns(
|
|
19090
|
-
this.dataConfig.columnConfigs,
|
|
19091
|
-
"headerColor"
|
|
19092
|
-
).map((color) => color ?? null);
|
|
19093
|
-
},
|
|
19094
|
-
columnDeletables() {
|
|
19095
|
-
return getPropertiesFromColumns(
|
|
19096
|
-
this.dataConfig.columnConfigs,
|
|
19097
|
-
"deletable"
|
|
19098
|
-
);
|
|
19099
|
-
},
|
|
19100
|
-
columnEditables() {
|
|
19101
|
-
return getPropertiesFromColumns(
|
|
19102
|
-
this.dataConfig.columnConfigs,
|
|
19103
|
-
"editable"
|
|
19104
|
-
);
|
|
19105
|
-
},
|
|
19106
18989
|
slottedColumns() {
|
|
19107
|
-
return getPropertiesFromColumns(
|
|
19108
|
-
this.dataConfig.columnConfigs,
|
|
19109
|
-
"hasSlotContent"
|
|
19110
|
-
).map(
|
|
18990
|
+
return getPropertiesFromColumns(this.columns, "hasSlotContent").map(
|
|
19111
18991
|
(hasSlotContent, colInd) => hasSlotContent ? colInd : null
|
|
19112
18992
|
).filter((colInd) => colInd !== null);
|
|
19113
18993
|
},
|
|
19114
|
-
tableHeaderClass() {
|
|
19115
|
-
return [
|
|
19116
|
-
"table-header",
|
|
19117
|
-
{
|
|
19118
|
-
"sub-menu-active": this.tableConfig.subMenuItems?.length
|
|
19119
|
-
}
|
|
19120
|
-
];
|
|
19121
|
-
},
|
|
19122
18994
|
topDataLength() {
|
|
19123
18995
|
if (this.data === null || this.data.length === 0) {
|
|
19124
18996
|
return 0;
|
|
@@ -19158,9 +19030,6 @@ const _sfc_main$1 = {
|
|
|
19158
19030
|
return isTop ? this.currentSelection[groupInd][indexInInput] : this.currentBottomSelection[indexInInput];
|
|
19159
19031
|
};
|
|
19160
19032
|
},
|
|
19161
|
-
enableRowResize() {
|
|
19162
|
-
return this.dataConfig.rowConfig.enableResizing;
|
|
19163
|
-
},
|
|
19164
19033
|
scrollerItemSize() {
|
|
19165
19034
|
if (this.currentRowHeight === "dynamic") {
|
|
19166
19035
|
return this.minRowHeight;
|
|
@@ -19170,14 +19039,16 @@ const _sfc_main$1 = {
|
|
|
19170
19039
|
sortControlOptions() {
|
|
19171
19040
|
const selectableColumns = [];
|
|
19172
19041
|
const selectableDirections = {};
|
|
19173
|
-
this.
|
|
19174
|
-
if (
|
|
19042
|
+
this.columns.forEach((column) => {
|
|
19043
|
+
if (column.isNotSortable) {
|
|
19175
19044
|
return;
|
|
19176
19045
|
}
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19046
|
+
selectableColumns.push({
|
|
19047
|
+
id: column.id,
|
|
19048
|
+
text: column.header
|
|
19049
|
+
});
|
|
19050
|
+
const sortTexts = columnSortText[column.type ?? "default"];
|
|
19051
|
+
selectableDirections[column.id] = [
|
|
19181
19052
|
{ id: "1", text: sortTexts.ascending },
|
|
19182
19053
|
{ id: "-1", text: sortTexts.descending }
|
|
19183
19054
|
];
|
|
@@ -19186,12 +19057,12 @@ const _sfc_main$1 = {
|
|
|
19186
19057
|
}
|
|
19187
19058
|
},
|
|
19188
19059
|
watch: {
|
|
19189
|
-
"
|
|
19060
|
+
"rowConfig.compactMode": {
|
|
19190
19061
|
handler() {
|
|
19191
19062
|
this.resetRowHeight();
|
|
19192
19063
|
}
|
|
19193
19064
|
},
|
|
19194
|
-
"
|
|
19065
|
+
"rowConfig.rowHeight": {
|
|
19195
19066
|
handler() {
|
|
19196
19067
|
this.resetRowHeight();
|
|
19197
19068
|
}
|
|
@@ -19273,6 +19144,10 @@ const _sfc_main$1 = {
|
|
|
19273
19144
|
this.clearCellSelection();
|
|
19274
19145
|
this.$emit("columnSort", colInd, sortDirection);
|
|
19275
19146
|
},
|
|
19147
|
+
onActionBarColumnSort(columnId, sortDirection) {
|
|
19148
|
+
const colInd = columnId === void 0 ? void 0 : this.columns.findIndex((column) => column.id === columnId);
|
|
19149
|
+
this.onColumnSort(colInd, sortDirection);
|
|
19150
|
+
},
|
|
19276
19151
|
onSelectAll(selected) {
|
|
19277
19152
|
consola.debug(`TableUI emitting: selectAll ${selected}`);
|
|
19278
19153
|
this.$emit("selectAll", selected);
|
|
@@ -19294,7 +19169,7 @@ const _sfc_main$1 = {
|
|
|
19294
19169
|
this.selectCell(
|
|
19295
19170
|
{ x: cellInd, y: rowInd },
|
|
19296
19171
|
groupInd === null ? isTop : groupInd,
|
|
19297
|
-
ignoreIfSelected || Boolean(this.
|
|
19172
|
+
ignoreIfSelected || Boolean(this.columns[cellInd]?.editable)
|
|
19298
19173
|
);
|
|
19299
19174
|
this.stopEditingCell();
|
|
19300
19175
|
},
|
|
@@ -19302,9 +19177,7 @@ const _sfc_main$1 = {
|
|
|
19302
19177
|
if (this.toBeEditedCell && this.toBeEditedCell.x === cellInd && this.toBeEditedCell.y === rowInd) {
|
|
19303
19178
|
return;
|
|
19304
19179
|
}
|
|
19305
|
-
const isEditable = Boolean(
|
|
19306
|
-
this.dataConfig.columnConfigs[cellInd]?.editable
|
|
19307
|
-
);
|
|
19180
|
+
const isEditable = Boolean(this.columns[cellInd]?.editable);
|
|
19308
19181
|
if (isEditable && this.isSingleSelectedCell({ x: cellInd, y: rowInd })) {
|
|
19309
19182
|
this.onStartEditingCell();
|
|
19310
19183
|
} else {
|
|
@@ -19327,7 +19200,7 @@ const _sfc_main$1 = {
|
|
|
19327
19200
|
onTableBodyFocusOut() {
|
|
19328
19201
|
this.changeFocus(false);
|
|
19329
19202
|
if (this.selectedCell) {
|
|
19330
|
-
if (this.
|
|
19203
|
+
if (this.columns[this.selectedCell.x]?.editable) {
|
|
19331
19204
|
this.selectCell(this.selectedCell, this.currentRectId ?? 0, true);
|
|
19332
19205
|
} else {
|
|
19333
19206
|
this.clearCellSelection();
|
|
@@ -19390,8 +19263,7 @@ const _sfc_main$1 = {
|
|
|
19390
19263
|
this.stopEditingCell();
|
|
19391
19264
|
},
|
|
19392
19265
|
onMoveSelectionOutOfBodyUp({ columnInd }) {
|
|
19393
|
-
|
|
19394
|
-
if (!isHeaderFocusable) {
|
|
19266
|
+
if (!this.header?.isColumnHeaderFocusable(columnInd)) {
|
|
19395
19267
|
return;
|
|
19396
19268
|
}
|
|
19397
19269
|
this.clearCellSelection();
|
|
@@ -19424,7 +19296,7 @@ const _sfc_main$1 = {
|
|
|
19424
19296
|
}
|
|
19425
19297
|
},
|
|
19426
19298
|
onMoveIntoBodyFromRight() {
|
|
19427
|
-
const lastColumnInd = this.
|
|
19299
|
+
const lastColumnInd = this.columns.length - 1;
|
|
19428
19300
|
const lastRowAndRectId = this.lastRowAndRectIdBeforeMovingToNewColumnButton ?? {
|
|
19429
19301
|
rowInd: -1,
|
|
19430
19302
|
rectId: null
|
|
@@ -19513,7 +19385,7 @@ const _sfc_main$1 = {
|
|
|
19513
19385
|
if (direction === "right") {
|
|
19514
19386
|
if (type === "delete" && this.tableConfig.showSelection) {
|
|
19515
19387
|
this.focusRowVirtualColumn("selection", rowInd, rectId);
|
|
19516
|
-
} else if (this.
|
|
19388
|
+
} else if (this.columns.length > 0) {
|
|
19517
19389
|
this.onMoveIntoBodyFromLeft(rowInd, rectId);
|
|
19518
19390
|
}
|
|
19519
19391
|
} else if (direction === "left") {
|
|
@@ -19554,7 +19426,7 @@ const _sfc_main$1 = {
|
|
|
19554
19426
|
});
|
|
19555
19427
|
return;
|
|
19556
19428
|
}
|
|
19557
|
-
if (columnInd === this.
|
|
19429
|
+
if (columnInd === this.columns.length) {
|
|
19558
19430
|
this.onMoveSelectionOutOfBodyRight({
|
|
19559
19431
|
rowInd,
|
|
19560
19432
|
rectId: this.currentRectId
|
|
@@ -19572,7 +19444,7 @@ const _sfc_main$1 = {
|
|
|
19572
19444
|
expandSelection
|
|
19573
19445
|
);
|
|
19574
19446
|
await this.scrollToCellSelectionOverlay();
|
|
19575
|
-
this.toBeShownCell = this.
|
|
19447
|
+
this.toBeShownCell = this.tableState.dataValueViewIsShown ? this.selectedCell : null;
|
|
19576
19448
|
},
|
|
19577
19449
|
async expandSelectedCell() {
|
|
19578
19450
|
if (this.selectedCell && this.tableConfig.enableDataValueViews) {
|
|
@@ -19581,7 +19453,7 @@ const _sfc_main$1 = {
|
|
|
19581
19453
|
}
|
|
19582
19454
|
},
|
|
19583
19455
|
onStartEditingCell(initialValue) {
|
|
19584
|
-
if (this.selectedCell && this.
|
|
19456
|
+
if (this.selectedCell && this.columns[this.selectedCell.x]?.editable) {
|
|
19585
19457
|
this.setToBeEditedCell(this.selectedCell, initialValue);
|
|
19586
19458
|
}
|
|
19587
19459
|
},
|
|
@@ -19649,8 +19521,8 @@ const _sfc_main$1 = {
|
|
|
19649
19521
|
this.columnResizeActive = false;
|
|
19650
19522
|
this.$emit("columnResizeEnd");
|
|
19651
19523
|
},
|
|
19652
|
-
getCellContentSlotName(
|
|
19653
|
-
return `cellContent-${
|
|
19524
|
+
getCellContentSlotName(columns, columnId) {
|
|
19525
|
+
return `cellContent-${columns[columnId].key}`;
|
|
19654
19526
|
},
|
|
19655
19527
|
getHeaderComponent() {
|
|
19656
19528
|
return this.$refs.header;
|
|
@@ -19682,8 +19554,8 @@ const _sfc_main$1 = {
|
|
|
19682
19554
|
},
|
|
19683
19555
|
getRowData(row) {
|
|
19684
19556
|
const isEmptyArray = Array.isArray(row) && row.length === 0;
|
|
19685
|
-
return isEmptyArray ? row : this.
|
|
19686
|
-
(column) => row[column]
|
|
19557
|
+
return isEmptyArray ? row : this.columns.map(
|
|
19558
|
+
(column) => row[column.key]
|
|
19687
19559
|
);
|
|
19688
19560
|
},
|
|
19689
19561
|
getRowRefName(groupInd, rowInd) {
|
|
@@ -19720,7 +19592,7 @@ const _sfc_main$1 = {
|
|
|
19720
19592
|
this.$refs.actionBar?.openFilterControl(columnIndex);
|
|
19721
19593
|
},
|
|
19722
19594
|
clearColumnFilter(columnIndex) {
|
|
19723
|
-
const config = this.
|
|
19595
|
+
const config = this.columns[columnIndex].filterConfig;
|
|
19724
19596
|
if (config) {
|
|
19725
19597
|
this.$emit("columnFilter", columnIndex, defaultValueFor(config.is));
|
|
19726
19598
|
}
|
|
@@ -19738,26 +19610,25 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19738
19610
|
const _component_TableCore = resolveComponent("TableCore");
|
|
19739
19611
|
const _component_PageControls = resolveComponent("PageControls");
|
|
19740
19612
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19741
|
-
|
|
19613
|
+
$props.actionConfig ? (openBlock(), createBlock(_component_TableActionBar, {
|
|
19614
|
+
key: 0,
|
|
19742
19615
|
ref: "actionBar",
|
|
19743
|
-
"all-rows-count": $props.
|
|
19744
|
-
"filtered-rows-count": $props.
|
|
19745
|
-
"all-columns-count": $props.
|
|
19746
|
-
"filtered-columns-count": $
|
|
19747
|
-
title: $props.
|
|
19748
|
-
"row-label": $props.tableConfig.
|
|
19749
|
-
"show-table-size": $props.tableConfig.
|
|
19750
|
-
"
|
|
19751
|
-
"
|
|
19752
|
-
"
|
|
19616
|
+
"all-rows-count": $props.tableState.tableSize,
|
|
19617
|
+
"filtered-rows-count": $props.tableState.currentSize,
|
|
19618
|
+
"all-columns-count": $props.tableState.columnCount,
|
|
19619
|
+
"filtered-columns-count": $props.columns.length,
|
|
19620
|
+
title: $props.actionState?.actionBarTitle,
|
|
19621
|
+
"row-label": $props.tableConfig.rowLabel,
|
|
19622
|
+
"show-table-size": $props.tableConfig.showTableSize,
|
|
19623
|
+
"action-config": $props.actionConfig,
|
|
19624
|
+
"col-sort-values": $props.colSortValues,
|
|
19625
|
+
"col-filter-values": $props.colFilterValues,
|
|
19753
19626
|
"sort-control-options": $options.sortControlOptions,
|
|
19754
|
-
|
|
19755
|
-
"column-headers": $options.columnHeaders,
|
|
19756
|
-
"settings-items": $props.tableConfig.settingsItems,
|
|
19627
|
+
columns: $props.columns,
|
|
19757
19628
|
onResetTemporaryView: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("resetTemporaryView")),
|
|
19758
19629
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => _ctx.$emit("columnFilter", colInd, value)),
|
|
19759
|
-
onOnColumnSort: $options.
|
|
19760
|
-
}, null, 8, ["all-rows-count", "filtered-rows-count", "all-columns-count", "filtered-columns-count", "title", "row-label", "show-table-size", "
|
|
19630
|
+
onOnColumnSort: $options.onActionBarColumnSort
|
|
19631
|
+
}, null, 8, ["all-rows-count", "filtered-rows-count", "all-columns-count", "filtered-columns-count", "title", "row-label", "show-table-size", "action-config", "col-sort-values", "col-filter-values", "sort-control-options", "columns", "onOnColumnSort"])) : createCommentVNode("", true),
|
|
19761
19632
|
createElementVNode("table", {
|
|
19762
19633
|
ref: "wrapper",
|
|
19763
19634
|
tabindex: -1,
|
|
@@ -19775,14 +19646,15 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19775
19646
|
ref: "tableCore",
|
|
19776
19647
|
"scroll-data": $options.scrollData,
|
|
19777
19648
|
"total-width": $setup.totalWidth,
|
|
19778
|
-
"
|
|
19649
|
+
"col-sizes": $props.colSizes,
|
|
19779
19650
|
"column-resize": { active: $data.columnResizeActive },
|
|
19780
19651
|
"table-config": $props.tableConfig,
|
|
19652
|
+
"sub-menu-config": $props.subMenuConfig,
|
|
19781
19653
|
"scroll-config": {
|
|
19782
19654
|
itemSize: $options.scrollerItemSize,
|
|
19783
19655
|
numRowsAbove: $props.numRowsAbove,
|
|
19784
19656
|
numRowsBelow: $props.numRowsBelow,
|
|
19785
|
-
compact: Boolean($props.
|
|
19657
|
+
compact: Boolean($props.rowConfig.compactMode)
|
|
19786
19658
|
},
|
|
19787
19659
|
"current-row-height": $options.currentRowHeight,
|
|
19788
19660
|
"new-column-button-width": $setup.newColumnButtonWidth,
|
|
@@ -19801,9 +19673,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19801
19673
|
"row-data": row,
|
|
19802
19674
|
row: $options.getRowData(row),
|
|
19803
19675
|
"table-config": $props.tableConfig,
|
|
19804
|
-
"
|
|
19805
|
-
"
|
|
19806
|
-
|
|
19676
|
+
"sub-menu-config": $props.subMenuConfig,
|
|
19677
|
+
"show-drag-handle": $props.tableConfig.enableRowResizing,
|
|
19678
|
+
columns: $props.columns,
|
|
19679
|
+
"col-sizes": $props.colSizes,
|
|
19680
|
+
"row-config": $props.rowConfig,
|
|
19807
19681
|
"row-height": $options.currentRowHeight,
|
|
19808
19682
|
"min-row-height": $options.minRowHeight,
|
|
19809
19683
|
"is-selected": $options.currentSelectionMap(rowInd, groupInd || 0),
|
|
@@ -19846,12 +19720,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19846
19720
|
}, [
|
|
19847
19721
|
renderList($options.slottedColumns, (colInd) => {
|
|
19848
19722
|
return {
|
|
19849
|
-
name: $options.getCellContentSlotName($
|
|
19723
|
+
name: $options.getCellContentSlotName($props.columns, colInd),
|
|
19850
19724
|
fn: withCtx((cellData) => [
|
|
19851
|
-
renderSlot(_ctx.$slots, `cellContent-${$
|
|
19725
|
+
renderSlot(_ctx.$slots, `cellContent-${$props.columns[colInd].key}`, {
|
|
19852
19726
|
data: {
|
|
19853
19727
|
...cellData,
|
|
19854
|
-
key: $
|
|
19728
|
+
key: $props.columns[colInd].key,
|
|
19855
19729
|
rowInd,
|
|
19856
19730
|
colInd
|
|
19857
19731
|
}
|
|
@@ -19859,26 +19733,31 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19859
19733
|
])
|
|
19860
19734
|
};
|
|
19861
19735
|
})
|
|
19862
|
-
]), 1032, ["row-data", "row", "table-config", "show-drag-handle", "
|
|
19736
|
+
]), 1032, ["row-data", "row", "table-config", "sub-menu-config", "show-drag-handle", "columns", "col-sizes", "row-config", "row-height", "min-row-height", "is-selected", "select-cells-on-move", "disable-row-height-transition", "selected-cell-index", "cell-selection-range", "to-be-expanded-cell-index", "to-be-edited-cell-index", "new-column-button-width", "onDeleteRow", "onRowSelect", "onCellSelect", "onDataValueView", "onExpandCellSelect", "onRowInput", "onRowSubMenuClick", "onResizeAllRows", "onResizeRow", "onVirtualColumnNav"])
|
|
19863
19737
|
]),
|
|
19864
19738
|
header: withCtx(({ getDragHandleHeight, width = null }) => [
|
|
19865
19739
|
createVNode(_component_Header, {
|
|
19866
19740
|
ref: "header",
|
|
19867
19741
|
style: normalizeStyle(width === null ? {} : { width: `${width}px` }),
|
|
19868
19742
|
"table-config": $props.tableConfig,
|
|
19869
|
-
"
|
|
19870
|
-
|
|
19871
|
-
"
|
|
19872
|
-
"
|
|
19873
|
-
"
|
|
19874
|
-
"column-deletables": $options.columnDeletables,
|
|
19875
|
-
"column-editables": $options.columnEditables,
|
|
19876
|
-
"is-selected": $props.totalSelected > 0,
|
|
19743
|
+
"action-config": $props.actionConfig,
|
|
19744
|
+
columns: $props.columns,
|
|
19745
|
+
"col-filter-values": $props.colFilterValues,
|
|
19746
|
+
"col-sizes": $props.colSizes,
|
|
19747
|
+
"is-selected": $props.tableState.totalSelected > 0,
|
|
19877
19748
|
"get-drag-handle-height": getDragHandleHeight,
|
|
19878
|
-
class: normalizeClass(
|
|
19749
|
+
class: normalizeClass([
|
|
19750
|
+
"table-header",
|
|
19751
|
+
{
|
|
19752
|
+
"sub-menu-active": $props.subMenuConfig.subMenuItems?.length
|
|
19753
|
+
}
|
|
19754
|
+
]),
|
|
19879
19755
|
"show-new-column-button": $setup.showNewColumnAndRowButton,
|
|
19880
19756
|
"selected-header-index": $options.selectedHeaderIndex,
|
|
19881
19757
|
onHeaderSelect: $options.onSelectAll,
|
|
19758
|
+
onColumnSort: $options.onColumnSort,
|
|
19759
|
+
onOpenActionBarFilterControl: $options.openActionBarFilterControl,
|
|
19760
|
+
onClearColumnFilter: $options.clearColumnFilter,
|
|
19882
19761
|
onDeleteColumn: $options.onDeleteColumn,
|
|
19883
19762
|
onColumnResize: $options.onColumnResize,
|
|
19884
19763
|
onAllColumnsResize: $options.onAllColumnsResize,
|
|
@@ -19897,7 +19776,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19897
19776
|
renderSlot(_ctx.$slots, "subHeader", normalizeProps(guardReactiveProps(slotProps)), void 0, true)
|
|
19898
19777
|
]),
|
|
19899
19778
|
_: 3
|
|
19900
|
-
}, 8, ["style", "table-config", "
|
|
19779
|
+
}, 8, ["style", "table-config", "action-config", "columns", "col-filter-values", "col-sizes", "is-selected", "get-drag-handle-height", "class", "show-new-column-button", "selected-header-index", "onHeaderSelect", "onColumnSort", "onOpenActionBarFilterControl", "onClearColumnFilter", "onDeleteColumn", "onColumnResize", "onAllColumnsResize", "onColumnResizeStart", "onColumnResizeEnd", "onMoveDownFromHeaderCell", "onHeaderCellSelect", "onHeaderCellDeselect", "onUpdate:newColumnButtonWidth", "onNewColumnButtonClick"])
|
|
19901
19780
|
]),
|
|
19902
19781
|
"cell-selection-overlay": withCtx(() => [
|
|
19903
19782
|
$setup.rectMinMax && !$setup.isEditingCell && $options.selectedHeaderIndex === null ? (openBlock(), createBlock(_component_CellSelectionOverlay, {
|
|
@@ -19908,9 +19787,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19908
19787
|
"table-config": $props.tableConfig,
|
|
19909
19788
|
"row-resize-index": $data.currentResizedScrollIndex,
|
|
19910
19789
|
"row-resize-delta": $data.currentRowSizeDelta,
|
|
19911
|
-
"
|
|
19790
|
+
"col-sizes": $props.colSizes,
|
|
19912
19791
|
"cell-selection-rect-focus-corner": $setup.focusWithin ? $setup.selectedCell : void 0
|
|
19913
|
-
}, null, 8, ["rect", "row-height", "table-config", "row-resize-index", "row-resize-delta", "
|
|
19792
|
+
}, null, 8, ["rect", "row-height", "table-config", "row-resize-index", "row-resize-delta", "col-sizes", "cell-selection-rect-focus-corner"])) : createCommentVNode("", true)
|
|
19914
19793
|
]),
|
|
19915
19794
|
belowBody: withCtx(() => [
|
|
19916
19795
|
$setup.showNewColumnAndRowButton ? (openBlock(), createBlock(_component_NewRowButton, {
|
|
@@ -19923,17 +19802,20 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19923
19802
|
}, null, 8, ["onClick", "onKeydownUp"])) : createCommentVNode("", true)
|
|
19924
19803
|
]),
|
|
19925
19804
|
_: 3
|
|
19926
|
-
}, 8, ["scroll-data", "total-width", "
|
|
19927
|
-
$props.
|
|
19805
|
+
}, 8, ["scroll-data", "total-width", "col-sizes", "column-resize", "table-config", "sub-menu-config", "scroll-config", "current-row-height", "new-column-button-width", "onScrollerUpdate", "onMoveSelection", "onClearSelection", "onExpandSelectedCell", "onStartEditing"]),
|
|
19806
|
+
$props.pageConfig && $props.pageState ? (openBlock(), createBlock(_component_PageControls, {
|
|
19928
19807
|
key: 0,
|
|
19929
|
-
"page-config": $props.
|
|
19808
|
+
"page-config": $props.pageConfig,
|
|
19809
|
+
"table-config": $props.tableConfig,
|
|
19810
|
+
"page-state": $props.pageState,
|
|
19811
|
+
"table-state": $props.tableState,
|
|
19930
19812
|
onPageChange: $options.onPageChange,
|
|
19931
19813
|
onPageSizeUpdate: $options.onPageSizeUpdate
|
|
19932
|
-
}, null, 8, ["page-config", "onPageChange", "onPageSizeUpdate"])) : createCommentVNode("", true)
|
|
19814
|
+
}, null, 8, ["page-config", "table-config", "page-state", "table-state", "onPageChange", "onPageSizeUpdate"])) : createCommentVNode("", true)
|
|
19933
19815
|
], 544)
|
|
19934
19816
|
]);
|
|
19935
19817
|
}
|
|
19936
|
-
const TableUI = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
19818
|
+
const TableUI = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-bac906a7"]]);
|
|
19937
19819
|
|
|
19938
19820
|
const useTableReady = ({ onReady }) => {
|
|
19939
19821
|
const autoSizesInitialized = ref(false);
|
|
@@ -19973,7 +19855,18 @@ const _sfc_main = {
|
|
|
19973
19855
|
type: Array,
|
|
19974
19856
|
default: () => []
|
|
19975
19857
|
},
|
|
19976
|
-
|
|
19858
|
+
/** Stable per-column definitions (forwarded to TableUI). */
|
|
19859
|
+
columns: {
|
|
19860
|
+
type: Array,
|
|
19861
|
+
default: () => []
|
|
19862
|
+
},
|
|
19863
|
+
/** Per-column widths, ordered by displayed column (forwarded to TableUI). */
|
|
19864
|
+
colSizes: {
|
|
19865
|
+
type: Array,
|
|
19866
|
+
default: () => []
|
|
19867
|
+
},
|
|
19868
|
+
/** Appearance of the table's rows (forwarded to TableUI). */
|
|
19869
|
+
rowConfig: {
|
|
19977
19870
|
type: Object,
|
|
19978
19871
|
default: () => ({})
|
|
19979
19872
|
},
|
|
@@ -19981,6 +19874,54 @@ const _sfc_main = {
|
|
|
19981
19874
|
type: Object,
|
|
19982
19875
|
default: () => ({})
|
|
19983
19876
|
},
|
|
19877
|
+
tableState: {
|
|
19878
|
+
type: Object,
|
|
19879
|
+
default: () => ({})
|
|
19880
|
+
},
|
|
19881
|
+
pageConfig: {
|
|
19882
|
+
type: Object,
|
|
19883
|
+
default: void 0
|
|
19884
|
+
},
|
|
19885
|
+
pageState: {
|
|
19886
|
+
type: Object,
|
|
19887
|
+
default: void 0
|
|
19888
|
+
},
|
|
19889
|
+
actionConfig: {
|
|
19890
|
+
type: Object,
|
|
19891
|
+
default: void 0
|
|
19892
|
+
},
|
|
19893
|
+
actionState: {
|
|
19894
|
+
type: Object,
|
|
19895
|
+
default: void 0
|
|
19896
|
+
},
|
|
19897
|
+
colFilterValues: {
|
|
19898
|
+
type: Object,
|
|
19899
|
+
default: () => ({})
|
|
19900
|
+
},
|
|
19901
|
+
colSortValues: {
|
|
19902
|
+
type: Array,
|
|
19903
|
+
default: () => []
|
|
19904
|
+
},
|
|
19905
|
+
numRowsAbove: {
|
|
19906
|
+
type: Number,
|
|
19907
|
+
default: 0
|
|
19908
|
+
},
|
|
19909
|
+
numRowsBelow: {
|
|
19910
|
+
type: Number,
|
|
19911
|
+
default: 0
|
|
19912
|
+
},
|
|
19913
|
+
bottomData: {
|
|
19914
|
+
type: Array,
|
|
19915
|
+
default: () => []
|
|
19916
|
+
},
|
|
19917
|
+
currentBottomSelection: {
|
|
19918
|
+
type: Array,
|
|
19919
|
+
default: () => []
|
|
19920
|
+
},
|
|
19921
|
+
subMenuConfig: {
|
|
19922
|
+
type: Object,
|
|
19923
|
+
default: () => ({})
|
|
19924
|
+
},
|
|
19984
19925
|
/** This object contains all the options necessary to calculate the sizes based on the
|
|
19985
19926
|
* content. In case only one of calculateForBody/calculateForHeader is true, the emitted object contains auto
|
|
19986
19927
|
* sizes according to body/header. In case both are true, the maximum of both values is used. For fixedSizes only
|
|
@@ -20029,8 +19970,8 @@ const _sfc_main = {
|
|
|
20029
19970
|
mountTableUIForAutoSizeCalculation() {
|
|
20030
19971
|
return this.data !== null && this.calculateSizes;
|
|
20031
19972
|
},
|
|
20032
|
-
|
|
20033
|
-
return getPropertiesFromColumns(this.
|
|
19973
|
+
columnIds() {
|
|
19974
|
+
return getPropertiesFromColumns(this.columns, "id");
|
|
20034
19975
|
},
|
|
20035
19976
|
currentColumnsWithAutoSize() {
|
|
20036
19977
|
return /* @__PURE__ */ new Set([
|
|
@@ -20041,7 +19982,7 @@ const _sfc_main = {
|
|
|
20041
19982
|
removedColumnIds() {
|
|
20042
19983
|
const removedColumnIds = /* @__PURE__ */ new Set();
|
|
20043
19984
|
this.currentColumnsWithAutoSize.forEach((columnId) => {
|
|
20044
|
-
if (!this.
|
|
19985
|
+
if (!this.columnIds.includes(columnId)) {
|
|
20045
19986
|
removedColumnIds.add(columnId);
|
|
20046
19987
|
}
|
|
20047
19988
|
});
|
|
@@ -20049,7 +19990,7 @@ const _sfc_main = {
|
|
|
20049
19990
|
},
|
|
20050
19991
|
addedColumnIds() {
|
|
20051
19992
|
const addedColumnIds = /* @__PURE__ */ new Set();
|
|
20052
|
-
this.
|
|
19993
|
+
this.columnIds.forEach((columnId) => {
|
|
20053
19994
|
if (!this.currentColumnsWithAutoSize.has(columnId)) {
|
|
20054
19995
|
addedColumnIds.add(columnId);
|
|
20055
19996
|
}
|
|
@@ -20062,19 +20003,11 @@ const _sfc_main = {
|
|
|
20062
20003
|
paginatedDataForAutoColumnSizesCalculation() {
|
|
20063
20004
|
return [this.data.flat().slice(0, DEFAULT_NUM_ROWS)];
|
|
20064
20005
|
},
|
|
20065
|
-
|
|
20066
|
-
return
|
|
20067
|
-
...this.dataConfig,
|
|
20068
|
-
columnConfigs: this.dataConfig.columnConfigs.map(
|
|
20069
|
-
(columnConfig) => ({
|
|
20070
|
-
...columnConfig,
|
|
20071
|
-
size: MAX_AUTO_COLUMN_SIZE
|
|
20072
|
-
})
|
|
20073
|
-
)
|
|
20074
|
-
};
|
|
20006
|
+
colSizesForCalculationWithAutoColumnSizes() {
|
|
20007
|
+
return this.columnIds.map(() => MAX_AUTO_COLUMN_SIZE);
|
|
20075
20008
|
},
|
|
20076
|
-
|
|
20077
|
-
return this.autoColumnSizingActive ? this.
|
|
20009
|
+
colSizesForAutoSizesCalculation() {
|
|
20010
|
+
return this.autoColumnSizingActive ? this.colSizesForCalculationWithAutoColumnSizes : this.colSizes;
|
|
20078
20011
|
},
|
|
20079
20012
|
tableConfigForAutoSizesCalculation() {
|
|
20080
20013
|
return {
|
|
@@ -20093,7 +20026,7 @@ const _sfc_main = {
|
|
|
20093
20026
|
return this.autoColumnSizingActive && !this.useSavedColumnSizes;
|
|
20094
20027
|
},
|
|
20095
20028
|
columnPaddingsHorizontal() {
|
|
20096
|
-
return this.
|
|
20029
|
+
return this.columnIds.reduce(
|
|
20097
20030
|
(paddings, columnId) => {
|
|
20098
20031
|
paddings[columnId] = CELL_PADDING_HORIZONTAL * 2;
|
|
20099
20032
|
return paddings;
|
|
@@ -20128,12 +20061,12 @@ const _sfc_main = {
|
|
|
20128
20061
|
},
|
|
20129
20062
|
deep: true
|
|
20130
20063
|
},
|
|
20131
|
-
|
|
20064
|
+
columnIds(newIds, oldIds) {
|
|
20132
20065
|
if (newIds.length !== oldIds.length || !newIds.every((el, index) => el === oldIds[index])) {
|
|
20133
20066
|
this.triggerCalculationOfAutoSizes();
|
|
20134
20067
|
}
|
|
20135
20068
|
},
|
|
20136
|
-
"
|
|
20069
|
+
"rowConfig.compactMode": {
|
|
20137
20070
|
handler() {
|
|
20138
20071
|
if (this.autoRowHeightOptions.calculate) {
|
|
20139
20072
|
this.useSavedColumnSizes = true;
|
|
@@ -20145,7 +20078,7 @@ const _sfc_main = {
|
|
|
20145
20078
|
mounted() {
|
|
20146
20079
|
if (this.autoRowHeightSizingActive) {
|
|
20147
20080
|
const unwatchRowHeight = this.$watch(
|
|
20148
|
-
() => this.
|
|
20081
|
+
() => this.rowConfig.rowHeight,
|
|
20149
20082
|
async () => {
|
|
20150
20083
|
await sleep(0);
|
|
20151
20084
|
this.disableRowHeightTransition = false;
|
|
@@ -20239,7 +20172,7 @@ const _sfc_main = {
|
|
|
20239
20172
|
this.emitNewAutoSizes();
|
|
20240
20173
|
},
|
|
20241
20174
|
initializeSizesWithMinSize(minSize) {
|
|
20242
|
-
return this.
|
|
20175
|
+
return this.columnIds.reduce(
|
|
20243
20176
|
(sizes, columnId) => ({
|
|
20244
20177
|
...sizes,
|
|
20245
20178
|
[columnId]: minSize
|
|
@@ -20280,7 +20213,7 @@ const _sfc_main = {
|
|
|
20280
20213
|
const sizesByColumn = {};
|
|
20281
20214
|
const heightsByColumn = {};
|
|
20282
20215
|
const cellComponents = rowComponent.getCellComponents();
|
|
20283
|
-
this.
|
|
20216
|
+
this.columnIds.forEach((columnId, columnIndex) => {
|
|
20284
20217
|
if (!fixedSizes.hasOwnProperty(columnId)) {
|
|
20285
20218
|
const { width, height } = cellComponents[columnIndex].getCellContentDimensions();
|
|
20286
20219
|
sizesByColumn[columnId] = width;
|
|
@@ -20294,7 +20227,7 @@ const _sfc_main = {
|
|
|
20294
20227
|
},
|
|
20295
20228
|
calculateAndSetAutoColumnSizesHeader() {
|
|
20296
20229
|
const headerCellSizes = this.$refs.tableUIForAutoSize.getHeaderComponent().getHeaderCellWidths();
|
|
20297
|
-
this.
|
|
20230
|
+
this.columnIds.forEach((columnId, columnIndex) => {
|
|
20298
20231
|
const headerWidth = headerCellSizes[columnIndex];
|
|
20299
20232
|
if (this.currentColumnSizes[columnId] < headerWidth) {
|
|
20300
20233
|
this.currentColumnSizes[columnId] = headerWidth;
|
|
@@ -20340,8 +20273,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20340
20273
|
}, _ctx.$attrs, {
|
|
20341
20274
|
data: $props.data,
|
|
20342
20275
|
"current-selection": $props.currentSelection,
|
|
20343
|
-
"
|
|
20276
|
+
"current-bottom-selection": $props.currentBottomSelection,
|
|
20277
|
+
columns: $props.columns,
|
|
20278
|
+
"col-sizes": $props.colSizes,
|
|
20279
|
+
"col-filter-values": $props.colFilterValues,
|
|
20280
|
+
"col-sort-values": $props.colSortValues,
|
|
20281
|
+
"num-rows-above": $props.numRowsAbove,
|
|
20282
|
+
"num-rows-below": $props.numRowsBelow,
|
|
20283
|
+
"bottom-data": $props.bottomData,
|
|
20284
|
+
"row-config": $props.rowConfig,
|
|
20344
20285
|
"table-config": $props.tableConfig,
|
|
20286
|
+
"table-state": $props.tableState,
|
|
20287
|
+
"page-config": $props.pageConfig,
|
|
20288
|
+
"page-state": $props.pageState,
|
|
20289
|
+
"action-config": $props.actionConfig,
|
|
20290
|
+
"action-state": $props.actionState,
|
|
20291
|
+
"sub-menu-config": $props.subMenuConfig,
|
|
20345
20292
|
"disable-row-height-transition": $data.disableRowHeightTransition,
|
|
20346
20293
|
"onUpdate:availableWidth": $options.onUpdateAvailableWidth
|
|
20347
20294
|
}), createSlots({ _: 2 }, [
|
|
@@ -20353,14 +20300,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20353
20300
|
])
|
|
20354
20301
|
};
|
|
20355
20302
|
})
|
|
20356
|
-
]), 1040, ["style", "data", "current-selection", "data-config", "table-config", "disable-row-height-transition", "onUpdate:availableWidth"]),
|
|
20303
|
+
]), 1040, ["style", "data", "current-selection", "current-bottom-selection", "columns", "col-sizes", "col-filter-values", "col-sort-values", "num-rows-above", "num-rows-below", "bottom-data", "row-config", "table-config", "table-state", "page-config", "page-state", "action-config", "action-state", "sub-menu-config", "disable-row-height-transition", "onUpdate:availableWidth"]),
|
|
20357
20304
|
$options.mountTableUIForAutoSizeCalculation ? (openBlock(), createBlock(_component_TableUI, {
|
|
20358
20305
|
key: 0,
|
|
20359
20306
|
ref: "tableUIForAutoSize",
|
|
20360
20307
|
class: "table-column-size-calculation",
|
|
20361
20308
|
data: $options.paginatedDataForAutoColumnSizesCalculation,
|
|
20362
20309
|
"current-selection": $props.currentSelection,
|
|
20363
|
-
|
|
20310
|
+
columns: $props.columns,
|
|
20311
|
+
"col-sizes": $options.colSizesForAutoSizesCalculation,
|
|
20312
|
+
"row-config": $props.rowConfig,
|
|
20364
20313
|
"table-config": $options.tableConfigForAutoSizesCalculation,
|
|
20365
20314
|
onVnodeMounted: $options.calculateAutoSizes
|
|
20366
20315
|
}, createSlots({ _: 2 }, [
|
|
@@ -20372,603 +20321,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20372
20321
|
])
|
|
20373
20322
|
};
|
|
20374
20323
|
})
|
|
20375
|
-
]), 1032, ["data", "current-selection", "
|
|
20324
|
+
]), 1032, ["data", "current-selection", "columns", "col-sizes", "row-config", "table-config", "onVnodeMounted"])) : createCommentVNode("", true)
|
|
20376
20325
|
], 64);
|
|
20377
20326
|
}
|
|
20378
|
-
const TableUIWithAutoSizeCalculation = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
20379
|
-
|
|
20380
|
-
const getColumnDomains = ({ data, formatters, types }) => {
|
|
20381
|
-
let domainMap = {};
|
|
20382
|
-
let nominalColumns = [];
|
|
20383
|
-
Object.entries(types).forEach((entry) => {
|
|
20384
|
-
let [col, colType] = entry;
|
|
20385
|
-
// treat boolean as nominal (as they can have formatted domains)
|
|
20386
|
-
if ([columnTypes.Boolean, columnTypes.Nominal].includes(colType)) {
|
|
20387
|
-
nominalColumns.push(col);
|
|
20388
|
-
domainMap[col] = [];
|
|
20389
|
-
}
|
|
20390
|
-
});
|
|
20391
|
-
data.forEach((row) => {
|
|
20392
|
-
nominalColumns.forEach((col) => {
|
|
20393
|
-
const cellValue = unpackObjectRepresentation(row[col]);
|
|
20394
|
-
const formattedCellValue = formatters?.[col]?.(cellValue) || cellValue;
|
|
20395
|
-
if (!domainMap[col].includes(formattedCellValue)) {
|
|
20396
|
-
domainMap[col].push(formattedCellValue);
|
|
20397
|
-
}
|
|
20398
|
-
});
|
|
20399
|
-
});
|
|
20400
|
-
return domainMap;
|
|
20401
|
-
};
|
|
20402
|
-
|
|
20403
|
-
const getDefaultFilterValues = (columns, types) => columns.reduce((obj, col) => {
|
|
20404
|
-
obj[col] = columnFilterConfigs[types[col]].getInitialValue();
|
|
20405
|
-
return obj;
|
|
20406
|
-
}, {});
|
|
20407
|
-
const getInitialFilterValues = (columns, types, initialFilterValues) => columns.reduce((obj, col) => {
|
|
20408
|
-
obj[col] = initialFilterValues.hasOwnProperty(col) ? initialFilterValues[col] : columnFilterConfigs[types[col]].getInitialValue();
|
|
20409
|
-
return obj;
|
|
20410
|
-
}, {});
|
|
20411
|
-
const getFilterConfigs = ({
|
|
20412
|
-
domains,
|
|
20413
|
-
columns,
|
|
20414
|
-
types,
|
|
20415
|
-
values
|
|
20416
|
-
}) => columns.map((col) => {
|
|
20417
|
-
const is = columnFilterConfigs[types[col]].is;
|
|
20418
|
-
if (is === "FilterInputField") {
|
|
20419
|
-
return {
|
|
20420
|
-
is,
|
|
20421
|
-
modelValue: values[col]
|
|
20422
|
-
};
|
|
20423
|
-
}
|
|
20424
|
-
return {
|
|
20425
|
-
is,
|
|
20426
|
-
modelValue: values[col],
|
|
20427
|
-
possibleValues: (domains[col] ?? []).map((val) => ({
|
|
20428
|
-
id: val,
|
|
20429
|
-
text: val
|
|
20430
|
-
}))
|
|
20431
|
-
};
|
|
20432
|
-
});
|
|
20433
|
-
|
|
20434
|
-
/**
|
|
20435
|
-
* Utility for checking the current pagination state and providing the correct page
|
|
20436
|
-
* number if the current state is invalid. Invalid page states include a current page
|
|
20437
|
-
* number which is outside of the range of the filtered data, a page size which is
|
|
20438
|
-
* larger than the total number of rows in the data or a paginated data set size of 0.
|
|
20439
|
-
*
|
|
20440
|
-
* @param {Number} pageSize - the current page size (in number of rows per page).
|
|
20441
|
-
* @param {Number} currentPage - the current page number to check.
|
|
20442
|
-
* @param {Number} availableRows - the number of rows in the filtered data set.
|
|
20443
|
-
* @param {Number} pageRows - the number of rows in the current paginated data set.
|
|
20444
|
-
* @returns {Number|null} new page number or null of no update is needed.
|
|
20445
|
-
*/
|
|
20446
|
-
const getNextPage = (pageSize, currentPage, availableRows, pageRows) => {
|
|
20447
|
-
if (pageSize > availableRows) {
|
|
20448
|
-
return 1;
|
|
20449
|
-
} else if (pageSize * currentPage > availableRows || pageRows < 1) {
|
|
20450
|
-
let newPageNumber = currentPage;
|
|
20451
|
-
while (newPageNumber >= 1) {
|
|
20452
|
-
if (pageSize * newPageNumber > availableRows) {
|
|
20453
|
-
newPageNumber -= 1;
|
|
20454
|
-
} else {
|
|
20455
|
-
break;
|
|
20456
|
-
}
|
|
20457
|
-
}
|
|
20458
|
-
return newPageNumber;
|
|
20459
|
-
}
|
|
20460
|
-
return null;
|
|
20461
|
-
};
|
|
20462
|
-
|
|
20463
|
-
/**
|
|
20464
|
-
* Take a relative row id from a selection event and return the processed index.
|
|
20465
|
-
*
|
|
20466
|
-
* @param {*} param
|
|
20467
|
-
* @param {Number} param.relativeInd - row index provided by event.
|
|
20468
|
-
* @param {Number} param.groupInd - row group index provided by event.
|
|
20469
|
-
* @param {Number} param.currentPage - the current page number from the table.
|
|
20470
|
-
* @param {Number} param.currentPageSize - the current page size from the table.
|
|
20471
|
-
* @param {Number} [param.currentGroup] - the current group-by group (if present).
|
|
20472
|
-
* @param {Array<Array<Number>>} param.processedIndicies - the grouped and sorted index mapping.
|
|
20473
|
-
* @returns {number} index from processed mapping
|
|
20474
|
-
*/
|
|
20475
|
-
const getProcessedRowInd = ({
|
|
20476
|
-
relativeInd,
|
|
20477
|
-
groupInd,
|
|
20478
|
-
currentPage,
|
|
20479
|
-
currentPageSize,
|
|
20480
|
-
currentGroup,
|
|
20481
|
-
processedIndicies,
|
|
20482
|
-
}) => {
|
|
20483
|
-
let pageStart = currentPageSize * (currentPage - 1);
|
|
20484
|
-
if (pageStart === 0) {
|
|
20485
|
-
return relativeInd;
|
|
20486
|
-
}
|
|
20487
|
-
if (currentGroup) {
|
|
20488
|
-
let indCount = 0;
|
|
20489
|
-
processedIndicies.forEach((group, gInd) => {
|
|
20490
|
-
if (gInd < groupInd) {
|
|
20491
|
-
indCount += group.length;
|
|
20492
|
-
}
|
|
20493
|
-
});
|
|
20494
|
-
if (indCount <= pageStart) {
|
|
20495
|
-
return pageStart - indCount + relativeInd;
|
|
20496
|
-
}
|
|
20497
|
-
return relativeInd;
|
|
20498
|
-
}
|
|
20499
|
-
return relativeInd + pageStart;
|
|
20500
|
-
};
|
|
20501
|
-
|
|
20502
|
-
/**
|
|
20503
|
-
* Utility function to search a single cell. Formatters are required for the following table data types:
|
|
20504
|
-
* Number, String, Nominal, DateTime, Boolean. Errors thrown during search will assume no match was found
|
|
20505
|
-
* and return false. Additionally, if no type is supplied, `toString` will be called on the item. Objects
|
|
20506
|
-
* and Arrays are stringified to perform a 'deep search'.
|
|
20507
|
-
*
|
|
20508
|
-
* ** All searches are case insensitive **
|
|
20509
|
-
*
|
|
20510
|
-
* @param {*} field - the item to search.
|
|
20511
|
-
* @param {String} type - the table data type for the search item.
|
|
20512
|
-
* @param {Function} formatter - the formatting function to apply to the item before searching.
|
|
20513
|
-
* @param {String} query - the search term to locate in the item.
|
|
20514
|
-
* @returns {Boolean} - if a match was found.
|
|
20515
|
-
*/
|
|
20516
|
-
const searchCell = (field, type, formatter, query) => {
|
|
20517
|
-
if (typeof field === "undefined") {
|
|
20518
|
-
return false;
|
|
20519
|
-
}
|
|
20520
|
-
try {
|
|
20521
|
-
let formattedData;
|
|
20522
|
-
switch (type) {
|
|
20523
|
-
case columnTypes.Number:
|
|
20524
|
-
case columnTypes.String:
|
|
20525
|
-
case columnTypes.Nominal:
|
|
20526
|
-
case columnTypes.DateTime:
|
|
20527
|
-
case columnTypes.Boolean:
|
|
20528
|
-
formattedData = formatter(field);
|
|
20529
|
-
break;
|
|
20530
|
-
case columnTypes.Array:
|
|
20531
|
-
case columnTypes.Object:
|
|
20532
|
-
formattedData = JSON.stringify(field);
|
|
20533
|
-
// search both JSON data and displayed value if custom formatter provided
|
|
20534
|
-
if (formatter?.name && !columnTypes[formatter.name]) {
|
|
20535
|
-
formattedData += formatter(field);
|
|
20536
|
-
}
|
|
20537
|
-
break;
|
|
20538
|
-
default:
|
|
20539
|
-
formattedData = field.toString();
|
|
20540
|
-
}
|
|
20541
|
-
return formattedData.search(new RegExp(query.trim(), "i")) > -1;
|
|
20542
|
-
} catch (_err) {
|
|
20543
|
-
return false;
|
|
20544
|
-
}
|
|
20545
|
-
};
|
|
20546
|
-
|
|
20547
|
-
/**
|
|
20548
|
-
* Utility for searching an entire row of values. For specifics of the search dynamics, please @see searchCell.
|
|
20549
|
-
*
|
|
20550
|
-
* @param {*[]} row - an array of values to search.
|
|
20551
|
-
* @param {String[]} types - an array of types for the values in the row.
|
|
20552
|
-
* @param {Function[]} formatters - an array of formatting functions for values.
|
|
20553
|
-
* @param {String} query - the search query to locate in the provided row.
|
|
20554
|
-
* @returns {Boolean} - if the query has been matched with an item in the row.
|
|
20555
|
-
*/
|
|
20556
|
-
const searchRow = (row, types, formatters, query) =>
|
|
20557
|
-
row.some((data, colInd) =>
|
|
20558
|
-
searchCell(
|
|
20559
|
-
unpackObjectRepresentation(data),
|
|
20560
|
-
types[colInd],
|
|
20561
|
-
formatters[colInd],
|
|
20562
|
-
query,
|
|
20563
|
-
),
|
|
20564
|
-
);
|
|
20565
|
-
|
|
20566
|
-
/**
|
|
20567
|
-
* Utility function designed to consume an entire data set and output only the rows which match the provided
|
|
20568
|
-
* filter state. This filtering happens on three levels:
|
|
20569
|
-
*
|
|
20570
|
-
* 1.) Time filtering- if a time filter is provided with a DateTime column, any data outside of this range
|
|
20571
|
-
* will be excluded from the returned data subset. If either parameter is omitted, then no filtering on
|
|
20572
|
-
* DateTime will be performed.
|
|
20573
|
-
* 2.) Search filtering- if a search query is provided, the data set will be checked for matching rows on a
|
|
20574
|
-
* global level- meaning any match in any column will satisfy this condition and move on for further
|
|
20575
|
-
* filtering. If this search query is omitted, all data which passed the time filter (if provided), will
|
|
20576
|
-
* continue on to column filtering.
|
|
20577
|
-
* 3.) Column filtering- if there are active column filters for the data set, each row will be checked on a
|
|
20578
|
-
* columnar basis for values matching the filter configuration for that column. This filtering is type
|
|
20579
|
-
* sensitive (defined in @see table.config.js ).
|
|
20580
|
-
*
|
|
20581
|
-
* @param {Object} filterConfig - the object mapping of the required fields for filtering the data.
|
|
20582
|
-
* @param {Object[]} filterConfig.data - the data set to process.
|
|
20583
|
-
* @param {String[]} filterConfig.columnKeys - the column keys for the row Objects of the currently displayed data.
|
|
20584
|
-
* Should only be the currently displayed columns, because users only want to filter based on the information
|
|
20585
|
-
* currently displayed.
|
|
20586
|
-
* @param {Object} filterConfig.formatters - a columnKey/function mapping for the formatting functions of the column
|
|
20587
|
-
* data. Enables filtering on the data the user is viewing, as opposed to the raw data values which may have
|
|
20588
|
-
* undergone some point-wise transformations depending on the table configuration.
|
|
20589
|
-
* @param {Object} filterConfig.types - a columnKey/type (@see table.config.js ) mapping for the columns in the data
|
|
20590
|
-
* set. Allows data-type specific filtering.
|
|
20591
|
-
* @param {String} filterConfig.timeFilter - the optional active time filter value. Possible values are the keys
|
|
20592
|
-
* found in @see time.config.js . If none is provided, no time filtering will be performed.
|
|
20593
|
-
* @param {String} filterConfig.timeFilterKey - the optional columnKey of the DateTime column which should be used
|
|
20594
|
-
* for time filtering. Require IFF a timeFilter has been provided.
|
|
20595
|
-
* @param {String} filterConfig.searchQuery - the optional global search query active for the dataset. If none is
|
|
20596
|
-
* provided, no global search or filtering will be performed.
|
|
20597
|
-
* @param {Object} filterConfig.filterValues - the columnKey/value mapping for any currently active column-specific
|
|
20598
|
-
* filters. If no filters are active, an empty Object should be provided.
|
|
20599
|
-
* @returns {Object} filteredDataConfig - contains the results of the filtering operations.
|
|
20600
|
-
* @returns {Object[]} filteredDataConfig.filteredData - the rows which passed all provided filtering operations.
|
|
20601
|
-
* @returns {Number[]} filteredDataConfig.filteredIndicies - an array of the original row indicies for the filtered
|
|
20602
|
-
* data subset. Can be used for tracking transformations of the data.
|
|
20603
|
-
*/
|
|
20604
|
-
const filter = (filterConfig) => {
|
|
20605
|
-
let {
|
|
20606
|
-
data,
|
|
20607
|
-
columnKeys,
|
|
20608
|
-
formatters,
|
|
20609
|
-
types,
|
|
20610
|
-
timeFilter,
|
|
20611
|
-
timeFilterKey,
|
|
20612
|
-
searchQuery,
|
|
20613
|
-
filterValues,
|
|
20614
|
-
} = filterConfig;
|
|
20615
|
-
let localColumnTypes = columnKeys.map((colKey) => types[colKey]);
|
|
20616
|
-
let filters = Object.entries(filterValues);
|
|
20617
|
-
let columnFormatters = Object.values(formatters);
|
|
20618
|
-
let filteredIndicies = [];
|
|
20619
|
-
let filteredData = data.filter((row, rowInd) => {
|
|
20620
|
-
if (timeFilter) {
|
|
20621
|
-
let inTimeFilter = checkTimeFilter(
|
|
20622
|
-
row[timeFilterKey],
|
|
20623
|
-
tableTimeFilters[timeFilter],
|
|
20624
|
-
);
|
|
20625
|
-
if (!inTimeFilter) {
|
|
20626
|
-
return false;
|
|
20627
|
-
}
|
|
20628
|
-
}
|
|
20629
|
-
let rowValues = columnKeys.map((colKey) => row[colKey]);
|
|
20630
|
-
let shouldSearch = searchQuery && searchQuery.length;
|
|
20631
|
-
if (
|
|
20632
|
-
shouldSearch &&
|
|
20633
|
-
!searchRow(rowValues, localColumnTypes, columnFormatters, searchQuery)
|
|
20634
|
-
) {
|
|
20635
|
-
return false;
|
|
20636
|
-
}
|
|
20637
|
-
if (filters.length === 0) {
|
|
20638
|
-
filteredIndicies.push(rowInd);
|
|
20639
|
-
return true;
|
|
20640
|
-
}
|
|
20641
|
-
let inFilter = filters.every((entry) => {
|
|
20642
|
-
let colKey = entry[0];
|
|
20643
|
-
let filterVal = entry[1];
|
|
20644
|
-
let colInd = columnKeys.indexOf(colKey);
|
|
20645
|
-
let columnType = localColumnTypes[colInd];
|
|
20646
|
-
let colFormatter = columnFormatters[colInd];
|
|
20647
|
-
let rowValue = unpackObjectRepresentation(row[colKey]);
|
|
20648
|
-
const formattedRowValue = colFormatter
|
|
20649
|
-
? colFormatter(rowValue)
|
|
20650
|
-
: rowValue;
|
|
20651
|
-
if (filterVal === null) {
|
|
20652
|
-
return rowValue === null;
|
|
20653
|
-
}
|
|
20654
|
-
if (
|
|
20655
|
-
typeof filterVal === "undefined" ||
|
|
20656
|
-
filterVal === "" ||
|
|
20657
|
-
(Array.isArray(filterVal) && filterVal.length === 0)
|
|
20658
|
-
) {
|
|
20659
|
-
return true;
|
|
20660
|
-
}
|
|
20661
|
-
if (isEmpty(rowValue)) {
|
|
20662
|
-
return false;
|
|
20663
|
-
}
|
|
20664
|
-
switch (columnType) {
|
|
20665
|
-
case columnTypes.Nominal: {
|
|
20666
|
-
return filterVal.includes(formattedRowValue);
|
|
20667
|
-
}
|
|
20668
|
-
case columnTypes.Number:
|
|
20669
|
-
case columnTypes.String:
|
|
20670
|
-
case columnTypes.DateTime:
|
|
20671
|
-
case columnTypes.Object:
|
|
20672
|
-
case columnTypes.Array:
|
|
20673
|
-
return searchCell(rowValue, columnType, colFormatter, filterVal);
|
|
20674
|
-
case columnTypes.Boolean:
|
|
20675
|
-
return filterVal.includes(
|
|
20676
|
-
colFormatter ? colFormatter(rowValue) : rowValue.toString(),
|
|
20677
|
-
);
|
|
20678
|
-
// return filterVal.includes(rowValue.toString());
|
|
20679
|
-
default:
|
|
20680
|
-
return true;
|
|
20681
|
-
}
|
|
20682
|
-
});
|
|
20683
|
-
if (inFilter) {
|
|
20684
|
-
filteredIndicies.push(rowInd);
|
|
20685
|
-
}
|
|
20686
|
-
return inFilter;
|
|
20687
|
-
});
|
|
20688
|
-
return { filteredData, filteredIndicies };
|
|
20689
|
-
};
|
|
20690
|
-
|
|
20691
|
-
const missingValueSymbol = Symbol("Missing");
|
|
20692
|
-
|
|
20693
|
-
/**
|
|
20694
|
-
* Utility function for grouping rows in the provided data based on nominal group membership. This group membership
|
|
20695
|
-
* is determined by the provided column name and key. If there is no group currently, the function will return a
|
|
20696
|
-
* formatted object mapping for the placeholder group 'None' which can then be ignored, but processed in the same
|
|
20697
|
-
* way as grouped data. For rows with a missing nominal column value, they will be mapped to the group 'Missing'
|
|
20698
|
-
* unless there is already a nominal group mapped to missing (as is sometimes the case with pre-processed data).
|
|
20699
|
-
* In this case, a fallback group will be created for 'No group'.
|
|
20700
|
-
*
|
|
20701
|
-
* This method also expects to receive an array of indicies corresponding to the rows in the master dataset. This
|
|
20702
|
-
* allows for transformation tracking during grouping to enable selection or other row-specific actions and events
|
|
20703
|
-
* on the returned grouped data.
|
|
20704
|
-
*
|
|
20705
|
-
* @param {Object} groupConfig - the configuration options to use during grouping.
|
|
20706
|
-
* @param {Object[]} groupConfig.sortedData - an array of row data as individual JSON objects in the array.
|
|
20707
|
-
* @param {String} groupConfig.groupColumn - the group-by column name (as displayed in the header).
|
|
20708
|
-
* @param {String} groupConfig.groupColumnKey - the key representation of the group-by column as found in the row
|
|
20709
|
-
* JSON objects of the sortedData.
|
|
20710
|
-
* @param {Number[]} groupConfig.filteredIndicies - the original row indicies of the data filtered/sorted/mutated in
|
|
20711
|
-
* in the same transformation as the sortedData. Used to track method transformations.
|
|
20712
|
-
* @returns {Object} groupedDataConfig - a map of group transformation information.
|
|
20713
|
-
* @returns {Object} groupedDataConfig.groupedData - an object mapping of group data and the index of the group name in
|
|
20714
|
-
* the groupTitles list.
|
|
20715
|
-
* @returns {Array[]} groupedDataConfig.groupedData.data - an array of arrays, each containing a single group of row
|
|
20716
|
-
* JSON objects.
|
|
20717
|
-
* @returns {Number} groupedDataConfig.groupedData.groupInd - the index of the group in the groupTitles list.
|
|
20718
|
-
* @returns {Array[]} groupedDataConfig.groupedIndicies - an array of arrays of numbers; the arrays representing groups
|
|
20719
|
-
* and the numbers the original indicies.
|
|
20720
|
-
* @returns {Array} groupedDataConfig.groupTitles - a list of Group names
|
|
20721
|
-
*/
|
|
20722
|
-
const group = (groupConfig) => {
|
|
20723
|
-
let { filteredData, groupColumn, groupColumnKey, filteredIndicies } =
|
|
20724
|
-
groupConfig;
|
|
20725
|
-
let returnValue = {
|
|
20726
|
-
groupedData: {},
|
|
20727
|
-
groupedIndicies: [],
|
|
20728
|
-
groupTitles: [],
|
|
20729
|
-
};
|
|
20730
|
-
if (!groupColumn || groupColumn === "None") {
|
|
20731
|
-
returnValue.groupedIndicies.push(filteredIndicies);
|
|
20732
|
-
returnValue.groupTitles.push("None");
|
|
20733
|
-
returnValue.groupedData = [
|
|
20734
|
-
{
|
|
20735
|
-
data: filteredData,
|
|
20736
|
-
groupInd: 0,
|
|
20737
|
-
},
|
|
20738
|
-
];
|
|
20739
|
-
return returnValue;
|
|
20740
|
-
}
|
|
20741
|
-
let containsMissingGroupFromString = false;
|
|
20742
|
-
returnValue.groupedData = filteredData.reduce((map, row, rowInd) => {
|
|
20743
|
-
let rowGroup = unpackObjectRepresentation(row[groupColumnKey]);
|
|
20744
|
-
if (isEmpty(rowGroup) || isMissingValue(rowGroup)) {
|
|
20745
|
-
rowGroup = missingValueSymbol;
|
|
20746
|
-
} else if (rowGroup === missingValueSymbol.description) {
|
|
20747
|
-
containsMissingGroupFromString = true;
|
|
20748
|
-
}
|
|
20749
|
-
if (typeof map[rowGroup] === "undefined") {
|
|
20750
|
-
returnValue.groupTitles.push(rowGroup);
|
|
20751
|
-
let indexTracker = returnValue.groupedIndicies.push([]);
|
|
20752
|
-
map[rowGroup] = {
|
|
20753
|
-
data: [],
|
|
20754
|
-
groupInd: indexTracker - 1,
|
|
20755
|
-
};
|
|
20756
|
-
}
|
|
20757
|
-
returnValue.groupedIndicies[map[rowGroup].groupInd].push(
|
|
20758
|
-
filteredIndicies[rowInd],
|
|
20759
|
-
);
|
|
20760
|
-
map[rowGroup].data.push(row);
|
|
20761
|
-
return map;
|
|
20762
|
-
}, {});
|
|
20763
|
-
let orderedGroups = [];
|
|
20764
|
-
returnValue.groupTitles = returnValue.groupTitles
|
|
20765
|
-
.sort((group1, group2) => {
|
|
20766
|
-
if (group1 === missingValueSymbol) {
|
|
20767
|
-
return 1;
|
|
20768
|
-
} else if (group2 === missingValueSymbol) {
|
|
20769
|
-
return -1;
|
|
20770
|
-
}
|
|
20771
|
-
return group1.toLowerCase() > group2.toLowerCase() ? 1 : -1;
|
|
20772
|
-
})
|
|
20773
|
-
.map((group) => {
|
|
20774
|
-
orderedGroups.push(returnValue.groupedData[group]);
|
|
20775
|
-
if (group === missingValueSymbol) {
|
|
20776
|
-
return containsMissingGroupFromString
|
|
20777
|
-
? "No group"
|
|
20778
|
-
: missingValueSymbol.description;
|
|
20779
|
-
}
|
|
20780
|
-
return group;
|
|
20781
|
-
});
|
|
20782
|
-
returnValue.groupedData = orderedGroups;
|
|
20783
|
-
|
|
20784
|
-
return returnValue;
|
|
20785
|
-
};
|
|
20786
|
-
|
|
20787
|
-
/**
|
|
20788
|
-
* Utility function to process grouped data into a single page of grouped data based on the current page size
|
|
20789
|
-
* and the start and end row indicies. Also creates an updated array for both paginated selection and indicies.
|
|
20790
|
-
*
|
|
20791
|
-
* @param {Object} paginationConfig - the configuration options to use during pagination.
|
|
20792
|
-
* @param {Array[]} paginationConfig.sortedData - a double-nested array containing the full set of filtered,
|
|
20793
|
-
* grouped and sorted data.
|
|
20794
|
-
* @example: [
|
|
20795
|
-
* [row1, row2,...], // group1
|
|
20796
|
-
* ...,
|
|
20797
|
-
* [rowN, rowN+1, ...], // group2
|
|
20798
|
-
* ]
|
|
20799
|
-
* @param {Array[]} paginationConfig.processedIndicies - a double-nested array containing the full set of filtered,
|
|
20800
|
-
* grouped,and sorted indicies which map to the indicies of the previously filtered, grouped and sorted row in
|
|
20801
|
-
* the original data.
|
|
20802
|
-
* @param {Array[]} paginationConfig.processedSelection - a double-nested array containing the full set of filtered,
|
|
20803
|
-
* grouped and sorted selection state.
|
|
20804
|
-
* @param {Number} paginationConfig.pageSize - the current number of items which should be shown per page.
|
|
20805
|
-
* @param {Number} paginationConfig.pageStart - the starting row index to include (zero indexed; inclusive).
|
|
20806
|
-
* @param {Number} paginationConfig.pageEnd - the row index of the first row to *exclude* from the page.
|
|
20807
|
-
* @returns {Object} paginatedResults - the results of the pagination. All values are double-nested arrays and excluded
|
|
20808
|
-
* groups will be returned as empty arrays and empty data or empty pages will be represented as empty arrays as well.
|
|
20809
|
-
* @returns {Array[]} paginatedResults.paginatedData - the paginated data to display on the page.
|
|
20810
|
-
* @returns {Array[]} paginatedResults.paginatedSelection - the paginated selection to pass to the TableUI.vue component.
|
|
20811
|
-
* @returns {Array[]} paginatedResults.paginatedIndicies - the paginated indicies to map TableUI selection events to their
|
|
20812
|
-
* original indicies.
|
|
20813
|
-
*/
|
|
20814
|
-
const paginate = (paginationConfig) => {
|
|
20815
|
-
let {
|
|
20816
|
-
sortedData,
|
|
20817
|
-
processedIndicies,
|
|
20818
|
-
processedSelection = [],
|
|
20819
|
-
pageSize,
|
|
20820
|
-
pageStart,
|
|
20821
|
-
pageEnd,
|
|
20822
|
-
} = paginationConfig;
|
|
20823
|
-
let includedRows = 0;
|
|
20824
|
-
let totalRows = 0;
|
|
20825
|
-
let paginatedSelection = [];
|
|
20826
|
-
let paginatedIndicies = [];
|
|
20827
|
-
let paginatedData = sortedData.map((dataGroup, groupInd) => {
|
|
20828
|
-
let groupCount = dataGroup.length;
|
|
20829
|
-
let groupStart = totalRows;
|
|
20830
|
-
let groupEnd = groupStart + groupCount;
|
|
20831
|
-
let remainingRows = pageSize - includedRows;
|
|
20832
|
-
let returnValue = [];
|
|
20833
|
-
let skipGroup =
|
|
20834
|
-
remainingRows <= 0 || groupEnd < pageStart || groupStart > pageEnd;
|
|
20835
|
-
let includeEntireGroup =
|
|
20836
|
-
remainingRows >= groupCount &&
|
|
20837
|
-
groupStart >= pageStart &&
|
|
20838
|
-
groupEnd <= pageEnd;
|
|
20839
|
-
if (skipGroup) {
|
|
20840
|
-
returnValue = [];
|
|
20841
|
-
paginatedSelection.push([]);
|
|
20842
|
-
paginatedIndicies.push([]);
|
|
20843
|
-
} else if (includeEntireGroup) {
|
|
20844
|
-
returnValue = dataGroup;
|
|
20845
|
-
paginatedSelection.push(processedSelection[groupInd]);
|
|
20846
|
-
paginatedIndicies.push(processedIndicies[groupInd]);
|
|
20847
|
-
} else {
|
|
20848
|
-
let groupSliceStart = 0;
|
|
20849
|
-
let groupSliceEnd = groupCount;
|
|
20850
|
-
if (groupStart < pageStart) {
|
|
20851
|
-
groupSliceStart = pageStart - groupStart;
|
|
20852
|
-
if (groupCount - groupSliceStart > remainingRows) {
|
|
20853
|
-
groupSliceEnd = groupSliceStart + remainingRows;
|
|
20854
|
-
}
|
|
20855
|
-
} else if (groupSliceStart + remainingRows < groupCount) {
|
|
20856
|
-
groupSliceEnd = groupSliceStart + remainingRows;
|
|
20857
|
-
}
|
|
20858
|
-
returnValue = dataGroup.slice(groupSliceStart, groupSliceEnd);
|
|
20859
|
-
paginatedSelection.push(
|
|
20860
|
-
processedSelection[groupInd]?.slice(groupSliceStart, groupSliceEnd),
|
|
20861
|
-
);
|
|
20862
|
-
paginatedIndicies.push(
|
|
20863
|
-
processedIndicies[groupInd].slice(groupSliceStart, groupSliceEnd),
|
|
20864
|
-
);
|
|
20865
|
-
}
|
|
20866
|
-
includedRows += returnValue.length;
|
|
20867
|
-
totalRows += groupCount;
|
|
20868
|
-
return returnValue;
|
|
20869
|
-
});
|
|
20870
|
-
return { paginatedData, paginatedSelection, paginatedIndicies };
|
|
20871
|
-
};
|
|
20872
|
-
|
|
20873
|
-
/**
|
|
20874
|
-
* Utility function for sorting a data set. This functionality sorts the entire dataset, but also performs sorts within
|
|
20875
|
-
* the grouped data. Additionally, transformations of the row order are tracked on an index level so original row order
|
|
20876
|
-
* can be tracked.
|
|
20877
|
-
*
|
|
20878
|
-
* @param {*} sortConfig - the object mapping of the required fields for sorting the data.
|
|
20879
|
-
* @param {Array[]} sortConfig.groupedData - an array of arrays, each containing a single group of row JSON objects.
|
|
20880
|
-
* @param {Array[]} sortConfig.groupedIndicies - an array of arrays of numbers; the arrays representing groups
|
|
20881
|
-
* and the numbers the original indicies.
|
|
20882
|
-
* @param {String} sortConfig.groupColumnKey - the columnKey of the column currently being used as the "group-by"
|
|
20883
|
-
* column.
|
|
20884
|
-
* @param {String[]} sortConfig.columnKeys - the column keys for the row Objects of the currently displayed data.
|
|
20885
|
-
* @param {Object} sortConfig.columnTypes - a columnKey/type (@see table.config.js ) mapping for the columns in the data
|
|
20886
|
-
* set. Allows data-type specific sorting.
|
|
20887
|
-
* @param {String} [sortConfig.sortColumn] - the optional columnKey for the column which should be used to sort the data.
|
|
20888
|
-
* If none is provided, no sorting will be performed.
|
|
20889
|
-
* @param {String} sortConfig.sortDirection - either 1 or -1 which correspond to ascending/descending respectively.
|
|
20890
|
-
* @returns {Object} sortedDataConfig - contains the results of the sorting operations.
|
|
20891
|
-
* @returns {Array[]} sortedDataConfig.sortedData - an array of arrays of row Objects. This data set will be grouped and
|
|
20892
|
-
* sorted according to the provided configuration.
|
|
20893
|
-
* @returns {Number[]} sortedDataConfig.sortedIndicies - an array of the original row indicies grouped and sorted according
|
|
20894
|
-
* to the previous grouping and the current sorting transformations which were performed.
|
|
20895
|
-
*/
|
|
20896
|
-
const sort = (sortConfig) => {
|
|
20897
|
-
let {
|
|
20898
|
-
groupedData,
|
|
20899
|
-
groupedIndicies,
|
|
20900
|
-
groupColumnKey,
|
|
20901
|
-
columnKeys,
|
|
20902
|
-
columnTypes: currentColumnTypes,
|
|
20903
|
-
sortColumn,
|
|
20904
|
-
sortDirection,
|
|
20905
|
-
} = sortConfig;
|
|
20906
|
-
|
|
20907
|
-
return groupedData
|
|
20908
|
-
.map(({ data, groupInd }) =>
|
|
20909
|
-
data
|
|
20910
|
-
.map((row, rowInd) => ({
|
|
20911
|
-
row,
|
|
20912
|
-
rowInd: groupedIndicies[groupInd][rowInd],
|
|
20913
|
-
}))
|
|
20914
|
-
.sort(({ row: row1 }, { row: row2 }) => {
|
|
20915
|
-
// only sort within groups
|
|
20916
|
-
if (
|
|
20917
|
-
sortColumn === null ||
|
|
20918
|
-
(groupColumnKey && row1[groupColumnKey] !== row2[groupColumnKey])
|
|
20919
|
-
) {
|
|
20920
|
-
return 0;
|
|
20921
|
-
}
|
|
20922
|
-
let columnKey = columnKeys[sortColumn];
|
|
20923
|
-
let columnType = currentColumnTypes[sortColumn];
|
|
20924
|
-
let rawVal1 = row1[columnKey];
|
|
20925
|
-
let rawVal2 = row2[columnKey];
|
|
20926
|
-
const val1EmptyOrMissing =
|
|
20927
|
-
isEmpty(rawVal1) || isMissingValue(rawVal1);
|
|
20928
|
-
const val2EmptyOrMissing =
|
|
20929
|
-
isEmpty(rawVal2) || isMissingValue(rawVal2);
|
|
20930
|
-
|
|
20931
|
-
if (val1EmptyOrMissing && val2EmptyOrMissing) {
|
|
20932
|
-
return 0;
|
|
20933
|
-
} else if (val1EmptyOrMissing) {
|
|
20934
|
-
return 1;
|
|
20935
|
-
} else if (val2EmptyOrMissing) {
|
|
20936
|
-
return -1;
|
|
20937
|
-
} else {
|
|
20938
|
-
let order = 0;
|
|
20939
|
-
if (
|
|
20940
|
-
columnType === columnTypes.Array &&
|
|
20941
|
-
rawVal1.length !== rawVal2.length
|
|
20942
|
-
) {
|
|
20943
|
-
order = rawVal1.length > rawVal2.length ? 1 : -1;
|
|
20944
|
-
} else {
|
|
20945
|
-
let val1comparison = JSON.stringify(row1[columnKey]);
|
|
20946
|
-
let val2comparison = JSON.stringify(row2[columnKey]);
|
|
20947
|
-
if (val1comparison !== val2comparison) {
|
|
20948
|
-
order = val1comparison > val2comparison ? 1 : -1;
|
|
20949
|
-
}
|
|
20950
|
-
}
|
|
20951
|
-
return order * sortDirection;
|
|
20952
|
-
}
|
|
20953
|
-
})
|
|
20954
|
-
.reduce(
|
|
20955
|
-
(acc, mapItem) => {
|
|
20956
|
-
acc.data.push(mapItem.row);
|
|
20957
|
-
acc.indicies.push(mapItem.rowInd);
|
|
20958
|
-
return acc;
|
|
20959
|
-
},
|
|
20960
|
-
{ data: [], indicies: [] },
|
|
20961
|
-
),
|
|
20962
|
-
)
|
|
20963
|
-
.reduce(
|
|
20964
|
-
(acc, { data, indicies }) => {
|
|
20965
|
-
acc.sortedData.push(data);
|
|
20966
|
-
acc.sortedIndicies.push(indicies);
|
|
20967
|
-
return acc;
|
|
20968
|
-
},
|
|
20969
|
-
{ sortedData: [], sortedIndicies: [] },
|
|
20970
|
-
);
|
|
20971
|
-
};
|
|
20327
|
+
const TableUIWithAutoSizeCalculation = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-38696592"]]);
|
|
20972
20328
|
|
|
20973
|
-
export { TableActionBar, TableUI, TableUIWithAutoSizeCalculation,
|
|
20329
|
+
export { TableActionBar, TableUI, TableUIWithAutoSizeCalculation, columnFilterConfigs, columnSortText, columnTypes, constants, defaultPageSize, filterComponents, getMissingValueMessage, isMissingValue, tablePageSizes, unpackObjectRepresentation };
|
|
20974
20330
|
//# sourceMappingURL=index.js.map
|