@opentinyvue/vue-grid-toolbar 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/index.d.ts +13 -0
- package/lib/index.js +4037 -0
- package/package.json +47 -0
- package/src/custom-saas.vue.d.ts +2 -0
- package/src/custom-select.vue.d.ts +11 -0
- package/src/custom-switch.vue.d.ts +2 -0
- package/src/custom.vue.d.ts +2 -0
- package/src/index.d.ts +2 -0
- package/src/multiple-history.d.ts +15 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,4037 @@
|
|
|
1
|
+
import { isNumber } from '@opentinyvue/vue-renderless/common/type';
|
|
2
|
+
import { IconSave, IconEdit, IconDel, IconEyeopen, IconEyeclose, IconUnlock, IconLeftFrozen, IconRightFrozen, IconLock, IconMinus, IconDescending, IconAscending, IconClose, IconChevronRight, iconFullscreen, iconMinscreen } from '@opentinyvue/vue-icon';
|
|
3
|
+
import { defineComponent, $props, appProperties, directive, useDefer, isVue2, $prefix, hooks, h } from '@opentinyvue/vue-common';
|
|
4
|
+
import { find as find$1, toStringJSON, toJSONString, isPlainObject, isEmpty } from '@opentinyvue/vue-renderless/grid/static/';
|
|
5
|
+
import { GlobalEvent, getListeners, getEventTargetNode, emitEvent, getFuncText } from '@opentinyvue/vue-renderless/grid/utils';
|
|
6
|
+
import Button from '@opentinyvue/vue-button';
|
|
7
|
+
import Modal from '@opentinyvue/vue-modal';
|
|
8
|
+
import { t } from '@opentinyvue/vue-locale';
|
|
9
|
+
import Grid, { GridTools, GridRadio, GridColumn, GridConfig, GridAdapter } from '@opentinyvue/vue-grid';
|
|
10
|
+
import { find, isNull, arrayEach, mapTree, isArray } from '@opentinyvue/vue-renderless/grid/static';
|
|
11
|
+
import Select from '@opentinyvue/vue-select';
|
|
12
|
+
import Alert from '@opentinyvue/vue-alert';
|
|
13
|
+
import Tabs from '@opentinyvue/vue-tabs';
|
|
14
|
+
import TabItem from '@opentinyvue/vue-tab-item';
|
|
15
|
+
import Option from '@opentinyvue/vue-option';
|
|
16
|
+
import Input from '@opentinyvue/vue-input';
|
|
17
|
+
import Layout from '@opentinyvue/vue-layout';
|
|
18
|
+
import Row from '@opentinyvue/vue-row';
|
|
19
|
+
import Col from '@opentinyvue/vue-col';
|
|
20
|
+
import DialogBox from '@opentinyvue/vue-dialog-box';
|
|
21
|
+
import Popover from '@opentinyvue/vue-popover';
|
|
22
|
+
import Radio from '@opentinyvue/vue-radio';
|
|
23
|
+
import { format } from '@opentinyvue/vue-renderless/common/date';
|
|
24
|
+
import { extend } from '@opentinyvue/vue-renderless/common/object';
|
|
25
|
+
import Tree from '@opentinyvue/vue-tree';
|
|
26
|
+
import Split from '@opentinyvue/vue-split';
|
|
27
|
+
import Checkbox from '@opentinyvue/vue-checkbox';
|
|
28
|
+
import CheckboxGroup from '@opentinyvue/vue-checkbox-group';
|
|
29
|
+
import RadioGroup from '@opentinyvue/vue-radio-group';
|
|
30
|
+
import Search from '@opentinyvue/vue-search';
|
|
31
|
+
import Dropdown from '@opentinyvue/vue-dropdown';
|
|
32
|
+
import DropdownMenu from '@opentinyvue/vue-dropdown-menu';
|
|
33
|
+
import DropdownItem from '@opentinyvue/vue-dropdown-item';
|
|
34
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
35
|
+
import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
|
|
36
|
+
import '@opentinyvue/vue-theme/grid-toolbar/index.css';
|
|
37
|
+
|
|
38
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
39
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
40
|
+
if (render) {
|
|
41
|
+
options.render = render;
|
|
42
|
+
options.staticRenderFns = staticRenderFns;
|
|
43
|
+
options._compiled = true;
|
|
44
|
+
}
|
|
45
|
+
var hook;
|
|
46
|
+
if (injectStyles) {
|
|
47
|
+
hook = injectStyles;
|
|
48
|
+
}
|
|
49
|
+
if (hook) {
|
|
50
|
+
if (options.functional) {
|
|
51
|
+
options._injectStyles = hook;
|
|
52
|
+
var originalRender = options.render;
|
|
53
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
54
|
+
hook.call(context);
|
|
55
|
+
return originalRender(h, context);
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
var existing = options.beforeCreate;
|
|
59
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
exports: scriptExports,
|
|
64
|
+
options
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var _excluded2 = ["property"], _excluded3 = ["property"];
|
|
69
|
+
function _objectWithoutPropertiesLoose2(r, e) {
|
|
70
|
+
if (null == r) return {};
|
|
71
|
+
var t2 = {};
|
|
72
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
73
|
+
if (e.includes(n)) continue;
|
|
74
|
+
t2[n] = r[n];
|
|
75
|
+
}
|
|
76
|
+
return t2;
|
|
77
|
+
}
|
|
78
|
+
function _extends() {
|
|
79
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
80
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
81
|
+
var t2 = arguments[e];
|
|
82
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}, _extends.apply(null, arguments);
|
|
86
|
+
}
|
|
87
|
+
function getStorage(storageKey, storageType, remoteMethod) {
|
|
88
|
+
return new Promise(function(resolve, reject) {
|
|
89
|
+
if (storageType === "local") {
|
|
90
|
+
var valueString = localStorage.getItem(storageKey);
|
|
91
|
+
var valueObj = toStringJSON(valueString);
|
|
92
|
+
resolve(valueObj);
|
|
93
|
+
} else if (storageType === "remote") {
|
|
94
|
+
remoteMethod().then(function(remoteString) {
|
|
95
|
+
var remoteObj = toStringJSON(remoteString);
|
|
96
|
+
remoteObj = remoteObj && remoteObj[storageKey] || null;
|
|
97
|
+
resolve(remoteObj);
|
|
98
|
+
}).catch(reject);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function setStorage(storageKey, valueObj, storageType, vm, eventName) {
|
|
103
|
+
if (storageType === "local") {
|
|
104
|
+
var valueString = toJSONString(valueObj);
|
|
105
|
+
localStorage.setItem(storageKey, valueString);
|
|
106
|
+
} else if (storageType === "remote") {
|
|
107
|
+
var _toJSONString;
|
|
108
|
+
var remoteString = toJSONString((_toJSONString = {}, _toJSONString[storageKey] = valueObj, _toJSONString));
|
|
109
|
+
vm.$emit(eventName, remoteString);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function generateId() {
|
|
113
|
+
var now = /* @__PURE__ */ new Date();
|
|
114
|
+
var suf = /GMT[-+]\d+/.exec(now.toString())[0].replace(/\+/, "E").replace(/-/, "W").replace(/0/g, "");
|
|
115
|
+
var name = format(now, "yyyy-MM-dd hh:mm:ss.SSS");
|
|
116
|
+
return {
|
|
117
|
+
id: now.getTime() + suf,
|
|
118
|
+
name
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function createCustom(setting, userKey) {
|
|
122
|
+
var _generateId = generateId(), id = _generateId.id, name = _generateId.name;
|
|
123
|
+
return {
|
|
124
|
+
id,
|
|
125
|
+
name,
|
|
126
|
+
userKey,
|
|
127
|
+
setting: {
|
|
128
|
+
custom: setting
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function mergeArray(toArr, fromArr) {
|
|
133
|
+
var result = [];
|
|
134
|
+
for (var i = 0; i < fromArr.length; i++) {
|
|
135
|
+
var fromItem = _extends({
|
|
136
|
+
order: null,
|
|
137
|
+
fixed: null,
|
|
138
|
+
visible: true,
|
|
139
|
+
sortable: false
|
|
140
|
+
}, fromArr[i]);
|
|
141
|
+
var toItem = void 0;
|
|
142
|
+
for (var j = 0; j < toArr.length; j++) {
|
|
143
|
+
if (fromItem.property === toArr[j].property) {
|
|
144
|
+
toItem = _extends({}, toArr[j]);
|
|
145
|
+
if (fromArr[i].children && toArr[j].children) {
|
|
146
|
+
fromItem.children = mergeArray(toArr[j].children, fromArr[i].children);
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
result.push(extend(true, {}, toItem || {}, fromItem));
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
var __vue2_script$3 = defineComponent({
|
|
156
|
+
name: "TinyGridCustomSwitch",
|
|
157
|
+
components: {
|
|
158
|
+
TinyButton: Button,
|
|
159
|
+
TinySelect: Select,
|
|
160
|
+
TinyInput: Input,
|
|
161
|
+
TinyLayout: Layout,
|
|
162
|
+
TinyRow: Row,
|
|
163
|
+
TinyCol: Col,
|
|
164
|
+
TinyAlert: Alert,
|
|
165
|
+
TinyRadio: Radio,
|
|
166
|
+
TinyPopover: Popover,
|
|
167
|
+
TinyDialogBox: DialogBox
|
|
168
|
+
},
|
|
169
|
+
inject: {
|
|
170
|
+
$grid: {
|
|
171
|
+
default: null
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
emits: ["init-storage"],
|
|
175
|
+
props: _extends({}, $props, {
|
|
176
|
+
customMode: String,
|
|
177
|
+
selectedTemplateVal: {
|
|
178
|
+
type: Object,
|
|
179
|
+
default: function _default() {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
historyConfig: {
|
|
184
|
+
type: Object,
|
|
185
|
+
default: function _default2() {
|
|
186
|
+
return {};
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
remote: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: false
|
|
192
|
+
}
|
|
193
|
+
}),
|
|
194
|
+
data: function data() {
|
|
195
|
+
return {
|
|
196
|
+
IconSave: IconSave(),
|
|
197
|
+
IconEdit: IconEdit(),
|
|
198
|
+
IconDel: IconDel(),
|
|
199
|
+
saveDisabled: true,
|
|
200
|
+
selectDisabled: true,
|
|
201
|
+
applyDisabled: true,
|
|
202
|
+
editDisabled: true,
|
|
203
|
+
delDisabled: true,
|
|
204
|
+
options: [],
|
|
205
|
+
option: null,
|
|
206
|
+
selected: null,
|
|
207
|
+
selectedName: null,
|
|
208
|
+
visible: false,
|
|
209
|
+
userKey: null,
|
|
210
|
+
status: null,
|
|
211
|
+
editName: null,
|
|
212
|
+
selectedTemplateName: "",
|
|
213
|
+
savedTemplateName: "",
|
|
214
|
+
templateVisible: false,
|
|
215
|
+
saveMethod: "save"
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
computed: {
|
|
219
|
+
dialogTitle: function dialogTitle() {
|
|
220
|
+
return this.status === "apply" ? this.t("ui.grid.individuation.switchapply") : this.status === "edit" ? this.t("ui.grid.individuation.switchedit") : this.status === "del" ? this.t("ui.grid.individuation.switchdel") : this.t("ui.grid.individuation.switchconfirm");
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
watch: {
|
|
224
|
+
templateVisible: function templateVisible(val) {
|
|
225
|
+
val && (this.savedTemplateName = "");
|
|
226
|
+
},
|
|
227
|
+
selectedTemplateVal: {
|
|
228
|
+
handler: function handler() {
|
|
229
|
+
this.selectedTemplateName = this.selectedTemplateVal.name || "";
|
|
230
|
+
this.saveMethod = this.selectedTemplateVal.id && !this.historyConfig.hideOverwrite ? "overwrite" : "save";
|
|
231
|
+
},
|
|
232
|
+
deep: true,
|
|
233
|
+
immediate: true
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
created: function created() {
|
|
237
|
+
this.setUserKey();
|
|
238
|
+
this.initStorage(true);
|
|
239
|
+
},
|
|
240
|
+
methods: {
|
|
241
|
+
t,
|
|
242
|
+
handleSave: function handleSave() {
|
|
243
|
+
this.status = "save";
|
|
244
|
+
this.visible = true;
|
|
245
|
+
},
|
|
246
|
+
initStorage: function initStorage(isInit) {
|
|
247
|
+
var _this = this;
|
|
248
|
+
var _this$$grid$getVm = this.$grid.getVm("toolbar"), _this$$grid$getVm$set = _this$$grid$getVm.settingOpts, storageType = _this$$grid$getVm$set.storage, storageKey = _this$$grid$getVm$set.storageKey, toolbarId = _this$$grid$getVm.id;
|
|
249
|
+
if (!this.doCheck({
|
|
250
|
+
storageType
|
|
251
|
+
})) return;
|
|
252
|
+
getStorage(this.historyConfig.storageKey, storageType, this.historyConfig.remoteMethod).then(function(storeObj) {
|
|
253
|
+
var optionArr = (storeObj || {})[toolbarId] || [];
|
|
254
|
+
_this.options = optionArr.filter(function(opt) {
|
|
255
|
+
return _this.userKey ? opt.userKey === _this.userKey : true;
|
|
256
|
+
});
|
|
257
|
+
_this.$emit("init-storage", _this.options);
|
|
258
|
+
if (isInit) {
|
|
259
|
+
getStorage(storageKey, storageType, _this.historyConfig.remoteSelectedMethod).then(function(storeObj2) {
|
|
260
|
+
_this.option = (storeObj2 || {})[toolbarId] || {};
|
|
261
|
+
_this.enableAll();
|
|
262
|
+
_this.setSelected();
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
handleSaveConfirm: function handleSaveConfirm(flag, hideTip) {
|
|
268
|
+
var _this2 = this;
|
|
269
|
+
if (flag === "overwrite") {
|
|
270
|
+
if (this.customMode === "saas" && !this.selectedTemplateVal.id || this.customMode !== "saas" && !this.selected) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
var toolbarVm = this.$grid.getVm("toolbar");
|
|
275
|
+
var customVm = toolbarVm.$refs.custom;
|
|
276
|
+
customVm.updatedSorting = true;
|
|
277
|
+
var item = createCustom(customVm.buildSettings(), this.userKey);
|
|
278
|
+
item = JSON.parse(JSON.stringify(item));
|
|
279
|
+
var toolbarId = toolbarVm.id;
|
|
280
|
+
var business = function business2(storeObj) {
|
|
281
|
+
storeObj = storeObj || {};
|
|
282
|
+
var optionArr = storeObj[toolbarId] || [];
|
|
283
|
+
if (flag === "save" || flag === "save-apply") {
|
|
284
|
+
if (flag === "save" && _this2.savedTemplateName) {
|
|
285
|
+
item.name = _this2.savedTemplateName;
|
|
286
|
+
}
|
|
287
|
+
_this2.options.push(item);
|
|
288
|
+
!_this2.remote && _this2.$emit("init-storage", _this2.options);
|
|
289
|
+
optionArr.unshift(item);
|
|
290
|
+
} else if (flag === "overwrite") {
|
|
291
|
+
var index, customId, customName;
|
|
292
|
+
var selectedId = _this2.customMode === "saas" ? _this2.selectedTemplateVal.id : _this2.selected;
|
|
293
|
+
var selectedName = _this2.customMode === "saas" ? _this2.selectedTemplateVal.name : _this2.selectedName;
|
|
294
|
+
for (var i = 0; i < optionArr.length; i++) {
|
|
295
|
+
if (optionArr[i].id === selectedId) {
|
|
296
|
+
index = i;
|
|
297
|
+
customId = selectedId;
|
|
298
|
+
customName = selectedName;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
item.id = customId;
|
|
303
|
+
item.name = _this2.selectedTemplateName || customName;
|
|
304
|
+
optionArr.splice(index, 1, item);
|
|
305
|
+
if (_this2.selectedTemplateName && !_this2.remote) {
|
|
306
|
+
_this2.$emit("init-storage", optionArr);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
storeObj[toolbarId] = optionArr;
|
|
310
|
+
return storeObj;
|
|
311
|
+
};
|
|
312
|
+
var postOperate = function postOperate2() {
|
|
313
|
+
if (flag === "save-apply" || flag === "overwrite") {
|
|
314
|
+
customVm.multipleHistoryId = item.id;
|
|
315
|
+
_this2.customMode !== "saas" && customVm.saveSettings(false);
|
|
316
|
+
}
|
|
317
|
+
_this2.visible = false;
|
|
318
|
+
_this2.status = "";
|
|
319
|
+
};
|
|
320
|
+
this.templateVisible = false;
|
|
321
|
+
this.doStorage(business, postOperate);
|
|
322
|
+
if (!this.historyConfig.hideSuccessTip && !hideTip) {
|
|
323
|
+
Modal.message({
|
|
324
|
+
message: t("ui.grid.saveSuccess"),
|
|
325
|
+
status: "success"
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
handleApply: function handleApply() {
|
|
330
|
+
if (this.historyConfig.applyDisabled || this.applyDisabled || !this.selected || this.option.id === this.selected) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
this.status = "apply";
|
|
334
|
+
this.visible = true;
|
|
335
|
+
},
|
|
336
|
+
handleApplyConfirm: function handleApplyConfirm(flag) {
|
|
337
|
+
var _this3 = this;
|
|
338
|
+
if (flag === "yes") {
|
|
339
|
+
var toolbarVm = this.$grid.getVm("toolbar");
|
|
340
|
+
var toolbarId = toolbarVm.id;
|
|
341
|
+
var customVm = toolbarVm.$refs.custom;
|
|
342
|
+
var customId;
|
|
343
|
+
var noStore = true;
|
|
344
|
+
var business = function business2(storeObj) {
|
|
345
|
+
storeObj = storeObj || {};
|
|
346
|
+
var optionArr = storeObj[toolbarId] || [];
|
|
347
|
+
var selected = optionArr.find(function(opt) {
|
|
348
|
+
return opt.id === _this3.selected;
|
|
349
|
+
});
|
|
350
|
+
if (selected) {
|
|
351
|
+
delete selected.setting.custom.id;
|
|
352
|
+
customVm.columns = mergeArray(customVm.columns, selected.setting.custom.columns);
|
|
353
|
+
customVm.settings.pageSize = selected.setting.custom.pageSize;
|
|
354
|
+
customVm.settings.sortType = selected.setting.custom.sortType;
|
|
355
|
+
customId = selected.id;
|
|
356
|
+
}
|
|
357
|
+
storeObj[toolbarId] = optionArr;
|
|
358
|
+
return storeObj;
|
|
359
|
+
};
|
|
360
|
+
var postOperate = function postOperate2() {
|
|
361
|
+
customVm.multipleHistoryId = customId;
|
|
362
|
+
customVm.saveSettings();
|
|
363
|
+
_this3.visible = false;
|
|
364
|
+
_this3.status = "";
|
|
365
|
+
};
|
|
366
|
+
this.doStorage(business, postOperate, noStore);
|
|
367
|
+
}
|
|
368
|
+
this.visible = false;
|
|
369
|
+
this.status = "";
|
|
370
|
+
},
|
|
371
|
+
handleEdit: function handleEdit() {
|
|
372
|
+
if (this.historyConfig.editDisabled || this.editDisabled || !this.selected) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.editName = this.selectedName;
|
|
376
|
+
this.status = "edit";
|
|
377
|
+
this.visible = true;
|
|
378
|
+
},
|
|
379
|
+
handleEditConfirm: function handleEditConfirm(flag) {
|
|
380
|
+
var _this4 = this;
|
|
381
|
+
if (flag === "yes") {
|
|
382
|
+
if (!this.editName) return;
|
|
383
|
+
var _this$$grid$getVm2 = this.$grid.getVm("toolbar"), toolbarId = _this$$grid$getVm2.id;
|
|
384
|
+
var business = function business2(storeObj) {
|
|
385
|
+
storeObj = storeObj || {};
|
|
386
|
+
var optionArr = storeObj[toolbarId] || [];
|
|
387
|
+
var selected = optionArr.find(function(opt) {
|
|
388
|
+
return opt.id === _this4.selected;
|
|
389
|
+
});
|
|
390
|
+
selected && (selected.name = _this4.editName);
|
|
391
|
+
storeObj[toolbarId] = optionArr;
|
|
392
|
+
return storeObj;
|
|
393
|
+
};
|
|
394
|
+
var postOperate = function postOperate2() {
|
|
395
|
+
_this4.setSelected();
|
|
396
|
+
_this4.visible = false;
|
|
397
|
+
_this4.status = "";
|
|
398
|
+
_this4.editName = null;
|
|
399
|
+
};
|
|
400
|
+
this.doStorage(business, postOperate);
|
|
401
|
+
}
|
|
402
|
+
if (flag === "no") {
|
|
403
|
+
this.visible = false;
|
|
404
|
+
this.status = "";
|
|
405
|
+
this.editName = null;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
handleDel: function handleDel() {
|
|
409
|
+
if (this.historyConfig.delDisabled || this.delDisabled || !this.selected) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
this.status = "del";
|
|
413
|
+
this.visible = true;
|
|
414
|
+
},
|
|
415
|
+
handleDelConfirm: function handleDelConfirm(flag, selected) {
|
|
416
|
+
var _this5 = this;
|
|
417
|
+
if (flag === "yes") {
|
|
418
|
+
var _this$$grid$getVm3 = this.$grid.getVm("toolbar"), toolbarId = _this$$grid$getVm3.id;
|
|
419
|
+
var business = function business2(storeObj) {
|
|
420
|
+
storeObj = storeObj || {};
|
|
421
|
+
var optionArr = storeObj[toolbarId] || [];
|
|
422
|
+
var selectedId = selected ? selected.id : _this5.selected;
|
|
423
|
+
optionArr = optionArr.filter(function(opt) {
|
|
424
|
+
return opt.id !== selectedId;
|
|
425
|
+
});
|
|
426
|
+
storeObj[toolbarId] = optionArr;
|
|
427
|
+
return storeObj;
|
|
428
|
+
};
|
|
429
|
+
var postOperate = function postOperate2() {
|
|
430
|
+
_this5.setSelected();
|
|
431
|
+
_this5.visible = false;
|
|
432
|
+
_this5.status = "";
|
|
433
|
+
if (!_this5.remote) {
|
|
434
|
+
_this5.$emit("init-storage", _this5.options);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
this.doStorage(business, postOperate);
|
|
438
|
+
}
|
|
439
|
+
if (flag === "no") {
|
|
440
|
+
this.visible = false;
|
|
441
|
+
this.status = "";
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
doStorage: function doStorage(business, postOperate, noStore) {
|
|
445
|
+
var _this6 = this;
|
|
446
|
+
if (noStore === void 0) {
|
|
447
|
+
noStore = false;
|
|
448
|
+
}
|
|
449
|
+
var toolbarVm = this.$grid.getVm("toolbar");
|
|
450
|
+
var storageType = toolbarVm.settingOpts.storage, toolbarId = toolbarVm.id;
|
|
451
|
+
getStorage(this.historyConfig.storageKey, storageType, this.historyConfig.remoteMethod).then(function(storeObj) {
|
|
452
|
+
storeObj = business(storeObj);
|
|
453
|
+
if (!noStore) {
|
|
454
|
+
setStorage(_this6.historyConfig.storageKey, storeObj, storageType, toolbarVm, "multiple-history");
|
|
455
|
+
_this6.options = storeObj[toolbarId].filter(function(opt) {
|
|
456
|
+
return _this6.userKey ? opt.userKey === _this6.userKey : true;
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
setTimeout(postOperate);
|
|
460
|
+
});
|
|
461
|
+
},
|
|
462
|
+
handleSelectChange: function handleSelectChange() {
|
|
463
|
+
var _this7 = this;
|
|
464
|
+
if (this.selected) {
|
|
465
|
+
var item = find(this.options, function(item2) {
|
|
466
|
+
return item2.id === _this7.selected;
|
|
467
|
+
});
|
|
468
|
+
this.selectedName = item ? item.name : null;
|
|
469
|
+
} else {
|
|
470
|
+
this.selectedName = null;
|
|
471
|
+
}
|
|
472
|
+
this.fixStatus();
|
|
473
|
+
},
|
|
474
|
+
doCheck: function doCheck(_ref3) {
|
|
475
|
+
var storageType = _ref3.storageType;
|
|
476
|
+
if (storageType === "remote") {
|
|
477
|
+
if (!this.historyConfig.remoteMethod || typeof this.historyConfig.remoteMethod !== "function") {
|
|
478
|
+
GridTools.error("ui.grid.error.remoteMethod");
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
if (!this.historyConfig.remoteSelectedMethod || typeof this.historyConfig.remoteSelectedMethod !== "function") {
|
|
482
|
+
GridTools.error("ui.grid.error.remoteSelectedMethod");
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return true;
|
|
487
|
+
},
|
|
488
|
+
setUserKey: function setUserKey() {
|
|
489
|
+
this.userKey = ~["userId", "userAccount"].indexOf(this.historyConfig.userKey) ? this.$grid.$service ? this.$grid.$service.base.getEnvInfoSync().user[this.historyConfig.userKey] : null : null;
|
|
490
|
+
},
|
|
491
|
+
setSelected: function setSelected() {
|
|
492
|
+
var _this8 = this;
|
|
493
|
+
this.selected = this.option ? this.option.id : "";
|
|
494
|
+
if (this.selected) {
|
|
495
|
+
var item = find(this.options, function(item2) {
|
|
496
|
+
return item2.id === _this8.selected;
|
|
497
|
+
});
|
|
498
|
+
this.selected = item ? this.selected : null;
|
|
499
|
+
this.selectedName = item ? item.name : null;
|
|
500
|
+
this.$emit("set-selected", this.selected);
|
|
501
|
+
}
|
|
502
|
+
this.fixStatus();
|
|
503
|
+
},
|
|
504
|
+
fixStatus: function fixStatus() {
|
|
505
|
+
this.applyDisabled = false;
|
|
506
|
+
this.editDisabled = false;
|
|
507
|
+
this.delDisabled = false;
|
|
508
|
+
if (!this.selectedName) {
|
|
509
|
+
this.editDisabled = true;
|
|
510
|
+
this.delDisabled = true;
|
|
511
|
+
}
|
|
512
|
+
if (!this.selectedName || this.option.id === this.selected) {
|
|
513
|
+
this.applyDisabled = true;
|
|
514
|
+
}
|
|
515
|
+
var toolbarVm = this.$grid.getVm("toolbar");
|
|
516
|
+
var customVm = toolbarVm.$refs.custom;
|
|
517
|
+
customVm.saveDisabled = false;
|
|
518
|
+
if (this.selected) {
|
|
519
|
+
customVm.saveDisabled = true;
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
enableAll: function enableAll() {
|
|
523
|
+
this.saveDisabled = false;
|
|
524
|
+
this.selectDisabled = false;
|
|
525
|
+
this.applyDisabled = false;
|
|
526
|
+
this.editDisabled = false;
|
|
527
|
+
this.delDisabled = false;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
var render$3 = function render$32() {
|
|
532
|
+
var _vm = this;
|
|
533
|
+
var _h = _vm.$createElement;
|
|
534
|
+
var _c = _vm._self._c || _h;
|
|
535
|
+
return _vm.customMode === "saas" ? _c("tiny-popover", {
|
|
536
|
+
ref: "popover",
|
|
537
|
+
attrs: {
|
|
538
|
+
"width": "280",
|
|
539
|
+
"placement": "top",
|
|
540
|
+
"popper-class": "grid-toolbar-template-popover",
|
|
541
|
+
"trigger": "manual"
|
|
542
|
+
},
|
|
543
|
+
scopedSlots: _vm._u([{
|
|
544
|
+
key: "reference",
|
|
545
|
+
fn: function fn() {
|
|
546
|
+
return [_c("tiny-button", {
|
|
547
|
+
staticClass: "save-btn",
|
|
548
|
+
on: {
|
|
549
|
+
"click": function click($event) {
|
|
550
|
+
_vm.templateVisible = !_vm.templateVisible;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.saveTemplate")))])];
|
|
554
|
+
},
|
|
555
|
+
proxy: true
|
|
556
|
+
}], null, false, 3411578796),
|
|
557
|
+
model: {
|
|
558
|
+
value: _vm.templateVisible,
|
|
559
|
+
callback: function callback($$v) {
|
|
560
|
+
_vm.templateVisible = $$v;
|
|
561
|
+
},
|
|
562
|
+
expression: "templateVisible"
|
|
563
|
+
}
|
|
564
|
+
}, [_c("div", [_vm.selectedTemplateVal.id && !_vm.historyConfig.hideOverwrite ? _c("div", {
|
|
565
|
+
staticClass: "radio-box"
|
|
566
|
+
}, [_c("tiny-radio", {
|
|
567
|
+
attrs: {
|
|
568
|
+
"label": "overwrite"
|
|
569
|
+
},
|
|
570
|
+
model: {
|
|
571
|
+
value: _vm.saveMethod,
|
|
572
|
+
callback: function callback($$v) {
|
|
573
|
+
_vm.saveMethod = $$v;
|
|
574
|
+
},
|
|
575
|
+
expression: "saveMethod"
|
|
576
|
+
}
|
|
577
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.overwriteSave")))]), _c("tiny-radio", {
|
|
578
|
+
attrs: {
|
|
579
|
+
"label": "save"
|
|
580
|
+
},
|
|
581
|
+
model: {
|
|
582
|
+
value: _vm.saveMethod,
|
|
583
|
+
callback: function callback($$v) {
|
|
584
|
+
_vm.saveMethod = $$v;
|
|
585
|
+
},
|
|
586
|
+
expression: "saveMethod"
|
|
587
|
+
}
|
|
588
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.saveAs")))])], 1) : _vm._e(), _vm.saveMethod === "save" ? _c("tiny-input", {
|
|
589
|
+
attrs: {
|
|
590
|
+
"type": "text",
|
|
591
|
+
"placeholder": _vm.t("ui.grid.individuation.defaultTemplateName")
|
|
592
|
+
},
|
|
593
|
+
model: {
|
|
594
|
+
value: _vm.savedTemplateName,
|
|
595
|
+
callback: function callback($$v) {
|
|
596
|
+
_vm.savedTemplateName = $$v;
|
|
597
|
+
},
|
|
598
|
+
expression: "savedTemplateName"
|
|
599
|
+
}
|
|
600
|
+
}) : _c("tiny-input", {
|
|
601
|
+
attrs: {
|
|
602
|
+
"placeholder": _vm.t("ui.grid.individuation.reserveTemplateName"),
|
|
603
|
+
"type": "text"
|
|
604
|
+
},
|
|
605
|
+
model: {
|
|
606
|
+
value: _vm.selectedTemplateName,
|
|
607
|
+
callback: function callback($$v) {
|
|
608
|
+
_vm.selectedTemplateName = $$v;
|
|
609
|
+
},
|
|
610
|
+
expression: "selectedTemplateName"
|
|
611
|
+
}
|
|
612
|
+
}), _c("div", {
|
|
613
|
+
staticClass: "btn-box"
|
|
614
|
+
}, [_c("tiny-button", {
|
|
615
|
+
on: {
|
|
616
|
+
"click": function click($event) {
|
|
617
|
+
_vm.templateVisible = false;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.cancelBtn")))]), _c("tiny-button", {
|
|
621
|
+
attrs: {
|
|
622
|
+
"type": "primary"
|
|
623
|
+
},
|
|
624
|
+
on: {
|
|
625
|
+
"click": function click($event) {
|
|
626
|
+
return _vm.handleSaveConfirm(_vm.saveMethod);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.saveBtn")))])], 1)], 1)]) : _c("div", {
|
|
630
|
+
staticClass: "tiny-grid-custom-switch"
|
|
631
|
+
}, [_c("tiny-layout", [_c("tiny-row", {
|
|
632
|
+
attrs: {
|
|
633
|
+
"no-space": ""
|
|
634
|
+
}
|
|
635
|
+
}, [_c("tiny-col", {
|
|
636
|
+
attrs: {
|
|
637
|
+
"span": 12
|
|
638
|
+
}
|
|
639
|
+
}, [_c("div", {
|
|
640
|
+
staticClass: "tiny-grid-custom-switch__title"
|
|
641
|
+
}, [_vm.historyConfig.showTitle ? _c("tiny-alert", {
|
|
642
|
+
attrs: {
|
|
643
|
+
"description": _vm.historyConfig.title || _vm.t("ui.grid.individuation.switchtitle"),
|
|
644
|
+
"closable": false
|
|
645
|
+
}
|
|
646
|
+
}) : _vm._e()], 1)])], 1), _c("tiny-row", {
|
|
647
|
+
attrs: {
|
|
648
|
+
"no-space": ""
|
|
649
|
+
}
|
|
650
|
+
}, [_vm.historyConfig.showSave ? _c("tiny-col", {
|
|
651
|
+
attrs: {
|
|
652
|
+
"span": 2
|
|
653
|
+
}
|
|
654
|
+
}, [_c("div", [_c("tiny-button", {
|
|
655
|
+
attrs: {
|
|
656
|
+
"type": "primary",
|
|
657
|
+
"size": "mini",
|
|
658
|
+
"disabled": _vm.historyConfig.saveDisabled || _vm.saveDisabled
|
|
659
|
+
},
|
|
660
|
+
on: {
|
|
661
|
+
"click": _vm.handleSave
|
|
662
|
+
}
|
|
663
|
+
}, [_vm._v(_vm._s(_vm.historyConfig.saveText || _vm.t("ui.grid.individuation.switchsave")))])], 1)]) : _vm._e(), _c("tiny-col", {
|
|
664
|
+
attrs: {
|
|
665
|
+
"span": 2
|
|
666
|
+
}
|
|
667
|
+
}, [_c("div", {
|
|
668
|
+
staticClass: "tiny-grid-custom-switch__label"
|
|
669
|
+
}, [_vm._v(" " + _vm._s(_vm.historyConfig.labelText || _vm.t("ui.grid.individuation.switchlabel")) + " ")])]), _c("tiny-col", {
|
|
670
|
+
attrs: {
|
|
671
|
+
"span": 5
|
|
672
|
+
}
|
|
673
|
+
}, [_c("div", {
|
|
674
|
+
staticClass: "tiny-grid-custom-switch__content"
|
|
675
|
+
}, [_c("tiny-select", {
|
|
676
|
+
ref: "select",
|
|
677
|
+
attrs: {
|
|
678
|
+
"clearable": "",
|
|
679
|
+
"value-field": "id",
|
|
680
|
+
"text-field": "name",
|
|
681
|
+
"placeholder": _vm.historyConfig.selectPlaceholder || _vm.t("ui.select.placeholder"),
|
|
682
|
+
"disabled": _vm.historyConfig.selectDisabled || _vm.selectDisabled,
|
|
683
|
+
"options": _vm.options
|
|
684
|
+
},
|
|
685
|
+
on: {
|
|
686
|
+
"change": _vm.handleSelectChange
|
|
687
|
+
},
|
|
688
|
+
model: {
|
|
689
|
+
value: _vm.selected,
|
|
690
|
+
callback: function callback($$v) {
|
|
691
|
+
_vm.selected = $$v;
|
|
692
|
+
},
|
|
693
|
+
expression: "selected"
|
|
694
|
+
}
|
|
695
|
+
})], 1)]), _c("tiny-col", {
|
|
696
|
+
attrs: {
|
|
697
|
+
"span": 3
|
|
698
|
+
}
|
|
699
|
+
}, [_c("div", [_vm.historyConfig.showApply ? _c("span", {
|
|
700
|
+
staticClass: "tiny-grid-custom-switch__icon-btn",
|
|
701
|
+
class: {
|
|
702
|
+
"tiny-grid-custom-switch__icon-btn--disabled": _vm.historyConfig.applyDisabled || _vm.applyDisabled
|
|
703
|
+
},
|
|
704
|
+
attrs: {
|
|
705
|
+
"title": _vm.historyConfig.applyTitle || _vm.t("ui.grid.individuation.switchapply")
|
|
706
|
+
},
|
|
707
|
+
on: {
|
|
708
|
+
"click": _vm.handleApply
|
|
709
|
+
}
|
|
710
|
+
}, [_c(_vm.historyConfig.applyIcon || _vm.IconSave, {
|
|
711
|
+
tag: "component"
|
|
712
|
+
})], 1) : _vm._e(), _vm.historyConfig.showEdit ? _c("span", {
|
|
713
|
+
staticClass: "tiny-grid-custom-switch__icon-btn",
|
|
714
|
+
class: {
|
|
715
|
+
"tiny-grid-custom-switch__icon-btn--disabled": _vm.historyConfig.editDisabled || _vm.editDisabled
|
|
716
|
+
},
|
|
717
|
+
attrs: {
|
|
718
|
+
"title": _vm.historyConfig.editTitle || _vm.t("ui.grid.individuation.switchedit")
|
|
719
|
+
},
|
|
720
|
+
on: {
|
|
721
|
+
"click": _vm.handleEdit
|
|
722
|
+
}
|
|
723
|
+
}, [_c(_vm.historyConfig.editIcon || _vm.IconEdit, {
|
|
724
|
+
tag: "component"
|
|
725
|
+
})], 1) : _vm._e(), _vm.historyConfig.showDel ? _c("span", {
|
|
726
|
+
staticClass: "tiny-grid-custom-switch__icon-btn",
|
|
727
|
+
class: {
|
|
728
|
+
"tiny-grid-custom-switch__icon-btn--disabled": _vm.historyConfig.delDisabled || _vm.delDisabled
|
|
729
|
+
},
|
|
730
|
+
attrs: {
|
|
731
|
+
"title": _vm.historyConfig.delTitle || _vm.t("ui.grid.individuation.switchdel")
|
|
732
|
+
},
|
|
733
|
+
on: {
|
|
734
|
+
"click": _vm.handleDel
|
|
735
|
+
}
|
|
736
|
+
}, [_c(_vm.historyConfig.delIcon || _vm.IconDel, {
|
|
737
|
+
tag: "component"
|
|
738
|
+
})], 1) : _vm._e()])])], 1)], 1), _c("tiny-dialog-box", {
|
|
739
|
+
attrs: {
|
|
740
|
+
"top": "30vh",
|
|
741
|
+
"width": "420px",
|
|
742
|
+
"dialog-class": "tiny-grid-custom-switch__dialog-box",
|
|
743
|
+
"draggable": "",
|
|
744
|
+
"append-to-body": "",
|
|
745
|
+
"visible": _vm.visible,
|
|
746
|
+
"close-on-click-modal": false,
|
|
747
|
+
"title": _vm.dialogTitle
|
|
748
|
+
},
|
|
749
|
+
on: {
|
|
750
|
+
"update:visible": function updateVisible($event) {
|
|
751
|
+
_vm.visible = $event;
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
scopedSlots: _vm._u([{
|
|
755
|
+
key: "footer",
|
|
756
|
+
fn: function fn() {
|
|
757
|
+
return [~["apply", "edit", "del"].indexOf(_vm.status) ? [_vm.status === "apply" ? [_c("tiny-button", {
|
|
758
|
+
attrs: {
|
|
759
|
+
"type": "primary"
|
|
760
|
+
},
|
|
761
|
+
on: {
|
|
762
|
+
"click": function click($event) {
|
|
763
|
+
return _vm.handleApplyConfirm("yes");
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchdelyes")) + " ")]), _c("tiny-button", {
|
|
767
|
+
on: {
|
|
768
|
+
"click": function click($event) {
|
|
769
|
+
return _vm.handleApplyConfirm("no");
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.switchdelno")))])] : _vm._e(), _vm.status === "edit" ? [_c("tiny-button", {
|
|
773
|
+
attrs: {
|
|
774
|
+
"type": "primary",
|
|
775
|
+
"disabled": !_vm.editName
|
|
776
|
+
},
|
|
777
|
+
on: {
|
|
778
|
+
"click": function click($event) {
|
|
779
|
+
return _vm.handleEditConfirm("yes");
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchdelyes")) + " ")]), _c("tiny-button", {
|
|
783
|
+
on: {
|
|
784
|
+
"click": function click($event) {
|
|
785
|
+
return _vm.handleEditConfirm("no");
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.switchdelno")))])] : _vm._e(), _vm.status === "del" ? [_c("tiny-button", {
|
|
789
|
+
attrs: {
|
|
790
|
+
"type": "primary"
|
|
791
|
+
},
|
|
792
|
+
on: {
|
|
793
|
+
"click": function click($event) {
|
|
794
|
+
return _vm.handleDelConfirm("yes");
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchdelyes")) + " ")]), _c("tiny-button", {
|
|
798
|
+
on: {
|
|
799
|
+
"click": function click($event) {
|
|
800
|
+
return _vm.handleDelConfirm("no");
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.switchdelno")))])] : _vm._e()] : _vm._e()];
|
|
804
|
+
},
|
|
805
|
+
proxy: true
|
|
806
|
+
}])
|
|
807
|
+
}, [_vm.status === "save" ? _c("div", {
|
|
808
|
+
staticClass: "tiny-grid-custom-switch__confirm-btns"
|
|
809
|
+
}, [_c("tiny-button", {
|
|
810
|
+
attrs: {
|
|
811
|
+
"type": "primary"
|
|
812
|
+
},
|
|
813
|
+
on: {
|
|
814
|
+
"click": function click($event) {
|
|
815
|
+
return _vm.handleSaveConfirm("save");
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchonlytemp")) + " ")]), _c("tiny-button", {
|
|
819
|
+
on: {
|
|
820
|
+
"click": function click($event) {
|
|
821
|
+
return _vm.handleSaveConfirm("save-apply");
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchtempapply")) + " ")]), _c("tiny-button", {
|
|
825
|
+
attrs: {
|
|
826
|
+
"disabled": !_vm.selected
|
|
827
|
+
},
|
|
828
|
+
on: {
|
|
829
|
+
"click": function click($event) {
|
|
830
|
+
return _vm.handleSaveConfirm("overwrite");
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchtempoverwrite")) + " ")])], 1) : _vm._e(), _vm.status === "apply" ? [_c("div", {
|
|
834
|
+
staticClass: "tiny-grid-custom-switch__del-tip"
|
|
835
|
+
}, [_vm._v(_vm._s(_vm.selectedName))]), _c("div", {
|
|
836
|
+
staticClass: "tiny-grid-custom-switch__del-tip"
|
|
837
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchapplycon")) + " ")])] : _vm._e(), _vm.status === "edit" ? [_c("tiny-input", {
|
|
838
|
+
model: {
|
|
839
|
+
value: _vm.editName,
|
|
840
|
+
callback: function callback($$v) {
|
|
841
|
+
_vm.editName = $$v;
|
|
842
|
+
},
|
|
843
|
+
expression: "editName"
|
|
844
|
+
}
|
|
845
|
+
})] : _vm._e(), _vm.status === "del" ? [_c("div", {
|
|
846
|
+
staticClass: "tiny-grid-custom-switch__del-tip"
|
|
847
|
+
}, [_vm._v(_vm._s(_vm.selectedName))]), _c("div", {
|
|
848
|
+
staticClass: "tiny-grid-custom-switch__del-tip"
|
|
849
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.switchdelcon")) + " ")])] : _vm._e()], 2)], 1);
|
|
850
|
+
};
|
|
851
|
+
var staticRenderFns$3 = [];
|
|
852
|
+
var __cssModules$3 = {};
|
|
853
|
+
var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3);
|
|
854
|
+
function __vue2_injectStyles$3(context) {
|
|
855
|
+
for (var o in __cssModules$3) {
|
|
856
|
+
this[o] = __cssModules$3[o];
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
var CustomSwitch = /* @__PURE__ */ function() {
|
|
860
|
+
return __component__$3.exports;
|
|
861
|
+
}();
|
|
862
|
+
var __vue2_script$2 = defineComponent({
|
|
863
|
+
components: {
|
|
864
|
+
TinyAlert: Alert,
|
|
865
|
+
TinyTabs: Tabs,
|
|
866
|
+
TinyTabItem: TabItem,
|
|
867
|
+
TinyModal: Modal,
|
|
868
|
+
TinyButton: Button,
|
|
869
|
+
TinyRadio: GridRadio,
|
|
870
|
+
TinyGrid: Grid,
|
|
871
|
+
TinyGridColumn: GridColumn,
|
|
872
|
+
TinySelect: Select,
|
|
873
|
+
TinyOption: Option,
|
|
874
|
+
IconEyeopen: IconEyeopen(),
|
|
875
|
+
IconEyeclose: IconEyeclose(),
|
|
876
|
+
IconUnlock: IconUnlock(),
|
|
877
|
+
IconLeftFrozen: IconLeftFrozen(),
|
|
878
|
+
IconRightFrozen: IconRightFrozen(),
|
|
879
|
+
IconLock: IconLock(),
|
|
880
|
+
IconMinus: IconMinus(),
|
|
881
|
+
IconDescending: IconDescending(),
|
|
882
|
+
IconAscending: IconAscending(),
|
|
883
|
+
TinyCustomSwitch: CustomSwitch
|
|
884
|
+
},
|
|
885
|
+
name: "TinyGridCustom",
|
|
886
|
+
inject: {
|
|
887
|
+
$grid: {
|
|
888
|
+
default: null
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
props: _extends({}, $props, {
|
|
892
|
+
data: {
|
|
893
|
+
type: Array,
|
|
894
|
+
default: function _default3() {
|
|
895
|
+
return [];
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
other: {
|
|
899
|
+
type: Boolean,
|
|
900
|
+
default: true
|
|
901
|
+
},
|
|
902
|
+
initSettings: {
|
|
903
|
+
type: Object,
|
|
904
|
+
default: function _default4() {
|
|
905
|
+
return {
|
|
906
|
+
pageSizes: [10, 15, 20, 30, 50, 100],
|
|
907
|
+
pageSize: 10,
|
|
908
|
+
sortType: "page",
|
|
909
|
+
showIndex: false
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
value: Boolean,
|
|
914
|
+
sortable: Function,
|
|
915
|
+
rowClassName: [Function, String],
|
|
916
|
+
onBeforeMove: Function,
|
|
917
|
+
filter: String,
|
|
918
|
+
refresh: Boolean,
|
|
919
|
+
keys: {
|
|
920
|
+
type: Array,
|
|
921
|
+
default: function _default5() {
|
|
922
|
+
return [];
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
numberSorting: Boolean,
|
|
926
|
+
multipleHistory: [Object, Boolean],
|
|
927
|
+
resetMethod: Function,
|
|
928
|
+
showHideAll: Boolean,
|
|
929
|
+
fixedSorting: Boolean
|
|
930
|
+
}),
|
|
931
|
+
emits: ["input", "saveSettings", "resetSettings", "cancelSettings", "showModal"],
|
|
932
|
+
data: function data2() {
|
|
933
|
+
return {
|
|
934
|
+
activeName: "base",
|
|
935
|
+
animateShow: "base",
|
|
936
|
+
constants: {
|
|
937
|
+
icon: {
|
|
938
|
+
asc: "icon-ascending",
|
|
939
|
+
desc: "icon-descending",
|
|
940
|
+
left: "icon-left-frozen",
|
|
941
|
+
right: "icon-right-frozen"
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
columns: [],
|
|
945
|
+
fullColumn: [],
|
|
946
|
+
customColumns: [{
|
|
947
|
+
field: "level"
|
|
948
|
+
}, {
|
|
949
|
+
field: "property"
|
|
950
|
+
}],
|
|
951
|
+
settings: {
|
|
952
|
+
sortType: this.initSettings.sortType || "page",
|
|
953
|
+
pageSize: this.initSettings.pageSize || this.pageSizes[0] || 10,
|
|
954
|
+
columns: []
|
|
955
|
+
},
|
|
956
|
+
sortingOptions: [],
|
|
957
|
+
multipleHistoryId: null,
|
|
958
|
+
saveDisabled: false
|
|
959
|
+
};
|
|
960
|
+
},
|
|
961
|
+
created: function created2() {
|
|
962
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
963
|
+
},
|
|
964
|
+
watch: {
|
|
965
|
+
value: function value() {
|
|
966
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
967
|
+
},
|
|
968
|
+
data: {
|
|
969
|
+
handler: function handler2(val) {
|
|
970
|
+
this.columns = this.getColumnConfigs(val);
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
activeName: {
|
|
974
|
+
handler: function handler3(val) {
|
|
975
|
+
var _this9 = this;
|
|
976
|
+
setTimeout(function() {
|
|
977
|
+
_this9.animateShow = val;
|
|
978
|
+
}, 0);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
computed: {
|
|
983
|
+
visible: {
|
|
984
|
+
get: function get() {
|
|
985
|
+
return this.value;
|
|
986
|
+
},
|
|
987
|
+
set: function set() {
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
showFixed: function showFixed() {
|
|
991
|
+
return this.$grid;
|
|
992
|
+
},
|
|
993
|
+
tinyTable: function tinyTable() {
|
|
994
|
+
return this.$grid && this.$grid.$refs.tinyTable || {};
|
|
995
|
+
},
|
|
996
|
+
isGroup: function isGroup() {
|
|
997
|
+
return this.tinyTable.isGroup;
|
|
998
|
+
},
|
|
999
|
+
historyConfig: function historyConfig() {
|
|
1000
|
+
var multipleHistory = isNull(this.multipleHistory) || typeof this.multipleHistory === "boolean" ? {} : this.multipleHistory;
|
|
1001
|
+
return extend(true, {}, this.initSettings.multipleHistory || {}, multipleHistory);
|
|
1002
|
+
},
|
|
1003
|
+
TinyTheme: function TinyTheme() {
|
|
1004
|
+
var ctx = appProperties();
|
|
1005
|
+
return (ctx.Tiny_theme ? ctx.Tiny_theme.value : "") || "aurora";
|
|
1006
|
+
},
|
|
1007
|
+
dropConfig: function dropConfig() {
|
|
1008
|
+
return {
|
|
1009
|
+
row: true,
|
|
1010
|
+
column: false,
|
|
1011
|
+
plugin: !this.isGroup && this.sortable,
|
|
1012
|
+
onBeforeMove: this.onBeforeMove,
|
|
1013
|
+
filter: this.filter,
|
|
1014
|
+
refresh: this.refresh
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
methods: {
|
|
1019
|
+
t,
|
|
1020
|
+
getColumnConfigs: function getColumnConfigs(configs) {
|
|
1021
|
+
var _getColNodes = function getColNodes(columns2) {
|
|
1022
|
+
return columns2.map(function(_ref4) {
|
|
1023
|
+
var id = _ref4.id, title = _ref4.title, property = _ref4.property, fixed = _ref4.fixed, visible = _ref4.visible, order = _ref4.order, sortable = _ref4.sortable, level = _ref4.level, children = _ref4.children;
|
|
1024
|
+
if (property) {
|
|
1025
|
+
var column = {
|
|
1026
|
+
id,
|
|
1027
|
+
title,
|
|
1028
|
+
property,
|
|
1029
|
+
fixed,
|
|
1030
|
+
visible,
|
|
1031
|
+
order,
|
|
1032
|
+
sortable,
|
|
1033
|
+
level,
|
|
1034
|
+
children
|
|
1035
|
+
};
|
|
1036
|
+
children && (column.children = _getColNodes(children));
|
|
1037
|
+
return column;
|
|
1038
|
+
}
|
|
1039
|
+
return void 0;
|
|
1040
|
+
}).filter(function(i) {
|
|
1041
|
+
return i;
|
|
1042
|
+
});
|
|
1043
|
+
};
|
|
1044
|
+
if (configs.length && this.$grid) {
|
|
1045
|
+
var _this$$grid$getTableC = this.$grid.getTableColumn(), collectColumn = _this$$grid$getTableC.collectColumn;
|
|
1046
|
+
var columns = _getColNodes(collectColumn);
|
|
1047
|
+
columns = this.doFixedSorting(columns);
|
|
1048
|
+
this.initNumberSorting(columns);
|
|
1049
|
+
return columns;
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
doFixedSorting: function doFixedSorting(columns) {
|
|
1053
|
+
if (this.isGroup || !this.fixedSorting) {
|
|
1054
|
+
return columns;
|
|
1055
|
+
}
|
|
1056
|
+
var fixedLeft = [];
|
|
1057
|
+
var normal = [];
|
|
1058
|
+
var fixedRight = [];
|
|
1059
|
+
columns.forEach(function(column) {
|
|
1060
|
+
if (!column.fixed) {
|
|
1061
|
+
normal.push(column);
|
|
1062
|
+
} else if (column.fixed === "left") {
|
|
1063
|
+
fixedLeft.push(column);
|
|
1064
|
+
} else if (column.fixed === "right") {
|
|
1065
|
+
fixedRight.push(column);
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
return [].concat(fixedLeft, normal, fixedRight);
|
|
1069
|
+
},
|
|
1070
|
+
initNumberSorting: function initNumberSorting(columns) {
|
|
1071
|
+
var _this10 = this;
|
|
1072
|
+
if (this.isGroup) return;
|
|
1073
|
+
this.sortingOptions = [];
|
|
1074
|
+
columns.forEach(function(column, index) {
|
|
1075
|
+
column.sortingIndex = index + 1;
|
|
1076
|
+
_this10.sortingOptions.push(column.sortingIndex);
|
|
1077
|
+
});
|
|
1078
|
+
},
|
|
1079
|
+
handelNumberSorting: function handelNumberSorting(sort, row) {
|
|
1080
|
+
var oldSort = this.columns.indexOf(row);
|
|
1081
|
+
var newSort = sort - 1;
|
|
1082
|
+
var columns = [];
|
|
1083
|
+
this.columns.splice(oldSort, 1);
|
|
1084
|
+
this.columns.splice(newSort, 0, row);
|
|
1085
|
+
this.columns.forEach(function(column, index) {
|
|
1086
|
+
column.sortingIndex = index + 1;
|
|
1087
|
+
columns.push(column);
|
|
1088
|
+
});
|
|
1089
|
+
this.columns = columns;
|
|
1090
|
+
},
|
|
1091
|
+
handleRowDropEnd: function handleRowDropEnd() {
|
|
1092
|
+
if (this.isGroup) return;
|
|
1093
|
+
this.columns.forEach(function(column, index) {
|
|
1094
|
+
column.sortingIndex = index + 1;
|
|
1095
|
+
});
|
|
1096
|
+
},
|
|
1097
|
+
renderNumberSorting: function renderNumberSorting(h2, _ref5) {
|
|
1098
|
+
var row = _ref5.row;
|
|
1099
|
+
return h2("span", row.sortingIndex + "");
|
|
1100
|
+
},
|
|
1101
|
+
handleCustomMouseMove: function handleCustomMouseMove() {
|
|
1102
|
+
this.$refs.switch && this.$refs.switch.$refs.select && this.$refs.switch.$refs.select.blur();
|
|
1103
|
+
},
|
|
1104
|
+
handleInput: function handleInput(val) {
|
|
1105
|
+
this.$emit("input", val);
|
|
1106
|
+
},
|
|
1107
|
+
handleFixed: function handleFixed(column) {
|
|
1108
|
+
var index = this.columns.indexOf(column);
|
|
1109
|
+
var splitIndex = 0;
|
|
1110
|
+
var fixed = column.fixed;
|
|
1111
|
+
if (!this.isGroup) {
|
|
1112
|
+
column.fixed = fixed ? fixed === "left" ? "right" : void 0 : "left";
|
|
1113
|
+
if (this.fixedSorting) {
|
|
1114
|
+
this.columns = this.doFixedSorting(this.columns);
|
|
1115
|
+
this.initNumberSorting(this.columns);
|
|
1116
|
+
}
|
|
1117
|
+
} else {
|
|
1118
|
+
for (var i = 0; i < this.columns.length; i++) {
|
|
1119
|
+
if (this.columns[i].children) {
|
|
1120
|
+
splitIndex = i;
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
var leftColumns = this.columns.slice(0, index);
|
|
1125
|
+
var rightColumns = this.columns.slice(index + 1);
|
|
1126
|
+
var changeFixed = function changeFixed2(left, right, column2, type) {
|
|
1127
|
+
var fixed2 = column2.fixed;
|
|
1128
|
+
if (fixed2) {
|
|
1129
|
+
if (!left.some(function(column3) {
|
|
1130
|
+
return column3.fixed === type;
|
|
1131
|
+
})) {
|
|
1132
|
+
column2.fixed = void 0;
|
|
1133
|
+
}
|
|
1134
|
+
} else {
|
|
1135
|
+
if (!right.length || !right.some(function(column3) {
|
|
1136
|
+
return !column3.fixed;
|
|
1137
|
+
})) {
|
|
1138
|
+
column2.fixed = type;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (fixed2 === column2.fixed) {
|
|
1142
|
+
Modal.message({
|
|
1143
|
+
id: "customSetting",
|
|
1144
|
+
message: t("ui.grid.error.groupFixed"),
|
|
1145
|
+
status: "warning"
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
if (index > splitIndex) {
|
|
1150
|
+
changeFixed(leftColumns, rightColumns, column, "right");
|
|
1151
|
+
} else {
|
|
1152
|
+
changeFixed(rightColumns, leftColumns, column, "left");
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
handleOrder: function handleOrder(column) {
|
|
1157
|
+
var columns = this.columns, tinyTable3 = this.tinyTable;
|
|
1158
|
+
var sortOpts = tinyTable3.sortOpts;
|
|
1159
|
+
var multipleColumnSort = sortOpts.multipleColumnSort;
|
|
1160
|
+
column.order = tinyTable3.toggleColumnOrder(column);
|
|
1161
|
+
if (column.order && !multipleColumnSort) {
|
|
1162
|
+
arrayEach(columns, function(col) {
|
|
1163
|
+
return col !== column && (col.order = null);
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
handleVisible: function handleVisible(column) {
|
|
1168
|
+
var visibleColumnCount = this.tinyTable.visibleColumn.filter(function(item) {
|
|
1169
|
+
return item.visible;
|
|
1170
|
+
}).length;
|
|
1171
|
+
if (column.visible && visibleColumnCount === 1) {
|
|
1172
|
+
Modal.message({
|
|
1173
|
+
id: "customSetting",
|
|
1174
|
+
message: t("ui.grid.individuation.hideMsg"),
|
|
1175
|
+
status: "warning"
|
|
1176
|
+
});
|
|
1177
|
+
} else {
|
|
1178
|
+
column.visible = !column.visible;
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
showOrHideAllColumns: function showOrHideAllColumns(visible) {
|
|
1182
|
+
this.columns.forEach(function(col) {
|
|
1183
|
+
col.visible = visible;
|
|
1184
|
+
});
|
|
1185
|
+
this.showAll = visible;
|
|
1186
|
+
},
|
|
1187
|
+
handlerSetting: function handlerSetting(type, column) {
|
|
1188
|
+
var invisibleCols = this.fullColumn.filter(function(item) {
|
|
1189
|
+
return item.visible;
|
|
1190
|
+
}).length;
|
|
1191
|
+
switch (type) {
|
|
1192
|
+
case "visible":
|
|
1193
|
+
if (column[type] && invisibleCols === 1) {
|
|
1194
|
+
Modal.message({
|
|
1195
|
+
id: "customSetting",
|
|
1196
|
+
message: t("ui.grid.individuation.hideMsg"),
|
|
1197
|
+
status: "warning"
|
|
1198
|
+
});
|
|
1199
|
+
} else {
|
|
1200
|
+
column[type] = !column[type];
|
|
1201
|
+
}
|
|
1202
|
+
break;
|
|
1203
|
+
case "fixed":
|
|
1204
|
+
this.handleFixed(column);
|
|
1205
|
+
break;
|
|
1206
|
+
case "order":
|
|
1207
|
+
column[type] = column[type] ? column[type] === "asc" ? "desc" : null : "asc";
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
buildSettings: function buildSettings() {
|
|
1212
|
+
var props = ["order", "fixed", "visible", "sortable"].concat(this.keys);
|
|
1213
|
+
this.settings.columns = mapTree(this.columns, function(_ref6) {
|
|
1214
|
+
var property = _ref6.property, rest = _objectWithoutPropertiesLoose2(_ref6, _excluded2);
|
|
1215
|
+
var node = {
|
|
1216
|
+
property
|
|
1217
|
+
};
|
|
1218
|
+
props.forEach(function(prop) {
|
|
1219
|
+
node[prop] = rest[prop];
|
|
1220
|
+
});
|
|
1221
|
+
return node;
|
|
1222
|
+
});
|
|
1223
|
+
return this.settings;
|
|
1224
|
+
},
|
|
1225
|
+
saveSettings: function saveSettings() {
|
|
1226
|
+
this.buildSettings();
|
|
1227
|
+
this.$emit("saveSettings", this.settings);
|
|
1228
|
+
this.handleClose();
|
|
1229
|
+
},
|
|
1230
|
+
resetSettings: function resetSettings(event) {
|
|
1231
|
+
var _this11 = this;
|
|
1232
|
+
if (this.activeName === "base") {
|
|
1233
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
1234
|
+
if (this.settings.columns && this.settings.columns.length) {
|
|
1235
|
+
this.settings.columns.forEach(function(setting) {
|
|
1236
|
+
var column = find(_this11.columns, function(item) {
|
|
1237
|
+
return item.property === setting.property;
|
|
1238
|
+
});
|
|
1239
|
+
if (column) {
|
|
1240
|
+
Object.assign(setting, column);
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
} else if (this.activeName === "other") {
|
|
1245
|
+
this.settings.sortType = this.initSettings.sortType;
|
|
1246
|
+
this.settings.pageSize = this.initSettings.pageSize;
|
|
1247
|
+
}
|
|
1248
|
+
event && this.$emit("resetSettings", this.settings);
|
|
1249
|
+
},
|
|
1250
|
+
cancelSettings: function cancelSettings() {
|
|
1251
|
+
this.resetSettings();
|
|
1252
|
+
this.$emit("cancelSettings");
|
|
1253
|
+
this.$emit("input", false);
|
|
1254
|
+
this.handleClose();
|
|
1255
|
+
},
|
|
1256
|
+
handleClose: function handleClose() {
|
|
1257
|
+
this.$emit("showModal", false);
|
|
1258
|
+
},
|
|
1259
|
+
handleReset: function handleReset(event) {
|
|
1260
|
+
var _this12 = this;
|
|
1261
|
+
var equal = function equal2(cols1, cols2) {
|
|
1262
|
+
var props1 = [];
|
|
1263
|
+
var props2 = [];
|
|
1264
|
+
cols1.forEach(function(col) {
|
|
1265
|
+
return col && col.property && props1.push(col.property);
|
|
1266
|
+
});
|
|
1267
|
+
cols2.forEach(function(col) {
|
|
1268
|
+
return col && col.property && props2.push(col.property);
|
|
1269
|
+
});
|
|
1270
|
+
return props1.length === props2.length && props1.sort().join(",") === props2.sort().join(",");
|
|
1271
|
+
};
|
|
1272
|
+
if (typeof this.resetMethod === "function") {
|
|
1273
|
+
this.resetMethod().then(function(sourceSettings) {
|
|
1274
|
+
_this12.buildSettings();
|
|
1275
|
+
var _ref7 = sourceSettings || {}, columns = _ref7.columns, sortType = _ref7.sortType, pageSize = _ref7.pageSize;
|
|
1276
|
+
if (columns && columns.length && _this12.settings.columns && _this12.settings.columns.length) {
|
|
1277
|
+
_this12.settings.columns.forEach(function(setting) {
|
|
1278
|
+
var source = find(columns, function(item) {
|
|
1279
|
+
return item.property === setting.property;
|
|
1280
|
+
});
|
|
1281
|
+
var target = find(_this12.columns, function(item) {
|
|
1282
|
+
return item.property === setting.property;
|
|
1283
|
+
});
|
|
1284
|
+
if (source) {
|
|
1285
|
+
Object.assign(setting, source);
|
|
1286
|
+
Object.assign(target, source);
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
if (equal(columns, _this12.settings.columns)) {
|
|
1290
|
+
var settingColumns = [];
|
|
1291
|
+
var gridColumns = [];
|
|
1292
|
+
columns.forEach(function(source) {
|
|
1293
|
+
var settingCol = find(_this12.settings.columns, function(item) {
|
|
1294
|
+
return source.property === item.property;
|
|
1295
|
+
});
|
|
1296
|
+
var targetCol = find(_this12.columns, function(item) {
|
|
1297
|
+
return source.property === item.property;
|
|
1298
|
+
});
|
|
1299
|
+
settingColumns.push(settingCol);
|
|
1300
|
+
gridColumns.push(targetCol);
|
|
1301
|
+
});
|
|
1302
|
+
_this12.settings.columns = settingColumns;
|
|
1303
|
+
_this12.columns = gridColumns;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
sortType && (_this12.settings.sortType = sortType);
|
|
1307
|
+
pageSize && (_this12.settings.pageSize = pageSize);
|
|
1308
|
+
});
|
|
1309
|
+
} else {
|
|
1310
|
+
this.resetSettings(event);
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
visibleTitle: function visibleTitle(row) {
|
|
1314
|
+
if (row.visible) {
|
|
1315
|
+
return t("ui.grid.individuation.colConfigs.visible");
|
|
1316
|
+
} else {
|
|
1317
|
+
return t("ui.grid.individuation.colConfigs.invisible");
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
sortTitle: function sortTitle(row) {
|
|
1321
|
+
if (row.sortable) {
|
|
1322
|
+
if (row.order) {
|
|
1323
|
+
if (row.order === "asc") {
|
|
1324
|
+
return t("ui.grid.individuation.colConfigs.asc");
|
|
1325
|
+
} else {
|
|
1326
|
+
return t("ui.grid.individuation.colConfigs.desc");
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
return t("ui.grid.individuation.colConfigs.unsorted");
|
|
1330
|
+
}
|
|
1331
|
+
} else {
|
|
1332
|
+
return "";
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
fixedTitle: function fixedTitle(row) {
|
|
1336
|
+
if (row.fixed) {
|
|
1337
|
+
if (row.fixed === "left") {
|
|
1338
|
+
return t("ui.grid.individuation.colConfigs.frozenLeft");
|
|
1339
|
+
} else {
|
|
1340
|
+
return t("ui.grid.individuation.colConfigs.frozenRight");
|
|
1341
|
+
}
|
|
1342
|
+
} else {
|
|
1343
|
+
return t("ui.grid.individuation.colConfigs.unfrozen");
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
var _excluded = ["row"];
|
|
1349
|
+
function _objectWithoutProperties(e, t2) {
|
|
1350
|
+
if (null == e) return {};
|
|
1351
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t2);
|
|
1352
|
+
if (Object.getOwnPropertySymbols) {
|
|
1353
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
1354
|
+
for (r = 0; r < s.length; r++) o = s[r], t2.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
1355
|
+
}
|
|
1356
|
+
return i;
|
|
1357
|
+
}
|
|
1358
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
1359
|
+
if (null == r) return {};
|
|
1360
|
+
var t2 = {};
|
|
1361
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1362
|
+
if (e.includes(n)) continue;
|
|
1363
|
+
t2[n] = r[n];
|
|
1364
|
+
}
|
|
1365
|
+
return t2;
|
|
1366
|
+
}
|
|
1367
|
+
var render$2 = function render$22() {
|
|
1368
|
+
var _vm = this;
|
|
1369
|
+
var _h = _vm.$createElement;
|
|
1370
|
+
var _c = _vm._self._c || _h;
|
|
1371
|
+
return _c("tiny-modal", {
|
|
1372
|
+
attrs: {
|
|
1373
|
+
"width": "600",
|
|
1374
|
+
"title": _vm.t("ui.grid.individuation.title")
|
|
1375
|
+
},
|
|
1376
|
+
on: {
|
|
1377
|
+
"input": _vm.handleInput,
|
|
1378
|
+
"close": _vm.handleClose,
|
|
1379
|
+
"custom-mousemove": _vm.handleCustomMouseMove
|
|
1380
|
+
},
|
|
1381
|
+
scopedSlots: _vm._u([{
|
|
1382
|
+
key: "default",
|
|
1383
|
+
fn: function fn() {
|
|
1384
|
+
return [_vm.visible ? _c("div", {
|
|
1385
|
+
staticClass: "tiny-grid-custom tiny-grid__wrapper"
|
|
1386
|
+
}, [_c("tiny-tabs", {
|
|
1387
|
+
staticClass: "tiny-grid-custom__tabs",
|
|
1388
|
+
model: {
|
|
1389
|
+
value: _vm.activeName,
|
|
1390
|
+
callback: function callback($$v) {
|
|
1391
|
+
_vm.activeName = $$v;
|
|
1392
|
+
},
|
|
1393
|
+
expression: "activeName"
|
|
1394
|
+
}
|
|
1395
|
+
}, [_c("div", {
|
|
1396
|
+
staticClass: "tiny-grid-custom__tabs-body"
|
|
1397
|
+
}, [_c("tiny-tab-item", {
|
|
1398
|
+
staticClass: "tabs-body-item",
|
|
1399
|
+
attrs: {
|
|
1400
|
+
"title": _vm.t("ui.grid.individuation.tabs.base.title"),
|
|
1401
|
+
"name": "base"
|
|
1402
|
+
}
|
|
1403
|
+
}, [_c("tiny-alert", {
|
|
1404
|
+
staticClass: "tiny-grid-custom__alert",
|
|
1405
|
+
attrs: {
|
|
1406
|
+
"description": _vm.t("ui.grid.individuation.tabs.base.tips"),
|
|
1407
|
+
"closable": false
|
|
1408
|
+
}
|
|
1409
|
+
}), _c("tiny-grid", {
|
|
1410
|
+
staticClass: "tiny-grid-custom__setting",
|
|
1411
|
+
attrs: {
|
|
1412
|
+
"auto-resize": true,
|
|
1413
|
+
"data": _vm.columns,
|
|
1414
|
+
"row-class-name": _vm.rowClassName,
|
|
1415
|
+
"row-key": "",
|
|
1416
|
+
"drop-config": _vm.dropConfig,
|
|
1417
|
+
"tree-config": {
|
|
1418
|
+
children: "children"
|
|
1419
|
+
},
|
|
1420
|
+
"show-header": false,
|
|
1421
|
+
"edit-config": {
|
|
1422
|
+
trigger: "click",
|
|
1423
|
+
mode: "cell",
|
|
1424
|
+
showStatus: true
|
|
1425
|
+
},
|
|
1426
|
+
"max-height": _vm.historyConfig.tableMaxHeight
|
|
1427
|
+
},
|
|
1428
|
+
on: {
|
|
1429
|
+
"row-drop-end": _vm.handleRowDropEnd
|
|
1430
|
+
}
|
|
1431
|
+
}, [_vm.initSettings.showIndex ? _c("tiny-grid-column", {
|
|
1432
|
+
attrs: {
|
|
1433
|
+
"type": "index",
|
|
1434
|
+
"width": "60"
|
|
1435
|
+
}
|
|
1436
|
+
}) : _vm._e(), _c("tiny-grid-column", {
|
|
1437
|
+
attrs: {
|
|
1438
|
+
"field": "title",
|
|
1439
|
+
"tree-node": ""
|
|
1440
|
+
}
|
|
1441
|
+
}), _c("tiny-grid-column", {
|
|
1442
|
+
attrs: {
|
|
1443
|
+
"field": "property",
|
|
1444
|
+
"width": "120px",
|
|
1445
|
+
"class-name": "setting-item"
|
|
1446
|
+
},
|
|
1447
|
+
scopedSlots: _vm._u([{
|
|
1448
|
+
key: "default",
|
|
1449
|
+
fn: function fn2(_ref) {
|
|
1450
|
+
var row = _ref.row, data6 = _objectWithoutProperties(_ref, _excluded);
|
|
1451
|
+
return [!row.children ? _c("div", {
|
|
1452
|
+
staticClass: "setting-icon"
|
|
1453
|
+
}, [_c("span", {
|
|
1454
|
+
staticClass: "icon",
|
|
1455
|
+
attrs: {
|
|
1456
|
+
"title": _vm.visibleTitle(row)
|
|
1457
|
+
}
|
|
1458
|
+
}, [_c(row.visible ? "icon-eyeopen" : "icon-eyeclose", {
|
|
1459
|
+
tag: "component",
|
|
1460
|
+
class: [{
|
|
1461
|
+
open: row.visible
|
|
1462
|
+
}],
|
|
1463
|
+
on: {
|
|
1464
|
+
"click": function click($event) {
|
|
1465
|
+
return _vm.handlerSetting("visible", row, data6);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
})], 1), _c("span", {
|
|
1469
|
+
staticClass: "icon",
|
|
1470
|
+
attrs: {
|
|
1471
|
+
"title": _vm.sortTitle(row)
|
|
1472
|
+
}
|
|
1473
|
+
}, [_c(row.order ? _vm.constants.icon[row.order] : "icon-minus", {
|
|
1474
|
+
tag: "component",
|
|
1475
|
+
class: {
|
|
1476
|
+
sort: row.order,
|
|
1477
|
+
"is-visible": !row.sortable
|
|
1478
|
+
},
|
|
1479
|
+
on: {
|
|
1480
|
+
"click": function click($event) {
|
|
1481
|
+
return _vm.handlerSetting("order", row);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
})], 1), _c("span", {
|
|
1485
|
+
staticClass: "icon",
|
|
1486
|
+
attrs: {
|
|
1487
|
+
"title": _vm.fixedTitle(row)
|
|
1488
|
+
}
|
|
1489
|
+
}, [row.level === 1 && _vm.showFixed ? _c(row.fixed ? _vm.constants.icon[row.fixed] : "icon-unlock", {
|
|
1490
|
+
tag: "component",
|
|
1491
|
+
class: {
|
|
1492
|
+
lock: row.fixed
|
|
1493
|
+
},
|
|
1494
|
+
on: {
|
|
1495
|
+
"click": function click($event) {
|
|
1496
|
+
return _vm.handlerSetting("fixed", row);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}) : _vm._e()], 1)]) : _vm._e()];
|
|
1500
|
+
}
|
|
1501
|
+
}], null, false, 2200875852)
|
|
1502
|
+
}), _vm.numberSorting && !_vm.isGroup ? _c("tiny-grid-column", {
|
|
1503
|
+
attrs: {
|
|
1504
|
+
"width": "100px",
|
|
1505
|
+
"editor": {},
|
|
1506
|
+
"renderer": _vm.renderNumberSorting
|
|
1507
|
+
},
|
|
1508
|
+
scopedSlots: _vm._u([{
|
|
1509
|
+
key: "edit",
|
|
1510
|
+
fn: function fn2(_ref2) {
|
|
1511
|
+
var row = _ref2.row;
|
|
1512
|
+
return [_c("tiny-select", {
|
|
1513
|
+
on: {
|
|
1514
|
+
"change": function change($event) {
|
|
1515
|
+
return _vm.handelNumberSorting($event, row);
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
model: {
|
|
1519
|
+
value: row.sortingIndex,
|
|
1520
|
+
callback: function callback($$v) {
|
|
1521
|
+
_vm.$set(row, "sortingIndex", $$v);
|
|
1522
|
+
},
|
|
1523
|
+
expression: "row.sortingIndex"
|
|
1524
|
+
}
|
|
1525
|
+
}, _vm._l(_vm.sortingOptions, function(item) {
|
|
1526
|
+
return _c("tiny-option", {
|
|
1527
|
+
key: item,
|
|
1528
|
+
attrs: {
|
|
1529
|
+
"label": item,
|
|
1530
|
+
"value": item
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
}), 1)];
|
|
1534
|
+
}
|
|
1535
|
+
}], null, false, 4084401751)
|
|
1536
|
+
}) : _vm._e()], 1)], 1), _vm.other ? _c("tiny-tab-item", {
|
|
1537
|
+
staticClass: "tabs-body-item",
|
|
1538
|
+
attrs: {
|
|
1539
|
+
"title": _vm.t("ui.grid.individuation.tabs.other.title"),
|
|
1540
|
+
"name": "other"
|
|
1541
|
+
}
|
|
1542
|
+
}, [_c("tiny-alert", {
|
|
1543
|
+
staticClass: "tiny-grid-custom__alert",
|
|
1544
|
+
attrs: {
|
|
1545
|
+
"description": _vm.t("ui.grid.individuation.tabs.other.tips"),
|
|
1546
|
+
"closable": false
|
|
1547
|
+
}
|
|
1548
|
+
}), _c("ul", {
|
|
1549
|
+
staticClass: "tiny-grid-custom__setting other-setting"
|
|
1550
|
+
}, [_c("li", {
|
|
1551
|
+
staticClass: "setting-item"
|
|
1552
|
+
}, [_c("span", {
|
|
1553
|
+
staticClass: "label"
|
|
1554
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.sortType")))]), _c("span", {
|
|
1555
|
+
staticClass: "selection"
|
|
1556
|
+
}, [_c("tiny-radio", {
|
|
1557
|
+
attrs: {
|
|
1558
|
+
"label": "page"
|
|
1559
|
+
},
|
|
1560
|
+
model: {
|
|
1561
|
+
value: _vm.settings.sortType,
|
|
1562
|
+
callback: function callback($$v) {
|
|
1563
|
+
_vm.$set(_vm.settings, "sortType", $$v);
|
|
1564
|
+
},
|
|
1565
|
+
expression: "settings.sortType"
|
|
1566
|
+
}
|
|
1567
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.currPageSort")))]), _c("tiny-radio", {
|
|
1568
|
+
attrs: {
|
|
1569
|
+
"label": "all"
|
|
1570
|
+
},
|
|
1571
|
+
model: {
|
|
1572
|
+
value: _vm.settings.sortType,
|
|
1573
|
+
callback: function callback($$v) {
|
|
1574
|
+
_vm.$set(_vm.settings, "sortType", $$v);
|
|
1575
|
+
},
|
|
1576
|
+
expression: "settings.sortType"
|
|
1577
|
+
}
|
|
1578
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.allDataSort")))])], 1)]), _c("li", {
|
|
1579
|
+
staticClass: "setting-item"
|
|
1580
|
+
}, [_c("span", {
|
|
1581
|
+
staticClass: "label"
|
|
1582
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.pageSize")))]), _c("span", {
|
|
1583
|
+
staticClass: "selection"
|
|
1584
|
+
}, _vm._l(_vm.initSettings.pageSizes, function(item, index) {
|
|
1585
|
+
return _c("tiny-radio", {
|
|
1586
|
+
key: index,
|
|
1587
|
+
attrs: {
|
|
1588
|
+
"label": item
|
|
1589
|
+
},
|
|
1590
|
+
model: {
|
|
1591
|
+
value: _vm.settings.pageSize,
|
|
1592
|
+
callback: function callback($$v) {
|
|
1593
|
+
_vm.$set(_vm.settings, "pageSize", $$v);
|
|
1594
|
+
},
|
|
1595
|
+
expression: "settings.pageSize"
|
|
1596
|
+
}
|
|
1597
|
+
}, [_vm._v(_vm._s(item))]);
|
|
1598
|
+
}), 1)])])], 1) : _vm._e(), _vm.multipleHistory && _vm.activeName === "base" ? _c("tiny-custom-switch", {
|
|
1599
|
+
ref: "switch",
|
|
1600
|
+
attrs: {
|
|
1601
|
+
"history-config": _vm.historyConfig
|
|
1602
|
+
}
|
|
1603
|
+
}) : _vm._e()], 1)]), !_vm.multipleHistory || _vm.multipleHistory && _vm.activeName === "base" ? _c("div", {
|
|
1604
|
+
staticClass: "tiny-grid-custom__footer",
|
|
1605
|
+
attrs: {
|
|
1606
|
+
"dir": _vm.TinyTheme === "saas" ? "rtl" : "ltr"
|
|
1607
|
+
}
|
|
1608
|
+
}, [_c("tiny-button", {
|
|
1609
|
+
on: {
|
|
1610
|
+
"click": _vm.handleReset
|
|
1611
|
+
}
|
|
1612
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.resetBtn")) + " ")]), _vm.showHideAll ? _c("tiny-button", {
|
|
1613
|
+
on: {
|
|
1614
|
+
"click": function click($event) {
|
|
1615
|
+
return _vm.showOrHideAllColumns(!_vm.showAll);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
}, [_vm._v(_vm._s(_vm.showAll ? _vm.t("ui.grid.individuation.hideAll") : _vm.t("ui.grid.individuation.showAll")))]) : _vm._e(), _c("tiny-button", {
|
|
1619
|
+
on: {
|
|
1620
|
+
"click": _vm.cancelSettings
|
|
1621
|
+
}
|
|
1622
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.cancelBtn")) + " ")]), _c("tiny-button", {
|
|
1623
|
+
attrs: {
|
|
1624
|
+
"type": "primary",
|
|
1625
|
+
"disabled": _vm.saveDisabled
|
|
1626
|
+
},
|
|
1627
|
+
on: {
|
|
1628
|
+
"click": _vm.saveSettings
|
|
1629
|
+
}
|
|
1630
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.saveBtn")) + " ")])], 1) : _vm._e()], 1) : _vm._e()];
|
|
1631
|
+
},
|
|
1632
|
+
proxy: true
|
|
1633
|
+
}]),
|
|
1634
|
+
model: {
|
|
1635
|
+
value: _vm.visible,
|
|
1636
|
+
callback: function callback($$v) {
|
|
1637
|
+
_vm.visible = $$v;
|
|
1638
|
+
},
|
|
1639
|
+
expression: "visible"
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
};
|
|
1643
|
+
var staticRenderFns$2 = [];
|
|
1644
|
+
var __cssModules$2 = {};
|
|
1645
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2);
|
|
1646
|
+
function __vue2_injectStyles$2(context) {
|
|
1647
|
+
for (var o in __cssModules$2) {
|
|
1648
|
+
this[o] = __cssModules$2[o];
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
var GridCustom = /* @__PURE__ */ function() {
|
|
1652
|
+
return __component__$2.exports;
|
|
1653
|
+
}();
|
|
1654
|
+
var __vue2_script$1 = {
|
|
1655
|
+
name: "TinyGridCustomSelect",
|
|
1656
|
+
components: {
|
|
1657
|
+
TinySelect: Select,
|
|
1658
|
+
TinyOption: Option,
|
|
1659
|
+
TinyIconSetting: GridConfig.icon.custom
|
|
1660
|
+
},
|
|
1661
|
+
props: {
|
|
1662
|
+
data: {
|
|
1663
|
+
type: Array,
|
|
1664
|
+
default: function _default6() {
|
|
1665
|
+
return [];
|
|
1666
|
+
}
|
|
1667
|
+
},
|
|
1668
|
+
setting: {
|
|
1669
|
+
type: [Object, Boolean]
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
inject: {
|
|
1673
|
+
$grid: {
|
|
1674
|
+
default: null
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
data: function data3() {
|
|
1678
|
+
return {
|
|
1679
|
+
columns: [],
|
|
1680
|
+
multivalue: []
|
|
1681
|
+
};
|
|
1682
|
+
},
|
|
1683
|
+
created: function created3() {
|
|
1684
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
1685
|
+
},
|
|
1686
|
+
watch: {
|
|
1687
|
+
data: {
|
|
1688
|
+
handler: function handler4(val) {
|
|
1689
|
+
this.columns = this.getColumnConfigs(val);
|
|
1690
|
+
this.multivalue = this.columns.filter(function(item) {
|
|
1691
|
+
return item.visible;
|
|
1692
|
+
}).map(function(item) {
|
|
1693
|
+
return item.property;
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
},
|
|
1698
|
+
methods: {
|
|
1699
|
+
columnChange: function columnChange(values) {
|
|
1700
|
+
this.columns.forEach(function(column) {
|
|
1701
|
+
column.visible = values.includes(column.property);
|
|
1702
|
+
});
|
|
1703
|
+
this.$emit("saveSettings", {
|
|
1704
|
+
columns: this.columns
|
|
1705
|
+
});
|
|
1706
|
+
},
|
|
1707
|
+
getColumnConfigs: function getColumnConfigs2(configs) {
|
|
1708
|
+
var _this13 = this;
|
|
1709
|
+
var _getColNodes2 = function getColNodes(columns2) {
|
|
1710
|
+
return columns2.map(function(_ref8) {
|
|
1711
|
+
var id = _ref8.id, title = _ref8.title, property = _ref8.property, fixed = _ref8.fixed, visible = _ref8.visible, order = _ref8.order, sortable = _ref8.sortable, level = _ref8.level, children = _ref8.children;
|
|
1712
|
+
if (property) {
|
|
1713
|
+
var _this13$setting;
|
|
1714
|
+
var column = {
|
|
1715
|
+
id,
|
|
1716
|
+
title,
|
|
1717
|
+
property,
|
|
1718
|
+
fixed,
|
|
1719
|
+
visible,
|
|
1720
|
+
order,
|
|
1721
|
+
sortable,
|
|
1722
|
+
level,
|
|
1723
|
+
children
|
|
1724
|
+
};
|
|
1725
|
+
column.disabled = Boolean((_this13$setting = _this13.setting) == null ? void 0 : _this13$setting.customDisable == null ? void 0 : _this13$setting.customDisable(column));
|
|
1726
|
+
children && (column.children = _getColNodes2(children));
|
|
1727
|
+
return column;
|
|
1728
|
+
}
|
|
1729
|
+
}).filter(function(i) {
|
|
1730
|
+
return i;
|
|
1731
|
+
});
|
|
1732
|
+
};
|
|
1733
|
+
if (configs.length && this.$grid) {
|
|
1734
|
+
var _this$$grid$getTableC2 = this.$grid.getTableColumn(), collectColumn = _this$$grid$getTableC2.collectColumn;
|
|
1735
|
+
var columns = _getColNodes2(collectColumn);
|
|
1736
|
+
return columns;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
var render$1 = function render$12() {
|
|
1742
|
+
var _vm = this;
|
|
1743
|
+
var _h = _vm.$createElement;
|
|
1744
|
+
var _c = _vm._self._c || _h;
|
|
1745
|
+
return _c("tiny-select", {
|
|
1746
|
+
attrs: {
|
|
1747
|
+
"placeholder": "请选择",
|
|
1748
|
+
"placement": "bottom-end",
|
|
1749
|
+
"searchable": true,
|
|
1750
|
+
"multiple": ""
|
|
1751
|
+
},
|
|
1752
|
+
on: {
|
|
1753
|
+
"change": _vm.columnChange
|
|
1754
|
+
},
|
|
1755
|
+
scopedSlots: _vm._u([{
|
|
1756
|
+
key: "reference",
|
|
1757
|
+
fn: function fn() {
|
|
1758
|
+
return [_c("tiny-icon-setting")];
|
|
1759
|
+
},
|
|
1760
|
+
proxy: true
|
|
1761
|
+
}]),
|
|
1762
|
+
model: {
|
|
1763
|
+
value: _vm.multivalue,
|
|
1764
|
+
callback: function callback($$v) {
|
|
1765
|
+
_vm.multivalue = $$v;
|
|
1766
|
+
},
|
|
1767
|
+
expression: "multivalue"
|
|
1768
|
+
}
|
|
1769
|
+
}, _vm._l(_vm.columns, function(item) {
|
|
1770
|
+
return _c("tiny-option", {
|
|
1771
|
+
key: item.property,
|
|
1772
|
+
attrs: {
|
|
1773
|
+
"disabled": item.disabled,
|
|
1774
|
+
"label": item.title,
|
|
1775
|
+
"value": item.property
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
}), 1);
|
|
1779
|
+
};
|
|
1780
|
+
var staticRenderFns$1 = [];
|
|
1781
|
+
var __cssModules$1 = {};
|
|
1782
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
|
|
1783
|
+
function __vue2_injectStyles$1(context) {
|
|
1784
|
+
for (var o in __cssModules$1) {
|
|
1785
|
+
this[o] = __cssModules$1[o];
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
var GridCustomSelect = /* @__PURE__ */ function() {
|
|
1789
|
+
return __component__$1.exports;
|
|
1790
|
+
}();
|
|
1791
|
+
var position = ["left", "right"];
|
|
1792
|
+
var TitleRender = {
|
|
1793
|
+
props: ["column"],
|
|
1794
|
+
render: function render() {
|
|
1795
|
+
var column = this.column, $parent = this.$parent;
|
|
1796
|
+
var title = column.title;
|
|
1797
|
+
var tinyTable3 = $parent.tinyTable;
|
|
1798
|
+
return h("span", {
|
|
1799
|
+
class: ["custom-saas-title-render", column.id]
|
|
1800
|
+
}, [typeof title === "function" ? title(h, {
|
|
1801
|
+
$table: tinyTable3,
|
|
1802
|
+
column
|
|
1803
|
+
}) : title]);
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1806
|
+
var __vue2_script = defineComponent({
|
|
1807
|
+
components: {
|
|
1808
|
+
TinyModal: Modal,
|
|
1809
|
+
TinyButton: Button,
|
|
1810
|
+
TinySplit: Split,
|
|
1811
|
+
TinySelect: Select,
|
|
1812
|
+
TinyOption: Option,
|
|
1813
|
+
TinyDropdown: Dropdown,
|
|
1814
|
+
TinyDropdownMenu: DropdownMenu,
|
|
1815
|
+
TinyDropdownItem: DropdownItem,
|
|
1816
|
+
TinyCustomSwitch: CustomSwitch,
|
|
1817
|
+
IconClose: IconClose(),
|
|
1818
|
+
IconLeftFrozen: IconLeftFrozen(),
|
|
1819
|
+
IconRightFrozen: IconRightFrozen(),
|
|
1820
|
+
IconDescending: IconDescending(),
|
|
1821
|
+
IconAscending: IconAscending(),
|
|
1822
|
+
IconChevronRight: IconChevronRight(),
|
|
1823
|
+
TinyCheckbox: Checkbox,
|
|
1824
|
+
TinyCheckboxGroup: CheckboxGroup,
|
|
1825
|
+
TinyRadioGroup: RadioGroup,
|
|
1826
|
+
TinyTooltip: Tooltip,
|
|
1827
|
+
TinyRadio: Radio,
|
|
1828
|
+
TinySearch: Search,
|
|
1829
|
+
TinyTree: Tree,
|
|
1830
|
+
TitleRender
|
|
1831
|
+
},
|
|
1832
|
+
directives: directive({
|
|
1833
|
+
Clickoutside
|
|
1834
|
+
}),
|
|
1835
|
+
name: "TinyGridCustom",
|
|
1836
|
+
inject: {
|
|
1837
|
+
$grid: {
|
|
1838
|
+
default: null
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
props: _extends({}, $props, {
|
|
1842
|
+
data: {
|
|
1843
|
+
type: Array,
|
|
1844
|
+
default: function _default7() {
|
|
1845
|
+
return [];
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
alwaysShowColumns: {
|
|
1849
|
+
type: Array,
|
|
1850
|
+
default: function _default8() {
|
|
1851
|
+
return [];
|
|
1852
|
+
}
|
|
1853
|
+
},
|
|
1854
|
+
columnsGroup: {
|
|
1855
|
+
type: Array,
|
|
1856
|
+
default: function _default9() {
|
|
1857
|
+
return [];
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
other: {
|
|
1861
|
+
type: Boolean,
|
|
1862
|
+
default: true
|
|
1863
|
+
},
|
|
1864
|
+
search: {
|
|
1865
|
+
type: Boolean,
|
|
1866
|
+
default: true
|
|
1867
|
+
},
|
|
1868
|
+
initSettings: {
|
|
1869
|
+
type: Object,
|
|
1870
|
+
default: function _default10() {
|
|
1871
|
+
return {
|
|
1872
|
+
pageSizes: [10, 15, 20, 30, 50, 100],
|
|
1873
|
+
pageSize: 10,
|
|
1874
|
+
sortType: "page",
|
|
1875
|
+
showIndex: false
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
},
|
|
1879
|
+
customMode: String,
|
|
1880
|
+
value: Boolean,
|
|
1881
|
+
sortable: Function,
|
|
1882
|
+
rowClassName: [Function, String],
|
|
1883
|
+
onBeforeMove: Function,
|
|
1884
|
+
filter: String,
|
|
1885
|
+
refresh: Boolean,
|
|
1886
|
+
keys: {
|
|
1887
|
+
type: Array,
|
|
1888
|
+
default: function _default11() {
|
|
1889
|
+
return [];
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
numberSorting: Boolean,
|
|
1893
|
+
multipleHistory: [Object, Boolean],
|
|
1894
|
+
resetMethod: Function,
|
|
1895
|
+
setting: [Object, Boolean]
|
|
1896
|
+
}),
|
|
1897
|
+
data: function data4() {
|
|
1898
|
+
return {
|
|
1899
|
+
maxFixedNum: 6,
|
|
1900
|
+
tooltipContent: "",
|
|
1901
|
+
tooltipVisible: false,
|
|
1902
|
+
templateVisible: false,
|
|
1903
|
+
activeName: "base",
|
|
1904
|
+
animateShow: "base",
|
|
1905
|
+
selectedTemplate: "",
|
|
1906
|
+
lastSelectIndex: 0,
|
|
1907
|
+
searchValue: "",
|
|
1908
|
+
splitVal: 0.4,
|
|
1909
|
+
columns: [],
|
|
1910
|
+
searchColumns: [],
|
|
1911
|
+
fullColumn: [],
|
|
1912
|
+
customColumns: [{
|
|
1913
|
+
field: "level"
|
|
1914
|
+
}, {
|
|
1915
|
+
field: "property"
|
|
1916
|
+
}],
|
|
1917
|
+
settings: {
|
|
1918
|
+
sortType: this.initSettings.sortType || "page",
|
|
1919
|
+
pageSize: this.initSettings.pageSize || this.pageSizes[0] || 10,
|
|
1920
|
+
columns: []
|
|
1921
|
+
},
|
|
1922
|
+
originColumns: [],
|
|
1923
|
+
groupedColumns: [],
|
|
1924
|
+
checkedColumns: [],
|
|
1925
|
+
sortingOptions: [],
|
|
1926
|
+
templateOptions: [],
|
|
1927
|
+
defaultcheckedkeys: [],
|
|
1928
|
+
colIds: [],
|
|
1929
|
+
multipleHistoryId: null,
|
|
1930
|
+
saveDisabled: false,
|
|
1931
|
+
updatedSorting: false,
|
|
1932
|
+
columnsSorted: false,
|
|
1933
|
+
opt: {},
|
|
1934
|
+
allCheckedKeys: []
|
|
1935
|
+
};
|
|
1936
|
+
},
|
|
1937
|
+
setup: function setup() {
|
|
1938
|
+
var _useDefer = useDefer(80), defer = _useDefer.defer, reset = _useDefer.reset;
|
|
1939
|
+
return {
|
|
1940
|
+
defer,
|
|
1941
|
+
reset
|
|
1942
|
+
};
|
|
1943
|
+
},
|
|
1944
|
+
created: function created4() {
|
|
1945
|
+
this.initOpt();
|
|
1946
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
1947
|
+
},
|
|
1948
|
+
watch: {
|
|
1949
|
+
value: function value2(val) {
|
|
1950
|
+
var _this14 = this;
|
|
1951
|
+
if (val) {
|
|
1952
|
+
this.initOpt();
|
|
1953
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
1954
|
+
this.groupedColumns = this.getGroupedColumns();
|
|
1955
|
+
this.checkedColumns = this.columns.filter(function(col) {
|
|
1956
|
+
return col.visible;
|
|
1957
|
+
}).map(function(col) {
|
|
1958
|
+
return col.property;
|
|
1959
|
+
});
|
|
1960
|
+
this.defaultcheckedkeys = this.getDefaultcheckedkeys();
|
|
1961
|
+
setTimeout(function() {
|
|
1962
|
+
_this14.initDragEvent();
|
|
1963
|
+
_this14.initDrag = true;
|
|
1964
|
+
if (_this14.$refs.tree) {
|
|
1965
|
+
_this14.allCheckedKeys = [].concat(_this14.$refs.tree.getCheckedKeys(), _this14.$refs.tree.getHalfCheckedKeys());
|
|
1966
|
+
}
|
|
1967
|
+
}, 100);
|
|
1968
|
+
this.reset();
|
|
1969
|
+
}
|
|
1970
|
+
},
|
|
1971
|
+
checkedColumns: {
|
|
1972
|
+
handler: function handler5(val) {
|
|
1973
|
+
this.columns.forEach(function(column) {
|
|
1974
|
+
column.visible = !!~val.indexOf(column.property);
|
|
1975
|
+
});
|
|
1976
|
+
this.columnsSorted = false;
|
|
1977
|
+
this.updateSortingIndex();
|
|
1978
|
+
},
|
|
1979
|
+
deep: !isVue2
|
|
1980
|
+
},
|
|
1981
|
+
data: {
|
|
1982
|
+
handler: function handler6(val) {
|
|
1983
|
+
this.columns = this.getColumnConfigs(val);
|
|
1984
|
+
this.groupedColumns = this.getGroupedColumns();
|
|
1985
|
+
}
|
|
1986
|
+
},
|
|
1987
|
+
activeName: {
|
|
1988
|
+
handler: function handler7(val) {
|
|
1989
|
+
var _this15 = this;
|
|
1990
|
+
setTimeout(function() {
|
|
1991
|
+
_this15.animateShow = val;
|
|
1992
|
+
}, 0);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
computed: {
|
|
1997
|
+
visible: {
|
|
1998
|
+
get: function get2() {
|
|
1999
|
+
return this.value;
|
|
2000
|
+
},
|
|
2001
|
+
set: function set2() {
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
2004
|
+
showFixed: function showFixed2() {
|
|
2005
|
+
return this.$grid;
|
|
2006
|
+
},
|
|
2007
|
+
tinyTable: function tinyTable2() {
|
|
2008
|
+
return this.$grid && this.$grid.$refs.tinyTable || {};
|
|
2009
|
+
},
|
|
2010
|
+
isGroup: function isGroup2() {
|
|
2011
|
+
return this.tinyTable.isGroup;
|
|
2012
|
+
},
|
|
2013
|
+
historyConfig: function historyConfig2() {
|
|
2014
|
+
var multipleHistory = isNull(this.multipleHistory) || typeof this.multipleHistory === "boolean" ? {} : this.multipleHistory;
|
|
2015
|
+
return extend(true, {}, this.initSettings.multipleHistory || {}, multipleHistory);
|
|
2016
|
+
},
|
|
2017
|
+
tinyTheme: function tinyTheme() {
|
|
2018
|
+
return this.tinyTable.tinyTheme || GridConfig.themes.AURORA;
|
|
2019
|
+
},
|
|
2020
|
+
visibleColumns: function visibleColumns() {
|
|
2021
|
+
var _this16 = this;
|
|
2022
|
+
if (this.isGroup) {
|
|
2023
|
+
return this.columns.filter(function(column) {
|
|
2024
|
+
return _this16.allCheckedKeys.includes(column.id);
|
|
2025
|
+
});
|
|
2026
|
+
} else {
|
|
2027
|
+
return this.columns.filter(function(column) {
|
|
2028
|
+
return column.visible;
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
selectedTemplateVal: function selectedTemplateVal() {
|
|
2033
|
+
var _this17 = this;
|
|
2034
|
+
return this.templateOptions.find(function(item) {
|
|
2035
|
+
return item.id === _this17.selectedTemplate;
|
|
2036
|
+
}) || {};
|
|
2037
|
+
},
|
|
2038
|
+
isIndeterminate: {
|
|
2039
|
+
get: function get3() {
|
|
2040
|
+
return !(this.checkedColumns.length === 0 || this.checkedColumns.length === this.columns.length);
|
|
2041
|
+
}
|
|
2042
|
+
},
|
|
2043
|
+
isMultiIndeterminate: function isMultiIndeterminate() {
|
|
2044
|
+
return this.allCheckedKeys.length !== 0 && this.allCheckedKeys.length !== this.colIds.length;
|
|
2045
|
+
},
|
|
2046
|
+
multiCheckAll: {
|
|
2047
|
+
get: function get4() {
|
|
2048
|
+
return this.allCheckedKeys.length === this.colIds.length;
|
|
2049
|
+
},
|
|
2050
|
+
set: function set3(val) {
|
|
2051
|
+
if (val) {
|
|
2052
|
+
this.allCheckedKeys = [].concat(this.colIds);
|
|
2053
|
+
} else {
|
|
2054
|
+
this.allCheckedKeys = [];
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
},
|
|
2058
|
+
checkAll: {
|
|
2059
|
+
get: function get5() {
|
|
2060
|
+
return this.checkedColumns.length === this.columns.length;
|
|
2061
|
+
},
|
|
2062
|
+
set: function set4(val) {
|
|
2063
|
+
if (val) {
|
|
2064
|
+
this.checkedColumns = this.columns.map(function(item) {
|
|
2065
|
+
return item.property;
|
|
2066
|
+
});
|
|
2067
|
+
} else {
|
|
2068
|
+
this.checkedColumns = [].concat(this.alwaysShowColumns);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
},
|
|
2072
|
+
dropConfig: function dropConfig2() {
|
|
2073
|
+
return {
|
|
2074
|
+
row: true,
|
|
2075
|
+
column: false,
|
|
2076
|
+
plugin: !this.isGroup && this.sortable,
|
|
2077
|
+
onBeforeMove: this.onBeforeMove,
|
|
2078
|
+
filter: this.filter,
|
|
2079
|
+
refresh: this.refresh
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
methods: {
|
|
2084
|
+
t,
|
|
2085
|
+
initOpt: function initOpt() {
|
|
2086
|
+
this.opt = {
|
|
2087
|
+
asc: {
|
|
2088
|
+
value: "asc",
|
|
2089
|
+
label: t("ui.grid.individuation.colConfigs.asc")
|
|
2090
|
+
},
|
|
2091
|
+
desc: {
|
|
2092
|
+
value: "desc",
|
|
2093
|
+
label: t("ui.grid.individuation.colConfigs.desc")
|
|
2094
|
+
},
|
|
2095
|
+
left: {
|
|
2096
|
+
value: "left",
|
|
2097
|
+
label: t("ui.grid.individuation.colConfigs.frozenLeft")
|
|
2098
|
+
},
|
|
2099
|
+
right: {
|
|
2100
|
+
value: "right",
|
|
2101
|
+
label: t("ui.grid.individuation.colConfigs.frozenRight")
|
|
2102
|
+
},
|
|
2103
|
+
cancelSort: {
|
|
2104
|
+
value: "cancel",
|
|
2105
|
+
label: t("ui.grid.individuation.colConfigs.unsort")
|
|
2106
|
+
},
|
|
2107
|
+
cancelFixed: {
|
|
2108
|
+
value: "cancel",
|
|
2109
|
+
label: t("ui.grid.individuation.colConfigs.unfreeze")
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
},
|
|
2113
|
+
setSelectedTemplate: function setSelectedTemplate(val) {
|
|
2114
|
+
this.selectedTemplate = val;
|
|
2115
|
+
},
|
|
2116
|
+
initStorage: function initStorage2(option) {
|
|
2117
|
+
this.templateOptions = option;
|
|
2118
|
+
},
|
|
2119
|
+
updateTemplateOptions: function updateTemplateOptions(id, name) {
|
|
2120
|
+
this.templateOptions.forEach(function(opt) {
|
|
2121
|
+
if (opt.id === id) {
|
|
2122
|
+
opt.name = name;
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2125
|
+
},
|
|
2126
|
+
checkAllChange: function checkAllChange(val) {
|
|
2127
|
+
if (val) {
|
|
2128
|
+
this.$refs.tree.setCheckedKeys(this.colIds);
|
|
2129
|
+
this.hideOrShowColumns(true);
|
|
2130
|
+
} else {
|
|
2131
|
+
this.$refs.tree.setCheckedKeys([]);
|
|
2132
|
+
this.hideOrShowColumns(false);
|
|
2133
|
+
}
|
|
2134
|
+
},
|
|
2135
|
+
checkNode: function checkNode(node, data6, checked) {
|
|
2136
|
+
node.visible = checked;
|
|
2137
|
+
if (node.children && Array.isArray(node.children)) {
|
|
2138
|
+
node.children.forEach(function(item) {
|
|
2139
|
+
item.visible = node.visible;
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
var checkedKeys = this.$refs.tree.getCheckedKeys();
|
|
2143
|
+
var halfCheckedKeys = this.$refs.tree.getHalfCheckedKeys();
|
|
2144
|
+
this.allCheckedKeys = checkedKeys.concat(halfCheckedKeys);
|
|
2145
|
+
},
|
|
2146
|
+
hideOrShowColumns: function hideOrShowColumns(visible) {
|
|
2147
|
+
setColumnsVisible(this.columns);
|
|
2148
|
+
function setColumnsVisible(columns) {
|
|
2149
|
+
columns.forEach(function(col) {
|
|
2150
|
+
if (col.children) {
|
|
2151
|
+
setColumnsVisible(col.children);
|
|
2152
|
+
}
|
|
2153
|
+
col.visible = visible;
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
},
|
|
2157
|
+
getRowClassName: function getRowClassName(row) {
|
|
2158
|
+
if (typeof this.rowClassName === "function") {
|
|
2159
|
+
return this.rowClassName({
|
|
2160
|
+
row
|
|
2161
|
+
});
|
|
2162
|
+
} else {
|
|
2163
|
+
return this.rowClassName;
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
getColumnConfigs: function getColumnConfigs3(configs) {
|
|
2167
|
+
var _this18 = this;
|
|
2168
|
+
var alwaysShowColumns = this.alwaysShowColumns;
|
|
2169
|
+
this.colIds = [];
|
|
2170
|
+
var _getColNodes3 = function getColNodes(columns2) {
|
|
2171
|
+
return columns2.map(function(_ref9) {
|
|
2172
|
+
var id = _ref9.id, title = _ref9.title, property = _ref9.property, fixed = _ref9.fixed, visible = _ref9.visible, order = _ref9.order, sortable = _ref9.sortable, level = _ref9.level, children = _ref9.children;
|
|
2173
|
+
if (property) {
|
|
2174
|
+
var column = {
|
|
2175
|
+
id,
|
|
2176
|
+
title,
|
|
2177
|
+
property,
|
|
2178
|
+
alwaysShow: alwaysShowColumns.includes(property),
|
|
2179
|
+
fixed,
|
|
2180
|
+
visible,
|
|
2181
|
+
order,
|
|
2182
|
+
sortable,
|
|
2183
|
+
level,
|
|
2184
|
+
children,
|
|
2185
|
+
numberSortVisible: false,
|
|
2186
|
+
expand: true
|
|
2187
|
+
};
|
|
2188
|
+
children && (column.children = _getColNodes3(children));
|
|
2189
|
+
_this18.colIds.push(id);
|
|
2190
|
+
return column;
|
|
2191
|
+
}
|
|
2192
|
+
return null;
|
|
2193
|
+
}).filter(function(i) {
|
|
2194
|
+
return i;
|
|
2195
|
+
});
|
|
2196
|
+
};
|
|
2197
|
+
if (configs.length && this.$grid) {
|
|
2198
|
+
var _this$$grid$getTableC3 = this.$grid.getTableColumn(), collectColumn = _this$$grid$getTableC3.collectColumn;
|
|
2199
|
+
var columns = _getColNodes3(collectColumn);
|
|
2200
|
+
this.originColumns = [].concat(columns);
|
|
2201
|
+
var sortColumns = this.initSortingColumns(columns);
|
|
2202
|
+
this.initSortAndFixedOption(columns);
|
|
2203
|
+
return sortColumns;
|
|
2204
|
+
} else {
|
|
2205
|
+
return [];
|
|
2206
|
+
}
|
|
2207
|
+
},
|
|
2208
|
+
initSortAndFixedOption: function initSortAndFixedOption(columns) {
|
|
2209
|
+
var _this19 = this;
|
|
2210
|
+
columns.forEach(function(column) {
|
|
2211
|
+
column.sortOption = column.order === "asc" ? [_this19.opt.desc, _this19.opt.cancelSort] : column.order === "desc" ? [_this19.opt.asc, _this19.opt.cancelSort] : [_this19.opt.asc, _this19.opt.desc];
|
|
2212
|
+
column.fixedOption = column.fixed === "left" ? [_this19.opt.right, _this19.opt.cancelFixed] : column.fixed === "right" ? [_this19.opt.left, _this19.opt.cancelFixed] : [_this19.opt.left, _this19.opt.right];
|
|
2213
|
+
});
|
|
2214
|
+
},
|
|
2215
|
+
initSortingColumns: function initSortingColumns(columns) {
|
|
2216
|
+
var leftCols = [];
|
|
2217
|
+
var rightCols = [];
|
|
2218
|
+
var visibleCols = [];
|
|
2219
|
+
columns.forEach(function(col) {
|
|
2220
|
+
if (col.fixed === "left") {
|
|
2221
|
+
leftCols.push(col);
|
|
2222
|
+
} else if (col.fixed === "right") {
|
|
2223
|
+
rightCols.push(col);
|
|
2224
|
+
} else {
|
|
2225
|
+
visibleCols.push(col);
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2228
|
+
var result = [].concat(leftCols, visibleCols, rightCols);
|
|
2229
|
+
this.updateSortingIndex();
|
|
2230
|
+
return result;
|
|
2231
|
+
},
|
|
2232
|
+
getGroupedColumns: function getGroupedColumns() {
|
|
2233
|
+
var _this20 = this;
|
|
2234
|
+
var result = [];
|
|
2235
|
+
if (this.columnsGroup.length) {
|
|
2236
|
+
this.columnsGroup.forEach(function(item) {
|
|
2237
|
+
var data6 = [];
|
|
2238
|
+
item.data.forEach(function(col) {
|
|
2239
|
+
var column = _this20.originColumns.find(function(c) {
|
|
2240
|
+
return c.property === col;
|
|
2241
|
+
});
|
|
2242
|
+
if (column) {
|
|
2243
|
+
data6.push(column);
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
result.push({
|
|
2247
|
+
label: item.label,
|
|
2248
|
+
data: data6
|
|
2249
|
+
});
|
|
2250
|
+
});
|
|
2251
|
+
} else {
|
|
2252
|
+
result.push({
|
|
2253
|
+
label: "",
|
|
2254
|
+
data: [].concat(this.originColumns)
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
return result;
|
|
2258
|
+
},
|
|
2259
|
+
getDefaultcheckedkeys: function getDefaultcheckedkeys() {
|
|
2260
|
+
var checkedkeys = [];
|
|
2261
|
+
getCheckedkeys(this.columns);
|
|
2262
|
+
function getCheckedkeys(columns) {
|
|
2263
|
+
columns.forEach(function(col) {
|
|
2264
|
+
if (col.children) {
|
|
2265
|
+
getCheckedkeys(col.children);
|
|
2266
|
+
} else {
|
|
2267
|
+
col.visible && checkedkeys.push(col.id);
|
|
2268
|
+
}
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
return checkedkeys;
|
|
2272
|
+
},
|
|
2273
|
+
deleteTemplate: function deleteTemplate(item, $event) {
|
|
2274
|
+
var _this21 = this;
|
|
2275
|
+
$event.stopPropagation();
|
|
2276
|
+
Modal.confirm(t("ui.grid.individuation.switchdelcon"), t("ui.grid.individuation.switchdelconfirm")).then(function(res) {
|
|
2277
|
+
if (res === "confirm") {
|
|
2278
|
+
if (!_this21.setting.remote && item.id === _this21.selectedTemplate) {
|
|
2279
|
+
_this21.selectedTemplate = "";
|
|
2280
|
+
setTimeout(function() {
|
|
2281
|
+
_this21.templateOptions = _this21.$refs.switch.options;
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
_this21.$refs.switch.handleDelConfirm("yes", item);
|
|
2285
|
+
_this21.$emit("delete-template", item);
|
|
2286
|
+
}
|
|
2287
|
+
});
|
|
2288
|
+
},
|
|
2289
|
+
selectedTemplateChange: function selectedTemplateChange() {
|
|
2290
|
+
var _this22 = this;
|
|
2291
|
+
var selected = this.templateOptions.find(function(opt) {
|
|
2292
|
+
return opt.id === _this22.selectedTemplate;
|
|
2293
|
+
});
|
|
2294
|
+
if (selected) {
|
|
2295
|
+
this.columns = mergeArray(this.columns, selected.setting.custom.columns);
|
|
2296
|
+
this.columns = this.initSortingColumns(this.columns);
|
|
2297
|
+
this.initSortAndFixedOption(this.columns);
|
|
2298
|
+
this.groupedColumns = this.getGroupedColumns();
|
|
2299
|
+
this.isGroup && (this.defaultcheckedkeys = this.getDefaultcheckedkeys());
|
|
2300
|
+
this.checkedColumns = this.columns.filter(function(col) {
|
|
2301
|
+
return col.visible;
|
|
2302
|
+
}).map(function(col) {
|
|
2303
|
+
return col.property;
|
|
2304
|
+
});
|
|
2305
|
+
this.settings.pageSize = selected.setting.custom.pageSize;
|
|
2306
|
+
this.multipleHistoryId = selected.id;
|
|
2307
|
+
this.updatedSorting = true;
|
|
2308
|
+
if (this.$refs.tree) {
|
|
2309
|
+
setTimeout(function() {
|
|
2310
|
+
_this22.allCheckedKeys = [].concat(_this22.$refs.tree.getCheckedKeys(), _this22.$refs.tree.getHalfCheckedKeys());
|
|
2311
|
+
}, 100);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
},
|
|
2315
|
+
updateSelectedTemplate: function updateSelectedTemplate(val) {
|
|
2316
|
+
this.selectedTemplate = val;
|
|
2317
|
+
this.selectedTemplateChange();
|
|
2318
|
+
},
|
|
2319
|
+
sortSelectChange: function sortSelectChange(index) {
|
|
2320
|
+
var newIndex = index - 1;
|
|
2321
|
+
var oldIndex = this.lastSelectIndex - 1;
|
|
2322
|
+
this.handleFixed("sort", 1, 1, oldIndex, newIndex);
|
|
2323
|
+
},
|
|
2324
|
+
selectFocus: function selectFocus(event, index) {
|
|
2325
|
+
this.lastSelectIndex = index;
|
|
2326
|
+
},
|
|
2327
|
+
// 勿同步,search组件input事件第一个参数就是val
|
|
2328
|
+
searchChange: function searchChange(val) {
|
|
2329
|
+
var _this23 = this;
|
|
2330
|
+
var getRenderedTitle = function getRenderedTitle2(col) {
|
|
2331
|
+
var result = "";
|
|
2332
|
+
if (typeof col.title === "function") {
|
|
2333
|
+
var titleElm = _this23.$el.querySelector(".custom-saas-title-render." + col.id);
|
|
2334
|
+
result = titleElm && titleElm.textContent || "";
|
|
2335
|
+
result = result.toUpperCase();
|
|
2336
|
+
} else if (col.title) {
|
|
2337
|
+
result = col.title && col.title.toUpperCase();
|
|
2338
|
+
}
|
|
2339
|
+
return result;
|
|
2340
|
+
};
|
|
2341
|
+
if (this.isGroup) {
|
|
2342
|
+
this.$refs.tree.filter(val);
|
|
2343
|
+
} else {
|
|
2344
|
+
this.searchColumns = this.columns.filter(function(col) {
|
|
2345
|
+
var title = getRenderedTitle(col);
|
|
2346
|
+
var upperVal = val && val.toUpperCase();
|
|
2347
|
+
return title.includes(upperVal);
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
},
|
|
2351
|
+
filterTreeNode: function filterTreeNode(value3, data6) {
|
|
2352
|
+
if (!value3) return true;
|
|
2353
|
+
var label = data6.label || "";
|
|
2354
|
+
if (typeof data6.label !== "string") {
|
|
2355
|
+
label = data6.label.toString();
|
|
2356
|
+
}
|
|
2357
|
+
return label.includes(value3);
|
|
2358
|
+
},
|
|
2359
|
+
handelClearAll: function handelClearAll() {
|
|
2360
|
+
this.checkedColumns = [].concat(this.alwaysShowColumns);
|
|
2361
|
+
},
|
|
2362
|
+
hiddenColumn: function hiddenColumn(val) {
|
|
2363
|
+
var index = this.checkedColumns.findIndex(function(col) {
|
|
2364
|
+
return col === val;
|
|
2365
|
+
});
|
|
2366
|
+
this.checkedColumns.splice(index, 1);
|
|
2367
|
+
},
|
|
2368
|
+
handleSortItemClick: function handleSortItemClick(item) {
|
|
2369
|
+
var column = this.columns.find(function(col) {
|
|
2370
|
+
return col.property === item.property;
|
|
2371
|
+
});
|
|
2372
|
+
if (column) {
|
|
2373
|
+
column.order = item.value === "cancel" ? void 0 : item.value;
|
|
2374
|
+
column.sortOption = column.order === "asc" ? [this.opt.desc, this.opt.cancelSort] : column.order === "desc" ? [this.opt.asc, this.opt.cancelSort] : [this.opt.asc, this.opt.desc];
|
|
2375
|
+
}
|
|
2376
|
+
},
|
|
2377
|
+
// TODO: 待完善具体类型 vm dropdown组件示例
|
|
2378
|
+
handleFixedItemClick: function handleFixedItemClick(itemData, vm) {
|
|
2379
|
+
var item;
|
|
2380
|
+
if (vm) {
|
|
2381
|
+
item = itemData;
|
|
2382
|
+
} else {
|
|
2383
|
+
item = itemData == null ? void 0 : itemData.itemData;
|
|
2384
|
+
}
|
|
2385
|
+
var index = this.columns.findIndex(function(col) {
|
|
2386
|
+
return col.property === item.property;
|
|
2387
|
+
});
|
|
2388
|
+
var column = this.columns[index];
|
|
2389
|
+
item.fixed = column.fixed;
|
|
2390
|
+
if (column) {
|
|
2391
|
+
if (position.includes(item.value) && !position.includes(column.fixed) && this.fixedNumberIsMax()) {
|
|
2392
|
+
Modal.message({
|
|
2393
|
+
message: t("ui.grid.individuation.maxFreezeNumMsg"),
|
|
2394
|
+
status: "warning",
|
|
2395
|
+
id: "drop-fixed-max-waring"
|
|
2396
|
+
});
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
this.columns.splice(index, 1);
|
|
2400
|
+
this.updatedSorting = true;
|
|
2401
|
+
var leftIdx = this.columns.reduce(function(result, col, index2) {
|
|
2402
|
+
return col.fixed === "left" && col.visible ? index2 : result;
|
|
2403
|
+
}, -1);
|
|
2404
|
+
var rightIdx = this.columns.findIndex(function(col) {
|
|
2405
|
+
return col.fixed === "right" && col.visible;
|
|
2406
|
+
});
|
|
2407
|
+
column.fixed = item.value === "cancel" ? void 0 : item.value;
|
|
2408
|
+
if (item.value === "left") {
|
|
2409
|
+
this.columns.splice(leftIdx >= 0 ? leftIdx + 1 : 0, 0, column);
|
|
2410
|
+
column.fixedOption = [this.opt.right, this.opt.cancelFixed];
|
|
2411
|
+
} else if (item.value === "right") {
|
|
2412
|
+
this.columns.splice(rightIdx >= 0 ? rightIdx : this.columns.length, 0, column);
|
|
2413
|
+
column.fixedOption = [this.opt.left, this.opt.cancelFixed];
|
|
2414
|
+
} else {
|
|
2415
|
+
if (item.fixed === "left" && leftIdx >= 0) {
|
|
2416
|
+
this.columns.splice(leftIdx + 1, 0, column);
|
|
2417
|
+
} else if (item.fixed === "right" && rightIdx >= 0) {
|
|
2418
|
+
this.columns.splice(rightIdx, 0, column);
|
|
2419
|
+
} else {
|
|
2420
|
+
this.columns.splice(index, 0, column);
|
|
2421
|
+
}
|
|
2422
|
+
column.fixedOption = [this.opt.left, this.opt.right];
|
|
2423
|
+
}
|
|
2424
|
+
this.updateSortingIndex();
|
|
2425
|
+
}
|
|
2426
|
+
},
|
|
2427
|
+
fixedNumberIsMax: function fixedNumberIsMax() {
|
|
2428
|
+
return this.columns.filter(function(col) {
|
|
2429
|
+
return col.visible && col.fixed;
|
|
2430
|
+
}).length >= this.maxFixedNum;
|
|
2431
|
+
},
|
|
2432
|
+
updateSortingIndex: function updateSortingIndex() {
|
|
2433
|
+
var _this24 = this;
|
|
2434
|
+
this.sortingOptions = [];
|
|
2435
|
+
var index = 1;
|
|
2436
|
+
this.columns.forEach(function(column) {
|
|
2437
|
+
if (column.visible) {
|
|
2438
|
+
column.sortingIndex = index;
|
|
2439
|
+
_this24.sortingOptions.push(column.sortingIndex);
|
|
2440
|
+
index++;
|
|
2441
|
+
} else {
|
|
2442
|
+
column.sortingIndex = null;
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
},
|
|
2446
|
+
handleDropdownMouseenter: function handleDropdownMouseenter($event, index) {
|
|
2447
|
+
var childNode = this.$refs.list.children[index];
|
|
2448
|
+
childNode && childNode.classList.add("show-dropdown");
|
|
2449
|
+
},
|
|
2450
|
+
handleDropdownMouseleave: function handleDropdownMouseleave($event, index) {
|
|
2451
|
+
var childNode = this.$refs.list.children[index];
|
|
2452
|
+
childNode && childNode.classList.remove("show-dropdown");
|
|
2453
|
+
},
|
|
2454
|
+
handleMouseenter: function handleMouseenter($event) {
|
|
2455
|
+
var dom = $event.target;
|
|
2456
|
+
var text = dom.textContent;
|
|
2457
|
+
var tooltip = this.$refs.tooltip;
|
|
2458
|
+
if (dom.scrollWidth > dom.offsetWidth) {
|
|
2459
|
+
tooltip.state.referenceElm = dom;
|
|
2460
|
+
tooltip.state.popperElm && (tooltip.state.popperElm.style.display = "none");
|
|
2461
|
+
tooltip.doDestroy();
|
|
2462
|
+
this.tooltipVisible = true;
|
|
2463
|
+
this.tooltipContent = text;
|
|
2464
|
+
setTimeout(tooltip.updatePopper, 20);
|
|
2465
|
+
}
|
|
2466
|
+
},
|
|
2467
|
+
handleMouseleave: function handleMouseleave() {
|
|
2468
|
+
this.tooltipVisible = false;
|
|
2469
|
+
},
|
|
2470
|
+
handleInput: function handleInput2(val) {
|
|
2471
|
+
this.$emit("input", val);
|
|
2472
|
+
},
|
|
2473
|
+
buildSettings: function buildSettings2() {
|
|
2474
|
+
var props = ["order", "fixed", "visible", "sortable"].concat(this.keys);
|
|
2475
|
+
!this.updatedSorting && !this.columnsGroup.length && (this.columns = [].concat(this.groupedColumns[0].data));
|
|
2476
|
+
this.settings.columns = mapTree(this.columns, function(_ref10) {
|
|
2477
|
+
var property = _ref10.property, rest = _objectWithoutPropertiesLoose2(_ref10, _excluded3);
|
|
2478
|
+
var node = {
|
|
2479
|
+
property
|
|
2480
|
+
};
|
|
2481
|
+
props.forEach(function(prop) {
|
|
2482
|
+
node[prop] = rest[prop];
|
|
2483
|
+
});
|
|
2484
|
+
return node;
|
|
2485
|
+
});
|
|
2486
|
+
return this.settings;
|
|
2487
|
+
},
|
|
2488
|
+
saveSettings: function saveSettings2(val) {
|
|
2489
|
+
var _this25 = this;
|
|
2490
|
+
var visible = typeof val === "boolean" ? val : false;
|
|
2491
|
+
this.buildSettings();
|
|
2492
|
+
this.$emit("saveSettings", this.settings, visible, this.updatedSorting);
|
|
2493
|
+
if (this.multipleHistory && this.selectedTemplate) {
|
|
2494
|
+
var selected = this.templateOptions.find(function(opt) {
|
|
2495
|
+
return opt.id === _this25.selectedTemplate;
|
|
2496
|
+
});
|
|
2497
|
+
if (selected && JSON.stringify(selected.setting.custom.columns) !== JSON.stringify(this.settings.columns)) {
|
|
2498
|
+
this.$refs.switch.handleSaveConfirm("overwrite", true);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
!visible && this.handleClose();
|
|
2502
|
+
},
|
|
2503
|
+
resetSettings: function resetSettings2(event) {
|
|
2504
|
+
var _this26 = this;
|
|
2505
|
+
if (this.activeName === "base") {
|
|
2506
|
+
this.columns = this.getColumnConfigs(this.data);
|
|
2507
|
+
this.checkedColumns = this.columns.filter(function(col) {
|
|
2508
|
+
return col.visible;
|
|
2509
|
+
}).map(function(col) {
|
|
2510
|
+
return col.property;
|
|
2511
|
+
});
|
|
2512
|
+
if (this.settings.columns && this.settings.columns.length) {
|
|
2513
|
+
this.settings.columns.forEach(function(setting) {
|
|
2514
|
+
var column = find(_this26.columns, function(item) {
|
|
2515
|
+
return item.property === setting.property;
|
|
2516
|
+
});
|
|
2517
|
+
if (column) {
|
|
2518
|
+
Object.assign(setting, column);
|
|
2519
|
+
}
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
} else if (this.activeName === "other") {
|
|
2523
|
+
this.settings.pageSize = this.initSettings.pageSize;
|
|
2524
|
+
}
|
|
2525
|
+
event && this.$emit("resetSettings", this.settings);
|
|
2526
|
+
},
|
|
2527
|
+
cancelSettings: function cancelSettings2() {
|
|
2528
|
+
this.resetSettings();
|
|
2529
|
+
this.$emit("cancelSettings");
|
|
2530
|
+
this.$emit("input", false);
|
|
2531
|
+
this.handleClose();
|
|
2532
|
+
},
|
|
2533
|
+
handleClose: function handleClose2() {
|
|
2534
|
+
this.updatedSorting = false;
|
|
2535
|
+
this.$emit("showModal", false);
|
|
2536
|
+
},
|
|
2537
|
+
handleReset: function handleReset2(event) {
|
|
2538
|
+
var _this27 = this;
|
|
2539
|
+
var equal = function equal2(cols1, cols2) {
|
|
2540
|
+
var props1 = [];
|
|
2541
|
+
var props2 = [];
|
|
2542
|
+
cols1.forEach(function(col) {
|
|
2543
|
+
return col && col.property && props1.push(col.property);
|
|
2544
|
+
});
|
|
2545
|
+
cols2.forEach(function(col) {
|
|
2546
|
+
return col && col.property && props2.push(col.property);
|
|
2547
|
+
});
|
|
2548
|
+
return props1.length === props2.length && props1.sort().join(",") === props2.sort().join(",");
|
|
2549
|
+
};
|
|
2550
|
+
if (typeof this.resetMethod === "function") {
|
|
2551
|
+
this.resetMethod().then(function(sourceSettings) {
|
|
2552
|
+
_this27.updatedSorting = true;
|
|
2553
|
+
_this27.buildSettings();
|
|
2554
|
+
var _ref11 = sourceSettings || {}, columns = _ref11.columns, sortType = _ref11.sortType, pageSize = _ref11.pageSize;
|
|
2555
|
+
if (columns && columns.length && _this27.settings.columns && _this27.settings.columns.length) {
|
|
2556
|
+
_this27.settings.columns.forEach(function(setting) {
|
|
2557
|
+
var source = find(columns, function(item) {
|
|
2558
|
+
return item.property === setting.property;
|
|
2559
|
+
});
|
|
2560
|
+
var target = find(_this27.columns, function(item) {
|
|
2561
|
+
return item.property === setting.property;
|
|
2562
|
+
});
|
|
2563
|
+
if (source) {
|
|
2564
|
+
Object.assign(setting, source);
|
|
2565
|
+
Object.assign(target, source);
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
if (equal(columns, _this27.settings.columns)) {
|
|
2569
|
+
var settingColumns = [];
|
|
2570
|
+
var gridColumns = [];
|
|
2571
|
+
columns.forEach(function(source) {
|
|
2572
|
+
var settingCol = find(_this27.settings.columns, function(item) {
|
|
2573
|
+
return source.property === item.property;
|
|
2574
|
+
});
|
|
2575
|
+
var targetCol = find(_this27.columns, function(item) {
|
|
2576
|
+
return source.property === item.property;
|
|
2577
|
+
});
|
|
2578
|
+
settingColumns.push(settingCol);
|
|
2579
|
+
gridColumns.push(targetCol);
|
|
2580
|
+
});
|
|
2581
|
+
_this27.settings.columns = settingColumns;
|
|
2582
|
+
_this27.columns = gridColumns;
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
sortType && (_this27.settings.sortType = sortType);
|
|
2586
|
+
pageSize && (_this27.settings.pageSize = pageSize);
|
|
2587
|
+
_this27.checkedColumns = _this27.columns.filter(function(col) {
|
|
2588
|
+
return col.visible;
|
|
2589
|
+
}).map(function(col) {
|
|
2590
|
+
return col.property;
|
|
2591
|
+
});
|
|
2592
|
+
});
|
|
2593
|
+
} else {
|
|
2594
|
+
this.resetSettings(event);
|
|
2595
|
+
}
|
|
2596
|
+
},
|
|
2597
|
+
handleFixed: function handleFixed2(type, from, to, oldIndex, newIndex) {
|
|
2598
|
+
if (from === to && oldIndex !== newIndex) {
|
|
2599
|
+
!this.columnsSorted && this.columnsSorting();
|
|
2600
|
+
var newCol = this.visibleColumns[newIndex];
|
|
2601
|
+
var oldCol = this.visibleColumns[oldIndex];
|
|
2602
|
+
if (type === "sort" && position.includes(newCol.fixed) && !position.includes(oldCol.fixed) && this.fixedNumberIsMax()) {
|
|
2603
|
+
this.visibleColumns[oldIndex].sortingIndex = this.lastSelectIndex;
|
|
2604
|
+
Modal.message({
|
|
2605
|
+
message: t("ui.grid.individuation.maxFreezeNumMsg"),
|
|
2606
|
+
status: "warning",
|
|
2607
|
+
id: "select-fixed-max-waring"
|
|
2608
|
+
});
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
if (newCol.fixed === "left") {
|
|
2612
|
+
oldCol.fixed = "left";
|
|
2613
|
+
oldCol.fixedOption = [this.opt.right, this.opt.cancelFixed];
|
|
2614
|
+
} else if (newCol.fixed === "right") {
|
|
2615
|
+
oldCol.fixed = "right";
|
|
2616
|
+
oldCol.fixedOption = [this.opt.left, this.opt.cancelFixed];
|
|
2617
|
+
} else {
|
|
2618
|
+
oldCol.fixed = void 0;
|
|
2619
|
+
oldCol.fixedOption = [this.opt.left, this.opt.right];
|
|
2620
|
+
}
|
|
2621
|
+
var curIndex = this.columns.findIndex(function(col) {
|
|
2622
|
+
return col.property === oldCol.property;
|
|
2623
|
+
});
|
|
2624
|
+
this.columns.splice(curIndex, 1);
|
|
2625
|
+
this.columns.splice(newIndex, 0, oldCol);
|
|
2626
|
+
this.updateSortingIndex();
|
|
2627
|
+
this.updatedSorting = true;
|
|
2628
|
+
}
|
|
2629
|
+
},
|
|
2630
|
+
columnsSorting: function columnsSorting() {
|
|
2631
|
+
var visibleColumns2 = [];
|
|
2632
|
+
var hiddenColumns = [];
|
|
2633
|
+
this.columns.forEach(function(col) {
|
|
2634
|
+
if (col.visible) {
|
|
2635
|
+
visibleColumns2.push(col);
|
|
2636
|
+
} else {
|
|
2637
|
+
hiddenColumns.push(col);
|
|
2638
|
+
}
|
|
2639
|
+
});
|
|
2640
|
+
this.columns = [].concat(visibleColumns2, hiddenColumns);
|
|
2641
|
+
this.columnsSorted = true;
|
|
2642
|
+
},
|
|
2643
|
+
initDragEvent: function initDragEvent() {
|
|
2644
|
+
var _this28 = this;
|
|
2645
|
+
var handleUpdate = function handleUpdate2(e) {
|
|
2646
|
+
var from = e.from, to = e.to, oldIndex = e.oldIndex, newIndex = e.newIndex;
|
|
2647
|
+
_this28.handleFixed("drag", from, to, oldIndex, newIndex);
|
|
2648
|
+
};
|
|
2649
|
+
if (!this.dropConfig.plugin) return;
|
|
2650
|
+
this.dropConfig.plugin.create(this.$refs.list, {
|
|
2651
|
+
animation: 200,
|
|
2652
|
+
draggable: '[data-tag="tiny-grid-toolbar-item"]',
|
|
2653
|
+
handle: ".toolbar-drag-item",
|
|
2654
|
+
onUpdate: handleUpdate,
|
|
2655
|
+
onMove: function onMove(e) {
|
|
2656
|
+
if (e.related && (e.related.classList.contains("left") || e.related.classList.contains("right")) && !(e.dragged.classList.contains("left") || e.dragged.classList.contains("right")) && _this28.fixedNumberIsMax()) {
|
|
2657
|
+
Modal.message({
|
|
2658
|
+
message: t("ui.grid.individuation.maxFreezeNumMsg"),
|
|
2659
|
+
status: "warning",
|
|
2660
|
+
id: "drag-fixed-max-waring"
|
|
2661
|
+
});
|
|
2662
|
+
return false;
|
|
2663
|
+
}
|
|
2664
|
+
var rowName = e.dragged && e.dragged.getAttribute("data-row");
|
|
2665
|
+
var row = _this28.columns.find(function(row2) {
|
|
2666
|
+
return row2.property === rowName;
|
|
2667
|
+
}) || {};
|
|
2668
|
+
var cancel = typeof _this28.onBeforeMove === "function" ? _this28.onBeforeMove("row", row, e) : true;
|
|
2669
|
+
return cancel === void 0 || cancel;
|
|
2670
|
+
}
|
|
2671
|
+
});
|
|
2672
|
+
},
|
|
2673
|
+
clickSortDisplay: function clickSortDisplay(column, index) {
|
|
2674
|
+
var _this29 = this;
|
|
2675
|
+
column.numberSortVisible = true;
|
|
2676
|
+
this.columns.forEach(function(col) {
|
|
2677
|
+
return col !== column && (col.numberSortVisible = false);
|
|
2678
|
+
});
|
|
2679
|
+
this.$nextTick(function() {
|
|
2680
|
+
var selectVm = _this29.$refs["select" + index];
|
|
2681
|
+
selectVm = isArray(selectVm) && selectVm[0] ? selectVm[0] : null;
|
|
2682
|
+
if (selectVm) {
|
|
2683
|
+
selectVm.focus();
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2686
|
+
},
|
|
2687
|
+
clickEditorOutside: function clickEditorOutside() {
|
|
2688
|
+
this.columns.forEach(function(col) {
|
|
2689
|
+
return col.numberSortVisible = false;
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
var render2 = function render3() {
|
|
2695
|
+
var _vm = this;
|
|
2696
|
+
var _h = _vm.$createElement;
|
|
2697
|
+
var _c = _vm._self._c || _h;
|
|
2698
|
+
return _c("tiny-modal", {
|
|
2699
|
+
staticClass: "tiny-grid-toolbar-modal",
|
|
2700
|
+
attrs: {
|
|
2701
|
+
"width": "800",
|
|
2702
|
+
"title": " "
|
|
2703
|
+
},
|
|
2704
|
+
on: {
|
|
2705
|
+
"input": _vm.handleInput,
|
|
2706
|
+
"close": _vm.handleClose
|
|
2707
|
+
},
|
|
2708
|
+
scopedSlots: _vm._u([{
|
|
2709
|
+
key: "default",
|
|
2710
|
+
fn: function fn() {
|
|
2711
|
+
return [_vm.visible ? _c("div", {
|
|
2712
|
+
staticClass: "tiny-grid-custom"
|
|
2713
|
+
}, [_c("div", {
|
|
2714
|
+
staticClass: "tiny-grid-custom__tabs"
|
|
2715
|
+
}, [_c("div", {
|
|
2716
|
+
staticClass: "tiny-grid-custom__tabs-head"
|
|
2717
|
+
}, [_c("ul", [_c("li", {
|
|
2718
|
+
class: {
|
|
2719
|
+
"tiny-grid-custom__tabs-selected": _vm.activeName === "base" && _vm.other,
|
|
2720
|
+
"tiny-grid-custom__tabs-base": !_vm.other
|
|
2721
|
+
},
|
|
2722
|
+
on: {
|
|
2723
|
+
"click": function click($event) {
|
|
2724
|
+
_vm.activeName = "base";
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.t("ui.grid.individuation.columnSet")))])]), _vm.other ? _c("li", {
|
|
2728
|
+
class: {
|
|
2729
|
+
"tiny-grid-custom__tabs-selected": _vm.activeName === "other"
|
|
2730
|
+
},
|
|
2731
|
+
on: {
|
|
2732
|
+
"click": function click($event) {
|
|
2733
|
+
_vm.activeName = "other";
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.title")))])]) : _vm._e()])]), _c("div", {
|
|
2737
|
+
staticClass: "tiny-grid-custom__tabs-body"
|
|
2738
|
+
}, [_c("div", {
|
|
2739
|
+
directives: [{
|
|
2740
|
+
name: "show",
|
|
2741
|
+
rawName: "v-show",
|
|
2742
|
+
value: _vm.activeName === "base",
|
|
2743
|
+
expression: "activeName === 'base'"
|
|
2744
|
+
}],
|
|
2745
|
+
class: ["tabs-body-item", _vm.animateShow === "base" ? "active-item" : ""]
|
|
2746
|
+
}, [_c("tiny-split", {
|
|
2747
|
+
attrs: {
|
|
2748
|
+
"trigger-simple": "",
|
|
2749
|
+
"collapse-left-top": ""
|
|
2750
|
+
},
|
|
2751
|
+
scopedSlots: _vm._u([{
|
|
2752
|
+
key: "left",
|
|
2753
|
+
fn: function fn2() {
|
|
2754
|
+
return [_c("div", {
|
|
2755
|
+
staticClass: "left-panel"
|
|
2756
|
+
}, [_vm.multipleHistory ? _c("div", {
|
|
2757
|
+
staticClass: "select-template"
|
|
2758
|
+
}, [_c("tiny-select", {
|
|
2759
|
+
attrs: {
|
|
2760
|
+
"shape": "filter",
|
|
2761
|
+
"label": _vm.t("ui.grid.individuation.selectTemplate"),
|
|
2762
|
+
"clearable": ""
|
|
2763
|
+
},
|
|
2764
|
+
on: {
|
|
2765
|
+
"change": _vm.selectedTemplateChange
|
|
2766
|
+
},
|
|
2767
|
+
model: {
|
|
2768
|
+
value: _vm.selectedTemplate,
|
|
2769
|
+
callback: function callback($$v) {
|
|
2770
|
+
_vm.selectedTemplate = $$v;
|
|
2771
|
+
},
|
|
2772
|
+
expression: "selectedTemplate"
|
|
2773
|
+
}
|
|
2774
|
+
}, _vm._l(_vm.templateOptions, function(item) {
|
|
2775
|
+
return _c("tiny-option", {
|
|
2776
|
+
key: item.id,
|
|
2777
|
+
attrs: {
|
|
2778
|
+
"label": item.name,
|
|
2779
|
+
"value": item.id
|
|
2780
|
+
}
|
|
2781
|
+
}, [_c("span", {
|
|
2782
|
+
staticStyle: {
|
|
2783
|
+
"float": "left",
|
|
2784
|
+
"width": "240px",
|
|
2785
|
+
"overflow": "hidden",
|
|
2786
|
+
"text-overflow": "ellipsis",
|
|
2787
|
+
"white-space": "nowrap"
|
|
2788
|
+
},
|
|
2789
|
+
attrs: {
|
|
2790
|
+
"title": item.name
|
|
2791
|
+
}
|
|
2792
|
+
}, [_vm._v(_vm._s(item.name))]), _vm.historyConfig.showDel ? _c("span", {
|
|
2793
|
+
staticStyle: {
|
|
2794
|
+
"float": "right",
|
|
2795
|
+
"padding": "0 6px",
|
|
2796
|
+
"color": "#1890ff",
|
|
2797
|
+
"cursor": "pointer"
|
|
2798
|
+
},
|
|
2799
|
+
on: {
|
|
2800
|
+
"click": function click($event) {
|
|
2801
|
+
return _vm.deleteTemplate(item, $event);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.switchdel")))]) : _vm._e()]);
|
|
2805
|
+
}), 1)], 1) : _vm._e(), _vm.search ? _c("tiny-search", {
|
|
2806
|
+
attrs: {
|
|
2807
|
+
"placeholder": _vm.t("ui.grid.individuation.toolbar.search")
|
|
2808
|
+
},
|
|
2809
|
+
on: {
|
|
2810
|
+
"input": _vm.searchChange
|
|
2811
|
+
},
|
|
2812
|
+
model: {
|
|
2813
|
+
value: _vm.searchValue,
|
|
2814
|
+
callback: function callback($$v) {
|
|
2815
|
+
_vm.searchValue = $$v;
|
|
2816
|
+
},
|
|
2817
|
+
expression: "searchValue"
|
|
2818
|
+
}
|
|
2819
|
+
}) : _vm._e(), _vm.isGroup ? _c("div", [!_vm.searchValue ? _c("div", {
|
|
2820
|
+
staticClass: "multi-check-all-btn"
|
|
2821
|
+
}, [_c("tiny-checkbox", {
|
|
2822
|
+
attrs: {
|
|
2823
|
+
"indeterminate": _vm.isMultiIndeterminate
|
|
2824
|
+
},
|
|
2825
|
+
on: {
|
|
2826
|
+
"change": _vm.checkAllChange
|
|
2827
|
+
},
|
|
2828
|
+
model: {
|
|
2829
|
+
value: _vm.multiCheckAll,
|
|
2830
|
+
callback: function callback($$v) {
|
|
2831
|
+
_vm.multiCheckAll = $$v;
|
|
2832
|
+
},
|
|
2833
|
+
expression: "multiCheckAll"
|
|
2834
|
+
}
|
|
2835
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.toolbar.all")) + " ")])], 1) : _vm._e(), _c("tiny-tree", {
|
|
2836
|
+
ref: "tree",
|
|
2837
|
+
attrs: {
|
|
2838
|
+
"data": _vm.columns,
|
|
2839
|
+
"default-expand-all": "",
|
|
2840
|
+
"check-on-click-node": "",
|
|
2841
|
+
"show-checkbox": "",
|
|
2842
|
+
"node-key": "id",
|
|
2843
|
+
"default-checked-keys": _vm.defaultcheckedkeys,
|
|
2844
|
+
"filter-node-method": _vm.filterTreeNode,
|
|
2845
|
+
"props": {
|
|
2846
|
+
label: "title"
|
|
2847
|
+
}
|
|
2848
|
+
},
|
|
2849
|
+
on: {
|
|
2850
|
+
"check": _vm.checkNode
|
|
2851
|
+
},
|
|
2852
|
+
scopedSlots: _vm._u([{
|
|
2853
|
+
key: "default",
|
|
2854
|
+
fn: function fn3(sourceData) {
|
|
2855
|
+
return [_c("div", {
|
|
2856
|
+
staticClass: "tiny-tree-node__label"
|
|
2857
|
+
}, [_c("title-render", {
|
|
2858
|
+
attrs: {
|
|
2859
|
+
"column": sourceData.data
|
|
2860
|
+
}
|
|
2861
|
+
})], 1)];
|
|
2862
|
+
}
|
|
2863
|
+
}], null, false, 3003057265)
|
|
2864
|
+
})], 1) : _c("div", [_vm.searchValue ? _c("div", [_c("tiny-checkbox-group", {
|
|
2865
|
+
attrs: {
|
|
2866
|
+
"vertical": ""
|
|
2867
|
+
},
|
|
2868
|
+
model: {
|
|
2869
|
+
value: _vm.checkedColumns,
|
|
2870
|
+
callback: function callback($$v) {
|
|
2871
|
+
_vm.checkedColumns = $$v;
|
|
2872
|
+
},
|
|
2873
|
+
expression: "checkedColumns"
|
|
2874
|
+
}
|
|
2875
|
+
}, _vm._l(_vm.searchColumns, function(column) {
|
|
2876
|
+
return _c("tiny-checkbox", {
|
|
2877
|
+
key: column.property,
|
|
2878
|
+
attrs: {
|
|
2879
|
+
"label": column.property,
|
|
2880
|
+
"disabled": column.alwaysShow
|
|
2881
|
+
}
|
|
2882
|
+
}, [_c("title-render", {
|
|
2883
|
+
attrs: {
|
|
2884
|
+
"column": column
|
|
2885
|
+
}
|
|
2886
|
+
})], 1);
|
|
2887
|
+
}), 1)], 1) : _c("div", [_c("div", {
|
|
2888
|
+
staticClass: "check-all-btn"
|
|
2889
|
+
}, [_c("tiny-checkbox", {
|
|
2890
|
+
attrs: {
|
|
2891
|
+
"indeterminate": _vm.isIndeterminate
|
|
2892
|
+
},
|
|
2893
|
+
model: {
|
|
2894
|
+
value: _vm.checkAll,
|
|
2895
|
+
callback: function callback($$v) {
|
|
2896
|
+
_vm.checkAll = $$v;
|
|
2897
|
+
},
|
|
2898
|
+
expression: "checkAll"
|
|
2899
|
+
}
|
|
2900
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.toolbar.all")) + " ")])], 1), _c("tiny-checkbox-group", {
|
|
2901
|
+
attrs: {
|
|
2902
|
+
"vertical": ""
|
|
2903
|
+
},
|
|
2904
|
+
model: {
|
|
2905
|
+
value: _vm.checkedColumns,
|
|
2906
|
+
callback: function callback($$v) {
|
|
2907
|
+
_vm.checkedColumns = $$v;
|
|
2908
|
+
},
|
|
2909
|
+
expression: "checkedColumns"
|
|
2910
|
+
}
|
|
2911
|
+
}, [_vm._l(_vm.groupedColumns, function(group, index) {
|
|
2912
|
+
return [_vm.defer(Math.floor(index / 5)) ? _c("div", {
|
|
2913
|
+
key: index
|
|
2914
|
+
}, [group.label ? _c("p", {
|
|
2915
|
+
staticClass: "group-label",
|
|
2916
|
+
class: [index === 0 && "group-label-first"]
|
|
2917
|
+
}, [_vm._v(" " + _vm._s(group.label) + " ")]) : _vm._e(), _vm._l(group.data, function(column) {
|
|
2918
|
+
return _c("tiny-checkbox", {
|
|
2919
|
+
key: column.property,
|
|
2920
|
+
attrs: {
|
|
2921
|
+
"label": column.property,
|
|
2922
|
+
"disabled": column.alwaysShow
|
|
2923
|
+
}
|
|
2924
|
+
}, [_c("title-render", {
|
|
2925
|
+
attrs: {
|
|
2926
|
+
"column": column
|
|
2927
|
+
}
|
|
2928
|
+
})], 1);
|
|
2929
|
+
})], 2) : _vm._e()];
|
|
2930
|
+
})], 2)], 1)])], 1)];
|
|
2931
|
+
},
|
|
2932
|
+
proxy: true
|
|
2933
|
+
}, {
|
|
2934
|
+
key: "right",
|
|
2935
|
+
fn: function fn2() {
|
|
2936
|
+
return [_c("div", {
|
|
2937
|
+
staticClass: "right-panel"
|
|
2938
|
+
}, [_c("div", {
|
|
2939
|
+
staticClass: "header"
|
|
2940
|
+
}, [_c("p", [_vm._v(" " + _vm._s(_vm.t("ui.grid.individuation.toolbar.selected")) + " (" + _vm._s(_vm.visibleColumns.length) + "/" + _vm._s(_vm.columns.length) + ") ")]), !_vm.setting.hideFixedColumn ? _c("span", [_vm._v(_vm._s(_vm.t("ui.grid.individuation.toolbar.freeze")))]) : _vm._e(), !_vm.setting.hideSortColumn ? _c("span", [_vm._v(_vm._s(_vm.t("ui.grid.individuation.toolbar.sort")))]) : _vm._e(), !_vm.isGroup ? _c("span", {
|
|
2941
|
+
staticClass: "clear-all",
|
|
2942
|
+
on: {
|
|
2943
|
+
"click": _vm.handelClearAll
|
|
2944
|
+
}
|
|
2945
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.toolbar.clear")))]) : _vm._e()]), _c("ul", {
|
|
2946
|
+
ref: "list",
|
|
2947
|
+
staticClass: "column-list-panel"
|
|
2948
|
+
}, _vm._l(_vm.visibleColumns, function(column, index) {
|
|
2949
|
+
return _c("li", {
|
|
2950
|
+
key: column.property + index,
|
|
2951
|
+
class: [column.fixed, _vm.getRowClassName(column), "column-list-item", !column.expand && "item-collapse"],
|
|
2952
|
+
attrs: {
|
|
2953
|
+
"data-tag": "tiny-grid-toolbar-item",
|
|
2954
|
+
"data-row": column.property
|
|
2955
|
+
}
|
|
2956
|
+
}, [_c("div", [_vm.defer(Math.floor(index / 3)) ? _c("div", {
|
|
2957
|
+
staticClass: "column-container",
|
|
2958
|
+
class: [!_vm.isGroup && "with-padding"]
|
|
2959
|
+
}, [_vm.dropConfig.plugin && !_vm.isGroup ? _c("div", {
|
|
2960
|
+
staticClass: "drag-icon toolbar-drag-item"
|
|
2961
|
+
}, [_c("span"), _c("span"), _c("span"), _c("span"), _c("span"), _c("span")]) : _vm._e(), _vm.isGroup && column.children ? _c("div", {
|
|
2962
|
+
staticClass: "toolbar-icon-expand",
|
|
2963
|
+
class: [column.expand && "toolbar-icon-collapse"]
|
|
2964
|
+
}, [_c("icon-chevron-right", {
|
|
2965
|
+
on: {
|
|
2966
|
+
"click": function click($event) {
|
|
2967
|
+
column.expand = !column.expand;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
})], 1) : _vm._e(), !_vm.isGroup ? _c("div", {
|
|
2971
|
+
staticClass: "sort-number"
|
|
2972
|
+
}, [column.numberSortVisible ? _c("div", {
|
|
2973
|
+
directives: [{
|
|
2974
|
+
name: "clickoutside",
|
|
2975
|
+
rawName: "v-clickoutside",
|
|
2976
|
+
value: _vm.clickEditorOutside,
|
|
2977
|
+
expression: "clickEditorOutside"
|
|
2978
|
+
}],
|
|
2979
|
+
staticClass: "sort-number-editor"
|
|
2980
|
+
}, [_c("tiny-select", {
|
|
2981
|
+
ref: "select" + index,
|
|
2982
|
+
refInFor: true,
|
|
2983
|
+
attrs: {
|
|
2984
|
+
"automatic-dropdown": ""
|
|
2985
|
+
},
|
|
2986
|
+
on: {
|
|
2987
|
+
"focus": function focus($event) {
|
|
2988
|
+
return _vm.selectFocus($event, column.sortingIndex);
|
|
2989
|
+
},
|
|
2990
|
+
"change": _vm.sortSelectChange
|
|
2991
|
+
},
|
|
2992
|
+
model: {
|
|
2993
|
+
value: column.sortingIndex,
|
|
2994
|
+
callback: function callback($$v) {
|
|
2995
|
+
_vm.$set(column, "sortingIndex", $$v);
|
|
2996
|
+
},
|
|
2997
|
+
expression: "column.sortingIndex"
|
|
2998
|
+
}
|
|
2999
|
+
}, _vm._l(_vm.sortingOptions, function(item) {
|
|
3000
|
+
return _c("tiny-option", {
|
|
3001
|
+
key: item,
|
|
3002
|
+
attrs: {
|
|
3003
|
+
"label": item,
|
|
3004
|
+
"value": item
|
|
3005
|
+
}
|
|
3006
|
+
});
|
|
3007
|
+
}), 1)], 1) : _c("div", {
|
|
3008
|
+
staticClass: "sort-number-display",
|
|
3009
|
+
on: {
|
|
3010
|
+
"click": function click($event) {
|
|
3011
|
+
return _vm.clickSortDisplay(column, index);
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
}, [_vm._v(" " + _vm._s(column.sortingIndex) + " ")])]) : _vm._e(), _c("p", {
|
|
3015
|
+
staticClass: "name toolbar-drag-item",
|
|
3016
|
+
class: [_vm.dropConfig.plugin && !_vm.isGroup && "dragable"],
|
|
3017
|
+
on: {
|
|
3018
|
+
"mouseenter": _vm.handleMouseenter,
|
|
3019
|
+
"mouseleave": _vm.handleMouseleave
|
|
3020
|
+
}
|
|
3021
|
+
}, [_c("title-render", {
|
|
3022
|
+
attrs: {
|
|
3023
|
+
"column": column
|
|
3024
|
+
}
|
|
3025
|
+
})], 1), !_vm.setting.hideFixedColumn && (!_vm.isGroup || !column.children) ? _c("div", {
|
|
3026
|
+
staticClass: "dropdown-column"
|
|
3027
|
+
}, [_c("tiny-dropdown", {
|
|
3028
|
+
attrs: {
|
|
3029
|
+
"show-icon": false,
|
|
3030
|
+
"trigger": "hover"
|
|
3031
|
+
},
|
|
3032
|
+
on: {
|
|
3033
|
+
"item-click": _vm.handleFixedItemClick
|
|
3034
|
+
},
|
|
3035
|
+
scopedSlots: _vm._u([{
|
|
3036
|
+
key: "dropdown",
|
|
3037
|
+
fn: function fn3() {
|
|
3038
|
+
return [_c("tiny-dropdown-menu", {
|
|
3039
|
+
on: {
|
|
3040
|
+
"mouseenter": function mouseenter($event) {
|
|
3041
|
+
return _vm.handleDropdownMouseenter($event, index);
|
|
3042
|
+
},
|
|
3043
|
+
"mouseleave": function mouseleave($event) {
|
|
3044
|
+
return _vm.handleDropdownMouseleave($event, index);
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
}, _vm._l(column.fixedOption, function(item) {
|
|
3048
|
+
return _c("tiny-dropdown-item", {
|
|
3049
|
+
key: item.value,
|
|
3050
|
+
attrs: {
|
|
3051
|
+
"label": item.label,
|
|
3052
|
+
"item-data": {
|
|
3053
|
+
value: item.value,
|
|
3054
|
+
property: column.property
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
}, [_vm._v(_vm._s(item.label))]);
|
|
3058
|
+
}), 1)];
|
|
3059
|
+
},
|
|
3060
|
+
proxy: true
|
|
3061
|
+
}], null, true)
|
|
3062
|
+
}, [_c("span", {
|
|
3063
|
+
class: ["left", "right"].includes(column.fixed) && "dropdown-btn"
|
|
3064
|
+
}, [column.fixed === "left" ? _c("icon-left-frozen") : column.fixed === "right" ? _c("icon-right-frozen") : _c("span", {
|
|
3065
|
+
staticClass: "set-btn"
|
|
3066
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.toolbar.set")))])], 1)])], 1) : _vm._e(), !_vm.setting.hideSortColumn ? _c("div", {
|
|
3067
|
+
staticClass: "dropdown-column",
|
|
3068
|
+
class: [!column.sortable && "visibility-hidden"]
|
|
3069
|
+
}, [_c("tiny-dropdown", {
|
|
3070
|
+
attrs: {
|
|
3071
|
+
"show-icon": false,
|
|
3072
|
+
"trigger": "hover"
|
|
3073
|
+
},
|
|
3074
|
+
on: {
|
|
3075
|
+
"item-click": _vm.handleSortItemClick
|
|
3076
|
+
},
|
|
3077
|
+
scopedSlots: _vm._u([{
|
|
3078
|
+
key: "dropdown",
|
|
3079
|
+
fn: function fn3() {
|
|
3080
|
+
return [_c("tiny-dropdown-menu", {
|
|
3081
|
+
on: {
|
|
3082
|
+
"mouseenter": function mouseenter($event) {
|
|
3083
|
+
return _vm.handleDropdownMouseenter($event, index);
|
|
3084
|
+
},
|
|
3085
|
+
"mouseleave": function mouseleave($event) {
|
|
3086
|
+
return _vm.handleDropdownMouseleave($event, index);
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
}, _vm._l(column.sortOption, function(item) {
|
|
3090
|
+
return _c("tiny-dropdown-item", {
|
|
3091
|
+
key: item.value,
|
|
3092
|
+
attrs: {
|
|
3093
|
+
"label": item.label,
|
|
3094
|
+
"item-data": {
|
|
3095
|
+
value: item.value,
|
|
3096
|
+
property: column.property
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
}, [_vm._v(_vm._s(item.label))]);
|
|
3100
|
+
}), 1)];
|
|
3101
|
+
},
|
|
3102
|
+
proxy: true
|
|
3103
|
+
}], null, true)
|
|
3104
|
+
}, [_c("span", {
|
|
3105
|
+
class: ["asc", "desc"].includes(column.order) && "dropdown-btn"
|
|
3106
|
+
}, [column.order === "asc" ? _c("icon-ascending") : column.order === "desc" ? _c("icon-descending") : _c("span", {
|
|
3107
|
+
staticClass: "set-btn",
|
|
3108
|
+
class: [!column.sortable && "visibility-hidden"]
|
|
3109
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.toolbar.set")))])], 1)])], 1) : _vm._e(), !_vm.isGroup ? _c("span", {
|
|
3110
|
+
staticClass: "close-icon",
|
|
3111
|
+
class: [column.alwaysShow && "visibility-hidden"],
|
|
3112
|
+
on: {
|
|
3113
|
+
"click": function click($event) {
|
|
3114
|
+
return _vm.hiddenColumn(column.property);
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
}, [_c("icon-close")], 1) : _vm._e()]) : _vm._e(), column.children ? _c("ul", _vm._l(column.children, function(column2, index2) {
|
|
3118
|
+
return _c("li", {
|
|
3119
|
+
directives: [{
|
|
3120
|
+
name: "show",
|
|
3121
|
+
rawName: "v-show",
|
|
3122
|
+
value: column2.visible,
|
|
3123
|
+
expression: "column.visible"
|
|
3124
|
+
}],
|
|
3125
|
+
key: column2.property + index2,
|
|
3126
|
+
class: [column2.fixed, _vm.getRowClassName(column2)],
|
|
3127
|
+
attrs: {
|
|
3128
|
+
"data-row": column2.property
|
|
3129
|
+
}
|
|
3130
|
+
}, [_c("div", {
|
|
3131
|
+
staticClass: "column-container"
|
|
3132
|
+
}, [_c("p", {
|
|
3133
|
+
staticClass: "name child-name",
|
|
3134
|
+
on: {
|
|
3135
|
+
"mouseenter": _vm.handleMouseenter,
|
|
3136
|
+
"mouseleave": _vm.handleMouseleave
|
|
3137
|
+
}
|
|
3138
|
+
}, [_c("title-render", {
|
|
3139
|
+
attrs: {
|
|
3140
|
+
"column": column2
|
|
3141
|
+
}
|
|
3142
|
+
})], 1)])]);
|
|
3143
|
+
}), 0) : _vm._e()])]);
|
|
3144
|
+
}), 0)])];
|
|
3145
|
+
},
|
|
3146
|
+
proxy: true
|
|
3147
|
+
}], null, false, 1239171024),
|
|
3148
|
+
model: {
|
|
3149
|
+
value: _vm.splitVal,
|
|
3150
|
+
callback: function callback($$v) {
|
|
3151
|
+
_vm.splitVal = $$v;
|
|
3152
|
+
},
|
|
3153
|
+
expression: "splitVal"
|
|
3154
|
+
}
|
|
3155
|
+
})], 1), _c("div", {
|
|
3156
|
+
directives: [{
|
|
3157
|
+
name: "show",
|
|
3158
|
+
rawName: "v-show",
|
|
3159
|
+
value: _vm.activeName === "other",
|
|
3160
|
+
expression: "activeName === 'other'"
|
|
3161
|
+
}],
|
|
3162
|
+
class: ["tabs-body-item", _vm.animateShow === "other" ? "active-item" : ""]
|
|
3163
|
+
}, [_c("div", {
|
|
3164
|
+
staticClass: "other-setting"
|
|
3165
|
+
}, [_c("span", {
|
|
3166
|
+
staticClass: "label"
|
|
3167
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.tabs.other.pageSize")))]), _c("tiny-radio-group", {
|
|
3168
|
+
model: {
|
|
3169
|
+
value: _vm.settings.pageSize,
|
|
3170
|
+
callback: function callback($$v) {
|
|
3171
|
+
_vm.$set(_vm.settings, "pageSize", $$v);
|
|
3172
|
+
},
|
|
3173
|
+
expression: "settings.pageSize"
|
|
3174
|
+
}
|
|
3175
|
+
}, _vm._l(_vm.initSettings.pageSizes, function(item, index) {
|
|
3176
|
+
return _c("tiny-radio", {
|
|
3177
|
+
key: index,
|
|
3178
|
+
attrs: {
|
|
3179
|
+
"label": item
|
|
3180
|
+
}
|
|
3181
|
+
}, [_vm._v(_vm._s(item))]);
|
|
3182
|
+
}), 1)], 1)])])]), _c("div", {
|
|
3183
|
+
staticClass: "tiny-grid-custom__footer",
|
|
3184
|
+
attrs: {
|
|
3185
|
+
"dir": _vm.tinyTheme === "saas" ? "rtl" : "ltr"
|
|
3186
|
+
}
|
|
3187
|
+
}, [_c("tiny-button", {
|
|
3188
|
+
attrs: {
|
|
3189
|
+
"type": "primary"
|
|
3190
|
+
},
|
|
3191
|
+
on: {
|
|
3192
|
+
"click": _vm.saveSettings
|
|
3193
|
+
}
|
|
3194
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.saveBtn")))]), _vm.multipleHistory && _vm.activeName === "base" ? _c("tiny-custom-switch", {
|
|
3195
|
+
ref: "switch",
|
|
3196
|
+
attrs: {
|
|
3197
|
+
"remote": _vm.setting.remote,
|
|
3198
|
+
"custom-mode": _vm.customMode,
|
|
3199
|
+
"selectedTemplateVal": _vm.selectedTemplateVal,
|
|
3200
|
+
"history-config": _vm.historyConfig
|
|
3201
|
+
},
|
|
3202
|
+
on: {
|
|
3203
|
+
"init-storage": _vm.initStorage,
|
|
3204
|
+
"set-selected": _vm.setSelectedTemplate
|
|
3205
|
+
}
|
|
3206
|
+
}) : _vm._e(), _c("tiny-button", {
|
|
3207
|
+
on: {
|
|
3208
|
+
"click": _vm.handleReset
|
|
3209
|
+
}
|
|
3210
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.resetBtn")))]), _c("tiny-button", {
|
|
3211
|
+
on: {
|
|
3212
|
+
"click": _vm.cancelSettings
|
|
3213
|
+
}
|
|
3214
|
+
}, [_vm._v(_vm._s(_vm.t("ui.grid.individuation.cancelBtn")))])], 1)]) : _vm._e(), _c("tiny-tooltip", {
|
|
3215
|
+
ref: "tooltip",
|
|
3216
|
+
attrs: {
|
|
3217
|
+
"popper-class": "absolute",
|
|
3218
|
+
"manual": true,
|
|
3219
|
+
"effect": "light",
|
|
3220
|
+
"content": _vm.tooltipContent,
|
|
3221
|
+
"placement": "top"
|
|
3222
|
+
},
|
|
3223
|
+
model: {
|
|
3224
|
+
value: _vm.tooltipVisible,
|
|
3225
|
+
callback: function callback($$v) {
|
|
3226
|
+
_vm.tooltipVisible = $$v;
|
|
3227
|
+
},
|
|
3228
|
+
expression: "tooltipVisible"
|
|
3229
|
+
}
|
|
3230
|
+
})];
|
|
3231
|
+
},
|
|
3232
|
+
proxy: true
|
|
3233
|
+
}]),
|
|
3234
|
+
model: {
|
|
3235
|
+
value: _vm.visible,
|
|
3236
|
+
callback: function callback($$v) {
|
|
3237
|
+
_vm.visible = $$v;
|
|
3238
|
+
},
|
|
3239
|
+
expression: "visible"
|
|
3240
|
+
}
|
|
3241
|
+
});
|
|
3242
|
+
};
|
|
3243
|
+
var staticRenderFns = [];
|
|
3244
|
+
var __cssModules = {};
|
|
3245
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render2, staticRenderFns, false, __vue2_injectStyles);
|
|
3246
|
+
function __vue2_injectStyles(context) {
|
|
3247
|
+
for (var o in __cssModules) {
|
|
3248
|
+
this[o] = __cssModules[o];
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
var GridCustomSaas = /* @__PURE__ */ function() {
|
|
3252
|
+
return __component__.exports;
|
|
3253
|
+
}();
|
|
3254
|
+
var classMap = {
|
|
3255
|
+
isActive: "is__active"
|
|
3256
|
+
};
|
|
3257
|
+
function createMacroTask(_ref12) {
|
|
3258
|
+
var _vm = _ref12._vm;
|
|
3259
|
+
setTimeout(function() {
|
|
3260
|
+
if (_vm.settingStore.activeBtn || _vm.settingStore.activeWrapper) return;
|
|
3261
|
+
_vm.closeSetting();
|
|
3262
|
+
}, 300);
|
|
3263
|
+
}
|
|
3264
|
+
function renderToolsWrapper(_ref13) {
|
|
3265
|
+
var _vm = _ref13._vm, $tools = _ref13.$tools, $grid = _ref13.$grid, table = _ref13.table;
|
|
3266
|
+
return h("div", {
|
|
3267
|
+
class: "tiny-grid-tools__wrapper"
|
|
3268
|
+
}, $tools.call(_vm, {
|
|
3269
|
+
$grid,
|
|
3270
|
+
$table: table
|
|
3271
|
+
}, h));
|
|
3272
|
+
}
|
|
3273
|
+
function renderFullScreenWrapper(_ref14) {
|
|
3274
|
+
var _vm = _ref14._vm;
|
|
3275
|
+
return h("div", {
|
|
3276
|
+
class: "tiny-grid-fullscreen__wrapper"
|
|
3277
|
+
}, [h("div", {
|
|
3278
|
+
class: "tiny-grid-fullscreen__btn",
|
|
3279
|
+
on: {
|
|
3280
|
+
click: _vm.fullscreenEvent
|
|
3281
|
+
}
|
|
3282
|
+
}, [h(_vm.isFull ? GridConfig.icon.minscreen : GridConfig.icon.fullscreen, {
|
|
3283
|
+
class: "tiny-svg-size"
|
|
3284
|
+
})])]);
|
|
3285
|
+
}
|
|
3286
|
+
function renderRefreshWrapper(_ref15) {
|
|
3287
|
+
var _vm = _ref15._vm;
|
|
3288
|
+
return h("div", {
|
|
3289
|
+
class: "tiny-grid-refresh__wrapper"
|
|
3290
|
+
}, [h("div", {
|
|
3291
|
+
class: "tiny-grid-refresh__btn",
|
|
3292
|
+
on: {
|
|
3293
|
+
click: _vm.refreshEvent
|
|
3294
|
+
}
|
|
3295
|
+
}, [h(GridConfig.icon.refresh, {
|
|
3296
|
+
class: ["tiny-svg-size", {
|
|
3297
|
+
roll: _vm.isRefresh
|
|
3298
|
+
}]
|
|
3299
|
+
})])]);
|
|
3300
|
+
}
|
|
3301
|
+
function renderCustomWrapper(_ref16) {
|
|
3302
|
+
var _ref17;
|
|
3303
|
+
var _vm = _ref16._vm, settingStore = _ref16.settingStore, settingsBtnOns = _ref16.settingsBtnOns, tableFullColumn = _ref16.tableFullColumn, setting = _ref16.setting, initSettings = _ref16.initSettings;
|
|
3304
|
+
return h("div", {
|
|
3305
|
+
class: ["tiny-grid-custom__wrapper", (_ref17 = {}, _ref17[classMap.isActive] = settingStore.customVisible, _ref17)],
|
|
3306
|
+
ref: "customWrapper"
|
|
3307
|
+
}, [
|
|
3308
|
+
// TODO: 此处应使用图标按钮,但saas主题图标按钮样式有问题。
|
|
3309
|
+
h("div", {
|
|
3310
|
+
class: "tiny-grid-custom__setting-btn",
|
|
3311
|
+
on: settingsBtnOns
|
|
3312
|
+
}, [setting != null && setting.simple ? h("tiny-grid-custom-select", {
|
|
3313
|
+
on: {
|
|
3314
|
+
saveSettings: _vm.handleSaveSettings
|
|
3315
|
+
},
|
|
3316
|
+
props: {
|
|
3317
|
+
data: tableFullColumn,
|
|
3318
|
+
setting,
|
|
3319
|
+
value: settingStore.customVisible
|
|
3320
|
+
}
|
|
3321
|
+
}) : h(GridConfig.icon.custom, {
|
|
3322
|
+
class: "tiny-svg-size"
|
|
3323
|
+
})]),
|
|
3324
|
+
h("div", {
|
|
3325
|
+
class: "tiny-grid-custom__option-wrapper"
|
|
3326
|
+
}, [h(_vm.customMode === "saas" ? "tiny-grid-custom-saas" : "tiny-grid-custom", {
|
|
3327
|
+
on: {
|
|
3328
|
+
showModal: function showModal(modalVisible) {
|
|
3329
|
+
return settingStore.customVisible = modalVisible;
|
|
3330
|
+
},
|
|
3331
|
+
saveSettings: _vm.handleSaveSettings,
|
|
3332
|
+
resetSettings: function resetSettings3(settings) {
|
|
3333
|
+
return _vm.$emit("reset-setting", settings);
|
|
3334
|
+
},
|
|
3335
|
+
cancelSettings: function cancelSettings3() {
|
|
3336
|
+
return _vm.$emit("cancel-setting");
|
|
3337
|
+
},
|
|
3338
|
+
deleteTemplate: function deleteTemplate2(template) {
|
|
3339
|
+
return _vm.$emit("delete-template", template);
|
|
3340
|
+
}
|
|
3341
|
+
},
|
|
3342
|
+
props: {
|
|
3343
|
+
customMode: _vm.customMode,
|
|
3344
|
+
data: tableFullColumn,
|
|
3345
|
+
value: settingStore.customVisible,
|
|
3346
|
+
other: setting.other,
|
|
3347
|
+
search: setting.search,
|
|
3348
|
+
keys: setting.keys,
|
|
3349
|
+
sortable: setting.sortable,
|
|
3350
|
+
filter: setting.filter,
|
|
3351
|
+
onBeforeMove: setting.onBeforeMove,
|
|
3352
|
+
rowClassName: setting.rowClassName,
|
|
3353
|
+
refresh: setting.refresh,
|
|
3354
|
+
numberSorting: setting.numberSorting,
|
|
3355
|
+
multipleHistory: setting.multipleHistory,
|
|
3356
|
+
initSettings,
|
|
3357
|
+
resetMethod: _vm.resetMethod,
|
|
3358
|
+
alwaysShowColumns: setting.alwaysShowColumns,
|
|
3359
|
+
columnsGroup: setting.columnsGroup,
|
|
3360
|
+
showHideAll: setting.showHideAll,
|
|
3361
|
+
fixedSorting: setting.fixedSorting,
|
|
3362
|
+
setting
|
|
3363
|
+
},
|
|
3364
|
+
ref: "custom"
|
|
3365
|
+
})])
|
|
3366
|
+
]);
|
|
3367
|
+
}
|
|
3368
|
+
function getScopedSlots(_ref18) {
|
|
3369
|
+
var item = _ref18.item, _vm = _ref18._vm, vSize2 = _ref18.vSize;
|
|
3370
|
+
var scopedSlots = null;
|
|
3371
|
+
var childHandler = function childHandler2(child) {
|
|
3372
|
+
var res = [null];
|
|
3373
|
+
if (child.visible !== false) {
|
|
3374
|
+
res = h(Button, {
|
|
3375
|
+
on: {
|
|
3376
|
+
click: function click(event) {
|
|
3377
|
+
return _vm.btnEvent(event, child);
|
|
3378
|
+
}
|
|
3379
|
+
},
|
|
3380
|
+
props: {
|
|
3381
|
+
disabled: child.disabled,
|
|
3382
|
+
size: vSize2,
|
|
3383
|
+
loading: child.loading,
|
|
3384
|
+
type: child.type
|
|
3385
|
+
}
|
|
3386
|
+
}, getFuncText(child.name));
|
|
3387
|
+
}
|
|
3388
|
+
return res;
|
|
3389
|
+
};
|
|
3390
|
+
if (item.dropdowns && item.dropdowns.length) {
|
|
3391
|
+
scopedSlots = {
|
|
3392
|
+
default: function _default17() {
|
|
3393
|
+
return getFuncText(item.name);
|
|
3394
|
+
},
|
|
3395
|
+
dropdowns: function dropdowns() {
|
|
3396
|
+
return item.dropdowns.map(childHandler);
|
|
3397
|
+
}
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3400
|
+
return scopedSlots;
|
|
3401
|
+
}
|
|
3402
|
+
function renderButtonWrapper(_ref19) {
|
|
3403
|
+
var _childrenArg;
|
|
3404
|
+
var _vm = _ref19._vm, $buttons = _ref19.$buttons, $grid = _ref19.$grid, table = _ref19.table, buttons = _ref19.buttons, vSize2 = _ref19.vSize;
|
|
3405
|
+
var childrenArg;
|
|
3406
|
+
if ($buttons) {
|
|
3407
|
+
childrenArg = $buttons.call(_vm, {
|
|
3408
|
+
$grid,
|
|
3409
|
+
$table: table
|
|
3410
|
+
}, h);
|
|
3411
|
+
} else {
|
|
3412
|
+
childrenArg = buttons.map(function(item) {
|
|
3413
|
+
var res = [null];
|
|
3414
|
+
if (item.visible !== false) {
|
|
3415
|
+
var scopedSlots = getScopedSlots({
|
|
3416
|
+
item,
|
|
3417
|
+
_vm,
|
|
3418
|
+
vSize: vSize2
|
|
3419
|
+
});
|
|
3420
|
+
res = h(Button, {
|
|
3421
|
+
on: {
|
|
3422
|
+
click: function click(event) {
|
|
3423
|
+
return _vm.btnEvent(event, item);
|
|
3424
|
+
}
|
|
3425
|
+
},
|
|
3426
|
+
props: {
|
|
3427
|
+
disabled: item.disabled,
|
|
3428
|
+
size: vSize2,
|
|
3429
|
+
loading: item.loading,
|
|
3430
|
+
type: item.type
|
|
3431
|
+
},
|
|
3432
|
+
scopedSlots
|
|
3433
|
+
}, getFuncText(item.name));
|
|
3434
|
+
}
|
|
3435
|
+
return res;
|
|
3436
|
+
});
|
|
3437
|
+
}
|
|
3438
|
+
return (_childrenArg = childrenArg) != null && _childrenArg.length ? h("div", {
|
|
3439
|
+
class: "tiny-grid-button__wrapper"
|
|
3440
|
+
}, childrenArg) : null;
|
|
3441
|
+
}
|
|
3442
|
+
var GridToolbar = defineComponent({
|
|
3443
|
+
name: $prefix + "GridToolbar",
|
|
3444
|
+
components: {
|
|
3445
|
+
TinyGridCustom: GridCustom,
|
|
3446
|
+
TinyGridCustomSelect: GridCustomSelect,
|
|
3447
|
+
TinyGridCustomSaas: GridCustomSaas,
|
|
3448
|
+
IconFullscreen: iconFullscreen(),
|
|
3449
|
+
IconMinscreen: iconMinscreen()
|
|
3450
|
+
},
|
|
3451
|
+
props: _extends({}, $props, {
|
|
3452
|
+
id: String,
|
|
3453
|
+
loading: {
|
|
3454
|
+
type: Boolean,
|
|
3455
|
+
default: false
|
|
3456
|
+
},
|
|
3457
|
+
customMode: {
|
|
3458
|
+
type: String,
|
|
3459
|
+
default: function _default12() {
|
|
3460
|
+
var ctx = appProperties();
|
|
3461
|
+
return (ctx.tiny_theme ? ctx.tiny_theme.value : "") || "aurora";
|
|
3462
|
+
}
|
|
3463
|
+
},
|
|
3464
|
+
resizable: {
|
|
3465
|
+
type: [Boolean, Object],
|
|
3466
|
+
default: function _default13() {
|
|
3467
|
+
return GridConfig.toolbar.resizable;
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
refresh: {
|
|
3471
|
+
type: [Boolean, Object],
|
|
3472
|
+
default: function _default14() {
|
|
3473
|
+
return GridConfig.toolbar.refresh;
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3476
|
+
setting: {
|
|
3477
|
+
type: [Boolean, Object],
|
|
3478
|
+
default: function _default15() {
|
|
3479
|
+
return GridConfig.toolbar.setting;
|
|
3480
|
+
}
|
|
3481
|
+
},
|
|
3482
|
+
fullScreen: {
|
|
3483
|
+
type: Boolean,
|
|
3484
|
+
default: false
|
|
3485
|
+
},
|
|
3486
|
+
buttons: {
|
|
3487
|
+
type: Array,
|
|
3488
|
+
default: function _default16() {
|
|
3489
|
+
return GridConfig.toolbar.buttons;
|
|
3490
|
+
}
|
|
3491
|
+
},
|
|
3492
|
+
size: String,
|
|
3493
|
+
data: Array,
|
|
3494
|
+
customs: Array,
|
|
3495
|
+
beforeOpenFullScreen: Function,
|
|
3496
|
+
beforeCloseFullScreen: Function,
|
|
3497
|
+
resetMethod: Function
|
|
3498
|
+
}),
|
|
3499
|
+
inject: {
|
|
3500
|
+
$grid: {
|
|
3501
|
+
default: null
|
|
3502
|
+
}
|
|
3503
|
+
},
|
|
3504
|
+
data: function data5() {
|
|
3505
|
+
return {
|
|
3506
|
+
table: null,
|
|
3507
|
+
isRefresh: false,
|
|
3508
|
+
tableFullColumn: [],
|
|
3509
|
+
initSettings: {
|
|
3510
|
+
pageSizes: [],
|
|
3511
|
+
pageSize: 10,
|
|
3512
|
+
sortType: "page",
|
|
3513
|
+
showIndex: false,
|
|
3514
|
+
multipleHistory: {
|
|
3515
|
+
tableMaxHeight: "",
|
|
3516
|
+
showTitle: true,
|
|
3517
|
+
title: "",
|
|
3518
|
+
showSave: true,
|
|
3519
|
+
saveDisabled: false,
|
|
3520
|
+
saveText: "",
|
|
3521
|
+
labelText: "",
|
|
3522
|
+
selectPlaceholder: "",
|
|
3523
|
+
selectDisabled: false,
|
|
3524
|
+
showApply: true,
|
|
3525
|
+
applyDisabled: false,
|
|
3526
|
+
applyTitle: "",
|
|
3527
|
+
applyIcon: null,
|
|
3528
|
+
showEdit: true,
|
|
3529
|
+
editDisabled: false,
|
|
3530
|
+
editTitle: "",
|
|
3531
|
+
editIcon: null,
|
|
3532
|
+
showDel: true,
|
|
3533
|
+
delDisabled: false,
|
|
3534
|
+
delTitle: "",
|
|
3535
|
+
delIcon: null,
|
|
3536
|
+
storageKey: "TINY_TABLE_MULTI_HISTORY_SETTING",
|
|
3537
|
+
remoteMethod: null,
|
|
3538
|
+
userKey: "",
|
|
3539
|
+
// userId or userAccount
|
|
3540
|
+
remoteSelectedMethod: null
|
|
3541
|
+
}
|
|
3542
|
+
},
|
|
3543
|
+
settingStore: {
|
|
3544
|
+
visible: false,
|
|
3545
|
+
customVisible: false
|
|
3546
|
+
},
|
|
3547
|
+
isFull: false
|
|
3548
|
+
};
|
|
3549
|
+
},
|
|
3550
|
+
computed: {
|
|
3551
|
+
vSize: function vSize() {
|
|
3552
|
+
return this.size || this.$parent.size || this.$parent.vSize;
|
|
3553
|
+
},
|
|
3554
|
+
refreshOpts: function refreshOpts() {
|
|
3555
|
+
return _extends({}, GridConfig.toolbar.refresh, this.refresh);
|
|
3556
|
+
},
|
|
3557
|
+
resizableOpts: function resizableOpts() {
|
|
3558
|
+
return _extends({
|
|
3559
|
+
storageKey: "TINY_TABLE_CUSTOM_COLUMN_WIDTH"
|
|
3560
|
+
}, GridConfig.toolbar.resizable, this.resizable);
|
|
3561
|
+
},
|
|
3562
|
+
settingOpts: function settingOpts() {
|
|
3563
|
+
return _extends({
|
|
3564
|
+
storageKey: "TINY_TABLE_CUSTOM_SETTING"
|
|
3565
|
+
}, GridConfig.toolbar.setting, this.setting);
|
|
3566
|
+
}
|
|
3567
|
+
},
|
|
3568
|
+
created: function created5() {
|
|
3569
|
+
var _this30 = this;
|
|
3570
|
+
var settingOpts2 = this.settingOpts, id = this.id, customs = this.customs, $grid = this.$grid;
|
|
3571
|
+
this.initSettings.pageSizes = $grid.pagerConfig && $grid.pagerConfig.pageSizes || [10, 15, 20, 30, 50, 100];
|
|
3572
|
+
this.initSettings.pageSize = $grid.pagerConfig && $grid.pagerConfig.pageSize || 10;
|
|
3573
|
+
this.initSettings.sortType = this.setting && this.setting.sortType || "page";
|
|
3574
|
+
this.initSettings.showIndex = this.setting && this.setting.showIndex;
|
|
3575
|
+
if (settingOpts2.storage === "local") {
|
|
3576
|
+
this.initSettings = Object.assign(this.initSettings, this.getStorageMap(settingOpts2.storageKey)[id] || {});
|
|
3577
|
+
}
|
|
3578
|
+
if (customs) {
|
|
3579
|
+
this.tableFullColumn = customs;
|
|
3580
|
+
}
|
|
3581
|
+
if (settingOpts2.storage && !id) {
|
|
3582
|
+
return GridTools.error("ui.grid.error.toolbarId");
|
|
3583
|
+
}
|
|
3584
|
+
this.loadStorage();
|
|
3585
|
+
GlobalEvent.on(this, "mousedown", this.handleGlobalMousedownEvent);
|
|
3586
|
+
GlobalEvent.on(this, "blur", this.handleGlobalBlurEvent);
|
|
3587
|
+
this.removeHandler = function() {
|
|
3588
|
+
GlobalEvent.off(_this30, "mousedown");
|
|
3589
|
+
GlobalEvent.off(_this30, "blur");
|
|
3590
|
+
};
|
|
3591
|
+
this.$grid.connect({
|
|
3592
|
+
name: "toolbar",
|
|
3593
|
+
vm: this
|
|
3594
|
+
});
|
|
3595
|
+
},
|
|
3596
|
+
setup: function setup2(props, _ref20) {
|
|
3597
|
+
var slots = _ref20.slots, attrs = _ref20.attrs, listeners = _ref20.listeners;
|
|
3598
|
+
var instance = hooks.getCurrentInstance().proxy;
|
|
3599
|
+
var tableListeners = getListeners(attrs, listeners);
|
|
3600
|
+
hooks.onBeforeUnmount(function() {
|
|
3601
|
+
return typeof instance.removeHandler === "function" && instance.removeHandler();
|
|
3602
|
+
});
|
|
3603
|
+
return {
|
|
3604
|
+
slots,
|
|
3605
|
+
tableListeners
|
|
3606
|
+
};
|
|
3607
|
+
},
|
|
3608
|
+
render: function render4() {
|
|
3609
|
+
var _ref21;
|
|
3610
|
+
var $grid = this.$grid, $slots = this.slots, table = this.table, loading = this.loading, settingStore = this.settingStore, refresh = this.refresh, fullScreen = this.fullScreen;
|
|
3611
|
+
var setting = this.setting, initSettings = this.initSettings, _this$buttons = this.buttons, buttons = _this$buttons === void 0 ? [] : _this$buttons, vSize2 = this.vSize, tableFullColumn = this.tableFullColumn;
|
|
3612
|
+
var $buttons = $slots.buttons, $tools = $slots.tools;
|
|
3613
|
+
var settingsBtnOns = {};
|
|
3614
|
+
setting && (settingsBtnOns.click = this.settingBtnClick);
|
|
3615
|
+
var map = {
|
|
3616
|
+
isLoading: "is__loading"
|
|
3617
|
+
};
|
|
3618
|
+
var propsArg = {
|
|
3619
|
+
class: ["tiny-grid-toolbar", (_ref21 = {}, _ref21["size__" + vSize2] = vSize2, _ref21[map.isLoading] = loading, _ref21)]
|
|
3620
|
+
};
|
|
3621
|
+
var args = {
|
|
3622
|
+
_vm: this,
|
|
3623
|
+
settingStore,
|
|
3624
|
+
settingsBtnOns,
|
|
3625
|
+
tableFullColumn,
|
|
3626
|
+
setting,
|
|
3627
|
+
initSettings
|
|
3628
|
+
};
|
|
3629
|
+
var defaultSlot = function defaultSlot2() {
|
|
3630
|
+
return typeof $slots.default === "function" ? $slots.default() : $slots.default;
|
|
3631
|
+
};
|
|
3632
|
+
var childrenArg = [renderButtonWrapper({
|
|
3633
|
+
_vm: this,
|
|
3634
|
+
$buttons,
|
|
3635
|
+
$grid,
|
|
3636
|
+
table,
|
|
3637
|
+
buttons,
|
|
3638
|
+
vSize: vSize2
|
|
3639
|
+
}), setting ? renderCustomWrapper(args) : null, refresh ? renderRefreshWrapper({
|
|
3640
|
+
_vm: this
|
|
3641
|
+
}) : null, fullScreen ? renderFullScreenWrapper({
|
|
3642
|
+
_vm: this
|
|
3643
|
+
}) : null, $tools ? renderToolsWrapper({
|
|
3644
|
+
_vm: this,
|
|
3645
|
+
$tools,
|
|
3646
|
+
$grid,
|
|
3647
|
+
table
|
|
3648
|
+
}) : defaultSlot()];
|
|
3649
|
+
return h("div", propsArg, childrenArg);
|
|
3650
|
+
},
|
|
3651
|
+
methods: {
|
|
3652
|
+
updateTemplateList: function updateTemplateList() {
|
|
3653
|
+
var custom = this.$refs.custom;
|
|
3654
|
+
if (custom && custom.$refs.switch) {
|
|
3655
|
+
custom.$refs.switch.initStorage(false);
|
|
3656
|
+
}
|
|
3657
|
+
},
|
|
3658
|
+
updateSelectedTemplate: function updateSelectedTemplate2(val) {
|
|
3659
|
+
var custom = this.$refs.custom;
|
|
3660
|
+
custom && custom.updateSelectedTemplate(val);
|
|
3661
|
+
},
|
|
3662
|
+
settingBtnClick: function settingBtnClick() {
|
|
3663
|
+
var _this$setting;
|
|
3664
|
+
if ((_this$setting = this.setting) != null && _this$setting.simple) {
|
|
3665
|
+
return;
|
|
3666
|
+
}
|
|
3667
|
+
return this.setting && this.setting.customSetting ? this.setting.settingBtnClickFn() : this.handleClickCustomEvent();
|
|
3668
|
+
},
|
|
3669
|
+
updateConf: function updateConf() {
|
|
3670
|
+
var _this31 = this;
|
|
3671
|
+
var data6 = this.data;
|
|
3672
|
+
var $children = this.$parent.$children;
|
|
3673
|
+
var findHandler = function findHandler2(childComp, childIndex) {
|
|
3674
|
+
return childComp && childComp.refreshColumn && childIndex > $children.indexOf(_this31) && (data6 ? childComp.data === data6 : childComp.$vnode.componentOptions.tag === "tiny-grid-table");
|
|
3675
|
+
};
|
|
3676
|
+
this.table = find$1($children, findHandler);
|
|
3677
|
+
},
|
|
3678
|
+
closeSetting: function closeSetting() {
|
|
3679
|
+
var setting = this.setting;
|
|
3680
|
+
var settingStore = this.settingStore;
|
|
3681
|
+
if (settingStore.visible) {
|
|
3682
|
+
settingStore.visible = false;
|
|
3683
|
+
}
|
|
3684
|
+
if (settingStore.visible && setting && !settingStore.immediate) {
|
|
3685
|
+
this.updateSetting();
|
|
3686
|
+
}
|
|
3687
|
+
},
|
|
3688
|
+
openSetting: function openSetting() {
|
|
3689
|
+
this.settingStore.visible = true;
|
|
3690
|
+
},
|
|
3691
|
+
showAllColumns: function showAllColumns() {
|
|
3692
|
+
this.$refs.custom.showOrHideAllColumns(true);
|
|
3693
|
+
},
|
|
3694
|
+
hideAllColumns: function hideAllColumns() {
|
|
3695
|
+
this.$refs.custom.showOrHideAllColumns(false);
|
|
3696
|
+
},
|
|
3697
|
+
orderSetting: function orderSetting() {
|
|
3698
|
+
var id = this.id, settingOpts2 = this.settingOpts;
|
|
3699
|
+
var allData = [];
|
|
3700
|
+
var custumSetting = JSON.parse(localStorage.getItem(settingOpts2.storageKey));
|
|
3701
|
+
if (custumSetting) {
|
|
3702
|
+
var customName = custumSetting[id];
|
|
3703
|
+
allData = customName && customName.columns || [];
|
|
3704
|
+
}
|
|
3705
|
+
var orderArg = allData.map(function(value3) {
|
|
3706
|
+
return {
|
|
3707
|
+
fileds: value3.property,
|
|
3708
|
+
property: value3.property,
|
|
3709
|
+
order: value3.order,
|
|
3710
|
+
prop: value3.property
|
|
3711
|
+
};
|
|
3712
|
+
}).filter(function(item) {
|
|
3713
|
+
return item.order !== null;
|
|
3714
|
+
});
|
|
3715
|
+
return orderArg;
|
|
3716
|
+
},
|
|
3717
|
+
loadColWidth: function loadColWidth() {
|
|
3718
|
+
var id = this.id, resizableOpts2 = this.resizableOpts;
|
|
3719
|
+
if (resizableOpts2.storage) {
|
|
3720
|
+
var width = this.getStorageMap(resizableOpts2.storageKey)[id] || {};
|
|
3721
|
+
{
|
|
3722
|
+
var widthSet = {};
|
|
3723
|
+
for (var key in width) {
|
|
3724
|
+
if (Object.prototype.hasOwnProperty.call(width, key)) {
|
|
3725
|
+
widthSet[key] = {
|
|
3726
|
+
resizeWidth: width[key]
|
|
3727
|
+
};
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3730
|
+
return widthSet;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
},
|
|
3734
|
+
loadStorage: function loadStorage() {
|
|
3735
|
+
var _this32 = this;
|
|
3736
|
+
var $grid = this.$grid, id = this.id, resizable = this.resizable, setting = this.setting, settingOpts2 = this.settingOpts;
|
|
3737
|
+
if (!$grid) {
|
|
3738
|
+
return;
|
|
3739
|
+
}
|
|
3740
|
+
if (resizable || setting) {
|
|
3741
|
+
var customSettings = [];
|
|
3742
|
+
if ($grid) {
|
|
3743
|
+
$grid.connect({
|
|
3744
|
+
toolbar: this
|
|
3745
|
+
});
|
|
3746
|
+
} else {
|
|
3747
|
+
throw new Error("[tiny-grid-toolbar] Not found tiny-grid.");
|
|
3748
|
+
}
|
|
3749
|
+
if (settingOpts2.storage === "local") {
|
|
3750
|
+
var settingsStorage = this.getStorageMap(settingOpts2.storageKey)[id];
|
|
3751
|
+
customSettings = settingsStorage && settingsStorage.columns || [];
|
|
3752
|
+
if (settingsStorage && settingsStorage.pageSize) {
|
|
3753
|
+
var pageSize = settingsStorage.pageSize;
|
|
3754
|
+
if (this.$grid.pagerConfig && this.$grid.pagerConfig.pageSize !== pageSize) {
|
|
3755
|
+
this.$grid.createJob("pageSizeChangeCallback", function() {
|
|
3756
|
+
_this32.$grid.pageSizeChange(pageSize, $grid.autoLoad === false);
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
this.$grid.createJob("updateCustomsCallback", function() {
|
|
3762
|
+
_this32.updateCustoms(customSettings.length ? customSettings : _this32.tableFullColumn);
|
|
3763
|
+
});
|
|
3764
|
+
}
|
|
3765
|
+
},
|
|
3766
|
+
updateColumn: function updateColumn(fullColumn) {
|
|
3767
|
+
this.tableFullColumn = fullColumn;
|
|
3768
|
+
},
|
|
3769
|
+
updateCustoms: function updateCustoms(customs) {
|
|
3770
|
+
var _this33 = this;
|
|
3771
|
+
var $grid = this.$grid, table = this.table, setting = this.setting;
|
|
3772
|
+
var comp = $grid || table;
|
|
3773
|
+
var sort = setting && !!setting.sortable;
|
|
3774
|
+
if (comp) {
|
|
3775
|
+
var colWidth = this.loadColWidth();
|
|
3776
|
+
comp.reloadCustoms(customs, sort, colWidth).then(function(fullColumn) {
|
|
3777
|
+
_this33.tableFullColumn = fullColumn;
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
},
|
|
3781
|
+
getStorageMap: function getStorageMap(key) {
|
|
3782
|
+
var version2 = GridConfig.version;
|
|
3783
|
+
var rest = toStringJSON(localStorage.getItem(key));
|
|
3784
|
+
return rest && rest._v === version2 ? rest : {
|
|
3785
|
+
_v: version2
|
|
3786
|
+
};
|
|
3787
|
+
},
|
|
3788
|
+
// 保存 'fixed', 'visible', 'order' 列的个性化配置
|
|
3789
|
+
saveCustomSettings: function saveCustomSettings(columnConfigs) {
|
|
3790
|
+
var id = this.id, settingOpts2 = this.settingOpts;
|
|
3791
|
+
if (settingOpts2.storage === "local") {
|
|
3792
|
+
var settingsStorageMap = this.getStorageMap(settingOpts2.storageKey);
|
|
3793
|
+
var settingsStorage = settingsStorageMap[id] || {};
|
|
3794
|
+
settingsStorage.columns = columnConfigs;
|
|
3795
|
+
settingsStorageMap[id] = settingsStorage;
|
|
3796
|
+
localStorage.setItem(settingOpts2.storageKey, toJSONString(settingsStorageMap));
|
|
3797
|
+
}
|
|
3798
|
+
return this.$nextTick();
|
|
3799
|
+
},
|
|
3800
|
+
// 保存分页、排序类型数据数据
|
|
3801
|
+
savePagerSettings: function savePagerSettings(settingConfigs) {
|
|
3802
|
+
var id = this.id, settingOpts2 = this.settingOpts;
|
|
3803
|
+
if (settingOpts2.storage) {
|
|
3804
|
+
var settingsStorageMap = this.getStorageMap(settingOpts2.storageKey);
|
|
3805
|
+
var settingsStorage = settingsStorageMap[id];
|
|
3806
|
+
if (settingsStorage) {
|
|
3807
|
+
Object.assign(settingsStorage, settingConfigs);
|
|
3808
|
+
} else {
|
|
3809
|
+
settingsStorage = settingConfigs;
|
|
3810
|
+
}
|
|
3811
|
+
settingsStorageMap[id] = settingsStorage;
|
|
3812
|
+
localStorage.setItem(settingOpts2.storageKey, toJSONString(settingsStorageMap));
|
|
3813
|
+
}
|
|
3814
|
+
return this.$nextTick();
|
|
3815
|
+
},
|
|
3816
|
+
// 只保存隐藏列配置
|
|
3817
|
+
saveColumnHide: function saveColumnHide() {
|
|
3818
|
+
var id = this.id, tableFullColumn = this.tableFullColumn, settingOpts2 = this.settingOpts;
|
|
3819
|
+
if (settingOpts2.storage) {
|
|
3820
|
+
var columnHideStorageMap = this.getStorageMap(settingOpts2.storageKey);
|
|
3821
|
+
var colHides = tableFullColumn.filter(function(column) {
|
|
3822
|
+
return column.property && !column.visible;
|
|
3823
|
+
});
|
|
3824
|
+
columnHideStorageMap[id] = colHides.length ? colHides.map(function(column) {
|
|
3825
|
+
return column.property;
|
|
3826
|
+
}).join(",") : void 0;
|
|
3827
|
+
this.$refs.custom && this.$refs.custom.saveSettings();
|
|
3828
|
+
}
|
|
3829
|
+
return this.$nextTick();
|
|
3830
|
+
},
|
|
3831
|
+
saveColumnWidth: function saveColumnWidth(isReset) {
|
|
3832
|
+
var id = this.id, resizableOpts2 = this.resizableOpts, tableFullColumn = this.tableFullColumn;
|
|
3833
|
+
var storage = resizableOpts2.storage, storageKey = resizableOpts2.storageKey;
|
|
3834
|
+
var columnWidthStorageMap;
|
|
3835
|
+
if (storage) {
|
|
3836
|
+
columnWidthStorageMap = this.getStorageMap(storageKey);
|
|
3837
|
+
}
|
|
3838
|
+
var columnWidthStorage;
|
|
3839
|
+
if (storage && !isReset) {
|
|
3840
|
+
columnWidthStorage = columnWidthStorageMap[id];
|
|
3841
|
+
columnWidthStorage = isPlainObject(columnWidthStorage) ? columnWidthStorage : {};
|
|
3842
|
+
tableFullColumn.forEach(function(_ref22) {
|
|
3843
|
+
var property = _ref22.property, resizeWidth = _ref22.resizeWidth, renderWidth = _ref22.renderWidth;
|
|
3844
|
+
if (property && resizeWidth) {
|
|
3845
|
+
columnWidthStorage[property] = renderWidth;
|
|
3846
|
+
}
|
|
3847
|
+
});
|
|
3848
|
+
}
|
|
3849
|
+
if (storage) {
|
|
3850
|
+
columnWidthStorageMap[id] = isEmpty(columnWidthStorage) ? void 0 : columnWidthStorage;
|
|
3851
|
+
localStorage.setItem(storageKey, toJSONString(columnWidthStorageMap));
|
|
3852
|
+
}
|
|
3853
|
+
return this.$nextTick();
|
|
3854
|
+
},
|
|
3855
|
+
resetResizable: function resetResizable() {
|
|
3856
|
+
this.updateResizable(this);
|
|
3857
|
+
},
|
|
3858
|
+
updateResizable: function updateResizable(isReset) {
|
|
3859
|
+
var tableComp = this.$grid || this.table;
|
|
3860
|
+
this.saveColumnWidth(isReset);
|
|
3861
|
+
tableComp.analyColumnWidth();
|
|
3862
|
+
return tableComp.recalculate();
|
|
3863
|
+
},
|
|
3864
|
+
updateSetting: function updateSetting() {
|
|
3865
|
+
var _this34 = this;
|
|
3866
|
+
var tableComp = this.$grid || this.table;
|
|
3867
|
+
tableComp.refreshColumn();
|
|
3868
|
+
this.tableFullColumn = this.tableFullColumn.slice(0);
|
|
3869
|
+
return this.$nextTick(function() {
|
|
3870
|
+
return _this34.$refs.custom && _this34.$refs.custom.saveSettings();
|
|
3871
|
+
});
|
|
3872
|
+
},
|
|
3873
|
+
applySettings: function applySettings(_ref23) {
|
|
3874
|
+
var _this35 = this;
|
|
3875
|
+
var columns = _ref23.columns, pageSize = _ref23.pageSize, updatedSorting = _ref23.updatedSorting;
|
|
3876
|
+
var sort = this.setting && !!this.setting.sortable || updatedSorting;
|
|
3877
|
+
if (this.$grid) {
|
|
3878
|
+
if (columns && columns.length) {
|
|
3879
|
+
var colWidth = this.loadColWidth();
|
|
3880
|
+
this.$grid.reloadCustoms(columns, sort, colWidth).then(function() {
|
|
3881
|
+
_this35.$grid.handleTableData(true).then(function() {
|
|
3882
|
+
_this35.$grid.recalculate();
|
|
3883
|
+
});
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
if (isNumber(pageSize) && this.$grid.pagerConfig && this.$grid.pagerConfig.pageSize !== pageSize) {
|
|
3887
|
+
this.$grid.pageSizeChange(pageSize);
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
},
|
|
3891
|
+
handleSaveSettings: function handleSaveSettings(settingConfigs, visible, updatedSorting) {
|
|
3892
|
+
var settingStore = this.settingStore, setting = this.setting, settingOpts2 = this.settingOpts;
|
|
3893
|
+
var customRef = this.$refs.custom;
|
|
3894
|
+
settingStore.customVisible = false;
|
|
3895
|
+
var columns = settingConfigs.columns, pageSize = settingConfigs.pageSize, sortType = settingConfigs.sortType;
|
|
3896
|
+
this.applySettings({
|
|
3897
|
+
columns,
|
|
3898
|
+
pageSize,
|
|
3899
|
+
updatedSorting
|
|
3900
|
+
});
|
|
3901
|
+
if (setting && settingOpts2.storage === "local") {
|
|
3902
|
+
var pagerSettings = {
|
|
3903
|
+
pageSize,
|
|
3904
|
+
sortType,
|
|
3905
|
+
id: null
|
|
3906
|
+
};
|
|
3907
|
+
if (setting.multipleHistory && customRef.multipleHistoryId) {
|
|
3908
|
+
pagerSettings.id = customRef.multipleHistoryId;
|
|
3909
|
+
customRef.multipleHistoryId = null;
|
|
3910
|
+
}
|
|
3911
|
+
this.saveCustomSettings(columns);
|
|
3912
|
+
this.savePagerSettings(pagerSettings);
|
|
3913
|
+
} else if (setting && settingOpts2.storage === "remote") {
|
|
3914
|
+
if (settingOpts2.remote) {
|
|
3915
|
+
this.$emit("remote-setting", settingConfigs);
|
|
3916
|
+
if (setting.multipleHistory) {
|
|
3917
|
+
var _settingOpts$storageK, _toJSONString2;
|
|
3918
|
+
this.$emit("multiple-history-option", toJSONString((_toJSONString2 = {}, _toJSONString2[settingOpts2.storageKey] = (_settingOpts$storageK = {}, _settingOpts$storageK[this.id] = _extends({}, settingConfigs, {
|
|
3919
|
+
id: customRef.multipleHistoryId || null
|
|
3920
|
+
}), _settingOpts$storageK), _toJSONString2)));
|
|
3921
|
+
customRef.multipleHistoryId = null;
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
this.$emit("save-setting", settingConfigs);
|
|
3926
|
+
},
|
|
3927
|
+
handleGlobalMousedownEvent: function handleGlobalMousedownEvent(event) {
|
|
3928
|
+
if (!getEventTargetNode(event, this.$refs.customWrapper).flag) {
|
|
3929
|
+
this.closeSetting();
|
|
3930
|
+
}
|
|
3931
|
+
},
|
|
3932
|
+
handleGlobalBlurEvent: function handleGlobalBlurEvent() {
|
|
3933
|
+
this.closeSetting();
|
|
3934
|
+
},
|
|
3935
|
+
// NEXT 未用到
|
|
3936
|
+
handleClickSettingEvent: function handleClickSettingEvent() {
|
|
3937
|
+
var settingStore = this.settingStore;
|
|
3938
|
+
settingStore.visible = !settingStore.visible;
|
|
3939
|
+
},
|
|
3940
|
+
handleClickCustomEvent: function handleClickCustomEvent() {
|
|
3941
|
+
var settingStore = this.settingStore;
|
|
3942
|
+
this.$refs.custom.settings.pageSize = this.$grid.pagerConfig && this.$grid.pagerConfig.pageSize || this.settingOpts.storage === "local" && this.$refs.custom.settings.pageSize || 10;
|
|
3943
|
+
settingStore.customVisible = !settingStore.customVisible;
|
|
3944
|
+
},
|
|
3945
|
+
// NEXT 未用到
|
|
3946
|
+
handleMouseenterSettingEvent: function handleMouseenterSettingEvent() {
|
|
3947
|
+
this.settingStore.activeBtn = true;
|
|
3948
|
+
this.openSetting();
|
|
3949
|
+
},
|
|
3950
|
+
// NEXT 未用到
|
|
3951
|
+
handleMouseleaveSettingEvent: function handleMouseleaveSettingEvent() {
|
|
3952
|
+
this.settingStore.activeBtn = false;
|
|
3953
|
+
createMacroTask({
|
|
3954
|
+
_vm: this
|
|
3955
|
+
});
|
|
3956
|
+
},
|
|
3957
|
+
// NEXT 未用到
|
|
3958
|
+
handleWrapperMouseenterEvent: function handleWrapperMouseenterEvent() {
|
|
3959
|
+
this.settingStore.activeWrapper = true;
|
|
3960
|
+
this.openSetting();
|
|
3961
|
+
},
|
|
3962
|
+
// NEXT 未用到
|
|
3963
|
+
handleWrapperMouseleaveEvent: function handleWrapperMouseleaveEvent() {
|
|
3964
|
+
this.settingStore.activeWrapper = false;
|
|
3965
|
+
createMacroTask({
|
|
3966
|
+
_vm: this
|
|
3967
|
+
});
|
|
3968
|
+
},
|
|
3969
|
+
refreshEvent: function refreshEvent() {
|
|
3970
|
+
var _this36 = this;
|
|
3971
|
+
var $grid = this.$grid, isRefresh = this.isRefresh, refreshOpts2 = this.refreshOpts;
|
|
3972
|
+
var catchHandler = function catchHandler2(e) {
|
|
3973
|
+
return e;
|
|
3974
|
+
};
|
|
3975
|
+
var nextHandler = function nextHandler2() {
|
|
3976
|
+
return _this36.isRefresh = false;
|
|
3977
|
+
};
|
|
3978
|
+
if (isRefresh) return;
|
|
3979
|
+
this.isRefresh = true;
|
|
3980
|
+
if (refreshOpts2.query) {
|
|
3981
|
+
refreshOpts2.query().catch(catchHandler).then(nextHandler);
|
|
3982
|
+
return;
|
|
3983
|
+
}
|
|
3984
|
+
if ($grid && $grid.fetchData) {
|
|
3985
|
+
$grid.commitProxy("reload").catch(catchHandler).then(nextHandler);
|
|
3986
|
+
return;
|
|
3987
|
+
}
|
|
3988
|
+
if ($grid) {
|
|
3989
|
+
$grid.refreshData().then(nextHandler);
|
|
3990
|
+
}
|
|
3991
|
+
},
|
|
3992
|
+
btnEvent: function btnEvent(event, item) {
|
|
3993
|
+
var $grid = this.$grid, table = this.table, tableListeners = this.tableListeners;
|
|
3994
|
+
var code = item.code;
|
|
3995
|
+
if (code) {
|
|
3996
|
+
if ($grid && !tableListeners["button-click"]) {
|
|
3997
|
+
$grid.triggerToolbarBtnEvent(item, event);
|
|
3998
|
+
} else {
|
|
3999
|
+
var btnMethod = GridAdapter.buttons.get(code);
|
|
4000
|
+
var params = {
|
|
4001
|
+
code,
|
|
4002
|
+
button: item,
|
|
4003
|
+
$grid,
|
|
4004
|
+
$table: table
|
|
4005
|
+
};
|
|
4006
|
+
if (btnMethod) {
|
|
4007
|
+
btnMethod.call(this, params, event);
|
|
4008
|
+
}
|
|
4009
|
+
emitEvent(this, "button-click", [params, event]);
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
},
|
|
4013
|
+
fullscreenEvent: function fullscreenEvent() {
|
|
4014
|
+
var beforeOpenFullScreen;
|
|
4015
|
+
var beforeCloseFullScreen;
|
|
4016
|
+
var interceptFullScreen;
|
|
4017
|
+
var show = !this.isFull;
|
|
4018
|
+
if (this.fullScreen) {
|
|
4019
|
+
beforeOpenFullScreen = this.beforeOpenFullScreen;
|
|
4020
|
+
beforeCloseFullScreen = this.beforeCloseFullScreen;
|
|
4021
|
+
interceptFullScreen = show && typeof beforeOpenFullScreen === "function" && !beforeOpenFullScreen() || !show && typeof beforeCloseFullScreen === "function" && !beforeCloseFullScreen();
|
|
4022
|
+
if (interceptFullScreen) return;
|
|
4023
|
+
}
|
|
4024
|
+
if (this.$grid) {
|
|
4025
|
+
this.isFull = !this.isFull;
|
|
4026
|
+
this.$grid.commitProxy("fullscreen", this.isFull);
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
});
|
|
4031
|
+
var version = "2.21.0";
|
|
4032
|
+
GridToolbar.install = function(Vue) {
|
|
4033
|
+
Vue.component(GridToolbar.name, GridToolbar);
|
|
4034
|
+
};
|
|
4035
|
+
GridToolbar.version = version;
|
|
4036
|
+
|
|
4037
|
+
export { GridToolbar as default };
|