@zeedhi/vuetify 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/tek-grid/TekGrid.js +287 -0
- package/dist/components/tek-grid/column-filter/TekGridColumnFilter.js +201 -0
- package/dist/components/tek-grid/column-header/TekGridHeaderRow.js +134 -0
- package/dist/components/tek-grid/columns-button/TekGridColumnsButton.js +79 -0
- package/dist/components/tek-grid/columns-button/TekGridColumnsOptionsController.js +416 -0
- package/dist/components/tek-grid/columns-button/TekGridColumnsOptionsModal.js +501 -0
- package/dist/components/tek-grid/filter-button/TekGridFilterButton.js +36 -0
- package/dist/components/tek-grid/indentation/TekGridIndentation.js +20 -0
- package/dist/components/tek-grid/layout-options/TekGridLayoutOptions.js +101 -0
- package/dist/components/tek-grid/row/TekGridFooterRow.js +57 -0
- package/dist/components/tek-grid/row/TekGridGroupRow.js +58 -0
- package/dist/components/zd-date-input/ZdDateInput.js +23 -86
- package/dist/components/zd-date-range/ZdDateRange.js +22 -84
- package/dist/components/zd-tabs/ZdTab.js +0 -3
- package/dist/components/zd-text/ZdText.js +3 -2
- package/dist/composables/index.js +2 -0
- package/dist/composables/useDateKeydown.js +87 -0
- package/dist/composables/usePickerValue.js +19 -0
- package/dist/composables/useTableLayout.js +212 -0
- package/dist/utils/isArrayOperation.js +4 -0
- package/dist/zd-vuetify.css +14120 -13554
- package/dist/zd-vuetify.js +8322 -4831
- package/package.json +4 -4
- package/src/components/zd-badge/ZdBadge.vue +2 -2
- package/src/components/zd-card/ZdCard.vue +2 -2
- package/src/components/zd-col/ZdCol.vue +1 -0
- package/src/components/zd-container/ZdContainer.vue +2 -2
- package/src/components/zd-date-input/ZdDateInput.ts +27 -94
- package/src/components/zd-date-input/ZdDateInput.vue +1 -0
- package/src/components/zd-date-range/ZdDateRange.ts +22 -88
- package/src/components/zd-date-range/ZdDateRange.vue +12 -14
- package/src/components/zd-footer/ZdFooter.vue +1 -0
- package/src/components/zd-grid/footer/ZdGridFooter.vue +2 -2
- package/src/components/zd-grid/toolbar/ZdGridToolbar.vue +2 -2
- package/src/components/zd-header/ZdHeader.vue +5 -5
- package/src/components/zd-iterable/ZdIterableNoData.vue +6 -6
- package/src/components/zd-iterable-component-render/ZdIterableComponentRender.vue +10 -10
- package/src/components/zd-layout/ZdLayout.vue +2 -2
- package/src/components/zd-login/ZdLogin.vue +4 -4
- package/src/components/zd-main/ZdMain.vue +2 -2
- package/src/components/zd-master-detail/ZdMasterDetail.vue +2 -2
- package/src/components/zd-modal/ZdModal.vue +2 -2
- package/src/components/zd-progress/ZdProgress.vue +2 -2
- package/src/components/zd-row/ZdRow.vue +1 -0
- package/src/components/zd-select/ZdSelect.vue +4 -4
- package/src/components/zd-select-multiple/ZdSelectMultiple.vue +4 -4
- package/src/components/zd-tabs/ZdTab.ts +0 -3
- package/src/components/zd-tabs/ZdTab.vue +1 -1
- package/src/components/zd-tabs/ZdTabItem.vue +11 -10
- package/src/components/zd-tabs/ZdTabs.vue +4 -20
- package/src/components/zd-text/ZdText.ts +3 -2
- package/src/components/zd-time/ZdTime.vue +1 -0
- package/src/components/zd-tooltip/ZdTooltip.vue +2 -2
- package/src/components/zd-tree/ZdTree.vue +4 -4
- package/src/composables/index.ts +2 -0
- package/src/composables/useDateKeydown.ts +109 -0
- package/src/composables/usePickerValue.ts +22 -0
- package/types/components/tek-grid/TekGrid.d.ts +7258 -0
- package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +129 -0
- package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +225 -0
- package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +2432 -0
- package/types/components/tek-grid/columns-button/TekGridColumnsOptionsController.d.ts +65 -0
- package/types/components/tek-grid/columns-button/TekGridColumnsOptionsModal.d.ts +9 -0
- package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +2920 -0
- package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +32 -0
- package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +1892 -0
- package/types/components/tek-grid/row/TekGridFooterRow.d.ts +90 -0
- package/types/components/tek-grid/row/TekGridGroupRow.d.ts +87 -0
- package/types/components/zd-date-input/ZdDateInput.d.ts +2 -2
- package/types/components/zd-date-range/ZdDateRange.d.ts +22 -7
- package/types/components/zd-grid-editable/cell/ZdGridEditableCell.d.ts +1 -1
- package/types/components/zd-layout/ZdLayout.d.ts +1 -1
- package/types/components/zd-list/ZdList.d.ts +3 -3
- package/types/components/zd-list/ZdListGroup.d.ts +2 -2
- package/types/components/zd-list/ZdListItem.d.ts +1 -1
- package/types/components/zd-month/ZdMonth.d.ts +2 -2
- package/types/components/zd-tabs/ZdTab.d.ts +0 -9
- package/types/components/zd-text/ZdText.d.ts +46 -37
- package/types/components/zd-time/ZdTime.d.ts +2 -2
- package/types/composables/index.d.ts +2 -0
- package/types/composables/useDateKeydown.d.ts +5 -0
- package/types/composables/usePickerValue.d.ts +10 -0
- package/types/composables/useTableLayout.d.ts +25 -0
- package/types/utils/isArrayOperation.d.ts +2 -0
- package/.package.json +0 -54
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Modal, TekGrid } from '@zeedhi/common';
|
|
11
|
+
import { I18n, Metadata, Singleton, Utils } from '@zeedhi/core';
|
|
12
|
+
import Sortable from 'sortablejs';
|
|
13
|
+
let TekGridColumnsOptionsController = class TekGridColumnsOptionsController {
|
|
14
|
+
modal;
|
|
15
|
+
columnData = {};
|
|
16
|
+
fixedColumns = [];
|
|
17
|
+
visibleColumns = [];
|
|
18
|
+
groupedColumns = [];
|
|
19
|
+
otherColumns = [];
|
|
20
|
+
aggregationData = [];
|
|
21
|
+
selectedColumnNames = [];
|
|
22
|
+
searchValue = '';
|
|
23
|
+
showGroups = true;
|
|
24
|
+
selectedColumnsAlignment;
|
|
25
|
+
selectedColumnsAggregation;
|
|
26
|
+
iterableComponent;
|
|
27
|
+
instanceValue;
|
|
28
|
+
constructor(modal) {
|
|
29
|
+
this.modal = modal;
|
|
30
|
+
}
|
|
31
|
+
updateArrays() {
|
|
32
|
+
this.fixedColumns = [];
|
|
33
|
+
this.visibleColumns = [];
|
|
34
|
+
this.groupedColumns = [];
|
|
35
|
+
this.otherColumns = [];
|
|
36
|
+
Object.keys(this.columnData).forEach((name) => {
|
|
37
|
+
const column = this.columnData[name];
|
|
38
|
+
if (this.instanceValue && this.instanceValue.ignoreColumns.indexOf(column.name) === -1) {
|
|
39
|
+
if (column.grouped) {
|
|
40
|
+
this.groupedColumns.push(column);
|
|
41
|
+
}
|
|
42
|
+
else if (column.fixed) {
|
|
43
|
+
this.fixedColumns.push(column);
|
|
44
|
+
}
|
|
45
|
+
else if (column.isVisible) {
|
|
46
|
+
this.visibleColumns.push(column);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.otherColumns.push(column);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
set instance(instance) {
|
|
55
|
+
this.instanceValue = instance;
|
|
56
|
+
this.iterableComponent = instance.iterableComponent;
|
|
57
|
+
this.showGroups = instance.iterableComponent instanceof TekGrid;
|
|
58
|
+
this.aggregationData = instance.getAggregationSelectData();
|
|
59
|
+
this.columnData = {};
|
|
60
|
+
this.iterableComponent.columns.forEach((column) => {
|
|
61
|
+
this.columnData[column.name] = {
|
|
62
|
+
name: column.name,
|
|
63
|
+
label: column.label,
|
|
64
|
+
fixed: column.fixed,
|
|
65
|
+
isVisible: column.isVisible,
|
|
66
|
+
align: column.align,
|
|
67
|
+
grouped: column.grouped || false,
|
|
68
|
+
groupOpened: column.groupOpened || false,
|
|
69
|
+
aggregation: column.aggregation,
|
|
70
|
+
aggregationText: this.getAggregationText(column.aggregation),
|
|
71
|
+
selected: false,
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
this.updateArrays();
|
|
75
|
+
this.selectedColumnNames = [];
|
|
76
|
+
}
|
|
77
|
+
getAggregationText(aggregation) {
|
|
78
|
+
let result = '';
|
|
79
|
+
if (aggregation) {
|
|
80
|
+
const idx = this.aggregationData.findIndex((item) => item.value === aggregation);
|
|
81
|
+
if (idx !== -1) {
|
|
82
|
+
result = ` (${this.aggregationData[idx].text})`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
columnInSearch(column) {
|
|
88
|
+
return !this.searchValue || Utils.normalize(column.label).indexOf(Utils.normalize(this.searchValue)) !== -1;
|
|
89
|
+
}
|
|
90
|
+
get fixedColumnData() {
|
|
91
|
+
return this.fixedColumns.filter(this.columnInSearch.bind(this));
|
|
92
|
+
}
|
|
93
|
+
set fixedColumnData(_data) {
|
|
94
|
+
// do nothing
|
|
95
|
+
}
|
|
96
|
+
get visibleColumnData() {
|
|
97
|
+
return this.visibleColumns.filter(this.columnInSearch.bind(this));
|
|
98
|
+
}
|
|
99
|
+
set visibleColumnData(_data) {
|
|
100
|
+
// do nothing
|
|
101
|
+
}
|
|
102
|
+
get groupedColumnData() {
|
|
103
|
+
return this.groupedColumns.filter(this.columnInSearch.bind(this));
|
|
104
|
+
}
|
|
105
|
+
set groupedColumnData(_data) {
|
|
106
|
+
// do nothing
|
|
107
|
+
}
|
|
108
|
+
get otherColumnData() {
|
|
109
|
+
return this.otherColumns.filter(this.columnInSearch.bind(this));
|
|
110
|
+
}
|
|
111
|
+
set otherColumnData(_data) {
|
|
112
|
+
// do nothing
|
|
113
|
+
}
|
|
114
|
+
get hasSelectedColumn() {
|
|
115
|
+
return this.selectedColumnNames.length > 0;
|
|
116
|
+
}
|
|
117
|
+
get hasNoSelectedColumn() {
|
|
118
|
+
return !this.hasSelectedColumn;
|
|
119
|
+
}
|
|
120
|
+
get detailColumnName() {
|
|
121
|
+
const columnNames = this.selectedColumnNames.length
|
|
122
|
+
? this.selectedColumnNames.join(', ')
|
|
123
|
+
: I18n.translate('TEKGRID_SELECT_COLUMN');
|
|
124
|
+
return `${I18n.translate('TEKGRID_DETAILS_FOR')} ${columnNames}`;
|
|
125
|
+
}
|
|
126
|
+
get hasNoFixedColumns() {
|
|
127
|
+
return this.fixedColumns.length === 0;
|
|
128
|
+
}
|
|
129
|
+
get hasNoVisibleColumns() {
|
|
130
|
+
return this.visibleColumns.length === 0;
|
|
131
|
+
}
|
|
132
|
+
get hasNoGroupedColumns() {
|
|
133
|
+
return this.groupedColumns.length === 0;
|
|
134
|
+
}
|
|
135
|
+
get hasNoOtherColumns() {
|
|
136
|
+
return this.otherColumns.length === 0;
|
|
137
|
+
}
|
|
138
|
+
get hasNoSingleSelection() {
|
|
139
|
+
return this.selectedColumnNames.length !== 1;
|
|
140
|
+
}
|
|
141
|
+
get selectedColumnLabel() {
|
|
142
|
+
return this.selectedColumnNames.length === 1 ? this.columnData[this.selectedColumnNames[0]].label : '';
|
|
143
|
+
}
|
|
144
|
+
set selectedColumnLabel(value) {
|
|
145
|
+
if (this.selectedColumnNames.length === 1) {
|
|
146
|
+
this.columnData[this.selectedColumnNames[0]].label = value;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
getSameValue(propName) {
|
|
150
|
+
const isEqual = this.selectedColumnNames.length > 0 &&
|
|
151
|
+
this.selectedColumnNames.every((name) => this.columnData[name][propName] === this.columnData[this.selectedColumnNames[0]][propName]);
|
|
152
|
+
return isEqual ? this.columnData[this.selectedColumnNames[0]][propName] : undefined;
|
|
153
|
+
}
|
|
154
|
+
setSameValue(propName, value) {
|
|
155
|
+
this.selectedColumnNames.forEach((name) => {
|
|
156
|
+
this.columnData[name][propName] = value;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
get groupInSelection() {
|
|
160
|
+
return this.hasNoSelectedColumn || this.selectedColumnNames.some((name) => this.columnData[name].grouped);
|
|
161
|
+
}
|
|
162
|
+
get notGroupInSelection() {
|
|
163
|
+
return this.hasNoSelectedColumn || this.selectedColumnNames.some((name) => !this.columnData[name].grouped);
|
|
164
|
+
}
|
|
165
|
+
get selectedColumnGroupOpened() {
|
|
166
|
+
return this.getSameValue('groupOpened');
|
|
167
|
+
}
|
|
168
|
+
set selectedColumnGroupOpened(value) {
|
|
169
|
+
this.setSameValue('groupOpened', value);
|
|
170
|
+
}
|
|
171
|
+
selectMounted({ component }) {
|
|
172
|
+
this.updatingSelect = true;
|
|
173
|
+
if (component.name === 'tekGridColumnsOptionsColumnAlignment') {
|
|
174
|
+
component.value = this.selectedColumnsAlignment;
|
|
175
|
+
}
|
|
176
|
+
else if (component.name === 'tekGridColumnsOptionsColumnAggregation') {
|
|
177
|
+
component.value = this.selectedColumnsAggregation;
|
|
178
|
+
}
|
|
179
|
+
// prevent changing column value from here
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
this.updatingSelect = false;
|
|
182
|
+
}, 0);
|
|
183
|
+
}
|
|
184
|
+
updatingSelect = false;
|
|
185
|
+
selectChange({ component }) {
|
|
186
|
+
if (this.updatingSelect)
|
|
187
|
+
return;
|
|
188
|
+
if (component.name === 'tekGridColumnsOptionsColumnAlignment') {
|
|
189
|
+
this.setSameValue('align', component.value);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.setSameValue('aggregation', component.value);
|
|
193
|
+
this.setSameValue('aggregationText', this.getAggregationText(component.value));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
updateSelects() {
|
|
197
|
+
this.selectedColumnsAlignment = this.updateSelect('align');
|
|
198
|
+
this.selectedColumnsAggregation = this.updateSelect('aggregation');
|
|
199
|
+
}
|
|
200
|
+
updateSelect(propName) {
|
|
201
|
+
this.updatingSelect = true;
|
|
202
|
+
const propValue = this.getSameValue(propName);
|
|
203
|
+
const selectNames = {
|
|
204
|
+
align: 'tekGridColumnsOptionsColumnAlignment',
|
|
205
|
+
aggregation: 'tekGridColumnsOptionsColumnAggregation',
|
|
206
|
+
};
|
|
207
|
+
const instances = Metadata.getInstances(selectNames[propName]);
|
|
208
|
+
if (instances[0]) {
|
|
209
|
+
instances[0].value = propValue;
|
|
210
|
+
}
|
|
211
|
+
// prevent changing column value from here
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
this.updatingSelect = false;
|
|
214
|
+
}, 0);
|
|
215
|
+
return propValue;
|
|
216
|
+
}
|
|
217
|
+
columnRemoveClick(column) {
|
|
218
|
+
column.isVisible = false;
|
|
219
|
+
this.selectedColumnNames.splice(this.selectedColumnNames.indexOf(column.name), 1);
|
|
220
|
+
this.otherColumns.push(column);
|
|
221
|
+
}
|
|
222
|
+
columnFixedRemoveClick({ element }) {
|
|
223
|
+
const columnName = element?.getAttribute('columnname');
|
|
224
|
+
if (columnName) {
|
|
225
|
+
const column = this.columnData[columnName];
|
|
226
|
+
this.columnRemoveClick(column);
|
|
227
|
+
this.fixedColumns.splice(this.fixedColumns.indexOf(column), 1);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
columnVisibleRemoveClick({ element }) {
|
|
231
|
+
const columnName = element?.getAttribute('columnname');
|
|
232
|
+
if (columnName) {
|
|
233
|
+
const column = this.columnData[columnName];
|
|
234
|
+
this.columnRemoveClick(column);
|
|
235
|
+
this.visibleColumns.splice(this.visibleColumns.indexOf(column), 1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
columnGroupedRemoveClick({ element }) {
|
|
239
|
+
const columnName = element?.getAttribute('columnname');
|
|
240
|
+
if (columnName) {
|
|
241
|
+
const column = this.columnData[columnName];
|
|
242
|
+
this.columnRemoveClick(column);
|
|
243
|
+
this.groupedColumns.splice(this.groupedColumns.indexOf(column), 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
isMacPlatform() {
|
|
247
|
+
return /Mac/.test(navigator.platform);
|
|
248
|
+
}
|
|
249
|
+
isMobilePlatform() {
|
|
250
|
+
return /iPhone|iPad|Android/.test(navigator.platform);
|
|
251
|
+
}
|
|
252
|
+
columnClick({ element, event }) {
|
|
253
|
+
const columnName = element.getAttribute('columnname');
|
|
254
|
+
if (columnName) {
|
|
255
|
+
const mouseEvent = event;
|
|
256
|
+
const multiple = (this.isMacPlatform() && mouseEvent.metaKey) || mouseEvent.ctrlKey || this.isMobilePlatform();
|
|
257
|
+
if (!multiple) {
|
|
258
|
+
Object.keys(this.columnData).forEach((name) => {
|
|
259
|
+
const column = this.columnData[name];
|
|
260
|
+
column.selected = column.name === columnName;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this.columnData[columnName].selected = !this.columnData[columnName].selected;
|
|
265
|
+
}
|
|
266
|
+
const orderedColumns = this.fixedColumns
|
|
267
|
+
.concat(this.visibleColumns)
|
|
268
|
+
.concat(this.groupedColumns)
|
|
269
|
+
.concat(this.otherColumns);
|
|
270
|
+
this.selectedColumnNames = orderedColumns.filter((column) => column.selected).map((column) => column.name);
|
|
271
|
+
this.updateSelects();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
removeFromSourceList(columnName) {
|
|
275
|
+
const column = this.columnData[columnName];
|
|
276
|
+
const fixedIdx = this.fixedColumns.indexOf(column);
|
|
277
|
+
if (fixedIdx !== -1) {
|
|
278
|
+
this.fixedColumns.splice(fixedIdx, 1);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
const visibleIdx = this.visibleColumns.indexOf(column);
|
|
282
|
+
if (visibleIdx !== -1) {
|
|
283
|
+
this.visibleColumns.splice(visibleIdx, 1);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
const groupedIdx = this.groupedColumns.indexOf(column);
|
|
287
|
+
if (groupedIdx !== -1) {
|
|
288
|
+
this.groupedColumns.splice(groupedIdx, 1);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
const otherIdx = this.otherColumns.indexOf(column);
|
|
292
|
+
if (otherIdx !== -1) {
|
|
293
|
+
this.otherColumns.splice(otherIdx, 1);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
onDragEnd(event) {
|
|
300
|
+
const columnName = event.item.getAttribute('columnname');
|
|
301
|
+
if (this.selectedColumnNames.indexOf(columnName) === -1) {
|
|
302
|
+
this.selectedColumnNames = [columnName];
|
|
303
|
+
this.updateSelects();
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
Object.keys(this.columnData).forEach((name) => {
|
|
306
|
+
const column = this.columnData[name];
|
|
307
|
+
column.selected = column.name === columnName;
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
this.selectedColumnNames.forEach((name, index) => {
|
|
312
|
+
const newIndex = event.newIndex + index;
|
|
313
|
+
if (name) {
|
|
314
|
+
this.removeFromSourceList(name);
|
|
315
|
+
const column = this.columnData[name];
|
|
316
|
+
if (event.to.id === 'tekGridColumnsOptionsFixedColumns') {
|
|
317
|
+
column.fixed = true;
|
|
318
|
+
column.isVisible = true;
|
|
319
|
+
column.grouped = false;
|
|
320
|
+
column.groupOpened = false;
|
|
321
|
+
this.fixedColumns.splice(newIndex, 0, column);
|
|
322
|
+
}
|
|
323
|
+
else if (event.to.id === 'tekGridColumnsOptionsVisibleColumns') {
|
|
324
|
+
column.fixed = false;
|
|
325
|
+
column.isVisible = true;
|
|
326
|
+
column.grouped = false;
|
|
327
|
+
column.groupOpened = false;
|
|
328
|
+
this.visibleColumns.splice(newIndex, 0, column);
|
|
329
|
+
}
|
|
330
|
+
else if (event.to.id === 'tekGridColumnsOptionsOtherColumns') {
|
|
331
|
+
column.fixed = false;
|
|
332
|
+
column.isVisible = false;
|
|
333
|
+
column.grouped = false;
|
|
334
|
+
column.groupOpened = false;
|
|
335
|
+
this.otherColumns.splice(newIndex, 0, column);
|
|
336
|
+
}
|
|
337
|
+
else if (event.to.id === 'tekGridColumnsOptionsGroupedColumns') {
|
|
338
|
+
column.fixed = false;
|
|
339
|
+
column.isVisible = true;
|
|
340
|
+
column.grouped = true;
|
|
341
|
+
column.aggregation = undefined;
|
|
342
|
+
column.aggregationText = '';
|
|
343
|
+
this.groupedColumns.splice(newIndex, 0, column);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
columnContainerMounted({ element }) {
|
|
349
|
+
if (element) {
|
|
350
|
+
Sortable.create(element, {
|
|
351
|
+
handle: '.tek-grid-column-option-box',
|
|
352
|
+
group: 'column-container',
|
|
353
|
+
filter: '.no-data, .tek-grid-column-option-grouped-true',
|
|
354
|
+
onEnd: this.onDragEnd.bind(this),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
selectAll({ component }) {
|
|
359
|
+
let list;
|
|
360
|
+
if (component.name === 'tekGridColumnsOptionsFixedSelectAll') {
|
|
361
|
+
list = this.fixedColumns;
|
|
362
|
+
}
|
|
363
|
+
else if (component.name === 'tekGridColumnsOptionsVisibleSelectAll') {
|
|
364
|
+
list = this.visibleColumns;
|
|
365
|
+
}
|
|
366
|
+
else if (component.name === 'tekGridColumnsOptionsOtherSelectAll') {
|
|
367
|
+
list = this.otherColumns;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
list = this.groupedColumns;
|
|
371
|
+
}
|
|
372
|
+
this.selectedColumnNames = list.map((column) => column.name);
|
|
373
|
+
Object.keys(this.columnData).forEach((columnName) => {
|
|
374
|
+
const column = this.columnData[columnName];
|
|
375
|
+
column.selected = this.selectedColumnNames.indexOf(column.name) !== -1;
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
cancelChanges() {
|
|
379
|
+
this.modal.hide();
|
|
380
|
+
}
|
|
381
|
+
applyChanges({ event, element }) {
|
|
382
|
+
const ignoredColumns = this.iterableComponent.columns.filter((column) => this.instanceValue && this.instanceValue.ignoreColumns.indexOf(column.name) !== -1);
|
|
383
|
+
const orderedColumns = this.groupedColumns
|
|
384
|
+
.concat(this.fixedColumns)
|
|
385
|
+
.concat(this.visibleColumns)
|
|
386
|
+
.concat(this.otherColumns)
|
|
387
|
+
.concat(ignoredColumns);
|
|
388
|
+
if (this.iterableComponent) {
|
|
389
|
+
this.iterableComponent.columns = orderedColumns.map((orderColumn) => {
|
|
390
|
+
const columnIdx = this.iterableComponent.columns.findIndex((column) => column.name === orderColumn.name);
|
|
391
|
+
const iterableColumn = this.iterableComponent.columns[columnIdx];
|
|
392
|
+
iterableColumn.fixed = orderColumn.fixed;
|
|
393
|
+
iterableColumn.isVisible = orderColumn.isVisible;
|
|
394
|
+
iterableColumn.grouped = orderColumn.grouped;
|
|
395
|
+
iterableColumn.groupOpened = orderColumn.groupOpened;
|
|
396
|
+
iterableColumn.label = orderColumn.label;
|
|
397
|
+
iterableColumn.align = orderColumn.align;
|
|
398
|
+
iterableColumn.aggregation = orderColumn.aggregation;
|
|
399
|
+
return iterableColumn;
|
|
400
|
+
});
|
|
401
|
+
const { datasource } = this.iterableComponent;
|
|
402
|
+
const order = datasource.order.filter((item) => {
|
|
403
|
+
const columnName = item.split('.')[0];
|
|
404
|
+
return this.groupedColumns.findIndex((column) => column.name === columnName) === -1;
|
|
405
|
+
});
|
|
406
|
+
datasource.order = this.groupedColumns.map((column) => `${column.name}.asc`).concat(order);
|
|
407
|
+
this.iterableComponent.changeLayout(event, element);
|
|
408
|
+
}
|
|
409
|
+
this.modal.hide();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
TekGridColumnsOptionsController = __decorate([
|
|
413
|
+
Singleton,
|
|
414
|
+
__metadata("design:paramtypes", [Modal])
|
|
415
|
+
], TekGridColumnsOptionsController);
|
|
416
|
+
export default TekGridColumnsOptionsController;
|