@zeedhi/teknisa-components-vuetify 1.117.1 → 3.0.1

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.
Files changed (92) hide show
  1. package/.package.json +49 -0
  2. package/dist/teknisa-vuetify.css +1 -0
  3. package/dist/teknisa-vuetify.js +3882 -0
  4. package/environments.json +16 -0
  5. package/package.json +18 -17
  6. package/src/components/index.ts +38 -0
  7. package/src/components/public.ts +41 -0
  8. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts +34 -0
  9. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue +75 -0
  10. package/src/components/tek-grid/TekGrid.ts +318 -0
  11. package/src/components/tek-grid/TekGrid.vue +235 -0
  12. package/src/components/tek-grid/column-filter/TekGridColumnFilter.ts +244 -0
  13. package/src/components/tek-grid/column-filter/TekGridColumnFilter.vue +93 -0
  14. package/src/components/tek-grid/column-header/TekGridHeaderRow.ts +147 -0
  15. package/src/components/tek-grid/column-header/TekGridHeaderRow.vue +78 -0
  16. package/src/components/tek-grid/columns-button/TekGridColumnsButton.ts +96 -0
  17. package/src/components/tek-grid/columns-button/TekGridColumnsButton.vue +273 -0
  18. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsController.ts +470 -0
  19. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsModal.ts +513 -0
  20. package/src/components/tek-grid/filter-button/TekGridFilterButton.ts +47 -0
  21. package/src/components/tek-grid/filter-button/TekGridFilterButton.vue +28 -0
  22. package/src/components/tek-grid/indentation/TekGridIndentation.ts +21 -0
  23. package/src/components/tek-grid/indentation/TekGridIndentation.vue +33 -0
  24. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.ts +119 -0
  25. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.vue +172 -0
  26. package/src/components/tek-grid/row/TekGridFooterRow.ts +62 -0
  27. package/src/components/tek-grid/row/TekGridFooterRow.vue +64 -0
  28. package/src/components/tek-grid/row/TekGridGroupRow.ts +65 -0
  29. package/src/components/tek-grid/row/TekGridGroupRow.vue +65 -0
  30. package/src/components/tek-user-info/TekUserInfo.ts +51 -0
  31. package/src/components/tek-user-info/TekUserInfo.vue +53 -0
  32. package/src/components/tek-user-info/TekUserInfoList.ts +39 -0
  33. package/src/components/tek-user-info/TekUserInfoList.vue +12 -0
  34. package/src/composables/useTableLayout.ts +290 -0
  35. package/src/index.ts +29 -0
  36. package/src/shims-vue.d.ts +6 -0
  37. package/src/styles/index.scss +0 -0
  38. package/src/utils/isArrayOperation.ts +5 -0
  39. package/types/components/index.d.ts +5 -3
  40. package/types/components/public.d.ts +5 -18
  41. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +1137 -12
  42. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts.d.ts +1138 -0
  43. package/types/components/tek-grid/TekGrid.d.ts +7208 -86
  44. package/types/components/tek-grid/TekGrid.ts.d.ts +7211 -0
  45. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +130 -0
  46. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +130 -0
  47. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +225 -0
  48. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +225 -0
  49. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +2432 -0
  50. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +2432 -0
  51. package/types/components/tek-grid/{TekGridColumnsOptionsController.d.ts → columns-button/TekGridColumnsOptionsController.d.ts} +7 -8
  52. package/types/components/tek-grid/{TekGridColumnsOptionsModal.d.ts → columns-button/TekGridColumnsOptionsModal.d.ts} +2 -3
  53. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +2920 -0
  54. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +2920 -0
  55. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +32 -0
  56. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +32 -0
  57. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +1893 -0
  58. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +1893 -0
  59. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +90 -0
  60. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +90 -0
  61. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +87 -0
  62. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +87 -0
  63. package/types/components/tek-user-info/TekUserInfo.d.ts +1937 -10
  64. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +1940 -0
  65. package/types/components/tek-user-info/TekUserInfoList.d.ts +1014 -8
  66. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +1015 -0
  67. package/types/composables/useTableLayout.d.ts +26 -0
  68. package/types/index.d.ts +2 -2
  69. package/types/utils/isArrayOperation.d.ts +2 -0
  70. package/dist/tek-components-vuetify.esm.js +0 -8924
  71. package/dist/tek-components-vuetify.umd.js +0 -8949
  72. package/types/components/crud/TekCrudAddButton.d.ts +0 -14
  73. package/types/components/crud/TekCrudButton.d.ts +0 -12
  74. package/types/components/crud/TekCrudCancelButton.d.ts +0 -12
  75. package/types/components/crud/TekCrudDeleteButton.d.ts +0 -14
  76. package/types/components/crud/TekCrudForm.d.ts +0 -9
  77. package/types/components/crud/TekCrudSaveButton.d.ts +0 -11
  78. package/types/components/tek-card-title/TekCardTitle.d.ts +0 -16
  79. package/types/components/tek-drag-grid/TekDragGrid.d.ts +0 -20
  80. package/types/components/tek-grid/TekGridColumnsButton.d.ts +0 -16
  81. package/types/components/tek-grid/TekGridFilterButton.d.ts +0 -27
  82. package/types/components/tek-grid/TekGridLayoutOptions.d.ts +0 -19
  83. package/types/components/tek-grid/subcomponents/TekGridCellIdentation.d.ts +0 -9
  84. package/types/components/tek-grid/subcomponents/TekGridColumnFilter.d.ts +0 -16
  85. package/types/components/tek-grid/subcomponents/TekGridHeaderIndentation.d.ts +0 -5
  86. package/types/components/tek-image/TekImage.d.ts +0 -20
  87. package/types/components/tek-iterable-carousel/TekIterableCarousel.d.ts +0 -11
  88. package/types/components/tek-iterable-component-render/TekIterableComponentRender.d.ts +0 -9
  89. package/types/components/tek-loading/TekLoading.d.ts +0 -9
  90. package/types/components/tek-notifications/TekNotifications.d.ts +0 -12
  91. package/types/components/tek-product-card/TekProductCard.d.ts +0 -24
  92. package/types/components/tek-tree-grid/TekTreeGrid.d.ts +0 -72
