vxe-table 3.5.0-beta.1 → 3.5.0-beta.4
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/export/src/mixin.js +1 -1
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/index.umd.js +114 -92
- package/lib/index.umd.min.js +1 -1
- package/lib/select/src/select.js +16 -5
- package/lib/select/src/select.min.js +1 -1
- package/lib/table/src/body.js +2 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +71 -62
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +22 -10
- package/lib/table/src/util.js +14 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/tools/utils.js +0 -13
- package/lib/tools/utils.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/v-x-e-table/src/conf.js +5 -2
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/export/src/mixin.js +1 -1
- package/packages/select/src/select.js +14 -5
- package/packages/table/src/body.js +3 -3
- package/packages/table/src/methods.js +13 -8
- package/packages/table/src/table.js +21 -9
- package/packages/table/src/util.js +11 -0
- package/packages/tools/utils.js +0 -11
- package/packages/v-x-e-table/src/conf.js +5 -2
- package/types/table.d.ts +6 -6
package/lib/select/src/select.js
CHANGED
|
@@ -40,7 +40,8 @@ function getOptUniqueId() {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function getOptkey(_vm) {
|
|
43
|
-
|
|
43
|
+
var optionOpts = _vm.optionOpts;
|
|
44
|
+
return optionOpts.keyField || _vm.optionId || '_X_OPTION_KEY';
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
function getOptid(_vm, option) {
|
|
@@ -184,7 +185,9 @@ function renderOption(h, _vm, list, group) {
|
|
|
184
185
|
optionKey = _vm.optionKey,
|
|
185
186
|
value = _vm.value,
|
|
186
187
|
multiple = _vm.multiple,
|
|
187
|
-
currentValue = _vm.currentValue
|
|
188
|
+
currentValue = _vm.currentValue,
|
|
189
|
+
optionOpts = _vm.optionOpts;
|
|
190
|
+
var useKey = optionOpts.useKey;
|
|
188
191
|
return list.map(function (option, cIndex) {
|
|
189
192
|
var slots = option.slots;
|
|
190
193
|
var isVisible = !isGroup || isOptionVisible(option);
|
|
@@ -193,7 +196,7 @@ function renderOption(h, _vm, list, group) {
|
|
|
193
196
|
var optid = getOptid(_vm, option);
|
|
194
197
|
var defaultSlot = slots ? slots.default : null;
|
|
195
198
|
return isVisible ? h('div', {
|
|
196
|
-
key: optionKey ? optid : cIndex,
|
|
199
|
+
key: useKey || optionKey ? optid : cIndex,
|
|
197
200
|
class: ['vxe-select-option', option.className, {
|
|
198
201
|
'is--disabled': isDisabled,
|
|
199
202
|
'is--selected': multiple ? value && value.indexOf(optionValue) > -1 : value === optionValue,
|
|
@@ -226,14 +229,16 @@ function renderOptgroup(h, _vm) {
|
|
|
226
229
|
var optionKey = _vm.optionKey,
|
|
227
230
|
visibleGroupList = _vm.visibleGroupList,
|
|
228
231
|
groupLabelField = _vm.groupLabelField,
|
|
229
|
-
groupOptionsField = _vm.groupOptionsField
|
|
232
|
+
groupOptionsField = _vm.groupOptionsField,
|
|
233
|
+
optionOpts = _vm.optionOpts;
|
|
234
|
+
var useKey = optionOpts.useKey;
|
|
230
235
|
return visibleGroupList.map(function (group, gIndex) {
|
|
231
236
|
var slots = group.slots;
|
|
232
237
|
var optid = getOptid(_vm, group);
|
|
233
238
|
var isGroupDisabled = group.disabled;
|
|
234
239
|
var defaultSlot = slots ? slots.default : null;
|
|
235
240
|
return h('div', {
|
|
236
|
-
key: optionKey ? optid : gIndex,
|
|
241
|
+
key: useKey || optionKey ? optid : gIndex,
|
|
237
242
|
class: ['vxe-optgroup', group.className, {
|
|
238
243
|
'is--disabled': isGroupDisabled
|
|
239
244
|
}],
|
|
@@ -293,6 +298,7 @@ var _default2 = {
|
|
|
293
298
|
optionProps: Object,
|
|
294
299
|
optionGroups: Array,
|
|
295
300
|
optionGroupProps: Object,
|
|
301
|
+
optionConfig: Object,
|
|
296
302
|
className: [String, Function],
|
|
297
303
|
size: {
|
|
298
304
|
type: String,
|
|
@@ -301,12 +307,14 @@ var _default2 = {
|
|
|
301
307
|
}
|
|
302
308
|
},
|
|
303
309
|
emptyText: String,
|
|
310
|
+
// 已废弃,被 option-config.keyField 替换
|
|
304
311
|
optionId: {
|
|
305
312
|
type: String,
|
|
306
313
|
default: function _default() {
|
|
307
314
|
return _conf.default.select.optionId;
|
|
308
315
|
}
|
|
309
316
|
},
|
|
317
|
+
// 已废弃,被 option-config.useKey 替换
|
|
310
318
|
optionKey: Boolean,
|
|
311
319
|
transfer: {
|
|
312
320
|
type: Boolean,
|
|
@@ -359,6 +367,9 @@ var _default2 = {
|
|
|
359
367
|
groupOptionsField: function groupOptionsField() {
|
|
360
368
|
return this.groupPropsOpts.options || 'options';
|
|
361
369
|
},
|
|
370
|
+
optionOpts: function optionOpts() {
|
|
371
|
+
return Object.assign({}, _conf.default.select.optionConfig, this.optionConfig);
|
|
372
|
+
},
|
|
362
373
|
isGroup: function isGroup() {
|
|
363
374
|
return this.fullGroupList.some(function (item) {
|
|
364
375
|
return item.options && item.options.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,exports.renderOptgroup=renderOptgroup,exports.renderOption=renderOption;var _xeUtils=_interopRequireDefault(require("xe-utils")),_input=_interopRequireDefault(require("../../input/src/input")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_utils=_interopRequireWildcard(require("../../tools/utils")),_dom=_interopRequireDefault(require("../../tools/dom")),_event=require("../../tools/event");function _getRequireWildcardCache(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(_getRequireWildcardCache=function(t){return t?i:e})(t)}function _interopRequireWildcard(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==_typeof(t)&&"function"!=typeof t)return{default:t};e=_getRequireWildcardCache(e);if(e&&e.has(t))return e.get(t);var i,n,o={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&((n=l?Object.getOwnPropertyDescriptor(t,i):null)&&(n.get||n.set)?Object.defineProperty(o,i,n):o[i]=t[i]);return o.default=t,e&&e.set(t,o),o}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function isOptionVisible(t){return!1!==t.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}function getOptkey(t){return t.optionId||"_X_ID"}function getOptid(t,e){t=e[getOptkey(t)];return t?encodeURIComponent(t):""}function findOffsetOption(t,e,i){var n,o,l,s,r=t.isGroup,u=t.visibleOptionList,a=t.visibleGroupList,p=t.valueField,f=t.groupOptionsField;if(r)for(var c=0;c<a.length;c++){var d=a[c],h=d[f],v=d.disabled;if(h)for(var b=0;b<h.length;b++){var O=h[b],g=isOptionVisible(O),m=v||O.disabled;if(n||m||(n=O),s&&g&&!m&&(l=O,!i))return{offsetOption:l};if(e===O[p]){if(s=O,i)return{offsetOption:o}}else g&&!m&&(o=O)}}else for(var _=0;_<u.length;_++){var x=u[_],P=x.disabled;if(n||P||(n=x),s&&!P&&(l=x,!i))return{offsetOption:l};if(e===x[p]){if(s=x,i)return{offsetOption:o}}else P||(o=x)}return{firstOption:n}}function findOption(t,e){var i=t.isGroup,n=t.fullOptionList,o=t.fullGroupList,l=t.valueField;if(i)for(var s=0;s<o.length;s++){var r=o[s];if(r.options)for(var u=0;u<r.options.length;u++){var a=r.options[u];if(e===a[l])return a}}return n.find(function(t){return e===t[l]})}function getSelectLabel(t,e){var i=findOption(t,e);return _xeUtils.default.toValueString(i?i[t.labelField]:e)}function renderOption(r,u,t,a){var p=u.isGroup,f=u.labelField,c=u.valueField,d=u.optionKey,h=u.value,v=u.multiple,b=u.currentValue;return t.map(function(t,e){var i=t.slots,n=!p||isOptionVisible(t),o=a&&a.disabled||t.disabled,l=t[c],s=getOptid(u,t),i=i?i.default:null;return n?r("div",{key:d?s:e,class:["vxe-select-option",t.className,{"is--disabled":o,"is--selected":v?h&&-1<h.indexOf(l):h===l,"is--hover":b===l}],attrs:{optid:s},on:{mousedown:u.mousedownOptionEvent,click:function(t){o||u.changeOptionEvent(t,l)},mouseenter:function(){o||u.setCurrentOption(t)}}},i?u.callSlot(i,{option:t,$select:u},r):_utils.default.formatText((0,_utils.getFuncText)(t[f]))):null})}function renderOptgroup(l,s){var r=s.optionKey,t=s.visibleGroupList,u=s.groupLabelField,a=s.groupOptionsField;return t.map(function(t,e){var i=t.slots,n=getOptid(s,t),o=t.disabled,i=i?i.default:null;return l("div",{key:r?n:e,class:["vxe-optgroup",t.className,{"is--disabled":o}],attrs:{optid:n}},[l("div",{class:"vxe-optgroup--title"},i?s.callSlot(i,{option:t,$select:s},l):(0,_utils.getFuncText)(t[u])),l("div",{class:"vxe-optgroup--wrapper"},renderOption(l,s,t[a],t))])})}function renderOpts(t,e){var i=e.isGroup,n=e.visibleGroupList,o=e.visibleOptionList;if(i){if(n.length)return renderOptgroup(t,e)}else if(o.length)return renderOption(t,e,o);return[t("div",{class:"vxe-select--empty-placeholder"},e.emptyText||_conf.default.i18n("vxe.select.emptyText"))]}var _default2={name:"VxeSelect",mixins:[_size.default],props:{value:null,clearable:Boolean,placeholder:String,loading:Boolean,disabled:Boolean,multiple:Boolean,multiCharOverflow:{type:[Number,String],default:function(){return _conf.default.select.multiCharOverflow}},prefixIcon:String,placement:String,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,className:[String,Function],size:{type:String,default:function(){return _conf.default.select.size||_conf.default.size}},emptyText:String,optionId:{type:String,default:function(){return _conf.default.select.optionId}},optionKey:Boolean,transfer:{type:Boolean,default:function(){return _conf.default.select.transfer}}},components:{VxeInput:_input.default},provide:function(){return{$xeselect:this}},data:function(){return{inited:!1,collectOption:[],fullGroupList:[],fullOptionList:[],visibleGroupList:[],visibleOptionList:[],panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},computed:{propsOpts:function(){return this.optionProps||{}},groupPropsOpts:function(){return this.optionGroupProps||{}},labelField:function(){return this.propsOpts.label||"label"},valueField:function(){return this.propsOpts.value||"value"},groupLabelField:function(){return this.groupPropsOpts.label||"label"},groupOptionsField:function(){return this.groupPropsOpts.options||"options"},isGroup:function(){return this.fullGroupList.some(function(t){return t.options&&t.options.length})},multiMaxCharNum:function(){return _xeUtils.default.toNumber(this.multiCharOverflow)},selectLabel:function(){var e=this,t=this.value,i=this.multiple,n=this.multiMaxCharNum;return t&&i?(_xeUtils.default.isArray(t)?t:[t]).map(function(t){t=getSelectLabel(e,t);return 0<n&&t.length>n?"".concat(t.substring(0,n),"..."):t}).join(", "):getSelectLabel(this,t)}},watch:{collectOption:function(t){t.some(function(t){return t.options&&t.options.length})?(this.fullOptionList=[],this.fullGroupList=t):(this.fullGroupList=[],this.fullOptionList=t),this.cacheItemMap()},options:function(t){this.fullGroupList=[],this.fullOptionList=t,this.cacheItemMap()},optionGroups:function(t){this.fullOptionList=[],this.fullGroupList=t,this.cacheItemMap()}},created:function(){var t=this.options,e=this.optionGroups;e?this.fullGroupList=e:t&&(this.fullOptionList=t),this.cacheItemMap(),_event.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_event.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_event.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),_event.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var t=this.$refs.panel;t&&t.parentNode&&t.parentNode.removeChild(t)},destroyed:function(){_event.GlobalEvent.off(this,"mousewheel"),_event.GlobalEvent.off(this,"mousedown"),_event.GlobalEvent.off(this,"keydown"),_event.GlobalEvent.off(this,"blur")},render:function(t){var e=this.$scopedSlots,i=this.vSize,n=this.className,o=this.inited,l=this.isActivated,s=this.loading,r=this.disabled,u=this.visiblePanel,a=e.prefix;return t("div",{class:["vxe-select",n?_xeUtils.default.isFunction(n)?n({$select:this}):n:"",(_defineProperty(n={},"size--".concat(i),i),_defineProperty(n,"is--visivle",u),_defineProperty(n,"is--disabled",r),_defineProperty(n,"is--loading",s),_defineProperty(n,"is--active",l),n)]},[t("div",{class:"vxe-select-slots",ref:"hideOption"},this.$slots.default),t("vxe-input",{ref:"input",props:{clearable:this.clearable,placeholder:this.placeholder,readonly:!0,disabled:r,type:"text",prefixIcon:this.prefixIcon,suffixIcon:s?_conf.default.icon.SELECT_LOADED:u?_conf.default.icon.SELECT_OPEN:_conf.default.icon.SELECT_CLOSE,value:this.selectLabel},on:{clear:this.clearEvent,click:this.togglePanelEvent,focus:this.focusEvent,blur:this.blurEvent,"suffix-click":this.togglePanelEvent},scopedSlots:a?{prefix:function(){return a({})}}:{}}),t("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-select--panel",(_defineProperty(r={},"size--".concat(i),i),_defineProperty(r,"is--transfer",this.transfer),_defineProperty(r,"animat--leave",!s&&this.animatVisible),_defineProperty(r,"animat--enter",!s&&u),r)],attrs:{placement:this.panelPlacement},style:this.panelStyle},o?[t("div",{ref:"optWrapper",class:"vxe-select-option--wrapper"},renderOpts(t,this))]:null)])},methods:{callSlot:function(t,e,i){if(t){var n=this.$scopedSlots;if(_xeUtils.default.isString(t)&&(t=n[t]||null),_xeUtils.default.isFunction(t))return t.call(this,e,i)}return[]},cacheItemMap:function(){function e(t){getOptid(i,t)||(t[l]=getOptUniqueId())}var i=this,t=this.fullOptionList,n=this.fullGroupList,o=this.groupOptionsField,l=getOptkey(this);n.length?n.forEach(function(t){e(t),t[o]&&t[o].forEach(e)}):t.length&&t.forEach(e),this.refreshOption()},refreshOption:function(){var t=this.isGroup,e=this.fullOptionList,i=this.fullGroupList;return t?this.visibleGroupList=i.filter(isOptionVisible):this.visibleOptionList=e.filter(isOptionVisible),this.$nextTick()},setCurrentOption:function(t){t&&(this.currentValue=t[this.valueField])},scrollToOption:function(n,o){var l=this;return this.$nextTick().then(function(){var t,e,i;n&&(t=(i=l.$refs).optWrapper,e=i.panel.querySelector("[optid='".concat(getOptid(l,n),"']")),t&&e&&(i=t.offsetHeight,o?e.offsetTop+e.offsetHeight-t.scrollTop>i&&(t.scrollTop=e.offsetTop+e.offsetHeight-i):(e.offsetTop+5<t.scrollTop||e.offsetTop+5>t.scrollTop+t.clientHeight)&&(t.scrollTop=e.offsetTop-5)))})},clearEvent:function(t,e){this.clearValueEvent(e,null),this.hideOptionPanel()},clearValueEvent:function(t,e){this.changeEvent(t,e),this.$emit("clear",{value:e,$event:t})},changeEvent:function(t,e){e!==this.value&&(this.$emit("input",e),this.$emit("change",{value:e,$event:t}))},mousedownOptionEvent:function(t){0===t.button&&t.stopPropagation()},changeOptionEvent:function(t,e){var i=this.value;this.multiple?(i=i?-1===i.indexOf(e)?i.concat([e]):i.filter(function(t){return t!==e}):[e],this.changeEvent(t,i)):(this.changeEvent(t,e),this.hideOptionPanel())},handleGlobalMousewheelEvent:function(t){var e=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_dom.default.getEventTargetNode(t,e.panel).flag?this.updatePlacement():this.hideOptionPanel())},handleGlobalMousedownEvent:function(t){var e=this.$refs,i=this.$el,n=this.disabled,o=this.visiblePanel;n||(this.isActivated=_dom.default.getEventTargetNode(t,i).flag||_dom.default.getEventTargetNode(t,e.panel).flag,o&&!this.isActivated&&this.hideOptionPanel())},handleGlobalKeydownEvent:function(t){var e,i,n,o,l,s,r,u=this.visiblePanel,a=this.currentValue,p=this.clearable;this.disabled||(e=13===(s=t.keyCode),r=27===s,i=38===s,n=40===s,o=46===s,l=32===s,(s=9===s)&&(this.isActivated=!1),u?r||s?this.hideOptionPanel():e?(t.preventDefault(),t.stopPropagation(),this.changeOptionEvent(t,a)):i||n?(t.preventDefault(),s=(r=findOffsetOption(this,a,i)).firstOption,(r=r.offsetOption)||findOption(this,a)||(r=s),this.setCurrentOption(r),this.scrollToOption(r,n)):l&&t.preventDefault():(i||n||e||l)&&this.isActivated&&(t.preventDefault(),this.showOptionPanel()),this.isActivated&&o&&p&&this.clearValueEvent(t,null))},handleGlobalBlurEvent:function(){this.hideOptionPanel()},updateZindex:function(){this.panelIndex<_utils.default.getLastZIndex()&&(this.panelIndex=_utils.default.nextZIndex())},focusEvent:function(){this.disabled||(this.isActivated=!0)},blurEvent:function(){this.isActivated=!1},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){this.visiblePanel?this.hideOptionPanel():this.showOptionPanel(),this.$nextTick()},hidePanel:function(){this.visiblePanel&&this.hideOptionPanel(),this.$nextTick()},showPanel:function(){this.visiblePanel||this.showOptionPanel(),this.$nextTick()},togglePanelEvent:function(t){t.$event.preventDefault(),this.visiblePanel?this.hideOptionPanel():this.showOptionPanel()},showOptionPanel:function(){var i=this,t=this.loading,e=this.disabled;t||e||(clearTimeout(this.hidePanelTimeout),this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),this.isActivated=!0,this.animatVisible=!0,setTimeout(function(){var t=i.value,e=i.multiple,t=findOption(i,e&&t?t[0]:t);i.visiblePanel=!0,t&&(i.setCurrentOption(t),i.scrollToOption(t))},10),this.updateZindex(),this.updatePlacement())},hideOptionPanel:function(){var t=this;this.visiblePanel=!1,this.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1},350)},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var t=c.$refs,e=c.transfer,i=c.placement,n=c.panelIndex,o=t.input.$el,l=t.panel;if(l&&o){var s=o.offsetHeight,r=o.offsetWidth,u=l.offsetHeight,a=l.offsetWidth,p={zIndex:n},f=_dom.default.getAbsolutePos(o),t=f.boundingTop,l=f.boundingLeft,n=f.visibleHeight,o=f.visibleWidth,f="bottom";return e?(e=t+s,"top"===i?(f="top",e=t-u):i||(n<e+u+5&&(f="top",e=t-u),e<5&&(f="bottom",e=t+s)),o<(l=l)+a+5&&(l-=l+a+5-o),l<5&&(l=5),Object.assign(p,{left:"".concat(l,"px"),top:"".concat(e,"px"),minWidth:"".concat(r,"px")})):"top"===i?(f="top",p.bottom="".concat(s,"px")):i||n<t+s+u&&5<t-s-u&&(f="top",p.bottom="".concat(s,"px")),c.panelStyle=p,c.panelPlacement=f,c.$nextTick()}})},focus:function(){return this.isActivated=!0,this.$refs.input.focus(),this.$nextTick()},blur:function(){return this.hideOptionPanel(),this.$refs.input.blur(),this.$nextTick()}}};exports.default=_default2;
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,exports.renderOptgroup=renderOptgroup,exports.renderOption=renderOption;var _xeUtils=_interopRequireDefault(require("xe-utils")),_input=_interopRequireDefault(require("../../input/src/input")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_utils=_interopRequireWildcard(require("../../tools/utils")),_dom=_interopRequireDefault(require("../../tools/dom")),_event=require("../../tools/event");function _getRequireWildcardCache(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(_getRequireWildcardCache=function(t){return t?i:e})(t)}function _interopRequireWildcard(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==_typeof(t)&&"function"!=typeof t)return{default:t};e=_getRequireWildcardCache(e);if(e&&e.has(t))return e.get(t);var i,n,o={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&((n=l?Object.getOwnPropertyDescriptor(t,i):null)&&(n.get||n.set)?Object.defineProperty(o,i,n):o[i]=t[i]);return o.default=t,e&&e.set(t,o),o}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function isOptionVisible(t){return!1!==t.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}function getOptkey(t){return t.optionOpts.keyField||t.optionId||"_X_OPTION_KEY"}function getOptid(t,e){t=e[getOptkey(t)];return t?encodeURIComponent(t):""}function findOffsetOption(t,e,i){var n,o,l,s,r=t.isGroup,u=t.visibleOptionList,a=t.visibleGroupList,p=t.valueField,f=t.groupOptionsField;if(r)for(var c=0;c<a.length;c++){var d=a[c],h=d[f],v=d.disabled;if(h)for(var b=0;b<h.length;b++){var O=h[b],g=isOptionVisible(O),m=v||O.disabled;if(n||m||(n=O),s&&g&&!m&&(l=O,!i))return{offsetOption:l};if(e===O[p]){if(s=O,i)return{offsetOption:o}}else g&&!m&&(o=O)}}else for(var _=0;_<u.length;_++){var x=u[_],y=x.disabled;if(n||y||(n=x),s&&!y&&(l=x,!i))return{offsetOption:l};if(e===x[p]){if(s=x,i)return{offsetOption:o}}else y||(o=x)}return{firstOption:n}}function findOption(t,e){var i=t.isGroup,n=t.fullOptionList,o=t.fullGroupList,l=t.valueField;if(i)for(var s=0;s<o.length;s++){var r=o[s];if(r.options)for(var u=0;u<r.options.length;u++){var a=r.options[u];if(e===a[l])return a}}return n.find(function(t){return e===t[l]})}function getSelectLabel(t,e){var i=findOption(t,e);return _xeUtils.default.toValueString(i?i[t.labelField]:e)}function renderOption(r,u,t,a){var p=u.isGroup,f=u.labelField,c=u.valueField,d=u.optionKey,h=u.value,v=u.multiple,b=u.currentValue,O=u.optionOpts.useKey;return t.map(function(t,e){var i=t.slots,n=!p||isOptionVisible(t),o=a&&a.disabled||t.disabled,l=t[c],s=getOptid(u,t),i=i?i.default:null;return n?r("div",{key:O||d?s:e,class:["vxe-select-option",t.className,{"is--disabled":o,"is--selected":v?h&&-1<h.indexOf(l):h===l,"is--hover":b===l}],attrs:{optid:s},on:{mousedown:u.mousedownOptionEvent,click:function(t){o||u.changeOptionEvent(t,l)},mouseenter:function(){o||u.setCurrentOption(t)}}},i?u.callSlot(i,{option:t,$select:u},r):_utils.default.formatText((0,_utils.getFuncText)(t[f]))):null})}function renderOptgroup(l,s){var r=s.optionKey,t=s.visibleGroupList,u=s.groupLabelField,a=s.groupOptionsField,p=s.optionOpts.useKey;return t.map(function(t,e){var i=t.slots,n=getOptid(s,t),o=t.disabled,i=i?i.default:null;return l("div",{key:p||r?n:e,class:["vxe-optgroup",t.className,{"is--disabled":o}],attrs:{optid:n}},[l("div",{class:"vxe-optgroup--title"},i?s.callSlot(i,{option:t,$select:s},l):(0,_utils.getFuncText)(t[u])),l("div",{class:"vxe-optgroup--wrapper"},renderOption(l,s,t[a],t))])})}function renderOpts(t,e){var i=e.isGroup,n=e.visibleGroupList,o=e.visibleOptionList;if(i){if(n.length)return renderOptgroup(t,e)}else if(o.length)return renderOption(t,e,o);return[t("div",{class:"vxe-select--empty-placeholder"},e.emptyText||_conf.default.i18n("vxe.select.emptyText"))]}var _default2={name:"VxeSelect",mixins:[_size.default],props:{value:null,clearable:Boolean,placeholder:String,loading:Boolean,disabled:Boolean,multiple:Boolean,multiCharOverflow:{type:[Number,String],default:function(){return _conf.default.select.multiCharOverflow}},prefixIcon:String,placement:String,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,optionConfig:Object,className:[String,Function],size:{type:String,default:function(){return _conf.default.select.size||_conf.default.size}},emptyText:String,optionId:{type:String,default:function(){return _conf.default.select.optionId}},optionKey:Boolean,transfer:{type:Boolean,default:function(){return _conf.default.select.transfer}}},components:{VxeInput:_input.default},provide:function(){return{$xeselect:this}},data:function(){return{inited:!1,collectOption:[],fullGroupList:[],fullOptionList:[],visibleGroupList:[],visibleOptionList:[],panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},computed:{propsOpts:function(){return this.optionProps||{}},groupPropsOpts:function(){return this.optionGroupProps||{}},labelField:function(){return this.propsOpts.label||"label"},valueField:function(){return this.propsOpts.value||"value"},groupLabelField:function(){return this.groupPropsOpts.label||"label"},groupOptionsField:function(){return this.groupPropsOpts.options||"options"},optionOpts:function(){return Object.assign({},_conf.default.select.optionConfig,this.optionConfig)},isGroup:function(){return this.fullGroupList.some(function(t){return t.options&&t.options.length})},multiMaxCharNum:function(){return _xeUtils.default.toNumber(this.multiCharOverflow)},selectLabel:function(){var e=this,t=this.value,i=this.multiple,n=this.multiMaxCharNum;return t&&i?(_xeUtils.default.isArray(t)?t:[t]).map(function(t){t=getSelectLabel(e,t);return 0<n&&t.length>n?"".concat(t.substring(0,n),"..."):t}).join(", "):getSelectLabel(this,t)}},watch:{collectOption:function(t){t.some(function(t){return t.options&&t.options.length})?(this.fullOptionList=[],this.fullGroupList=t):(this.fullGroupList=[],this.fullOptionList=t),this.cacheItemMap()},options:function(t){this.fullGroupList=[],this.fullOptionList=t,this.cacheItemMap()},optionGroups:function(t){this.fullOptionList=[],this.fullGroupList=t,this.cacheItemMap()}},created:function(){var t=this.options,e=this.optionGroups;e?this.fullGroupList=e:t&&(this.fullOptionList=t),this.cacheItemMap(),_event.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_event.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_event.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),_event.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var t=this.$refs.panel;t&&t.parentNode&&t.parentNode.removeChild(t)},destroyed:function(){_event.GlobalEvent.off(this,"mousewheel"),_event.GlobalEvent.off(this,"mousedown"),_event.GlobalEvent.off(this,"keydown"),_event.GlobalEvent.off(this,"blur")},render:function(t){var e=this.$scopedSlots,i=this.vSize,n=this.className,o=this.inited,l=this.isActivated,s=this.loading,r=this.disabled,u=this.visiblePanel,a=e.prefix;return t("div",{class:["vxe-select",n?_xeUtils.default.isFunction(n)?n({$select:this}):n:"",(_defineProperty(n={},"size--".concat(i),i),_defineProperty(n,"is--visivle",u),_defineProperty(n,"is--disabled",r),_defineProperty(n,"is--loading",s),_defineProperty(n,"is--active",l),n)]},[t("div",{class:"vxe-select-slots",ref:"hideOption"},this.$slots.default),t("vxe-input",{ref:"input",props:{clearable:this.clearable,placeholder:this.placeholder,readonly:!0,disabled:r,type:"text",prefixIcon:this.prefixIcon,suffixIcon:s?_conf.default.icon.SELECT_LOADED:u?_conf.default.icon.SELECT_OPEN:_conf.default.icon.SELECT_CLOSE,value:this.selectLabel},on:{clear:this.clearEvent,click:this.togglePanelEvent,focus:this.focusEvent,blur:this.blurEvent,"suffix-click":this.togglePanelEvent},scopedSlots:a?{prefix:function(){return a({})}}:{}}),t("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-select--panel",(_defineProperty(r={},"size--".concat(i),i),_defineProperty(r,"is--transfer",this.transfer),_defineProperty(r,"animat--leave",!s&&this.animatVisible),_defineProperty(r,"animat--enter",!s&&u),r)],attrs:{placement:this.panelPlacement},style:this.panelStyle},o?[t("div",{ref:"optWrapper",class:"vxe-select-option--wrapper"},renderOpts(t,this))]:null)])},methods:{callSlot:function(t,e,i){if(t){var n=this.$scopedSlots;if(_xeUtils.default.isString(t)&&(t=n[t]||null),_xeUtils.default.isFunction(t))return t.call(this,e,i)}return[]},cacheItemMap:function(){function e(t){getOptid(i,t)||(t[l]=getOptUniqueId())}var i=this,t=this.fullOptionList,n=this.fullGroupList,o=this.groupOptionsField,l=getOptkey(this);n.length?n.forEach(function(t){e(t),t[o]&&t[o].forEach(e)}):t.length&&t.forEach(e),this.refreshOption()},refreshOption:function(){var t=this.isGroup,e=this.fullOptionList,i=this.fullGroupList;return t?this.visibleGroupList=i.filter(isOptionVisible):this.visibleOptionList=e.filter(isOptionVisible),this.$nextTick()},setCurrentOption:function(t){t&&(this.currentValue=t[this.valueField])},scrollToOption:function(n,o){var l=this;return this.$nextTick().then(function(){var t,e,i;n&&(t=(i=l.$refs).optWrapper,e=i.panel.querySelector("[optid='".concat(getOptid(l,n),"']")),t&&e&&(i=t.offsetHeight,o?e.offsetTop+e.offsetHeight-t.scrollTop>i&&(t.scrollTop=e.offsetTop+e.offsetHeight-i):(e.offsetTop+5<t.scrollTop||e.offsetTop+5>t.scrollTop+t.clientHeight)&&(t.scrollTop=e.offsetTop-5)))})},clearEvent:function(t,e){this.clearValueEvent(e,null),this.hideOptionPanel()},clearValueEvent:function(t,e){this.changeEvent(t,e),this.$emit("clear",{value:e,$event:t})},changeEvent:function(t,e){e!==this.value&&(this.$emit("input",e),this.$emit("change",{value:e,$event:t}))},mousedownOptionEvent:function(t){0===t.button&&t.stopPropagation()},changeOptionEvent:function(t,e){var i=this.value;this.multiple?(i=i?-1===i.indexOf(e)?i.concat([e]):i.filter(function(t){return t!==e}):[e],this.changeEvent(t,i)):(this.changeEvent(t,e),this.hideOptionPanel())},handleGlobalMousewheelEvent:function(t){var e=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_dom.default.getEventTargetNode(t,e.panel).flag?this.updatePlacement():this.hideOptionPanel())},handleGlobalMousedownEvent:function(t){var e=this.$refs,i=this.$el,n=this.disabled,o=this.visiblePanel;n||(this.isActivated=_dom.default.getEventTargetNode(t,i).flag||_dom.default.getEventTargetNode(t,e.panel).flag,o&&!this.isActivated&&this.hideOptionPanel())},handleGlobalKeydownEvent:function(t){var e,i,n,o,l,s,r,u=this.visiblePanel,a=this.currentValue,p=this.clearable;this.disabled||(e=13===(s=t.keyCode),r=27===s,i=38===s,n=40===s,o=46===s,l=32===s,(s=9===s)&&(this.isActivated=!1),u?r||s?this.hideOptionPanel():e?(t.preventDefault(),t.stopPropagation(),this.changeOptionEvent(t,a)):i||n?(t.preventDefault(),s=(r=findOffsetOption(this,a,i)).firstOption,(r=r.offsetOption)||findOption(this,a)||(r=s),this.setCurrentOption(r),this.scrollToOption(r,n)):l&&t.preventDefault():(i||n||e||l)&&this.isActivated&&(t.preventDefault(),this.showOptionPanel()),this.isActivated&&o&&p&&this.clearValueEvent(t,null))},handleGlobalBlurEvent:function(){this.hideOptionPanel()},updateZindex:function(){this.panelIndex<_utils.default.getLastZIndex()&&(this.panelIndex=_utils.default.nextZIndex())},focusEvent:function(){this.disabled||(this.isActivated=!0)},blurEvent:function(){this.isActivated=!1},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){this.visiblePanel?this.hideOptionPanel():this.showOptionPanel(),this.$nextTick()},hidePanel:function(){this.visiblePanel&&this.hideOptionPanel(),this.$nextTick()},showPanel:function(){this.visiblePanel||this.showOptionPanel(),this.$nextTick()},togglePanelEvent:function(t){t.$event.preventDefault(),this.visiblePanel?this.hideOptionPanel():this.showOptionPanel()},showOptionPanel:function(){var i=this,t=this.loading,e=this.disabled;t||e||(clearTimeout(this.hidePanelTimeout),this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),this.isActivated=!0,this.animatVisible=!0,setTimeout(function(){var t=i.value,e=i.multiple,t=findOption(i,e&&t?t[0]:t);i.visiblePanel=!0,t&&(i.setCurrentOption(t),i.scrollToOption(t))},10),this.updateZindex(),this.updatePlacement())},hideOptionPanel:function(){var t=this;this.visiblePanel=!1,this.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1},350)},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var t=c.$refs,e=c.transfer,i=c.placement,n=c.panelIndex,o=t.input.$el,l=t.panel;if(l&&o){var s=o.offsetHeight,r=o.offsetWidth,u=l.offsetHeight,a=l.offsetWidth,p={zIndex:n},f=_dom.default.getAbsolutePos(o),t=f.boundingTop,l=f.boundingLeft,n=f.visibleHeight,o=f.visibleWidth,f="bottom";return e?(e=t+s,"top"===i?(f="top",e=t-u):i||(n<e+u+5&&(f="top",e=t-u),e<5&&(f="bottom",e=t+s)),o<(l=l)+a+5&&(l-=l+a+5-o),l<5&&(l=5),Object.assign(p,{left:"".concat(l,"px"),top:"".concat(e,"px"),minWidth:"".concat(r,"px")})):"top"===i?(f="top",p.bottom="".concat(s,"px")):i||n<t+s+u&&5<t-s-u&&(f="top",p.bottom="".concat(s,"px")),c.panelStyle=p,c.panelPlacement=f,c.$nextTick()}})},focus:function(){return this.isActivated=!0,this.$refs.input.focus(),this.$nextTick()},blur:function(){return this.hideOptionPanel(),this.$refs.input.blur(),this.$nextTick()}}};exports.default=_default2;
|
package/lib/table/src/body.js
CHANGED
|
@@ -53,9 +53,7 @@ function renderLine(h, _vm, $xetable, params) {
|
|
|
53
53
|
fullAllDataRowIdData = $xetable.fullAllDataRowIdData;
|
|
54
54
|
var slots = column.slots,
|
|
55
55
|
treeNode = column.treeNode;
|
|
56
|
-
|
|
57
|
-
var rowid = _utils.default.getRowid($xetable, row);
|
|
58
|
-
|
|
56
|
+
var rowid = (0, _util.getRowid)($xetable, row);
|
|
59
57
|
var rest = fullAllDataRowIdData[rowid];
|
|
60
58
|
var rLevel = 0;
|
|
61
59
|
var rIndex = 0;
|
|
@@ -403,8 +401,7 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
403
401
|
};
|
|
404
402
|
}
|
|
405
403
|
|
|
406
|
-
var rowid =
|
|
407
|
-
|
|
404
|
+
var rowid = (0, _util.getRowid)($xetable, row);
|
|
408
405
|
var rest = fullAllDataRowIdData[rowid];
|
|
409
406
|
var rowLevel = rest ? rest.level : 0;
|
|
410
407
|
var seq = rest ? rest.seq : -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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)}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")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_utils=_interopRequireWildcard(require("../../tools/utils")),_util=require("./util"),_dom=_interopRequireDefault(require("../../tools/dom"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var l=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:l})(e)}function _interopRequireWildcard(e,l){if(!l&&e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};l=_getRequireWildcardCache(l);if(l&&l.has(e))return l.get(e);var t,r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&((r=n?Object.getOwnPropertyDescriptor(e,t):null)&&(r.get||r.set)?Object.defineProperty(o,t,r):o[t]=e[t]);return o.default=e,l&&l.set(e,o),o}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,l){if(e){if("string"==typeof e)return _arrayLikeToArray(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,l):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,r=new Array(l);t<l;t++)r[t]=e[t];return r}var scrollProcessTimeout,renderType="body";function isOperateMouse(e){return e._isResize||e.lastScrollTime&&Date.now()<e.lastScrollTime+e.delayHover}function renderLine(e,l,t,r){var o=r.row,n=r.column,i=t.treeOpts,a=t.treeConfig,s=t.fullAllDataRowIdData,c=n.slots,d=n.treeNode,u=s[_utils.default.getRowid(t,o)],n=0,s=0,o=[];return u&&(n=u.level,s=u._index,o=u.items),c&&c.line?t.callSlot(c.line,r,e):a&&d&&i.line?[e("div",{class:"vxe-tree--line-wrapper"},[e("div",{class:"vxe-tree--line",style:{height:"".concat((0,_util.calcTreeLine)(r,o,s),"px"),left:"".concat(n*i.indent+(n?2-(0,_util.getOffsetSize)(t):0)+16,"px")}})])]:[]}function renderColumn(e,l,t,r,o,n,i,a,s,c,d,u,p,f,y){var h,g=t.$listeners,v=t.afterFullData,m=t.tableData,w=t.height,b=t.columnKey,x=t.overflowX,_=t.sYOpts,T=t.scrollXLoad,S=t.scrollYLoad,O=t.highlightCurrentRow,C=t.showOverflow,L=t.isAllOverflow,$=t.align,R=t.currentColumn,k=t.cellClassName,I=t.cellStyle,H=t.mergeList,E=t.spanMethod,A=t.radioOpts,Y=t.checkboxOpts,P=t.expandOpts,W=t.treeOpts,D=t.tooltipOpts,M=t.mouseConfig,q=t.editConfig,B=t.editOpts,j=t.editRules,U=t.validOpts,X=t.editStore,N=t.validStore,z=t.tooltipConfig,F=t.rowOpts,K=t.columnOpts,V=u.type,G=u.cellRender,J=u.editRender,Q=u.align,Z=u.showOverflow,ee=u.className,le=u.treeNode,te=X.actived,re=_.rHeight,oe=F.height,ne=D.showAll||D.enabled,ie=t.getColumnIndex(u),ae=t.getVTColumnIndex(u),X=(0,_utils.isEnableConf)(J),_=n?u.fixed!==n:u.fixed&&x,D=_xeUtils.default.isUndefined(Z)||_xeUtils.default.isNull(Z)?C:Z,x="ellipsis"===D,se="title"===D,ce=!0===D||"tooltip"===D,Z=se||ce||x,D={},Q=Q||$,$=N.row===a&&N.column===u,j=j&&U.showMessage&&("default"===U.message?w||1<m.length:"inline"===U.message),w={colid:u.id},de=g["cell-mouseenter"],ue=g["cell-mouseleave"],U=J&&q&&"dblclick"===B.trigger,pe={$table:t,seq:r,rowid:o,row:a,rowIndex:s,$rowIndex:c,_rowIndex:d,column:u,columnIndex:ie,$columnIndex:p,_columnIndex:ae,fixed:n,type:renderType,isHidden:_,level:i,visibleData:v,data:m,items:y};if(!T&&!S||Z||(x=Z=!0),(se||ce||ne||de||z)&&(D.mouseenter=function(e){isOperateMouse(t)||(se?_dom.default.updateCellTitle(e.currentTarget,u):(ce||ne)&&t.triggerBodyTooltipEvent(e,pe),de&&t.emitEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},pe),e))}),(ce||ne||ue||z)&&(D.mouseleave=function(e){isOperateMouse(t)||((ce||ne)&&t.handleTargetLeaveEvent(e),ue&&t.emitEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},pe),e))}),(Y.range||M)&&(D.mousedown=function(e){t.triggerCellMousedownEvent(e,pe)}),(F.isCurrent||O||g["cell-click"]||J&&q||"row"===P.trigger||"cell"===P.trigger||"row"===A.trigger||"radio"===u.type&&"cell"===A.trigger||"row"===Y.trigger||"checkbox"===u.type&&"cell"===Y.trigger||"row"===W.trigger||u.treeNode&&"cell"===W.trigger)&&(D.click=function(e){t.triggerCellClickEvent(e,pe)}),(U||g["cell-dblclick"])&&(D.dblclick=function(e){t.triggerCellDblclickEvent(e,pe)}),H.length){d=(0,_util.mergeBodyMethod)(H,d,ae);if(d){var ae=d.rowspan,fe=d.colspan;if(!ae||!fe)return null;1<ae&&(w.rowspan=ae),1<fe&&(w.colspan=fe)}}else if(E){fe=E(pe)||{},E=fe.rowspan,E=void 0===E?1:E,fe=fe.colspan,fe=void 0===fe?1:fe;if(!E||!fe)return null;1<E&&(w.rowspan=E),1<fe&&(w.colspan=fe)}!(_=_&&H&&(1<w.colspan||1<w.rowspan)?!1:_)&&q&&(J||G)&&(B.showStatus||B.showUpdateStatus)&&(h=t.isUpdateByRow(a,u.property));G=[];return _&&C&&L?G.push(e("div",{class:["vxe-cell",{"c--title":se,"c--tooltip":ce,"c--ellipsis":x}],style:{maxHeight:Z&&(re||oe)?"".concat(re||oe,"px"):""}})):(G.push.apply(G,_toConsumableArray(renderLine(e,l,t,pe)).concat([e("div",{class:["vxe-cell",{"c--title":se,"c--tooltip":ce,"c--ellipsis":x}],style:{maxHeight:Z&&(re||oe)?"".concat(re||oe,"px"):""},attrs:{title:se?t.getCellLabel(a,u):null}},u.renderCell(e,pe))])),j&&$&&G.push(e("div",{class:"vxe-cell--valid",style:N.rule&&N.rule.maxWidth?{width:"".concat(N.rule.maxWidth,"px")}:null},[e("span",{class:"vxe-cell--valid-msg"},N.content)]))),e("td",{class:["vxe-body--column",u.id,(_defineProperty(e={},"col--".concat(Q),Q),_defineProperty(e,"col--".concat(V),V),_defineProperty(e,"col--last",p===f.length-1),_defineProperty(e,"col--tree-node",le),_defineProperty(e,"col--edit",X),_defineProperty(e,"col--ellipsis",Z),_defineProperty(e,"fixed--hidden",_),_defineProperty(e,"col--dirty",h),_defineProperty(e,"col--actived",q&&X&&te.row===a&&(te.column===u||"row"===B.mode)),_defineProperty(e,"col--valid-error",$),_defineProperty(e,"col--current",R===u),e),_utils.default.getClass(ee,pe),_utils.default.getClass(k,pe)],key:b||K.useKey?u.id:p,attrs:w,style:Object.assign({height:Z&&(re||oe)?"".concat(re||oe,"px"):""},I?_xeUtils.default.isFunction(I)?I(pe):I:null),on:D},G)}function renderRows(p,f,y,h,g,v){var m=y.stripe,w=y.rowKey,b=y.highlightHoverRow,x=y.rowClassName,_=y.rowStyle,T=y.editConfig,S=y.showOverflow,O=y.treeConfig,C=y.treeOpts,L=y.editOpts,$=y.treeExpandeds,R=y.scrollYLoad,k=y.editStore,I=y.rowExpandeds,H=y.radioOpts,E=y.checkboxOpts,A=y.expandColumn,Y=y.hasFixedColumn,P=y.fullAllDataRowIdData,W=y.rowOpts,D=[];return g.forEach(function(t,r){var e={},o=y.getVTRowIndex(t),n=y.getRowIndex(t);(W.isHover||b)&&(e.mouseenter=function(e){isOperateMouse(y)||y.triggerHoverEvent(e,{row:t,rowIndex:n})},e.mouseleave=function(){isOperateMouse(y)||y.clearHoverRow()});var l,i,a=_utils.default.getRowid(y,t),s=P[a],c=s?s.level:0,d=s?s.seq:-1,u={$table:y,seq:d,rowid:a,fixed:h,type:renderType,level:c,row:t,rowIndex:n,$rowIndex:r},s=!1;T&&(s=-1<k.insertList.indexOf(t)),D.push(p("tr",{class:["vxe-body--row",{"row--stripe":m&&(y.getVTRowIndex(t)+1)%2==0,"is--new":s,"row--new":s&&(L.showStatus||L.showInsertStatus),"row--radio":H.highlight&&y.selectRow===t,"row--checked":E.highlight&&y.isCheckedByCheckboxRow(t)},x?_xeUtils.default.isFunction(x)?x(u):x:""],attrs:{rowid:a},style:_?_xeUtils.default.isFunction(_)?_(u):_:null,key:w||W.useKey||O?a:r,on:e},v.map(function(e,l){return renderColumn(p,f,y,d,a,h,c,t,n,r,o,e,l,v,g)}))),A&&I.length&&-1<I.indexOf(t)&&(O&&(l={paddingLeft:"".concat(c*C.indent+30,"px")}),i=A.showOverflow,u=_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?S:i,i={$table:y,seq:d,column:A,fixed:h,type:renderType,level:c,row:t,rowIndex:n,$rowIndex:r},D.push(p("tr",{class:"vxe-body--expanded-row",key:"expand_".concat(a),style:_?_xeUtils.default.isFunction(_)?_(i):_:null,on:e},[p("td",{class:["vxe-body--expanded-column",{"fixed--hidden":h&&!Y,"col--ellipsis":u}],attrs:{colspan:v.length}},[p("div",{class:"vxe-body--expanded-cell",style:l},[A.renderData(p,i)])])]))),!O||R||C.transform||!$.length||(i=t[C.children])&&i.length&&-1<$.indexOf(t)&&D.push.apply(D,_toConsumableArray(renderRows(p,f,y,h,i,v)))}),D}function syncBodyScroll(e,l,t,r,o){(r||o)&&(r&&((0,_util.removeScrollListener)(r),r.scrollTop=t),o&&((0,_util.removeScrollListener)(o),o.scrollTop=t),clearTimeout(scrollProcessTimeout),scrollProcessTimeout=setTimeout(function(){(0,_util.restoreScrollListener)(r),(0,_util.restoreScrollListener)(o)},300))}var _default={name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,size:String,fixedType:String},data:function(){return{wheelTime:null,wheelYSize:0,wheelYInterval:0,wheelYTotal:0}},mounted:function(){var e=this.$parent,l=this.$el,t=this.$refs,r=this.fixedType,e=e.elemStore,r="".concat(r||"main","-body-");e["".concat(r,"wrapper")]=l,e["".concat(r,"table")]=t.table,e["".concat(r,"colgroup")]=t.colgroup,e["".concat(r,"list")]=t.tbody,e["".concat(r,"xSpace")]=t.xSpace,e["".concat(r,"ySpace")]=t.ySpace,e["".concat(r,"emptyBlock")]=t.emptyBlock,this.$el.onscroll=this.scrollEvent,this.$el._onscroll=this.scrollEvent},beforeDestroy:function(){clearTimeout(this.wheelTime),this.$el._onscroll=null,this.$el.onscroll=null},destroyed:function(){var e=this.$parent,l=this.fixedType,e=e.elemStore,l="".concat(l||"main","-body-");e["".concat(l,"wrapper")]=null,e["".concat(l,"table")]=null,e["".concat(l,"colgroup")]=null,e["".concat(l,"list")]=null,e["".concat(l,"xSpace")]=null,e["".concat(l,"ySpace")]=null,e["".concat(l,"emptyBlock")]=null},render:function(t){var e=this._e,l=this.$parent,r=this.fixedColumn,o=this.fixedType,n=l.$scopedSlots,i=l.tId,a=l.tableData,s=l.tableColumn,c=l.visibleColumn,d=l.showOverflow,u=l.keyboardConfig,p=l.keyboardOpts,f=l.mergeList,y=l.spanMethod,h=l.scrollXLoad,g=l.scrollYLoad,v=l.isAllOverflow,m=l.emptyOpts,w=l.mouseConfig,b=l.mouseOpts,x=l.sYOpts;return o&&(s=!(h||g||d&&v)||f.length||y||u&&p.isMerge?c:r),m=n.empty?n.empty.call(this,{$table:l},t):(n=(n=m.name?_vXETable.default.renderer.get(m.name):null)?n.renderEmpty:null)?n.call(this,t,m,{$table:l}):l.emptyText||_conf.default.i18n("vxe.table.emptyText"),t("div",{class:["vxe-table--body-wrapper",o?"fixed-".concat(o,"--wrapper"):"body--wrapper"],attrs:{xid:i},on:g&&"wheel"===x.mode?{wheel:this.wheelEvent}:{}},[o?e():t("div",{class:"vxe-body--x-space",ref:"xSpace"}),t("div",{class:"vxe-body--y-space",ref:"ySpace"}),t("table",{class:"vxe-table--body",attrs:{xid:i,cellspacing:0,cellpadding:0,border:0},ref:"table"},[t("colgroup",{ref:"colgroup"},s.map(function(e,l){return t("col",{attrs:{name:e.id},key:l})})),t("tbody",{ref:"tbody"},renderRows(t,this,l,o,a,s))]),t("div",{class:"vxe-table--checkbox-range"}),w&&b.area?t("div",{class:"vxe-table--cell-area"},[t("span",{class:"vxe-table--cell-main-area"},b.extension?[t("span",{class:"vxe-table--cell-main-area-btn",on:{mousedown:function(e){l.triggerCellExtendMousedownEvent(e,{$table:l,fixed:o,type:renderType})}}})]:null),t("span",{class:"vxe-table--cell-copy-area"}),t("span",{class:"vxe-table--cell-extend-area"}),t("span",{class:"vxe-table--cell-multi-area"}),t("span",{class:"vxe-table--cell-active-area"})]):null,o?null:t("div",{class:"vxe-table--empty-block",ref:"emptyBlock"},[t("div",{class:"vxe-table--empty-content"},m)])])},methods:{scrollEvent:function(e){var l=this.$el,t=this.$parent,r=this.fixedType,o=t.$refs,n=t.elemStore,i=t.highlightHoverRow,a=t.scrollXLoad,s=t.scrollYLoad,c=t.lastScrollTop,d=t.lastScrollLeft,u=t.rowOpts,p=o.tableHeader,f=o.tableBody,y=o.leftBody,h=o.rightBody,g=o.tableFooter,v=o.validTip,m=p?p.$el:null,o=g?g.$el:null,p=f.$el,g=y?y.$el:null,f=h?h.$el:null,y=n["main-body-ySpace"],h=n["main-body-xSpace"],n=(s&&y?y:p).clientHeight,y=(a&&h?h:p).clientWidth,h=l.scrollTop,l=p.scrollLeft,d=l!==d,c=h!==c;t.lastScrollTop=h,t.lastScrollLeft=l,t.lastScrollTime=Date.now(),(u.isHover||i)&&t.clearHoverRow(),g&&"left"===r?syncBodyScroll(t,r,h=g.scrollTop,p,f):f&&"right"===r?syncBodyScroll(t,r,h=f.scrollTop,p,g):(d&&(m&&(m.scrollLeft=p.scrollLeft),o&&(o.scrollLeft=p.scrollLeft)),(g||f)&&(t.checkScrolling(),c&&syncBodyScroll(t,r,h,g,f))),a&&d&&t.triggerScrollXEvent(e),s&&c&&t.triggerScrollYEvent(e),d&&v&&v.visible&&v.updatePlacement(),t.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:h,scrollLeft:l,scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,bodyHeight:n,bodyWidth:y,isX:d,isY:c},e)},handleWheel:function(a,s,e,c,d){var u=this,p=this.$parent,l=p.$refs,t=p.elemStore,r=p.scrollYLoad,o=p.scrollXLoad,n=l.tableBody,i=l.leftBody,l=l.rightBody,f=n.$el,y=i?i.$el:null,h=l?l.$el:null,i=this.isPrevWheelTop===s?Math.max(0,this.wheelYSize-this.wheelYTotal):0,l=t["main-body-ySpace"],t=t["main-body-xSpace"],g=(r&&l?l:f).clientHeight,v=(o&&t?t:f).clientWidth;this.isPrevWheelTop=s,this.wheelYSize=Math.abs(s?e-i:e+i),this.wheelYInterval=0,this.wheelYTotal=0,clearTimeout(this.wheelTime),function e(){var l,t,r=u.fixedType,o=u.wheelYTotal,n=u.wheelYSize,i=u.wheelYInterval;o<n&&(n<(o+=i=Math.max(5,Math.floor(1.5*i)))&&(i-=o-n),t=f.scrollTop,l=f.clientHeight,n=f.scrollHeight,f.scrollTop=t=t+i*(s?-1:1),y&&(y.scrollTop=t),h&&(h.scrollTop=t),(s?t<n-l:0<=t)&&(u.wheelTime=setTimeout(e,10)),u.wheelYTotal=o,u.wheelYInterval=i,p.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:f.scrollTop,scrollLeft:f.scrollLeft,scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,bodyHeight:g,bodyWidth:v,isX:c,isY:d},a))}()},wheelEvent:function(e){var l=e.deltaY,t=e.deltaX,r=this.$el,o=this.$parent,n=o.$refs,i=o.highlightHoverRow,a=o.scrollYLoad,s=o.lastScrollTop,c=o.lastScrollLeft,d=o.rowOpts,u=n.tableBody.$el,n=l,l=n<0;(l?r.scrollTop<=0:r.scrollTop>=r.scrollHeight-r.clientHeight)||(r=r.scrollTop+n,c=(t=u.scrollLeft+t)!==c,(s=r!==s)&&(e.preventDefault(),o.lastScrollTop=r,o.lastScrollLeft=t,o.lastScrollTime=Date.now(),(d.isHover||i)&&o.clearHoverRow(),this.handleWheel(e,l,n,c,s),a&&o.triggerScrollYEvent(e)))}}};exports.default=_default;
|
|
1
|
+
"use strict";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)}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")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_utils=_interopRequireWildcard(require("../../tools/utils")),_util=require("./util"),_dom=_interopRequireDefault(require("../../tools/dom"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var l=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:l})(e)}function _interopRequireWildcard(e,l){if(!l&&e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};l=_getRequireWildcardCache(l);if(l&&l.has(e))return l.get(e);var t,r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&((r=n?Object.getOwnPropertyDescriptor(e,t):null)&&(r.get||r.set)?Object.defineProperty(o,t,r):o[t]=e[t]);return o.default=e,l&&l.set(e,o),o}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,l){if(e){if("string"==typeof e)return _arrayLikeToArray(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,l):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,r=new Array(l);t<l;t++)r[t]=e[t];return r}var scrollProcessTimeout,renderType="body";function isOperateMouse(e){return e._isResize||e.lastScrollTime&&Date.now()<e.lastScrollTime+e.delayHover}function renderLine(e,l,t,r){var o=r.row,n=r.column,i=t.treeOpts,a=t.treeConfig,s=t.fullAllDataRowIdData,c=n.slots,d=n.treeNode,u=s[(0,_util.getRowid)(t,o)],n=0,s=0,o=[];return u&&(n=u.level,s=u._index,o=u.items),c&&c.line?t.callSlot(c.line,r,e):a&&d&&i.line?[e("div",{class:"vxe-tree--line-wrapper"},[e("div",{class:"vxe-tree--line",style:{height:"".concat((0,_util.calcTreeLine)(r,o,s),"px"),left:"".concat(n*i.indent+(n?2-(0,_util.getOffsetSize)(t):0)+16,"px")}})])]:[]}function renderColumn(e,l,t,r,o,n,i,a,s,c,d,u,p,f,y){var h,g=t.$listeners,v=t.afterFullData,m=t.tableData,w=t.height,b=t.columnKey,x=t.overflowX,_=t.sYOpts,T=t.scrollXLoad,S=t.scrollYLoad,O=t.highlightCurrentRow,C=t.showOverflow,L=t.isAllOverflow,$=t.align,R=t.currentColumn,k=t.cellClassName,I=t.cellStyle,H=t.mergeList,E=t.spanMethod,A=t.radioOpts,Y=t.checkboxOpts,P=t.expandOpts,W=t.treeOpts,D=t.tooltipOpts,M=t.mouseConfig,q=t.editConfig,B=t.editOpts,j=t.editRules,U=t.validOpts,X=t.editStore,N=t.validStore,z=t.tooltipConfig,F=t.rowOpts,K=t.columnOpts,V=u.type,G=u.cellRender,J=u.editRender,Q=u.align,Z=u.showOverflow,ee=u.className,le=u.treeNode,te=X.actived,re=_.rHeight,oe=F.height,ne=D.showAll||D.enabled,ie=t.getColumnIndex(u),ae=t.getVTColumnIndex(u),X=(0,_utils.isEnableConf)(J),_=n?u.fixed!==n:u.fixed&&x,D=_xeUtils.default.isUndefined(Z)||_xeUtils.default.isNull(Z)?C:Z,x="ellipsis"===D,se="title"===D,ce=!0===D||"tooltip"===D,Z=se||ce||x,D={},Q=Q||$,$=N.row===a&&N.column===u,j=j&&U.showMessage&&("default"===U.message?w||1<m.length:"inline"===U.message),w={colid:u.id},de=g["cell-mouseenter"],ue=g["cell-mouseleave"],U=J&&q&&"dblclick"===B.trigger,pe={$table:t,seq:r,rowid:o,row:a,rowIndex:s,$rowIndex:c,_rowIndex:d,column:u,columnIndex:ie,$columnIndex:p,_columnIndex:ae,fixed:n,type:renderType,isHidden:_,level:i,visibleData:v,data:m,items:y};if(!T&&!S||Z||(x=Z=!0),(se||ce||ne||de||z)&&(D.mouseenter=function(e){isOperateMouse(t)||(se?_dom.default.updateCellTitle(e.currentTarget,u):(ce||ne)&&t.triggerBodyTooltipEvent(e,pe),de&&t.emitEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},pe),e))}),(ce||ne||ue||z)&&(D.mouseleave=function(e){isOperateMouse(t)||((ce||ne)&&t.handleTargetLeaveEvent(e),ue&&t.emitEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},pe),e))}),(Y.range||M)&&(D.mousedown=function(e){t.triggerCellMousedownEvent(e,pe)}),(F.isCurrent||O||g["cell-click"]||J&&q||"row"===P.trigger||"cell"===P.trigger||"row"===A.trigger||"radio"===u.type&&"cell"===A.trigger||"row"===Y.trigger||"checkbox"===u.type&&"cell"===Y.trigger||"row"===W.trigger||u.treeNode&&"cell"===W.trigger)&&(D.click=function(e){t.triggerCellClickEvent(e,pe)}),(U||g["cell-dblclick"])&&(D.dblclick=function(e){t.triggerCellDblclickEvent(e,pe)}),H.length){d=(0,_util.mergeBodyMethod)(H,d,ae);if(d){var ae=d.rowspan,fe=d.colspan;if(!ae||!fe)return null;1<ae&&(w.rowspan=ae),1<fe&&(w.colspan=fe)}}else if(E){fe=E(pe)||{},E=fe.rowspan,E=void 0===E?1:E,fe=fe.colspan,fe=void 0===fe?1:fe;if(!E||!fe)return null;1<E&&(w.rowspan=E),1<fe&&(w.colspan=fe)}!(_=_&&H&&(1<w.colspan||1<w.rowspan)?!1:_)&&q&&(J||G)&&(B.showStatus||B.showUpdateStatus)&&(h=t.isUpdateByRow(a,u.property));G=[];return _&&C&&L?G.push(e("div",{class:["vxe-cell",{"c--title":se,"c--tooltip":ce,"c--ellipsis":x}],style:{maxHeight:Z&&(re||oe)?"".concat(re||oe,"px"):""}})):(G.push.apply(G,_toConsumableArray(renderLine(e,l,t,pe)).concat([e("div",{class:["vxe-cell",{"c--title":se,"c--tooltip":ce,"c--ellipsis":x}],style:{maxHeight:Z&&(re||oe)?"".concat(re||oe,"px"):""},attrs:{title:se?t.getCellLabel(a,u):null}},u.renderCell(e,pe))])),j&&$&&G.push(e("div",{class:"vxe-cell--valid",style:N.rule&&N.rule.maxWidth?{width:"".concat(N.rule.maxWidth,"px")}:null},[e("span",{class:"vxe-cell--valid-msg"},N.content)]))),e("td",{class:["vxe-body--column",u.id,(_defineProperty(e={},"col--".concat(Q),Q),_defineProperty(e,"col--".concat(V),V),_defineProperty(e,"col--last",p===f.length-1),_defineProperty(e,"col--tree-node",le),_defineProperty(e,"col--edit",X),_defineProperty(e,"col--ellipsis",Z),_defineProperty(e,"fixed--hidden",_),_defineProperty(e,"col--dirty",h),_defineProperty(e,"col--actived",q&&X&&te.row===a&&(te.column===u||"row"===B.mode)),_defineProperty(e,"col--valid-error",$),_defineProperty(e,"col--current",R===u),e),_utils.default.getClass(ee,pe),_utils.default.getClass(k,pe)],key:b||K.useKey?u.id:p,attrs:w,style:Object.assign({height:Z&&(re||oe)?"".concat(re||oe,"px"):""},I?_xeUtils.default.isFunction(I)?I(pe):I:null),on:D},G)}function renderRows(p,f,y,h,g,v){var m=y.stripe,w=y.rowKey,b=y.highlightHoverRow,x=y.rowClassName,_=y.rowStyle,T=y.editConfig,S=y.showOverflow,O=y.treeConfig,C=y.treeOpts,L=y.editOpts,$=y.treeExpandeds,R=y.scrollYLoad,k=y.editStore,I=y.rowExpandeds,H=y.radioOpts,E=y.checkboxOpts,A=y.expandColumn,Y=y.hasFixedColumn,P=y.fullAllDataRowIdData,W=y.rowOpts,D=[];return g.forEach(function(t,r){var e={},o=y.getVTRowIndex(t),n=y.getRowIndex(t);(W.isHover||b)&&(e.mouseenter=function(e){isOperateMouse(y)||y.triggerHoverEvent(e,{row:t,rowIndex:n})},e.mouseleave=function(){isOperateMouse(y)||y.clearHoverRow()});var l,i,a=(0,_util.getRowid)(y,t),s=P[a],c=s?s.level:0,d=s?s.seq:-1,u={$table:y,seq:d,rowid:a,fixed:h,type:renderType,level:c,row:t,rowIndex:n,$rowIndex:r},s=!1;T&&(s=-1<k.insertList.indexOf(t)),D.push(p("tr",{class:["vxe-body--row",{"row--stripe":m&&(y.getVTRowIndex(t)+1)%2==0,"is--new":s,"row--new":s&&(L.showStatus||L.showInsertStatus),"row--radio":H.highlight&&y.selectRow===t,"row--checked":E.highlight&&y.isCheckedByCheckboxRow(t)},x?_xeUtils.default.isFunction(x)?x(u):x:""],attrs:{rowid:a},style:_?_xeUtils.default.isFunction(_)?_(u):_:null,key:w||W.useKey||O?a:r,on:e},v.map(function(e,l){return renderColumn(p,f,y,d,a,h,c,t,n,r,o,e,l,v,g)}))),A&&I.length&&-1<I.indexOf(t)&&(O&&(l={paddingLeft:"".concat(c*C.indent+30,"px")}),i=A.showOverflow,u=_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?S:i,i={$table:y,seq:d,column:A,fixed:h,type:renderType,level:c,row:t,rowIndex:n,$rowIndex:r},D.push(p("tr",{class:"vxe-body--expanded-row",key:"expand_".concat(a),style:_?_xeUtils.default.isFunction(_)?_(i):_:null,on:e},[p("td",{class:["vxe-body--expanded-column",{"fixed--hidden":h&&!Y,"col--ellipsis":u}],attrs:{colspan:v.length}},[p("div",{class:"vxe-body--expanded-cell",style:l},[A.renderData(p,i)])])]))),!O||R||C.transform||!$.length||(i=t[C.children])&&i.length&&-1<$.indexOf(t)&&D.push.apply(D,_toConsumableArray(renderRows(p,f,y,h,i,v)))}),D}function syncBodyScroll(e,l,t,r,o){(r||o)&&(r&&((0,_util.removeScrollListener)(r),r.scrollTop=t),o&&((0,_util.removeScrollListener)(o),o.scrollTop=t),clearTimeout(scrollProcessTimeout),scrollProcessTimeout=setTimeout(function(){(0,_util.restoreScrollListener)(r),(0,_util.restoreScrollListener)(o)},300))}var _default={name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,size:String,fixedType:String},data:function(){return{wheelTime:null,wheelYSize:0,wheelYInterval:0,wheelYTotal:0}},mounted:function(){var e=this.$parent,l=this.$el,t=this.$refs,r=this.fixedType,e=e.elemStore,r="".concat(r||"main","-body-");e["".concat(r,"wrapper")]=l,e["".concat(r,"table")]=t.table,e["".concat(r,"colgroup")]=t.colgroup,e["".concat(r,"list")]=t.tbody,e["".concat(r,"xSpace")]=t.xSpace,e["".concat(r,"ySpace")]=t.ySpace,e["".concat(r,"emptyBlock")]=t.emptyBlock,this.$el.onscroll=this.scrollEvent,this.$el._onscroll=this.scrollEvent},beforeDestroy:function(){clearTimeout(this.wheelTime),this.$el._onscroll=null,this.$el.onscroll=null},destroyed:function(){var e=this.$parent,l=this.fixedType,e=e.elemStore,l="".concat(l||"main","-body-");e["".concat(l,"wrapper")]=null,e["".concat(l,"table")]=null,e["".concat(l,"colgroup")]=null,e["".concat(l,"list")]=null,e["".concat(l,"xSpace")]=null,e["".concat(l,"ySpace")]=null,e["".concat(l,"emptyBlock")]=null},render:function(t){var e=this._e,l=this.$parent,r=this.fixedColumn,o=this.fixedType,n=l.$scopedSlots,i=l.tId,a=l.tableData,s=l.tableColumn,c=l.visibleColumn,d=l.showOverflow,u=l.keyboardConfig,p=l.keyboardOpts,f=l.mergeList,y=l.spanMethod,h=l.scrollXLoad,g=l.scrollYLoad,v=l.isAllOverflow,m=l.emptyOpts,w=l.mouseConfig,b=l.mouseOpts,x=l.sYOpts;return o&&(s=!(h||g||d&&v)||f.length||y||u&&p.isMerge?c:r),m=n.empty?n.empty.call(this,{$table:l},t):(n=(n=m.name?_vXETable.default.renderer.get(m.name):null)?n.renderEmpty:null)?n.call(this,t,m,{$table:l}):l.emptyText||_conf.default.i18n("vxe.table.emptyText"),t("div",{class:["vxe-table--body-wrapper",o?"fixed-".concat(o,"--wrapper"):"body--wrapper"],attrs:{xid:i},on:g&&"wheel"===x.mode?{wheel:this.wheelEvent}:{}},[o?e():t("div",{class:"vxe-body--x-space",ref:"xSpace"}),t("div",{class:"vxe-body--y-space",ref:"ySpace"}),t("table",{class:"vxe-table--body",attrs:{xid:i,cellspacing:0,cellpadding:0,border:0},ref:"table"},[t("colgroup",{ref:"colgroup"},s.map(function(e,l){return t("col",{attrs:{name:e.id},key:l})})),t("tbody",{ref:"tbody"},renderRows(t,this,l,o,a,s))]),t("div",{class:"vxe-table--checkbox-range"}),w&&b.area?t("div",{class:"vxe-table--cell-area"},[t("span",{class:"vxe-table--cell-main-area"},b.extension?[t("span",{class:"vxe-table--cell-main-area-btn",on:{mousedown:function(e){l.triggerCellExtendMousedownEvent(e,{$table:l,fixed:o,type:renderType})}}})]:null),t("span",{class:"vxe-table--cell-copy-area"}),t("span",{class:"vxe-table--cell-extend-area"}),t("span",{class:"vxe-table--cell-multi-area"}),t("span",{class:"vxe-table--cell-active-area"})]):null,o?null:t("div",{class:"vxe-table--empty-block",ref:"emptyBlock"},[t("div",{class:"vxe-table--empty-content"},m)])])},methods:{scrollEvent:function(e){var l=this.$el,t=this.$parent,r=this.fixedType,o=t.$refs,n=t.elemStore,i=t.highlightHoverRow,a=t.scrollXLoad,s=t.scrollYLoad,c=t.lastScrollTop,d=t.lastScrollLeft,u=t.rowOpts,p=o.tableHeader,f=o.tableBody,y=o.leftBody,h=o.rightBody,g=o.tableFooter,v=o.validTip,m=p?p.$el:null,o=g?g.$el:null,p=f.$el,g=y?y.$el:null,f=h?h.$el:null,y=n["main-body-ySpace"],h=n["main-body-xSpace"],n=(s&&y?y:p).clientHeight,y=(a&&h?h:p).clientWidth,h=l.scrollTop,l=p.scrollLeft,d=l!==d,c=h!==c;t.lastScrollTop=h,t.lastScrollLeft=l,t.lastScrollTime=Date.now(),(u.isHover||i)&&t.clearHoverRow(),g&&"left"===r?syncBodyScroll(t,r,h=g.scrollTop,p,f):f&&"right"===r?syncBodyScroll(t,r,h=f.scrollTop,p,g):(d&&(m&&(m.scrollLeft=p.scrollLeft),o&&(o.scrollLeft=p.scrollLeft)),(g||f)&&(t.checkScrolling(),c&&syncBodyScroll(t,r,h,g,f))),a&&d&&t.triggerScrollXEvent(e),s&&c&&t.triggerScrollYEvent(e),d&&v&&v.visible&&v.updatePlacement(),t.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:h,scrollLeft:l,scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,bodyHeight:n,bodyWidth:y,isX:d,isY:c},e)},handleWheel:function(a,s,e,c,d){var u=this,p=this.$parent,l=p.$refs,t=p.elemStore,r=p.scrollYLoad,o=p.scrollXLoad,n=l.tableBody,i=l.leftBody,l=l.rightBody,f=n.$el,y=i?i.$el:null,h=l?l.$el:null,i=this.isPrevWheelTop===s?Math.max(0,this.wheelYSize-this.wheelYTotal):0,l=t["main-body-ySpace"],t=t["main-body-xSpace"],g=(r&&l?l:f).clientHeight,v=(o&&t?t:f).clientWidth;this.isPrevWheelTop=s,this.wheelYSize=Math.abs(s?e-i:e+i),this.wheelYInterval=0,this.wheelYTotal=0,clearTimeout(this.wheelTime),function e(){var l,t,r=u.fixedType,o=u.wheelYTotal,n=u.wheelYSize,i=u.wheelYInterval;o<n&&(n<(o+=i=Math.max(5,Math.floor(1.5*i)))&&(i-=o-n),t=f.scrollTop,l=f.clientHeight,n=f.scrollHeight,f.scrollTop=t=t+i*(s?-1:1),y&&(y.scrollTop=t),h&&(h.scrollTop=t),(s?t<n-l:0<=t)&&(u.wheelTime=setTimeout(e,10)),u.wheelYTotal=o,u.wheelYInterval=i,p.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:f.scrollTop,scrollLeft:f.scrollLeft,scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,bodyHeight:g,bodyWidth:v,isX:c,isY:d},a))}()},wheelEvent:function(e){var l=e.deltaY,t=e.deltaX,r=this.$el,o=this.$parent,n=o.$refs,i=o.highlightHoverRow,a=o.scrollYLoad,s=o.lastScrollTop,c=o.lastScrollLeft,d=o.rowOpts,u=n.tableBody.$el,n=l,l=n<0;(l?r.scrollTop<=0:r.scrollTop>=r.scrollHeight-r.clientHeight)||(r=r.scrollTop+n,c=(t=u.scrollLeft+t)!==c,(s=r!==s)&&(e.preventDefault(),o.lastScrollTop=r,o.lastScrollLeft=t,o.lastScrollTime=Date.now(),(d.isHover||i)&&o.clearHoverRow(),this.handleWheel(e,l,n,c,s),a&&o.triggerScrollYEvent(e)))}}};exports.default=_default;
|