@knime/kds-table 0.2.1 → 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 +21 -0
- package/dist/index.css +283 -288
- package/dist/index.js +1112 -1530
- package/dist/index.js.map +1 -1
- package/dist/src/components/TableCore.vue.d.ts +7 -3
- package/dist/src/components/TableCore.vue.d.ts.map +1 -1
- package/dist/src/components/TableCoreVirtual.vue.d.ts +2 -1
- package/dist/src/components/TableCoreVirtual.vue.d.ts.map +1 -1
- package/dist/src/components/TableUI.vue.d.ts +1093 -1625
- package/dist/src/components/TableUI.vue.d.ts.map +1 -1
- package/dist/src/components/TableUIWithAutoSizeCalculation.vue.d.ts +2087 -8085
- 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/useCommonScrollContainerProps.d.ts +7 -0
- package/dist/src/components/composables/useCommonScrollContainerProps.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/composables/useResizeScrollSpacer.d.ts +23 -0
- package/dist/src/components/composables/useResizeScrollSpacer.d.ts.map +1 -0
- 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 -405
- 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/layout/useAutoScrollOnRightEdge.d.ts +24 -0
- package/dist/src/components/layout/useAutoScrollOnRightEdge.d.ts.map +1 -0
- 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 +4 -3
- 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
|
-
import { computed, unref, watch, ref, isRef, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, inject, provide, defineComponent, openBlock, createElementBlock, withModifiers, renderSlot, toValue,
|
|
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
|
|
@@ -742,6 +638,67 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
742
638
|
};
|
|
743
639
|
}
|
|
744
640
|
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region useRafFn/index.ts
|
|
643
|
+
/**
|
|
644
|
+
* Call function on every `requestAnimationFrame`. With controls of pausing and resuming.
|
|
645
|
+
*
|
|
646
|
+
* @see https://vueuse.org/useRafFn
|
|
647
|
+
* @param fn
|
|
648
|
+
* @param options
|
|
649
|
+
*/
|
|
650
|
+
function useRafFn(fn, options = {}) {
|
|
651
|
+
const { immediate = true, fpsLimit = null, window: window$1 = defaultWindow, once = false } = options;
|
|
652
|
+
const isActive = shallowRef(false);
|
|
653
|
+
const intervalLimit = computed(() => {
|
|
654
|
+
const limit = toValue(fpsLimit);
|
|
655
|
+
return limit ? 1e3 / limit : null;
|
|
656
|
+
});
|
|
657
|
+
let previousFrameTimestamp = 0;
|
|
658
|
+
let rafId = null;
|
|
659
|
+
function loop(timestamp$1) {
|
|
660
|
+
if (!isActive.value || !window$1) return;
|
|
661
|
+
if (!previousFrameTimestamp) previousFrameTimestamp = timestamp$1;
|
|
662
|
+
const delta = timestamp$1 - previousFrameTimestamp;
|
|
663
|
+
if (intervalLimit.value && delta < intervalLimit.value) {
|
|
664
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
previousFrameTimestamp = timestamp$1;
|
|
668
|
+
fn({
|
|
669
|
+
delta,
|
|
670
|
+
timestamp: timestamp$1
|
|
671
|
+
});
|
|
672
|
+
if (once) {
|
|
673
|
+
isActive.value = false;
|
|
674
|
+
rafId = null;
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
678
|
+
}
|
|
679
|
+
function resume() {
|
|
680
|
+
if (!isActive.value && window$1) {
|
|
681
|
+
isActive.value = true;
|
|
682
|
+
previousFrameTimestamp = 0;
|
|
683
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function pause() {
|
|
687
|
+
isActive.value = false;
|
|
688
|
+
if (rafId != null && window$1) {
|
|
689
|
+
window$1.cancelAnimationFrame(rafId);
|
|
690
|
+
rafId = null;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (immediate) resume();
|
|
694
|
+
tryOnScopeDispose(pause);
|
|
695
|
+
return {
|
|
696
|
+
isActive: readonly(isActive),
|
|
697
|
+
pause,
|
|
698
|
+
resume
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
|
|
745
702
|
//#endregion
|
|
746
703
|
//#region useResizeObserver/index.ts
|
|
747
704
|
/**
|
|
@@ -1692,7 +1649,7 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
|
|
|
1692
1649
|
}
|
|
1693
1650
|
});
|
|
1694
1651
|
|
|
1695
|
-
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__scopeId", "data-v-
|
|
1652
|
+
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__scopeId", "data-v-24ade73a"]]);
|
|
1696
1653
|
|
|
1697
1654
|
const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
1698
1655
|
__name: "KdsButton",
|
|
@@ -2767,7 +2724,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
2767
2724
|
}
|
|
2768
2725
|
});
|
|
2769
2726
|
|
|
2770
|
-
const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__scopeId", "data-v-
|
|
2727
|
+
const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__scopeId", "data-v-3354d162"]]);
|
|
2771
2728
|
|
|
2772
2729
|
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
2773
2730
|
...{
|
|
@@ -8180,7 +8137,7 @@ function applyDefaultFilter(v) {
|
|
|
8180
8137
|
return name + "(" + defaultValue + unit + ")";
|
|
8181
8138
|
}
|
|
8182
8139
|
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
|
|
8183
|
-
const filter
|
|
8140
|
+
const filter = {
|
|
8184
8141
|
...complex,
|
|
8185
8142
|
getAnimatableNone: (v) => {
|
|
8186
8143
|
const functions = v.match(functionRegex);
|
|
@@ -8310,8 +8267,8 @@ const defaultValueTypes = {
|
|
|
8310
8267
|
borderRightColor: color,
|
|
8311
8268
|
borderBottomColor: color,
|
|
8312
8269
|
borderLeftColor: color,
|
|
8313
|
-
filter
|
|
8314
|
-
WebkitFilter: filter
|
|
8270
|
+
filter,
|
|
8271
|
+
WebkitFilter: filter,
|
|
8315
8272
|
mask,
|
|
8316
8273
|
WebkitMask: mask,
|
|
8317
8274
|
};
|
|
@@ -8320,7 +8277,7 @@ const defaultValueTypes = {
|
|
|
8320
8277
|
*/
|
|
8321
8278
|
const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
8322
8279
|
|
|
8323
|
-
const customTypes = /*@__PURE__*/ new Set([filter
|
|
8280
|
+
const customTypes = /*@__PURE__*/ new Set([filter, mask]);
|
|
8324
8281
|
function getAnimatableNone(key, value) {
|
|
8325
8282
|
let defaultValueType = getDefaultValueType(key);
|
|
8326
8283
|
if (!customTypes.has(defaultValueType))
|
|
@@ -10438,7 +10395,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
10438
10395
|
}
|
|
10439
10396
|
});
|
|
10440
10397
|
|
|
10441
|
-
const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-
|
|
10398
|
+
const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-0bec87ad"]]);
|
|
10442
10399
|
|
|
10443
10400
|
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
10444
10401
|
__name: "KdsCheckbox",
|
|
@@ -14689,7 +14646,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
14689
14646
|
}
|
|
14690
14647
|
});
|
|
14691
14648
|
|
|
14692
|
-
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-
|
|
14649
|
+
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-0a6ce241"]]);
|
|
14693
14650
|
|
|
14694
14651
|
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
14695
14652
|
__name: "KdsDropdown",
|
|
@@ -15367,24 +15324,24 @@ const useIndicesAndStylesFor = (data) => {
|
|
|
15367
15324
|
};
|
|
15368
15325
|
};
|
|
15369
15326
|
|
|
15370
|
-
const _hoisted_1$
|
|
15327
|
+
const _hoisted_1$d = {
|
|
15371
15328
|
key: 0,
|
|
15372
15329
|
class: "deletion-cell-spacer"
|
|
15373
15330
|
};
|
|
15374
|
-
const _sfc_main$
|
|
15331
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
15375
15332
|
__name: "EmptyRow",
|
|
15376
15333
|
props: {
|
|
15377
15334
|
width: {},
|
|
15378
15335
|
height: {},
|
|
15379
15336
|
compact: { type: Boolean },
|
|
15380
|
-
|
|
15337
|
+
colSizes: {},
|
|
15381
15338
|
specialColumnSizes: {},
|
|
15382
15339
|
tableConfig: {}
|
|
15383
15340
|
},
|
|
15384
15341
|
setup(__props) {
|
|
15385
15342
|
const props = __props;
|
|
15386
15343
|
const { indexedData: indexedRow, style: rowStyles } = useIndicesAndStylesFor(
|
|
15387
|
-
toRef(props, "
|
|
15344
|
+
toRef(props, "colSizes")
|
|
15388
15345
|
);
|
|
15389
15346
|
const paddingTopBottom = computed(
|
|
15390
15347
|
() => props.compact ? COMPACT_ROW_PADDING_TOP_BOTTOM : DEFAULT_ROW_PADDING_TOP_BOTTOM
|
|
@@ -15397,7 +15354,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
15397
15354
|
height: `${__props.height}px`
|
|
15398
15355
|
})
|
|
15399
15356
|
}, [
|
|
15400
|
-
__props.tableConfig.enableRowDeletion ? (openBlock(), createElementBlock("td", _hoisted_1$
|
|
15357
|
+
__props.tableConfig.enableRowDeletion ? (openBlock(), createElementBlock("td", _hoisted_1$d)) : createCommentVNode("", true),
|
|
15401
15358
|
__props.tableConfig.showSelection ? (openBlock(), createElementBlock("td", {
|
|
15402
15359
|
key: 1,
|
|
15403
15360
|
class: "select-cell",
|
|
@@ -15431,9 +15388,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
15431
15388
|
}
|
|
15432
15389
|
});
|
|
15433
15390
|
|
|
15434
|
-
const EmptyRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15391
|
+
const EmptyRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__scopeId", "data-v-640baae1"]]);
|
|
15435
15392
|
|
|
15436
|
-
const _sfc_main$
|
|
15393
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
15437
15394
|
__name: "PlaceholderRow",
|
|
15438
15395
|
props: {
|
|
15439
15396
|
height: {}
|
|
@@ -15450,16 +15407,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
15450
15407
|
}
|
|
15451
15408
|
});
|
|
15452
15409
|
|
|
15453
|
-
const PlaceholderRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15410
|
+
const PlaceholderRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__scopeId", "data-v-df158652"]]);
|
|
15454
15411
|
|
|
15455
|
-
const _sfc_main$
|
|
15412
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
15456
15413
|
__name: "VirtualRow",
|
|
15457
15414
|
props: {
|
|
15458
15415
|
dataItem: {},
|
|
15459
15416
|
rowHeight: {},
|
|
15460
15417
|
compact: { type: Boolean },
|
|
15461
15418
|
bodyWidth: {},
|
|
15462
|
-
|
|
15419
|
+
colSizes: {},
|
|
15463
15420
|
specialColumnSizes: {},
|
|
15464
15421
|
tableConfig: {}
|
|
15465
15422
|
},
|
|
@@ -15478,10 +15435,10 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
15478
15435
|
height: __props.rowHeight,
|
|
15479
15436
|
compact: __props.compact,
|
|
15480
15437
|
width: __props.bodyWidth,
|
|
15481
|
-
"
|
|
15438
|
+
"col-sizes": __props.colSizes,
|
|
15482
15439
|
"special-column-sizes": __props.specialColumnSizes,
|
|
15483
15440
|
"table-config": __props.tableConfig
|
|
15484
|
-
}, null, 8, ["height", "compact", "width", "
|
|
15441
|
+
}, null, 8, ["height", "compact", "width", "col-sizes", "special-column-sizes", "table-config"]));
|
|
15485
15442
|
};
|
|
15486
15443
|
}
|
|
15487
15444
|
});
|
|
@@ -15544,26 +15501,79 @@ const provideCommonScrollContainerProps = (containerRef, params) => {
|
|
|
15544
15501
|
provideForCloseSubMenusOnScroll();
|
|
15545
15502
|
provide(injectionKey, containerRef);
|
|
15546
15503
|
};
|
|
15504
|
+
const useScrollContainer = () => inject(injectionKey, ref(null));
|
|
15547
15505
|
const useCommonScrollContainerProps = () => {
|
|
15548
15506
|
const closeExpandedSubMenu = injectCloseExpandedSubMenu();
|
|
15549
15507
|
const overflowStyles = useOverflowStyles();
|
|
15550
|
-
const containerRef = inject(injectionKey);
|
|
15551
15508
|
return {
|
|
15552
15509
|
overflowStyles,
|
|
15553
15510
|
closeExpandedSubMenu,
|
|
15554
|
-
containerRef
|
|
15511
|
+
containerRef: useScrollContainer()
|
|
15555
15512
|
};
|
|
15556
15513
|
};
|
|
15557
15514
|
|
|
15558
|
-
const
|
|
15515
|
+
const useResizeScrollSpacer = ({
|
|
15516
|
+
columnResizeActive,
|
|
15517
|
+
currentBodyWidth,
|
|
15518
|
+
scrollContainer
|
|
15519
|
+
}) => {
|
|
15520
|
+
const showResizeScrollSpacer = ref(false);
|
|
15521
|
+
const collapseResizeScrollSpacer = ref(false);
|
|
15522
|
+
const additionalSpacerWidth = ref("0px");
|
|
15523
|
+
const getVisibleWidthBeyondBody = () => {
|
|
15524
|
+
const container = scrollContainer.value;
|
|
15525
|
+
if (container === null) {
|
|
15526
|
+
return 0;
|
|
15527
|
+
}
|
|
15528
|
+
return Math.max(
|
|
15529
|
+
0,
|
|
15530
|
+
container.scrollLeft + container.clientWidth - currentBodyWidth.value
|
|
15531
|
+
);
|
|
15532
|
+
};
|
|
15533
|
+
watch(columnResizeActive, (active) => {
|
|
15534
|
+
if (active) {
|
|
15535
|
+
collapseResizeScrollSpacer.value = false;
|
|
15536
|
+
showResizeScrollSpacer.value = true;
|
|
15537
|
+
additionalSpacerWidth.value = "100vw";
|
|
15538
|
+
} else if (showResizeScrollSpacer.value) {
|
|
15539
|
+
const visibleWidthBeyondBody = getVisibleWidthBeyondBody();
|
|
15540
|
+
if (visibleWidthBeyondBody > 0) {
|
|
15541
|
+
additionalSpacerWidth.value = `${visibleWidthBeyondBody}px`;
|
|
15542
|
+
nextTick(() => {
|
|
15543
|
+
scrollContainer.value?.offsetWidth;
|
|
15544
|
+
additionalSpacerWidth.value = "0px";
|
|
15545
|
+
collapseResizeScrollSpacer.value = true;
|
|
15546
|
+
});
|
|
15547
|
+
} else {
|
|
15548
|
+
showResizeScrollSpacer.value = false;
|
|
15549
|
+
additionalSpacerWidth.value = "0px";
|
|
15550
|
+
}
|
|
15551
|
+
}
|
|
15552
|
+
});
|
|
15553
|
+
const onResizeScrollSpacerTransitionEnd = () => {
|
|
15554
|
+
if (collapseResizeScrollSpacer.value) {
|
|
15555
|
+
showResizeScrollSpacer.value = false;
|
|
15556
|
+
collapseResizeScrollSpacer.value = false;
|
|
15557
|
+
}
|
|
15558
|
+
};
|
|
15559
|
+
return {
|
|
15560
|
+
showResizeScrollSpacer,
|
|
15561
|
+
collapseResizeScrollSpacer,
|
|
15562
|
+
additionalSpacerWidth,
|
|
15563
|
+
onResizeScrollSpacerTransitionEnd
|
|
15564
|
+
};
|
|
15565
|
+
};
|
|
15566
|
+
|
|
15567
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
15559
15568
|
__name: "TableCoreVirtual",
|
|
15560
15569
|
props: {
|
|
15561
15570
|
scrollData: {},
|
|
15562
15571
|
scrollConfig: {},
|
|
15563
|
-
|
|
15572
|
+
colSizes: {},
|
|
15564
15573
|
specialColumnSizes: {},
|
|
15565
15574
|
currentBodyWidth: {},
|
|
15566
|
-
tableConfig: {}
|
|
15575
|
+
tableConfig: {},
|
|
15576
|
+
columnResizeActive: { type: Boolean }
|
|
15567
15577
|
},
|
|
15568
15578
|
emits: ["scrollerUpdate", "moveSelection", "clearSelection", "expandSelectedCell", "startEditing", "bodyFocusin", "bodyFocusout"],
|
|
15569
15579
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15583,7 +15593,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15583
15593
|
sizeManager
|
|
15584
15594
|
);
|
|
15585
15595
|
const columnSizeManager = withLeftSideSize(
|
|
15586
|
-
withRightSideSize(new Z$1(toRef(props, "
|
|
15596
|
+
withRightSideSize(new Z$1(toRef(props, "colSizes")))
|
|
15587
15597
|
);
|
|
15588
15598
|
const numRows = computed(
|
|
15589
15599
|
() => props.scrollData.length + props.scrollConfig.numRowsAbove + props.scrollConfig.numRowsBelow
|
|
@@ -15641,6 +15651,16 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15641
15651
|
containerRef: injectedContainerRef,
|
|
15642
15652
|
overflowStyles
|
|
15643
15653
|
} = useCommonScrollContainerProps();
|
|
15654
|
+
const {
|
|
15655
|
+
showResizeScrollSpacer,
|
|
15656
|
+
collapseResizeScrollSpacer,
|
|
15657
|
+
additionalSpacerWidth,
|
|
15658
|
+
onResizeScrollSpacerTransitionEnd
|
|
15659
|
+
} = useResizeScrollSpacer({
|
|
15660
|
+
columnResizeActive: toRef(props, "columnResizeActive"),
|
|
15661
|
+
currentBodyWidth: toRef(props, "currentBodyWidth"),
|
|
15662
|
+
scrollContainer: containerProps.ref
|
|
15663
|
+
});
|
|
15644
15664
|
__expose({
|
|
15645
15665
|
scrollToPosition: ({ top, left }) => {
|
|
15646
15666
|
if (top !== void 0) {
|
|
@@ -15663,7 +15683,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15663
15683
|
},
|
|
15664
15684
|
style: normalizeStyle(unref(overflowStyles)),
|
|
15665
15685
|
class: normalizeClass(["container", { "fit-content": __props.tableConfig.forceRenderAll }]),
|
|
15666
|
-
onScroll: _cache[
|
|
15686
|
+
onScroll: _cache[7] || (_cache[7] = () => [unref(containerProps).onScroll(), unref(closeExpandedSubMenu)()])
|
|
15667
15687
|
}, [
|
|
15668
15688
|
createElementVNode("div", {
|
|
15669
15689
|
ref_key: "headerContainer",
|
|
@@ -15686,13 +15706,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15686
15706
|
style: normalizeStyle(__props.tableConfig.forceRenderAll ? {} : unref(verticalStyles))
|
|
15687
15707
|
}, [
|
|
15688
15708
|
(openBlock(true), createElementBlock(Fragment, null, renderList(renderedRowIndices.value, (rowInd) => {
|
|
15689
|
-
return openBlock(), createBlock(_sfc_main$
|
|
15709
|
+
return openBlock(), createBlock(_sfc_main$k, {
|
|
15690
15710
|
key: rowInd,
|
|
15691
15711
|
"row-height": __props.scrollConfig.itemSize,
|
|
15692
15712
|
compact: __props.scrollConfig.compact,
|
|
15693
15713
|
"body-width": __props.currentBodyWidth,
|
|
15694
15714
|
"data-item": __props.scrollData[rowInd - __props.scrollConfig.numRowsAbove],
|
|
15695
|
-
"
|
|
15715
|
+
"col-sizes": __props.colSizes,
|
|
15696
15716
|
"special-column-sizes": __props.specialColumnSizes,
|
|
15697
15717
|
"table-config": __props.tableConfig
|
|
15698
15718
|
}, {
|
|
@@ -15703,7 +15723,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15703
15723
|
}, void 0, true)
|
|
15704
15724
|
]),
|
|
15705
15725
|
_: 2
|
|
15706
|
-
}, 1032, ["row-height", "compact", "body-width", "data-item", "
|
|
15726
|
+
}, 1032, ["row-height", "compact", "body-width", "data-item", "col-sizes", "special-column-sizes", "table-config"]);
|
|
15707
15727
|
}), 128))
|
|
15708
15728
|
], 4)
|
|
15709
15729
|
]),
|
|
@@ -15711,13 +15731,26 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15711
15731
|
renderSlot(_ctx.$slots, "belowBody", {}, void 0, true)
|
|
15712
15732
|
]),
|
|
15713
15733
|
_: 3
|
|
15714
|
-
})
|
|
15734
|
+
}),
|
|
15735
|
+
unref(showResizeScrollSpacer) ? (openBlock(), createElementBlock("div", {
|
|
15736
|
+
key: 0,
|
|
15737
|
+
class: normalizeClass([
|
|
15738
|
+
"resize-scroll-spacer",
|
|
15739
|
+
{ collapsing: unref(collapseResizeScrollSpacer) }
|
|
15740
|
+
]),
|
|
15741
|
+
"aria-hidden": "true",
|
|
15742
|
+
style: normalizeStyle({
|
|
15743
|
+
width: `calc(${__props.currentBodyWidth}px + ${unref(additionalSpacerWidth)})`
|
|
15744
|
+
}),
|
|
15745
|
+
onTransitionend: _cache[6] || (_cache[6] = //@ts-ignore
|
|
15746
|
+
(...args) => unref(onResizeScrollSpacerTransitionEnd) && unref(onResizeScrollSpacerTransitionEnd)(...args))
|
|
15747
|
+
}, null, 38)) : createCommentVNode("", true)
|
|
15715
15748
|
], 38)) : createCommentVNode("", true);
|
|
15716
15749
|
};
|
|
15717
15750
|
}
|
|
15718
15751
|
});
|
|
15719
15752
|
|
|
15720
|
-
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
15753
|
+
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-a66c9aef"]]);
|
|
15721
15754
|
|
|
15722
15755
|
function getDefaultExportFromCjs (x) {
|
|
15723
15756
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -15873,14 +15906,15 @@ const useAvailableWidth = ({
|
|
|
15873
15906
|
return { innerWidthToBodyWidth, fitsInsideTotalWidth };
|
|
15874
15907
|
};
|
|
15875
15908
|
|
|
15876
|
-
const _sfc_main$
|
|
15909
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
15877
15910
|
__name: "TableCore",
|
|
15878
15911
|
props: {
|
|
15879
15912
|
scrollData: {},
|
|
15880
15913
|
scrollConfig: {},
|
|
15881
15914
|
tableConfig: {},
|
|
15915
|
+
subMenuConfig: {},
|
|
15882
15916
|
totalWidth: {},
|
|
15883
|
-
|
|
15917
|
+
colSizes: {},
|
|
15884
15918
|
currentRowHeight: {},
|
|
15885
15919
|
columnResize: {},
|
|
15886
15920
|
newColumnButtonWidth: {}
|
|
@@ -15905,7 +15939,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15905
15939
|
() => props.tableConfig.enableRowDeletion ? SPECIAL_COLUMNS_SIZE : 0
|
|
15906
15940
|
);
|
|
15907
15941
|
const rightSideSize = computed(() => {
|
|
15908
|
-
const rowSubMenuSpace = (props.
|
|
15942
|
+
const rowSubMenuSpace = (props.subMenuConfig.subMenuItems ?? []).length > 0 || props.subMenuConfig.reserveSpaceForSubMenu === "always" ? SPECIAL_COLUMNS_SIZE : 0;
|
|
15909
15943
|
return rowSubMenuSpace + props.newColumnButtonWidth;
|
|
15910
15944
|
});
|
|
15911
15945
|
const scrolledElement = ref(null);
|
|
@@ -15918,7 +15952,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15918
15952
|
totalWidth: toRef(props, "totalWidth")
|
|
15919
15953
|
});
|
|
15920
15954
|
const currentBodyWidth = computed(() => {
|
|
15921
|
-
const widthContentColumns = props.
|
|
15955
|
+
const widthContentColumns = props.colSizes.reduce(
|
|
15922
15956
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15923
15957
|
(prev, curr) => prev + curr,
|
|
15924
15958
|
0
|
|
@@ -15937,7 +15971,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15937
15971
|
ref_key: "tableCoreVirtual",
|
|
15938
15972
|
ref: tableCoreVirtual,
|
|
15939
15973
|
"scroll-data": __props.scrollData[0],
|
|
15940
|
-
"
|
|
15974
|
+
"col-sizes": __props.colSizes,
|
|
15941
15975
|
"scroll-config": __props.scrollConfig,
|
|
15942
15976
|
"special-column-sizes": {
|
|
15943
15977
|
selectionSize: selectionSize.value,
|
|
@@ -15946,6 +15980,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15946
15980
|
},
|
|
15947
15981
|
"current-body-width": currentBodyWidth.value,
|
|
15948
15982
|
"table-config": __props.tableConfig,
|
|
15983
|
+
"column-resize-active": __props.columnResize.active,
|
|
15949
15984
|
onScrollerUpdate: _cache[0] || (_cache[0] = (startIndex, endIndex) => emit("scrollerUpdate", startIndex, endIndex)),
|
|
15950
15985
|
onMoveSelection: _cache[1] || (_cache[1] = (...args) => emit("moveSelection", ...args)),
|
|
15951
15986
|
onClearSelection: _cache[2] || (_cache[2] = ($event) => emit("clearSelection")),
|
|
@@ -15972,7 +16007,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15972
16007
|
renderSlot(_ctx.$slots, "belowBody")
|
|
15973
16008
|
]),
|
|
15974
16009
|
_: 3
|
|
15975
|
-
}, 8, ["scroll-data", "
|
|
16010
|
+
}, 8, ["scroll-data", "col-sizes", "scroll-config", "special-column-sizes", "current-body-width", "table-config", "column-resize-active"]);
|
|
15976
16011
|
};
|
|
15977
16012
|
}
|
|
15978
16013
|
});
|
|
@@ -16227,126 +16262,14 @@ const createEditingCellKeydownHandler = ({
|
|
|
16227
16262
|
};
|
|
16228
16263
|
};
|
|
16229
16264
|
|
|
16230
|
-
const
|
|
16231
|
-
if (is === "ControlMultiselect") {
|
|
16232
|
-
return [];
|
|
16233
|
-
}
|
|
16234
|
-
return "";
|
|
16235
|
-
};
|
|
16236
|
-
const missingValueFor = (is) => {
|
|
16237
|
-
if (is === "ControlMultiselect") {
|
|
16238
|
-
return [null];
|
|
16239
|
-
}
|
|
16240
|
-
return null;
|
|
16241
|
-
};
|
|
16242
|
-
const isMissingMode = (config) => {
|
|
16243
|
-
if (config.is === "ControlMultiselect") {
|
|
16244
|
-
return Array.isArray(config.modelValue) && config.modelValue.length === 1 && config.modelValue[0] === null;
|
|
16245
|
-
}
|
|
16246
|
-
return config.modelValue === null;
|
|
16247
|
-
};
|
|
16248
|
-
const isActive = (config) => {
|
|
16249
|
-
if (!config) {
|
|
16250
|
-
return false;
|
|
16251
|
-
}
|
|
16252
|
-
if (isMissingMode(config)) {
|
|
16253
|
-
return true;
|
|
16254
|
-
}
|
|
16255
|
-
if (config.is === "ControlMultiselect") {
|
|
16256
|
-
return Array.isArray(config.modelValue) && config.modelValue.length > 0;
|
|
16257
|
-
}
|
|
16258
|
-
return config.modelValue !== void 0 && config.modelValue !== "";
|
|
16259
|
-
};
|
|
16260
|
-
|
|
16261
|
-
const useHeaderMenuItems = ({
|
|
16262
|
-
enableSorting,
|
|
16263
|
-
enableFiltering,
|
|
16264
|
-
filterConfig,
|
|
16265
|
-
sortDirection,
|
|
16266
|
-
headerSubMenuItems,
|
|
16267
|
-
sortTexts,
|
|
16268
|
-
onColumnSort,
|
|
16269
|
-
openFilterControl,
|
|
16270
|
-
clearFilter
|
|
16271
|
-
}) => {
|
|
16272
|
-
const staticItems = [];
|
|
16273
|
-
const hasDynamicItems = Boolean(headerSubMenuItems?.length);
|
|
16274
|
-
const showFilterItem = enableFiltering && filterConfig !== void 0;
|
|
16275
|
-
const filterIsActive = showFilterItem && isActive(filterConfig);
|
|
16276
|
-
if (enableSorting) {
|
|
16277
|
-
staticItems.push({
|
|
16278
|
-
id: "table-header-sort",
|
|
16279
|
-
text: "Sort this column",
|
|
16280
|
-
separator: !showFilterItem && hasDynamicItems,
|
|
16281
|
-
sectionHeadline: true,
|
|
16282
|
-
sectionHeadlineIcon: "sort-ascending"
|
|
16283
|
-
});
|
|
16284
|
-
staticItems.push({
|
|
16285
|
-
id: "sort-asc",
|
|
16286
|
-
text: sortTexts.ascending,
|
|
16287
|
-
handler: (_item, _event) => {
|
|
16288
|
-
onColumnSort(1);
|
|
16289
|
-
},
|
|
16290
|
-
trailingIcon: sortDirection === 1 ? "checkmark" : void 0
|
|
16291
|
-
});
|
|
16292
|
-
staticItems.push({
|
|
16293
|
-
id: "sort-desc",
|
|
16294
|
-
text: sortTexts.descending,
|
|
16295
|
-
handler: (_item, _event) => {
|
|
16296
|
-
onColumnSort(-1);
|
|
16297
|
-
},
|
|
16298
|
-
trailingIcon: sortDirection === -1 ? "checkmark" : void 0
|
|
16299
|
-
});
|
|
16300
|
-
staticItems.push({
|
|
16301
|
-
id: "sort-none",
|
|
16302
|
-
text: "No sorting",
|
|
16303
|
-
handler: (_item, _event) => {
|
|
16304
|
-
onColumnSort(0);
|
|
16305
|
-
},
|
|
16306
|
-
trailingIcon: sortDirection === 0 ? "checkmark" : void 0
|
|
16307
|
-
});
|
|
16308
|
-
}
|
|
16309
|
-
if (showFilterItem) {
|
|
16310
|
-
if (filterIsActive) {
|
|
16311
|
-
staticItems.push({
|
|
16312
|
-
id: "table-header-clear-filter",
|
|
16313
|
-
text: "Clear filter",
|
|
16314
|
-
separator: hasDynamicItems,
|
|
16315
|
-
accessory: {
|
|
16316
|
-
type: "icon",
|
|
16317
|
-
name: "filter"
|
|
16318
|
-
},
|
|
16319
|
-
handler: (_item, _event) => {
|
|
16320
|
-
clearFilter();
|
|
16321
|
-
}
|
|
16322
|
-
});
|
|
16323
|
-
} else {
|
|
16324
|
-
staticItems.push({
|
|
16325
|
-
id: "table-header-filter",
|
|
16326
|
-
text: "Filter by this column",
|
|
16327
|
-
separator: hasDynamicItems,
|
|
16328
|
-
accessory: {
|
|
16329
|
-
type: "icon",
|
|
16330
|
-
name: "filter"
|
|
16331
|
-
},
|
|
16332
|
-
handler: (_item, _event) => {
|
|
16333
|
-
openFilterControl();
|
|
16334
|
-
}
|
|
16335
|
-
});
|
|
16336
|
-
}
|
|
16337
|
-
}
|
|
16338
|
-
const menuItems = [...staticItems, ...headerSubMenuItems ?? []];
|
|
16339
|
-
return menuItems.length ? menuItems : void 0;
|
|
16340
|
-
};
|
|
16341
|
-
|
|
16342
|
-
const _hoisted_1$b = {
|
|
16265
|
+
const _hoisted_1$c = {
|
|
16343
16266
|
key: 0,
|
|
16344
16267
|
class: "page-navigation"
|
|
16345
16268
|
};
|
|
16346
16269
|
const _hoisted_2$8 = { class: "navigation-buttons" };
|
|
16347
16270
|
const _hoisted_3$5 = { class: "page-count" };
|
|
16348
16271
|
const _hoisted_4$3 = { class: "navigation-buttons" };
|
|
16349
|
-
const _sfc_main$
|
|
16272
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
16350
16273
|
__name: "PageNavigation",
|
|
16351
16274
|
props: {
|
|
16352
16275
|
currentItems: { default: 0 },
|
|
@@ -16369,7 +16292,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
16369
16292
|
emit("pageChange", newPageNumber);
|
|
16370
16293
|
};
|
|
16371
16294
|
return (_ctx, _cache) => {
|
|
16372
|
-
return hasNextPage.value || hasPreviousPage.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16295
|
+
return hasNextPage.value || hasPreviousPage.value ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
16373
16296
|
createElementVNode("div", _hoisted_2$8, [
|
|
16374
16297
|
createVNode(unref(_sfc_main$1s), {
|
|
16375
16298
|
variant: "transparent",
|
|
@@ -16412,9 +16335,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
16412
16335
|
}
|
|
16413
16336
|
});
|
|
16414
16337
|
|
|
16415
|
-
const PageNavigation = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16338
|
+
const PageNavigation = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-f8714af0"]]);
|
|
16416
16339
|
|
|
16417
|
-
const _hoisted_1$
|
|
16340
|
+
const _hoisted_1$b = {
|
|
16418
16341
|
key: 0,
|
|
16419
16342
|
class: "subtle"
|
|
16420
16343
|
};
|
|
@@ -16428,7 +16351,7 @@ const _hoisted_4$2 = {
|
|
|
16428
16351
|
class: "muted"
|
|
16429
16352
|
};
|
|
16430
16353
|
const _hoisted_5$1 = { class: "subtle" };
|
|
16431
|
-
const _sfc_main$
|
|
16354
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
16432
16355
|
__name: "PageRowRange",
|
|
16433
16356
|
props: {
|
|
16434
16357
|
currentItems: { default: 0 },
|
|
@@ -16450,7 +16373,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
16450
16373
|
() => hasMultiplePages.value && __props.currentItems ? `of ${__props.currentItems}` : __props.currentItems
|
|
16451
16374
|
);
|
|
16452
16375
|
return (_ctx, _cache) => {
|
|
16453
|
-
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, [
|
|
16454
16377
|
createElementVNode("span", _hoisted_3$4, toDisplayString(__props.rowLabel) + ":", 1),
|
|
16455
16378
|
hasMultiplePages.value && __props.currentItems ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(pageRangeStart.value) + "–" + toDisplayString(pageRangeEnd.value), 1)) : createCommentVNode("", true),
|
|
16456
16379
|
createElementVNode("span", _hoisted_5$1, toDisplayString(rowCountText.value), 1)
|
|
@@ -16459,25 +16382,34 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
16459
16382
|
}
|
|
16460
16383
|
});
|
|
16461
16384
|
|
|
16462
|
-
const PageRowRange = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16385
|
+
const PageRowRange = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__scopeId", "data-v-6cdf0c06"]]);
|
|
16463
16386
|
|
|
16464
|
-
const _sfc_main$
|
|
16387
|
+
const _sfc_main$f = {
|
|
16465
16388
|
components: {
|
|
16466
16389
|
PageNavigation,
|
|
16467
16390
|
PageRowRange,
|
|
16468
16391
|
KdsMenuButton: _sfc_main$1h
|
|
16469
16392
|
},
|
|
16470
16393
|
props: {
|
|
16394
|
+
tableConfig: {
|
|
16395
|
+
type: Object,
|
|
16396
|
+
required: true
|
|
16397
|
+
},
|
|
16471
16398
|
pageConfig: {
|
|
16472
16399
|
type: Object,
|
|
16473
|
-
|
|
16400
|
+
required: true
|
|
16401
|
+
},
|
|
16402
|
+
tableState: {
|
|
16403
|
+
type: Object,
|
|
16404
|
+
required: true
|
|
16405
|
+
},
|
|
16406
|
+
pageState: {
|
|
16407
|
+
type: Object,
|
|
16408
|
+
required: true
|
|
16474
16409
|
}
|
|
16475
16410
|
},
|
|
16476
16411
|
emits: ["pageSizeUpdate", "pageChange"],
|
|
16477
16412
|
computed: {
|
|
16478
|
-
showPageNavigationControls() {
|
|
16479
|
-
return this.pageConfig.showPageControls ?? true;
|
|
16480
|
-
},
|
|
16481
16413
|
pageSizeItems() {
|
|
16482
16414
|
return (this.pageConfig.possiblePageSizes ?? []).map((pageSize) => ({
|
|
16483
16415
|
id: pageSize.toString(),
|
|
@@ -16496,28 +16428,27 @@ const _sfc_main$e = {
|
|
|
16496
16428
|
}
|
|
16497
16429
|
};
|
|
16498
16430
|
|
|
16499
|
-
const _hoisted_1$
|
|
16431
|
+
const _hoisted_1$a = { class: "page-controls" };
|
|
16500
16432
|
const _hoisted_2$6 = { class: "page-size-menu" };
|
|
16501
16433
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16502
16434
|
const _component_PageRowRange = resolveComponent("PageRowRange");
|
|
16503
16435
|
const _component_PageNavigation = resolveComponent("PageNavigation");
|
|
16504
16436
|
const _component_KdsMenuButton = resolveComponent("KdsMenuButton");
|
|
16505
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
16437
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
16506
16438
|
createVNode(_component_PageRowRange, {
|
|
16507
16439
|
class: "page-row-range",
|
|
16508
|
-
"current-items": $props.
|
|
16440
|
+
"current-items": $props.tableState.currentSize,
|
|
16509
16441
|
"page-size": $props.pageConfig.pageSize,
|
|
16510
|
-
"current-page": $props.
|
|
16511
|
-
"show-table-size": $props.
|
|
16512
|
-
"row-label": $props.
|
|
16442
|
+
"current-page": $props.pageState.currentPage,
|
|
16443
|
+
"show-table-size": $props.tableConfig.showTableSize,
|
|
16444
|
+
"row-label": $props.tableConfig.rowLabel
|
|
16513
16445
|
}, null, 8, ["current-items", "page-size", "current-page", "show-table-size", "row-label"]),
|
|
16514
|
-
|
|
16515
|
-
|
|
16516
|
-
"current-items": $props.pageConfig.currentSize,
|
|
16446
|
+
createVNode(_component_PageNavigation, {
|
|
16447
|
+
"current-items": $props.tableState.currentSize,
|
|
16517
16448
|
"page-size": $props.pageConfig.pageSize,
|
|
16518
|
-
"current-page": $props.
|
|
16449
|
+
"current-page": $props.pageState.currentPage,
|
|
16519
16450
|
onPageChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("pageChange", $event))
|
|
16520
|
-
}, null, 8, ["current-items", "page-size", "current-page"])
|
|
16451
|
+
}, null, 8, ["current-items", "page-size", "current-page"]),
|
|
16521
16452
|
createElementVNode("div", _hoisted_2$6, [
|
|
16522
16453
|
createVNode(_component_KdsMenuButton, {
|
|
16523
16454
|
items: $options.pageSizeItems,
|
|
@@ -16530,9 +16461,40 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
16530
16461
|
])
|
|
16531
16462
|
]);
|
|
16532
16463
|
}
|
|
16533
|
-
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"]]);
|
|
16534
16465
|
|
|
16535
|
-
const
|
|
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
|
+
};
|
|
16496
|
+
|
|
16497
|
+
const _hoisted_1$9 = {
|
|
16536
16498
|
key: 0,
|
|
16537
16499
|
class: "rows"
|
|
16538
16500
|
};
|
|
@@ -16540,11 +16502,11 @@ const _hoisted_2$5 = {
|
|
|
16540
16502
|
key: 1,
|
|
16541
16503
|
class: "value"
|
|
16542
16504
|
};
|
|
16543
|
-
const _sfc_main$
|
|
16505
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
16544
16506
|
__name: "FilterControlBody",
|
|
16545
16507
|
props: {
|
|
16546
|
-
|
|
16547
|
-
|
|
16508
|
+
columns: {},
|
|
16509
|
+
colFilterValues: {}
|
|
16548
16510
|
},
|
|
16549
16511
|
emits: ["columnFilter"],
|
|
16550
16512
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16566,22 +16528,29 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16566
16528
|
return config;
|
|
16567
16529
|
};
|
|
16568
16530
|
const filterableColumnIndices = computed(
|
|
16569
|
-
() => (props.
|
|
16531
|
+
() => (props.columns ?? []).map((column, index) => ({ config: column.filterConfig, index })).filter(({ config }) => config !== void 0).map(({ index }) => index)
|
|
16570
16532
|
);
|
|
16571
16533
|
const trackedIndices = ref([]);
|
|
16572
16534
|
onMounted(() => {
|
|
16573
|
-
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);
|
|
16574
16540
|
});
|
|
16575
16541
|
const visibleFilters = computed(
|
|
16576
16542
|
() => trackedIndices.value.map((index, rowPosition) => {
|
|
16577
|
-
const
|
|
16543
|
+
const column = props.columns?.[index];
|
|
16544
|
+
const config = column?.filterConfig;
|
|
16545
|
+
const value = props.colFilterValues[column.id];
|
|
16578
16546
|
if (!config) {
|
|
16579
16547
|
return null;
|
|
16580
16548
|
}
|
|
16581
16549
|
return {
|
|
16582
16550
|
rowPosition,
|
|
16583
16551
|
index,
|
|
16584
|
-
config: withFilteredPossibleValues(config)
|
|
16552
|
+
config: withFilteredPossibleValues(config),
|
|
16553
|
+
value
|
|
16585
16554
|
};
|
|
16586
16555
|
}).filter(
|
|
16587
16556
|
(entry) => entry !== null
|
|
@@ -16594,7 +16563,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16594
16563
|
(idx) => idx === currentIndex || !trackedIndices.value.includes(idx)
|
|
16595
16564
|
).map((idx) => ({
|
|
16596
16565
|
id: String(idx),
|
|
16597
|
-
text: props.
|
|
16566
|
+
text: props.columns?.[idx]?.header ?? ""
|
|
16598
16567
|
}));
|
|
16599
16568
|
const onColumnChange = (rowPosition, newIdAsString) => {
|
|
16600
16569
|
const newIndex = Number(newIdAsString);
|
|
@@ -16602,8 +16571,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16602
16571
|
if (oldIndex === newIndex) {
|
|
16603
16572
|
return;
|
|
16604
16573
|
}
|
|
16605
|
-
const
|
|
16606
|
-
|
|
16574
|
+
const oldColumn = props.columns?.[oldIndex];
|
|
16575
|
+
const oldConfig = oldColumn?.filterConfig;
|
|
16576
|
+
const oldValue = props.colFilterValues[oldColumn?.id];
|
|
16577
|
+
if (oldConfig && isActive(oldConfig, oldValue)) {
|
|
16607
16578
|
emit("columnFilter", oldIndex, defaultValueFor(oldConfig.is));
|
|
16608
16579
|
}
|
|
16609
16580
|
trackedIndices.value = trackedIndices.value.map(
|
|
@@ -16628,8 +16599,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16628
16599
|
};
|
|
16629
16600
|
const onDeleteRow = (rowPosition) => {
|
|
16630
16601
|
const index = trackedIndices.value[rowPosition];
|
|
16631
|
-
const
|
|
16632
|
-
|
|
16602
|
+
const column = props.columns?.[index];
|
|
16603
|
+
const config = column?.filterConfig;
|
|
16604
|
+
const value = props.colFilterValues[column?.id];
|
|
16605
|
+
if (isActive(config, value)) {
|
|
16633
16606
|
emit("columnFilter", index, defaultValueFor(config.is));
|
|
16634
16607
|
}
|
|
16635
16608
|
trackedIndices.value = trackedIndices.value.filter(
|
|
@@ -16660,8 +16633,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16660
16633
|
__expose({ addAndFocusColumn });
|
|
16661
16634
|
return (_ctx, _cache) => {
|
|
16662
16635
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
16663
|
-
visibleFilters.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16664
|
-
(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 }) => {
|
|
16665
16638
|
return openBlock(), createElementBlock("div", {
|
|
16666
16639
|
key: index,
|
|
16667
16640
|
class: "row"
|
|
@@ -16676,19 +16649,19 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16676
16649
|
}, null, 8, ["model-value", "possible-values", "onUpdate:modelValue"]),
|
|
16677
16650
|
createVNode(unref(_sfc_main$z), {
|
|
16678
16651
|
class: "mode",
|
|
16679
|
-
"model-value": unref(isMissingMode)(config) ? "missing" : "contains",
|
|
16652
|
+
"model-value": unref(isMissingMode)(config, value) ? "missing" : "contains",
|
|
16680
16653
|
placeholder: "Mode",
|
|
16681
16654
|
"possible-values": MODE_OPTIONS,
|
|
16682
16655
|
ariaLabel: "Select filter mode",
|
|
16683
16656
|
"onUpdate:modelValue": ($event) => onModeChange(index, config, $event)
|
|
16684
16657
|
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
16685
|
-
!unref(isMissingMode)(config) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
16658
|
+
!unref(isMissingMode)(config, value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
16686
16659
|
config.is === "FilterInputField" ? (openBlock(), createBlock(unref(KdsTextInput), {
|
|
16687
16660
|
key: 0,
|
|
16688
16661
|
ref_for: true,
|
|
16689
16662
|
ref: (el) => setValueRef(index, el),
|
|
16690
16663
|
class: "value",
|
|
16691
|
-
"model-value":
|
|
16664
|
+
"model-value": value ?? "",
|
|
16692
16665
|
placeholder: "value",
|
|
16693
16666
|
ariaLabel: "Enter filter value",
|
|
16694
16667
|
"onUpdate:modelValue": ($event) => emit("columnFilter", index, $event)
|
|
@@ -16697,7 +16670,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16697
16670
|
ref_for: true,
|
|
16698
16671
|
ref: (el) => setValueRef(index, el),
|
|
16699
16672
|
class: "value",
|
|
16700
|
-
"model-value":
|
|
16673
|
+
"model-value": value ?? "",
|
|
16701
16674
|
placeholder: "value",
|
|
16702
16675
|
"possible-values": config.possibleValues,
|
|
16703
16676
|
ariaLabel: "Select filter value",
|
|
@@ -16707,7 +16680,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16707
16680
|
ref_for: true,
|
|
16708
16681
|
ref: (el) => setValueRef(index, el),
|
|
16709
16682
|
class: "value",
|
|
16710
|
-
"model-value":
|
|
16683
|
+
"model-value": value ?? [],
|
|
16711
16684
|
placeholder: "value",
|
|
16712
16685
|
"possible-values": config.possibleValues,
|
|
16713
16686
|
ariaLabel: "Select filter values",
|
|
@@ -16740,16 +16713,16 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
16740
16713
|
}
|
|
16741
16714
|
});
|
|
16742
16715
|
|
|
16743
|
-
const FilterControlBody = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16716
|
+
const FilterControlBody = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__scopeId", "data-v-bd4cc5ec"]]);
|
|
16744
16717
|
|
|
16745
|
-
const _sfc_main$
|
|
16718
|
+
const _sfc_main$d = { };
|
|
16746
16719
|
|
|
16747
|
-
const _hoisted_1$
|
|
16720
|
+
const _hoisted_1$8 = { class: "popover" };
|
|
16748
16721
|
const _hoisted_2$4 = { class: "header" };
|
|
16749
16722
|
const _hoisted_3$3 = { class: "body" };
|
|
16750
16723
|
|
|
16751
16724
|
function _sfc_render$3(_ctx, _cache) {
|
|
16752
|
-
return (openBlock(), createElementBlock("div", _hoisted_1$
|
|
16725
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
16753
16726
|
createElementVNode("span", _hoisted_2$4, [
|
|
16754
16727
|
renderSlot(_ctx.$slots, "header", {}, undefined, true)
|
|
16755
16728
|
]),
|
|
@@ -16758,7 +16731,7 @@ function _sfc_render$3(_ctx, _cache) {
|
|
|
16758
16731
|
])
|
|
16759
16732
|
]))
|
|
16760
16733
|
}
|
|
16761
|
-
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"]]);
|
|
16762
16735
|
|
|
16763
16736
|
const useButtonPopoverInteraction = ({
|
|
16764
16737
|
keepButtonActive
|
|
@@ -16789,11 +16762,11 @@ const useButtonPopoverInteraction = ({
|
|
|
16789
16762
|
};
|
|
16790
16763
|
};
|
|
16791
16764
|
|
|
16792
|
-
const _sfc_main$
|
|
16765
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
16793
16766
|
__name: "FilterControl",
|
|
16794
16767
|
props: {
|
|
16795
|
-
|
|
16796
|
-
|
|
16768
|
+
columns: {},
|
|
16769
|
+
colFilterValues: {}
|
|
16797
16770
|
},
|
|
16798
16771
|
emits: ["columnFilter"],
|
|
16799
16772
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16802,7 +16775,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
16802
16775
|
const filterPopoverRef = useTemplateRef("filterPopoverRef");
|
|
16803
16776
|
const filterBodyRef = useTemplateRef("filterBodyRef");
|
|
16804
16777
|
const hasActiveFilter = computed(
|
|
16805
|
-
() => props.
|
|
16778
|
+
() => props.columns?.some(
|
|
16779
|
+
(column) => isActive(column.filterConfig, props.colFilterValues[column.id])
|
|
16780
|
+
) ?? false
|
|
16806
16781
|
);
|
|
16807
16782
|
const {
|
|
16808
16783
|
buttonIsActive,
|
|
@@ -16863,10 +16838,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
16863
16838
|
createVNode(FilterControlBody, {
|
|
16864
16839
|
ref_key: "filterBodyRef",
|
|
16865
16840
|
ref: filterBodyRef,
|
|
16866
|
-
|
|
16867
|
-
"
|
|
16841
|
+
columns: __props.columns,
|
|
16842
|
+
"col-filter-values": __props.colFilterValues,
|
|
16868
16843
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => emit("columnFilter", colInd, value))
|
|
16869
|
-
}, null, 8, ["
|
|
16844
|
+
}, null, 8, ["columns", "col-filter-values"])
|
|
16870
16845
|
]),
|
|
16871
16846
|
_: 1
|
|
16872
16847
|
})
|
|
@@ -16878,14 +16853,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
16878
16853
|
}
|
|
16879
16854
|
});
|
|
16880
16855
|
|
|
16881
|
-
const FilterControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16856
|
+
const FilterControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__scopeId", "data-v-3cd94230"]]);
|
|
16882
16857
|
|
|
16883
|
-
const _hoisted_1$
|
|
16858
|
+
const _hoisted_1$7 = { class: "body" };
|
|
16884
16859
|
const NONE_COLUMN_VALUE = "None";
|
|
16885
|
-
const _sfc_main$
|
|
16860
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
16886
16861
|
__name: "SortControl",
|
|
16887
16862
|
props: {
|
|
16888
|
-
|
|
16863
|
+
colSortValues: {},
|
|
16889
16864
|
sortControlOptions: {}
|
|
16890
16865
|
},
|
|
16891
16866
|
emits: ["columnSort"],
|
|
@@ -16894,10 +16869,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
16894
16869
|
const emit = __emit;
|
|
16895
16870
|
const sortPopoverRef = useTemplateRef("sortPopoverRef");
|
|
16896
16871
|
const selectedColumn = ref(
|
|
16897
|
-
props.
|
|
16872
|
+
props.colSortValues?.[0]?.id?.toString() ?? NONE_COLUMN_VALUE
|
|
16898
16873
|
);
|
|
16899
16874
|
watch(
|
|
16900
|
-
() => props.
|
|
16875
|
+
() => props.colSortValues?.[0]?.id,
|
|
16901
16876
|
(val) => {
|
|
16902
16877
|
if (val === void 0 && selectedColumn.value !== void 0) {
|
|
16903
16878
|
return;
|
|
@@ -16906,7 +16881,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
16906
16881
|
}
|
|
16907
16882
|
);
|
|
16908
16883
|
const hasSortConfig = computed(
|
|
16909
|
-
() => props.
|
|
16884
|
+
() => props.colSortValues !== void 0 && props.colSortValues[0]?.id !== void 0 && props.colSortValues[0]?.direction !== void 0
|
|
16910
16885
|
);
|
|
16911
16886
|
const possibleColumns = computed(() => [
|
|
16912
16887
|
{ id: NONE_COLUMN_VALUE, text: NONE_COLUMN_VALUE },
|
|
@@ -16916,25 +16891,25 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
16916
16891
|
() => selectedColumn.value === NONE_COLUMN_VALUE ? [] : props.sortControlOptions.selectableDirections[selectedColumn.value] ?? []
|
|
16917
16892
|
);
|
|
16918
16893
|
const selectedSortDirection = computed(
|
|
16919
|
-
() => props.
|
|
16894
|
+
() => props.colSortValues?.[0]?.direction?.toString() ?? ""
|
|
16920
16895
|
);
|
|
16921
16896
|
const { buttonIsActive, showPopover, onButtonClick, onPopoverToggle } = useButtonPopoverInteraction({ keepButtonActive: hasSortConfig });
|
|
16922
|
-
const onSortColumnChange = (
|
|
16923
|
-
selectedColumn.value =
|
|
16924
|
-
if (
|
|
16897
|
+
const onSortColumnChange = (columnId) => {
|
|
16898
|
+
selectedColumn.value = columnId;
|
|
16899
|
+
if (columnId === NONE_COLUMN_VALUE) {
|
|
16925
16900
|
emit("columnSort", void 0, 0);
|
|
16926
16901
|
return;
|
|
16927
16902
|
}
|
|
16928
16903
|
emit(
|
|
16929
16904
|
"columnSort",
|
|
16930
|
-
|
|
16931
|
-
props.
|
|
16905
|
+
columnId,
|
|
16906
|
+
props.colSortValues?.[0]?.direction || 1
|
|
16932
16907
|
);
|
|
16933
16908
|
};
|
|
16934
16909
|
const onSortDirectionChange = (direction) => {
|
|
16935
16910
|
emit(
|
|
16936
16911
|
"columnSort",
|
|
16937
|
-
|
|
16912
|
+
selectedColumn.value,
|
|
16938
16913
|
Number.parseInt(direction, 10)
|
|
16939
16914
|
);
|
|
16940
16915
|
};
|
|
@@ -16973,7 +16948,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
16973
16948
|
_cache[0] || (_cache[0] = createTextVNode(" Sorting ", -1))
|
|
16974
16949
|
]),
|
|
16975
16950
|
body: withCtx(() => [
|
|
16976
|
-
createElementVNode("div", _hoisted_1$
|
|
16951
|
+
createElementVNode("div", _hoisted_1$7, [
|
|
16977
16952
|
createVNode(unref(_sfc_main$z), {
|
|
16978
16953
|
"model-value": selectedColumn.value,
|
|
16979
16954
|
"possible-values": possibleColumns.value,
|
|
@@ -17000,9 +16975,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
17000
16975
|
}
|
|
17001
16976
|
});
|
|
17002
16977
|
|
|
17003
|
-
const SortControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
16978
|
+
const SortControl = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__scopeId", "data-v-ad5ee20c"]]);
|
|
17004
16979
|
|
|
17005
|
-
const _hoisted_1$
|
|
16980
|
+
const _hoisted_1$6 = { class: "left" };
|
|
17006
16981
|
const _hoisted_2$3 = {
|
|
17007
16982
|
key: 0,
|
|
17008
16983
|
class: "title"
|
|
@@ -17012,7 +16987,7 @@ const _hoisted_3$2 = {
|
|
|
17012
16987
|
class: "dimension"
|
|
17013
16988
|
};
|
|
17014
16989
|
const _hoisted_4$1 = { class: "right" };
|
|
17015
|
-
const _sfc_main$
|
|
16990
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
17016
16991
|
__name: "TableActionBar",
|
|
17017
16992
|
props: {
|
|
17018
16993
|
allRowsCount: { default: 0 },
|
|
@@ -17022,19 +16997,17 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17022
16997
|
rowLabel: { default: "Rows" },
|
|
17023
16998
|
title: { default: "" },
|
|
17024
16999
|
showTableSize: { type: Boolean, default: true },
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17000
|
+
actionConfig: {},
|
|
17001
|
+
colSortValues: { default: () => [] },
|
|
17002
|
+
colFilterValues: {},
|
|
17028
17003
|
sortControlOptions: {},
|
|
17029
|
-
|
|
17030
|
-
columnHeaders: {},
|
|
17031
|
-
settingsItems: { default: () => [] }
|
|
17004
|
+
columns: {}
|
|
17032
17005
|
},
|
|
17033
17006
|
emits: ["resetTemporaryView", "columnFilter", "onColumnSort"],
|
|
17034
17007
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
17035
17008
|
const isTemporaryView = computed(() => __props.title === "Temporary view");
|
|
17036
17009
|
const hasContent = computed(
|
|
17037
|
-
() => Boolean(__props.title) || __props.showTableSize || __props.
|
|
17010
|
+
() => Boolean(__props.title) || __props.showTableSize || __props.actionConfig.enableSorting || __props.actionConfig.enableFilters
|
|
17038
17011
|
);
|
|
17039
17012
|
const hasRows = computed(() => __props.allRowsCount > 0);
|
|
17040
17013
|
const shouldAppendOfRows = computed(() => __props.filteredRowsCount < __props.allRowsCount);
|
|
@@ -17043,7 +17016,6 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17043
17016
|
const shouldAppendOfColumns = computed(
|
|
17044
17017
|
() => __props.filteredColumnsCount < __props.allColumnsCount
|
|
17045
17018
|
);
|
|
17046
|
-
const hasSettingsItems = computed(() => __props.settingsItems.length > 0);
|
|
17047
17019
|
const formatCount = (label, filteredCount, totalCount, appendTotal) => `${label}: ${filteredCount}${appendTotal ? ` of ${totalCount}` : ""}`;
|
|
17048
17020
|
const dimensionText = computed(() => {
|
|
17049
17021
|
if (!hasRows.value && !hasColumns.value) {
|
|
@@ -17079,32 +17051,32 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17079
17051
|
key: 0,
|
|
17080
17052
|
class: normalizeClass(["kds-table-action-bar", { "temporary-view": isTemporaryView.value }])
|
|
17081
17053
|
}, [
|
|
17082
|
-
createElementVNode("div", _hoisted_1$
|
|
17054
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
17083
17055
|
__props.title ? (openBlock(), createElementBlock("span", _hoisted_2$3, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
|
|
17084
17056
|
__props.showTableSize ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(dimensionText.value), 1)) : createCommentVNode("", true),
|
|
17085
|
-
__props.
|
|
17057
|
+
__props.actionConfig.enableSorting ? (openBlock(), createBlock(SortControl, {
|
|
17086
17058
|
key: 2,
|
|
17087
|
-
"sort-
|
|
17059
|
+
"col-sort-values": __props.colSortValues,
|
|
17088
17060
|
"sort-control-options": __props.sortControlOptions,
|
|
17089
|
-
onColumnSort: _cache[0] || (_cache[0] = (
|
|
17090
|
-
}, null, 8, ["sort-
|
|
17091
|
-
__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, {
|
|
17092
17064
|
key: 3,
|
|
17093
17065
|
ref_key: "filterControlRef",
|
|
17094
17066
|
ref: filterControlRef,
|
|
17095
|
-
|
|
17096
|
-
"
|
|
17067
|
+
columns: __props.columns,
|
|
17068
|
+
"col-filter-values": __props.colFilterValues,
|
|
17097
17069
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => emit("columnFilter", colInd, value))
|
|
17098
|
-
}, null, 8, ["
|
|
17070
|
+
}, null, 8, ["columns", "col-filter-values"])) : createCommentVNode("", true)
|
|
17099
17071
|
]),
|
|
17100
17072
|
createElementVNode("div", _hoisted_4$1, [
|
|
17101
|
-
|
|
17073
|
+
__props.actionConfig.settingsItems?.length ? (openBlock(), createBlock(unref(_sfc_main$1h), {
|
|
17102
17074
|
key: 0,
|
|
17103
17075
|
ariaLabel: "Table settings",
|
|
17104
17076
|
size: "small",
|
|
17105
17077
|
variant: "transparent",
|
|
17106
17078
|
"leading-icon": "parameter",
|
|
17107
|
-
items: __props.settingsItems
|
|
17079
|
+
items: __props.actionConfig.settingsItems
|
|
17108
17080
|
}, null, 8, ["items"])) : createCommentVNode("", true),
|
|
17109
17081
|
isTemporaryView.value ? (openBlock(), createBlock(unref(_sfc_main$1s), {
|
|
17110
17082
|
key: 1,
|
|
@@ -17120,44 +17092,426 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17120
17092
|
}
|
|
17121
17093
|
});
|
|
17122
17094
|
|
|
17123
|
-
const TableActionBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
17095
|
+
const TableActionBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__scopeId", "data-v-4a59722f"]]);
|
|
17096
|
+
|
|
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 = () => {
|
|
17189
|
+
const container = scrollContainer.value;
|
|
17190
|
+
if (!container) {
|
|
17191
|
+
return false;
|
|
17192
|
+
}
|
|
17193
|
+
const { right } = container.getBoundingClientRect();
|
|
17194
|
+
return pointerClientX >= right - AUTO_SCROLL_EDGE_SIZE;
|
|
17195
|
+
};
|
|
17196
|
+
const { pause, resume } = useRafFn(
|
|
17197
|
+
({ delta }) => {
|
|
17198
|
+
const deltaPx = AUTO_SCROLL_SPEED * delta / 1e3;
|
|
17199
|
+
autoScrollOffset.value += deltaPx;
|
|
17200
|
+
const container = scrollContainer.value;
|
|
17201
|
+
onAutoScroll();
|
|
17202
|
+
nextTick(() => {
|
|
17203
|
+
if (container) {
|
|
17204
|
+
container.scrollLeft = scrollLeftBase + autoScrollOffset.value;
|
|
17205
|
+
}
|
|
17206
|
+
});
|
|
17207
|
+
},
|
|
17208
|
+
{ immediate: false }
|
|
17209
|
+
);
|
|
17210
|
+
const updateZone = (clientX) => {
|
|
17211
|
+
pointerClientX = clientX;
|
|
17212
|
+
if (isInTriggerZone()) {
|
|
17213
|
+
resume();
|
|
17214
|
+
} else {
|
|
17215
|
+
pause();
|
|
17216
|
+
}
|
|
17217
|
+
};
|
|
17218
|
+
const onPointerDown = (clientX) => {
|
|
17219
|
+
scrollLeftBase = scrollContainer.value?.scrollLeft ?? 0;
|
|
17220
|
+
updateZone(clientX);
|
|
17221
|
+
};
|
|
17222
|
+
const onPointerMove = (clientX) => {
|
|
17223
|
+
updateZone(clientX);
|
|
17224
|
+
};
|
|
17225
|
+
const onPointerUp = () => {
|
|
17226
|
+
pause();
|
|
17227
|
+
autoScrollOffset.value = 0;
|
|
17228
|
+
};
|
|
17229
|
+
return { onPointerDown, onPointerMove, onPointerUp };
|
|
17230
|
+
};
|
|
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"]]);
|
|
17124
17486
|
|
|
17125
17487
|
const _sfc_main$8 = {
|
|
17126
17488
|
components: {
|
|
17127
17489
|
KdsCheckbox: _sfc_main$10,
|
|
17128
17490
|
KdsButton: _sfc_main$1s,
|
|
17129
|
-
|
|
17491
|
+
HeaderCell
|
|
17130
17492
|
},
|
|
17131
17493
|
props: {
|
|
17132
17494
|
tableConfig: {
|
|
17133
17495
|
type: Object,
|
|
17134
17496
|
default: () => ({})
|
|
17135
17497
|
},
|
|
17136
|
-
|
|
17137
|
-
type:
|
|
17138
|
-
default: () =>
|
|
17139
|
-
},
|
|
17140
|
-
columnSubHeaders: {
|
|
17141
|
-
type: Array,
|
|
17142
|
-
default: () => []
|
|
17143
|
-
},
|
|
17144
|
-
columnSizes: {
|
|
17145
|
-
type: Array,
|
|
17146
|
-
default: () => []
|
|
17498
|
+
actionConfig: {
|
|
17499
|
+
type: Object,
|
|
17500
|
+
default: () => ({})
|
|
17147
17501
|
},
|
|
17148
|
-
|
|
17502
|
+
columns: {
|
|
17149
17503
|
type: Array,
|
|
17150
17504
|
default: () => []
|
|
17151
17505
|
},
|
|
17152
|
-
|
|
17153
|
-
type:
|
|
17154
|
-
default: () =>
|
|
17506
|
+
colFilterValues: {
|
|
17507
|
+
type: Object,
|
|
17508
|
+
default: () => ({})
|
|
17155
17509
|
},
|
|
17156
|
-
|
|
17510
|
+
colSizes: {
|
|
17157
17511
|
type: Array,
|
|
17158
17512
|
default: () => []
|
|
17159
17513
|
},
|
|
17160
|
-
|
|
17514
|
+
colSortValues: {
|
|
17161
17515
|
type: Array,
|
|
17162
17516
|
default: () => []
|
|
17163
17517
|
},
|
|
@@ -17187,6 +17541,9 @@ const _sfc_main$8 = {
|
|
|
17187
17541
|
columnResizeEnd: () => true,
|
|
17188
17542
|
columnResizeStart: () => true,
|
|
17189
17543
|
allColumnsResize: (newSize) => true,
|
|
17544
|
+
columnSort: (index, direction) => true,
|
|
17545
|
+
openActionBarFilterControl: (index) => true,
|
|
17546
|
+
clearColumnFilter: (index) => true,
|
|
17190
17547
|
moveDownFromHeaderCell: (index) => true,
|
|
17191
17548
|
headerCellSelect: (index) => true,
|
|
17192
17549
|
"update:newColumnButtonWidth": (width) => true,
|
|
@@ -17198,7 +17555,7 @@ const _sfc_main$8 = {
|
|
|
17198
17555
|
deleteColumn: (index) => true
|
|
17199
17556
|
},
|
|
17200
17557
|
setup(props, { emit }) {
|
|
17201
|
-
const { indexedData:
|
|
17558
|
+
const { indexedData: indexedColumns, style: headerStyles } = useIndicesAndStylesFor(toRef(props, "columns"));
|
|
17202
17559
|
let currentColumnIndex = 0;
|
|
17203
17560
|
const onStartEditing = (initialValue) => {
|
|
17204
17561
|
emit("headerCellStartEditing", currentColumnIndex, initialValue);
|
|
@@ -17211,43 +17568,20 @@ const _sfc_main$8 = {
|
|
|
17211
17568
|
currentColumnIndex = columnIndex;
|
|
17212
17569
|
startEditingKeydown(event);
|
|
17213
17570
|
};
|
|
17214
|
-
return {
|
|
17571
|
+
return { indexedColumns, headerStyles, onHeaderCellKeydown };
|
|
17215
17572
|
},
|
|
17216
17573
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
17217
17574
|
data() {
|
|
17218
17575
|
return {
|
|
17219
|
-
hoverIndex: null,
|
|
17220
|
-
// the index of the column that is currently being hovered over; null during resize
|
|
17221
|
-
dragIndex: null,
|
|
17222
|
-
// the index of the column that is currently being dragged / resized
|
|
17223
|
-
columnSizeOnDragStart: 0,
|
|
17224
|
-
// the original width of the column that is currently being resized
|
|
17225
|
-
pageXOnDragStart: 0,
|
|
17226
|
-
// the x coordinate at which the mouse was clicked when starting the resize drag
|
|
17227
17576
|
minimumColumnWidth: MIN_COLUMN_SIZE,
|
|
17228
17577
|
// need to add this here since it is referenced in the template
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
borderTop: kdsSpacingContainer0p10x,
|
|
17578
|
+
resizingColumnIndex: null,
|
|
17579
|
+
// the index of the column that is currently being resized; null otherwise
|
|
17232
17580
|
focusedHeaderIndex: null
|
|
17233
17581
|
// the index of the currently focused header cell
|
|
17234
17582
|
};
|
|
17235
17583
|
},
|
|
17236
17584
|
computed: {
|
|
17237
|
-
enableColumnResizing() {
|
|
17238
|
-
const enableColumnResizingSetting = this.tableConfig.enableColumnResizing;
|
|
17239
|
-
if (enableColumnResizingSetting === void 0) {
|
|
17240
|
-
return true;
|
|
17241
|
-
} else {
|
|
17242
|
-
return enableColumnResizingSetting;
|
|
17243
|
-
}
|
|
17244
|
-
},
|
|
17245
|
-
hasSubHeaders() {
|
|
17246
|
-
return this.columnSubHeaders.some(Boolean);
|
|
17247
|
-
},
|
|
17248
|
-
currentResizeDragHandleWidth() {
|
|
17249
|
-
return this.enableColumnResizing ? COLUMN_RESIZE_DRAG_HANDLE_WIDTH : 0;
|
|
17250
|
-
},
|
|
17251
17585
|
headerSelectionOverlayStyle() {
|
|
17252
17586
|
const columnIndex = this.selectedHeaderIndex;
|
|
17253
17587
|
if (columnIndex === null || !this.tableConfig.enableHeaderCellSelection) {
|
|
@@ -17257,16 +17591,13 @@ const _sfc_main$8 = {
|
|
|
17257
17591
|
if (this.tableConfig.showSelection) {
|
|
17258
17592
|
left += SPECIAL_COLUMNS_SIZE;
|
|
17259
17593
|
}
|
|
17260
|
-
if (this.tableConfig.showCollapser) {
|
|
17261
|
-
left += SPECIAL_COLUMNS_SIZE;
|
|
17262
|
-
}
|
|
17263
17594
|
if (this.tableConfig.enableRowDeletion) {
|
|
17264
17595
|
left += SPECIAL_COLUMNS_SIZE;
|
|
17265
17596
|
}
|
|
17266
17597
|
for (let i = 0; i < columnIndex; i++) {
|
|
17267
|
-
left += this.
|
|
17598
|
+
left += this.columnSize(i);
|
|
17268
17599
|
}
|
|
17269
|
-
const width = this.
|
|
17600
|
+
const width = this.columnSize(columnIndex);
|
|
17270
17601
|
return {
|
|
17271
17602
|
left: `${left}px`,
|
|
17272
17603
|
width: `${width}px`
|
|
@@ -17274,8 +17605,15 @@ const _sfc_main$8 = {
|
|
|
17274
17605
|
}
|
|
17275
17606
|
},
|
|
17276
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
|
+
},
|
|
17277
17615
|
onHeaderCellFocus(columnIndex) {
|
|
17278
|
-
if (!this.tableConfig.enableHeaderCellSelection && !this.
|
|
17616
|
+
if (!this.tableConfig.enableHeaderCellSelection && !this.columns[columnIndex].editable) {
|
|
17279
17617
|
return;
|
|
17280
17618
|
}
|
|
17281
17619
|
this.focusedHeaderIndex = columnIndex;
|
|
@@ -17283,7 +17621,7 @@ const _sfc_main$8 = {
|
|
|
17283
17621
|
},
|
|
17284
17622
|
onHeaderCellBlur(columnIndex) {
|
|
17285
17623
|
this.focusedHeaderIndex = null;
|
|
17286
|
-
if (!this.
|
|
17624
|
+
if (!this.columns[columnIndex].editable) {
|
|
17287
17625
|
this.$emit("headerCellDeselect");
|
|
17288
17626
|
}
|
|
17289
17627
|
},
|
|
@@ -17301,89 +17639,46 @@ const _sfc_main$8 = {
|
|
|
17301
17639
|
if (this.tableConfig.enableHeaderCellSelection && this.selectedHeaderIndex !== ind) {
|
|
17302
17640
|
this.$emit("headerCellSelect", ind);
|
|
17303
17641
|
}
|
|
17304
|
-
if (this.
|
|
17642
|
+
if (this.columns[ind].editable) {
|
|
17305
17643
|
this.$emit("headerCellStartEditing", ind);
|
|
17306
17644
|
}
|
|
17307
17645
|
},
|
|
17308
|
-
|
|
17309
|
-
|
|
17310
|
-
if (this.dragIndex === null) {
|
|
17311
|
-
this.hoverIndex = columnIndex;
|
|
17312
|
-
}
|
|
17313
|
-
},
|
|
17314
|
-
onPointerLeave(event) {
|
|
17315
|
-
consola.debug("End hover over drag handle: ", event);
|
|
17316
|
-
if (this.dragIndex === null) {
|
|
17317
|
-
this.hoverIndex = null;
|
|
17318
|
-
}
|
|
17319
|
-
},
|
|
17320
|
-
onPointerDown(event, columnIndex) {
|
|
17321
|
-
consola.debug("Resize via drag triggered: ", event);
|
|
17322
|
-
event.stopPropagation();
|
|
17323
|
-
event.target.setPointerCapture(event.pointerId);
|
|
17324
|
-
this.dragIndex = columnIndex;
|
|
17325
|
-
this.currentDragHandlerHeight = this.getDragHandleHeight();
|
|
17326
|
-
this.columnSizeOnDragStart = this.columnSizes[columnIndex];
|
|
17327
|
-
this.pageXOnDragStart = event.pageX;
|
|
17646
|
+
onColumnResizeStart(columnIndex) {
|
|
17647
|
+
this.resizingColumnIndex = columnIndex;
|
|
17328
17648
|
this.$emit("columnResizeStart");
|
|
17329
17649
|
},
|
|
17330
|
-
|
|
17650
|
+
onColumnResizeEnd() {
|
|
17651
|
+
this.resizingColumnIndex = null;
|
|
17331
17652
|
this.$emit("columnResizeEnd");
|
|
17332
|
-
if (event.shiftKey) {
|
|
17333
|
-
const newColumnSize = this.columnSizeOnDragStart + event.pageX - this.pageXOnDragStart;
|
|
17334
|
-
this.$emit(
|
|
17335
|
-
"allColumnsResize",
|
|
17336
|
-
Math.max(newColumnSize, this.minimumColumnWidth)
|
|
17337
|
-
);
|
|
17338
|
-
}
|
|
17339
17653
|
},
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
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
|
+
},
|
|
17344
17669
|
onNewColumnButtonClick(event) {
|
|
17345
17670
|
this.$emit("newColumnButtonClick", event);
|
|
17346
17671
|
},
|
|
17347
17672
|
onNewColumnButtonKeydownLeft(event) {
|
|
17348
17673
|
this.$emit("newColumnButtonKeydownLeft", event);
|
|
17349
17674
|
},
|
|
17350
|
-
unthrottledOnPointerMove(event) {
|
|
17351
|
-
if (this.dragIndex !== null) {
|
|
17352
|
-
consola.debug("Resize via drag ongoing: ", event);
|
|
17353
|
-
const newColumnSize = this.columnSizeOnDragStart + event.pageX - this.pageXOnDragStart;
|
|
17354
|
-
this.$emit(
|
|
17355
|
-
"columnResize",
|
|
17356
|
-
this.dragIndex,
|
|
17357
|
-
Math.max(newColumnSize, this.minimumColumnWidth)
|
|
17358
|
-
);
|
|
17359
|
-
}
|
|
17360
|
-
},
|
|
17361
|
-
/* The lostpointercapture event is triggered if the pointer capture is lost for any reason, including its
|
|
17362
|
-
orderly release via a pointerup event. Because the onPointerMove function is throttled we also need to throttle
|
|
17363
|
-
the onLostPointerCapture function to guarantee order of event handling. */
|
|
17364
|
-
onLostPointerCapture: throttle(function(event) {
|
|
17365
|
-
consola.debug("Resize via drag finished: ", event);
|
|
17366
|
-
this.dragIndex = null;
|
|
17367
|
-
this.hoverIndex = null;
|
|
17368
|
-
}),
|
|
17369
|
-
/* eslint-enable no-invalid-this */
|
|
17370
|
-
dragHandleHeight(isDragging) {
|
|
17371
|
-
return isDragging ? this.currentDragHandlerHeight : HEADER_HEIGHT;
|
|
17372
|
-
},
|
|
17373
17675
|
onDeleteColumn(ind) {
|
|
17374
17676
|
this.$emit("deleteColumn", ind);
|
|
17375
17677
|
},
|
|
17376
17678
|
getHeaderCellWidths() {
|
|
17377
|
-
return this.
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
);
|
|
17381
|
-
const widthMainHeader = Math.ceil(
|
|
17382
|
-
this.$refs[`mainHeader-${columnIndex}`][0].getBoundingClientRect().width
|
|
17383
|
-
);
|
|
17384
|
-
const widthHeaderText = this.$refs[`headerText-${columnIndex}`][0].getBoundingClientRect().width;
|
|
17385
|
-
return widthCompleteHeader - widthMainHeader + widthHeaderText + this.currentResizeDragHandleWidth;
|
|
17386
|
-
});
|
|
17679
|
+
return this.columns.map(
|
|
17680
|
+
(_column, columnIndex) => this.$refs[`headerCell-${columnIndex}`][0].getHeaderCellWidth()
|
|
17681
|
+
);
|
|
17387
17682
|
},
|
|
17388
17683
|
/**
|
|
17389
17684
|
* We deliberately only react on Tab and not on blur since we do
|
|
@@ -17399,7 +17694,7 @@ const _sfc_main$8 = {
|
|
|
17399
17694
|
}
|
|
17400
17695
|
},
|
|
17401
17696
|
onKeydownRight(columnIndex) {
|
|
17402
|
-
if (columnIndex < this.
|
|
17697
|
+
if (columnIndex < this.columns.length - 1) {
|
|
17403
17698
|
this.focusHeaderCell(columnIndex + 1);
|
|
17404
17699
|
} else if (this.showNewColumnButton) {
|
|
17405
17700
|
if (this.tableConfig.enableHeaderCellSelection) {
|
|
@@ -17414,13 +17709,10 @@ const _sfc_main$8 = {
|
|
|
17414
17709
|
}
|
|
17415
17710
|
},
|
|
17416
17711
|
focusHeaderCell(cellInd) {
|
|
17417
|
-
|
|
17418
|
-
|
|
17419
|
-
|
|
17420
|
-
|
|
17421
|
-
} else if (this.columnDeletables[cellInd]) {
|
|
17422
|
-
this.$refs[`columnDeleteButton-${cellInd}`]?.[0]?.$el?.focus();
|
|
17423
|
-
}
|
|
17712
|
+
this.$refs[`headerCell-${cellInd}`][0].focus();
|
|
17713
|
+
},
|
|
17714
|
+
isColumnHeaderFocusable(cellInd) {
|
|
17715
|
+
return this.$refs[`headerCell-${cellInd}`][0].isFocusable();
|
|
17424
17716
|
},
|
|
17425
17717
|
focusNewColumnButton() {
|
|
17426
17718
|
this.$refs["new-column-button"]?.$el.focus();
|
|
@@ -17437,22 +17729,10 @@ const _hoisted_1$4 = {
|
|
|
17437
17729
|
class: "deletion-cell-spacer",
|
|
17438
17730
|
"aria-label": "Delete row"
|
|
17439
17731
|
};
|
|
17440
|
-
const _hoisted_2$2 = ["tabindex", "onFocus", "onBlur", "onClick", "onKeydown"];
|
|
17441
|
-
const _hoisted_3$1 = ["title"];
|
|
17442
|
-
const _hoisted_4 = {
|
|
17443
|
-
key: 0,
|
|
17444
|
-
class: "sub-header-text-container"
|
|
17445
|
-
};
|
|
17446
|
-
const _hoisted_5 = {
|
|
17447
|
-
key: 0,
|
|
17448
|
-
class: "delete-column-button"
|
|
17449
|
-
};
|
|
17450
|
-
const _hoisted_6 = { key: 1 };
|
|
17451
|
-
const _hoisted_7 = ["onPointerover", "onPointerdownPassive"];
|
|
17452
17732
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17453
17733
|
const _component_KdsCheckbox = resolveComponent("KdsCheckbox");
|
|
17734
|
+
const _component_HeaderCell = resolveComponent("HeaderCell");
|
|
17454
17735
|
const _component_KdsButton = resolveComponent("KdsButton");
|
|
17455
|
-
const _component_KdsMenuButton = resolveComponent("KdsMenuButton");
|
|
17456
17736
|
return openBlock(), createElementBlock("thead", null, [
|
|
17457
17737
|
createElementVNode("tr", {
|
|
17458
17738
|
style: normalizeStyle({ ...$setup.headerStyles })
|
|
@@ -17473,112 +17753,43 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17473
17753
|
"onUpdate:modelValue": $options.onSelect
|
|
17474
17754
|
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
17475
17755
|
], 32)) : createCommentVNode("", true),
|
|
17476
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.
|
|
17477
|
-
return openBlock(),
|
|
17756
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.indexedColumns, ([column, ind]) => {
|
|
17757
|
+
return openBlock(), createBlock(_component_HeaderCell, {
|
|
17478
17758
|
key: ind,
|
|
17479
17759
|
ref_for: true,
|
|
17480
|
-
ref: `
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
]
|
|
17514
|
-
}, [
|
|
17515
|
-
createElementVNode("div", {
|
|
17516
|
-
ref_for: true,
|
|
17517
|
-
ref: `mainHeader-${ind}`,
|
|
17518
|
-
class: "main-header"
|
|
17519
|
-
}, [
|
|
17520
|
-
createElementVNode("div", {
|
|
17521
|
-
class: "header-text-container",
|
|
17522
|
-
title: header
|
|
17523
|
-
}, [
|
|
17524
|
-
createElementVNode("span", {
|
|
17525
|
-
ref_for: true,
|
|
17526
|
-
ref: `headerText-${ind}`
|
|
17527
|
-
}, toDisplayString(header), 513)
|
|
17528
|
-
], 8, _hoisted_3$1)
|
|
17529
|
-
], 512),
|
|
17530
|
-
$props.columnSubHeaders[ind] ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
17531
|
-
renderSlot(_ctx.$slots, "subHeader", {
|
|
17532
|
-
subHeader: $props.columnSubHeaders[ind],
|
|
17533
|
-
columnIndex: ind
|
|
17534
|
-
}, () => [
|
|
17535
|
-
createTextVNode(toDisplayString($props.columnSubHeaders[ind]), 1)
|
|
17536
|
-
], true)
|
|
17537
|
-
])) : createCommentVNode("", true)
|
|
17538
|
-
], 42, _hoisted_2$2),
|
|
17539
|
-
$props.columnDeletables[ind] ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
17540
|
-
createVNode(_component_KdsButton, {
|
|
17541
|
-
ref_for: true,
|
|
17542
|
-
ref: `columnDeleteButton-${ind}`,
|
|
17543
|
-
variant: "transparent",
|
|
17544
|
-
"leading-icon": "trash",
|
|
17545
|
-
size: "small",
|
|
17546
|
-
ariaLabel: "Delete column",
|
|
17547
|
-
onClick: withModifiers(($event) => $options.onDeleteColumn(ind), ["stop"]),
|
|
17548
|
-
onKeydown: withKeys(withModifiers(($event) => $options.onKeydownDown(ind), ["prevent", "stop"]), ["down"])
|
|
17549
|
-
}, null, 8, ["onClick", "onKeydown"])
|
|
17550
|
-
])) : createCommentVNode("", true),
|
|
17551
|
-
$props.columnSubMenuItems[ind]?.length ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
17552
|
-
createVNode(_component_KdsMenuButton, {
|
|
17553
|
-
ref_for: true,
|
|
17554
|
-
ref: `columnMenuButton-${ind}`,
|
|
17555
|
-
ariaLabel: "Table column options",
|
|
17556
|
-
items: $props.columnSubMenuItems[ind],
|
|
17557
|
-
size: "small",
|
|
17558
|
-
variant: "transparent",
|
|
17559
|
-
"leading-icon": "more-actions",
|
|
17560
|
-
onKeydown: withKeys(withModifiers(($event) => $options.onKeydownDown(ind), ["prevent", "stop"]), ["down"])
|
|
17561
|
-
}, null, 8, ["items", "onKeydown"])
|
|
17562
|
-
])) : createCommentVNode("", true),
|
|
17563
|
-
$options.enableColumnResizing ? (openBlock(), createElementBlock("div", {
|
|
17564
|
-
key: 2,
|
|
17565
|
-
class: normalizeClass([
|
|
17566
|
-
"resize-handle-area",
|
|
17567
|
-
{ hover: $data.hoverIndex === ind, drag: $data.dragIndex === ind }
|
|
17568
|
-
]),
|
|
17569
|
-
style: normalizeStyle({
|
|
17570
|
-
height: `${$options.dragHandleHeight($data.dragIndex === ind)}px`
|
|
17571
|
-
}),
|
|
17572
|
-
onPointerover: ($event) => $options.onPointerOver($event, ind),
|
|
17573
|
-
onPointerleave: _cache[2] || (_cache[2] = (...args) => $options.onPointerLeave && $options.onPointerLeave(...args)),
|
|
17574
|
-
onPointerdownPassive: ($event) => $options.onPointerDown($event, ind),
|
|
17575
|
-
onPointerupPassive: _cache[3] || (_cache[3] = ($event) => $options.onPointerUp($event)),
|
|
17576
|
-
onPointermove: _cache[4] || (_cache[4] = (...args) => $options.onPointerMove && $options.onPointerMove(...args)),
|
|
17577
|
-
onLostpointercapture: _cache[5] || (_cache[5] = (...args) => $options.onLostPointerCapture && $options.onLostPointerCapture(...args))
|
|
17578
|
-
}, [..._cache[7] || (_cache[7] = [
|
|
17579
|
-
createElementVNode("span", { class: "resize-handle" }, null, -1)
|
|
17580
|
-
])], 46, _hoisted_7)) : createCommentVNode("", true)
|
|
17581
|
-
], 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"]);
|
|
17582
17793
|
}), 128)),
|
|
17583
17794
|
$props.showNewColumnButton ? (openBlock(), createElementBlock("th", {
|
|
17584
17795
|
key: 2,
|
|
@@ -17586,7 +17797,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17586
17797
|
scope: "col",
|
|
17587
17798
|
class: "new-column-head",
|
|
17588
17799
|
"aria-label": "Add column",
|
|
17589
|
-
onVnodeMounted: _cache[
|
|
17800
|
+
onVnodeMounted: _cache[1] || (_cache[1] = (...args) => $options.emitNewColumnButtonWidth && $options.emitNewColumnButtonWidth(...args))
|
|
17590
17801
|
}, [
|
|
17591
17802
|
createVNode(_component_KdsButton, {
|
|
17592
17803
|
ref: "new-column-button",
|
|
@@ -17608,7 +17819,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17608
17819
|
}, null, 6)) : createCommentVNode("", true)
|
|
17609
17820
|
]);
|
|
17610
17821
|
}
|
|
17611
|
-
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"]]);
|
|
17612
17823
|
|
|
17613
17824
|
const _hoisted_1$3 = { class: "sticky-container" };
|
|
17614
17825
|
const buttonRef = "button";
|
|
@@ -17689,7 +17900,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
17689
17900
|
text: {},
|
|
17690
17901
|
title: {},
|
|
17691
17902
|
color: {},
|
|
17692
|
-
classes: {},
|
|
17693
17903
|
selectOnMove: { type: Boolean },
|
|
17694
17904
|
size: {},
|
|
17695
17905
|
defaultTopBottomPadding: {},
|
|
@@ -17811,7 +18021,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
17811
18021
|
return (_ctx, _cache) => {
|
|
17812
18022
|
return openBlock(), createElementBlock("td", {
|
|
17813
18023
|
class: normalizeClass([
|
|
17814
|
-
__props.classes,
|
|
17815
18024
|
"data-cell",
|
|
17816
18025
|
{
|
|
17817
18026
|
"colored-cell": __props.color,
|
|
@@ -17860,25 +18069,23 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
17860
18069
|
}
|
|
17861
18070
|
});
|
|
17862
18071
|
|
|
17863
|
-
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"]]);
|
|
17864
18073
|
|
|
17865
18074
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
17866
18075
|
__name: "Cell",
|
|
17867
18076
|
props: {
|
|
18077
|
+
column: {},
|
|
17868
18078
|
cellData: {},
|
|
17869
18079
|
selectOnMove: { type: Boolean },
|
|
17870
|
-
isSlotted: { type: Boolean },
|
|
17871
18080
|
isSelected: { type: Boolean },
|
|
17872
18081
|
isInCellSelection: { type: Boolean },
|
|
17873
18082
|
isToBeExpanded: { type: Boolean },
|
|
17874
18083
|
size: {},
|
|
17875
|
-
classGenerators: {},
|
|
17876
|
-
formatter: { type: Function },
|
|
17877
18084
|
defaultTopBottomPadding: {},
|
|
17878
18085
|
defaultLeftRightPadding: {},
|
|
17879
|
-
hasDataValueView: { type: Boolean },
|
|
17880
18086
|
isEditing: { type: Boolean },
|
|
17881
|
-
inlineBlock: { type: Boolean }
|
|
18087
|
+
inlineBlock: { type: Boolean },
|
|
18088
|
+
enableDataValueView: { type: Boolean }
|
|
17882
18089
|
},
|
|
17883
18090
|
emits: ["click", "input", "select", "dataValueView"],
|
|
17884
18091
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -17889,34 +18096,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
17889
18096
|
const unpackedValue = computed(
|
|
17890
18097
|
() => unpackObjectRepresentation(props.cellData)
|
|
17891
18098
|
);
|
|
17892
|
-
const formattedValue = computed(
|
|
17893
|
-
() => props.formatter(unpackObjectRepresentation(unpackedValue.value))
|
|
17894
|
-
);
|
|
17895
18099
|
const title = computed(() => {
|
|
17896
18100
|
const { cellData } = props;
|
|
17897
18101
|
if (isMissingValue(cellData)) {
|
|
17898
18102
|
return getMissingValueMessage(cellData);
|
|
17899
18103
|
}
|
|
17900
|
-
if (
|
|
18104
|
+
if (unpackedValue.value === void 0) {
|
|
17901
18105
|
return null;
|
|
17902
18106
|
} else {
|
|
17903
|
-
return String(
|
|
17904
|
-
}
|
|
17905
|
-
});
|
|
17906
|
-
const classes = computed(() => {
|
|
17907
|
-
const { classGenerators } = props;
|
|
17908
|
-
if (classGenerators === void 0) {
|
|
17909
|
-
return [];
|
|
18107
|
+
return String(unpackedValue.value);
|
|
17910
18108
|
}
|
|
17911
|
-
return classGenerators.map((classItem) => {
|
|
17912
|
-
if (typeof classItem === "function") {
|
|
17913
|
-
return unpackedValue.value === void 0 ? null : classItem(unpackedValue.value);
|
|
17914
|
-
}
|
|
17915
|
-
if (typeof classItem === "object") {
|
|
17916
|
-
return classItem[unpackedValue.value];
|
|
17917
|
-
}
|
|
17918
|
-
return classItem;
|
|
17919
|
-
}).filter((obj) => obj !== null);
|
|
17920
18109
|
});
|
|
17921
18110
|
const cellRenderer = ref(null);
|
|
17922
18111
|
const getCellContentDimensions = () => cellRenderer.value?.getCellContentDimensions();
|
|
@@ -17930,16 +18119,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
17930
18119
|
ref_key: "cellRenderer",
|
|
17931
18120
|
ref: cellRenderer,
|
|
17932
18121
|
"is-missing": isMissing.value,
|
|
17933
|
-
"is-slotted": __props.
|
|
17934
|
-
text:
|
|
18122
|
+
"is-slotted": __props.column.hasSlotContent ?? false,
|
|
18123
|
+
text: unpackedValue.value,
|
|
17935
18124
|
title: title.value,
|
|
17936
18125
|
color: color.value,
|
|
17937
|
-
classes: classes.value,
|
|
17938
18126
|
"select-on-move": __props.selectOnMove,
|
|
17939
18127
|
"default-top-bottom-padding": __props.defaultTopBottomPadding,
|
|
17940
18128
|
"default-left-right-padding": __props.defaultLeftRightPadding,
|
|
18129
|
+
"no-padding-left-right": __props.column.noPaddingLeftRight,
|
|
18130
|
+
"no-padding-top-bottom": __props.column.noPaddingTopBottom,
|
|
17941
18131
|
size: __props.size,
|
|
17942
|
-
"enable-expand": !isMissing.value &&
|
|
18132
|
+
"enable-expand": !isMissing.value && __props.enableDataValueView && __props.column.hasDataValueView,
|
|
17943
18133
|
"is-selected": __props.isSelected,
|
|
17944
18134
|
"is-in-cell-selection": __props.isInCellSelection,
|
|
17945
18135
|
"is-to-be-expanded": __props.isToBeExpanded,
|
|
@@ -17958,7 +18148,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
17958
18148
|
])
|
|
17959
18149
|
};
|
|
17960
18150
|
})
|
|
17961
|
-
]), 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"]);
|
|
17962
18152
|
};
|
|
17963
18153
|
}
|
|
17964
18154
|
});
|
|
@@ -17977,7 +18167,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
17977
18167
|
rowData: { default: () => ({}) },
|
|
17978
18168
|
row: { default: () => [] },
|
|
17979
18169
|
tableConfig: {},
|
|
17980
|
-
|
|
18170
|
+
subMenuConfig: {},
|
|
18171
|
+
columns: {},
|
|
18172
|
+
colSizes: {},
|
|
17981
18173
|
rowConfig: { default: () => ({}) },
|
|
17982
18174
|
rowHeight: { default: DEFAULT_ROW_HEIGHT },
|
|
17983
18175
|
isSelected: { type: Boolean, default: false },
|
|
@@ -18013,34 +18205,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18013
18205
|
const activeDrag = ref(false);
|
|
18014
18206
|
const rowHeightOnDragStart = ref(0);
|
|
18015
18207
|
const columnKeys = computed(
|
|
18016
|
-
() => getPropertiesFromColumns(props.
|
|
18017
|
-
);
|
|
18018
|
-
const columnSizes = computed(
|
|
18019
|
-
() => getPropertiesFromColumns(props.columnConfigs, "size")
|
|
18020
|
-
);
|
|
18021
|
-
const formatters = computed(
|
|
18022
|
-
() => getPropertiesFromColumns(props.columnConfigs, "formatter")
|
|
18023
|
-
);
|
|
18024
|
-
const classGenerators = computed(
|
|
18025
|
-
() => getPropertiesFromColumns(props.columnConfigs, "classGenerator")
|
|
18026
|
-
);
|
|
18027
|
-
const slottedColumns = computed(
|
|
18028
|
-
() => getPropertiesFromColumns(props.columnConfigs, "hasSlotContent")
|
|
18029
|
-
);
|
|
18030
|
-
const hasDataValueView = computed(
|
|
18031
|
-
() => getPropertiesFromColumns(props.columnConfigs, "hasDataValueView")
|
|
18032
|
-
);
|
|
18033
|
-
const noPaddingTopBottom = computed(
|
|
18034
|
-
() => getPropertiesFromColumns(props.columnConfigs, "noPaddingTopBottom")
|
|
18035
|
-
);
|
|
18036
|
-
const noPaddingLeftRight = computed(
|
|
18037
|
-
() => getPropertiesFromColumns(props.columnConfigs, "noPaddingLeftRight")
|
|
18208
|
+
() => getPropertiesFromColumns(props.columns, "key")
|
|
18038
18209
|
);
|
|
18039
18210
|
const filteredSubMenuItems = computed(() => {
|
|
18040
|
-
if (!props.
|
|
18211
|
+
if (!props.subMenuConfig.subMenuItems?.length && !props.rowData?.subMenuItemsForRow?.length) {
|
|
18041
18212
|
return [];
|
|
18042
18213
|
}
|
|
18043
|
-
return props.rowData?.subMenuItemsForRow?.length ? props.rowData?.subMenuItemsForRow : props.
|
|
18214
|
+
return props.rowData?.subMenuItemsForRow?.length ? props.rowData?.subMenuItemsForRow : props.subMenuConfig.subMenuItems;
|
|
18044
18215
|
});
|
|
18045
18216
|
const onDeleteRow = () => {
|
|
18046
18217
|
emit("deleteRow");
|
|
@@ -18223,20 +18394,16 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18223
18394
|
cells.value[ind] = el;
|
|
18224
18395
|
},
|
|
18225
18396
|
key: ind,
|
|
18397
|
+
column: __props.columns[ind],
|
|
18226
18398
|
"cell-data": cell,
|
|
18227
18399
|
"select-on-move": __props.selectCellsOnMove,
|
|
18228
18400
|
"is-selected": __props.selectedCellIndex === ind,
|
|
18229
18401
|
"is-in-cell-selection": __props.cellSelectionRange !== null && ind >= __props.cellSelectionRange.min && ind <= __props.cellSelectionRange.max,
|
|
18230
18402
|
"is-to-be-expanded": __props.toBeExpandedCellIndex === ind,
|
|
18231
|
-
"
|
|
18232
|
-
"has-data-value-view": __props.tableConfig.enableDataValueViews && Boolean(hasDataValueView.value[ind]),
|
|
18403
|
+
"enable-data-value-view": __props.tableConfig.enableDataValueViews,
|
|
18233
18404
|
"is-editing": __props.toBeEditedCellIndex === ind,
|
|
18234
|
-
"no-padding-top-bottom": noPaddingTopBottom.value[ind],
|
|
18235
|
-
"no-padding-left-right": noPaddingLeftRight.value[ind],
|
|
18236
18405
|
"inline-block": __props.tableConfig.cellRendererInlineBlock,
|
|
18237
|
-
size:
|
|
18238
|
-
"class-generators": classGenerators.value[ind],
|
|
18239
|
-
formatter: formatters.value[ind],
|
|
18406
|
+
size: __props.colSizes[ind] ?? 100,
|
|
18240
18407
|
"default-top-bottom-padding": paddingTopBottom.value,
|
|
18241
18408
|
"default-left-right-padding": unref(paddingLeftRight),
|
|
18242
18409
|
onClick: ($event) => onCellClick($event, ind, cell),
|
|
@@ -18260,7 +18427,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18260
18427
|
}, void 0, true)
|
|
18261
18428
|
]),
|
|
18262
18429
|
_: 2
|
|
18263
|
-
}, 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"]);
|
|
18264
18431
|
}), 128)),
|
|
18265
18432
|
filteredSubMenuItems.value?.length ? (openBlock(), createElementBlock("td", _hoisted_2, [
|
|
18266
18433
|
createVNode(unref(_sfc_main$1h), {
|
|
@@ -18294,14 +18461,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
18294
18461
|
}
|
|
18295
18462
|
});
|
|
18296
18463
|
|
|
18297
|
-
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"]]);
|
|
18298
18465
|
|
|
18299
18466
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
18300
18467
|
__name: "CellSelectionOverlay",
|
|
18301
18468
|
props: {
|
|
18302
18469
|
rect: {},
|
|
18303
18470
|
rowHeight: {},
|
|
18304
|
-
|
|
18471
|
+
colSizes: {},
|
|
18305
18472
|
rowResizeIndex: {},
|
|
18306
18473
|
rowResizeDelta: {},
|
|
18307
18474
|
tableConfig: {},
|
|
@@ -18331,14 +18498,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18331
18498
|
if (props.tableConfig.showSelection) {
|
|
18332
18499
|
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18333
18500
|
}
|
|
18334
|
-
if (props.tableConfig.showCollapser) {
|
|
18335
|
-
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18336
|
-
}
|
|
18337
18501
|
if (props.tableConfig.enableRowDeletion) {
|
|
18338
18502
|
currentOffset += SPECIAL_COLUMNS_SIZE;
|
|
18339
18503
|
}
|
|
18340
18504
|
const offsets = [];
|
|
18341
|
-
props.
|
|
18505
|
+
props.colSizes.forEach((size) => {
|
|
18342
18506
|
offsets.push(currentOffset);
|
|
18343
18507
|
currentOffset += size;
|
|
18344
18508
|
});
|
|
@@ -18453,7 +18617,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18453
18617
|
}
|
|
18454
18618
|
});
|
|
18455
18619
|
|
|
18456
|
-
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"]]);
|
|
18457
18621
|
|
|
18458
18622
|
const _sfc_main$1 = {
|
|
18459
18623
|
components: {
|
|
@@ -18462,21 +18626,17 @@ const _sfc_main$1 = {
|
|
|
18462
18626
|
Row,
|
|
18463
18627
|
// TablePopover,
|
|
18464
18628
|
CellSelectionOverlay,
|
|
18465
|
-
TableCore: _sfc_main$
|
|
18629
|
+
TableCore: _sfc_main$i,
|
|
18466
18630
|
NewRowButton,
|
|
18467
18631
|
TableActionBar
|
|
18468
18632
|
},
|
|
18469
18633
|
props: {
|
|
18470
18634
|
/**
|
|
18471
18635
|
* Data props.
|
|
18472
|
-
*/
|
|
18473
|
-
data: {
|
|
18474
|
-
type: Array,
|
|
18475
|
-
default: () => []
|
|
18476
|
-
},
|
|
18477
|
-
currentSelection: {
|
|
18636
|
+
*/
|
|
18637
|
+
data: {
|
|
18478
18638
|
type: Array,
|
|
18479
|
-
|
|
18639
|
+
required: true
|
|
18480
18640
|
},
|
|
18481
18641
|
/**
|
|
18482
18642
|
* It specifies how many (empty) rows should be simultated above the given rows in this.data[0]
|
|
@@ -18500,6 +18660,10 @@ const _sfc_main$1 = {
|
|
|
18500
18660
|
type: Array,
|
|
18501
18661
|
default: () => []
|
|
18502
18662
|
},
|
|
18663
|
+
currentSelection: {
|
|
18664
|
+
type: Array,
|
|
18665
|
+
default: () => []
|
|
18666
|
+
},
|
|
18503
18667
|
/**
|
|
18504
18668
|
* analogous to currentSelection but for the bottomData
|
|
18505
18669
|
*/
|
|
@@ -18507,53 +18671,69 @@ const _sfc_main$1 = {
|
|
|
18507
18671
|
type: Array,
|
|
18508
18672
|
default: () => []
|
|
18509
18673
|
},
|
|
18510
|
-
totalSelected: {
|
|
18511
|
-
type: Number,
|
|
18512
|
-
default: 0
|
|
18513
|
-
},
|
|
18514
18674
|
/**
|
|
18515
18675
|
* Config props.
|
|
18516
18676
|
*/
|
|
18517
|
-
|
|
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: {
|
|
18518
18689
|
type: Object,
|
|
18519
18690
|
default: () => ({})
|
|
18520
18691
|
},
|
|
18692
|
+
/** Active sorts, ordered by sort priority. */
|
|
18693
|
+
colSortValues: {
|
|
18694
|
+
type: Array,
|
|
18695
|
+
default: () => []
|
|
18696
|
+
},
|
|
18697
|
+
/** Feature switches for the table. */
|
|
18521
18698
|
tableConfig: {
|
|
18522
18699
|
type: Object,
|
|
18523
|
-
default: () => ({})
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
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: () => ({})
|
|
18557
18737
|
},
|
|
18558
18738
|
disableRowHeightTransition: {
|
|
18559
18739
|
type: Boolean,
|
|
@@ -18694,9 +18874,7 @@ const _sfc_main$1 = {
|
|
|
18694
18874
|
editingCellInitialValue.value = initialValue ?? null;
|
|
18695
18875
|
};
|
|
18696
18876
|
const isEditingEnabled = computed(
|
|
18697
|
-
() => getPropertiesFromColumns(props.
|
|
18698
|
-
Boolean
|
|
18699
|
-
)
|
|
18877
|
+
() => getPropertiesFromColumns(props.columns, "editable").some(Boolean)
|
|
18700
18878
|
);
|
|
18701
18879
|
const { handleCopyOnKeydown, handleDeleteSelection } = useCellCopyPaste({
|
|
18702
18880
|
focusWithin,
|
|
@@ -18718,13 +18896,13 @@ const _sfc_main$1 = {
|
|
|
18718
18896
|
};
|
|
18719
18897
|
const toBeShownCell = ref(null);
|
|
18720
18898
|
const closeDataValueView = () => {
|
|
18721
|
-
if (props.
|
|
18899
|
+
if (props.tableState.dataValueViewIsShown) {
|
|
18722
18900
|
emit("closeDataValueView");
|
|
18723
18901
|
}
|
|
18724
18902
|
toBeShownCell.value = null;
|
|
18725
18903
|
};
|
|
18726
18904
|
provideDataValueViewsIsShown(
|
|
18727
|
-
toRef(props, "
|
|
18905
|
+
toRef(props, "tableState"),
|
|
18728
18906
|
closeDataValueView
|
|
18729
18907
|
);
|
|
18730
18908
|
const showNewColumnAndRowButton = computed(
|
|
@@ -18797,102 +18975,22 @@ const _sfc_main$1 = {
|
|
|
18797
18975
|
},
|
|
18798
18976
|
computed: {
|
|
18799
18977
|
minRowHeight() {
|
|
18800
|
-
return this.
|
|
18978
|
+
return this.rowConfig.compactMode ? COMPACT_ROW_HEIGHT : DEFAULT_ROW_HEIGHT;
|
|
18801
18979
|
},
|
|
18802
18980
|
initialRowHeight() {
|
|
18803
|
-
return this.
|
|
18981
|
+
return this.rowConfig?.rowHeight || this.minRowHeight;
|
|
18804
18982
|
},
|
|
18805
18983
|
currentRowHeight() {
|
|
18806
18984
|
return this.resizedRowHeight ?? this.initialRowHeight;
|
|
18807
18985
|
},
|
|
18808
|
-
/*
|
|
18809
|
-
* Current table config. E.g. if 4/10 columns displayed, 'current' fields return values w/ length 4.
|
|
18810
|
-
*/
|
|
18811
|
-
columnHeaders() {
|
|
18812
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "header");
|
|
18813
|
-
},
|
|
18814
|
-
columnSubHeaders() {
|
|
18815
|
-
return getPropertiesFromColumns(
|
|
18816
|
-
this.dataConfig.columnConfigs,
|
|
18817
|
-
"subHeader"
|
|
18818
|
-
);
|
|
18819
|
-
},
|
|
18820
|
-
columnHeaderSubMenuItems() {
|
|
18821
|
-
return getPropertiesFromColumns(
|
|
18822
|
-
this.dataConfig.columnConfigs,
|
|
18823
|
-
"headerSubMenuItems"
|
|
18824
|
-
).map(
|
|
18825
|
-
(menuItems, index) => useHeaderMenuItems({
|
|
18826
|
-
enableFiltering: Boolean(this.tableConfig.showColumnFilters),
|
|
18827
|
-
filterConfig: this.columnFilterConfigs[index],
|
|
18828
|
-
enableSorting: Boolean(this.tableConfig.sortConfig) && Boolean(this.columnSortConfigs[index]),
|
|
18829
|
-
sortDirection: this.tableConfig.sortConfig?.sortColumn === index ? this.tableConfig.sortConfig?.sortDirection ?? 0 : 0,
|
|
18830
|
-
headerSubMenuItems: menuItems,
|
|
18831
|
-
sortTexts: columnSortText[this.columnTypes[index] ?? "default"],
|
|
18832
|
-
onColumnSort: (direction) => this.onColumnSort(index, direction),
|
|
18833
|
-
openFilterControl: () => this.openActionBarFilterControl(index),
|
|
18834
|
-
clearFilter: () => this.clearColumnFilter(index)
|
|
18835
|
-
})
|
|
18836
|
-
);
|
|
18837
|
-
},
|
|
18838
|
-
columnSizes() {
|
|
18839
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "size");
|
|
18840
|
-
},
|
|
18841
|
-
columnTypes() {
|
|
18842
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "type");
|
|
18843
|
-
},
|
|
18844
18986
|
selectedHeaderIndex() {
|
|
18845
18987
|
return this.selectedCell?.y === -1 ? this.selectedCell.x : null;
|
|
18846
18988
|
},
|
|
18847
|
-
columnKeys() {
|
|
18848
|
-
return getPropertiesFromColumns(this.dataConfig.columnConfigs, "key");
|
|
18849
|
-
},
|
|
18850
|
-
columnSortConfigs() {
|
|
18851
|
-
return getPropertiesFromColumns(
|
|
18852
|
-
this.dataConfig.columnConfigs,
|
|
18853
|
-
"isSortable"
|
|
18854
|
-
).map((isSortable) => isSortable ?? true);
|
|
18855
|
-
},
|
|
18856
|
-
columnFilterConfigs() {
|
|
18857
|
-
return getPropertiesFromColumns(
|
|
18858
|
-
this.dataConfig.columnConfigs,
|
|
18859
|
-
"filterConfig"
|
|
18860
|
-
);
|
|
18861
|
-
},
|
|
18862
|
-
columnHeaderColors() {
|
|
18863
|
-
return getPropertiesFromColumns(
|
|
18864
|
-
this.dataConfig.columnConfigs,
|
|
18865
|
-
"headerColor"
|
|
18866
|
-
).map((color) => color ?? null);
|
|
18867
|
-
},
|
|
18868
|
-
columnDeletables() {
|
|
18869
|
-
return getPropertiesFromColumns(
|
|
18870
|
-
this.dataConfig.columnConfigs,
|
|
18871
|
-
"deletable"
|
|
18872
|
-
);
|
|
18873
|
-
},
|
|
18874
|
-
columnEditables() {
|
|
18875
|
-
return getPropertiesFromColumns(
|
|
18876
|
-
this.dataConfig.columnConfigs,
|
|
18877
|
-
"editable"
|
|
18878
|
-
);
|
|
18879
|
-
},
|
|
18880
18989
|
slottedColumns() {
|
|
18881
|
-
return getPropertiesFromColumns(
|
|
18882
|
-
this.dataConfig.columnConfigs,
|
|
18883
|
-
"hasSlotContent"
|
|
18884
|
-
).map(
|
|
18990
|
+
return getPropertiesFromColumns(this.columns, "hasSlotContent").map(
|
|
18885
18991
|
(hasSlotContent, colInd) => hasSlotContent ? colInd : null
|
|
18886
18992
|
).filter((colInd) => colInd !== null);
|
|
18887
18993
|
},
|
|
18888
|
-
tableHeaderClass() {
|
|
18889
|
-
return [
|
|
18890
|
-
"table-header",
|
|
18891
|
-
{
|
|
18892
|
-
"sub-menu-active": this.tableConfig.subMenuItems?.length
|
|
18893
|
-
}
|
|
18894
|
-
];
|
|
18895
|
-
},
|
|
18896
18994
|
topDataLength() {
|
|
18897
18995
|
if (this.data === null || this.data.length === 0) {
|
|
18898
18996
|
return 0;
|
|
@@ -18932,9 +19030,6 @@ const _sfc_main$1 = {
|
|
|
18932
19030
|
return isTop ? this.currentSelection[groupInd][indexInInput] : this.currentBottomSelection[indexInInput];
|
|
18933
19031
|
};
|
|
18934
19032
|
},
|
|
18935
|
-
enableRowResize() {
|
|
18936
|
-
return this.dataConfig.rowConfig.enableResizing;
|
|
18937
|
-
},
|
|
18938
19033
|
scrollerItemSize() {
|
|
18939
19034
|
if (this.currentRowHeight === "dynamic") {
|
|
18940
19035
|
return this.minRowHeight;
|
|
@@ -18944,14 +19039,16 @@ const _sfc_main$1 = {
|
|
|
18944
19039
|
sortControlOptions() {
|
|
18945
19040
|
const selectableColumns = [];
|
|
18946
19041
|
const selectableDirections = {};
|
|
18947
|
-
this.
|
|
18948
|
-
if (
|
|
19042
|
+
this.columns.forEach((column) => {
|
|
19043
|
+
if (column.isNotSortable) {
|
|
18949
19044
|
return;
|
|
18950
19045
|
}
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
19046
|
+
selectableColumns.push({
|
|
19047
|
+
id: column.id,
|
|
19048
|
+
text: column.header
|
|
19049
|
+
});
|
|
19050
|
+
const sortTexts = columnSortText[column.type ?? "default"];
|
|
19051
|
+
selectableDirections[column.id] = [
|
|
18955
19052
|
{ id: "1", text: sortTexts.ascending },
|
|
18956
19053
|
{ id: "-1", text: sortTexts.descending }
|
|
18957
19054
|
];
|
|
@@ -18960,12 +19057,12 @@ const _sfc_main$1 = {
|
|
|
18960
19057
|
}
|
|
18961
19058
|
},
|
|
18962
19059
|
watch: {
|
|
18963
|
-
"
|
|
19060
|
+
"rowConfig.compactMode": {
|
|
18964
19061
|
handler() {
|
|
18965
19062
|
this.resetRowHeight();
|
|
18966
19063
|
}
|
|
18967
19064
|
},
|
|
18968
|
-
"
|
|
19065
|
+
"rowConfig.rowHeight": {
|
|
18969
19066
|
handler() {
|
|
18970
19067
|
this.resetRowHeight();
|
|
18971
19068
|
}
|
|
@@ -19047,6 +19144,10 @@ const _sfc_main$1 = {
|
|
|
19047
19144
|
this.clearCellSelection();
|
|
19048
19145
|
this.$emit("columnSort", colInd, sortDirection);
|
|
19049
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
|
+
},
|
|
19050
19151
|
onSelectAll(selected) {
|
|
19051
19152
|
consola.debug(`TableUI emitting: selectAll ${selected}`);
|
|
19052
19153
|
this.$emit("selectAll", selected);
|
|
@@ -19068,7 +19169,7 @@ const _sfc_main$1 = {
|
|
|
19068
19169
|
this.selectCell(
|
|
19069
19170
|
{ x: cellInd, y: rowInd },
|
|
19070
19171
|
groupInd === null ? isTop : groupInd,
|
|
19071
|
-
ignoreIfSelected || Boolean(this.
|
|
19172
|
+
ignoreIfSelected || Boolean(this.columns[cellInd]?.editable)
|
|
19072
19173
|
);
|
|
19073
19174
|
this.stopEditingCell();
|
|
19074
19175
|
},
|
|
@@ -19076,9 +19177,7 @@ const _sfc_main$1 = {
|
|
|
19076
19177
|
if (this.toBeEditedCell && this.toBeEditedCell.x === cellInd && this.toBeEditedCell.y === rowInd) {
|
|
19077
19178
|
return;
|
|
19078
19179
|
}
|
|
19079
|
-
const isEditable = Boolean(
|
|
19080
|
-
this.dataConfig.columnConfigs[cellInd]?.editable
|
|
19081
|
-
);
|
|
19180
|
+
const isEditable = Boolean(this.columns[cellInd]?.editable);
|
|
19082
19181
|
if (isEditable && this.isSingleSelectedCell({ x: cellInd, y: rowInd })) {
|
|
19083
19182
|
this.onStartEditingCell();
|
|
19084
19183
|
} else {
|
|
@@ -19101,7 +19200,7 @@ const _sfc_main$1 = {
|
|
|
19101
19200
|
onTableBodyFocusOut() {
|
|
19102
19201
|
this.changeFocus(false);
|
|
19103
19202
|
if (this.selectedCell) {
|
|
19104
|
-
if (this.
|
|
19203
|
+
if (this.columns[this.selectedCell.x]?.editable) {
|
|
19105
19204
|
this.selectCell(this.selectedCell, this.currentRectId ?? 0, true);
|
|
19106
19205
|
} else {
|
|
19107
19206
|
this.clearCellSelection();
|
|
@@ -19164,8 +19263,7 @@ const _sfc_main$1 = {
|
|
|
19164
19263
|
this.stopEditingCell();
|
|
19165
19264
|
},
|
|
19166
19265
|
onMoveSelectionOutOfBodyUp({ columnInd }) {
|
|
19167
|
-
|
|
19168
|
-
if (!isHeaderFocusable) {
|
|
19266
|
+
if (!this.header?.isColumnHeaderFocusable(columnInd)) {
|
|
19169
19267
|
return;
|
|
19170
19268
|
}
|
|
19171
19269
|
this.clearCellSelection();
|
|
@@ -19198,7 +19296,7 @@ const _sfc_main$1 = {
|
|
|
19198
19296
|
}
|
|
19199
19297
|
},
|
|
19200
19298
|
onMoveIntoBodyFromRight() {
|
|
19201
|
-
const lastColumnInd = this.
|
|
19299
|
+
const lastColumnInd = this.columns.length - 1;
|
|
19202
19300
|
const lastRowAndRectId = this.lastRowAndRectIdBeforeMovingToNewColumnButton ?? {
|
|
19203
19301
|
rowInd: -1,
|
|
19204
19302
|
rectId: null
|
|
@@ -19287,7 +19385,7 @@ const _sfc_main$1 = {
|
|
|
19287
19385
|
if (direction === "right") {
|
|
19288
19386
|
if (type === "delete" && this.tableConfig.showSelection) {
|
|
19289
19387
|
this.focusRowVirtualColumn("selection", rowInd, rectId);
|
|
19290
|
-
} else if (this.
|
|
19388
|
+
} else if (this.columns.length > 0) {
|
|
19291
19389
|
this.onMoveIntoBodyFromLeft(rowInd, rectId);
|
|
19292
19390
|
}
|
|
19293
19391
|
} else if (direction === "left") {
|
|
@@ -19328,7 +19426,7 @@ const _sfc_main$1 = {
|
|
|
19328
19426
|
});
|
|
19329
19427
|
return;
|
|
19330
19428
|
}
|
|
19331
|
-
if (columnInd === this.
|
|
19429
|
+
if (columnInd === this.columns.length) {
|
|
19332
19430
|
this.onMoveSelectionOutOfBodyRight({
|
|
19333
19431
|
rowInd,
|
|
19334
19432
|
rectId: this.currentRectId
|
|
@@ -19346,7 +19444,7 @@ const _sfc_main$1 = {
|
|
|
19346
19444
|
expandSelection
|
|
19347
19445
|
);
|
|
19348
19446
|
await this.scrollToCellSelectionOverlay();
|
|
19349
|
-
this.toBeShownCell = this.
|
|
19447
|
+
this.toBeShownCell = this.tableState.dataValueViewIsShown ? this.selectedCell : null;
|
|
19350
19448
|
},
|
|
19351
19449
|
async expandSelectedCell() {
|
|
19352
19450
|
if (this.selectedCell && this.tableConfig.enableDataValueViews) {
|
|
@@ -19355,7 +19453,7 @@ const _sfc_main$1 = {
|
|
|
19355
19453
|
}
|
|
19356
19454
|
},
|
|
19357
19455
|
onStartEditingCell(initialValue) {
|
|
19358
|
-
if (this.selectedCell && this.
|
|
19456
|
+
if (this.selectedCell && this.columns[this.selectedCell.x]?.editable) {
|
|
19359
19457
|
this.setToBeEditedCell(this.selectedCell, initialValue);
|
|
19360
19458
|
}
|
|
19361
19459
|
},
|
|
@@ -19423,8 +19521,8 @@ const _sfc_main$1 = {
|
|
|
19423
19521
|
this.columnResizeActive = false;
|
|
19424
19522
|
this.$emit("columnResizeEnd");
|
|
19425
19523
|
},
|
|
19426
|
-
getCellContentSlotName(
|
|
19427
|
-
return `cellContent-${
|
|
19524
|
+
getCellContentSlotName(columns, columnId) {
|
|
19525
|
+
return `cellContent-${columns[columnId].key}`;
|
|
19428
19526
|
},
|
|
19429
19527
|
getHeaderComponent() {
|
|
19430
19528
|
return this.$refs.header;
|
|
@@ -19456,8 +19554,8 @@ const _sfc_main$1 = {
|
|
|
19456
19554
|
},
|
|
19457
19555
|
getRowData(row) {
|
|
19458
19556
|
const isEmptyArray = Array.isArray(row) && row.length === 0;
|
|
19459
|
-
return isEmptyArray ? row : this.
|
|
19460
|
-
(column) => row[column]
|
|
19557
|
+
return isEmptyArray ? row : this.columns.map(
|
|
19558
|
+
(column) => row[column.key]
|
|
19461
19559
|
);
|
|
19462
19560
|
},
|
|
19463
19561
|
getRowRefName(groupInd, rowInd) {
|
|
@@ -19494,7 +19592,7 @@ const _sfc_main$1 = {
|
|
|
19494
19592
|
this.$refs.actionBar?.openFilterControl(columnIndex);
|
|
19495
19593
|
},
|
|
19496
19594
|
clearColumnFilter(columnIndex) {
|
|
19497
|
-
const config = this.
|
|
19595
|
+
const config = this.columns[columnIndex].filterConfig;
|
|
19498
19596
|
if (config) {
|
|
19499
19597
|
this.$emit("columnFilter", columnIndex, defaultValueFor(config.is));
|
|
19500
19598
|
}
|
|
@@ -19512,26 +19610,25 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19512
19610
|
const _component_TableCore = resolveComponent("TableCore");
|
|
19513
19611
|
const _component_PageControls = resolveComponent("PageControls");
|
|
19514
19612
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19515
|
-
|
|
19613
|
+
$props.actionConfig ? (openBlock(), createBlock(_component_TableActionBar, {
|
|
19614
|
+
key: 0,
|
|
19516
19615
|
ref: "actionBar",
|
|
19517
|
-
"all-rows-count": $props.
|
|
19518
|
-
"filtered-rows-count": $props.
|
|
19519
|
-
"all-columns-count": $props.
|
|
19520
|
-
"filtered-columns-count": $
|
|
19521
|
-
title: $props.
|
|
19522
|
-
"row-label": $props.tableConfig.
|
|
19523
|
-
"show-table-size": $props.tableConfig.
|
|
19524
|
-
"
|
|
19525
|
-
"
|
|
19526
|
-
"
|
|
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,
|
|
19527
19626
|
"sort-control-options": $options.sortControlOptions,
|
|
19528
|
-
|
|
19529
|
-
"column-headers": $options.columnHeaders,
|
|
19530
|
-
"settings-items": $props.tableConfig.settingsItems,
|
|
19627
|
+
columns: $props.columns,
|
|
19531
19628
|
onResetTemporaryView: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("resetTemporaryView")),
|
|
19532
19629
|
onColumnFilter: _cache[1] || (_cache[1] = (colInd, value) => _ctx.$emit("columnFilter", colInd, value)),
|
|
19533
|
-
onOnColumnSort: $options.
|
|
19534
|
-
}, 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),
|
|
19535
19632
|
createElementVNode("table", {
|
|
19536
19633
|
ref: "wrapper",
|
|
19537
19634
|
tabindex: -1,
|
|
@@ -19549,14 +19646,15 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19549
19646
|
ref: "tableCore",
|
|
19550
19647
|
"scroll-data": $options.scrollData,
|
|
19551
19648
|
"total-width": $setup.totalWidth,
|
|
19552
|
-
"
|
|
19649
|
+
"col-sizes": $props.colSizes,
|
|
19553
19650
|
"column-resize": { active: $data.columnResizeActive },
|
|
19554
19651
|
"table-config": $props.tableConfig,
|
|
19652
|
+
"sub-menu-config": $props.subMenuConfig,
|
|
19555
19653
|
"scroll-config": {
|
|
19556
19654
|
itemSize: $options.scrollerItemSize,
|
|
19557
19655
|
numRowsAbove: $props.numRowsAbove,
|
|
19558
19656
|
numRowsBelow: $props.numRowsBelow,
|
|
19559
|
-
compact: Boolean($props.
|
|
19657
|
+
compact: Boolean($props.rowConfig.compactMode)
|
|
19560
19658
|
},
|
|
19561
19659
|
"current-row-height": $options.currentRowHeight,
|
|
19562
19660
|
"new-column-button-width": $setup.newColumnButtonWidth,
|
|
@@ -19575,9 +19673,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19575
19673
|
"row-data": row,
|
|
19576
19674
|
row: $options.getRowData(row),
|
|
19577
19675
|
"table-config": $props.tableConfig,
|
|
19578
|
-
"
|
|
19579
|
-
"
|
|
19580
|
-
|
|
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,
|
|
19581
19681
|
"row-height": $options.currentRowHeight,
|
|
19582
19682
|
"min-row-height": $options.minRowHeight,
|
|
19583
19683
|
"is-selected": $options.currentSelectionMap(rowInd, groupInd || 0),
|
|
@@ -19620,12 +19720,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19620
19720
|
}, [
|
|
19621
19721
|
renderList($options.slottedColumns, (colInd) => {
|
|
19622
19722
|
return {
|
|
19623
|
-
name: $options.getCellContentSlotName($
|
|
19723
|
+
name: $options.getCellContentSlotName($props.columns, colInd),
|
|
19624
19724
|
fn: withCtx((cellData) => [
|
|
19625
|
-
renderSlot(_ctx.$slots, `cellContent-${$
|
|
19725
|
+
renderSlot(_ctx.$slots, `cellContent-${$props.columns[colInd].key}`, {
|
|
19626
19726
|
data: {
|
|
19627
19727
|
...cellData,
|
|
19628
|
-
key: $
|
|
19728
|
+
key: $props.columns[colInd].key,
|
|
19629
19729
|
rowInd,
|
|
19630
19730
|
colInd
|
|
19631
19731
|
}
|
|
@@ -19633,26 +19733,31 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19633
19733
|
])
|
|
19634
19734
|
};
|
|
19635
19735
|
})
|
|
19636
|
-
]), 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"])
|
|
19637
19737
|
]),
|
|
19638
19738
|
header: withCtx(({ getDragHandleHeight, width = null }) => [
|
|
19639
19739
|
createVNode(_component_Header, {
|
|
19640
19740
|
ref: "header",
|
|
19641
19741
|
style: normalizeStyle(width === null ? {} : { width: `${width}px` }),
|
|
19642
19742
|
"table-config": $props.tableConfig,
|
|
19643
|
-
"
|
|
19644
|
-
|
|
19645
|
-
"
|
|
19646
|
-
"
|
|
19647
|
-
"
|
|
19648
|
-
"column-deletables": $options.columnDeletables,
|
|
19649
|
-
"column-editables": $options.columnEditables,
|
|
19650
|
-
"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,
|
|
19651
19748
|
"get-drag-handle-height": getDragHandleHeight,
|
|
19652
|
-
class: normalizeClass(
|
|
19749
|
+
class: normalizeClass([
|
|
19750
|
+
"table-header",
|
|
19751
|
+
{
|
|
19752
|
+
"sub-menu-active": $props.subMenuConfig.subMenuItems?.length
|
|
19753
|
+
}
|
|
19754
|
+
]),
|
|
19653
19755
|
"show-new-column-button": $setup.showNewColumnAndRowButton,
|
|
19654
19756
|
"selected-header-index": $options.selectedHeaderIndex,
|
|
19655
19757
|
onHeaderSelect: $options.onSelectAll,
|
|
19758
|
+
onColumnSort: $options.onColumnSort,
|
|
19759
|
+
onOpenActionBarFilterControl: $options.openActionBarFilterControl,
|
|
19760
|
+
onClearColumnFilter: $options.clearColumnFilter,
|
|
19656
19761
|
onDeleteColumn: $options.onDeleteColumn,
|
|
19657
19762
|
onColumnResize: $options.onColumnResize,
|
|
19658
19763
|
onAllColumnsResize: $options.onAllColumnsResize,
|
|
@@ -19671,7 +19776,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19671
19776
|
renderSlot(_ctx.$slots, "subHeader", normalizeProps(guardReactiveProps(slotProps)), void 0, true)
|
|
19672
19777
|
]),
|
|
19673
19778
|
_: 3
|
|
19674
|
-
}, 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"])
|
|
19675
19780
|
]),
|
|
19676
19781
|
"cell-selection-overlay": withCtx(() => [
|
|
19677
19782
|
$setup.rectMinMax && !$setup.isEditingCell && $options.selectedHeaderIndex === null ? (openBlock(), createBlock(_component_CellSelectionOverlay, {
|
|
@@ -19682,9 +19787,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19682
19787
|
"table-config": $props.tableConfig,
|
|
19683
19788
|
"row-resize-index": $data.currentResizedScrollIndex,
|
|
19684
19789
|
"row-resize-delta": $data.currentRowSizeDelta,
|
|
19685
|
-
"
|
|
19790
|
+
"col-sizes": $props.colSizes,
|
|
19686
19791
|
"cell-selection-rect-focus-corner": $setup.focusWithin ? $setup.selectedCell : void 0
|
|
19687
|
-
}, 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)
|
|
19688
19793
|
]),
|
|
19689
19794
|
belowBody: withCtx(() => [
|
|
19690
19795
|
$setup.showNewColumnAndRowButton ? (openBlock(), createBlock(_component_NewRowButton, {
|
|
@@ -19697,17 +19802,20 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19697
19802
|
}, null, 8, ["onClick", "onKeydownUp"])) : createCommentVNode("", true)
|
|
19698
19803
|
]),
|
|
19699
19804
|
_: 3
|
|
19700
|
-
}, 8, ["scroll-data", "total-width", "
|
|
19701
|
-
$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, {
|
|
19702
19807
|
key: 0,
|
|
19703
|
-
"page-config": $props.
|
|
19808
|
+
"page-config": $props.pageConfig,
|
|
19809
|
+
"table-config": $props.tableConfig,
|
|
19810
|
+
"page-state": $props.pageState,
|
|
19811
|
+
"table-state": $props.tableState,
|
|
19704
19812
|
onPageChange: $options.onPageChange,
|
|
19705
19813
|
onPageSizeUpdate: $options.onPageSizeUpdate
|
|
19706
|
-
}, null, 8, ["page-config", "onPageChange", "onPageSizeUpdate"])) : createCommentVNode("", true)
|
|
19814
|
+
}, null, 8, ["page-config", "table-config", "page-state", "table-state", "onPageChange", "onPageSizeUpdate"])) : createCommentVNode("", true)
|
|
19707
19815
|
], 544)
|
|
19708
19816
|
]);
|
|
19709
19817
|
}
|
|
19710
|
-
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"]]);
|
|
19711
19819
|
|
|
19712
19820
|
const useTableReady = ({ onReady }) => {
|
|
19713
19821
|
const autoSizesInitialized = ref(false);
|
|
@@ -19747,7 +19855,18 @@ const _sfc_main = {
|
|
|
19747
19855
|
type: Array,
|
|
19748
19856
|
default: () => []
|
|
19749
19857
|
},
|
|
19750
|
-
|
|
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: {
|
|
19751
19870
|
type: Object,
|
|
19752
19871
|
default: () => ({})
|
|
19753
19872
|
},
|
|
@@ -19755,6 +19874,54 @@ const _sfc_main = {
|
|
|
19755
19874
|
type: Object,
|
|
19756
19875
|
default: () => ({})
|
|
19757
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
|
+
},
|
|
19758
19925
|
/** This object contains all the options necessary to calculate the sizes based on the
|
|
19759
19926
|
* content. In case only one of calculateForBody/calculateForHeader is true, the emitted object contains auto
|
|
19760
19927
|
* sizes according to body/header. In case both are true, the maximum of both values is used. For fixedSizes only
|
|
@@ -19803,8 +19970,8 @@ const _sfc_main = {
|
|
|
19803
19970
|
mountTableUIForAutoSizeCalculation() {
|
|
19804
19971
|
return this.data !== null && this.calculateSizes;
|
|
19805
19972
|
},
|
|
19806
|
-
|
|
19807
|
-
return getPropertiesFromColumns(this.
|
|
19973
|
+
columnIds() {
|
|
19974
|
+
return getPropertiesFromColumns(this.columns, "id");
|
|
19808
19975
|
},
|
|
19809
19976
|
currentColumnsWithAutoSize() {
|
|
19810
19977
|
return /* @__PURE__ */ new Set([
|
|
@@ -19815,7 +19982,7 @@ const _sfc_main = {
|
|
|
19815
19982
|
removedColumnIds() {
|
|
19816
19983
|
const removedColumnIds = /* @__PURE__ */ new Set();
|
|
19817
19984
|
this.currentColumnsWithAutoSize.forEach((columnId) => {
|
|
19818
|
-
if (!this.
|
|
19985
|
+
if (!this.columnIds.includes(columnId)) {
|
|
19819
19986
|
removedColumnIds.add(columnId);
|
|
19820
19987
|
}
|
|
19821
19988
|
});
|
|
@@ -19823,7 +19990,7 @@ const _sfc_main = {
|
|
|
19823
19990
|
},
|
|
19824
19991
|
addedColumnIds() {
|
|
19825
19992
|
const addedColumnIds = /* @__PURE__ */ new Set();
|
|
19826
|
-
this.
|
|
19993
|
+
this.columnIds.forEach((columnId) => {
|
|
19827
19994
|
if (!this.currentColumnsWithAutoSize.has(columnId)) {
|
|
19828
19995
|
addedColumnIds.add(columnId);
|
|
19829
19996
|
}
|
|
@@ -19836,19 +20003,11 @@ const _sfc_main = {
|
|
|
19836
20003
|
paginatedDataForAutoColumnSizesCalculation() {
|
|
19837
20004
|
return [this.data.flat().slice(0, DEFAULT_NUM_ROWS)];
|
|
19838
20005
|
},
|
|
19839
|
-
|
|
19840
|
-
return
|
|
19841
|
-
...this.dataConfig,
|
|
19842
|
-
columnConfigs: this.dataConfig.columnConfigs.map(
|
|
19843
|
-
(columnConfig) => ({
|
|
19844
|
-
...columnConfig,
|
|
19845
|
-
size: MAX_AUTO_COLUMN_SIZE
|
|
19846
|
-
})
|
|
19847
|
-
)
|
|
19848
|
-
};
|
|
20006
|
+
colSizesForCalculationWithAutoColumnSizes() {
|
|
20007
|
+
return this.columnIds.map(() => MAX_AUTO_COLUMN_SIZE);
|
|
19849
20008
|
},
|
|
19850
|
-
|
|
19851
|
-
return this.autoColumnSizingActive ? this.
|
|
20009
|
+
colSizesForAutoSizesCalculation() {
|
|
20010
|
+
return this.autoColumnSizingActive ? this.colSizesForCalculationWithAutoColumnSizes : this.colSizes;
|
|
19852
20011
|
},
|
|
19853
20012
|
tableConfigForAutoSizesCalculation() {
|
|
19854
20013
|
return {
|
|
@@ -19867,7 +20026,7 @@ const _sfc_main = {
|
|
|
19867
20026
|
return this.autoColumnSizingActive && !this.useSavedColumnSizes;
|
|
19868
20027
|
},
|
|
19869
20028
|
columnPaddingsHorizontal() {
|
|
19870
|
-
return this.
|
|
20029
|
+
return this.columnIds.reduce(
|
|
19871
20030
|
(paddings, columnId) => {
|
|
19872
20031
|
paddings[columnId] = CELL_PADDING_HORIZONTAL * 2;
|
|
19873
20032
|
return paddings;
|
|
@@ -19902,12 +20061,12 @@ const _sfc_main = {
|
|
|
19902
20061
|
},
|
|
19903
20062
|
deep: true
|
|
19904
20063
|
},
|
|
19905
|
-
|
|
20064
|
+
columnIds(newIds, oldIds) {
|
|
19906
20065
|
if (newIds.length !== oldIds.length || !newIds.every((el, index) => el === oldIds[index])) {
|
|
19907
20066
|
this.triggerCalculationOfAutoSizes();
|
|
19908
20067
|
}
|
|
19909
20068
|
},
|
|
19910
|
-
"
|
|
20069
|
+
"rowConfig.compactMode": {
|
|
19911
20070
|
handler() {
|
|
19912
20071
|
if (this.autoRowHeightOptions.calculate) {
|
|
19913
20072
|
this.useSavedColumnSizes = true;
|
|
@@ -19919,7 +20078,7 @@ const _sfc_main = {
|
|
|
19919
20078
|
mounted() {
|
|
19920
20079
|
if (this.autoRowHeightSizingActive) {
|
|
19921
20080
|
const unwatchRowHeight = this.$watch(
|
|
19922
|
-
() => this.
|
|
20081
|
+
() => this.rowConfig.rowHeight,
|
|
19923
20082
|
async () => {
|
|
19924
20083
|
await sleep(0);
|
|
19925
20084
|
this.disableRowHeightTransition = false;
|
|
@@ -20013,7 +20172,7 @@ const _sfc_main = {
|
|
|
20013
20172
|
this.emitNewAutoSizes();
|
|
20014
20173
|
},
|
|
20015
20174
|
initializeSizesWithMinSize(minSize) {
|
|
20016
|
-
return this.
|
|
20175
|
+
return this.columnIds.reduce(
|
|
20017
20176
|
(sizes, columnId) => ({
|
|
20018
20177
|
...sizes,
|
|
20019
20178
|
[columnId]: minSize
|
|
@@ -20054,7 +20213,7 @@ const _sfc_main = {
|
|
|
20054
20213
|
const sizesByColumn = {};
|
|
20055
20214
|
const heightsByColumn = {};
|
|
20056
20215
|
const cellComponents = rowComponent.getCellComponents();
|
|
20057
|
-
this.
|
|
20216
|
+
this.columnIds.forEach((columnId, columnIndex) => {
|
|
20058
20217
|
if (!fixedSizes.hasOwnProperty(columnId)) {
|
|
20059
20218
|
const { width, height } = cellComponents[columnIndex].getCellContentDimensions();
|
|
20060
20219
|
sizesByColumn[columnId] = width;
|
|
@@ -20068,7 +20227,7 @@ const _sfc_main = {
|
|
|
20068
20227
|
},
|
|
20069
20228
|
calculateAndSetAutoColumnSizesHeader() {
|
|
20070
20229
|
const headerCellSizes = this.$refs.tableUIForAutoSize.getHeaderComponent().getHeaderCellWidths();
|
|
20071
|
-
this.
|
|
20230
|
+
this.columnIds.forEach((columnId, columnIndex) => {
|
|
20072
20231
|
const headerWidth = headerCellSizes[columnIndex];
|
|
20073
20232
|
if (this.currentColumnSizes[columnId] < headerWidth) {
|
|
20074
20233
|
this.currentColumnSizes[columnId] = headerWidth;
|
|
@@ -20114,8 +20273,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20114
20273
|
}, _ctx.$attrs, {
|
|
20115
20274
|
data: $props.data,
|
|
20116
20275
|
"current-selection": $props.currentSelection,
|
|
20117
|
-
"
|
|
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,
|
|
20118
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,
|
|
20119
20292
|
"disable-row-height-transition": $data.disableRowHeightTransition,
|
|
20120
20293
|
"onUpdate:availableWidth": $options.onUpdateAvailableWidth
|
|
20121
20294
|
}), createSlots({ _: 2 }, [
|
|
@@ -20127,14 +20300,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20127
20300
|
])
|
|
20128
20301
|
};
|
|
20129
20302
|
})
|
|
20130
|
-
]), 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"]),
|
|
20131
20304
|
$options.mountTableUIForAutoSizeCalculation ? (openBlock(), createBlock(_component_TableUI, {
|
|
20132
20305
|
key: 0,
|
|
20133
20306
|
ref: "tableUIForAutoSize",
|
|
20134
20307
|
class: "table-column-size-calculation",
|
|
20135
20308
|
data: $options.paginatedDataForAutoColumnSizesCalculation,
|
|
20136
20309
|
"current-selection": $props.currentSelection,
|
|
20137
|
-
|
|
20310
|
+
columns: $props.columns,
|
|
20311
|
+
"col-sizes": $options.colSizesForAutoSizesCalculation,
|
|
20312
|
+
"row-config": $props.rowConfig,
|
|
20138
20313
|
"table-config": $options.tableConfigForAutoSizesCalculation,
|
|
20139
20314
|
onVnodeMounted: $options.calculateAutoSizes
|
|
20140
20315
|
}, createSlots({ _: 2 }, [
|
|
@@ -20146,603 +20321,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20146
20321
|
])
|
|
20147
20322
|
};
|
|
20148
20323
|
})
|
|
20149
|
-
]), 1032, ["data", "current-selection", "
|
|
20324
|
+
]), 1032, ["data", "current-selection", "columns", "col-sizes", "row-config", "table-config", "onVnodeMounted"])) : createCommentVNode("", true)
|
|
20150
20325
|
], 64);
|
|
20151
20326
|
}
|
|
20152
|
-
const TableUIWithAutoSizeCalculation = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
20153
|
-
|
|
20154
|
-
const getColumnDomains = ({ data, formatters, types }) => {
|
|
20155
|
-
let domainMap = {};
|
|
20156
|
-
let nominalColumns = [];
|
|
20157
|
-
Object.entries(types).forEach((entry) => {
|
|
20158
|
-
let [col, colType] = entry;
|
|
20159
|
-
// treat boolean as nominal (as they can have formatted domains)
|
|
20160
|
-
if ([columnTypes.Boolean, columnTypes.Nominal].includes(colType)) {
|
|
20161
|
-
nominalColumns.push(col);
|
|
20162
|
-
domainMap[col] = [];
|
|
20163
|
-
}
|
|
20164
|
-
});
|
|
20165
|
-
data.forEach((row) => {
|
|
20166
|
-
nominalColumns.forEach((col) => {
|
|
20167
|
-
const cellValue = unpackObjectRepresentation(row[col]);
|
|
20168
|
-
const formattedCellValue = formatters?.[col]?.(cellValue) || cellValue;
|
|
20169
|
-
if (!domainMap[col].includes(formattedCellValue)) {
|
|
20170
|
-
domainMap[col].push(formattedCellValue);
|
|
20171
|
-
}
|
|
20172
|
-
});
|
|
20173
|
-
});
|
|
20174
|
-
return domainMap;
|
|
20175
|
-
};
|
|
20176
|
-
|
|
20177
|
-
const getDefaultFilterValues = (columns, types) => columns.reduce((obj, col) => {
|
|
20178
|
-
obj[col] = columnFilterConfigs[types[col]].getInitialValue();
|
|
20179
|
-
return obj;
|
|
20180
|
-
}, {});
|
|
20181
|
-
const getInitialFilterValues = (columns, types, initialFilterValues) => columns.reduce((obj, col) => {
|
|
20182
|
-
obj[col] = initialFilterValues.hasOwnProperty(col) ? initialFilterValues[col] : columnFilterConfigs[types[col]].getInitialValue();
|
|
20183
|
-
return obj;
|
|
20184
|
-
}, {});
|
|
20185
|
-
const getFilterConfigs = ({
|
|
20186
|
-
domains,
|
|
20187
|
-
columns,
|
|
20188
|
-
types,
|
|
20189
|
-
values
|
|
20190
|
-
}) => columns.map((col) => {
|
|
20191
|
-
const is = columnFilterConfigs[types[col]].is;
|
|
20192
|
-
if (is === "FilterInputField") {
|
|
20193
|
-
return {
|
|
20194
|
-
is,
|
|
20195
|
-
modelValue: values[col]
|
|
20196
|
-
};
|
|
20197
|
-
}
|
|
20198
|
-
return {
|
|
20199
|
-
is,
|
|
20200
|
-
modelValue: values[col],
|
|
20201
|
-
possibleValues: (domains[col] ?? []).map((val) => ({
|
|
20202
|
-
id: val,
|
|
20203
|
-
text: val
|
|
20204
|
-
}))
|
|
20205
|
-
};
|
|
20206
|
-
});
|
|
20207
|
-
|
|
20208
|
-
/**
|
|
20209
|
-
* Utility for checking the current pagination state and providing the correct page
|
|
20210
|
-
* number if the current state is invalid. Invalid page states include a current page
|
|
20211
|
-
* number which is outside of the range of the filtered data, a page size which is
|
|
20212
|
-
* larger than the total number of rows in the data or a paginated data set size of 0.
|
|
20213
|
-
*
|
|
20214
|
-
* @param {Number} pageSize - the current page size (in number of rows per page).
|
|
20215
|
-
* @param {Number} currentPage - the current page number to check.
|
|
20216
|
-
* @param {Number} availableRows - the number of rows in the filtered data set.
|
|
20217
|
-
* @param {Number} pageRows - the number of rows in the current paginated data set.
|
|
20218
|
-
* @returns {Number|null} new page number or null of no update is needed.
|
|
20219
|
-
*/
|
|
20220
|
-
const getNextPage = (pageSize, currentPage, availableRows, pageRows) => {
|
|
20221
|
-
if (pageSize > availableRows) {
|
|
20222
|
-
return 1;
|
|
20223
|
-
} else if (pageSize * currentPage > availableRows || pageRows < 1) {
|
|
20224
|
-
let newPageNumber = currentPage;
|
|
20225
|
-
while (newPageNumber >= 1) {
|
|
20226
|
-
if (pageSize * newPageNumber > availableRows) {
|
|
20227
|
-
newPageNumber -= 1;
|
|
20228
|
-
} else {
|
|
20229
|
-
break;
|
|
20230
|
-
}
|
|
20231
|
-
}
|
|
20232
|
-
return newPageNumber;
|
|
20233
|
-
}
|
|
20234
|
-
return null;
|
|
20235
|
-
};
|
|
20236
|
-
|
|
20237
|
-
/**
|
|
20238
|
-
* Take a relative row id from a selection event and return the processed index.
|
|
20239
|
-
*
|
|
20240
|
-
* @param {*} param
|
|
20241
|
-
* @param {Number} param.relativeInd - row index provided by event.
|
|
20242
|
-
* @param {Number} param.groupInd - row group index provided by event.
|
|
20243
|
-
* @param {Number} param.currentPage - the current page number from the table.
|
|
20244
|
-
* @param {Number} param.currentPageSize - the current page size from the table.
|
|
20245
|
-
* @param {Number} [param.currentGroup] - the current group-by group (if present).
|
|
20246
|
-
* @param {Array<Array<Number>>} param.processedIndicies - the grouped and sorted index mapping.
|
|
20247
|
-
* @returns {number} index from processed mapping
|
|
20248
|
-
*/
|
|
20249
|
-
const getProcessedRowInd = ({
|
|
20250
|
-
relativeInd,
|
|
20251
|
-
groupInd,
|
|
20252
|
-
currentPage,
|
|
20253
|
-
currentPageSize,
|
|
20254
|
-
currentGroup,
|
|
20255
|
-
processedIndicies,
|
|
20256
|
-
}) => {
|
|
20257
|
-
let pageStart = currentPageSize * (currentPage - 1);
|
|
20258
|
-
if (pageStart === 0) {
|
|
20259
|
-
return relativeInd;
|
|
20260
|
-
}
|
|
20261
|
-
if (currentGroup) {
|
|
20262
|
-
let indCount = 0;
|
|
20263
|
-
processedIndicies.forEach((group, gInd) => {
|
|
20264
|
-
if (gInd < groupInd) {
|
|
20265
|
-
indCount += group.length;
|
|
20266
|
-
}
|
|
20267
|
-
});
|
|
20268
|
-
if (indCount <= pageStart) {
|
|
20269
|
-
return pageStart - indCount + relativeInd;
|
|
20270
|
-
}
|
|
20271
|
-
return relativeInd;
|
|
20272
|
-
}
|
|
20273
|
-
return relativeInd + pageStart;
|
|
20274
|
-
};
|
|
20275
|
-
|
|
20276
|
-
/**
|
|
20277
|
-
* Utility function to search a single cell. Formatters are required for the following table data types:
|
|
20278
|
-
* Number, String, Nominal, DateTime, Boolean. Errors thrown during search will assume no match was found
|
|
20279
|
-
* and return false. Additionally, if no type is supplied, `toString` will be called on the item. Objects
|
|
20280
|
-
* and Arrays are stringified to perform a 'deep search'.
|
|
20281
|
-
*
|
|
20282
|
-
* ** All searches are case insensitive **
|
|
20283
|
-
*
|
|
20284
|
-
* @param {*} field - the item to search.
|
|
20285
|
-
* @param {String} type - the table data type for the search item.
|
|
20286
|
-
* @param {Function} formatter - the formatting function to apply to the item before searching.
|
|
20287
|
-
* @param {String} query - the search term to locate in the item.
|
|
20288
|
-
* @returns {Boolean} - if a match was found.
|
|
20289
|
-
*/
|
|
20290
|
-
const searchCell = (field, type, formatter, query) => {
|
|
20291
|
-
if (typeof field === "undefined") {
|
|
20292
|
-
return false;
|
|
20293
|
-
}
|
|
20294
|
-
try {
|
|
20295
|
-
let formattedData;
|
|
20296
|
-
switch (type) {
|
|
20297
|
-
case columnTypes.Number:
|
|
20298
|
-
case columnTypes.String:
|
|
20299
|
-
case columnTypes.Nominal:
|
|
20300
|
-
case columnTypes.DateTime:
|
|
20301
|
-
case columnTypes.Boolean:
|
|
20302
|
-
formattedData = formatter(field);
|
|
20303
|
-
break;
|
|
20304
|
-
case columnTypes.Array:
|
|
20305
|
-
case columnTypes.Object:
|
|
20306
|
-
formattedData = JSON.stringify(field);
|
|
20307
|
-
// search both JSON data and displayed value if custom formatter provided
|
|
20308
|
-
if (formatter?.name && !columnTypes[formatter.name]) {
|
|
20309
|
-
formattedData += formatter(field);
|
|
20310
|
-
}
|
|
20311
|
-
break;
|
|
20312
|
-
default:
|
|
20313
|
-
formattedData = field.toString();
|
|
20314
|
-
}
|
|
20315
|
-
return formattedData.search(new RegExp(query.trim(), "i")) > -1;
|
|
20316
|
-
} catch (_err) {
|
|
20317
|
-
return false;
|
|
20318
|
-
}
|
|
20319
|
-
};
|
|
20320
|
-
|
|
20321
|
-
/**
|
|
20322
|
-
* Utility for searching an entire row of values. For specifics of the search dynamics, please @see searchCell.
|
|
20323
|
-
*
|
|
20324
|
-
* @param {*[]} row - an array of values to search.
|
|
20325
|
-
* @param {String[]} types - an array of types for the values in the row.
|
|
20326
|
-
* @param {Function[]} formatters - an array of formatting functions for values.
|
|
20327
|
-
* @param {String} query - the search query to locate in the provided row.
|
|
20328
|
-
* @returns {Boolean} - if the query has been matched with an item in the row.
|
|
20329
|
-
*/
|
|
20330
|
-
const searchRow = (row, types, formatters, query) =>
|
|
20331
|
-
row.some((data, colInd) =>
|
|
20332
|
-
searchCell(
|
|
20333
|
-
unpackObjectRepresentation(data),
|
|
20334
|
-
types[colInd],
|
|
20335
|
-
formatters[colInd],
|
|
20336
|
-
query,
|
|
20337
|
-
),
|
|
20338
|
-
);
|
|
20339
|
-
|
|
20340
|
-
/**
|
|
20341
|
-
* Utility function designed to consume an entire data set and output only the rows which match the provided
|
|
20342
|
-
* filter state. This filtering happens on three levels:
|
|
20343
|
-
*
|
|
20344
|
-
* 1.) Time filtering- if a time filter is provided with a DateTime column, any data outside of this range
|
|
20345
|
-
* will be excluded from the returned data subset. If either parameter is omitted, then no filtering on
|
|
20346
|
-
* DateTime will be performed.
|
|
20347
|
-
* 2.) Search filtering- if a search query is provided, the data set will be checked for matching rows on a
|
|
20348
|
-
* global level- meaning any match in any column will satisfy this condition and move on for further
|
|
20349
|
-
* filtering. If this search query is omitted, all data which passed the time filter (if provided), will
|
|
20350
|
-
* continue on to column filtering.
|
|
20351
|
-
* 3.) Column filtering- if there are active column filters for the data set, each row will be checked on a
|
|
20352
|
-
* columnar basis for values matching the filter configuration for that column. This filtering is type
|
|
20353
|
-
* sensitive (defined in @see table.config.js ).
|
|
20354
|
-
*
|
|
20355
|
-
* @param {Object} filterConfig - the object mapping of the required fields for filtering the data.
|
|
20356
|
-
* @param {Object[]} filterConfig.data - the data set to process.
|
|
20357
|
-
* @param {String[]} filterConfig.columnKeys - the column keys for the row Objects of the currently displayed data.
|
|
20358
|
-
* Should only be the currently displayed columns, because users only want to filter based on the information
|
|
20359
|
-
* currently displayed.
|
|
20360
|
-
* @param {Object} filterConfig.formatters - a columnKey/function mapping for the formatting functions of the column
|
|
20361
|
-
* data. Enables filtering on the data the user is viewing, as opposed to the raw data values which may have
|
|
20362
|
-
* undergone some point-wise transformations depending on the table configuration.
|
|
20363
|
-
* @param {Object} filterConfig.types - a columnKey/type (@see table.config.js ) mapping for the columns in the data
|
|
20364
|
-
* set. Allows data-type specific filtering.
|
|
20365
|
-
* @param {String} filterConfig.timeFilter - the optional active time filter value. Possible values are the keys
|
|
20366
|
-
* found in @see time.config.js . If none is provided, no time filtering will be performed.
|
|
20367
|
-
* @param {String} filterConfig.timeFilterKey - the optional columnKey of the DateTime column which should be used
|
|
20368
|
-
* for time filtering. Require IFF a timeFilter has been provided.
|
|
20369
|
-
* @param {String} filterConfig.searchQuery - the optional global search query active for the dataset. If none is
|
|
20370
|
-
* provided, no global search or filtering will be performed.
|
|
20371
|
-
* @param {Object} filterConfig.filterValues - the columnKey/value mapping for any currently active column-specific
|
|
20372
|
-
* filters. If no filters are active, an empty Object should be provided.
|
|
20373
|
-
* @returns {Object} filteredDataConfig - contains the results of the filtering operations.
|
|
20374
|
-
* @returns {Object[]} filteredDataConfig.filteredData - the rows which passed all provided filtering operations.
|
|
20375
|
-
* @returns {Number[]} filteredDataConfig.filteredIndicies - an array of the original row indicies for the filtered
|
|
20376
|
-
* data subset. Can be used for tracking transformations of the data.
|
|
20377
|
-
*/
|
|
20378
|
-
const filter = (filterConfig) => {
|
|
20379
|
-
let {
|
|
20380
|
-
data,
|
|
20381
|
-
columnKeys,
|
|
20382
|
-
formatters,
|
|
20383
|
-
types,
|
|
20384
|
-
timeFilter,
|
|
20385
|
-
timeFilterKey,
|
|
20386
|
-
searchQuery,
|
|
20387
|
-
filterValues,
|
|
20388
|
-
} = filterConfig;
|
|
20389
|
-
let localColumnTypes = columnKeys.map((colKey) => types[colKey]);
|
|
20390
|
-
let filters = Object.entries(filterValues);
|
|
20391
|
-
let columnFormatters = Object.values(formatters);
|
|
20392
|
-
let filteredIndicies = [];
|
|
20393
|
-
let filteredData = data.filter((row, rowInd) => {
|
|
20394
|
-
if (timeFilter) {
|
|
20395
|
-
let inTimeFilter = checkTimeFilter(
|
|
20396
|
-
row[timeFilterKey],
|
|
20397
|
-
tableTimeFilters[timeFilter],
|
|
20398
|
-
);
|
|
20399
|
-
if (!inTimeFilter) {
|
|
20400
|
-
return false;
|
|
20401
|
-
}
|
|
20402
|
-
}
|
|
20403
|
-
let rowValues = columnKeys.map((colKey) => row[colKey]);
|
|
20404
|
-
let shouldSearch = searchQuery && searchQuery.length;
|
|
20405
|
-
if (
|
|
20406
|
-
shouldSearch &&
|
|
20407
|
-
!searchRow(rowValues, localColumnTypes, columnFormatters, searchQuery)
|
|
20408
|
-
) {
|
|
20409
|
-
return false;
|
|
20410
|
-
}
|
|
20411
|
-
if (filters.length === 0) {
|
|
20412
|
-
filteredIndicies.push(rowInd);
|
|
20413
|
-
return true;
|
|
20414
|
-
}
|
|
20415
|
-
let inFilter = filters.every((entry) => {
|
|
20416
|
-
let colKey = entry[0];
|
|
20417
|
-
let filterVal = entry[1];
|
|
20418
|
-
let colInd = columnKeys.indexOf(colKey);
|
|
20419
|
-
let columnType = localColumnTypes[colInd];
|
|
20420
|
-
let colFormatter = columnFormatters[colInd];
|
|
20421
|
-
let rowValue = unpackObjectRepresentation(row[colKey]);
|
|
20422
|
-
const formattedRowValue = colFormatter
|
|
20423
|
-
? colFormatter(rowValue)
|
|
20424
|
-
: rowValue;
|
|
20425
|
-
if (filterVal === null) {
|
|
20426
|
-
return rowValue === null;
|
|
20427
|
-
}
|
|
20428
|
-
if (
|
|
20429
|
-
typeof filterVal === "undefined" ||
|
|
20430
|
-
filterVal === "" ||
|
|
20431
|
-
(Array.isArray(filterVal) && filterVal.length === 0)
|
|
20432
|
-
) {
|
|
20433
|
-
return true;
|
|
20434
|
-
}
|
|
20435
|
-
if (isEmpty(rowValue)) {
|
|
20436
|
-
return false;
|
|
20437
|
-
}
|
|
20438
|
-
switch (columnType) {
|
|
20439
|
-
case columnTypes.Nominal: {
|
|
20440
|
-
return filterVal.includes(formattedRowValue);
|
|
20441
|
-
}
|
|
20442
|
-
case columnTypes.Number:
|
|
20443
|
-
case columnTypes.String:
|
|
20444
|
-
case columnTypes.DateTime:
|
|
20445
|
-
case columnTypes.Object:
|
|
20446
|
-
case columnTypes.Array:
|
|
20447
|
-
return searchCell(rowValue, columnType, colFormatter, filterVal);
|
|
20448
|
-
case columnTypes.Boolean:
|
|
20449
|
-
return filterVal.includes(
|
|
20450
|
-
colFormatter ? colFormatter(rowValue) : rowValue.toString(),
|
|
20451
|
-
);
|
|
20452
|
-
// return filterVal.includes(rowValue.toString());
|
|
20453
|
-
default:
|
|
20454
|
-
return true;
|
|
20455
|
-
}
|
|
20456
|
-
});
|
|
20457
|
-
if (inFilter) {
|
|
20458
|
-
filteredIndicies.push(rowInd);
|
|
20459
|
-
}
|
|
20460
|
-
return inFilter;
|
|
20461
|
-
});
|
|
20462
|
-
return { filteredData, filteredIndicies };
|
|
20463
|
-
};
|
|
20464
|
-
|
|
20465
|
-
const missingValueSymbol = Symbol("Missing");
|
|
20466
|
-
|
|
20467
|
-
/**
|
|
20468
|
-
* Utility function for grouping rows in the provided data based on nominal group membership. This group membership
|
|
20469
|
-
* is determined by the provided column name and key. If there is no group currently, the function will return a
|
|
20470
|
-
* formatted object mapping for the placeholder group 'None' which can then be ignored, but processed in the same
|
|
20471
|
-
* way as grouped data. For rows with a missing nominal column value, they will be mapped to the group 'Missing'
|
|
20472
|
-
* unless there is already a nominal group mapped to missing (as is sometimes the case with pre-processed data).
|
|
20473
|
-
* In this case, a fallback group will be created for 'No group'.
|
|
20474
|
-
*
|
|
20475
|
-
* This method also expects to receive an array of indicies corresponding to the rows in the master dataset. This
|
|
20476
|
-
* allows for transformation tracking during grouping to enable selection or other row-specific actions and events
|
|
20477
|
-
* on the returned grouped data.
|
|
20478
|
-
*
|
|
20479
|
-
* @param {Object} groupConfig - the configuration options to use during grouping.
|
|
20480
|
-
* @param {Object[]} groupConfig.sortedData - an array of row data as individual JSON objects in the array.
|
|
20481
|
-
* @param {String} groupConfig.groupColumn - the group-by column name (as displayed in the header).
|
|
20482
|
-
* @param {String} groupConfig.groupColumnKey - the key representation of the group-by column as found in the row
|
|
20483
|
-
* JSON objects of the sortedData.
|
|
20484
|
-
* @param {Number[]} groupConfig.filteredIndicies - the original row indicies of the data filtered/sorted/mutated in
|
|
20485
|
-
* in the same transformation as the sortedData. Used to track method transformations.
|
|
20486
|
-
* @returns {Object} groupedDataConfig - a map of group transformation information.
|
|
20487
|
-
* @returns {Object} groupedDataConfig.groupedData - an object mapping of group data and the index of the group name in
|
|
20488
|
-
* the groupTitles list.
|
|
20489
|
-
* @returns {Array[]} groupedDataConfig.groupedData.data - an array of arrays, each containing a single group of row
|
|
20490
|
-
* JSON objects.
|
|
20491
|
-
* @returns {Number} groupedDataConfig.groupedData.groupInd - the index of the group in the groupTitles list.
|
|
20492
|
-
* @returns {Array[]} groupedDataConfig.groupedIndicies - an array of arrays of numbers; the arrays representing groups
|
|
20493
|
-
* and the numbers the original indicies.
|
|
20494
|
-
* @returns {Array} groupedDataConfig.groupTitles - a list of Group names
|
|
20495
|
-
*/
|
|
20496
|
-
const group = (groupConfig) => {
|
|
20497
|
-
let { filteredData, groupColumn, groupColumnKey, filteredIndicies } =
|
|
20498
|
-
groupConfig;
|
|
20499
|
-
let returnValue = {
|
|
20500
|
-
groupedData: {},
|
|
20501
|
-
groupedIndicies: [],
|
|
20502
|
-
groupTitles: [],
|
|
20503
|
-
};
|
|
20504
|
-
if (!groupColumn || groupColumn === "None") {
|
|
20505
|
-
returnValue.groupedIndicies.push(filteredIndicies);
|
|
20506
|
-
returnValue.groupTitles.push("None");
|
|
20507
|
-
returnValue.groupedData = [
|
|
20508
|
-
{
|
|
20509
|
-
data: filteredData,
|
|
20510
|
-
groupInd: 0,
|
|
20511
|
-
},
|
|
20512
|
-
];
|
|
20513
|
-
return returnValue;
|
|
20514
|
-
}
|
|
20515
|
-
let containsMissingGroupFromString = false;
|
|
20516
|
-
returnValue.groupedData = filteredData.reduce((map, row, rowInd) => {
|
|
20517
|
-
let rowGroup = unpackObjectRepresentation(row[groupColumnKey]);
|
|
20518
|
-
if (isEmpty(rowGroup) || isMissingValue(rowGroup)) {
|
|
20519
|
-
rowGroup = missingValueSymbol;
|
|
20520
|
-
} else if (rowGroup === missingValueSymbol.description) {
|
|
20521
|
-
containsMissingGroupFromString = true;
|
|
20522
|
-
}
|
|
20523
|
-
if (typeof map[rowGroup] === "undefined") {
|
|
20524
|
-
returnValue.groupTitles.push(rowGroup);
|
|
20525
|
-
let indexTracker = returnValue.groupedIndicies.push([]);
|
|
20526
|
-
map[rowGroup] = {
|
|
20527
|
-
data: [],
|
|
20528
|
-
groupInd: indexTracker - 1,
|
|
20529
|
-
};
|
|
20530
|
-
}
|
|
20531
|
-
returnValue.groupedIndicies[map[rowGroup].groupInd].push(
|
|
20532
|
-
filteredIndicies[rowInd],
|
|
20533
|
-
);
|
|
20534
|
-
map[rowGroup].data.push(row);
|
|
20535
|
-
return map;
|
|
20536
|
-
}, {});
|
|
20537
|
-
let orderedGroups = [];
|
|
20538
|
-
returnValue.groupTitles = returnValue.groupTitles
|
|
20539
|
-
.sort((group1, group2) => {
|
|
20540
|
-
if (group1 === missingValueSymbol) {
|
|
20541
|
-
return 1;
|
|
20542
|
-
} else if (group2 === missingValueSymbol) {
|
|
20543
|
-
return -1;
|
|
20544
|
-
}
|
|
20545
|
-
return group1.toLowerCase() > group2.toLowerCase() ? 1 : -1;
|
|
20546
|
-
})
|
|
20547
|
-
.map((group) => {
|
|
20548
|
-
orderedGroups.push(returnValue.groupedData[group]);
|
|
20549
|
-
if (group === missingValueSymbol) {
|
|
20550
|
-
return containsMissingGroupFromString
|
|
20551
|
-
? "No group"
|
|
20552
|
-
: missingValueSymbol.description;
|
|
20553
|
-
}
|
|
20554
|
-
return group;
|
|
20555
|
-
});
|
|
20556
|
-
returnValue.groupedData = orderedGroups;
|
|
20557
|
-
|
|
20558
|
-
return returnValue;
|
|
20559
|
-
};
|
|
20560
|
-
|
|
20561
|
-
/**
|
|
20562
|
-
* Utility function to process grouped data into a single page of grouped data based on the current page size
|
|
20563
|
-
* and the start and end row indicies. Also creates an updated array for both paginated selection and indicies.
|
|
20564
|
-
*
|
|
20565
|
-
* @param {Object} paginationConfig - the configuration options to use during pagination.
|
|
20566
|
-
* @param {Array[]} paginationConfig.sortedData - a double-nested array containing the full set of filtered,
|
|
20567
|
-
* grouped and sorted data.
|
|
20568
|
-
* @example: [
|
|
20569
|
-
* [row1, row2,...], // group1
|
|
20570
|
-
* ...,
|
|
20571
|
-
* [rowN, rowN+1, ...], // group2
|
|
20572
|
-
* ]
|
|
20573
|
-
* @param {Array[]} paginationConfig.processedIndicies - a double-nested array containing the full set of filtered,
|
|
20574
|
-
* grouped,and sorted indicies which map to the indicies of the previously filtered, grouped and sorted row in
|
|
20575
|
-
* the original data.
|
|
20576
|
-
* @param {Array[]} paginationConfig.processedSelection - a double-nested array containing the full set of filtered,
|
|
20577
|
-
* grouped and sorted selection state.
|
|
20578
|
-
* @param {Number} paginationConfig.pageSize - the current number of items which should be shown per page.
|
|
20579
|
-
* @param {Number} paginationConfig.pageStart - the starting row index to include (zero indexed; inclusive).
|
|
20580
|
-
* @param {Number} paginationConfig.pageEnd - the row index of the first row to *exclude* from the page.
|
|
20581
|
-
* @returns {Object} paginatedResults - the results of the pagination. All values are double-nested arrays and excluded
|
|
20582
|
-
* groups will be returned as empty arrays and empty data or empty pages will be represented as empty arrays as well.
|
|
20583
|
-
* @returns {Array[]} paginatedResults.paginatedData - the paginated data to display on the page.
|
|
20584
|
-
* @returns {Array[]} paginatedResults.paginatedSelection - the paginated selection to pass to the TableUI.vue component.
|
|
20585
|
-
* @returns {Array[]} paginatedResults.paginatedIndicies - the paginated indicies to map TableUI selection events to their
|
|
20586
|
-
* original indicies.
|
|
20587
|
-
*/
|
|
20588
|
-
const paginate = (paginationConfig) => {
|
|
20589
|
-
let {
|
|
20590
|
-
sortedData,
|
|
20591
|
-
processedIndicies,
|
|
20592
|
-
processedSelection = [],
|
|
20593
|
-
pageSize,
|
|
20594
|
-
pageStart,
|
|
20595
|
-
pageEnd,
|
|
20596
|
-
} = paginationConfig;
|
|
20597
|
-
let includedRows = 0;
|
|
20598
|
-
let totalRows = 0;
|
|
20599
|
-
let paginatedSelection = [];
|
|
20600
|
-
let paginatedIndicies = [];
|
|
20601
|
-
let paginatedData = sortedData.map((dataGroup, groupInd) => {
|
|
20602
|
-
let groupCount = dataGroup.length;
|
|
20603
|
-
let groupStart = totalRows;
|
|
20604
|
-
let groupEnd = groupStart + groupCount;
|
|
20605
|
-
let remainingRows = pageSize - includedRows;
|
|
20606
|
-
let returnValue = [];
|
|
20607
|
-
let skipGroup =
|
|
20608
|
-
remainingRows <= 0 || groupEnd < pageStart || groupStart > pageEnd;
|
|
20609
|
-
let includeEntireGroup =
|
|
20610
|
-
remainingRows >= groupCount &&
|
|
20611
|
-
groupStart >= pageStart &&
|
|
20612
|
-
groupEnd <= pageEnd;
|
|
20613
|
-
if (skipGroup) {
|
|
20614
|
-
returnValue = [];
|
|
20615
|
-
paginatedSelection.push([]);
|
|
20616
|
-
paginatedIndicies.push([]);
|
|
20617
|
-
} else if (includeEntireGroup) {
|
|
20618
|
-
returnValue = dataGroup;
|
|
20619
|
-
paginatedSelection.push(processedSelection[groupInd]);
|
|
20620
|
-
paginatedIndicies.push(processedIndicies[groupInd]);
|
|
20621
|
-
} else {
|
|
20622
|
-
let groupSliceStart = 0;
|
|
20623
|
-
let groupSliceEnd = groupCount;
|
|
20624
|
-
if (groupStart < pageStart) {
|
|
20625
|
-
groupSliceStart = pageStart - groupStart;
|
|
20626
|
-
if (groupCount - groupSliceStart > remainingRows) {
|
|
20627
|
-
groupSliceEnd = groupSliceStart + remainingRows;
|
|
20628
|
-
}
|
|
20629
|
-
} else if (groupSliceStart + remainingRows < groupCount) {
|
|
20630
|
-
groupSliceEnd = groupSliceStart + remainingRows;
|
|
20631
|
-
}
|
|
20632
|
-
returnValue = dataGroup.slice(groupSliceStart, groupSliceEnd);
|
|
20633
|
-
paginatedSelection.push(
|
|
20634
|
-
processedSelection[groupInd]?.slice(groupSliceStart, groupSliceEnd),
|
|
20635
|
-
);
|
|
20636
|
-
paginatedIndicies.push(
|
|
20637
|
-
processedIndicies[groupInd].slice(groupSliceStart, groupSliceEnd),
|
|
20638
|
-
);
|
|
20639
|
-
}
|
|
20640
|
-
includedRows += returnValue.length;
|
|
20641
|
-
totalRows += groupCount;
|
|
20642
|
-
return returnValue;
|
|
20643
|
-
});
|
|
20644
|
-
return { paginatedData, paginatedSelection, paginatedIndicies };
|
|
20645
|
-
};
|
|
20646
|
-
|
|
20647
|
-
/**
|
|
20648
|
-
* Utility function for sorting a data set. This functionality sorts the entire dataset, but also performs sorts within
|
|
20649
|
-
* the grouped data. Additionally, transformations of the row order are tracked on an index level so original row order
|
|
20650
|
-
* can be tracked.
|
|
20651
|
-
*
|
|
20652
|
-
* @param {*} sortConfig - the object mapping of the required fields for sorting the data.
|
|
20653
|
-
* @param {Array[]} sortConfig.groupedData - an array of arrays, each containing a single group of row JSON objects.
|
|
20654
|
-
* @param {Array[]} sortConfig.groupedIndicies - an array of arrays of numbers; the arrays representing groups
|
|
20655
|
-
* and the numbers the original indicies.
|
|
20656
|
-
* @param {String} sortConfig.groupColumnKey - the columnKey of the column currently being used as the "group-by"
|
|
20657
|
-
* column.
|
|
20658
|
-
* @param {String[]} sortConfig.columnKeys - the column keys for the row Objects of the currently displayed data.
|
|
20659
|
-
* @param {Object} sortConfig.columnTypes - a columnKey/type (@see table.config.js ) mapping for the columns in the data
|
|
20660
|
-
* set. Allows data-type specific sorting.
|
|
20661
|
-
* @param {String} [sortConfig.sortColumn] - the optional columnKey for the column which should be used to sort the data.
|
|
20662
|
-
* If none is provided, no sorting will be performed.
|
|
20663
|
-
* @param {String} sortConfig.sortDirection - either 1 or -1 which correspond to ascending/descending respectively.
|
|
20664
|
-
* @returns {Object} sortedDataConfig - contains the results of the sorting operations.
|
|
20665
|
-
* @returns {Array[]} sortedDataConfig.sortedData - an array of arrays of row Objects. This data set will be grouped and
|
|
20666
|
-
* sorted according to the provided configuration.
|
|
20667
|
-
* @returns {Number[]} sortedDataConfig.sortedIndicies - an array of the original row indicies grouped and sorted according
|
|
20668
|
-
* to the previous grouping and the current sorting transformations which were performed.
|
|
20669
|
-
*/
|
|
20670
|
-
const sort = (sortConfig) => {
|
|
20671
|
-
let {
|
|
20672
|
-
groupedData,
|
|
20673
|
-
groupedIndicies,
|
|
20674
|
-
groupColumnKey,
|
|
20675
|
-
columnKeys,
|
|
20676
|
-
columnTypes: currentColumnTypes,
|
|
20677
|
-
sortColumn,
|
|
20678
|
-
sortDirection,
|
|
20679
|
-
} = sortConfig;
|
|
20680
|
-
|
|
20681
|
-
return groupedData
|
|
20682
|
-
.map(({ data, groupInd }) =>
|
|
20683
|
-
data
|
|
20684
|
-
.map((row, rowInd) => ({
|
|
20685
|
-
row,
|
|
20686
|
-
rowInd: groupedIndicies[groupInd][rowInd],
|
|
20687
|
-
}))
|
|
20688
|
-
.sort(({ row: row1 }, { row: row2 }) => {
|
|
20689
|
-
// only sort within groups
|
|
20690
|
-
if (
|
|
20691
|
-
sortColumn === null ||
|
|
20692
|
-
(groupColumnKey && row1[groupColumnKey] !== row2[groupColumnKey])
|
|
20693
|
-
) {
|
|
20694
|
-
return 0;
|
|
20695
|
-
}
|
|
20696
|
-
let columnKey = columnKeys[sortColumn];
|
|
20697
|
-
let columnType = currentColumnTypes[sortColumn];
|
|
20698
|
-
let rawVal1 = row1[columnKey];
|
|
20699
|
-
let rawVal2 = row2[columnKey];
|
|
20700
|
-
const val1EmptyOrMissing =
|
|
20701
|
-
isEmpty(rawVal1) || isMissingValue(rawVal1);
|
|
20702
|
-
const val2EmptyOrMissing =
|
|
20703
|
-
isEmpty(rawVal2) || isMissingValue(rawVal2);
|
|
20704
|
-
|
|
20705
|
-
if (val1EmptyOrMissing && val2EmptyOrMissing) {
|
|
20706
|
-
return 0;
|
|
20707
|
-
} else if (val1EmptyOrMissing) {
|
|
20708
|
-
return 1;
|
|
20709
|
-
} else if (val2EmptyOrMissing) {
|
|
20710
|
-
return -1;
|
|
20711
|
-
} else {
|
|
20712
|
-
let order = 0;
|
|
20713
|
-
if (
|
|
20714
|
-
columnType === columnTypes.Array &&
|
|
20715
|
-
rawVal1.length !== rawVal2.length
|
|
20716
|
-
) {
|
|
20717
|
-
order = rawVal1.length > rawVal2.length ? 1 : -1;
|
|
20718
|
-
} else {
|
|
20719
|
-
let val1comparison = JSON.stringify(row1[columnKey]);
|
|
20720
|
-
let val2comparison = JSON.stringify(row2[columnKey]);
|
|
20721
|
-
if (val1comparison !== val2comparison) {
|
|
20722
|
-
order = val1comparison > val2comparison ? 1 : -1;
|
|
20723
|
-
}
|
|
20724
|
-
}
|
|
20725
|
-
return order * sortDirection;
|
|
20726
|
-
}
|
|
20727
|
-
})
|
|
20728
|
-
.reduce(
|
|
20729
|
-
(acc, mapItem) => {
|
|
20730
|
-
acc.data.push(mapItem.row);
|
|
20731
|
-
acc.indicies.push(mapItem.rowInd);
|
|
20732
|
-
return acc;
|
|
20733
|
-
},
|
|
20734
|
-
{ data: [], indicies: [] },
|
|
20735
|
-
),
|
|
20736
|
-
)
|
|
20737
|
-
.reduce(
|
|
20738
|
-
(acc, { data, indicies }) => {
|
|
20739
|
-
acc.sortedData.push(data);
|
|
20740
|
-
acc.sortedIndicies.push(indicies);
|
|
20741
|
-
return acc;
|
|
20742
|
-
},
|
|
20743
|
-
{ sortedData: [], sortedIndicies: [] },
|
|
20744
|
-
);
|
|
20745
|
-
};
|
|
20327
|
+
const TableUIWithAutoSizeCalculation = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-38696592"]]);
|
|
20746
20328
|
|
|
20747
|
-
export { TableActionBar, TableUI, TableUIWithAutoSizeCalculation,
|
|
20329
|
+
export { TableActionBar, TableUI, TableUIWithAutoSizeCalculation, columnFilterConfigs, columnSortText, columnTypes, constants, defaultPageSize, filterComponents, getMissingValueMessage, isMissingValue, tablePageSizes, unpackObjectRepresentation };
|
|
20748
20330
|
//# sourceMappingURL=index.js.map
|