@@ -0,0 +1,3882 @@
1
+ import { ModalService, Icons } from '@zeedhi/common';
2
+ import ZdUserInfoComponent, { ZdUserInfoProps } from '@zeedhi/zd-user-info-vue';
3
+ import { BreadcrumbHeader, TekRestDatasource, TekGridColumn, TekFilterHelper, TekGrid, TekMemoryDatasource, TekGridColumnsButton, TekGridFilterButton, TekGridLayoutOptions, TekUserInfo, TekUserInfoList } from '@zeedhi/teknisa-components-common';
4
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps, withCtx, normalizeProps, guardReactiveProps, createElementVNode, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, renderSlot, inject, computed, provide, nextTick, withDirectives, normalizeClass, normalizeStyle, createSlots, vShow, reactive, toDisplayString, ref, watch, createTextVNode, onMounted, isMemoSame, withModifiers } from 'vue';
5
+ import { ZdComponentRenderProps, useCreateInstance, NotProvidedError, buildProps, ZdGridEditableProps, useGridEditableInstance, getRootElement, useGridColumns, ZdIterableColumnsButtonProps, useButtonInstance, ZdButtonProps, useGetMethods, ZdListProps } from '@zeedhi/vuetify';
6
+ import { Utils, Config, Metadata, dayjs, Singleton, I18n, Loader } from '@zeedhi/core';
7
+ import cloneDeep from 'lodash.clonedeep';
8
+ import debounce from 'lodash.debounce';
9
+ import sortable from 'sortablejs';
10
+
11
+ const TekBreadcrumbHeaderProps$1 = Object.assign(Object.assign({}, ZdComponentRenderProps), { title: {
12
+ type: String,
13
+ default: '',
14
+ }, breadcrumb: {
15
+ type: Object,
16
+ default: {},
17
+ }, rightSlot: {
18
+ type: Array,
19
+ default: () => [],
20
+ } });
21
+ const breadcrumbHeaderComponent$1 = defineComponent({
22
+ props: TekBreadcrumbHeaderProps$1,
23
+ inheritAttrs: false,
24
+ setup(props, ctx) {
25
+ const { instance, root } = useCreateInstance(props, ctx, BreadcrumbHeader);
26
+ return {
27
+ instance,
28
+ root,
29
+ };
30
+ },
31
+ });
32
+
33
+ const _hoisted_1$6 = ["id"];
34
+ const _hoisted_2$3 = { class: "tek-breadcrumb-header-slot-right" };
35
+ const _hoisted_3$1 = { key: 0 };
36
+
37
+ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
38
+ const _component_zd_breadcrumbs = resolveComponent("zd-breadcrumbs");
39
+ const _component_zd_text = resolveComponent("zd-text");
40
+ const _component_v_col = resolveComponent("v-col");
41
+
42
+ return (openBlock(), createElementBlock("div", {
43
+ id: _ctx.instance.name,
44
+ class: "tek-breadcrumb-header"
45
+ }, [
46
+ createVNode(_component_zd_breadcrumbs, mergeProps(_ctx.instance.breadcrumb, {
47
+ theme: _ctx.instance.theme
48
+ }), null, 16 /* FULL_PROPS */, ["theme"]),
49
+ createVNode(_component_v_col, {
50
+ class: "tek-breadcrumb-header-title-col",
51
+ cols: "12"
52
+ }, {
53
+ default: withCtx(() => [
54
+ createVNode(_component_zd_text, normalizeProps(guardReactiveProps({
55
+ name: `${_ctx.instance.name}-title`,
56
+ cssClass: 'tek-breadcrumb-header-title',
57
+ text: _ctx.$t(_ctx.instance.title),
58
+ })), null, 16 /* FULL_PROPS */),
59
+ createElementVNode("span", _hoisted_2$3, [
60
+ (_ctx.instance.rightSlot.length)
61
+ ? (openBlock(), createElementBlock("span", _hoisted_3$1, [
62
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.instance.rightSlot, (child, index) => {
63
+ return (openBlock(), createBlock(resolveDynamicComponent(child.component), mergeProps({ ref_for: true }, child, { key: index }), null, 16 /* FULL_PROPS */))
64
+ }), 128 /* KEYED_FRAGMENT */))
65
+ ]))
66
+ : createCommentVNode("v-if", true),
67
+ renderSlot(_ctx.$slots, "rightSlot")
68
+ ])
69
+ ]),
70
+ _: 3 /* FORWARDED */
71
+ })
72
+ ], 8 /* PROPS */, _hoisted_1$6))
73
+ }
74
+
75
+ breadcrumbHeaderComponent$1.render = render$b;
76
+ breadcrumbHeaderComponent$1.__file = "src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue";
77
+
78
+ function useTableLayout() {
79
+ const applyLayout = inject('applyLayout');
80
+ const getColumnElements = inject('getColumnElements');
81
+ const getTableWidth = inject('getTableWidth');
82
+ if (!applyLayout) {
83
+ throw new NotProvidedError('applyLayout');
84
+ }
85
+ if (!getColumnElements) {
86
+ throw new NotProvidedError('getColumnElements');
87
+ }
88
+ if (!getTableWidth) {
89
+ throw new NotProvidedError('getTableWidth');
90
+ }
91
+ return { applyLayout, getColumnElements, getTableWidth };
92
+ }
93
+ function provideTableLayout({ instance, rootEl, }) {
94
+ var _a;
95
+ const tableElement = (_a = rootEl.value) === null || _a === void 0 ? void 0 : _a.querySelector('table');
96
+ const columnDictionary = computed(() => getColumnDictionary(instance.columns));
97
+ const datasourceDynamicFilter = () => {
98
+ const datasource = instance.datasource;
99
+ if (datasource instanceof TekRestDatasource)
100
+ return datasource.dynamicFilter;
101
+ return {};
102
+ };
103
+ const getColumnDictionary = (columns) => {
104
+ const columnDictionary = {};
105
+ columns.forEach((column) => {
106
+ columnDictionary[column.name] = column;
107
+ });
108
+ return columnDictionary;
109
+ };
110
+ const addMissingColumns = (layout) => {
111
+ var _a;
112
+ const layoutColumnNames = ((_a = layout.columns) === null || _a === void 0 ? void 0 : _a.map((column) => column.name)) || [];
113
+ const columnNames = Object.keys(columnDictionary.value);
114
+ columnNames.forEach((columnName) => {
115
+ var _a;
116
+ if (!layoutColumnNames.includes(columnName)) {
117
+ (_a = layout.columns) === null || _a === void 0 ? void 0 : _a.push(columnDictionary.value[columnName]);
118
+ }
119
+ });
120
+ };
121
+ const setHelperValue = (column, value) => {
122
+ if (column instanceof TekGridColumn) {
123
+ if (!Array.isArray(column.filterProps) && typeof value === 'string') {
124
+ column.filterProps.helperValue = value;
125
+ }
126
+ else if (Array.isArray(column.filterProps) && Array.isArray(value)) {
127
+ column.filterProps.forEach((prop, index) => {
128
+ prop.value = value[index];
129
+ });
130
+ }
131
+ }
132
+ };
133
+ const getHelperValues = (dynamicFilter, columns) => {
134
+ const filter = cloneDeep(dynamicFilter);
135
+ Object.keys(filter).forEach((columnName) => {
136
+ const filterOptions = filter[columnName];
137
+ const column = columns[columns.findIndex((col) => col.name === columnName)];
138
+ const { filterHelperValue } = column;
139
+ filterOptions.forEach((item) => {
140
+ if (['IN', 'NOT_IN', 'BETWEEN'].includes(item.operation) && !Array.isArray(item.value)) {
141
+ item.value = item.value.split(';');
142
+ }
143
+ let helperValue = '';
144
+ if (!Array.isArray(filterHelperValue)) {
145
+ helperValue = filterHelperValue;
146
+ }
147
+ else {
148
+ Object.keys(filterHelperValue).forEach((key) => {
149
+ const value = filterHelperValue[key] || '';
150
+ if (`${item.relation || 'AND'}-${item.operation || 'CONTAINS'}` === key) {
151
+ helperValue = value;
152
+ }
153
+ });
154
+ }
155
+ if (helperValue) {
156
+ const columnObj = instance.getColumn(column.name);
157
+ item.value = TekFilterHelper.getValue(helperValue, columnObj);
158
+ }
159
+ });
160
+ });
161
+ return filter;
162
+ };
163
+ /**
164
+ * Applies the default grid layout
165
+ * @returns a boolean to indicate whether the group parameters changed
166
+ */
167
+ const applyDefaultLayout = (defaultLayout) => {
168
+ let groupParamsChanged = false;
169
+ instance.datasource.order = [...defaultLayout.originalDatasourceOrder];
170
+ instance.datasource.filter = Object.assign({}, defaultLayout.originalDatasourceFilter);
171
+ if (instance.datasource instanceof TekRestDatasource) {
172
+ instance.datasource.dynamicFilter = getHelperValues(defaultLayout.originalDatasourceDynamicFilter, defaultLayout.originalColumnProps);
173
+ }
174
+ instance.columns = defaultLayout.originalColumnProps.map((defaultColumn) => {
175
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
176
+ const col = columnDictionary.value[defaultColumn.name];
177
+ groupParamsChanged =
178
+ groupParamsChanged ||
179
+ col.grouped !== defaultColumn.grouped ||
180
+ col.groupOpened !== defaultColumn.groupOpened ||
181
+ col.aggregation !== defaultColumn.aggregation;
182
+ col.isVisible = (_a = defaultColumn.isVisible) !== null && _a !== void 0 ? _a : col.isVisible;
183
+ col.label = (_b = defaultColumn.label) !== null && _b !== void 0 ? _b : col.label;
184
+ col.align = (_c = defaultColumn.align) !== null && _c !== void 0 ? _c : col.align;
185
+ col.fixed = (_d = defaultColumn.fixed) !== null && _d !== void 0 ? _d : col.fixed;
186
+ col.grouped = (_e = defaultColumn.grouped) !== null && _e !== void 0 ? _e : col.grouped;
187
+ col.groupOpened = (_f = defaultColumn.groupOpened) !== null && _f !== void 0 ? _f : col.groupOpened;
188
+ col.aggregation = (_g = defaultColumn.aggregation) !== null && _g !== void 0 ? _g : col.aggregation;
189
+ col.minWidth = (_h = defaultColumn.minWidth) !== null && _h !== void 0 ? _h : col.minWidth;
190
+ col.maxWidth = (_j = defaultColumn.maxWidth) !== null && _j !== void 0 ? _j : col.maxWidth;
191
+ col.width = (_k = defaultColumn.width) !== null && _k !== void 0 ? _k : col.width;
192
+ setHelperValue(col, defaultColumn.filterHelperValue || '');
193
+ return col;
194
+ });
195
+ if (tableElement) {
196
+ tableElement.style.width = '100%';
197
+ const columnElements = Array.from(tableElement.querySelectorAll('tr th:not(.selectable)'));
198
+ columnElements.forEach((item) => {
199
+ item.style.width = 'unset';
200
+ });
201
+ }
202
+ return groupParamsChanged;
203
+ };
204
+ const applyNewLayout = (layout, changeLayoutCallback) => {
205
+ var _a;
206
+ const gridColumnNames = Object.keys(columnDictionary.value);
207
+ let layoutChanged = false;
208
+ // removes columns that are in the layout but not in grid
209
+ layout.columns = (_a = layout.columns) === null || _a === void 0 ? void 0 : _a.filter((column) => {
210
+ const isInGrid = gridColumnNames.includes(column.name);
211
+ if (!isInGrid)
212
+ layoutChanged = true;
213
+ return isInGrid;
214
+ });
215
+ if (layoutChanged) {
216
+ changeLayoutCallback(layout);
217
+ }
218
+ if (tableElement)
219
+ tableElement.style.width = layout.gridWidth || 'auto';
220
+ instance.datasource.order = layout.order !== undefined ? layout.order : instance.datasource.order;
221
+ instance.datasource.filter = layout.filter !== undefined ? layout.filter : instance.datasource.filter;
222
+ if (instance.datasource instanceof TekRestDatasource && layout.dynamicFilter !== undefined) {
223
+ instance.datasource.dynamicFilter = getHelperValues(layout.dynamicFilter, layout.columns || instance.columns);
224
+ }
225
+ if (layout.columns) {
226
+ instance.columns = layout.columns.map((column) => {
227
+ const col = columnDictionary.value[column.name];
228
+ col.label = column.label !== undefined ? column.label : col.label;
229
+ col.align = column.align !== undefined ? column.align : col.align;
230
+ col.isVisible = column.isVisible !== undefined ? column.isVisible : col.isVisible;
231
+ col.fixed = !!column.fixed;
232
+ col.grouped = !!column.grouped;
233
+ col.groupOpened = !!column.groupOpened;
234
+ col.aggregation = column.aggregation;
235
+ col.minWidth = column.minWidth || '';
236
+ col.maxWidth = column.maxWidth || '';
237
+ col.width = column.width;
238
+ setHelperValue(col, column.filterHelperValue || '');
239
+ return col;
240
+ });
241
+ // wait to change column orders
242
+ nextTick(() => {
243
+ gridColumnNames.forEach((_key, index) => {
244
+ const columnElement = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector(`tr th:not(.selectable)[index="${index}"]`);
245
+ if (columnElement) {
246
+ columnElement.style.width = layout.columns[index].width || 'unset';
247
+ }
248
+ });
249
+ });
250
+ }
251
+ };
252
+ const applyLayout = ({ layout, defaultLayout, changeLayoutCallback, }) => {
253
+ const oldOrder = instance.datasource.order;
254
+ const oldFilter = instance.datasource.filter;
255
+ const oldDynamicFilter = datasourceDynamicFilter();
256
+ let groupParamsChanged = false;
257
+ if (layout) {
258
+ addMissingColumns(layout);
259
+ applyNewLayout(layout, changeLayoutCallback);
260
+ }
261
+ else {
262
+ groupParamsChanged = applyDefaultLayout(defaultLayout);
263
+ }
264
+ if ((!Utils.isEqual(instance.datasource.order, oldOrder) ||
265
+ !Utils.isEqual(instance.datasource.filter, oldFilter) ||
266
+ !Utils.isEqual(datasourceDynamicFilter(), oldDynamicFilter)) &&
267
+ !groupParamsChanged) {
268
+ // Se os parametros de agrupamento tiverem sido alterados um get é feito automaticamente
269
+ instance.loadAfterTasks();
270
+ }
271
+ };
272
+ const getColumnElements = () => {
273
+ const elementDict = {};
274
+ const columnElements = (tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr th:not(.selectable)[index]')) || [];
275
+ columnElements.forEach((el) => {
276
+ const index = el.getAttribute('index');
277
+ if (index === null)
278
+ return;
279
+ elementDict[index] = el;
280
+ });
281
+ return elementDict;
282
+ };
283
+ const getTableWidth = () => {
284
+ return tableElement ? window.getComputedStyle(tableElement).width : 'auto';
285
+ };
286
+ provide('applyLayout', applyLayout);
287
+ provide('getColumnElements', getColumnElements);
288
+ provide('getTableWidth', getTableWidth);
289
+ }
290
+
291
+ const TekGridProps$1 = buildProps(Object.assign(Object.assign({}, ZdGridEditableProps), { toolbarSlot: {
292
+ type: Array,
293
+ default: undefined,
294
+ }, title: {
295
+ type: String,
296
+ default: '',
297
+ }, addButton: {
298
+ type: [Boolean, String],
299
+ default: false,
300
+ }, deleteButton: {
301
+ type: [String, Boolean],
302
+ default: 'none',
303
+ }, columnsButton: {
304
+ type: [Boolean, String],
305
+ default: false,
306
+ }, columnsButtonIgnore: {
307
+ type: [Array, String],
308
+ default: () => [],
309
+ }, showEditButtons: {
310
+ type: [Boolean, String],
311
+ default: true,
312
+ }, filterButton: {
313
+ type: [Boolean, String],
314
+ default: false,
315
+ }, modalFilterProps: {
316
+ type: Object,
317
+ default: () => ({}),
318
+ }, showSearch: {
319
+ type: [Boolean, String],
320
+ default: true,
321
+ }, columnFilterButton: {
322
+ type: [Boolean, String],
323
+ default: false,
324
+ }, hideActions: {
325
+ type: [Boolean, String],
326
+ default: false,
327
+ }, actions: {
328
+ type: Array,
329
+ default: () => [],
330
+ }, dragColumns: {
331
+ type: [Boolean, String],
332
+ default: true,
333
+ }, resizeColumns: {
334
+ type: [Boolean, String],
335
+ default: true,
336
+ }, showLayoutOptions: {
337
+ type: [Boolean, String],
338
+ default: true,
339
+ }, showExport: {
340
+ type: [String, Boolean],
341
+ default: false,
342
+ }, showReload: {
343
+ type: [Boolean, String],
344
+ default: true,
345
+ }, exportConfig: {
346
+ type: Array,
347
+ }, exportActions: {
348
+ type: Array,
349
+ }, groupsOpened: {
350
+ type: [Boolean, String],
351
+ default: false,
352
+ }, showSummaryTotal: {
353
+ type: [Boolean, String],
354
+ default: true,
355
+ }, mainGrid: {
356
+ type: [Boolean, String],
357
+ default: true,
358
+ }, xlsDefaultType: {
359
+ type: String,
360
+ default: undefined,
361
+ }, showCheckboxAllFilter: {
362
+ type: [Boolean, String],
363
+ default: Config.gridShowCheckboxAllFilter,
364
+ }, toolbarOpened: {
365
+ type: [Boolean],
366
+ default: true,
367
+ }, defaultFilter: {
368
+ type: Object,
369
+ }, reportTitle: {
370
+ type: String,
371
+ }, editNewRowsOnly: {
372
+ type: [Boolean, String],
373
+ default: false,
374
+ } }));
375
+ const gridEditableComponent$1 = defineComponent({
376
+ props: TekGridProps$1,
377
+ inheritAttrs: false,
378
+ setup(props, ctx) {
379
+ const { instance, root } = useCreateInstance(props, ctx, TekGrid);
380
+ const renderedData = computed(() => {
381
+ if (instance.isGrouped()) {
382
+ return instance.getGroupedData();
383
+ }
384
+ return instance.getData();
385
+ });
386
+ const visibleData = computed(() => {
387
+ return renderedData.value.filter((row) => instance.isItemVisible(row));
388
+ });
389
+ const gridEditableScope = useGridEditableInstance({ instance, root, renderedData: visibleData });
390
+ const rootEl = getRootElement(root);
391
+ const { visibleColumns } = useGridColumns({
392
+ instance,
393
+ rootEl,
394
+ visibilityCondition: (column) => column.isVisible && !column.grouped,
395
+ });
396
+ provideTableLayout({ instance, rootEl });
397
+ const debouncedDatasourceGet = debounce((instance) => {
398
+ const event = new Event('change', { cancelable: true });
399
+ instance.callEvent('beforeApplyFilter', { component: instance, event });
400
+ if (event.defaultPrevented)
401
+ return;
402
+ const { datasource } = instance;
403
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
404
+ datasource.updateDynamicFilter();
405
+ }
406
+ else {
407
+ datasource.get();
408
+ }
409
+ }, 500);
410
+ const filter = computed(() => {
411
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
412
+ return instance.datasource.dynamicFilter;
413
+ }
414
+ const datasourceFilter = instance.datasource.filter;
415
+ const simpleFilter = {};
416
+ Object.keys(datasourceFilter).forEach((key) => {
417
+ simpleFilter[key] = [{ relation: 'AND', operation: 'CONTAINS', value: datasourceFilter[key] }];
418
+ });
419
+ return simpleFilter;
420
+ });
421
+ const setFilter = (newFilter) => {
422
+ if (Utils.isEqual(filter, newFilter))
423
+ return;
424
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
425
+ instance.datasource.dynamicFilter = cloneDeep(newFilter);
426
+ }
427
+ else {
428
+ const normalFilter = {};
429
+ Object.keys(newFilter).forEach((key) => {
430
+ if (!newFilter[key][0].value)
431
+ return;
432
+ normalFilter[key] = newFilter[key][0].value;
433
+ });
434
+ instance.datasource.filter = normalFilter;
435
+ }
436
+ debouncedDatasourceGet(instance);
437
+ instance.changeLayout();
438
+ };
439
+ const columnHasFilter = (columnName) => {
440
+ return instance.columnHasFilter(columnName);
441
+ };
442
+ const isRowVisible = (row, index) => {
443
+ return instance.isItemVisible(row) && gridEditableScope.shouldRender(index);
444
+ };
445
+ const isCurrentRowGroup = (row) => {
446
+ const { uniqueKey, currentRow } = instance.datasource;
447
+ return !!((row.group && row.groupValue === currentRow.groupValue) ||
448
+ (row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey]));
449
+ };
450
+ const isGroupSelectIndeterminate = (item) => {
451
+ let hasSelected = false;
452
+ let hasNotSelected = false;
453
+ const { uniqueKey } = instance.datasource;
454
+ item.children.forEach((child) => {
455
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
456
+ hasSelected = hasSelected || idx !== -1;
457
+ hasNotSelected = hasNotSelected || idx === -1;
458
+ });
459
+ return hasSelected && hasNotSelected;
460
+ };
461
+ const isGroupSelected = (item) => {
462
+ return item.children.every((child) => {
463
+ const { uniqueKey } = instance.datasource;
464
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
465
+ return idx !== -1;
466
+ });
467
+ };
468
+ const selectGroupRowClick = (row, isSelected, event) => {
469
+ nextTick(() => {
470
+ const rootElement = getRootElement(root);
471
+ instance.selectGroupClick(row, isSelected, event, rootElement.value);
472
+ });
473
+ };
474
+ const selectGroup = (item, event) => {
475
+ const { uniqueKey } = instance.datasource;
476
+ const isSelected = isGroupSelected(item);
477
+ if (!isSelected) {
478
+ // here we fetch the item from renderedData because vuetify isSelected checks for object reference
479
+ // so we need to find the item inside renderedData to call selectRow() with the correct reference
480
+ // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VDataTable/composables/select.ts#L128
481
+ const items = item.children.map((child) => {
482
+ return renderedData.value.find((row) => child[uniqueKey] === row[uniqueKey]);
483
+ });
484
+ items.forEach((child) => {
485
+ if (!child)
486
+ return;
487
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
488
+ if (idx === -1) {
489
+ instance.selectRow(child, true);
490
+ }
491
+ });
492
+ }
493
+ else {
494
+ item.children.forEach((child) => {
495
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
496
+ if (idx !== -1) {
497
+ instance.selectRow(child, false);
498
+ }
499
+ });
500
+ }
501
+ selectGroupRowClick(item, !isSelected, event);
502
+ };
503
+ const openGroup = (item) => {
504
+ instance.openGroup(item);
505
+ };
506
+ const isGroup = (item) => {
507
+ return !!item.group;
508
+ };
509
+ const isFooter = (item) => {
510
+ return !!item.groupFooter;
511
+ };
512
+ const groupColumnNames = computed(() => {
513
+ return instance.columns.filter((column) => column.grouped).map((column) => column.name) || [];
514
+ });
515
+ return Object.assign(Object.assign({}, gridEditableScope), { instance,
516
+ root,
517
+ filter,
518
+ setFilter,
519
+ columnHasFilter,
520
+ visibleColumns,
521
+ isRowVisible,
522
+ isCurrentRowGroup,
523
+ isGroupSelectIndeterminate,
524
+ selectGroup,
525
+ isGroup,
526
+ openGroup,
527
+ renderedData,
528
+ isGroupSelected,
529
+ groupColumnNames,
530
+ isFooter,
531
+ visibleData });
532
+ },
533
+ });
534
+
535
+ const _hoisted_1$5 = ["colspan"];
536
+ const _hoisted_2$2 = ["colspan"];
537
+
538
+ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
539
+ const _component_zd_grid_toolbar = resolveComponent("zd-grid-toolbar");
540
+ const _component_tek_grid_header_row = resolveComponent("tek-grid-header-row");
541
+ const _component_tek_grid_group_row = resolveComponent("tek-grid-group-row");
542
+ const _component_tek_grid_indentation = resolveComponent("tek-grid-indentation");
543
+ const _component_zd_grid_editable_row = resolveComponent("zd-grid-editable-row");
544
+ const _component_tek_grid_footer_row = resolveComponent("tek-grid-footer-row");
545
+ const _component_zd_iterable_no_data = resolveComponent("zd-iterable-no-data");
546
+ const _component_zd_grid_footer = resolveComponent("zd-grid-footer");
547
+ const _component_v_data_table = resolveComponent("v-data-table");
548
+
549
+ return withDirectives((openBlock(), createBlock(_component_v_data_table, {
550
+ ref: "root",
551
+ id: _ctx.instance.name,
552
+ modelValue: _ctx.selectedRows,
553
+ "onUpdate:modelValue": _cache[12] || (_cache[12] = $event => ((_ctx.selectedRows) = $event)),
554
+ class: normalizeClass([
555
+ 'zd-grid',
556
+ 'tek-grid',
557
+ 'zd-grid-editable',
558
+ _ctx.instance.cssClass,
559
+ {
560
+ 'zd-grid--loading': _ctx.instance.datasource.loading,
561
+ 'zd-grid--cell-selection': _ctx.instance.cellSelection,
562
+ },
563
+ ]),
564
+ style: normalizeStyle([
565
+ _ctx.cssColorVars,
566
+ {
567
+ height: _ctx.$formatSize(_ctx.instance.height),
568
+ width: _ctx.$formatSize(_ctx.instance.width),
569
+ maxHeight: _ctx.$formatSize(_ctx.instance.maxHeight),
570
+ minHeight: _ctx.$formatSize(_ctx.instance.minHeight),
571
+ maxWidth: _ctx.$formatSize(_ctx.instance.maxWidth),
572
+ minWidth: _ctx.$formatSize(_ctx.instance.minWidth),
573
+ },
574
+ _ctx.$styleObject(_ctx.instance.cssStyle),
575
+ ]),
576
+ theme: _ctx.instance.theme,
577
+ "sort-asc-icon": "$collapse",
578
+ "sort-desc-icon": "$expand",
579
+ "fixed-header": "",
580
+ "multi-sort": "",
581
+ "hide-default-footer": "",
582
+ name: _ctx.instance.name,
583
+ headers: _ctx.headers,
584
+ items: _ctx.renderedData,
585
+ search: _ctx.instance.datasource.search,
586
+ density: _ctx.instance.dense ? 'compact' : 'default',
587
+ loading: _ctx.instance.datasource.loading,
588
+ "item-value": _ctx.instance.datasource.uniqueKey,
589
+ "items-per-page": -1,
590
+ "no-filter": "",
591
+ "sort-by": _ctx.sortBy,
592
+ "disable-sort": "",
593
+ "return-object": "",
594
+ tabindex: "0",
595
+ "onUpdate:sortBy": _cache[13] || (_cache[13] = $event => (_ctx.updateSortBy($event)))
596
+ }, createSlots({
597
+ top: withCtx(() => [
598
+ (!_ctx.hasToolbarSlot)
599
+ ? (openBlock(), createBlock(_component_zd_grid_toolbar, { key: 0 }))
600
+ : createCommentVNode("v-if", true),
601
+ renderSlot(_ctx.$slots, "toolbarSlot")
602
+ ]),
603
+ headers: withCtx(({ columns: tableColumns, isSorted, getSortIcon, toggleSort, sortBy }) => [
604
+ (_ctx.instance.showHeader)
605
+ ? (openBlock(), createBlock(_component_tek_grid_header_row, {
606
+ key: 0,
607
+ name: _ctx.instance.name,
608
+ selectable: _ctx.instance.selectable,
609
+ headerBackground: _ctx.instance.headerBackground,
610
+ showSelectAll: _ctx.instance.showSelectAll,
611
+ allselectedState: _ctx.allselectedState,
612
+ visibleColumns: _ctx.visibleColumns,
613
+ dragColumns: _ctx.instance.dragColumns,
614
+ headerCellTextColor: _ctx.instance.headerCellTextColor,
615
+ resizeColumns: _ctx.instance.resizeColumns,
616
+ getSortIcon: getSortIcon,
617
+ toggleSort: toggleSort,
618
+ sortBy: sortBy,
619
+ tableColumns: tableColumns,
620
+ isSorted: isSorted,
621
+ disableCheckbox: _ctx.instance.editing,
622
+ instanceName: _ctx.instance.name,
623
+ filterRelationsDatasource: _ctx.instance.filterRelationsDatasource,
624
+ filterOperationsDatasource: _ctx.instance.filterOperationsDatasource,
625
+ modelValue: _ctx.filter,
626
+ columnFilterButton: _ctx.instance.columnFilterButton,
627
+ columnHasFilter: _ctx.columnHasFilter,
628
+ level: _ctx.groupColumnNames.length,
629
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (_ctx.setFilter($event))),
630
+ onResizeMousedown: _cache[1] || (_cache[1] = $event => (_ctx.resizeMouseDownHandler($event.column, $event.event))),
631
+ onResizeClick: _cache[2] || (_cache[2] = $event => (_ctx.resizeClickHandler($event.event))),
632
+ onSelectAllClick: _cache[3] || (_cache[3] = $event => (_ctx.selectAllClick($event)))
633
+ }, null, 8 /* PROPS */, ["name", "selectable", "headerBackground", "showSelectAll", "allselectedState", "visibleColumns", "dragColumns", "headerCellTextColor", "resizeColumns", "getSortIcon", "toggleSort", "sortBy", "tableColumns", "isSorted", "disableCheckbox", "instanceName", "filterRelationsDatasource", "filterOperationsDatasource", "modelValue", "columnFilterButton", "columnHasFilter", "level"]))
634
+ : createCommentVNode("v-if", true)
635
+ ]),
636
+ "no-data": withCtx(() => [
637
+ createVNode(_component_zd_iterable_no_data, null, {
638
+ errorSlot: withCtx(() => [
639
+ renderSlot(_ctx.$slots, "errorSlot")
640
+ ]),
641
+ noResultSlot: withCtx(() => [
642
+ renderSlot(_ctx.$slots, "noResultSlot")
643
+ ]),
644
+ noDataSlot: withCtx(() => [
645
+ renderSlot(_ctx.$slots, "noDataSlot")
646
+ ]),
647
+ _: 3 /* FORWARDED */
648
+ })
649
+ ]),
650
+ bottom: withCtx(() => [
651
+ (_ctx.instance.showFooter && !_ctx.hasFooterSlot)
652
+ ? (openBlock(), createBlock(_component_zd_grid_footer, { key: 0 }))
653
+ : createCommentVNode("v-if", true),
654
+ renderSlot(_ctx.$slots, "footerSlot")
655
+ ]),
656
+ _: 2 /* DYNAMIC */
657
+ }, [
658
+ (_ctx.addTopPadding())
659
+ ? {
660
+ name: "body.prepend",
661
+ fn: withCtx(({ headers }) => [
662
+ createElementVNode("tr", null, [
663
+ createElementVNode("td", {
664
+ colspan: headers.length,
665
+ style: normalizeStyle(`padding-top:${_ctx.scrollData.startHeight}px`)
666
+ }, null, 12 /* STYLE, PROPS */, _hoisted_1$5)
667
+ ])
668
+ ]),
669
+ key: "0"
670
+ }
671
+ : undefined,
672
+ (_ctx.addBottomPadding())
673
+ ? {
674
+ name: "body.append",
675
+ fn: withCtx(({ headers }) => [
676
+ createElementVNode("tr", null, [
677
+ createElementVNode("td", {
678
+ colspan: headers.length,
679
+ style: normalizeStyle(`padding-top:${_ctx.scrollData.endHeight}px`)
680
+ }, null, 12 /* STYLE, PROPS */, _hoisted_2$2)
681
+ ])
682
+ ]),
683
+ key: "1"
684
+ }
685
+ : undefined,
686
+ (_ctx.instance.datasource.data.length)
687
+ ? {
688
+ name: "body",
689
+ fn: withCtx(({ internalItems, isSelected }) => [
690
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, i) => {
691
+ return (openBlock(), createElementBlock(Fragment, null, [
692
+ (_ctx.isRowVisible(item, i))
693
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
694
+ (_ctx.isGroup(item))
695
+ ? (openBlock(), createBlock(_component_tek_grid_group_row, {
696
+ key: item.groupColumnName + item.groupValue,
697
+ row: item,
698
+ "is-current-row": _ctx.isCurrentRowGroup(item),
699
+ selectable: _ctx.instance.selectable,
700
+ selectionDisabled: _ctx.instance.callDisableSelection(item),
701
+ cellSelection: _ctx.instance.cellSelection,
702
+ "is-current": _ctx.isCurrent,
703
+ isSelected: _ctx.isGroupSelected(item),
704
+ indeterminate: _ctx.isGroupSelectIndeterminate(item),
705
+ onClick: $event => (_ctx.rowClick(item, $event)),
706
+ onCheckboxClick: $event => (_ctx.selectGroup(item, $event)),
707
+ onFocusin: _cache[4] || (_cache[4] = $event => (_ctx.cellFocusIn($event))),
708
+ onExpandClick: $event => (_ctx.openGroup(item))
709
+ }, null, 8 /* PROPS */, ["row", "is-current-row", "selectable", "selectionDisabled", "cellSelection", "is-current", "isSelected", "indeterminate", "onClick", "onCheckboxClick", "onExpandClick"]))
710
+ : (!_ctx.isFooter(item))
711
+ ? (openBlock(), createBlock(_component_zd_grid_editable_row, {
712
+ key: _ctx.instance.getRowKey(item),
713
+ isSelected: isSelected(internalItems[i]),
714
+ isCurrentRow: _ctx.isCurrentRow(item),
715
+ selectable: _ctx.instance.selectable,
716
+ selectionDisabled: _ctx.instance.callDisableSelection(item),
717
+ cellSelection: _ctx.instance.cellSelection,
718
+ isCurrent: _ctx.isCurrent,
719
+ columns: _ctx.visibleColumns,
720
+ row: item,
721
+ fixedLeft: _ctx.fixedLeft,
722
+ fixedRight: _ctx.fixedRight,
723
+ isEditing: _ctx.isEditing,
724
+ onCellFocus: _cache[5] || (_cache[5] = $event => (_ctx.cellFocus($event))),
725
+ onCellClick: _cache[6] || (_cache[6] = $event => (_ctx.cellClick($event))),
726
+ onClick: $event => (_ctx.rowClick(item, $event)),
727
+ onFocusin: _cache[7] || (_cache[7] = $event => (_ctx.cellFocusIn($event))),
728
+ onCheckboxClick: $event => (_ctx.selectRowClick(item, !isSelected(internalItems[i]), $event)),
729
+ onCellEnterEdit: _cache[8] || (_cache[8] = $event => (_ctx.cellEnterEdit($event))),
730
+ onCellKeydown: _cache[9] || (_cache[9] = $event => (_ctx.cellKeydown($event)))
731
+ }, {
732
+ "cell-prepend": withCtx(({ index }) => [
733
+ (index === 0 && _ctx.groupColumnNames.length > 0)
734
+ ? (openBlock(), createBlock(_component_tek_grid_indentation, {
735
+ key: 0,
736
+ level: item.groupHeaders?.length
737
+ }, null, 8 /* PROPS */, ["level"]))
738
+ : createCommentVNode("v-if", true)
739
+ ]),
740
+ _: 2 /* DYNAMIC */
741
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["isSelected", "isCurrentRow", "selectable", "selectionDisabled", "cellSelection", "isCurrent", "columns", "row", "fixedLeft", "fixedRight", "isEditing", "onClick", "onCheckboxClick"]))
742
+ : (openBlock(), createBlock(_component_tek_grid_footer_row, {
743
+ key: 'footer' + item.groupColumnName + item.groupValue,
744
+ isSelected: isSelected(internalItems[i]),
745
+ selectable: _ctx.instance.selectable,
746
+ selectionDisabled: _ctx.instance.callDisableSelection(item),
747
+ cellSelection: _ctx.instance.cellSelection,
748
+ isCurrent: _ctx.isCurrent,
749
+ columns: _ctx.visibleColumns,
750
+ row: item,
751
+ fixedLeft: _ctx.fixedLeft,
752
+ fixedRight: _ctx.fixedRight,
753
+ onCellFocus: _cache[10] || (_cache[10] = $event => (_ctx.cellFocus($event))),
754
+ onFocusin: _cache[11] || (_cache[11] = $event => (_ctx.cellFocusIn($event)))
755
+ }, null, 8 /* PROPS */, ["isSelected", "selectable", "selectionDisabled", "cellSelection", "isCurrent", "columns", "row", "fixedLeft", "fixedRight"]))
756
+ ], 64 /* STABLE_FRAGMENT */))
757
+ : createCommentVNode("v-if", true)
758
+ ], 64 /* STABLE_FRAGMENT */))
759
+ }), 256 /* UNKEYED_FRAGMENT */))
760
+ ]),
761
+ key: "2"
762
+ }
763
+ : undefined
764
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["id", "modelValue", "class", "style", "theme", "name", "headers", "items", "search", "density", "loading", "item-value", "sort-by"])), [
765
+ [vShow, _ctx.instance.isVisible]
766
+ ])
767
+ }
768
+
769
+ gridEditableComponent$1.render = render$a;
770
+ gridEditableComponent$1.__file = "src/components/tek-grid/TekGrid.vue";
771
+
772
+ const isArrayOperation = (operation) => {
773
+ return ['IN', 'NOT_IN', 'BETWEEN'].includes(operation);
774
+ };
775
+
776
+ const TekGridColumnFilterProps$1 = {
777
+ hasFilterData: {
778
+ type: Boolean,
779
+ default: false,
780
+ },
781
+ column: {
782
+ type: Object,
783
+ required: true,
784
+ },
785
+ modelValue: {
786
+ type: Array,
787
+ default: [],
788
+ },
789
+ instanceName: {
790
+ type: String,
791
+ required: true,
792
+ },
793
+ filterRelationsDatasource: {
794
+ type: [Object, null],
795
+ required: false,
796
+ },
797
+ filterOperationsDatasource: {
798
+ type: [Object, null],
799
+ required: false,
800
+ },
801
+ isHovering: {
802
+ type: Boolean,
803
+ default: false,
804
+ },
805
+ multiple: {
806
+ type: Boolean,
807
+ required: true,
808
+ },
809
+ };
810
+ const tekGridColumnFilter$1 = defineComponent({
811
+ props: TekGridColumnFilterProps$1,
812
+ inheritAttrs: false,
813
+ emits: ['update:modelValue'],
814
+ setup(props, ctx) {
815
+ const getValueInputName = (index) => `${props.instanceName}-${props.column.name}-filter-value-${index}`;
816
+ const focusValueInput = (index) => {
817
+ const valueInputName = getValueInputName(index);
818
+ const input = Metadata.getInstance(valueInputName);
819
+ input.setFocus();
820
+ };
821
+ const createNewFilter = () => {
822
+ return reactive({
823
+ operation: 'CONTAINS',
824
+ relation: 'AND',
825
+ value: undefined,
826
+ });
827
+ };
828
+ let newFilter = createNewFilter();
829
+ const convertToDateFormat = (value, revert) => {
830
+ const dateFormat = props.column.componentProps.dateFormat || Config.dateFormat;
831
+ const displayFormat = props.column.componentProps.displayFormat || Config.displayFormat;
832
+ if (revert) {
833
+ if (dayjs(value, displayFormat).isValid() || !dayjs(value, dateFormat).isValid()) {
834
+ return value;
835
+ }
836
+ return dayjs(value, dateFormat).format(displayFormat);
837
+ }
838
+ if (dayjs(value, dateFormat).isValid() || !dayjs(value, displayFormat).isValid()) {
839
+ return value;
840
+ }
841
+ return dayjs(value, displayFormat).format(dateFormat);
842
+ };
843
+ const checkDateValueFormat = (value, revert = false) => {
844
+ if (!['ZdDate', 'ZdDateRange'].includes(props.column.componentProps.component))
845
+ return value;
846
+ if (Array.isArray(value)) {
847
+ return value.map((item) => convertToDateFormat(item, revert));
848
+ }
849
+ return convertToDateFormat(value, revert);
850
+ };
851
+ // use WeakMap to avoid memory leaks
852
+ const idMap = new WeakMap();
853
+ let idCounter = 0;
854
+ // retrieves a unique id for each item
855
+ const getId = (item) => {
856
+ if (!idMap.has(item)) {
857
+ idMap.set(item, `__item__${idCounter++}`);
858
+ }
859
+ return idMap.get(item);
860
+ };
861
+ // use computed to generate unique ids for each filter item
862
+ // this is needed for the v-for :key updates
863
+ const modelWithIds = computed(() => {
864
+ if (!props.multiple) {
865
+ if (props.modelValue.length > 0) {
866
+ return [{ id: getId(props.modelValue[0]), item: props.modelValue[0] }];
867
+ }
868
+ return [{ id: getId(newFilter), item: newFilter }];
869
+ }
870
+ return [...props.modelValue, newFilter].map((item) => ({
871
+ id: getId(item),
872
+ item,
873
+ }));
874
+ });
875
+ const debounceUpdateModel = debounce((modelValue) => {
876
+ if (Utils.isEqual(modelValue, props.modelValue))
877
+ return;
878
+ ctx.emit('update:modelValue', modelValue);
879
+ newFilter = createNewFilter();
880
+ }, 500);
881
+ const changeRelation = (index, { component }) => {
882
+ const modelValue = cloneDeep(props.modelValue);
883
+ const isNewFilter = index === modelValue.length;
884
+ const filter = isNewFilter ? newFilter : modelValue[index];
885
+ const { value } = component;
886
+ focusValueInput(index);
887
+ // update item type value
888
+ filter.relation = value;
889
+ if (isNewFilter)
890
+ return;
891
+ debounceUpdateModel(modelValue);
892
+ };
893
+ const changeOperation = (index, { component }) => {
894
+ const modelValue = cloneDeep(props.modelValue);
895
+ const filterItem = modelValue[index];
896
+ const isNewFilter = index === modelValue.length;
897
+ const filter = isNewFilter ? newFilter : filterItem;
898
+ const { value } = component;
899
+ focusValueInput(index);
900
+ // if operation is IN, NOT_IN or BETWEEN, value should be an array
901
+ if (isArrayOperation(value)) {
902
+ filter.value = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
903
+ }
904
+ // update item type value
905
+ filter.operation = value;
906
+ if (isNewFilter)
907
+ return;
908
+ debounceUpdateModel(modelValue);
909
+ };
910
+ const changeValue = (item, index, { component }) => {
911
+ const modelValue = cloneDeep(props.modelValue);
912
+ const filter = cloneDeep(item);
913
+ const { value } = component;
914
+ const isNewFilter = props.multiple && index === modelValue.length;
915
+ let formattedValue = value;
916
+ if (value && isArrayOperation(filter.operation)) {
917
+ formattedValue = value.split(';');
918
+ }
919
+ filter.value = checkDateValueFormat(formattedValue);
920
+ if (!props.multiple) {
921
+ debounceUpdateModel([filter]);
922
+ return;
923
+ }
924
+ if (isNewFilter) {
925
+ // only emit event when newFilter has value
926
+ if (!filter.value)
927
+ return;
928
+ debounceUpdateModel([...modelValue, filter]);
929
+ return;
930
+ }
931
+ if (!filter.value) {
932
+ // when removing the last (not new) filter, should pass its operation and relation to the new filter
933
+ if (index === modelValue.length - 1) {
934
+ newFilter.operation = filter.operation;
935
+ newFilter.relation = filter.relation;
936
+ }
937
+ modelValue.splice(index, 1);
938
+ // if the removed filter was the first, should set the new first relation to AND
939
+ if (modelValue.length > 0 && index === 0) {
940
+ modelValue[0].relation = 'AND';
941
+ }
942
+ // if the removed filter was the last, should set the newFilter relation to AND
943
+ if (modelValue.length === 0) {
944
+ newFilter.relation = 'AND';
945
+ }
946
+ }
947
+ debounceUpdateModel(modelValue);
948
+ };
949
+ const getComponentType = (operation) => {
950
+ return isArrayOperation(operation) ? 'ZdTextInput' : props.column.componentProps.component;
951
+ };
952
+ const getComponentHint = (operation) => {
953
+ return isArrayOperation(operation) ? 'TEKGRID_MULTIPLE_VALUE_HINT' : '';
954
+ };
955
+ const getItemValue = (item) => {
956
+ return isArrayOperation(item.operation) ? item.value.join(';') : item.value;
957
+ };
958
+ return {
959
+ changeValue,
960
+ changeRelation,
961
+ changeOperation,
962
+ getValueInputName,
963
+ newFilter,
964
+ getComponentType,
965
+ getComponentHint,
966
+ modelWithIds,
967
+ getItemValue,
968
+ };
969
+ },
970
+ });
971
+
972
+ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
973
+ const _component_zd_grid_header_icon = resolveComponent("zd-grid-header-icon");
974
+ const _component_zd_radio = resolveComponent("zd-radio");
975
+ const _component_zd_select = resolveComponent("zd-select");
976
+ const _component_v_card = resolveComponent("v-card");
977
+ const _component_v_menu = resolveComponent("v-menu");
978
+
979
+ return (openBlock(), createBlock(_component_v_menu, {
980
+ "offset-overflow": "",
981
+ "offset-y": "",
982
+ transition: "scale-transition",
983
+ "content-class": "tek-grid-column-filter__menu",
984
+ "close-on-content-click": false
985
+ }, {
986
+ activator: withCtx(({ props }) => [
987
+ createVNode(_component_zd_grid_header_icon, mergeProps(props, {
988
+ icon: _ctx.$getIcon('filter'),
989
+ hidden: !_ctx.isHovering && !_ctx.hasFilterData,
990
+ color: _ctx.hasFilterData ? 'primary' : ''
991
+ }), null, 16 /* FULL_PROPS */, ["icon", "hidden", "color"])
992
+ ]),
993
+ default: withCtx(() => [
994
+ createVNode(_component_v_card, {
995
+ class: "zd-pa-4 zd-pb-0",
996
+ "min-width": 200,
997
+ "max-height": 300
998
+ }, {
999
+ default: withCtx(() => [
1000
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelWithIds, ({ item, id }, filterIndex) => {
1001
+ return (openBlock(), createElementBlock(Fragment, { key: id }, [
1002
+ createCommentVNode(" relation "),
1003
+ (_ctx.multiple && filterIndex > 0)
1004
+ ? (openBlock(), createBlock(_component_zd_radio, mergeProps({
1005
+ key: 0,
1006
+ name: `${_ctx.instanceName}-${_ctx.column.name}-filter-relation-${filterIndex}`
1007
+ }, { ref_for: true }, {
1008
+ showLabel: false,
1009
+ showHelper: false,
1010
+ vertical: false,
1011
+ cssClass: 'zd-mb-2',
1012
+ datasource: _ctx.filterRelationsDatasource,
1013
+ dataValue: 'value',
1014
+ dataLabel: 'text',
1015
+ value: item.relation,
1016
+ events: {
1017
+ change: (params) => _ctx.changeRelation(filterIndex, params),
1018
+ },
1019
+ }), null, 16 /* FULL_PROPS */, ["name"]))
1020
+ : createCommentVNode("v-if", true),
1021
+ createCommentVNode(" operation "),
1022
+ (_ctx.multiple && item.operation)
1023
+ ? (openBlock(), createBlock(_component_zd_select, mergeProps({
1024
+ key: 1,
1025
+ name: `${_ctx.instanceName}-${_ctx.column.name}-filter-operation-${filterIndex}`
1026
+ }, { ref_for: true }, {
1027
+ autocomplete: false,
1028
+ showLabel: false,
1029
+ showHelper: false,
1030
+ clearable: false,
1031
+ cssClass: 'zd-mb-2',
1032
+ datasource: _ctx.filterOperationsDatasource,
1033
+ dataValue: 'value',
1034
+ dataText: 'text',
1035
+ value: item.operation,
1036
+ events: {
1037
+ change: (params) => _ctx.changeOperation(filterIndex, params),
1038
+ },
1039
+ }), null, 16 /* FULL_PROPS */, ["name"]))
1040
+ : createCommentVNode("v-if", true),
1041
+ createCommentVNode(" value "),
1042
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.getComponentType(item.operation)), mergeProps({
1043
+ name: `${_ctx.instanceName}-${_ctx.column.name}-filter-value-${filterIndex}`
1044
+ }, { ref_for: true }, {
1045
+ ..._ctx.column.componentProps,
1046
+ showLabel: false,
1047
+ showHelper: true,
1048
+ autofill: false,
1049
+ cssClass: 'zd-mb-2',
1050
+ value: _ctx.getItemValue(item),
1051
+ persistentHint: true,
1052
+ hint: _ctx.getComponentHint(item.operation),
1053
+ events: {
1054
+ input: (params) => _ctx.changeValue(item, filterIndex, params),
1055
+ change: (params) => _ctx.changeValue(item, filterIndex, params),
1056
+ },
1057
+ }), null, 16 /* FULL_PROPS */, ["name"]))
1058
+ ], 64 /* STABLE_FRAGMENT */))
1059
+ }), 128 /* KEYED_FRAGMENT */))
1060
+ ]),
1061
+ _: 1 /* STABLE */
1062
+ })
1063
+ ]),
1064
+ _: 1 /* STABLE */
1065
+ }))
1066
+ }
1067
+
1068
+ tekGridColumnFilter$1.render = render$9;
1069
+ tekGridColumnFilter$1.__file = "src/components/tek-grid/column-filter/TekGridColumnFilter.vue";
1070
+
1071
+ var script$3 = defineComponent({
1072
+ props: {
1073
+ selectable: {
1074
+ type: Boolean,
1075
+ default: false,
1076
+ },
1077
+ headerBackground: {
1078
+ type: String,
1079
+ default: '',
1080
+ },
1081
+ showSelectAll: {
1082
+ type: Boolean,
1083
+ default: false,
1084
+ },
1085
+ allselectedState: {
1086
+ type: Number,
1087
+ default: 0,
1088
+ },
1089
+ visibleColumns: {
1090
+ type: Array,
1091
+ default: () => [],
1092
+ },
1093
+ dragColumns: {
1094
+ type: Boolean,
1095
+ default: false,
1096
+ },
1097
+ headerCellTextColor: {
1098
+ type: String,
1099
+ default: '',
1100
+ },
1101
+ resizeColumns: {
1102
+ type: Boolean,
1103
+ default: false,
1104
+ },
1105
+ getSortIcon: {
1106
+ type: Function,
1107
+ default: () => { },
1108
+ },
1109
+ isSorted: {
1110
+ type: Function,
1111
+ default: () => { },
1112
+ },
1113
+ toggleSort: {
1114
+ type: Function,
1115
+ default: () => { },
1116
+ },
1117
+ tableColumns: {
1118
+ type: Array,
1119
+ default: () => [],
1120
+ },
1121
+ sortBy: {
1122
+ type: Array,
1123
+ default: () => [],
1124
+ },
1125
+ disableCheckbox: {
1126
+ type: Boolean,
1127
+ default: false,
1128
+ },
1129
+ sortable: {
1130
+ type: Boolean,
1131
+ default: true,
1132
+ },
1133
+ name: {
1134
+ type: String,
1135
+ default: '',
1136
+ },
1137
+ modelValue: {
1138
+ type: Object,
1139
+ default: () => [],
1140
+ },
1141
+ instanceName: {
1142
+ type: String,
1143
+ required: true,
1144
+ },
1145
+ filterRelationsDatasource: {
1146
+ type: [Object, null],
1147
+ required: false,
1148
+ },
1149
+ filterOperationsDatasource: {
1150
+ type: [Object, null],
1151
+ required: false,
1152
+ },
1153
+ columnFilterButton: {
1154
+ type: Boolean,
1155
+ required: true,
1156
+ },
1157
+ columnHasFilter: {
1158
+ type: Function,
1159
+ required: true,
1160
+ },
1161
+ level: {
1162
+ type: Number,
1163
+ default: 0,
1164
+ },
1165
+ },
1166
+ emits: ['selectAllClick', 'resizeMousedown', 'resizeClick', 'update:modelValue'],
1167
+ setup(props, { emit }) {
1168
+ const calcWidth = inject('calcWidth');
1169
+ if (!calcWidth) {
1170
+ // TODO: use NotProvidedError
1171
+ throw new Error('calcWidth');
1172
+ }
1173
+ const selectAllClick = (event) => {
1174
+ emit('selectAllClick', event);
1175
+ };
1176
+ const resizeMousedown = (column, event) => {
1177
+ emit('resizeMousedown', { event, column });
1178
+ };
1179
+ const resizeClick = (event) => {
1180
+ emit('resizeClick', { event });
1181
+ };
1182
+ const findOrderIndex = (sortBy, column) => {
1183
+ return sortBy.findIndex((sort) => sort.key === column.name);
1184
+ };
1185
+ const updateModelValue = (columnName, value) => {
1186
+ const modelValue = Object.assign({}, props.modelValue);
1187
+ modelValue[columnName] = value;
1188
+ emit('update:modelValue', modelValue);
1189
+ };
1190
+ const showFilterButton = (column) => {
1191
+ return column.type !== 'action' && props.columnFilterButton && column.filterable;
1192
+ };
1193
+ return {
1194
+ calcWidth,
1195
+ resizeMousedown,
1196
+ resizeClick,
1197
+ findOrderIndex,
1198
+ updateModelValue,
1199
+ showFilterButton,
1200
+ selectAllClick,
1201
+ };
1202
+ },
1203
+ });
1204
+
1205
+ const _hoisted_1$4 = {
1206
+ key: 0,
1207
+ class: "tek-grid-column-aggregation"
1208
+ };
1209
+
1210
+ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
1211
+ const _component_tek_grid_indentation = resolveComponent("tek-grid-indentation");
1212
+ const _component_tek_grid_column_filter = resolveComponent("tek-grid-column-filter");
1213
+ const _component_zd_grid_column_header = resolveComponent("zd-grid-column-header");
1214
+ const _component_zd_grid_header_row = resolveComponent("zd-grid-header-row");
1215
+
1216
+ return (openBlock(), createBlock(_component_zd_grid_header_row, {
1217
+ name: _ctx.name,
1218
+ selectable: _ctx.selectable,
1219
+ headerBackground: _ctx.headerBackground,
1220
+ showSelectAll: _ctx.showSelectAll,
1221
+ allselectedState: _ctx.allselectedState,
1222
+ visibleColumns: _ctx.visibleColumns,
1223
+ dragColumns: _ctx.dragColumns,
1224
+ headerCellTextColor: _ctx.headerCellTextColor,
1225
+ resizeColumns: _ctx.resizeColumns,
1226
+ getSortIcon: _ctx.getSortIcon,
1227
+ toggleSort: _ctx.toggleSort,
1228
+ sortBy: _ctx.sortBy,
1229
+ tableColumns: _ctx.tableColumns,
1230
+ isSorted: _ctx.isSorted,
1231
+ disableCheckbox: _ctx.disableCheckbox,
1232
+ onSelectAllClick: _ctx.selectAllClick
1233
+ }, {
1234
+ default: withCtx(({ column, index, isHovering }) => [
1235
+ createVNode(_component_zd_grid_column_header, {
1236
+ cssStyle: {
1237
+ 'color': _ctx.headerCellTextColor,
1238
+ width: _ctx.calcWidth(column),
1239
+ },
1240
+ action: column.type === 'action',
1241
+ overflow: column.overflow,
1242
+ helperText: column.helperText,
1243
+ label: column.label,
1244
+ columnAlign: column.align,
1245
+ orderIndex: _ctx.findOrderIndex(_ctx.sortBy, column),
1246
+ isSortable: _ctx.sortable && column.sortable,
1247
+ resizeColumns: _ctx.resizeColumns,
1248
+ sortIcon: _ctx.getSortIcon(_ctx.tableColumns[index]),
1249
+ isSorted: _ctx.isSorted(_ctx.tableColumns[index]),
1250
+ isHovering: isHovering,
1251
+ onClick: $event => (_ctx.toggleSort(_ctx.tableColumns[index])),
1252
+ onResizeMousedown: $event => (_ctx.resizeMousedown(column, $event)),
1253
+ onResizeClick: _cache[0] || (_cache[0] = $event => (_ctx.resizeClick($event)))
1254
+ }, createSlots({
1255
+ label: withCtx(() => [
1256
+ (column.aggregation)
1257
+ ? (openBlock(), createElementBlock("span", _hoisted_1$4, "(" + toDisplayString(_ctx.$t(`TEKGRID_AGGREGATION_${column.aggregation}`)) + ") ", 1 /* TEXT */))
1258
+ : createCommentVNode("v-if", true)
1259
+ ]),
1260
+ _: 2 /* DYNAMIC */
1261
+ }, [
1262
+ (index === 0)
1263
+ ? {
1264
+ name: "prepend",
1265
+ fn: withCtx(() => [
1266
+ createVNode(_component_tek_grid_indentation, {
1267
+ level: _ctx.level,
1268
+ "show-divider": false
1269
+ }, null, 8 /* PROPS */, ["level"])
1270
+ ]),
1271
+ key: "0"
1272
+ }
1273
+ : undefined,
1274
+ (_ctx.showFilterButton(column))
1275
+ ? {
1276
+ name: "append",
1277
+ fn: withCtx(({ isHovering }) => [
1278
+ createVNode(_component_tek_grid_column_filter, {
1279
+ modelValue: _ctx.modelValue[column.name],
1280
+ hasFilterData: _ctx.columnHasFilter(column.name),
1281
+ column: column,
1282
+ instanceName: _ctx.instanceName,
1283
+ filterRelationsDatasource: _ctx.filterRelationsDatasource,
1284
+ filterOperationsDatasource: _ctx.filterOperationsDatasource,
1285
+ isHovering: isHovering,
1286
+ multiple: !!_ctx.filterRelationsDatasource && !!_ctx.filterOperationsDatasource,
1287
+ "onUpdate:modelValue": $event => (_ctx.updateModelValue(column.name, $event))
1288
+ }, null, 8 /* PROPS */, ["modelValue", "hasFilterData", "column", "instanceName", "filterRelationsDatasource", "filterOperationsDatasource", "isHovering", "multiple", "onUpdate:modelValue"])
1289
+ ]),
1290
+ key: "1"
1291
+ }
1292
+ : undefined
1293
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["cssStyle", "action", "overflow", "helperText", "label", "columnAlign", "orderIndex", "isSortable", "resizeColumns", "sortIcon", "isSorted", "isHovering", "onClick", "onResizeMousedown"])
1294
+ ]),
1295
+ _: 1 /* STABLE */
1296
+ }, 8 /* PROPS */, ["name", "selectable", "headerBackground", "showSelectAll", "allselectedState", "visibleColumns", "dragColumns", "headerCellTextColor", "resizeColumns", "getSortIcon", "toggleSort", "sortBy", "tableColumns", "isSorted", "disableCheckbox", "onSelectAllClick"]))
1297
+ }
1298
+
1299
+ script$3.render = render$8;
1300
+ script$3.__file = "src/components/tek-grid/column-header/TekGridHeaderRow.vue";
1301
+
1302
+ /******************************************************************************
1303
+ Copyright (c) Microsoft Corporation.
1304
+
1305
+ Permission to use, copy, modify, and/or distribute this software for any
1306
+ purpose with or without fee is hereby granted.
1307
+
1308
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1309
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1310
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1311
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1312
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1313
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1314
+ PERFORMANCE OF THIS SOFTWARE.
1315
+ ***************************************************************************** */
1316
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1317
+
1318
+
1319
+ function __decorate(decorators, target, key, desc) {
1320
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1321
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1322
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1323
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1324
+ }
1325
+
1326
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1327
+ var e = new Error(message);
1328
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1329
+ };
1330
+
1331
+ let TekGridColumnsOptionsController = class TekGridColumnsOptionsController {
1332
+ constructor(modal) {
1333
+ this.columnData = {};
1334
+ this.fixedColumns = [];
1335
+ this.visibleColumns = [];
1336
+ this.groupedColumns = [];
1337
+ this.otherColumns = [];
1338
+ this.aggregationData = [];
1339
+ this.selectedColumnNames = [];
1340
+ this.searchValue = '';
1341
+ this.showGroups = true;
1342
+ this.updatingSelect = false;
1343
+ this.modal = modal;
1344
+ }
1345
+ updateArrays() {
1346
+ this.fixedColumns = [];
1347
+ this.visibleColumns = [];
1348
+ this.groupedColumns = [];
1349
+ this.otherColumns = [];
1350
+ Object.keys(this.columnData).forEach((name) => {
1351
+ const column = this.columnData[name];
1352
+ if (this.instanceValue && this.instanceValue.ignoreColumns.indexOf(column.name) === -1) {
1353
+ if (column.grouped) {
1354
+ this.groupedColumns.push(column);
1355
+ }
1356
+ else if (column.fixed) {
1357
+ this.fixedColumns.push(column);
1358
+ }
1359
+ else if (column.isVisible) {
1360
+ this.visibleColumns.push(column);
1361
+ }
1362
+ else {
1363
+ this.otherColumns.push(column);
1364
+ }
1365
+ }
1366
+ });
1367
+ }
1368
+ set instance(instance) {
1369
+ this.instanceValue = instance;
1370
+ this.iterableComponent = instance.iterableComponent;
1371
+ this.showGroups = instance.iterableComponent instanceof TekGrid;
1372
+ this.aggregationData = instance.getAggregationSelectData();
1373
+ this.columnData = {};
1374
+ this.iterableComponent.columns.forEach((column) => {
1375
+ this.columnData[column.name] = {
1376
+ name: column.name,
1377
+ label: column.label,
1378
+ fixed: column.fixed,
1379
+ isVisible: column.isVisible,
1380
+ align: column.align,
1381
+ grouped: column.grouped || false,
1382
+ groupOpened: column.groupOpened || false,
1383
+ aggregation: column.aggregation,
1384
+ aggregationText: this.getAggregationText(column.aggregation),
1385
+ selected: false,
1386
+ };
1387
+ });
1388
+ this.updateArrays();
1389
+ this.selectedColumnNames = [];
1390
+ }
1391
+ getAggregationText(aggregation) {
1392
+ let result = '';
1393
+ if (aggregation) {
1394
+ const idx = this.aggregationData.findIndex((item) => item.value === aggregation);
1395
+ if (idx !== -1) {
1396
+ result = ` (${this.aggregationData[idx].text})`;
1397
+ }
1398
+ }
1399
+ return result;
1400
+ }
1401
+ columnInSearch(column) {
1402
+ return !this.searchValue || Utils.normalize(column.label).indexOf(Utils.normalize(this.searchValue)) !== -1;
1403
+ }
1404
+ get fixedColumnData() {
1405
+ return this.fixedColumns.filter(this.columnInSearch.bind(this));
1406
+ }
1407
+ set fixedColumnData(_data) {
1408
+ // do nothing
1409
+ }
1410
+ get visibleColumnData() {
1411
+ return this.visibleColumns.filter(this.columnInSearch.bind(this));
1412
+ }
1413
+ set visibleColumnData(_data) {
1414
+ // do nothing
1415
+ }
1416
+ get groupedColumnData() {
1417
+ return this.groupedColumns.filter(this.columnInSearch.bind(this));
1418
+ }
1419
+ set groupedColumnData(_data) {
1420
+ // do nothing
1421
+ }
1422
+ get otherColumnData() {
1423
+ return this.otherColumns.filter(this.columnInSearch.bind(this));
1424
+ }
1425
+ set otherColumnData(_data) {
1426
+ // do nothing
1427
+ }
1428
+ get hasSelectedColumn() {
1429
+ return this.selectedColumnNames.length > 0;
1430
+ }
1431
+ get hasNoSelectedColumn() {
1432
+ return !this.hasSelectedColumn;
1433
+ }
1434
+ get detailColumnName() {
1435
+ const columnNames = this.selectedColumnNames.length
1436
+ ? this.selectedColumnNames.join(', ')
1437
+ : I18n.translate('TEKGRID_SELECT_COLUMN');
1438
+ return `${I18n.translate('TEKGRID_DETAILS_FOR')} ${columnNames}`;
1439
+ }
1440
+ get hasNoFixedColumns() {
1441
+ return this.fixedColumns.length === 0;
1442
+ }
1443
+ get hasNoVisibleColumns() {
1444
+ return this.visibleColumns.length === 0;
1445
+ }
1446
+ get hasNoGroupedColumns() {
1447
+ return this.groupedColumns.length === 0;
1448
+ }
1449
+ get hasNoOtherColumns() {
1450
+ return this.otherColumns.length === 0;
1451
+ }
1452
+ get hasNoSingleSelection() {
1453
+ return this.selectedColumnNames.length !== 1;
1454
+ }
1455
+ get selectedColumnLabel() {
1456
+ return this.selectedColumnNames.length === 1 ? this.columnData[this.selectedColumnNames[0]].label : '';
1457
+ }
1458
+ set selectedColumnLabel(value) {
1459
+ if (this.selectedColumnNames.length === 1) {
1460
+ this.columnData[this.selectedColumnNames[0]].label = value;
1461
+ }
1462
+ }
1463
+ getSameValue(propName) {
1464
+ const isEqual = this.selectedColumnNames.length > 0 &&
1465
+ this.selectedColumnNames.every((name) => this.columnData[name][propName] === this.columnData[this.selectedColumnNames[0]][propName]);
1466
+ return isEqual ? this.columnData[this.selectedColumnNames[0]][propName] : undefined;
1467
+ }
1468
+ setSameValue(propName, value) {
1469
+ this.selectedColumnNames.forEach((name) => {
1470
+ this.columnData[name][propName] = value;
1471
+ });
1472
+ }
1473
+ get groupInSelection() {
1474
+ return this.hasNoSelectedColumn || this.selectedColumnNames.some((name) => this.columnData[name].grouped);
1475
+ }
1476
+ get notGroupInSelection() {
1477
+ return this.hasNoSelectedColumn || this.selectedColumnNames.some((name) => !this.columnData[name].grouped);
1478
+ }
1479
+ get selectedColumnGroupOpened() {
1480
+ return this.getSameValue('groupOpened');
1481
+ }
1482
+ set selectedColumnGroupOpened(value) {
1483
+ this.setSameValue('groupOpened', value);
1484
+ }
1485
+ selectMounted({ component }) {
1486
+ this.updatingSelect = true;
1487
+ if (component.name === 'tekGridColumnsOptionsColumnAlignment') {
1488
+ component.value = this.selectedColumnsAlignment;
1489
+ }
1490
+ else if (component.name === 'tekGridColumnsOptionsColumnAggregation') {
1491
+ component.value = this.selectedColumnsAggregation;
1492
+ }
1493
+ // prevent changing column value from here
1494
+ setTimeout(() => {
1495
+ this.updatingSelect = false;
1496
+ }, 0);
1497
+ }
1498
+ selectChange({ component }) {
1499
+ if (this.updatingSelect)
1500
+ return;
1501
+ if (component.name === 'tekGridColumnsOptionsColumnAlignment') {
1502
+ this.setSameValue('align', component.value);
1503
+ }
1504
+ else {
1505
+ this.setSameValue('aggregation', component.value);
1506
+ this.setSameValue('aggregationText', this.getAggregationText(component.value));
1507
+ }
1508
+ }
1509
+ updateSelects() {
1510
+ this.selectedColumnsAlignment = this.updateSelect('align');
1511
+ this.selectedColumnsAggregation = this.updateSelect('aggregation');
1512
+ }
1513
+ updateSelect(propName) {
1514
+ this.updatingSelect = true;
1515
+ const propValue = this.getSameValue(propName);
1516
+ const selectNames = {
1517
+ align: 'tekGridColumnsOptionsColumnAlignment',
1518
+ aggregation: 'tekGridColumnsOptionsColumnAggregation',
1519
+ };
1520
+ const instances = Metadata.getInstances(selectNames[propName]);
1521
+ if (instances[0]) {
1522
+ instances[0].value = propValue;
1523
+ }
1524
+ // prevent changing column value from here
1525
+ setTimeout(() => {
1526
+ this.updatingSelect = false;
1527
+ }, 0);
1528
+ return propValue;
1529
+ }
1530
+ columnRemoveClick(column) {
1531
+ column.isVisible = false;
1532
+ this.selectedColumnNames.splice(this.selectedColumnNames.indexOf(column.name), 1);
1533
+ this.otherColumns.push(column);
1534
+ }
1535
+ columnFixedRemoveClick({ element }) {
1536
+ const columnName = element === null || element === void 0 ? void 0 : element.getAttribute('columnname');
1537
+ if (columnName) {
1538
+ const column = this.columnData[columnName];
1539
+ this.columnRemoveClick(column);
1540
+ this.fixedColumns.splice(this.fixedColumns.indexOf(column), 1);
1541
+ }
1542
+ }
1543
+ columnVisibleRemoveClick({ element }) {
1544
+ const columnName = element === null || element === void 0 ? void 0 : element.getAttribute('columnname');
1545
+ if (columnName) {
1546
+ const column = this.columnData[columnName];
1547
+ this.columnRemoveClick(column);
1548
+ this.visibleColumns.splice(this.visibleColumns.indexOf(column), 1);
1549
+ }
1550
+ }
1551
+ columnGroupedRemoveClick({ element }) {
1552
+ const columnName = element === null || element === void 0 ? void 0 : element.getAttribute('columnname');
1553
+ if (columnName) {
1554
+ const column = this.columnData[columnName];
1555
+ this.columnRemoveClick(column);
1556
+ this.groupedColumns.splice(this.groupedColumns.indexOf(column), 1);
1557
+ }
1558
+ }
1559
+ isMacPlatform() {
1560
+ return /Mac/.test(navigator.platform);
1561
+ }
1562
+ isMobilePlatform() {
1563
+ return /iPhone|iPad|Android/.test(navigator.platform);
1564
+ }
1565
+ columnClick({ element, event }) {
1566
+ const columnName = element.getAttribute('columnname');
1567
+ if (columnName) {
1568
+ const mouseEvent = event;
1569
+ const multiple = (this.isMacPlatform() && mouseEvent.metaKey) || mouseEvent.ctrlKey || this.isMobilePlatform();
1570
+ if (!multiple) {
1571
+ Object.keys(this.columnData).forEach((name) => {
1572
+ const column = this.columnData[name];
1573
+ column.selected = column.name === columnName;
1574
+ });
1575
+ }
1576
+ else {
1577
+ this.columnData[columnName].selected = !this.columnData[columnName].selected;
1578
+ }
1579
+ const orderedColumns = this.fixedColumns
1580
+ .concat(this.visibleColumns)
1581
+ .concat(this.groupedColumns)
1582
+ .concat(this.otherColumns);
1583
+ this.selectedColumnNames = orderedColumns.filter((column) => column.selected).map((column) => column.name);
1584
+ this.updateSelects();
1585
+ }
1586
+ }
1587
+ removeFromSourceList(columnName) {
1588
+ const column = this.columnData[columnName];
1589
+ const fixedIdx = this.fixedColumns.indexOf(column);
1590
+ if (fixedIdx !== -1) {
1591
+ this.fixedColumns.splice(fixedIdx, 1);
1592
+ }
1593
+ else {
1594
+ const visibleIdx = this.visibleColumns.indexOf(column);
1595
+ if (visibleIdx !== -1) {
1596
+ this.visibleColumns.splice(visibleIdx, 1);
1597
+ }
1598
+ else {
1599
+ const groupedIdx = this.groupedColumns.indexOf(column);
1600
+ if (groupedIdx !== -1) {
1601
+ this.groupedColumns.splice(groupedIdx, 1);
1602
+ }
1603
+ else {
1604
+ const otherIdx = this.otherColumns.indexOf(column);
1605
+ if (otherIdx !== -1) {
1606
+ this.otherColumns.splice(otherIdx, 1);
1607
+ }
1608
+ }
1609
+ }
1610
+ }
1611
+ }
1612
+ onDragEnd(event) {
1613
+ const columnName = event.item.getAttribute('columnname');
1614
+ if (this.selectedColumnNames.indexOf(columnName) === -1) {
1615
+ this.selectedColumnNames = [columnName];
1616
+ this.updateSelects();
1617
+ setTimeout(() => {
1618
+ Object.keys(this.columnData).forEach((name) => {
1619
+ const column = this.columnData[name];
1620
+ column.selected = column.name === columnName;
1621
+ });
1622
+ });
1623
+ }
1624
+ this.selectedColumnNames.forEach((name, index) => {
1625
+ const newIndex = event.newIndex + index;
1626
+ if (name) {
1627
+ this.removeFromSourceList(name);
1628
+ const column = this.columnData[name];
1629
+ if (event.to.id === 'tekGridColumnsOptionsFixedColumns') {
1630
+ column.fixed = true;
1631
+ column.isVisible = true;
1632
+ column.grouped = false;
1633
+ column.groupOpened = false;
1634
+ this.fixedColumns.splice(newIndex, 0, column);
1635
+ }
1636
+ else if (event.to.id === 'tekGridColumnsOptionsVisibleColumns') {
1637
+ column.fixed = false;
1638
+ column.isVisible = true;
1639
+ column.grouped = false;
1640
+ column.groupOpened = false;
1641
+ this.visibleColumns.splice(newIndex, 0, column);
1642
+ }
1643
+ else if (event.to.id === 'tekGridColumnsOptionsOtherColumns') {
1644
+ column.fixed = false;
1645
+ column.isVisible = false;
1646
+ column.grouped = false;
1647
+ column.groupOpened = false;
1648
+ this.otherColumns.splice(newIndex, 0, column);
1649
+ }
1650
+ else if (event.to.id === 'tekGridColumnsOptionsGroupedColumns') {
1651
+ column.fixed = false;
1652
+ column.isVisible = true;
1653
+ column.grouped = true;
1654
+ column.aggregation = undefined;
1655
+ column.aggregationText = '';
1656
+ this.groupedColumns.splice(newIndex, 0, column);
1657
+ }
1658
+ }
1659
+ });
1660
+ }
1661
+ columnContainerMounted({ element }) {
1662
+ if (element) {
1663
+ sortable.create(element, {
1664
+ handle: '.tek-grid-column-option-box',
1665
+ group: 'column-container',
1666
+ filter: '.no-data, .tek-grid-column-option-grouped-true',
1667
+ onEnd: this.onDragEnd.bind(this),
1668
+ });
1669
+ }
1670
+ }
1671
+ selectAll({ component }) {
1672
+ let list;
1673
+ if (component.name === 'tekGridColumnsOptionsFixedSelectAll') {
1674
+ list = this.fixedColumns;
1675
+ }
1676
+ else if (component.name === 'tekGridColumnsOptionsVisibleSelectAll') {
1677
+ list = this.visibleColumns;
1678
+ }
1679
+ else if (component.name === 'tekGridColumnsOptionsOtherSelectAll') {
1680
+ list = this.otherColumns;
1681
+ }
1682
+ else {
1683
+ list = this.groupedColumns;
1684
+ }
1685
+ this.selectedColumnNames = list.map((column) => column.name);
1686
+ Object.keys(this.columnData).forEach((columnName) => {
1687
+ const column = this.columnData[columnName];
1688
+ column.selected = this.selectedColumnNames.indexOf(column.name) !== -1;
1689
+ });
1690
+ }
1691
+ cancelChanges() {
1692
+ this.modal.hide();
1693
+ }
1694
+ applyChanges({ event, element }) {
1695
+ const ignoredColumns = this.iterableComponent.columns.filter((column) => this.instanceValue && this.instanceValue.ignoreColumns.indexOf(column.name) !== -1);
1696
+ const orderedColumns = this.groupedColumns
1697
+ .concat(this.fixedColumns)
1698
+ .concat(this.visibleColumns)
1699
+ .concat(this.otherColumns)
1700
+ .concat(ignoredColumns);
1701
+ if (this.iterableComponent) {
1702
+ this.iterableComponent.columns = orderedColumns.map((orderColumn) => {
1703
+ const columnIdx = this.iterableComponent.columns.findIndex((column) => column.name === orderColumn.name);
1704
+ const iterableColumn = this.iterableComponent.columns[columnIdx];
1705
+ iterableColumn.fixed = orderColumn.fixed;
1706
+ iterableColumn.isVisible = orderColumn.isVisible;
1707
+ iterableColumn.grouped = orderColumn.grouped;
1708
+ iterableColumn.groupOpened = orderColumn.groupOpened;
1709
+ iterableColumn.label = orderColumn.label;
1710
+ iterableColumn.align = orderColumn.align;
1711
+ iterableColumn.aggregation = orderColumn.aggregation;
1712
+ return iterableColumn;
1713
+ });
1714
+ const { datasource } = this.iterableComponent;
1715
+ const order = datasource.order.filter((item) => {
1716
+ const columnName = item.split('.')[0];
1717
+ return this.groupedColumns.findIndex((column) => column.name === columnName) === -1;
1718
+ });
1719
+ datasource.order = this.groupedColumns.map((column) => `${column.name}.asc`).concat(order);
1720
+ this.iterableComponent.changeLayout(event, element);
1721
+ }
1722
+ this.modal.hide();
1723
+ }
1724
+ };
1725
+ TekGridColumnsOptionsController = __decorate([
1726
+ Singleton
1727
+ ], TekGridColumnsOptionsController);
1728
+ var TekGridColumnsOptionsController$1 = TekGridColumnsOptionsController;
1729
+
1730
+ class TekGridColumnsOptionsModal {
1731
+ static show(instance) {
1732
+ if (!TekGridColumnsOptionsModal.modal) {
1733
+ TekGridColumnsOptionsModal.modal = ModalService.create(TekGridColumnsOptionsModal.modalDef);
1734
+ Loader.addController(TekGridColumnsOptionsModal.controllerName, TekGridColumnsOptionsController$1, [
1735
+ TekGridColumnsOptionsModal.modal,
1736
+ ]);
1737
+ }
1738
+ const controller = Loader.getInstance(TekGridColumnsOptionsModal.controllerName);
1739
+ controller.instance = instance;
1740
+ TekGridColumnsOptionsModal.modal.show();
1741
+ }
1742
+ static hide() {
1743
+ if (TekGridColumnsOptionsModal.modal) {
1744
+ TekGridColumnsOptionsModal.modal.hide();
1745
+ }
1746
+ }
1747
+ }
1748
+ TekGridColumnsOptionsModal.controllerName = `TekGridColumnsOptionsController_${new Date().getTime()}`;
1749
+ TekGridColumnsOptionsModal.modalDef = {
1750
+ name: 'tekGridColumnsOptionsModal',
1751
+ title: '',
1752
+ persistent: true,
1753
+ grid: {
1754
+ sm: 11,
1755
+ md: 9,
1756
+ },
1757
+ children: [
1758
+ {
1759
+ name: 'tekGridColumnsOptionsCloseButtonContainer',
1760
+ component: 'ZdContainer',
1761
+ cssClass: 'zd-pa-0 zd-mb-6 zd-display-flex',
1762
+ children: [
1763
+ {
1764
+ name: 'tekGridColumnsOptionsTitleText',
1765
+ component: 'ZdText',
1766
+ text: 'TEKGRID_COLUMNS_OPTIONS',
1767
+ cssClass: 'zd-theme-font-title',
1768
+ },
1769
+ {
1770
+ name: 'tekGridColumnsOptionsFilterSpacer',
1771
+ component: 'VSpacer',
1772
+ },
1773
+ {
1774
+ name: 'tekGridColumnsOptionsCloseModalButton',
1775
+ component: 'ZdModalCloseButton',
1776
+ small: true,
1777
+ modalName: 'tekGridColumnsOptionsModal',
1778
+ },
1779
+ ],
1780
+ },
1781
+ {
1782
+ name: 'tekGridColumnsOptionsSearchRow',
1783
+ component: 'ZdRow',
1784
+ children: [
1785
+ {
1786
+ name: 'tekGridColumnsOptionsSearchCol',
1787
+ component: 'ZdCol',
1788
+ cols: 12,
1789
+ children: [
1790
+ {
1791
+ name: 'tekGridColumnsOptionsSearchInput',
1792
+ component: 'ZdTextInput',
1793
+ showLabel: false,
1794
+ showHelper: false,
1795
+ placeholder: 'SEARCH',
1796
+ appendIcon: 'magnify',
1797
+ value: `{{${TekGridColumnsOptionsModal.controllerName}.searchValue}}`,
1798
+ },
1799
+ ],
1800
+ },
1801
+ ],
1802
+ },
1803
+ {
1804
+ name: 'tekGridColumnsOptionsFixedRow',
1805
+ component: 'ZdRow',
1806
+ children: [
1807
+ {
1808
+ name: 'tekGridColumnsOptionsFixedCol',
1809
+ component: 'ZdCol',
1810
+ cols: 12,
1811
+ cssClass: 'tek-grid-column-option-container-col',
1812
+ children: [
1813
+ {
1814
+ name: 'tekGridColumnsOptionsFixedLabel',
1815
+ component: 'ZdText',
1816
+ text: 'TEKGRID_FIXED_COLUMNS',
1817
+ cssClass: 'tek-grid-column-option-label',
1818
+ },
1819
+ {
1820
+ name: 'tekGridColumnsOptionsFixedSelectAll',
1821
+ component: 'ZdText',
1822
+ text: 'TEKGRID_SELECT_ALL',
1823
+ cssClass: 'tek-grid-column-option-select-all',
1824
+ events: {
1825
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.selectAll}}`,
1826
+ },
1827
+ },
1828
+ {
1829
+ name: 'tekGridColumnsOptionsFixedDropHere',
1830
+ component: 'ZdText',
1831
+ text: 'TEKGRID_DROP_COLUMNS',
1832
+ cssClass: 'tek-grid-column-option-drop-here',
1833
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoFixedColumns}}`,
1834
+ },
1835
+ {
1836
+ name: 'tekGridColumnsOptionsFixedColumns',
1837
+ component: 'TekIterableComponentRender',
1838
+ id: 'tekGridColumnsOptionsFixedColumns',
1839
+ cssClass: 'tek-grid-column-option-container',
1840
+ datasource: {
1841
+ uniqueKey: 'name',
1842
+ data: `{{${TekGridColumnsOptionsModal.controllerName}.fixedColumnData}}`,
1843
+ },
1844
+ noDataSlot: [],
1845
+ events: {
1846
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.columnContainerMounted}}`,
1847
+ },
1848
+ componentMetadata: {
1849
+ name: 'tekGridColumnsOptionsFixedColumn_<<row.name>>',
1850
+ component: 'ZdTag',
1851
+ columnName: '<<row.name>>',
1852
+ cssClass: 'tek-grid-column-option-box zd-elevation-1 ' + 'tek-grid-column-option-selected-<<row.selected>>',
1853
+ tag: 'div',
1854
+ children: [
1855
+ {
1856
+ name: 'tekGridColumnsOptionsFixedColumnText_<<row.name>>',
1857
+ columnName: '<<row.name>>',
1858
+ component: 'ZdText',
1859
+ text: '<<row.label>><<row.aggregationText>>',
1860
+ },
1861
+ {
1862
+ name: 'tekGridColumnsOptionsFixedColumnRemove_<<row.name>>',
1863
+ columnName: '<<row.name>>',
1864
+ component: 'ZdIcon',
1865
+ iconName: 'close',
1866
+ events: {
1867
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnFixedRemoveClick}}`,
1868
+ },
1869
+ },
1870
+ ],
1871
+ events: {
1872
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnClick}}`,
1873
+ },
1874
+ },
1875
+ },
1876
+ ],
1877
+ },
1878
+ ],
1879
+ },
1880
+ {
1881
+ name: 'tekGridColumnsOptionsVisibleRow',
1882
+ component: 'ZdRow',
1883
+ children: [
1884
+ {
1885
+ name: 'tekGridColumnsOptionsVisibleCol',
1886
+ component: 'ZdCol',
1887
+ cols: 12,
1888
+ cssClass: 'tek-grid-column-option-container-col',
1889
+ children: [
1890
+ {
1891
+ name: 'tekGridColumnsOptionsVisibleLabel',
1892
+ component: 'ZdText',
1893
+ text: 'TEKGRID_VISIBLE_COLUMNS',
1894
+ cssClass: 'tek-grid-column-option-label',
1895
+ },
1896
+ {
1897
+ name: 'tekGridColumnsOptionsVisibleSelectAll',
1898
+ component: 'ZdText',
1899
+ text: 'TEKGRID_SELECT_ALL',
1900
+ cssClass: 'tek-grid-column-option-select-all',
1901
+ events: {
1902
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.selectAll}}`,
1903
+ },
1904
+ },
1905
+ {
1906
+ name: 'tekGridColumnsOptionsVisibleDropHere',
1907
+ component: 'ZdText',
1908
+ text: 'TEKGRID_DROP_COLUMNS',
1909
+ cssClass: 'tek-grid-column-option-drop-here',
1910
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoVisibleColumns}}`,
1911
+ },
1912
+ {
1913
+ name: 'tekGridColumnsOptionsVisibleColumns',
1914
+ component: 'TekIterableComponentRender',
1915
+ id: 'tekGridColumnsOptionsVisibleColumns',
1916
+ cssClass: 'tek-grid-column-option-container',
1917
+ datasource: {
1918
+ uniqueKey: 'name',
1919
+ data: `{{${TekGridColumnsOptionsModal.controllerName}.visibleColumnData}}`,
1920
+ },
1921
+ noDataSlot: [],
1922
+ events: {
1923
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.columnContainerMounted}}`,
1924
+ },
1925
+ componentMetadata: {
1926
+ name: 'tekGridColumnsOptionsVisibleColumn_<<row.name>>',
1927
+ component: 'ZdTag',
1928
+ columnName: '<<row.name>>',
1929
+ cssClass: 'tek-grid-column-option-box zd-elevation-1 ' + 'tek-grid-column-option-selected-<<row.selected>>',
1930
+ tag: 'div',
1931
+ children: [
1932
+ {
1933
+ name: 'tekGridColumnsOptionsVisibleColumnText_<<row.name>>',
1934
+ columnName: '<<row.name>>',
1935
+ component: 'ZdText',
1936
+ text: '<<row.label>><<row.aggregationText>>',
1937
+ },
1938
+ {
1939
+ name: 'tekGridColumnsOptionsVisibleColumnRemove_<<row.name>>',
1940
+ columnName: '<<row.name>>',
1941
+ component: 'ZdIcon',
1942
+ iconName: 'close',
1943
+ events: {
1944
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnVisibleRemoveClick}}`,
1945
+ },
1946
+ },
1947
+ ],
1948
+ events: {
1949
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnClick}}`,
1950
+ },
1951
+ },
1952
+ },
1953
+ ],
1954
+ },
1955
+ ],
1956
+ },
1957
+ {
1958
+ name: 'tekGridColumnsOptionsGroupedRow',
1959
+ component: 'ZdRow',
1960
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.showGroups}}`,
1961
+ children: [
1962
+ {
1963
+ name: 'tekGridColumnsOptionsGroupedCol',
1964
+ component: 'ZdCol',
1965
+ cssClass: 'tek-grid-column-option-container-col',
1966
+ cols: 12,
1967
+ children: [
1968
+ {
1969
+ name: 'tekGridColumnsOptionsGroupedLabel',
1970
+ component: 'ZdText',
1971
+ text: 'TEKGRID_GROUPED_COLUMNS',
1972
+ cssClass: 'tek-grid-column-option-label',
1973
+ },
1974
+ {
1975
+ name: 'tekGridColumnsOptionsGroupedSelectAll',
1976
+ component: 'ZdText',
1977
+ text: 'TEKGRID_SELECT_ALL',
1978
+ cssClass: 'tek-grid-column-option-select-all',
1979
+ events: {
1980
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.selectAll}}`,
1981
+ },
1982
+ },
1983
+ {
1984
+ name: 'tekGridColumnsOptionsGroupedDropHere',
1985
+ component: 'ZdText',
1986
+ text: 'TEKGRID_DROP_COLUMNS',
1987
+ cssClass: 'tek-grid-column-option-drop-here',
1988
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoGroupedColumns}}`,
1989
+ },
1990
+ {
1991
+ name: 'tekGridColumnsOptionsGroupedColumns',
1992
+ component: 'TekIterableComponentRender',
1993
+ id: 'tekGridColumnsOptionsGroupedColumns',
1994
+ cssClass: 'tek-grid-column-option-container',
1995
+ datasource: {
1996
+ uniqueKey: 'name',
1997
+ data: `{{${TekGridColumnsOptionsModal.controllerName}.groupedColumnData}}`,
1998
+ },
1999
+ noDataSlot: [],
2000
+ events: {
2001
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.columnContainerMounted}}`,
2002
+ },
2003
+ componentMetadata: {
2004
+ name: 'tekGridColumnsOptionsGroupedColumn_<<row.name>>',
2005
+ component: 'ZdTag',
2006
+ columnName: '<<row.name>>',
2007
+ cssClass: 'tek-grid-column-option-box zd-elevation-1 ' + 'tek-grid-column-option-selected-<<row.selected>>',
2008
+ tag: 'div',
2009
+ children: [
2010
+ {
2011
+ name: 'tekGridColumnsOptionsGroupedColumnText_<<row.name>>',
2012
+ columnName: '<<row.name>>',
2013
+ component: 'ZdText',
2014
+ text: '<<row.label>><<row.aggregationText>>',
2015
+ },
2016
+ {
2017
+ name: 'tekGridColumnsOptionsGroupedColumnRemove_<<row.name>>',
2018
+ columnName: '<<row.name>>',
2019
+ component: 'ZdIcon',
2020
+ iconName: 'close',
2021
+ events: {
2022
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnGroupedRemoveClick}}`,
2023
+ },
2024
+ },
2025
+ ],
2026
+ events: {
2027
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnClick}}`,
2028
+ },
2029
+ },
2030
+ },
2031
+ ],
2032
+ },
2033
+ ],
2034
+ },
2035
+ {
2036
+ name: 'tekGridColumnsOptionsOtherRow',
2037
+ component: 'ZdRow',
2038
+ children: [
2039
+ {
2040
+ name: 'tekGridColumnsOptionsOtherCol',
2041
+ component: 'ZdCol',
2042
+ cssClass: 'tek-grid-column-option-container-col',
2043
+ cols: 12,
2044
+ children: [
2045
+ {
2046
+ name: 'tekGridColumnsOptionsOtherLabel',
2047
+ component: 'ZdText',
2048
+ text: 'TEKGRID_OTHER_COLUMNS',
2049
+ cssClass: 'tek-grid-column-option-label',
2050
+ },
2051
+ {
2052
+ name: 'tekGridColumnsOptionsOtherSelectAll',
2053
+ component: 'ZdText',
2054
+ text: 'TEKGRID_SELECT_ALL',
2055
+ cssClass: 'tek-grid-column-option-select-all',
2056
+ events: {
2057
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.selectAll}}`,
2058
+ },
2059
+ },
2060
+ {
2061
+ name: 'tekGridColumnsOptionsOtherDropHere',
2062
+ component: 'ZdText',
2063
+ text: 'TEKGRID_DROP_COLUMNS',
2064
+ cssClass: 'tek-grid-column-option-drop-here',
2065
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoOtherColumns}}`,
2066
+ },
2067
+ {
2068
+ name: 'tekGridColumnsOptionsOtherColumns',
2069
+ component: 'TekIterableComponentRender',
2070
+ id: 'tekGridColumnsOptionsOtherColumns',
2071
+ cssClass: 'tek-grid-column-option-container',
2072
+ datasource: {
2073
+ uniqueKey: 'name',
2074
+ data: `{{${TekGridColumnsOptionsModal.controllerName}.otherColumnData}}`,
2075
+ },
2076
+ noDataSlot: [],
2077
+ events: {
2078
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.columnContainerMounted}}`,
2079
+ },
2080
+ componentMetadata: {
2081
+ name: 'tekGridColumnsOptionsOtherColumn_<<row.name>>',
2082
+ component: 'ZdText',
2083
+ columnName: '<<row.name>>',
2084
+ text: '<<row.label>><<row.aggregationText>>',
2085
+ cssClass: 'tek-grid-column-option-box zd-elevation-1 ' + 'tek-grid-column-option-selected-<<row.selected>>',
2086
+ events: {
2087
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.columnClick}}`,
2088
+ },
2089
+ },
2090
+ },
2091
+ ],
2092
+ },
2093
+ ],
2094
+ },
2095
+ {
2096
+ name: 'tekGridColumnsOptionsDetailColumnName',
2097
+ component: 'ZdText',
2098
+ cssClass: 'tek-grid-column-option-detail-name',
2099
+ text: `{{${TekGridColumnsOptionsModal.controllerName}.detailColumnName}}`,
2100
+ grid: {
2101
+ xs: 12,
2102
+ },
2103
+ },
2104
+ {
2105
+ name: 'tekGridColumnsOptionsDetailRow',
2106
+ component: 'ZdRow',
2107
+ children: [
2108
+ {
2109
+ name: 'tekGridColumnsOptionsDetailCol',
2110
+ component: 'ZdCol',
2111
+ cols: 12,
2112
+ children: [
2113
+ {
2114
+ name: 'tekGridColumnsOptionsDetailForm',
2115
+ component: 'ZdForm',
2116
+ cssClass: 'tek-grid-column-option-detail-form',
2117
+ children: [
2118
+ {
2119
+ name: 'tekGridColumnsOptionsColumnLabel',
2120
+ component: 'ZdTextInput',
2121
+ label: 'TEKGRID_COLUMN_LABEL',
2122
+ showHelper: false,
2123
+ clearable: false,
2124
+ disabled: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoSingleSelection}}`,
2125
+ value: `{{${TekGridColumnsOptionsModal.controllerName}.selectedColumnLabel}}`,
2126
+ grid: {
2127
+ xs: 12,
2128
+ md: 5,
2129
+ },
2130
+ },
2131
+ {
2132
+ name: 'tekGridColumnsOptionsColumnAlignment',
2133
+ component: 'ZdSelect',
2134
+ autocomplete: false,
2135
+ label: 'TEKGRID_COLUMN_ALIGNMENT',
2136
+ disabled: `{{${TekGridColumnsOptionsModal.controllerName}.hasNoSelectedColumn}}`,
2137
+ showHelper: false,
2138
+ clearable: false,
2139
+ grid: {
2140
+ xs: 6,
2141
+ md: 2,
2142
+ },
2143
+ dataText: 'text',
2144
+ dataValue: 'value',
2145
+ datasource: {
2146
+ data: [
2147
+ { text: 'TEKGRID_LEFT', value: 'left' },
2148
+ { text: 'TEKGRID_CENTER', value: 'center' },
2149
+ { text: 'TEKGRID_RIGHT', value: 'right' },
2150
+ ],
2151
+ translate: 'text',
2152
+ },
2153
+ events: {
2154
+ change: `{{${TekGridColumnsOptionsModal.controllerName}.selectChange}}`,
2155
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.selectMounted}}`,
2156
+ },
2157
+ },
2158
+ {
2159
+ name: 'tekGridColumnsOptionsColumnAggregation',
2160
+ component: 'ZdSelect',
2161
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.showGroups}}`,
2162
+ autocomplete: false,
2163
+ label: 'TEKGRID_COLUMN_AGGREGATION',
2164
+ showHelper: false,
2165
+ disabled: `{{${TekGridColumnsOptionsModal.controllerName}.groupInSelection}}`,
2166
+ dataText: 'text',
2167
+ dataValue: 'value',
2168
+ grid: {
2169
+ xs: 6,
2170
+ md: 2,
2171
+ },
2172
+ datasource: {
2173
+ data: `{{${TekGridColumnsOptionsModal.controllerName}.aggregationData}}`,
2174
+ },
2175
+ events: {
2176
+ change: `{{${TekGridColumnsOptionsModal.controllerName}.selectChange}}`,
2177
+ onMounted: `{{${TekGridColumnsOptionsModal.controllerName}.selectMounted}}`,
2178
+ },
2179
+ },
2180
+ {
2181
+ name: 'tekGridColumnsOptionsColumnGroupOpened',
2182
+ component: 'ZdCheckbox',
2183
+ isVisible: `{{${TekGridColumnsOptionsModal.controllerName}.showGroups}}`,
2184
+ cssClass: 'zd-form-input-align',
2185
+ disabled: `{{${TekGridColumnsOptionsModal.controllerName}.notGroupInSelection}}`,
2186
+ label: 'TEKGRID_COLUMN_GROUP_OPENED',
2187
+ value: `{{${TekGridColumnsOptionsModal.controllerName}.selectedColumnGroupOpened}}`,
2188
+ grid: {
2189
+ xs: 6,
2190
+ md: 3,
2191
+ },
2192
+ },
2193
+ ],
2194
+ },
2195
+ ],
2196
+ },
2197
+ ],
2198
+ },
2199
+ {
2200
+ name: 'tekGridColumnsOptionsDetailFooter',
2201
+ component: 'ZdFooter',
2202
+ padless: true,
2203
+ color: 'transparent',
2204
+ cssClass: 'zd-mt-6',
2205
+ rightSlot: [
2206
+ {
2207
+ name: 'tekGridColumnsOptionsDetailCancel',
2208
+ component: 'ZdButton',
2209
+ outline: true,
2210
+ label: 'TEKGRID_CANCEL',
2211
+ events: {
2212
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.cancelChanges}}`,
2213
+ },
2214
+ },
2215
+ {
2216
+ name: 'tekGridColumnsOptionsDetailApply',
2217
+ component: 'ZdButton',
2218
+ label: 'TEKGRID_APPLY',
2219
+ events: {
2220
+ click: `{{${TekGridColumnsOptionsModal.controllerName}.applyChanges}}`,
2221
+ },
2222
+ },
2223
+ ],
2224
+ },
2225
+ ],
2226
+ };
2227
+
2228
+ const TekGridColumnsButtonProps$1 = Object.assign(Object.assign({}, ZdIterableColumnsButtonProps), { hideGroups: {
2229
+ type: [Boolean, String],
2230
+ default: false,
2231
+ } });
2232
+ const tekGridColumnsButton$1 = defineComponent({
2233
+ props: TekGridColumnsButtonProps$1,
2234
+ inheritAttrs: false,
2235
+ setup(props, ctx) {
2236
+ const { instance, root } = useCreateInstance(props, ctx, TekGridColumnsButton);
2237
+ const buttonScope = useButtonInstance({ instance, root });
2238
+ const menuIsOpened = ref(false);
2239
+ const sortableInitialized = ref(false);
2240
+ const teste = (a) => {
2241
+ console.warn(a);
2242
+ };
2243
+ watch(menuIsOpened, () => {
2244
+ if (!menuIsOpened.value || sortableInitialized.value)
2245
+ return;
2246
+ sortableInitialized.value = true;
2247
+ nextTick(() => {
2248
+ const columnsTableBody = document.querySelector(`#${instance.name}_columns_table tbody`);
2249
+ if (columnsTableBody) {
2250
+ sortable.create(columnsTableBody, {
2251
+ handle: '.sortHandle',
2252
+ dragClass: 'tek-grid-columns-button-sortable-drag',
2253
+ onEnd: sortEnd,
2254
+ });
2255
+ }
2256
+ });
2257
+ });
2258
+ const gridGroupColumnNames = computed(() => {
2259
+ return instance.iterableComponent.columns.filter((column) => column.grouped).map((column) => column.name) || [];
2260
+ });
2261
+ const sortEnd = (event) => {
2262
+ const grid = instance.iterableComponent;
2263
+ const newOrder = Array.from(event.srcElement.querySelectorAll('tr')).map((row) => row.getAttribute('name'));
2264
+ const groupColumnNames = [];
2265
+ const newColumns = newOrder.map((columnName) => {
2266
+ const column = grid.getColumn(columnName);
2267
+ if (column.grouped) {
2268
+ groupColumnNames.push(columnName);
2269
+ }
2270
+ return column;
2271
+ });
2272
+ const ignoredColumns = grid.columns.filter((column) => instance.ignoreColumns.indexOf(column.name) !== -1);
2273
+ grid.columns = newColumns.concat(ignoredColumns);
2274
+ if (grid.updateGrouping && JSON.stringify(groupColumnNames) !== JSON.stringify(gridGroupColumnNames)) {
2275
+ grid.updateGrouping();
2276
+ }
2277
+ grid.changeLayout();
2278
+ };
2279
+ const moreOptions = () => {
2280
+ TekGridColumnsOptionsModal.show(instance);
2281
+ };
2282
+ const close = () => {
2283
+ menuIsOpened.value = false;
2284
+ };
2285
+ return Object.assign(Object.assign({}, buttonScope), { instance,
2286
+ root,
2287
+ menuIsOpened,
2288
+ moreOptions,
2289
+ close,
2290
+ teste,
2291
+ mergeProps });
2292
+ },
2293
+ });
2294
+
2295
+ const _hoisted_1$3 = { class: "tek-grid-columns-button-table-wrapper zd-mb-2" };
2296
+ const _hoisted_2$1 = ["id"];
2297
+ const _hoisted_3 = { key: 0 };
2298
+ const _hoisted_4 = { key: 1 };
2299
+ const _hoisted_5 = ["name"];
2300
+ const _hoisted_6 = { class: "tek-grid-columns-button-column-name sortHandle" };
2301
+ const _hoisted_7 = { key: 0 };
2302
+ const _hoisted_8 = {
2303
+ key: 1,
2304
+ class: "tek-grid-columns-button-column-aggregation"
2305
+ };
2306
+ const _hoisted_9 = { class: "tek-grid-columns-button-table-footer" };
2307
+
2308
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
2309
+ const _component_zd_activator_wrapper = resolveComponent("zd-activator-wrapper");
2310
+ const _component_v_tooltip = resolveComponent("v-tooltip");
2311
+ const _component_zd_checkbox = resolveComponent("zd-checkbox");
2312
+ const _component_zd_select = resolveComponent("zd-select");
2313
+ const _component_zd_button = resolveComponent("zd-button");
2314
+ const _component_v_card = resolveComponent("v-card");
2315
+ const _component_v_menu = resolveComponent("v-menu");
2316
+
2317
+ return (openBlock(), createBlock(_component_v_menu, {
2318
+ id: _ctx.instance.name,
2319
+ modelValue: _ctx.menuIsOpened,
2320
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => ((_ctx.menuIsOpened) = $event)),
2321
+ class: normalizeClass(['zd-iterable-columns-button', 'tek-grid-columns-button', _ctx.instance.cssClass]),
2322
+ style: normalizeStyle(_ctx.instance.cssStyle),
2323
+ closeOnContentClick: false,
2324
+ "offset-y": "",
2325
+ "content-class": "zd-iterable-columns-button-options tek-grid-columns-button-options"
2326
+ }, {
2327
+ activator: withCtx(({ props: onMenu }) => [
2328
+ createVNode(_component_v_tooltip, { bottom: "" }, {
2329
+ activator: withCtx(({ props: onTooltip }) => [
2330
+ createVNode(_component_zd_activator_wrapper, mergeProps({
2331
+ "child-props": {
2332
+ component: 'ZdButton',
2333
+ name: _ctx.instance.name,
2334
+ instanceObject: _ctx.instance,
2335
+ }
2336
+ }, _ctx.mergeProps(onMenu, onTooltip)), null, 16 /* FULL_PROPS */, ["child-props"])
2337
+ ]),
2338
+ default: withCtx(() => [
2339
+ createElementVNode("span", null, toDisplayString(_ctx.$t('TEKGRID_COLUMNS')), 1 /* TEXT */)
2340
+ ]),
2341
+ _: 2 /* DYNAMIC */
2342
+ }, 1024 /* DYNAMIC_SLOTS */)
2343
+ ]),
2344
+ default: withCtx(() => [
2345
+ createVNode(_component_v_card, { class: "zd-pa-2" }, {
2346
+ default: withCtx(() => [
2347
+ createElementVNode("div", _hoisted_1$3, [
2348
+ createElementVNode("table", {
2349
+ class: "tek-grid-columns-button-table",
2350
+ id: _ctx.instance.name + '_columns_table'
2351
+ }, [
2352
+ createElementVNode("thead", null, [
2353
+ createElementVNode("tr", null, [
2354
+ _cache[3] || (_cache[3] = createElementVNode("th", null, [
2355
+ createCommentVNode("Name")
2356
+ ], -1 /* CACHED */)),
2357
+ createElementVNode("th", null, toDisplayString(_ctx.$t('TEKGRID_COLUMN_VISIBLE')), 1 /* TEXT */),
2358
+ (!_ctx.instance.hideGroups)
2359
+ ? (openBlock(), createElementBlock("th", _hoisted_3, toDisplayString(_ctx.$t('TEKGRID_COLUMN_GROUPED')), 1 /* TEXT */))
2360
+ : createCommentVNode("v-if", true),
2361
+ (!_ctx.instance.hideGroups)
2362
+ ? (openBlock(), createElementBlock("th", _hoisted_4, toDisplayString(_ctx.$t('TEKGRID_COLUMN_AGGREGATION')), 1 /* TEXT */))
2363
+ : createCommentVNode("v-if", true)
2364
+ ])
2365
+ ]),
2366
+ createElementVNode("tbody", null, [
2367
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.instance.filteredColumns(), (column) => {
2368
+ return (openBlock(), createElementBlock("tr", {
2369
+ key: column.name,
2370
+ name: column.name
2371
+ }, [
2372
+ createElementVNode("td", _hoisted_6, [
2373
+ _cache[4] || (_cache[4] = createElementVNode("span", null, "⦙⦙", -1 /* CACHED */)),
2374
+ createTextVNode(toDisplayString(_ctx.$t(column.label)), 1 /* TEXT */)
2375
+ ]),
2376
+ createElementVNode("td", null, [
2377
+ createVNode(_component_zd_checkbox, {
2378
+ name: _ctx.instance.name + '_column_visible_' + column.name,
2379
+ value: column.grouped || column.isVisible,
2380
+ events: {
2381
+ change: _ctx.instance.controller.showHideTekColumn.bind(_ctx.instance.controller, column)
2382
+ }
2383
+ }, null, 8 /* PROPS */, ["name", "value", "events"])
2384
+ ]),
2385
+ (!_ctx.instance.hideGroups)
2386
+ ? (openBlock(), createElementBlock("td", _hoisted_7, [
2387
+ (column.type !== 'action')
2388
+ ? (openBlock(), createBlock(_component_zd_checkbox, {
2389
+ key: 0,
2390
+ name: _ctx.instance.name + '_column_grouped_' + column.name,
2391
+ value: column.grouped,
2392
+ events: {
2393
+ change: _ctx.instance.controller.changeGroupedColumn.bind(_ctx.instance.controller, column)
2394
+ }
2395
+ }, null, 8 /* PROPS */, ["name", "value", "events"]))
2396
+ : createCommentVNode("v-if", true)
2397
+ ]))
2398
+ : createCommentVNode("v-if", true),
2399
+ (!_ctx.instance.hideGroups)
2400
+ ? (openBlock(), createElementBlock("td", _hoisted_8, [
2401
+ (column.type !== 'action')
2402
+ ? (openBlock(), createBlock(_component_zd_select, mergeProps({
2403
+ key: 0,
2404
+ name: _ctx.instance.name + '_column_aggregation_' + column.name
2405
+ }, { ref_for: true }, {
2406
+ value: column.aggregation,
2407
+ disabled: column.grouped || !column.isVisible,
2408
+ events: {
2409
+ change: _ctx.instance.controller.changeAggregationColumn.bind(_ctx.instance.controller, column)
2410
+ },
2411
+ dataText: 'text',
2412
+ dataValue: 'value',
2413
+ autocomplete: false,
2414
+ showHelper: false,
2415
+ showLabel: false,
2416
+ datasource: {
2417
+ data: _ctx.instance.getAggregationSelectData(),
2418
+ },
2419
+ }), null, 16 /* FULL_PROPS */, ["name"]))
2420
+ : createCommentVNode("v-if", true)
2421
+ ]))
2422
+ : createCommentVNode("v-if", true)
2423
+ ], 8 /* PROPS */, _hoisted_5))
2424
+ }), 128 /* KEYED_FRAGMENT */))
2425
+ ])
2426
+ ], 8 /* PROPS */, _hoisted_2$1)
2427
+ ]),
2428
+ createElementVNode("div", _hoisted_9, [
2429
+ createVNode(_component_zd_button, {
2430
+ name: _ctx.instance.name + '_columns_table_footer_button',
2431
+ label: "TEKGRID_MORE_OPTIONS",
2432
+ small: "",
2433
+ outline: "",
2434
+ cssClass: "zd-ma-2 zd-mr-1",
2435
+ onClick: _cache[0] || (_cache[0] = $event => (_ctx.moreOptions()))
2436
+ }, null, 8 /* PROPS */, ["name"]),
2437
+ createVNode(_component_zd_button, {
2438
+ name: _ctx.instance.name + '_columns_table_footer_close',
2439
+ label: "TEKGRID_CLOSE",
2440
+ small: "",
2441
+ cssClass: "zd-ma-2 zd-ml-1",
2442
+ onClick: _cache[1] || (_cache[1] = $event => (_ctx.close()))
2443
+ }, null, 8 /* PROPS */, ["name"])
2444
+ ])
2445
+ ]),
2446
+ _: 1 /* STABLE */
2447
+ })
2448
+ ]),
2449
+ _: 1 /* STABLE */
2450
+ }, 8 /* PROPS */, ["id", "modelValue", "class", "style"]))
2451
+ }
2452
+
2453
+ tekGridColumnsButton$1.render = render$7;
2454
+ tekGridColumnsButton$1.__file = "src/components/tek-grid/columns-button/TekGridColumnsButton.vue";
2455
+
2456
+ const TekGridFilterButtonProps$1 = Object.assign(Object.assign({}, ZdButtonProps), { gridName: {
2457
+ type: String,
2458
+ default: '',
2459
+ }, grid: {
2460
+ type: [Object, String],
2461
+ default: () => { },
2462
+ }, showCheckboxAll: {
2463
+ type: [Boolean, String],
2464
+ default: false,
2465
+ } });
2466
+ const tekGridFilterButtonComponent$1 = defineComponent({
2467
+ props: TekGridFilterButtonProps$1,
2468
+ inheritAttrs: false,
2469
+ setup(props, ctx) {
2470
+ const { instance, root } = useCreateInstance(props, ctx, TekGridFilterButton);
2471
+ const buttonScope = useButtonInstance({ instance, root });
2472
+ const filterClick = ({ event }) => {
2473
+ instance.click(event);
2474
+ };
2475
+ return Object.assign(Object.assign({}, buttonScope), { instance,
2476
+ root,
2477
+ filterClick });
2478
+ },
2479
+ });
2480
+
2481
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
2482
+ const _component_zd_button = resolveComponent("zd-button");
2483
+
2484
+ return (openBlock(), createBlock(_component_zd_button, mergeProps({
2485
+ id: `instance.name`,
2486
+ name: `${_ctx.instance.name}_name`
2487
+ }, {
2488
+ icon: true,
2489
+ cssClass: 'tek-grid-filter-button',
2490
+ iconName: 'mdi-filter',
2491
+ isVisible: _ctx.instance.grid.filterButton,
2492
+ events: {
2493
+ click: _ctx.filterClick,
2494
+ },
2495
+ }), null, 16 /* FULL_PROPS */, ["name"]))
2496
+ }
2497
+
2498
+ tekGridFilterButtonComponent$1.render = render$6;
2499
+ tekGridFilterButtonComponent$1.__file = "src/components/tek-grid/filter-button/TekGridFilterButton.vue";
2500
+
2501
+ var script$2 = defineComponent({
2502
+ props: {
2503
+ showDivider: {
2504
+ type: Boolean,
2505
+ default: true,
2506
+ },
2507
+ level: {
2508
+ type: Number,
2509
+ default: 0,
2510
+ },
2511
+ footer: {
2512
+ type: Boolean,
2513
+ default: false,
2514
+ },
2515
+ },
2516
+ setup() {
2517
+ return {};
2518
+ },
2519
+ });
2520
+
2521
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2522
+ return (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.level, (n) => {
2523
+ return (openBlock(), createElementBlock("span", {
2524
+ key: n,
2525
+ class: normalizeClass([
2526
+ 'tek-grid-indentation',
2527
+ {
2528
+ 'tek-grid-indentation--corner': _ctx.footer && n === _ctx.level,
2529
+ 'tek-grid-indentation--divider': _ctx.showDivider,
2530
+ }
2531
+ ])
2532
+ }, null, 2 /* CLASS */))
2533
+ }), 128 /* KEYED_FRAGMENT */))
2534
+ }
2535
+
2536
+ script$2.render = render$5;
2537
+ script$2.__file = "src/components/tek-grid/indentation/TekGridIndentation.vue";
2538
+
2539
+ const TekGridLayoutOptionsProps$1 = Object.assign({}, ZdComponentRenderProps);
2540
+ const layoutOptionsComponent$1 = defineComponent({
2541
+ props: TekGridLayoutOptionsProps$1,
2542
+ inheritAttrs: false,
2543
+ setup(props, ctx) {
2544
+ const { instance, root } = useCreateInstance(props, ctx, TekGridLayoutOptions);
2545
+ const { applyLayout: applyTekGridLayout, getColumnElements, getTableWidth } = useTableLayout();
2546
+ onMounted(() => {
2547
+ instance.viewApplyLayout = applyLayout;
2548
+ instance.viewGetCurrentLayout = getCurrentLayout;
2549
+ });
2550
+ const confirmLayoutClick = ({ component }) => {
2551
+ const layoutName = component.value;
2552
+ if (layoutName) {
2553
+ const newLayout = getCurrentLayout(layoutName);
2554
+ instance.newLayout(newLayout);
2555
+ }
2556
+ menuActive.value = false;
2557
+ component.value = '';
2558
+ };
2559
+ const datasourceDynamicFilter = () => {
2560
+ const datasource = instance.grid.datasource;
2561
+ if (datasource instanceof TekRestDatasource)
2562
+ return datasource.dynamicFilter;
2563
+ return {};
2564
+ };
2565
+ const changeLayout = (layout) => {
2566
+ instance.updateLayout(layout.name, getCurrentLayout(layout.name));
2567
+ };
2568
+ const applyLayout = (layout) => {
2569
+ const defaultLayout = {
2570
+ originalDatasourceOrder: instance.originalDatasourceOrder,
2571
+ originalDatasourceFilter: instance.originalDatasourceFilter,
2572
+ originalColumnProps: instance.originalColumnProps,
2573
+ originalDatasourceDynamicFilter: instance.originalDatasourceDynamicFilter,
2574
+ };
2575
+ applyTekGridLayout({ layout, defaultLayout, changeLayoutCallback: changeLayout });
2576
+ menuActive.value = false;
2577
+ };
2578
+ const getCurrentLayout = (layoutName) => {
2579
+ const { grid } = instance;
2580
+ const gridWidth = getTableWidth();
2581
+ const columnElementsDict = getColumnElements();
2582
+ return {
2583
+ name: layoutName,
2584
+ gridWidth,
2585
+ order: grid.datasource.order,
2586
+ filter: grid.datasource.filter,
2587
+ dynamicFilter: datasourceDynamicFilter(),
2588
+ columns: grid.columns.map((column, index) => {
2589
+ const columnElement = columnElementsDict[index];
2590
+ return {
2591
+ name: column.name,
2592
+ label: column.label,
2593
+ align: column.align,
2594
+ width: columnElement ? window.getComputedStyle(columnElement).width : 'unset',
2595
+ minWidth: column.minWidth,
2596
+ maxWidth: column.maxWidth,
2597
+ isVisible: column.isVisible,
2598
+ fixed: column.fixed,
2599
+ grouped: column.grouped,
2600
+ groupOpened: column.groupOpened,
2601
+ aggregation: column.aggregation,
2602
+ filterHelperValue: instance.getHelperValue(column),
2603
+ };
2604
+ }),
2605
+ };
2606
+ };
2607
+ const menuActive = ref(false);
2608
+ const applyOrUpdateLayout = (event, layoutName) => {
2609
+ if (instance.layoutEdited) {
2610
+ instance.updateLayout(layoutName, getCurrentLayout(layoutName));
2611
+ event.stopImmediatePropagation();
2612
+ menuActive.value = false;
2613
+ }
2614
+ else {
2615
+ instance.applyLayout(layoutName);
2616
+ }
2617
+ };
2618
+ const deleteLayout = (event, layoutName) => {
2619
+ instance.deleteLayout(layoutName);
2620
+ event.stopImmediatePropagation();
2621
+ };
2622
+ return {
2623
+ instance,
2624
+ root,
2625
+ menuActive,
2626
+ confirmLayoutClick,
2627
+ applyOrUpdateLayout,
2628
+ deleteLayout,
2629
+ mergeProps,
2630
+ };
2631
+ },
2632
+ });
2633
+
2634
+ const _hoisted_1$2 = {
2635
+ key: 0,
2636
+ class: "tek-grid-layout-item-buttons"
2637
+ };
2638
+
2639
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2640
+ const _component_zd_activator_wrapper = resolveComponent("zd-activator-wrapper");
2641
+ const _component_v_badge = resolveComponent("v-badge");
2642
+ const _component_v_tooltip = resolveComponent("v-tooltip");
2643
+ const _component_v_list_item = resolveComponent("v-list-item");
2644
+ const _component_zd_text_input = resolveComponent("zd-text-input");
2645
+ const _component_zd_button = resolveComponent("zd-button");
2646
+ const _component_v_list = resolveComponent("v-list");
2647
+ const _component_v_menu = resolveComponent("v-menu");
2648
+
2649
+ return (openBlock(), createBlock(_component_v_menu, {
2650
+ id: _ctx.instance.name,
2651
+ name: _ctx.instance.name,
2652
+ class: normalizeClass(['tek-grid-layout-options', _ctx.instance.cssClass]),
2653
+ style: normalizeStyle(_ctx.instance.cssStyle),
2654
+ modelValue: _ctx.menuActive,
2655
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => ((_ctx.menuActive) = $event)),
2656
+ "offset-y": "",
2657
+ closeOnContentClick: false
2658
+ }, {
2659
+ activator: withCtx(({ props: onMenu }) => [
2660
+ createVNode(_component_v_tooltip, { bottom: "" }, {
2661
+ activator: withCtx(({ props: onTooltip }) => [
2662
+ withDirectives(createVNode(_component_v_badge, {
2663
+ overlap: "",
2664
+ class: "tek-grid-layout-options-badge",
2665
+ dot: "",
2666
+ offsetX: 12,
2667
+ offsetY: 12,
2668
+ value: _ctx.instance.layoutEdited
2669
+ }, {
2670
+ default: withCtx(() => [
2671
+ createVNode(_component_zd_activator_wrapper, mergeProps({ ref: "root" }, _ctx.mergeProps(onMenu, onTooltip), {
2672
+ "child-props": {
2673
+ component: 'ZdButton',
2674
+ name: _ctx.instance.name + '_button',
2675
+ icon: true,
2676
+ iconName: 'mdi-table-star',
2677
+ isVisible: _ctx.instance.isVisible,
2678
+ }
2679
+ }), null, 16 /* FULL_PROPS */, ["child-props"])
2680
+ ]),
2681
+ _: 2 /* DYNAMIC */
2682
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["value"]), [
2683
+ [vShow, _ctx.instance.isVisible]
2684
+ ])
2685
+ ]),
2686
+ default: withCtx(() => [
2687
+ createElementVNode("span", null, toDisplayString(_ctx.$t('LAYOUT') + (_ctx.instance.currentLayoutName || _ctx.$t('DEFAULT_LAYOUT'))), 1 /* TEXT */)
2688
+ ]),
2689
+ _: 2 /* DYNAMIC */
2690
+ }, 1024 /* DYNAMIC_SLOTS */)
2691
+ ]),
2692
+ default: withCtx(() => [
2693
+ createVNode(_component_v_list, null, {
2694
+ default: withCtx(() => [
2695
+ createVNode(_component_v_list_item, {
2696
+ class: normalizeClass(['tek-grid-layout-item-header', { edited: _ctx.instance.layoutEdited }])
2697
+ }, {
2698
+ default: withCtx(() => [
2699
+ createTextVNode(toDisplayString(_ctx.instance.layoutEdited ? _ctx.$t('LAYOUT_MODIFIED') : _ctx.$t('LAYOUT_NOT_MODIFIED')), 1 /* TEXT */)
2700
+ ]),
2701
+ _: 1 /* STABLE */
2702
+ }, 8 /* PROPS */, ["class"]),
2703
+ createVNode(_component_v_list_item, null, {
2704
+ default: withCtx(() => [
2705
+ createVNode(_component_zd_text_input, mergeProps({
2706
+ name: _ctx.instance.name+'_new_layout',
2707
+ ref: "inputNewLayout"
2708
+ }, {
2709
+ showHelper: false,
2710
+ showLabel: false,
2711
+ placeholder: 'NEW_LAYOUT',
2712
+ appendOuterIcon: 'mdi-check',
2713
+ autofocus: true,
2714
+ autofill: false,
2715
+ keyMap: {
2716
+ enter: {
2717
+ event: _ctx.confirmLayoutClick,
2718
+ input: true,
2719
+ active: true,
2720
+ },
2721
+ },
2722
+ events: {
2723
+ appendOuterIconClick: _ctx.confirmLayoutClick,
2724
+ },
2725
+ }), null, 16 /* FULL_PROPS */, ["name"])
2726
+ ]),
2727
+ _: 1 /* STABLE */
2728
+ }),
2729
+ (!_ctx.instance.layoutEdited)
2730
+ ? (openBlock(), createBlock(_component_v_list_item, {
2731
+ key: 0,
2732
+ class: normalizeClass(['tek-grid-layout-item', {
2733
+ selected: _ctx.instance.currentLayoutName === ''
2734
+ }]),
2735
+ onClick: _cache[0] || (_cache[0] = $event => (_ctx.instance.applyLayout('')))
2736
+ }, {
2737
+ default: withCtx(() => [
2738
+ createTextVNode(toDisplayString(_ctx.$t('DEFAULT_LAYOUT')), 1 /* TEXT */)
2739
+ ]),
2740
+ _: 1 /* STABLE */
2741
+ }, 8 /* PROPS */, ["class"]))
2742
+ : createCommentVNode("v-if", true),
2743
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.instance.layoutNames, (item) => {
2744
+ return (openBlock(), createBlock(_component_v_list_item, {
2745
+ key: item,
2746
+ class: normalizeClass(['tek-grid-layout-item', {
2747
+ selected: item === _ctx.instance.currentLayoutName
2748
+ }]),
2749
+ onClick: $event => (_ctx.applyOrUpdateLayout($event, item))
2750
+ }, {
2751
+ default: withCtx(() => [
2752
+ createTextVNode(toDisplayString(item) + " ", 1 /* TEXT */),
2753
+ (!_ctx.instance.layoutEdited)
2754
+ ? (openBlock(), createElementBlock("span", _hoisted_1$2, [
2755
+ createVNode(_component_zd_button, mergeProps({
2756
+ name: 'tek-grid-layout-item-delete_' + _ctx.instance.name + item
2757
+ }, { ref_for: true }, {
2758
+ small: true,
2759
+ icon: true,
2760
+ iconName: 'mdi-trash-can-outline',
2761
+ events: {
2762
+ click: ({ event }) => { _ctx.deleteLayout(event, item); },
2763
+ },
2764
+ }), null, 16 /* FULL_PROPS */, ["name"])
2765
+ ]))
2766
+ : createCommentVNode("v-if", true)
2767
+ ]),
2768
+ _: 2 /* DYNAMIC */
2769
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onClick"]))
2770
+ }), 128 /* KEYED_FRAGMENT */)),
2771
+ (_ctx.instance.layoutEdited)
2772
+ ? (openBlock(), createBlock(_component_v_list_item, {
2773
+ key: 1,
2774
+ class: normalizeClass(['tek-grid-layout-item-discard']),
2775
+ onClick: _cache[1] || (_cache[1] = $event => (_ctx.instance.discardChanges()))
2776
+ }, {
2777
+ default: withCtx(() => [
2778
+ createVNode(_component_zd_button, {
2779
+ small: "",
2780
+ color: "error darken-2",
2781
+ width: "100%",
2782
+ name: "tek-grid-layout-item-discard-changes",
2783
+ label: "LAYOUT_DISCART_CHANGES"
2784
+ })
2785
+ ]),
2786
+ _: 1 /* STABLE */
2787
+ }))
2788
+ : createCommentVNode("v-if", true)
2789
+ ]),
2790
+ _: 1 /* STABLE */
2791
+ })
2792
+ ]),
2793
+ _: 1 /* STABLE */
2794
+ }, 8 /* PROPS */, ["id", "name", "class", "style", "modelValue"]))
2795
+ }
2796
+
2797
+ layoutOptionsComponent$1.render = render$4;
2798
+ layoutOptionsComponent$1.__file = "src/components/tek-grid/layout-options/TekGridLayoutOptions.vue";
2799
+
2800
+ var script$1 = defineComponent({
2801
+ props: {
2802
+ isSelected: {
2803
+ type: Boolean,
2804
+ required: true,
2805
+ },
2806
+ selectable: {
2807
+ type: Boolean,
2808
+ required: true,
2809
+ },
2810
+ selectionDisabled: {
2811
+ type: Boolean,
2812
+ required: true,
2813
+ },
2814
+ cellSelection: {
2815
+ type: Boolean,
2816
+ required: true,
2817
+ },
2818
+ isCurrent: {
2819
+ type: Function,
2820
+ required: true,
2821
+ },
2822
+ columns: {
2823
+ type: Array,
2824
+ required: true,
2825
+ },
2826
+ row: {
2827
+ type: Object,
2828
+ required: true,
2829
+ },
2830
+ fixedLeft: {
2831
+ type: Object,
2832
+ required: true,
2833
+ },
2834
+ fixedRight: {
2835
+ type: Object,
2836
+ required: true,
2837
+ },
2838
+ },
2839
+ emits: ['focusin'],
2840
+ setup(props, { emit }) {
2841
+ const focusin = (event) => {
2842
+ emit('focusin', { event, row: props.row });
2843
+ };
2844
+ const getLevel = (row) => {
2845
+ if (!row.groupHeaders)
2846
+ return 0;
2847
+ const { length } = row.groupHeaders;
2848
+ return length + 1;
2849
+ };
2850
+ return {
2851
+ focusin,
2852
+ getLevel,
2853
+ };
2854
+ },
2855
+ });
2856
+
2857
+ const _hoisted_1$1 = {
2858
+ key: 0,
2859
+ class: /*@__PURE__*/normalizeClass([
2860
+ 'zd-grid__cell',
2861
+ 'zd-grid__cell--fixed',
2862
+ 'zd-grid__selectable-cell',
2863
+ ])
2864
+ };
2865
+
2866
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2867
+ const _component_tek_grid_indentation = resolveComponent("tek-grid-indentation");
2868
+ const _component_zd_grid_cell = resolveComponent("zd-grid-cell");
2869
+ const _component_table_row = resolveComponent("table-row");
2870
+
2871
+ return (openBlock(), createBlock(_component_table_row, {
2872
+ cssClass: [
2873
+ 'tek-grid-footer-row',
2874
+ { 'tek-grid-footer-row--summary': _ctx.row.groupSummary }
2875
+ ]
2876
+ }, {
2877
+ default: withCtx(() => [
2878
+ (_ctx.selectable)
2879
+ ? (openBlock(), createElementBlock("td", _hoisted_1$1))
2880
+ : createCommentVNode("v-if", true),
2881
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column, index, ___, _cached) => {
2882
+ const _memo = ([_ctx.row, column, _ctx.fixedLeft, _ctx.fixedRight, _ctx.cellSelection, _ctx.isCurrent({ row: _ctx.row, column })]);
2883
+ if (_cached && _cached.key === column.name && isMemoSame(_cached, _memo)) return _cached
2884
+ const _item = (openBlock(), createBlock(_component_zd_grid_cell, {
2885
+ key: column.name,
2886
+ row: _ctx.row,
2887
+ column: column,
2888
+ cssClass: [
2889
+ {
2890
+ 'zd-grid__cell--fixed': column.fixed,
2891
+ 'zd-grid__action-cell--fixed': column.actionFixed,
2892
+ },
2893
+ ],
2894
+ cssStyle: [{
2895
+ left: column.fixed ? _ctx.fixedLeft[column.name] : 'unset',
2896
+ right: column.actionFixed ? _ctx.fixedRight[column.name] : 'unset',
2897
+ }],
2898
+ cellSelection: _ctx.cellSelection,
2899
+ isCurrent: _ctx.isCurrent({ row: _ctx.row, column }),
2900
+ onFocus: $event => (_ctx.cellFocus($event, column)),
2901
+ onFocusin: $event => (_ctx.focusin($event, column))
2902
+ }, {
2903
+ prepend: withCtx(() => [
2904
+ (index === 0)
2905
+ ? (openBlock(), createBlock(_component_tek_grid_indentation, {
2906
+ key: 0,
2907
+ footer: "",
2908
+ level: _ctx.getLevel(_ctx.row)
2909
+ }, null, 8 /* PROPS */, ["level"]))
2910
+ : createCommentVNode("v-if", true)
2911
+ ]),
2912
+ _: 2 /* DYNAMIC */
2913
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["row", "column", "cssClass", "cssStyle", "cellSelection", "isCurrent", "onFocus", "onFocusin"]));
2914
+ _item.memo = _memo;
2915
+ return _item
2916
+ }, _cache, 0), 128 /* KEYED_FRAGMENT */))
2917
+ ]),
2918
+ _: 1 /* STABLE */
2919
+ }, 8 /* PROPS */, ["cssClass"]))
2920
+ }
2921
+
2922
+ script$1.render = render$3;
2923
+ script$1.__file = "src/components/tek-grid/row/TekGridFooterRow.vue";
2924
+
2925
+ var script = defineComponent({
2926
+ props: {
2927
+ isSelected: {
2928
+ type: Boolean,
2929
+ required: true,
2930
+ },
2931
+ isCurrentRow: {
2932
+ type: Boolean,
2933
+ required: true,
2934
+ },
2935
+ selectable: {
2936
+ type: Boolean,
2937
+ required: true,
2938
+ },
2939
+ selectionDisabled: {
2940
+ type: Boolean,
2941
+ required: true,
2942
+ },
2943
+ cellSelection: {
2944
+ type: Boolean,
2945
+ required: true,
2946
+ },
2947
+ isCurrent: {
2948
+ type: Function,
2949
+ required: true,
2950
+ },
2951
+ row: {
2952
+ type: Object,
2953
+ required: true,
2954
+ },
2955
+ indeterminate: {
2956
+ type: Boolean,
2957
+ required: true,
2958
+ },
2959
+ },
2960
+ emits: ['click', 'checkboxClick', 'focusin', 'expandClick'],
2961
+ setup(props, { emit }) {
2962
+ const click = (event) => {
2963
+ emit('click', event);
2964
+ };
2965
+ const checkboxClick = (event) => {
2966
+ emit('checkboxClick', event);
2967
+ };
2968
+ const focusin = (event) => {
2969
+ emit('focusin', { event, row: props.row });
2970
+ };
2971
+ const expandClick = (event) => {
2972
+ emit('expandClick', { event, row: props.row });
2973
+ };
2974
+ return {
2975
+ click,
2976
+ focusin,
2977
+ checkboxClick,
2978
+ expandClick,
2979
+ };
2980
+ },
2981
+ });
2982
+
2983
+ const _hoisted_1 = ["tabindex"];
2984
+ const _hoisted_2 = { class: "tek-grid__group-text zd-ml-2" };
2985
+
2986
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2987
+ const _component_zd_grid_checkbox = resolveComponent("zd-grid-checkbox");
2988
+ const _component_tek_grid_indentation = resolveComponent("tek-grid-indentation");
2989
+ const _component_v_icon = resolveComponent("v-icon");
2990
+ const _component_table_row = resolveComponent("table-row");
2991
+
2992
+ return (openBlock(), createBlock(_component_table_row, {
2993
+ class: normalizeClass([
2994
+ 'tek-grid-group-row',
2995
+ { 'tek-grid-row-group--summary': _ctx.row.groupSummary }
2996
+ ]),
2997
+ isCurrentRow: _ctx.isCurrentRow,
2998
+ onClick: _cache[3] || (_cache[3] = $event => (_ctx.click($event)))
2999
+ }, {
3000
+ default: withCtx(() => [
3001
+ (_ctx.selectable)
3002
+ ? (openBlock(), createBlock(_component_zd_grid_checkbox, {
3003
+ key: 0,
3004
+ disabled: _ctx.selectionDisabled,
3005
+ isSelected: _ctx.isSelected,
3006
+ indeterminate: _ctx.indeterminate,
3007
+ cellSelection: _ctx.cellSelection,
3008
+ isCurrent: _ctx.isCurrent({ row: _ctx.row }),
3009
+ onFocusin: _cache[0] || (_cache[0] = $event => (_ctx.focusin($event))),
3010
+ onClick: _cache[1] || (_cache[1] = withModifiers($event => (_ctx.checkboxClick($event)), ["stop"]))
3011
+ }, null, 8 /* PROPS */, ["disabled", "isSelected", "indeterminate", "cellSelection", "isCurrent"]))
3012
+ : createCommentVNode("v-if", true),
3013
+ createElementVNode("td", {
3014
+ colspan: 999,
3015
+ class: normalizeClass(
3016
+ [
3017
+ 'zd-grid__cell',
3018
+ 'text-left',
3019
+ 'tek-grid-group-cell',
3020
+ 'zd-grid__cell--fixed',
3021
+ ]),
3022
+ style: normalizeStyle(`left: ${(_ctx.selectable ? 40 : 0)}px`),
3023
+ tabindex: _ctx.cellSelection ? 0 : ''
3024
+ }, [
3025
+ createElementVNode("span", {
3026
+ class: normalizeClass([
3027
+ 'tek-grid-group-cell__container'
3028
+ ]),
3029
+ style: normalizeStyle(`left: ${(_ctx.selectable ? 48 : 8)}px`)
3030
+ }, [
3031
+ createVNode(_component_tek_grid_indentation, {
3032
+ level: _ctx.row.groupHeaders.length
3033
+ }, null, 8 /* PROPS */, ["level"]),
3034
+ (openBlock(), createBlock(_component_v_icon, {
3035
+ class: normalizeClass({ closed: !_ctx.row.groupOpened }),
3036
+ onClick: _cache[2] || (_cache[2] = $event => (_ctx.expandClick($event))),
3037
+ key: `${_ctx.row.groupIndex}_${_ctx.row.groupValue}`
3038
+ }, {
3039
+ default: withCtx(() => [
3040
+ createTextVNode(toDisplayString(_ctx.$getIcon('expand')), 1 /* TEXT */)
3041
+ ]),
3042
+ _: 1 /* STABLE */
3043
+ }, 8 /* PROPS */, ["class"])),
3044
+ createElementVNode("span", _hoisted_2, toDisplayString((_ctx.row.groupLabel? _ctx.row.groupLabel + ': ': '') + _ctx.row.groupValue), 1 /* TEXT */)
3045
+ ], 4 /* STYLE */)
3046
+ ], 12 /* STYLE, PROPS */, _hoisted_1)
3047
+ ]),
3048
+ _: 1 /* STABLE */
3049
+ }, 8 /* PROPS */, ["class", "isCurrentRow"]))
3050
+ }
3051
+
3052
+ script.render = render$2;
3053
+ script.__file = "src/components/tek-grid/row/TekGridGroupRow.vue";
3054
+
3055
+ const TekUserInfoProps$1 = Object.assign(Object.assign({}, ZdUserInfoProps), { aboutImage: {
3056
+ type: String,
3057
+ default: '',
3058
+ }, defaultEmail: {
3059
+ type: String,
3060
+ default: '',
3061
+ }, versionInfo: {
3062
+ type: [Object, String],
3063
+ default: null,
3064
+ }, versionUrl: {
3065
+ type: String,
3066
+ default: '',
3067
+ }, bottomSlot: {
3068
+ type: Array,
3069
+ default: undefined,
3070
+ } });
3071
+ const tekUserInfoComponent$1 = defineComponent({
3072
+ props: TekUserInfoProps$1,
3073
+ inheritAttrs: false,
3074
+ setup(props, ctx) {
3075
+ const { instance, root } = useCreateInstance(props, ctx, TekUserInfo);
3076
+ const { click, focus, blur, mouseenter, mouseleave } = useGetMethods(instance, root);
3077
+ return {
3078
+ instance,
3079
+ root,
3080
+ click,
3081
+ focus,
3082
+ blur,
3083
+ mouseenter,
3084
+ mouseleave,
3085
+ };
3086
+ }
3087
+ });
3088
+
3089
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3090
+ const _component_zd_user_info = resolveComponent("zd-user-info");
3091
+
3092
+ return (openBlock(), createBlock(_component_zd_user_info, {
3093
+ id: _ctx.instance.name,
3094
+ "instance-object": _ctx.instance,
3095
+ name: "user-info"
3096
+ }, null, 8 /* PROPS */, ["id", "instance-object"]))
3097
+ }
3098
+
3099
+ tekUserInfoComponent$1.render = render$1;
3100
+ tekUserInfoComponent$1.__file = "src/components/tek-user-info/TekUserInfo.vue";
3101
+
3102
+ const TekUserInfoListProps$1 = Object.assign(Object.assign({}, ZdListProps), { parentName: {
3103
+ type: String,
3104
+ default: '',
3105
+ }, dense: {
3106
+ type: [Boolean, String],
3107
+ default: true,
3108
+ } });
3109
+ const tekUserInfoListComponent$1 = defineComponent({
3110
+ props: TekUserInfoListProps$1,
3111
+ inheritAttrs: false,
3112
+ setup(props, ctx) {
3113
+ const { instance, root } = useCreateInstance(props, ctx, TekUserInfoList);
3114
+ const { click, focus, blur, mouseenter, mouseleave } = useGetMethods(instance, root);
3115
+ return {
3116
+ instance,
3117
+ root,
3118
+ click,
3119
+ focus,
3120
+ blur,
3121
+ mouseenter,
3122
+ mouseleave,
3123
+ };
3124
+ }
3125
+ });
3126
+
3127
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
3128
+ const _component_zd_list = resolveComponent("zd-list");
3129
+
3130
+ return (openBlock(), createBlock(_component_zd_list, {
3131
+ id: _ctx.instance.name,
3132
+ "instance-object": _ctx.instance,
3133
+ name: "list"
3134
+ }, null, 8 /* PROPS */, ["id", "instance-object"]))
3135
+ }
3136
+
3137
+ tekUserInfoListComponent$1.render = render;
3138
+ tekUserInfoListComponent$1.__file = "src/components/tek-user-info/TekUserInfoList.vue";
3139
+
3140
+ const TekBreadcrumbHeaderProps = Object.assign(Object.assign({}, ZdComponentRenderProps), { title: {
3141
+ type: String,
3142
+ default: '',
3143
+ }, breadcrumb: {
3144
+ type: Object,
3145
+ default: {},
3146
+ }, rightSlot: {
3147
+ type: Array,
3148
+ default: () => [],
3149
+ } });
3150
+ const breadcrumbHeaderComponent = defineComponent({
3151
+ props: TekBreadcrumbHeaderProps,
3152
+ inheritAttrs: false,
3153
+ setup(props, ctx) {
3154
+ const { instance, root } = useCreateInstance(props, ctx, BreadcrumbHeader);
3155
+ return {
3156
+ instance,
3157
+ root,
3158
+ };
3159
+ },
3160
+ });
3161
+
3162
+ const components = {
3163
+ TekBreadcrumbHeader: breadcrumbHeaderComponent$1,
3164
+ TekGrid: gridEditableComponent$1,
3165
+ TekGridColumnFilter: tekGridColumnFilter$1,
3166
+ TekGridHeaderRow: script$3,
3167
+ TekGridColumnsButton: tekGridColumnsButton$1,
3168
+ TekGridFilterButton: tekGridFilterButtonComponent$1,
3169
+ TekGridIndentation: script$2,
3170
+ TekGridLayoutOptions: layoutOptionsComponent$1,
3171
+ TekGridFooterRow: script$1,
3172
+ TekGridGroupRow: script,
3173
+ TekUserInfo: tekUserInfoComponent$1,
3174
+ TekUserInfoList: tekUserInfoListComponent$1,
3175
+ };
3176
+
3177
+ const TekGridProps = buildProps(Object.assign(Object.assign({}, ZdGridEditableProps), { toolbarSlot: {
3178
+ type: Array,
3179
+ default: undefined,
3180
+ }, title: {
3181
+ type: String,
3182
+ default: '',
3183
+ }, addButton: {
3184
+ type: [Boolean, String],
3185
+ default: false,
3186
+ }, deleteButton: {
3187
+ type: [String, Boolean],
3188
+ default: 'none',
3189
+ }, columnsButton: {
3190
+ type: [Boolean, String],
3191
+ default: false,
3192
+ }, columnsButtonIgnore: {
3193
+ type: [Array, String],
3194
+ default: () => [],
3195
+ }, showEditButtons: {
3196
+ type: [Boolean, String],
3197
+ default: true,
3198
+ }, filterButton: {
3199
+ type: [Boolean, String],
3200
+ default: false,
3201
+ }, modalFilterProps: {
3202
+ type: Object,
3203
+ default: () => ({}),
3204
+ }, showSearch: {
3205
+ type: [Boolean, String],
3206
+ default: true,
3207
+ }, columnFilterButton: {
3208
+ type: [Boolean, String],
3209
+ default: false,
3210
+ }, hideActions: {
3211
+ type: [Boolean, String],
3212
+ default: false,
3213
+ }, actions: {
3214
+ type: Array,
3215
+ default: () => [],
3216
+ }, dragColumns: {
3217
+ type: [Boolean, String],
3218
+ default: true,
3219
+ }, resizeColumns: {
3220
+ type: [Boolean, String],
3221
+ default: true,
3222
+ }, showLayoutOptions: {
3223
+ type: [Boolean, String],
3224
+ default: true,
3225
+ }, showExport: {
3226
+ type: [String, Boolean],
3227
+ default: false,
3228
+ }, showReload: {
3229
+ type: [Boolean, String],
3230
+ default: true,
3231
+ }, exportConfig: {
3232
+ type: Array,
3233
+ }, exportActions: {
3234
+ type: Array,
3235
+ }, groupsOpened: {
3236
+ type: [Boolean, String],
3237
+ default: false,
3238
+ }, showSummaryTotal: {
3239
+ type: [Boolean, String],
3240
+ default: true,
3241
+ }, mainGrid: {
3242
+ type: [Boolean, String],
3243
+ default: true,
3244
+ }, xlsDefaultType: {
3245
+ type: String,
3246
+ default: undefined,
3247
+ }, showCheckboxAllFilter: {
3248
+ type: [Boolean, String],
3249
+ default: Config.gridShowCheckboxAllFilter,
3250
+ }, toolbarOpened: {
3251
+ type: [Boolean],
3252
+ default: true,
3253
+ }, defaultFilter: {
3254
+ type: Object,
3255
+ }, reportTitle: {
3256
+ type: String,
3257
+ }, editNewRowsOnly: {
3258
+ type: [Boolean, String],
3259
+ default: false,
3260
+ } }));
3261
+ const gridEditableComponent = defineComponent({
3262
+ props: TekGridProps,
3263
+ inheritAttrs: false,
3264
+ setup(props, ctx) {
3265
+ const { instance, root } = useCreateInstance(props, ctx, TekGrid);
3266
+ const renderedData = computed(() => {
3267
+ if (instance.isGrouped()) {
3268
+ return instance.getGroupedData();
3269
+ }
3270
+ return instance.getData();
3271
+ });
3272
+ const visibleData = computed(() => {
3273
+ return renderedData.value.filter((row) => instance.isItemVisible(row));
3274
+ });
3275
+ const gridEditableScope = useGridEditableInstance({ instance, root, renderedData: visibleData });
3276
+ const rootEl = getRootElement(root);
3277
+ const { visibleColumns } = useGridColumns({
3278
+ instance,
3279
+ rootEl,
3280
+ visibilityCondition: (column) => column.isVisible && !column.grouped,
3281
+ });
3282
+ provideTableLayout({ instance, rootEl });
3283
+ const debouncedDatasourceGet = debounce((instance) => {
3284
+ const event = new Event('change', { cancelable: true });
3285
+ instance.callEvent('beforeApplyFilter', { component: instance, event });
3286
+ if (event.defaultPrevented)
3287
+ return;
3288
+ const { datasource } = instance;
3289
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
3290
+ datasource.updateDynamicFilter();
3291
+ }
3292
+ else {
3293
+ datasource.get();
3294
+ }
3295
+ }, 500);
3296
+ const filter = computed(() => {
3297
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
3298
+ return instance.datasource.dynamicFilter;
3299
+ }
3300
+ const datasourceFilter = instance.datasource.filter;
3301
+ const simpleFilter = {};
3302
+ Object.keys(datasourceFilter).forEach((key) => {
3303
+ simpleFilter[key] = [{ relation: 'AND', operation: 'CONTAINS', value: datasourceFilter[key] }];
3304
+ });
3305
+ return simpleFilter;
3306
+ });
3307
+ const setFilter = (newFilter) => {
3308
+ if (Utils.isEqual(filter, newFilter))
3309
+ return;
3310
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
3311
+ instance.datasource.dynamicFilter = cloneDeep(newFilter);
3312
+ }
3313
+ else {
3314
+ const normalFilter = {};
3315
+ Object.keys(newFilter).forEach((key) => {
3316
+ if (!newFilter[key][0].value)
3317
+ return;
3318
+ normalFilter[key] = newFilter[key][0].value;
3319
+ });
3320
+ instance.datasource.filter = normalFilter;
3321
+ }
3322
+ debouncedDatasourceGet(instance);
3323
+ instance.changeLayout();
3324
+ };
3325
+ const columnHasFilter = (columnName) => {
3326
+ return instance.columnHasFilter(columnName);
3327
+ };
3328
+ const isRowVisible = (row, index) => {
3329
+ return instance.isItemVisible(row) && gridEditableScope.shouldRender(index);
3330
+ };
3331
+ const isCurrentRowGroup = (row) => {
3332
+ const { uniqueKey, currentRow } = instance.datasource;
3333
+ return !!((row.group && row.groupValue === currentRow.groupValue) ||
3334
+ (row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey]));
3335
+ };
3336
+ const isGroupSelectIndeterminate = (item) => {
3337
+ let hasSelected = false;
3338
+ let hasNotSelected = false;
3339
+ const { uniqueKey } = instance.datasource;
3340
+ item.children.forEach((child) => {
3341
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
3342
+ hasSelected = hasSelected || idx !== -1;
3343
+ hasNotSelected = hasNotSelected || idx === -1;
3344
+ });
3345
+ return hasSelected && hasNotSelected;
3346
+ };
3347
+ const isGroupSelected = (item) => {
3348
+ return item.children.every((child) => {
3349
+ const { uniqueKey } = instance.datasource;
3350
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
3351
+ return idx !== -1;
3352
+ });
3353
+ };
3354
+ const selectGroupRowClick = (row, isSelected, event) => {
3355
+ nextTick(() => {
3356
+ const rootElement = getRootElement(root);
3357
+ instance.selectGroupClick(row, isSelected, event, rootElement.value);
3358
+ });
3359
+ };
3360
+ const selectGroup = (item, event) => {
3361
+ const { uniqueKey } = instance.datasource;
3362
+ const isSelected = isGroupSelected(item);
3363
+ if (!isSelected) {
3364
+ // here we fetch the item from renderedData because vuetify isSelected checks for object reference
3365
+ // so we need to find the item inside renderedData to call selectRow() with the correct reference
3366
+ // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VDataTable/composables/select.ts#L128
3367
+ const items = item.children.map((child) => {
3368
+ return renderedData.value.find((row) => child[uniqueKey] === row[uniqueKey]);
3369
+ });
3370
+ items.forEach((child) => {
3371
+ if (!child)
3372
+ return;
3373
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
3374
+ if (idx === -1) {
3375
+ instance.selectRow(child, true);
3376
+ }
3377
+ });
3378
+ }
3379
+ else {
3380
+ item.children.forEach((child) => {
3381
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
3382
+ if (idx !== -1) {
3383
+ instance.selectRow(child, false);
3384
+ }
3385
+ });
3386
+ }
3387
+ selectGroupRowClick(item, !isSelected, event);
3388
+ };
3389
+ const openGroup = (item) => {
3390
+ instance.openGroup(item);
3391
+ };
3392
+ const isGroup = (item) => {
3393
+ return !!item.group;
3394
+ };
3395
+ const isFooter = (item) => {
3396
+ return !!item.groupFooter;
3397
+ };
3398
+ const groupColumnNames = computed(() => {
3399
+ return instance.columns.filter((column) => column.grouped).map((column) => column.name) || [];
3400
+ });
3401
+ return Object.assign(Object.assign({}, gridEditableScope), { instance,
3402
+ root,
3403
+ filter,
3404
+ setFilter,
3405
+ columnHasFilter,
3406
+ visibleColumns,
3407
+ isRowVisible,
3408
+ isCurrentRowGroup,
3409
+ isGroupSelectIndeterminate,
3410
+ selectGroup,
3411
+ isGroup,
3412
+ openGroup,
3413
+ renderedData,
3414
+ isGroupSelected,
3415
+ groupColumnNames,
3416
+ isFooter,
3417
+ visibleData });
3418
+ },
3419
+ });
3420
+
3421
+ const TekGridColumnFilterProps = {
3422
+ hasFilterData: {
3423
+ type: Boolean,
3424
+ default: false,
3425
+ },
3426
+ column: {
3427
+ type: Object,
3428
+ required: true,
3429
+ },
3430
+ modelValue: {
3431
+ type: Array,
3432
+ default: [],
3433
+ },
3434
+ instanceName: {
3435
+ type: String,
3436
+ required: true,
3437
+ },
3438
+ filterRelationsDatasource: {
3439
+ type: [Object, null],
3440
+ required: false,
3441
+ },
3442
+ filterOperationsDatasource: {
3443
+ type: [Object, null],
3444
+ required: false,
3445
+ },
3446
+ isHovering: {
3447
+ type: Boolean,
3448
+ default: false,
3449
+ },
3450
+ multiple: {
3451
+ type: Boolean,
3452
+ required: true,
3453
+ },
3454
+ };
3455
+ const tekGridColumnFilter = defineComponent({
3456
+ props: TekGridColumnFilterProps,
3457
+ inheritAttrs: false,
3458
+ emits: ['update:modelValue'],
3459
+ setup(props, ctx) {
3460
+ const getValueInputName = (index) => `${props.instanceName}-${props.column.name}-filter-value-${index}`;
3461
+ const focusValueInput = (index) => {
3462
+ const valueInputName = getValueInputName(index);
3463
+ const input = Metadata.getInstance(valueInputName);
3464
+ input.setFocus();
3465
+ };
3466
+ const createNewFilter = () => {
3467
+ return reactive({
3468
+ operation: 'CONTAINS',
3469
+ relation: 'AND',
3470
+ value: undefined,
3471
+ });
3472
+ };
3473
+ let newFilter = createNewFilter();
3474
+ const convertToDateFormat = (value, revert) => {
3475
+ const dateFormat = props.column.componentProps.dateFormat || Config.dateFormat;
3476
+ const displayFormat = props.column.componentProps.displayFormat || Config.displayFormat;
3477
+ if (revert) {
3478
+ if (dayjs(value, displayFormat).isValid() || !dayjs(value, dateFormat).isValid()) {
3479
+ return value;
3480
+ }
3481
+ return dayjs(value, dateFormat).format(displayFormat);
3482
+ }
3483
+ if (dayjs(value, dateFormat).isValid() || !dayjs(value, displayFormat).isValid()) {
3484
+ return value;
3485
+ }
3486
+ return dayjs(value, displayFormat).format(dateFormat);
3487
+ };
3488
+ const checkDateValueFormat = (value, revert = false) => {
3489
+ if (!['ZdDate', 'ZdDateRange'].includes(props.column.componentProps.component))
3490
+ return value;
3491
+ if (Array.isArray(value)) {
3492
+ return value.map((item) => convertToDateFormat(item, revert));
3493
+ }
3494
+ return convertToDateFormat(value, revert);
3495
+ };
3496
+ // use WeakMap to avoid memory leaks
3497
+ const idMap = new WeakMap();
3498
+ let idCounter = 0;
3499
+ // retrieves a unique id for each item
3500
+ const getId = (item) => {
3501
+ if (!idMap.has(item)) {
3502
+ idMap.set(item, `__item__${idCounter++}`);
3503
+ }
3504
+ return idMap.get(item);
3505
+ };
3506
+ // use computed to generate unique ids for each filter item
3507
+ // this is needed for the v-for :key updates
3508
+ const modelWithIds = computed(() => {
3509
+ if (!props.multiple) {
3510
+ if (props.modelValue.length > 0) {
3511
+ return [{ id: getId(props.modelValue[0]), item: props.modelValue[0] }];
3512
+ }
3513
+ return [{ id: getId(newFilter), item: newFilter }];
3514
+ }
3515
+ return [...props.modelValue, newFilter].map((item) => ({
3516
+ id: getId(item),
3517
+ item,
3518
+ }));
3519
+ });
3520
+ const debounceUpdateModel = debounce((modelValue) => {
3521
+ if (Utils.isEqual(modelValue, props.modelValue))
3522
+ return;
3523
+ ctx.emit('update:modelValue', modelValue);
3524
+ newFilter = createNewFilter();
3525
+ }, 500);
3526
+ const changeRelation = (index, { component }) => {
3527
+ const modelValue = cloneDeep(props.modelValue);
3528
+ const isNewFilter = index === modelValue.length;
3529
+ const filter = isNewFilter ? newFilter : modelValue[index];
3530
+ const { value } = component;
3531
+ focusValueInput(index);
3532
+ // update item type value
3533
+ filter.relation = value;
3534
+ if (isNewFilter)
3535
+ return;
3536
+ debounceUpdateModel(modelValue);
3537
+ };
3538
+ const changeOperation = (index, { component }) => {
3539
+ const modelValue = cloneDeep(props.modelValue);
3540
+ const filterItem = modelValue[index];
3541
+ const isNewFilter = index === modelValue.length;
3542
+ const filter = isNewFilter ? newFilter : filterItem;
3543
+ const { value } = component;
3544
+ focusValueInput(index);
3545
+ // if operation is IN, NOT_IN or BETWEEN, value should be an array
3546
+ if (isArrayOperation(value)) {
3547
+ filter.value = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
3548
+ }
3549
+ // update item type value
3550
+ filter.operation = value;
3551
+ if (isNewFilter)
3552
+ return;
3553
+ debounceUpdateModel(modelValue);
3554
+ };
3555
+ const changeValue = (item, index, { component }) => {
3556
+ const modelValue = cloneDeep(props.modelValue);
3557
+ const filter = cloneDeep(item);
3558
+ const { value } = component;
3559
+ const isNewFilter = props.multiple && index === modelValue.length;
3560
+ let formattedValue = value;
3561
+ if (value && isArrayOperation(filter.operation)) {
3562
+ formattedValue = value.split(';');
3563
+ }
3564
+ filter.value = checkDateValueFormat(formattedValue);
3565
+ if (!props.multiple) {
3566
+ debounceUpdateModel([filter]);
3567
+ return;
3568
+ }
3569
+ if (isNewFilter) {
3570
+ // only emit event when newFilter has value
3571
+ if (!filter.value)
3572
+ return;
3573
+ debounceUpdateModel([...modelValue, filter]);
3574
+ return;
3575
+ }
3576
+ if (!filter.value) {
3577
+ // when removing the last (not new) filter, should pass its operation and relation to the new filter
3578
+ if (index === modelValue.length - 1) {
3579
+ newFilter.operation = filter.operation;
3580
+ newFilter.relation = filter.relation;
3581
+ }
3582
+ modelValue.splice(index, 1);
3583
+ // if the removed filter was the first, should set the new first relation to AND
3584
+ if (modelValue.length > 0 && index === 0) {
3585
+ modelValue[0].relation = 'AND';
3586
+ }
3587
+ // if the removed filter was the last, should set the newFilter relation to AND
3588
+ if (modelValue.length === 0) {
3589
+ newFilter.relation = 'AND';
3590
+ }
3591
+ }
3592
+ debounceUpdateModel(modelValue);
3593
+ };
3594
+ const getComponentType = (operation) => {
3595
+ return isArrayOperation(operation) ? 'ZdTextInput' : props.column.componentProps.component;
3596
+ };
3597
+ const getComponentHint = (operation) => {
3598
+ return isArrayOperation(operation) ? 'TEKGRID_MULTIPLE_VALUE_HINT' : '';
3599
+ };
3600
+ const getItemValue = (item) => {
3601
+ return isArrayOperation(item.operation) ? item.value.join(';') : item.value;
3602
+ };
3603
+ return {
3604
+ changeValue,
3605
+ changeRelation,
3606
+ changeOperation,
3607
+ getValueInputName,
3608
+ newFilter,
3609
+ getComponentType,
3610
+ getComponentHint,
3611
+ modelWithIds,
3612
+ getItemValue,
3613
+ };
3614
+ },
3615
+ });
3616
+
3617
+ const TekGridColumnsButtonProps = Object.assign(Object.assign({}, ZdIterableColumnsButtonProps), { hideGroups: {
3618
+ type: [Boolean, String],
3619
+ default: false,
3620
+ } });
3621
+ const tekGridColumnsButton = defineComponent({
3622
+ props: TekGridColumnsButtonProps,
3623
+ inheritAttrs: false,
3624
+ setup(props, ctx) {
3625
+ const { instance, root } = useCreateInstance(props, ctx, TekGridColumnsButton);
3626
+ const buttonScope = useButtonInstance({ instance, root });
3627
+ const menuIsOpened = ref(false);
3628
+ const sortableInitialized = ref(false);
3629
+ const teste = (a) => {
3630
+ console.warn(a);
3631
+ };
3632
+ watch(menuIsOpened, () => {
3633
+ if (!menuIsOpened.value || sortableInitialized.value)
3634
+ return;
3635
+ sortableInitialized.value = true;
3636
+ nextTick(() => {
3637
+ const columnsTableBody = document.querySelector(`#${instance.name}_columns_table tbody`);
3638
+ if (columnsTableBody) {
3639
+ sortable.create(columnsTableBody, {
3640
+ handle: '.sortHandle',
3641
+ dragClass: 'tek-grid-columns-button-sortable-drag',
3642
+ onEnd: sortEnd,
3643
+ });
3644
+ }
3645
+ });
3646
+ });
3647
+ const gridGroupColumnNames = computed(() => {
3648
+ return instance.iterableComponent.columns.filter((column) => column.grouped).map((column) => column.name) || [];
3649
+ });
3650
+ const sortEnd = (event) => {
3651
+ const grid = instance.iterableComponent;
3652
+ const newOrder = Array.from(event.srcElement.querySelectorAll('tr')).map((row) => row.getAttribute('name'));
3653
+ const groupColumnNames = [];
3654
+ const newColumns = newOrder.map((columnName) => {
3655
+ const column = grid.getColumn(columnName);
3656
+ if (column.grouped) {
3657
+ groupColumnNames.push(columnName);
3658
+ }
3659
+ return column;
3660
+ });
3661
+ const ignoredColumns = grid.columns.filter((column) => instance.ignoreColumns.indexOf(column.name) !== -1);
3662
+ grid.columns = newColumns.concat(ignoredColumns);
3663
+ if (grid.updateGrouping && JSON.stringify(groupColumnNames) !== JSON.stringify(gridGroupColumnNames)) {
3664
+ grid.updateGrouping();
3665
+ }
3666
+ grid.changeLayout();
3667
+ };
3668
+ const moreOptions = () => {
3669
+ TekGridColumnsOptionsModal.show(instance);
3670
+ };
3671
+ const close = () => {
3672
+ menuIsOpened.value = false;
3673
+ };
3674
+ return Object.assign(Object.assign({}, buttonScope), { instance,
3675
+ root,
3676
+ menuIsOpened,
3677
+ moreOptions,
3678
+ close,
3679
+ teste,
3680
+ mergeProps });
3681
+ },
3682
+ });
3683
+
3684
+ const TekGridFilterButtonProps = Object.assign(Object.assign({}, ZdButtonProps), { gridName: {
3685
+ type: String,
3686
+ default: '',
3687
+ }, grid: {
3688
+ type: [Object, String],
3689
+ default: () => { },
3690
+ }, showCheckboxAll: {
3691
+ type: [Boolean, String],
3692
+ default: false,
3693
+ } });
3694
+ const tekGridFilterButtonComponent = defineComponent({
3695
+ props: TekGridFilterButtonProps,
3696
+ inheritAttrs: false,
3697
+ setup(props, ctx) {
3698
+ const { instance, root } = useCreateInstance(props, ctx, TekGridFilterButton);
3699
+ const buttonScope = useButtonInstance({ instance, root });
3700
+ const filterClick = ({ event }) => {
3701
+ instance.click(event);
3702
+ };
3703
+ return Object.assign(Object.assign({}, buttonScope), { instance,
3704
+ root,
3705
+ filterClick });
3706
+ },
3707
+ });
3708
+
3709
+ const TekGridLayoutOptionsProps = Object.assign({}, ZdComponentRenderProps);
3710
+ const layoutOptionsComponent = defineComponent({
3711
+ props: TekGridLayoutOptionsProps,
3712
+ inheritAttrs: false,
3713
+ setup(props, ctx) {
3714
+ const { instance, root } = useCreateInstance(props, ctx, TekGridLayoutOptions);
3715
+ const { applyLayout: applyTekGridLayout, getColumnElements, getTableWidth } = useTableLayout();
3716
+ onMounted(() => {
3717
+ instance.viewApplyLayout = applyLayout;
3718
+ instance.viewGetCurrentLayout = getCurrentLayout;
3719
+ });
3720
+ const confirmLayoutClick = ({ component }) => {
3721
+ const layoutName = component.value;
3722
+ if (layoutName) {
3723
+ const newLayout = getCurrentLayout(layoutName);
3724
+ instance.newLayout(newLayout);
3725
+ }
3726
+ menuActive.value = false;
3727
+ component.value = '';
3728
+ };
3729
+ const datasourceDynamicFilter = () => {
3730
+ const datasource = instance.grid.datasource;
3731
+ if (datasource instanceof TekRestDatasource)
3732
+ return datasource.dynamicFilter;
3733
+ return {};
3734
+ };
3735
+ const changeLayout = (layout) => {
3736
+ instance.updateLayout(layout.name, getCurrentLayout(layout.name));
3737
+ };
3738
+ const applyLayout = (layout) => {
3739
+ const defaultLayout = {
3740
+ originalDatasourceOrder: instance.originalDatasourceOrder,
3741
+ originalDatasourceFilter: instance.originalDatasourceFilter,
3742
+ originalColumnProps: instance.originalColumnProps,
3743
+ originalDatasourceDynamicFilter: instance.originalDatasourceDynamicFilter,
3744
+ };
3745
+ applyTekGridLayout({ layout, defaultLayout, changeLayoutCallback: changeLayout });
3746
+ menuActive.value = false;
3747
+ };
3748
+ const getCurrentLayout = (layoutName) => {
3749
+ const { grid } = instance;
3750
+ const gridWidth = getTableWidth();
3751
+ const columnElementsDict = getColumnElements();
3752
+ return {
3753
+ name: layoutName,
3754
+ gridWidth,
3755
+ order: grid.datasource.order,
3756
+ filter: grid.datasource.filter,
3757
+ dynamicFilter: datasourceDynamicFilter(),
3758
+ columns: grid.columns.map((column, index) => {
3759
+ const columnElement = columnElementsDict[index];
3760
+ return {
3761
+ name: column.name,
3762
+ label: column.label,
3763
+ align: column.align,
3764
+ width: columnElement ? window.getComputedStyle(columnElement).width : 'unset',
3765
+ minWidth: column.minWidth,
3766
+ maxWidth: column.maxWidth,
3767
+ isVisible: column.isVisible,
3768
+ fixed: column.fixed,
3769
+ grouped: column.grouped,
3770
+ groupOpened: column.groupOpened,
3771
+ aggregation: column.aggregation,
3772
+ filterHelperValue: instance.getHelperValue(column),
3773
+ };
3774
+ }),
3775
+ };
3776
+ };
3777
+ const menuActive = ref(false);
3778
+ const applyOrUpdateLayout = (event, layoutName) => {
3779
+ if (instance.layoutEdited) {
3780
+ instance.updateLayout(layoutName, getCurrentLayout(layoutName));
3781
+ event.stopImmediatePropagation();
3782
+ menuActive.value = false;
3783
+ }
3784
+ else {
3785
+ instance.applyLayout(layoutName);
3786
+ }
3787
+ };
3788
+ const deleteLayout = (event, layoutName) => {
3789
+ instance.deleteLayout(layoutName);
3790
+ event.stopImmediatePropagation();
3791
+ };
3792
+ return {
3793
+ instance,
3794
+ root,
3795
+ menuActive,
3796
+ confirmLayoutClick,
3797
+ applyOrUpdateLayout,
3798
+ deleteLayout,
3799
+ mergeProps,
3800
+ };
3801
+ },
3802
+ });
3803
+
3804
+ const TekUserInfoProps = Object.assign(Object.assign({}, ZdUserInfoProps), { aboutImage: {
3805
+ type: String,
3806
+ default: '',
3807
+ }, defaultEmail: {
3808
+ type: String,
3809
+ default: '',
3810
+ }, versionInfo: {
3811
+ type: [Object, String],
3812
+ default: null,
3813
+ }, versionUrl: {
3814
+ type: String,
3815
+ default: '',
3816
+ }, bottomSlot: {
3817
+ type: Array,
3818
+ default: undefined,
3819
+ } });
3820
+ const tekUserInfoComponent = defineComponent({
3821
+ props: TekUserInfoProps,
3822
+ inheritAttrs: false,
3823
+ setup(props, ctx) {
3824
+ const { instance, root } = useCreateInstance(props, ctx, TekUserInfo);
3825
+ const { click, focus, blur, mouseenter, mouseleave } = useGetMethods(instance, root);
3826
+ return {
3827
+ instance,
3828
+ root,
3829
+ click,
3830
+ focus,
3831
+ blur,
3832
+ mouseenter,
3833
+ mouseleave,
3834
+ };
3835
+ }
3836
+ });
3837
+
3838
+ const TekUserInfoListProps = Object.assign(Object.assign({}, ZdListProps), { parentName: {
3839
+ type: String,
3840
+ default: '',
3841
+ }, dense: {
3842
+ type: [Boolean, String],
3843
+ default: true,
3844
+ } });
3845
+ const tekUserInfoListComponent = defineComponent({
3846
+ props: TekUserInfoListProps,
3847
+ inheritAttrs: false,
3848
+ setup(props, ctx) {
3849
+ const { instance, root } = useCreateInstance(props, ctx, TekUserInfoList);
3850
+ const { click, focus, blur, mouseenter, mouseleave } = useGetMethods(instance, root);
3851
+ return {
3852
+ instance,
3853
+ root,
3854
+ click,
3855
+ focus,
3856
+ blur,
3857
+ mouseenter,
3858
+ mouseleave,
3859
+ };
3860
+ }
3861
+ });
3862
+
3863
+ Icons.addIcons({
3864
+ add: 'mdi-plus-box',
3865
+ delete: 'mdi-trash-can-outline',
3866
+ refresh: 'mdi-refresh',
3867
+ more: 'mdi-dots-vertical',
3868
+ filter: 'mdi-filter',
3869
+ confirmLayout: 'mdi-check',
3870
+ updateLayout: 'mdi-square-edit-outline',
3871
+ layout: 'mdi-table-star',
3872
+ });
3873
+ const TeknisaComponents = {
3874
+ install(app) {
3875
+ Object.keys(components).forEach((id) => {
3876
+ app.component(id, components[id]);
3877
+ });
3878
+ app.component('ZdUserInfo', ZdUserInfoComponent);
3879
+ },
3880
+ };
3881
+
3882
+ export { breadcrumbHeaderComponent as TekBreadcrumbHeader, gridEditableComponent as TekGrid, tekGridColumnFilter as TekGridColumnFilter, tekGridColumnsButton as TekGridColumnsButton, tekGridFilterButtonComponent as TekGridFilterButton, layoutOptionsComponent as TekGridLayoutOptions, tekUserInfoComponent as TekUserInfo, tekUserInfoListComponent as TekUserInfoList, TeknisaComponents as default };