vxe-table 3.8.2 → 3.8.3-beta.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/lib/checkbox/src/group.js +7 -2
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/custom/src/mixin.js +3 -1
- package/lib/custom/src/mixin.min.js +1 -1
- package/lib/custom/src/panel.js +198 -45
- package/lib/custom/src/panel.min.js +1 -1
- package/lib/custom/style/style.css +327 -80
- package/lib/custom/style/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +308 -89
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +18 -7
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +18 -7
- package/lib/locale/lang/es-ES.js +18 -7
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +18 -7
- package/lib/locale/lang/ja-JP.js +18 -6
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +18 -6
- package/lib/locale/lang/pt-BR.js +18 -7
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +18 -7
- package/lib/locale/lang/zh-CN.js +18 -7
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +18 -7
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +18 -7
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +18 -7
- package/lib/locale/lang/zh-TC.js +18 -7
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +18 -7
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +18 -7
- package/lib/radio/src/group.js +7 -2
- package/lib/radio/src/group.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/columnInfo.js +10 -1
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +56 -33
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +3 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-table-custom-module/style/style.css +327 -80
- package/lib/vxe-table-custom-module/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/checkbox/src/group.js +6 -2
- package/packages/custom/src/mixin.js +2 -1
- package/packages/custom/src/panel.js +214 -52
- package/packages/locale/lang/en-US.js +18 -7
- package/packages/locale/lang/es-ES.js +18 -7
- package/packages/locale/lang/ja-JP.js +18 -6
- package/packages/locale/lang/pt-BR.js +18 -7
- package/packages/locale/lang/zh-CN.js +18 -7
- package/packages/locale/lang/zh-TC.js +18 -7
- package/packages/radio/src/group.js +6 -2
- package/packages/table/src/columnInfo.js +9 -3
- package/packages/table/src/methods.js +51 -33
- package/packages/table/src/table.js +3 -2
- package/styles/custom.scss +192 -86
- /package/lib/icon/style/{iconfont.1714101947757.ttf → iconfont.1714276918127.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1714101947757.woff → iconfont.1714276918127.woff} +0 -0
- /package/lib/icon/style/{iconfont.1714101947757.woff2 → iconfont.1714276918127.woff2} +0 -0
- /package/lib/{iconfont.1714101947757.ttf → iconfont.1714276918127.ttf} +0 -0
- /package/lib/{iconfont.1714101947757.woff → iconfont.1714276918127.woff} +0 -0
- /package/lib/{iconfont.1714101947757.woff2 → iconfont.1714276918127.woff2} +0 -0
|
@@ -55,13 +55,17 @@ var _default2 = exports.default = {
|
|
|
55
55
|
},
|
|
56
56
|
valueField: function valueField() {
|
|
57
57
|
return this.propsOpts.value || 'value';
|
|
58
|
+
},
|
|
59
|
+
disabledField: function disabledField() {
|
|
60
|
+
return this.propsOpts.disabled || 'disabled';
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
render: function render(h) {
|
|
61
64
|
var $scopedSlots = this.$scopedSlots,
|
|
62
65
|
options = this.options,
|
|
63
66
|
valueField = this.valueField,
|
|
64
|
-
labelField = this.labelField
|
|
67
|
+
labelField = this.labelField,
|
|
68
|
+
disabledField = this.disabledField;
|
|
65
69
|
var defaultSlot = $scopedSlots.default;
|
|
66
70
|
return h('div', {
|
|
67
71
|
class: 'vxe-checkbox-group'
|
|
@@ -69,7 +73,8 @@ var _default2 = exports.default = {
|
|
|
69
73
|
return h('vxe-checkbox', {
|
|
70
74
|
props: {
|
|
71
75
|
label: item[valueField],
|
|
72
|
-
content: item[labelField]
|
|
76
|
+
content: item[labelField],
|
|
77
|
+
disabled: item[disabledField]
|
|
73
78
|
}
|
|
74
79
|
});
|
|
75
80
|
}) : []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default2=exports.default={name:"VxeCheckboxGroup",props:{value:Array,options:Array,optionProps:Object,disabled:Boolean,max:[String,Number],size:{type:String,default:function(){return _conf.default.checkboxGroup.size||_conf.default.size}}},inject:{$xeform:{default:null},$xeformiteminfo:{default:null}},provide:function(){return{$xecheckboxgroup:this}},computed:{vSize:function(){return this.size||this.$parent.size||this.$parent.vSize},isMaximize:function(){var e=this.value,t=this.max;return!!t&&e.length>=_xeUtils.default.toNumber(t)},propsOpts:function(){return this.optionProps||{}},labelField:function(){return this.propsOpts.label||"label"},valueField:function(){return this.propsOpts.value||"value"}},render:function(t){var e=this.$scopedSlots,i=this.options,r=this.valueField,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default2=exports.default={name:"VxeCheckboxGroup",props:{value:Array,options:Array,optionProps:Object,disabled:Boolean,max:[String,Number],size:{type:String,default:function(){return _conf.default.checkboxGroup.size||_conf.default.size}}},inject:{$xeform:{default:null},$xeformiteminfo:{default:null}},provide:function(){return{$xecheckboxgroup:this}},computed:{vSize:function(){return this.size||this.$parent.size||this.$parent.vSize},isMaximize:function(){var e=this.value,t=this.max;return!!t&&e.length>=_xeUtils.default.toNumber(t)},propsOpts:function(){return this.optionProps||{}},labelField:function(){return this.propsOpts.label||"label"},valueField:function(){return this.propsOpts.value||"value"},disabledField:function(){return this.propsOpts.disabled||"disabled"}},render:function(t){var e=this.$scopedSlots,i=this.options,r=this.valueField,n=this.labelField,o=this.disabledField,e=e.default;return t("div",{class:"vxe-checkbox-group"},e?e.call(this,{}):i?i.map(function(e){return t("vxe-checkbox",{props:{label:e[r],content:e[n],disabled:e[o]}})}):[])},methods:{handleChecked:function(e,t){var i=e.checked,r=e.label,n=this.value||[],o=n.indexOf(r);i?-1===o&&n.push(r):n.splice(o,1),this.$emit("input",n),this.$emit("change",Object.assign({checklist:n},e)),this.$xeform&&this.$xeformiteminfo&&this.$xeform.triggerItemEvent(t,this.$xeformiteminfo.itemConfig.field,n)}}};
|
package/lib/custom/src/mixin.js
CHANGED
|
@@ -9,9 +9,11 @@ var _default = exports.default = {
|
|
|
9
9
|
_openCustom: function _openCustom() {
|
|
10
10
|
var _this = this;
|
|
11
11
|
var initStore = this.initStore,
|
|
12
|
-
customStore = this.customStore
|
|
12
|
+
customStore = this.customStore,
|
|
13
|
+
collectColumn = this.collectColumn;
|
|
13
14
|
customStore.visible = true;
|
|
14
15
|
initStore.custom = true;
|
|
16
|
+
this.customColumnList = collectColumn.slice(0);
|
|
15
17
|
this.checkCustomStatus();
|
|
16
18
|
this.calcMaxHeight();
|
|
17
19
|
return this.$nextTick().then(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=exports.default={methods:{_openCustom:function(){var t=this,e=this.initStore;return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=exports.default={methods:{_openCustom:function(){var t=this,e=this.initStore,i=this.customStore,s=this.collectColumn;return i.visible=!0,e.custom=!0,this.customColumnList=s.slice(0),this.checkCustomStatus(),this.calcMaxHeight(),this.$nextTick().then(function(){return t.calcMaxHeight()})},_closeCustom:function(){var t=this.customStore,e=this.customOpts;return t.visible&&(t.visible=!1,e.immediate||this.handleCustom()),this.$nextTick()},calcMaxHeight:function(){var t=this.$refs,e=this.customStore,i=t.customWrapper?t.customWrapper.$el:null,s=t.tableHeader?t.tableHeader.$el:null,t=t.tableBody?t.tableBody.$el:null,o=0;s&&(o+=s.clientHeight),t&&(o+=t.clientHeight),e.maxHeight=Math.max(0,i?Math.min(i.clientHeight,o-80):0)},checkCustomStatus:function(){var t=this.customStore,e=this.collectColumn,i=this.customOpts.checkMethod;t.isAll=e.every(function(t){return!!i&&!i({column:t})||t.visible}),t.isIndeterminate=!t.isAll&&e.some(function(t){return(!i||i({column:t}))&&(t.visible||t.halfVisible)})},emitCustomEvent:function(t,e){(this.$xegrid||this).$emit("custom",{type:t,$table:this,$grid:this.$xegrid,$event:e})},triggerCustomEvent:function(t){var e=this.customStore;e.visible?(this.closeCustom(),this.emitCustomEvent("close",t)):(e.btnEl=t.target,this.openCustom(),this.emitCustomEvent("open",t))},customOpenEvent:function(t){var e=this.customStore;e.visible||(e.activeBtn=!0,e.btnEl=t.target,this.openCustom(),this.emitCustomEvent("open",t))},customColseEvent:function(t){var e=this.customStore;e.visible&&(e.activeBtn=!1,this.closeCustom(),this.emitCustomEvent("close",t))}}};
|
package/lib/custom/src/panel.js
CHANGED
|
@@ -5,20 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _utils = _interopRequireDefault(require("../../tools/utils"));
|
|
8
|
+
var _dom = _interopRequireDefault(require("../../tools/dom"));
|
|
8
9
|
var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
|
|
9
10
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var formatText = _utils.default.formatText;
|
|
13
|
+
var addClass = _dom.default.addClass,
|
|
14
|
+
removeClass = _dom.default.removeClass;
|
|
15
|
+
function updateDropHint(_vm, evnt) {
|
|
16
|
+
var $refs = _vm.$refs;
|
|
17
|
+
var dragHintEl = $refs.dragHintElemRef;
|
|
18
|
+
var bodyEl = $refs.bodyElemRef;
|
|
19
|
+
if (!bodyEl) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (dragHintEl) {
|
|
23
|
+
var warpperEl = bodyEl.parentNode;
|
|
24
|
+
var warpperRect = warpperEl.getBoundingClientRect();
|
|
25
|
+
dragHintEl.style.display = 'block';
|
|
26
|
+
dragHintEl.style.top = "".concat(Math.min(warpperEl.clientHeight - warpperEl.scrollTop - dragHintEl.clientHeight, evnt.clientY - warpperRect.y), "px");
|
|
27
|
+
dragHintEl.style.left = "".concat(Math.min(warpperEl.clientWidth - warpperEl.scrollLeft - dragHintEl.clientWidth - 16, evnt.clientX - warpperRect.x), "px");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
17
30
|
function renderSimplePanel(h, _vm) {
|
|
18
31
|
var $xetable = _vm.$xetable,
|
|
19
32
|
customStore = _vm.customStore;
|
|
20
33
|
var customOpts = $xetable.customOpts,
|
|
21
|
-
|
|
34
|
+
customColumnList = $xetable.customColumnList,
|
|
22
35
|
isMaxFixedColumn = $xetable.isMaxFixedColumn;
|
|
23
36
|
var maxHeight = customStore.maxHeight;
|
|
24
37
|
var checkMethod = customOpts.checkMethod,
|
|
@@ -28,18 +41,18 @@ function renderSimplePanel(h, _vm) {
|
|
|
28
41
|
var customWrapperOns = {};
|
|
29
42
|
// hover 触发
|
|
30
43
|
if (trigger === 'hover') {
|
|
31
|
-
customWrapperOns.
|
|
32
|
-
customWrapperOns.
|
|
44
|
+
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
|
|
45
|
+
customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
|
|
33
46
|
}
|
|
34
|
-
_xeUtils.default.eachTree(
|
|
47
|
+
_xeUtils.default.eachTree(customColumnList, function (column, index, items, path, parent) {
|
|
35
48
|
var isVisible = visibleMethod ? visibleMethod({
|
|
36
49
|
column: column
|
|
37
50
|
}) : true;
|
|
38
51
|
if (isVisible) {
|
|
39
52
|
var isChecked = column.visible;
|
|
40
53
|
var isIndeterminate = column.halfVisible;
|
|
41
|
-
var colTitle = _utils.default.formatText(column.getTitle(), 1);
|
|
42
54
|
var isColGroup = column.children && column.children.length;
|
|
55
|
+
var colTitle = formatText(column.getTitle(), 1);
|
|
43
56
|
var isDisabled = checkMethod ? !checkMethod({
|
|
44
57
|
column: column
|
|
45
58
|
}) : false;
|
|
@@ -49,14 +62,12 @@ function renderSimplePanel(h, _vm) {
|
|
|
49
62
|
'is--group': isColGroup
|
|
50
63
|
}]
|
|
51
64
|
}, [h('div', {
|
|
65
|
+
title: colTitle,
|
|
52
66
|
class: ['vxe-table-custom--checkbox-option', {
|
|
53
67
|
'is--checked': isChecked,
|
|
54
68
|
'is--indeterminate': isIndeterminate,
|
|
55
69
|
'is--disabled': isDisabled
|
|
56
70
|
}],
|
|
57
|
-
attrs: {
|
|
58
|
-
title: colTitle
|
|
59
|
-
},
|
|
60
71
|
on: {
|
|
61
72
|
click: function click() {
|
|
62
73
|
if (!isDisabled) {
|
|
@@ -125,12 +136,13 @@ function renderSimplePanel(h, _vm) {
|
|
|
125
136
|
class: ['vxe-checkbox--icon', isAllIndeterminate ? _conf.default.icon.TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? _conf.default.icon.TABLE_CHECKBOX_CHECKED : _conf.default.icon.TABLE_CHECKBOX_UNCHECKED]
|
|
126
137
|
}), h('span', {
|
|
127
138
|
class: 'vxe-checkbox--label'
|
|
128
|
-
}, _conf.default.i18n('vxe.toolbar.customAll'))])])]), h('ul',
|
|
139
|
+
}, _conf.default.i18n('vxe.toolbar.customAll'))])])]), h('ul', {
|
|
129
140
|
class: 'vxe-table-custom--body',
|
|
130
141
|
style: maxHeight ? {
|
|
131
142
|
maxHeight: "".concat(maxHeight, "px")
|
|
132
|
-
} : {}
|
|
133
|
-
|
|
143
|
+
} : {},
|
|
144
|
+
on: customWrapperOns
|
|
145
|
+
}, colVNs), customOpts.showFooter ? h('div', {
|
|
134
146
|
class: 'vxe-table-custom--footer'
|
|
135
147
|
}, [h('button', {
|
|
136
148
|
class: 'btn--reset',
|
|
@@ -144,41 +156,59 @@ function renderSimplePanel(h, _vm) {
|
|
|
144
156
|
}
|
|
145
157
|
}, customOpts.confirmButtonText || _conf.default.i18n('vxe.toolbar.customConfirm'))]) : null]);
|
|
146
158
|
}
|
|
147
|
-
|
|
159
|
+
function renderPopupPanel(h, _vm) {
|
|
148
160
|
var $xetable = _vm.$xetable,
|
|
149
161
|
customStore = _vm.customStore;
|
|
150
162
|
var customOpts = $xetable.customOpts,
|
|
151
|
-
|
|
163
|
+
customColumnList = $xetable.customColumnList,
|
|
152
164
|
isMaxFixedColumn = $xetable.isMaxFixedColumn;
|
|
153
165
|
var checkMethod = customOpts.checkMethod,
|
|
154
166
|
visibleMethod = customOpts.visibleMethod;
|
|
155
167
|
var trVNs = [];
|
|
156
|
-
_xeUtils.default.eachTree(
|
|
168
|
+
_xeUtils.default.eachTree(customColumnList, function (column, index, items, path, parent) {
|
|
157
169
|
var isVisible = visibleMethod ? visibleMethod({
|
|
158
170
|
column: column
|
|
159
171
|
}) : true;
|
|
160
172
|
if (isVisible) {
|
|
161
173
|
var isChecked = column.visible;
|
|
162
174
|
var isIndeterminate = column.halfVisible;
|
|
163
|
-
var colTitle =
|
|
175
|
+
var colTitle = formatText(column.getTitle(), 1);
|
|
164
176
|
var isColGroup = column.children && column.children.length;
|
|
165
177
|
var isDisabled = checkMethod ? !checkMethod({
|
|
166
178
|
column: column
|
|
167
179
|
}) : false;
|
|
168
180
|
trVNs.push(h('tr', {
|
|
169
181
|
key: column.id,
|
|
170
|
-
class: ["vxe-table-custom-popup--row
|
|
182
|
+
class: ["vxe-table-custom-popup--row level--".concat(column.level), {
|
|
171
183
|
'is--group': isColGroup
|
|
172
|
-
}]
|
|
184
|
+
}],
|
|
185
|
+
attrs: {
|
|
186
|
+
colid: column.id
|
|
187
|
+
},
|
|
188
|
+
on: {
|
|
189
|
+
dragstart: _vm.sortDragstartEvent,
|
|
190
|
+
dragend: _vm.sortDragendEvent,
|
|
191
|
+
dragover: _vm.sortDragoverEvent
|
|
192
|
+
}
|
|
173
193
|
}, [h('td', {
|
|
174
|
-
class: 'vxe-table-custom-popup--column-
|
|
194
|
+
class: 'vxe-table-custom-popup--column-item col--sort'
|
|
195
|
+
}, [column.level === 1 ? h('span', {
|
|
196
|
+
class: 'vxe-table-custom-popup--column-sort-btn',
|
|
197
|
+
on: {
|
|
198
|
+
mousedown: _vm.sortMousedownEvent,
|
|
199
|
+
mouseup: _vm.sortMouseupEvent
|
|
200
|
+
}
|
|
201
|
+
}, [h('i', {
|
|
202
|
+
class: 'vxe-icon-sort'
|
|
203
|
+
})]) : null]), h('td', {
|
|
204
|
+
class: 'vxe-table-custom-popup--column-item col--name'
|
|
175
205
|
}, [h('div', {
|
|
176
206
|
class: 'vxe-table-custom-popup--name',
|
|
177
207
|
attrs: {
|
|
178
208
|
title: colTitle
|
|
179
209
|
}
|
|
180
210
|
}, colTitle)]), h('td', {
|
|
181
|
-
class: 'vxe-table-custom-popup--column-
|
|
211
|
+
class: 'vxe-table-custom-popup--column-item col--visible'
|
|
182
212
|
}, [h('div', {
|
|
183
213
|
class: ['vxe-table-custom--checkbox-option', {
|
|
184
214
|
'is--checked': isChecked,
|
|
@@ -195,22 +225,23 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
195
225
|
}, [h('span', {
|
|
196
226
|
class: ['vxe-checkbox--icon', isIndeterminate ? _conf.default.icon.TABLE_CHECKBOX_INDETERMINATE : isChecked ? _conf.default.icon.TABLE_CHECKBOX_CHECKED : _conf.default.icon.TABLE_CHECKBOX_UNCHECKED]
|
|
197
227
|
})])]), h('td', {
|
|
198
|
-
class: 'vxe-table-custom-popup--column-fixed'
|
|
228
|
+
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
199
229
|
}, [!parent && customOpts.allowFixed ? h('vxe-radio-group', {
|
|
200
230
|
props: {
|
|
201
231
|
value: column.fixed || '',
|
|
202
|
-
disabled: isMaxFixedColumn,
|
|
203
232
|
type: 'button',
|
|
204
233
|
size: 'mini',
|
|
205
234
|
options: [{
|
|
206
|
-
label: '
|
|
207
|
-
value: 'left'
|
|
235
|
+
label: _conf.default.i18n('vxe.custom.setting.fixedLeft'),
|
|
236
|
+
value: 'left',
|
|
237
|
+
disabled: isMaxFixedColumn
|
|
208
238
|
}, {
|
|
209
|
-
label: '
|
|
239
|
+
label: _conf.default.i18n('vxe.custom.setting.fixedUnset'),
|
|
210
240
|
value: ''
|
|
211
241
|
}, {
|
|
212
|
-
label: '
|
|
213
|
-
value: 'right'
|
|
242
|
+
label: _conf.default.i18n('vxe.custom.setting.fixedRight'),
|
|
243
|
+
value: 'right',
|
|
244
|
+
disabled: isMaxFixedColumn
|
|
214
245
|
}]
|
|
215
246
|
},
|
|
216
247
|
on: {
|
|
@@ -227,15 +258,19 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
227
258
|
return h('vxe-modal', {
|
|
228
259
|
key: 'popup',
|
|
229
260
|
props: {
|
|
230
|
-
className: 'vxe-table-custom-popup-warpper vxe-table--ignore-clear',
|
|
231
261
|
value: customStore.visible,
|
|
232
262
|
title: _conf.default.i18n('vxe.custom.cstmTitle'),
|
|
233
|
-
|
|
234
|
-
|
|
263
|
+
className: 'vxe-table-custom-popup-warpper vxe-table--ignore-clear',
|
|
264
|
+
width: '40vw',
|
|
265
|
+
minWidth: 500,
|
|
266
|
+
height: '50vh',
|
|
267
|
+
minHeight: 300,
|
|
235
268
|
mask: true,
|
|
236
269
|
lockView: true,
|
|
237
270
|
showFooter: true,
|
|
238
|
-
|
|
271
|
+
resize: true,
|
|
272
|
+
escClosable: true,
|
|
273
|
+
destroyOnClose: true
|
|
239
274
|
},
|
|
240
275
|
on: {
|
|
241
276
|
input: function input(value) {
|
|
@@ -245,8 +280,15 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
245
280
|
scopedSlots: {
|
|
246
281
|
default: function _default() {
|
|
247
282
|
return h('div', {
|
|
283
|
+
ref: 'bodyElemRef',
|
|
248
284
|
class: 'vxe-table-custom-popup--body'
|
|
249
|
-
}, [h('
|
|
285
|
+
}, [h('div', {
|
|
286
|
+
class: 'vxe-table-custom-popup--table-warpper'
|
|
287
|
+
}, [h('table', {}, [h('colgroup', {}, [h('col', {
|
|
288
|
+
style: {
|
|
289
|
+
width: '60px'
|
|
290
|
+
}
|
|
291
|
+
}), h('col'), h('col', {
|
|
250
292
|
style: {
|
|
251
293
|
width: '80px'
|
|
252
294
|
}
|
|
@@ -254,7 +296,16 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
254
296
|
style: {
|
|
255
297
|
width: '200px'
|
|
256
298
|
}
|
|
257
|
-
})]), h('thead', {}, [h('tr', {}, [h('th', {}, '
|
|
299
|
+
})]), h('thead', {}, [h('tr', {}, [h('th', {}, _conf.default.i18n('vxe.custom.setting.colSort')), h('th', {}, _conf.default.i18n('vxe.custom.setting.colTitle')), h('th', {}, _conf.default.i18n('vxe.custom.setting.colVisible')), h('th', {}, _conf.default.i18n('vxe.custom.setting.colFixed'))])]), h('transition-group', {
|
|
300
|
+
class: 'vxe-table-custom--body',
|
|
301
|
+
props: {
|
|
302
|
+
tag: 'tbody',
|
|
303
|
+
name: 'vxe-table-custom--flip'
|
|
304
|
+
}
|
|
305
|
+
}, trVNs)])]), h('div', {
|
|
306
|
+
ref: 'dragHintElemRef',
|
|
307
|
+
class: 'vxe-table-custom-popup--drag-hint'
|
|
308
|
+
}, _conf.default.i18n('vxe.custom.cstmDragTarget', [_vm.dragColumn ? _vm.dragColumn.getTitle() : '']))]);
|
|
258
309
|
},
|
|
259
310
|
footer: function footer() {
|
|
260
311
|
return h('div', {
|
|
@@ -285,7 +336,7 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
285
336
|
}
|
|
286
337
|
}
|
|
287
338
|
});
|
|
288
|
-
}
|
|
339
|
+
}
|
|
289
340
|
var _default2 = exports.default = {
|
|
290
341
|
name: 'VxeTableCustomPanel',
|
|
291
342
|
props: {
|
|
@@ -301,6 +352,11 @@ var _default2 = exports.default = {
|
|
|
301
352
|
default: null
|
|
302
353
|
}
|
|
303
354
|
},
|
|
355
|
+
data: function data() {
|
|
356
|
+
return {
|
|
357
|
+
dragColumn: null
|
|
358
|
+
};
|
|
359
|
+
},
|
|
304
360
|
computed: {},
|
|
305
361
|
render: function render(h) {
|
|
306
362
|
var $xetable = this.$xetable;
|
|
@@ -348,8 +404,8 @@ var _default2 = exports.default = {
|
|
|
348
404
|
},
|
|
349
405
|
handleOptionCheck: function handleOptionCheck(column) {
|
|
350
406
|
var $xetable = this.$xetable;
|
|
351
|
-
var
|
|
352
|
-
var matchObj = _xeUtils.default.findTree(
|
|
407
|
+
var customColumnList = $xetable.customColumnList;
|
|
408
|
+
var matchObj = _xeUtils.default.findTree(customColumnList, function (item) {
|
|
353
409
|
return item === column;
|
|
354
410
|
});
|
|
355
411
|
if (matchObj && matchObj.parent) {
|
|
@@ -399,12 +455,12 @@ var _default2 = exports.default = {
|
|
|
399
455
|
},
|
|
400
456
|
allCustomEvent: function allCustomEvent() {
|
|
401
457
|
var $xetable = this.$xetable,
|
|
402
|
-
customStore = this.customStore
|
|
403
|
-
|
|
404
|
-
|
|
458
|
+
customStore = this.customStore;
|
|
459
|
+
var customOpts = $xetable.customOpts,
|
|
460
|
+
customColumnList = $xetable.customColumnList;
|
|
405
461
|
var checkMethod = customOpts.checkMethod;
|
|
406
462
|
var isAll = !customStore.isAll;
|
|
407
|
-
_xeUtils.default.eachTree(
|
|
463
|
+
_xeUtils.default.eachTree(customColumnList, function (column) {
|
|
408
464
|
if (!checkMethod || checkMethod({
|
|
409
465
|
column: column
|
|
410
466
|
})) {
|
|
@@ -414,6 +470,103 @@ var _default2 = exports.default = {
|
|
|
414
470
|
});
|
|
415
471
|
customStore.isAll = isAll;
|
|
416
472
|
$xetable.checkCustomStatus();
|
|
473
|
+
},
|
|
474
|
+
sortMousedownEvent: function sortMousedownEvent(evnt) {
|
|
475
|
+
var $xetable = this.$xetable;
|
|
476
|
+
var btnEl = evnt.currentTarget;
|
|
477
|
+
var tdEl = btnEl.parentNode;
|
|
478
|
+
var trEl = tdEl.parentNode;
|
|
479
|
+
var colid = trEl.getAttribute('colid');
|
|
480
|
+
var column = $xetable.getColumnById(colid);
|
|
481
|
+
trEl.draggable = true;
|
|
482
|
+
this.dragColumn = column;
|
|
483
|
+
addClass(trEl, 'active--drag-origin');
|
|
484
|
+
},
|
|
485
|
+
sortMouseupEvent: function sortMouseupEvent(evnt) {
|
|
486
|
+
var btnEl = evnt.currentTarget;
|
|
487
|
+
var tdEl = btnEl.parentNode;
|
|
488
|
+
var trEl = tdEl.parentNode;
|
|
489
|
+
var dragHintEl = this.$refs.dragHintElemRef;
|
|
490
|
+
trEl.draggable = false;
|
|
491
|
+
this.dragColumn = null;
|
|
492
|
+
removeClass(trEl, 'active--drag-origin');
|
|
493
|
+
if (dragHintEl) {
|
|
494
|
+
dragHintEl.style.display = '';
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
sortDragstartEvent: function sortDragstartEvent(evnt) {
|
|
498
|
+
var img = new Image();
|
|
499
|
+
if (evnt.dataTransfer) {
|
|
500
|
+
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
sortDragendEvent: function sortDragendEvent(evnt) {
|
|
504
|
+
var $xetable = this.$xetable,
|
|
505
|
+
prevDropTrEl = this.prevDropTrEl;
|
|
506
|
+
var customColumnList = $xetable.customColumnList;
|
|
507
|
+
var trEl = evnt.currentTarget;
|
|
508
|
+
var dragHintEl = this.$refs.dragHintElemRef;
|
|
509
|
+
if (prevDropTrEl) {
|
|
510
|
+
// 判断是否有拖动
|
|
511
|
+
if (prevDropTrEl !== trEl) {
|
|
512
|
+
var dragOffset = prevDropTrEl.getAttribute('dragoffset');
|
|
513
|
+
var colid = trEl.getAttribute('colid');
|
|
514
|
+
var column = $xetable.getColumnById(colid);
|
|
515
|
+
if (!column) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
var cIndex = _xeUtils.default.findIndexOf(customColumnList, function (item) {
|
|
519
|
+
return item.id === column.id;
|
|
520
|
+
});
|
|
521
|
+
var targetColid = prevDropTrEl.getAttribute('colid');
|
|
522
|
+
var targetColumn = $xetable.getColumnById(targetColid);
|
|
523
|
+
if (!targetColumn) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
// 移出源位置
|
|
527
|
+
customColumnList.splice(cIndex, 1);
|
|
528
|
+
var tcIndex = _xeUtils.default.findIndexOf(customColumnList, function (item) {
|
|
529
|
+
return item.id === targetColumn.id;
|
|
530
|
+
});
|
|
531
|
+
// 插新位置
|
|
532
|
+
customColumnList.splice(tcIndex + (dragOffset === 'bottom' ? 1 : 0), 0, column);
|
|
533
|
+
}
|
|
534
|
+
prevDropTrEl.draggable = false;
|
|
535
|
+
prevDropTrEl.removeAttribute('dragoffset');
|
|
536
|
+
removeClass(prevDropTrEl, 'active--drag-target');
|
|
537
|
+
}
|
|
538
|
+
this.dragColumn = null;
|
|
539
|
+
trEl.draggable = false;
|
|
540
|
+
trEl.removeAttribute('dragoffset');
|
|
541
|
+
if (dragHintEl) {
|
|
542
|
+
dragHintEl.style.display = '';
|
|
543
|
+
}
|
|
544
|
+
removeClass(trEl, 'active--drag-target');
|
|
545
|
+
removeClass(trEl, 'active--drag-origin');
|
|
546
|
+
// 更新顺序
|
|
547
|
+
customColumnList.forEach(function (column, index) {
|
|
548
|
+
column.renderSortNumber = index;
|
|
549
|
+
});
|
|
550
|
+
},
|
|
551
|
+
sortDragoverEvent: function sortDragoverEvent(evnt) {
|
|
552
|
+
var $xetable = this.$xetable,
|
|
553
|
+
prevDropTrEl = this.prevDropTrEl;
|
|
554
|
+
var trEl = evnt.currentTarget;
|
|
555
|
+
if (prevDropTrEl !== trEl) {
|
|
556
|
+
removeClass(prevDropTrEl, 'active--drag-target');
|
|
557
|
+
}
|
|
558
|
+
var colid = trEl.getAttribute('colid');
|
|
559
|
+
var column = $xetable.getColumnById(colid);
|
|
560
|
+
// 是否移入有效元行
|
|
561
|
+
if (column && column.level === 1) {
|
|
562
|
+
evnt.preventDefault();
|
|
563
|
+
var offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
564
|
+
var dragOffset = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
565
|
+
addClass(trEl, 'active--drag-target');
|
|
566
|
+
trEl.setAttribute('dragoffset', dragOffset);
|
|
567
|
+
this.prevDropTrEl = trEl;
|
|
568
|
+
}
|
|
569
|
+
updateDropHint(this, evnt);
|
|
417
570
|
}
|
|
418
571
|
}
|
|
419
572
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _utils=_interopRequireDefault(require("../../tools/utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var o,n=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(o),!0).forEach(function(e){_defineProperty(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}function renderSimplePanel(a,f){var e=f.$xetable,t=f.customStore,p=e.customOpts,o=e.collectColumn,d=e.isMaxFixedColumn,e=t.maxHeight,m=p.checkMethod,v=p.visibleMethod,n=p.trigger,b=[],i={},n=("hover"===n&&(i.onMouseenter=f.handleWrapperMouseenterEvent,i.onMouseleave=f.handleWrapperMouseleaveEvent),_xeUtils.default.eachTree(o,function(e,t,o,n,i){var l,c,s,u,r;v&&!v({column:e})||(l=e.visible,c=e.halfVisible,s=_utils.default.formatText(e.getTitle(),1),u=e.children&&e.children.length,r=!!m&&!m({column:e}),b.push(a("li",{key:e.id,class:["vxe-table-custom--option","level--".concat(e.level),{"is--group":u}]},[a("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":l,"is--indeterminate":c,"is--disabled":r}],attrs:{title:s},on:{click:function(){r||f.changeCheckboxOption(e)}}},[a("span",{class:["vxe-checkbox--icon",c?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:l?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]}),a("span",{class:"vxe-checkbox--label"},s)]),!i&&p.allowFixed?a("div",{class:"vxe-table-custom--fixed-option"},[a("span",{class:["vxe-table-custom--fixed-left-option","left"===e.fixed?_conf.default.icon.TOOLBAR_TOOLS_FIXED_LEFT_ACTIVED:_conf.default.icon.TOOLBAR_TOOLS_FIXED_LEFT,{"is--checked":"left"===e.fixed,"is--disabled":d&&!e.fixed}],attrs:{title:_conf.default.i18n("left"===e.fixed?"vxe.toolbar.cancelfixed":"vxe.toolbar.fixedLeft")},on:{click:function(){f.changeFixedOption(e,"left")}}}),a("span",{class:["vxe-table-custom--fixed-right-option","right"===e.fixed?_conf.default.icon.TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVED:_conf.default.icon.TOOLBAR_TOOLS_FIXED_RIGHT,{"is--checked":"right"===e.fixed,"is--disabled":d&&!e.fixed}],attrs:{title:_conf.default.i18n("right"===e.fixed?"vxe.toolbar.cancelfixed":"vxe.toolbar.fixedRight")},on:{click:function(){f.changeFixedOption(e,"right")}}})]):null])))}),t.isAll),o=t.isIndeterminate;return a("div",{key:"simple",class:["vxe-table-custom-wrapper",{"is--active":t.visible}]},[a("ul",{class:"vxe-table-custom--header"},[a("li",{class:"vxe-table-custom--option"},[a("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":n,"is--indeterminate":o}],attrs:{title:_conf.default.i18n("vxe.table.allTitle")},on:{click:f.allCustomEvent}},[a("span",{class:["vxe-checkbox--icon",o?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:n?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]}),a("span",{class:"vxe-checkbox--label"},_conf.default.i18n("vxe.toolbar.customAll"))])])]),a("ul",_objectSpread({class:"vxe-table-custom--body",style:e?{maxHeight:"".concat(e,"px")}:{}},i),b),p.showFooter?a("div",{class:"vxe-table-custom--footer"},[a("button",{class:"btn--reset",on:{click:f.resetCustomEvent}},p.resetButtonText||_conf.default.i18n("vxe.toolbar.customRestore")),a("button",{class:"btn--confirm",on:{click:f.confirmCustomEvent}},p.confirmButtonText||_conf.default.i18n("vxe.toolbar.customConfirm"))]):null])}var renderPopupPanel=function(a,f){var e=f.$xetable,t=f.customStore,p=e.customOpts,o=e.collectColumn,d=e.isMaxFixedColumn,m=p.checkMethod,v=p.visibleMethod,b=[];return _xeUtils.default.eachTree(o,function(t,e,o,n,i){var l,c,s,u,r;v&&!v({column:t})||(l=t.visible,c=t.halfVisible,s=_utils.default.formatText(t.getTitle(),1),u=t.children&&t.children.length,r=!!m&&!m({column:t}),b.push(a("tr",{key:t.id,class:["vxe-table-custom-popup--row-level".concat(t.level),{"is--group":u}]},[a("td",{class:"vxe-table-custom-popup--column-name"},[a("div",{class:"vxe-table-custom-popup--name",attrs:{title:s}},s)]),a("td",{class:"vxe-table-custom-popup--column-visiblw"},[a("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":l,"is--indeterminate":c,"is--disabled":r}],on:{click:function(){r||f.changeCheckboxOption(t)}}},[a("span",{class:["vxe-checkbox--icon",c?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:l?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]})])]),a("td",{class:"vxe-table-custom-popup--column-fixed"},[!i&&p.allowFixed?a("vxe-radio-group",{props:{value:t.fixed||"",disabled:d,type:"button",size:"mini",options:[{label:"左侧",value:"left"},{label:"不固定",value:""},{label:"右侧",value:"right"}]},on:{input:function(e){t.fixed=e},change:function(){f.changePopupFixedOption(t)}}}):null])])))}),a("vxe-modal",{key:"popup",props:{className:"vxe-table-custom-popup-warpper vxe-table--ignore-clear",value:t.visible,title:_conf.default.i18n("vxe.custom.cstmTitle"),width:700,maxHeight:500,mask:!0,lockView:!0,showFooter:!0,escClosable:!0},on:{input:function(e){t.visible=e}},scopedSlots:{default:function(){return a("div",{class:"vxe-table-custom-popup--body"},[a("table",{},[a("colgroup",{},[a("col"),a("col",{style:{width:"80px"}}),a("col",{style:{width:"200px"}})]),a("thead",{},[a("tr",{},[a("th",{},"标题"),a("th",{},"是否显示"),a("th",{},"是否固定")])]),a("tbody",{},b)])])},footer:function(){return a("div",{class:"vxe-table-custom-popup--footer"},[a("vxe-button",{props:{content:p.resetButtonText||_conf.default.i18n("vxe.custom.cstmRestore")},on:{click:f.resetPopupCustomEvent}}),a("vxe-button",{props:{content:p.resetButtonText||_conf.default.i18n("vxe.custom.cstmCancel")},on:{click:f.cancelCustomEvent}}),a("vxe-button",{props:{status:"primary",content:p.confirmButtonText||_conf.default.i18n("vxe.custom.cstmConfirm")},on:{click:f.confirmCustomEvent}})])}}})},_default2=exports.default={name:"VxeTableCustomPanel",props:{customStore:{type:Object,default:function(){return{}}}},inject:{$xetable:{default:null}},computed:{},render:function(e){return("popup"===this.$xetable.customOpts.mode?renderPopupPanel:renderSimplePanel)(e,this)},methods:{handleWrapperMouseenterEvent:function(e){var t=this.$xetable;this.customStore.activeWrapper=!0,t.customOpenEvent(e)},handleWrapperMouseleaveEvent:function(e){var t=this.$xetable,o=this.customStore;o.activeWrapper=!1,setTimeout(function(){o.activeBtn||o.activeWrapper||t.customColseEvent(e)},300)},confirmCustomEvent:function(e){var t=this.$xetable;t.closeCustom(),t.emitCustomEvent("confirm",e)},cancelCustomEvent:function(e){var t=this.$xetable;t.closeCustom(),t.emitCustomEvent("cancel",e)},resetCustomEvent:function(e){var t=this.$xetable;t.resetColumn(!0),t.closeCustom(),t.emitCustomEvent("reset",e)},resetPopupCustomEvent:function(e){this.resetCustomEvent(e)},handleOptionCheck:function(t){var e=this.$xetable.collectColumn,e=_xeUtils.default.findTree(e,function(e){return e===t});e&&e.parent&&(e=e.parent).children&&e.children.length&&(e.visible=e.children.every(function(e){return e.visible}),e.halfVisible=!e.visible&&e.children.some(function(e){return e.visible||e.halfVisible}),this.handleOptionCheck(e))},changeCheckboxOption:function(e){var t=this.$xetable,o=t.customOpts,n=!e.visible;_xeUtils.default.eachTree([e],function(e){e.visible=n,e.halfVisible=!1}),this.handleOptionCheck(e),o.immediate&&t.handleCustom(),t.checkCustomStatus()},changeFixedOption:function(e,t){var o=this.$xetable,n=o.isMaxFixedColumn;e.fixed===t?o.clearColumnFixed(e):n&&!e.fixed||o.setColumnFixed(e,t)},changePopupFixedOption:function(e){var t=this.$xetable;t.isMaxFixedColumn||t.setColumnFixed(e,e.fixed)},allCustomEvent:function(){var e=this.$xetable,t=this.customStore,o=this.collectColumn,n=this.customOpts.checkMethod,i=!t.isAll;_xeUtils.default.eachTree(o,function(e){n&&!n({column:e})||(e.visible=i,e.halfVisible=!1)}),t.isAll=i,e.checkCustomStatus()}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _utils=_interopRequireDefault(require("../../tools/utils")),_dom=_interopRequireDefault(require("../../tools/dom")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var formatText=_utils.default.formatText,addClass=_dom.default.addClass,removeClass=_dom.default.removeClass;function updateDropHint(e,t){var o,e=e.$refs,i=e.dragHintElemRef,e=e.bodyElemRef;e&&i&&(o=(e=e.parentNode).getBoundingClientRect(),i.style.display="block",i.style.top="".concat(Math.min(e.clientHeight-e.scrollTop-i.clientHeight,t.clientY-o.y),"px"),i.style.left="".concat(Math.min(e.clientWidth-e.scrollLeft-i.clientWidth-16,t.clientX-o.x),"px"))}function renderSimplePanel(u,d){var e=d.$xetable,t=d.customStore,f=e.customOpts,o=e.customColumnList,m=e.isMaxFixedColumn,e=t.maxHeight,v=f.checkMethod,p=f.visibleMethod,i=f.trigger,x=[],n={},i=("hover"===i&&(n.mouseenter=d.handleWrapperMouseenterEvent,n.mouseleave=d.handleWrapperMouseleaveEvent),_xeUtils.default.eachTree(o,function(e,t,o,i,n){var l,s,a,c,r;p&&!p({column:e})||(l=e.visible,s=e.halfVisible,a=e.children&&e.children.length,c=formatText(e.getTitle(),1),r=!!v&&!v({column:e}),x.push(u("li",{key:e.id,class:["vxe-table-custom--option","level--".concat(e.level),{"is--group":a}]},[u("div",{title:c,class:["vxe-table-custom--checkbox-option",{"is--checked":l,"is--indeterminate":s,"is--disabled":r}],on:{click:function(){r||d.changeCheckboxOption(e)}}},[u("span",{class:["vxe-checkbox--icon",s?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:l?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]}),u("span",{class:"vxe-checkbox--label"},c)]),!n&&f.allowFixed?u("div",{class:"vxe-table-custom--fixed-option"},[u("span",{class:["vxe-table-custom--fixed-left-option","left"===e.fixed?_conf.default.icon.TOOLBAR_TOOLS_FIXED_LEFT_ACTIVED:_conf.default.icon.TOOLBAR_TOOLS_FIXED_LEFT,{"is--checked":"left"===e.fixed,"is--disabled":m&&!e.fixed}],attrs:{title:_conf.default.i18n("left"===e.fixed?"vxe.toolbar.cancelfixed":"vxe.toolbar.fixedLeft")},on:{click:function(){d.changeFixedOption(e,"left")}}}),u("span",{class:["vxe-table-custom--fixed-right-option","right"===e.fixed?_conf.default.icon.TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVED:_conf.default.icon.TOOLBAR_TOOLS_FIXED_RIGHT,{"is--checked":"right"===e.fixed,"is--disabled":m&&!e.fixed}],attrs:{title:_conf.default.i18n("right"===e.fixed?"vxe.toolbar.cancelfixed":"vxe.toolbar.fixedRight")},on:{click:function(){d.changeFixedOption(e,"right")}}})]):null])))}),t.isAll),o=t.isIndeterminate;return u("div",{key:"simple",class:["vxe-table-custom-wrapper",{"is--active":t.visible}]},[u("ul",{class:"vxe-table-custom--header"},[u("li",{class:"vxe-table-custom--option"},[u("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":o}],attrs:{title:_conf.default.i18n("vxe.table.allTitle")},on:{click:d.allCustomEvent}},[u("span",{class:["vxe-checkbox--icon",o?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:i?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]}),u("span",{class:"vxe-checkbox--label"},_conf.default.i18n("vxe.toolbar.customAll"))])])]),u("ul",{class:"vxe-table-custom--body",style:e?{maxHeight:"".concat(e,"px")}:{},on:n},x),f.showFooter?u("div",{class:"vxe-table-custom--footer"},[u("button",{class:"btn--reset",on:{click:d.resetCustomEvent}},f.resetButtonText||_conf.default.i18n("vxe.toolbar.customRestore")),u("button",{class:"btn--confirm",on:{click:d.confirmCustomEvent}},f.confirmButtonText||_conf.default.i18n("vxe.toolbar.customConfirm"))]):null])}function renderPopupPanel(u,d){var e=d.$xetable,t=d.customStore,f=e.customOpts,o=e.customColumnList,m=e.isMaxFixedColumn,v=f.checkMethod,p=f.visibleMethod,x=[];return _xeUtils.default.eachTree(o,function(t,e,o,i,n){var l,s,a,c,r;p&&!p({column:t})||(l=t.visible,s=t.halfVisible,a=formatText(t.getTitle(),1),c=t.children&&t.children.length,r=!!v&&!v({column:t}),x.push(u("tr",{key:t.id,class:["vxe-table-custom-popup--row level--".concat(t.level),{"is--group":c}],attrs:{colid:t.id},on:{dragstart:d.sortDragstartEvent,dragend:d.sortDragendEvent,dragover:d.sortDragoverEvent}},[u("td",{class:"vxe-table-custom-popup--column-item col--sort"},[1===t.level?u("span",{class:"vxe-table-custom-popup--column-sort-btn",on:{mousedown:d.sortMousedownEvent,mouseup:d.sortMouseupEvent}},[u("i",{class:"vxe-icon-sort"})]):null]),u("td",{class:"vxe-table-custom-popup--column-item col--name"},[u("div",{class:"vxe-table-custom-popup--name",attrs:{title:a}},a)]),u("td",{class:"vxe-table-custom-popup--column-item col--visible"},[u("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":l,"is--indeterminate":s,"is--disabled":r}],on:{click:function(){r||d.changeCheckboxOption(t)}}},[u("span",{class:["vxe-checkbox--icon",s?_conf.default.icon.TABLE_CHECKBOX_INDETERMINATE:l?_conf.default.icon.TABLE_CHECKBOX_CHECKED:_conf.default.icon.TABLE_CHECKBOX_UNCHECKED]})])]),u("td",{class:"vxe-table-custom-popup--column-item col--fixed"},[!n&&f.allowFixed?u("vxe-radio-group",{props:{value:t.fixed||"",type:"button",size:"mini",options:[{label:_conf.default.i18n("vxe.custom.setting.fixedLeft"),value:"left",disabled:m},{label:_conf.default.i18n("vxe.custom.setting.fixedUnset"),value:""},{label:_conf.default.i18n("vxe.custom.setting.fixedRight"),value:"right",disabled:m}]},on:{input:function(e){t.fixed=e},change:function(){d.changePopupFixedOption(t)}}}):null])])))}),u("vxe-modal",{key:"popup",props:{value:t.visible,title:_conf.default.i18n("vxe.custom.cstmTitle"),className:"vxe-table-custom-popup-warpper vxe-table--ignore-clear",width:"40vw",minWidth:500,height:"50vh",minHeight:300,mask:!0,lockView:!0,showFooter:!0,resize:!0,escClosable:!0,destroyOnClose:!0},on:{input:function(e){t.visible=e}},scopedSlots:{default:function(){return u("div",{ref:"bodyElemRef",class:"vxe-table-custom-popup--body"},[u("div",{class:"vxe-table-custom-popup--table-warpper"},[u("table",{},[u("colgroup",{},[u("col",{style:{width:"60px"}}),u("col"),u("col",{style:{width:"80px"}}),u("col",{style:{width:"200px"}})]),u("thead",{},[u("tr",{},[u("th",{},_conf.default.i18n("vxe.custom.setting.colSort")),u("th",{},_conf.default.i18n("vxe.custom.setting.colTitle")),u("th",{},_conf.default.i18n("vxe.custom.setting.colVisible")),u("th",{},_conf.default.i18n("vxe.custom.setting.colFixed"))])]),u("transition-group",{class:"vxe-table-custom--body",props:{tag:"tbody",name:"vxe-table-custom--flip"}},x)])]),u("div",{ref:"dragHintElemRef",class:"vxe-table-custom-popup--drag-hint"},_conf.default.i18n("vxe.custom.cstmDragTarget",[d.dragColumn?d.dragColumn.getTitle():""]))])},footer:function(){return u("div",{class:"vxe-table-custom-popup--footer"},[u("vxe-button",{props:{content:f.resetButtonText||_conf.default.i18n("vxe.custom.cstmRestore")},on:{click:d.resetPopupCustomEvent}}),u("vxe-button",{props:{content:f.resetButtonText||_conf.default.i18n("vxe.custom.cstmCancel")},on:{click:d.cancelCustomEvent}}),u("vxe-button",{props:{status:"primary",content:f.confirmButtonText||_conf.default.i18n("vxe.custom.cstmConfirm")},on:{click:d.confirmCustomEvent}})])}}})}var _default2=exports.default={name:"VxeTableCustomPanel",props:{customStore:{type:Object,default:function(){return{}}}},inject:{$xetable:{default:null}},data:function(){return{dragColumn:null}},computed:{},render:function(e){return("popup"===this.$xetable.customOpts.mode?renderPopupPanel:renderSimplePanel)(e,this)},methods:{handleWrapperMouseenterEvent:function(e){var t=this.$xetable;this.customStore.activeWrapper=!0,t.customOpenEvent(e)},handleWrapperMouseleaveEvent:function(e){var t=this.$xetable,o=this.customStore;o.activeWrapper=!1,setTimeout(function(){o.activeBtn||o.activeWrapper||t.customColseEvent(e)},300)},confirmCustomEvent:function(e){var t=this.$xetable;t.closeCustom(),t.emitCustomEvent("confirm",e)},cancelCustomEvent:function(e){var t=this.$xetable;t.closeCustom(),t.emitCustomEvent("cancel",e)},resetCustomEvent:function(e){var t=this.$xetable;t.resetColumn(!0),t.closeCustom(),t.emitCustomEvent("reset",e)},resetPopupCustomEvent:function(e){this.resetCustomEvent(e)},handleOptionCheck:function(t){var e=this.$xetable.customColumnList,e=_xeUtils.default.findTree(e,function(e){return e===t});e&&e.parent&&(e=e.parent).children&&e.children.length&&(e.visible=e.children.every(function(e){return e.visible}),e.halfVisible=!e.visible&&e.children.some(function(e){return e.visible||e.halfVisible}),this.handleOptionCheck(e))},changeCheckboxOption:function(e){var t=this.$xetable,o=t.customOpts,i=!e.visible;_xeUtils.default.eachTree([e],function(e){e.visible=i,e.halfVisible=!1}),this.handleOptionCheck(e),o.immediate&&t.handleCustom(),t.checkCustomStatus()},changeFixedOption:function(e,t){var o=this.$xetable,i=o.isMaxFixedColumn;e.fixed===t?o.clearColumnFixed(e):i&&!e.fixed||o.setColumnFixed(e,t)},changePopupFixedOption:function(e){var t=this.$xetable;t.isMaxFixedColumn||t.setColumnFixed(e,e.fixed)},allCustomEvent:function(){var e=this.$xetable,t=this.customStore,o=e.customOpts,i=e.customColumnList,n=o.checkMethod,l=!t.isAll;_xeUtils.default.eachTree(i,function(e){n&&!n({column:e})||(e.visible=l,e.halfVisible=!1)}),t.isAll=l,e.checkCustomStatus()},sortMousedownEvent:function(e){var t=this.$xetable,e=e.currentTarget.parentNode.parentNode,o=e.getAttribute("colid"),t=t.getColumnById(o);e.draggable=!0,this.dragColumn=t,addClass(e,"active--drag-origin")},sortMouseupEvent:function(e){var e=e.currentTarget.parentNode.parentNode,t=this.$refs.dragHintElemRef;e.draggable=!1,this.dragColumn=null,removeClass(e,"active--drag-origin"),t&&(t.style.display="")},sortDragstartEvent:function(e){var t=new Image;e.dataTransfer&&e.dataTransfer.setDragImage(t,0,0)},sortDragendEvent:function(e){var t=this.$xetable,o=this.prevDropTrEl,i=t.customColumnList,e=e.currentTarget,n=this.$refs.dragHintElemRef;if(o){if(o!==e){var l=o.getAttribute("dragoffset"),s=e.getAttribute("colid"),a=t.getColumnById(s);if(!a)return;var s=_xeUtils.default.findIndexOf(i,function(e){return e.id===a.id}),c=o.getAttribute("colid"),r=t.getColumnById(c);if(!r)return;i.splice(s,1);t=_xeUtils.default.findIndexOf(i,function(e){return e.id===r.id});i.splice(t+("bottom"===l?1:0),0,a)}o.draggable=!1,o.removeAttribute("dragoffset"),removeClass(o,"active--drag-target")}this.dragColumn=null,e.draggable=!1,e.removeAttribute("dragoffset"),n&&(n.style.display=""),removeClass(e,"active--drag-target"),removeClass(e,"active--drag-origin"),i.forEach(function(e,t){e.renderSortNumber=t})},sortDragoverEvent:function(e){var t=this.$xetable,o=this.prevDropTrEl,i=e.currentTarget,o=(o!==i&&removeClass(o,"active--drag-target"),i.getAttribute("colid")),t=t.getColumnById(o);t&&1===t.level&&(e.preventDefault(),o=e.clientY-i.getBoundingClientRect().y<i.clientHeight/2?"top":"bottom",addClass(i,"active--drag-target"),i.setAttribute("dragoffset",o),this.prevDropTrEl=i),updateDropHint(this,e)}}};
|