@zeedhi/teknisa-components-vuetify 3.1.0 → 3.3.0

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