mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-10 00:40:30 +08:00
86fc4eb695
Former-commit-id: 227ec9664fa803a11a731cf5336437c497f17066
2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
"59:function(e,t,n){\"use strict\";n.r(t);var r=function(){var e=this.$createElement,t=this._self._c||e;return t(\"div\",{class:[\"el-cascader-panel\",this.border&&\"is-bordered\"],on:{keydown:this.handleKeyDown}},this._l(this.menus,(function(e,n){return t(\"cascader-menu\",{key:n,ref:\"menu\",refInFor:!0,attrs:{index:n,nodes:e}})})),1)};r._withStripped=!0;var i=n(26),o=n.n(i),a=n(14),s=n.n(a),u=n(18),l=n.n(u),c=n(51),d=n.n(c),f=n(3),h=function(e){return e.stopPropagation()},p={inject:[\"panel\"],components:{ElCheckbox:l.a,ElRadio:d.a},props:{node:{required:!0},nodeId:String},computed:{config:function(){return this.panel.config},isLeaf:function(){return this.node.isLeaf},isDisabled:function(){return this.node.isDisabled},checkedValue:function(){return this.panel.checkedValue},isChecked:function(){return this.node.isSameNode(this.checkedValue)},inActivePath:function(){return this.isInPath(this.panel.activePath)},inCheckedPath:function(){var e=this;return!!this.config.checkStrictly&&this.panel.checkedNodePaths.some((function(t){return e.isInPath(t)}))},value:function(){return this.node.getValueByOption()}},methods:{handleExpand:function(){var e=this,t=this.panel,n=this.node,r=this.isDisabled,i=this.config,o=i.multiple;!i.checkStrictly&&r||n.loading||(i.lazy&&!n.loaded?t.lazyLoad(n,(function(){var t=e.isLeaf;if(t||e.handleExpand(),o){var r=!!t&&n.checked;e.handleMultiCheckChange(r)}})):t.handleExpand(n))},handleCheckChange:function(){var e=this.panel,t=this.value,n=this.node;e.handleCheckChange(t),e.handleExpand(n)},handleMultiCheckChange:function(e){this.node.doCheck(e),this.panel.calculateMultiCheckedValue()},isInPath:function(e){var t=this.node;return(e[t.level-1]||{}).uid===t.uid},renderPrefix:function(e){var t=this.isLeaf,n=this.isChecked,r=this.config,i=r.checkStrictly;return r.multiple?this.renderCheckbox(e):i?this.renderRadio(e):t&&n?this.renderCheckIcon(e):null},renderPostfix:function(e){var t=this.node,n=this.isLeaf;return t.loading?this.renderLoadingIcon(e):n?null:this.renderExpandIcon(e)},renderCheckbox:function(e){var t=this.node,n=this.config,r=this.isDisabled,i={on:{change:this.handleMultiCheckChange},nativeOn:{}};return n.checkStrictly&&(i.nativeOn.click=h),e(\"el-checkbox\",o()([{attrs:{value:t.checked,indeterminate:t.indeterminate,disabled:r}},i]))},renderRadio:function(e){var t=this.checkedValue,n=this.value,r=this.isDisabled;return Object(f.isEqual)(n,t)&&(n=t),e(\"el-radio\",{attrs:{value:t,label:n,disabled:r},on:{change:this.handleCheckChange},nativeOn:{click:h}},[e(\"span\")])},renderCheckIcon:function(e){return e(\"i\",{class:\"el-icon-check el-cascader-node__prefix\"})},renderLoadingIcon:function(e){return e(\"i\",{class:\"el-icon-loading el-cascader-node__postfix\"})},renderExpandIcon:function(e){return e(\"i\",{class:\"el-icon-arrow-right el-cascader-node__postfix\"})},renderContent:function(e){var t=this.panel,n=this.node,r=t.renderLabelFn;return e(\"span\",{class:\"el-cascader-node__label\"},[(r?r({node:n,data:n.data}):null)||n.label])}},render:function(e){var t=this,n=this.inActivePath,r=this.inCheckedPath,i=this.isChecked,a=this.isLeaf,s=this.isDisabled,u=this.config,l=this.nodeId,c=u.expandTrigger,d=u.checkStrictly,f=u.multiple,h=!d&&s,p={on:{}};return\"click\"===c?p.on.click=this.handleExpand:(p.on.mouseenter=function(e){t.handleExpand(),t.$emit(\"expand\",e)},p.on.focus=function(e){t.handleExpand(),t.$emit(\"expand\",e)}),!a||s||d||f||(p.on.click=this.handleCheckChange),e(\"li\",o()([{attrs:{role:\"menuitem\",id:l,\"aria-expanded\":n,tabindex:h?null:-1},class:{\"el-cascader-node\":!0,\"is-selectable\":d,\"in-active-path\":n,\"in-checked-path\":r,\"is-active\":i,\"is-disabled\":h}},p]),[this.renderPrefix(e),this.renderContent(e),this.renderPostfix(e)])}},m=n(0),y=Object(m.a)(p,void 0,void 0,!1,null,null,null);y.options.__file=\"packages/cascader-panel/src/cascader-node.vue\";var g=y.exports,v=n(6),_={name:\"ElCascaderMenu\",mixins:[n.n(v).a],inject:[\"panel\"],components:{ElScrollbar:s.a,CascaderNode:g},props:{nodes:{type:Array,required:!0},index:Number},data:function(){return{activeNode:null,hoverTimer:null,id:Object(f.generateId)()}},computed:{isEmpty:function(){return!this.nodes.length},menuId:function(){return\"cascader-menu-\"+this.id+\"-\"+this.index}},methods:{handleExpand:function(e){this.activeNode=e.target},handleMouseMove:function(e){var t=this.activeNode,n=this.hoverTimer,r=this.$refs.hoverZone;if(t&&r)if(t.contains(e.target)){clearTimeout(n);var i=this.$el.getBoundingClientRect().left,o=e.clientX-i,a=this.$el,s=a.offsetWidth,u=a.offsetHeight,l=t.offsetTop,c=l+t.offsetHeight;r.innerHTML='\\n <path style=\"pointer-events: auto;\" fill=\"transparent\" d=\"M'+o+\" \"+l+\" L\"+s+\" 0 V\"+l+' Z\" />\\n <path style=\"pointer-events: auto;\" fill=\"transparent\" d=\"M'+o+\" \"+c+\" L\"+s+\" \"+u+\" V\"+c+' Z\" />\\n '}else n||(this.hoverTimer=setTimeout(this.clearHoverZone,this.panel.config.hoverThreshold))},clearHoverZone:function(){var e=this.$refs.hoverZone;e&&(e.innerHTML=\"\")},renderEmptyText:function(e){return e(\"div\",{class:\"el-cascader-menu__empty-text\"},[this.t(\"el.cascader.noData\")])},renderNodeList:function(e){var t=this.menuId,n=this.panel.isHoverMenu,r={on:{}};n&&(r.on.expand=this.handleExpand);var i=this.nodes.map((function(n,i){var a=n.hasChildren;return e(\"cascader-node\",o()([{key:n.uid,attrs:{node:n,\"node-id\":t+\"-\"+i,\"aria-haspopup\":a,\"aria-owns\":a?t:null}},r]))}));return[].concat(i,[n?e(\"svg\",{ref:\"hoverZone\",class:\"el-cascader-menu__hover-zone\"}):null])}},render:function(e){var t=this.isEmpty,n=this.menuId,r={nativeOn:{}};return this.panel.isHoverMenu&&(r.nativeOn.mousemove=this.handleMouseMove),e(\"el-scrollbar\",o()([{attrs:{tag:\"ul\",role:\"menu\",id:n,\"wrap-class\":\"el-cascader-menu__wrap\",\"view-class\":{\"el-cascader-menu__list\":!0,\"is-empty\":t}},class:\"el-cascader-menu\"},r]),[t?this.renderEmptyText(e):this.renderNodeList(e)])}},b=Object(m.a)(_,void 0,void 0,!1,null,null,null);b.options.__file=\"packages/cascader-panel/src/cascader-menu.vue\";var M=b.exports,w=n(21),D=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),x=0,N=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,e),this.data=t,this.config=n,this.parent=r||null,this.level=this.parent?this.parent.level+1:1,this.uid=x++,this.initState(),this.initChildren()}return e.prototype.initState=function(){var e=this.config,t=e.value,n=e.label;this.value=this.data[t],this.label=this.data[n],this.pathNodes=this.calculatePathNodes(),this.path=this.pathNodes.map((function(e){return e.value})),this.pathLabels=this.pathNodes.map((function(e){return e.label})),this.loading=!1,this.loaded=!1},e.prototype.initChildren=function(){var t=this,n=this.config,r=n.children,i=this.data[r];this.hasChildren=Array.isArray(i),this.children=(i||[]).map((function(r){return new e(r,n,t)}))},e.prototype.calculatePathNodes=function(){for(var e=[this],t=this.parent;t;)e.unshift(t),t=t.parent;return e},e.prototype.getPath=function(){return this.path},e.prototype.getValue=function(){return this.value},e.prototype.getValueByOption=function(){return this.config.emitPath?this.getPath():this.getValue()},e.prototype.getText=function(e,t){return e?this.pathLabels.join(t):this.label},e.prototype.isSameNode=function(e){var t=this.getValueByOption();return this.config.multiple&&Array.isArray(e)?e.some((function(e){return Object(f.isEqual)(e,t)})):Object(f.isEqual)(e,t)},e.prototype.broadcast=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=\"onParent\"+Object(f.capitalize)(e);this.children.forEach((function(t){t&&(t.broadcast.apply(t,[e].concat(n)),t[i]&&t[i].apply(t,n))}))},e.prototype.emit=function(e){var t=this.parent,n=\"onChild\"+Object(f.capitalize)(e);if(t){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];t[n]&&t[n].apply(t,i),t.emit.apply(t,[e].concat(i))}},e.prototype.onParentCheck=function(e){this.isDisabled||this.setCheckState(e)},e.prototype.onChildCheck=function(){var e=this.children.filter((function(e){return!e.isDisabled})),t=!!e.length&&e.every((function(e){return e.checked}));this.setCheckState(t)},e.prototype.setCheckState=function(e){var t=this.children.length,n=this.children.reduce((function(e,t){return e+(t.checked?1:t.indeterminate?.5:0)}),0);this.checked=e,this.indeterminate=n!==t&&n>0},e.prototype.syncCheckState=function(e){var t=this.getValueByOption(),n=this.isSameNode(e,t);this.doCheck(n)},e.prototype.doCheck=function(e){this.checked!==e&&(this.config.checkStrictly?this.checked=e:(this.broadcast(\"check\",e),this.setCheckState(e),this.emit(\"check\")))},D(e,[{key:\"isDisabled\",get:function(){var e=this.data,t=this.parent,n=this.config,r=n.disabled,i=n.checkStrictly;return e[r]||!i&&t&&t.isDisabled}},{key:\"isLeaf\",get:function(){var e=this.data,t=this.loaded,n=this.hasChildren,r=this.children,i=this.config,o=i.lazy,a=i.leaf;if(o){var s=Object(w.isDef)(e[a])?e[a]:!!t&&!r.length;return this.hasChildren=!s,s}return!n}}]),e}(),j=function e(t,n){return t.reduce((function(t,r){return r.isLeaf?t.push(r):(!n&&t.push(r),t=t.concat(e(r.children,n))),t}),[])},T=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,e),this.config=n,this.initNodes(t)}return e.prototype.initNodes=function(e){var t=this;e=Object(f.coerceTruthyValueToArray)(e),this.nodes=e.map((function(e){return new N(e,t.config)})),this.flattedNodes=this.getFlattedNodes(!1,!1),this.leafNodes=this.getFlattedNodes(!0,!1)},e.prototype.appendNode=function(e,t){var n=new N(e,this.config,t);(t?t.children:this.nodes).push(n)},e.prototype.appendNodes=function(e,t){var n=this;(e=Object(f.coerceTruthyValueToArray)(e)).forEach((function(e){return n.appendNode(e,t)}))},e.prototype.getNodes=function(){return this.nodes},e.prototype.getFlattedNodes=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e?this.leafNodes:this.flattedNodes;return t?n:j(this.nodes,e)},e.prototype.getNodeByValue=function(e){if(e){var t=this.getFlattedNodes(!1,!this.config.lazy).filter((function(t){return Object(f.valueEquals)(t.path,e)||t.value===e}));return t&&t.length?t[0]:null}return null},e}(),k=n(9),O=n.n(k),L=n(32),S=n.n(L),I=n(31),C=n.n(I),E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A=S.a.keys,z={expandTrigger:\"click\",multiple:!1,checkStrictly:!1,emitPath:!0,lazy:!1,lazyLoad:f.noop,value:\"value\",label:\"label\",children:\"children\",leaf:\"leaf\",disabled:\"disabled\",hoverThreshold:500},Y=function(e){return!e.getAttribute(\"aria-owns\")},P=function(e,t){var n=e.parentNode;if(n){var r=n.querySelectorAll('.el-cascader-node[tabindex=\"-1\"]');return r[Array.prototype.indexOf.call(r,e)+t]||null}return null},U=function(e,t){if(e){var n=e.id.split(\"-\");return Number(n[n.length-2])}},$=function(e){e&&(e.focus(),!Y(e)&&e.click())},Q={name:\"ElCascaderPanel\",components:{CascaderMenu:M},props:{value:{},options:Array,props:Object,border:{type:Boolean,default:!0},renderLabel:Function},provide:function(){return{panel:this}},data:function(){return{checkedValue:null,checkedNodePaths:[],store:[],menus:[],activePath:[],loadCount:0}},computed:{config:function(){return O()(E({},z),this.props||{})},multiple:function(){return this.config.multiple},checkStrictly:function(){return this.config.checkStrictly},leafOnly:function(){return!this.checkStrictly},isHoverMenu:function(){return\"hover\"===this.config.expandTrigger},renderLabelFn:function(){return this.renderLabel||this.$scopedSlots.default}},watch:{options:{handler:function(){this.initStore()},immediate:!0,deep:!0},value:function(){this.syncCheckedValue(),this.checkStrictly&&this.calculateCheckedNodePaths()},checkedValue:function(e){Object(f.isEqual)(e,this.value)||(this.checkStrictly&&this.calculateCheckedNodePaths(),this.$emit(\"input\",e),this.$emit(\"change\",e))}},mounted:function(){Object(f.isEmpty)(this.value)||this.syncCheckedValue()},methods:{initStore:function(){var e=this.config,t=this.options;e.lazy&&Object(f.isEmpty)(t)?this.lazyLoad():(this.store=new T(t,e),this.menus=[this.store.getNodes()],this.syncMenuState())},syncCheckedValue:function(){var e=this.value,t=this.checkedValue;Object(f.isEqual)(e,t)||(this.checkedValue=e,this.syncMenuState())},syncMenuState:function(){var e=this.multiple,t=this.checkStrictly;this.syncActivePath(),e&&this.syncMultiCheckState(),t&&this.calculateCheckedNodePaths(),this.$nextTick(this.scrollIntoView)},syncMultiCheckState:function(){var e=this;this.getFlattedNodes(this.leafOnly).forEach((function(t){t.syncCheckState(e.checkedValue)}))},syncActivePath:function(){var e=this,t=this.store,n=this.multiple,r=this.activePath,i=this.checkedValue;if(Object(f.isEmpty)(r))if(Object(f.isEmpty)(i))this.activePath=[],this.menus=[t.getNodes()];else{var o=n?i[0]:i,a=((this.getNodeByValue(o)||{}).pathNodes||[]).slice(0,-1);this.expandNodes(a)}else{var s=r.map((function(t){return e.getNodeByValue(t.getValue())}));this.expandNodes(s)}},expandNodes:function(e){var t=this;e.forEach((function(e){return t.handleExpand(e,!0)}))},calculateCheckedNodePaths:function(){var e=this,t=this.checkedValue,n=this.multiple?Object(f.coerceTruthyValueToArray)(t):[t];this.checkedNodePaths=n.map((function(t){var n=e.getNodeByValue(t);return n?n.pathNodes:[]}))},handleKeyDown:function(e){var t=e.target;switch(e.keyCode){case A.up:var n=P(t,-1);$(n);break;case A.down:var r=P(t,1);$(r);break;case A.left:var i=this.$refs.menu[U(t)-1];if(i){var o=i.$el.querySelector('.el-cascader-node[aria-expanded=\"true\"]');$(o)}break;case A.right:var a=this.$refs.menu[U(t)+1];if(a){var s=a.$el.querySelector('.el-cascader-node[tabindex=\"-1\"]');$(s)}break;case A.enter:!function(e){if(e){var t=e.querySelector(\"input\");t?t.click():Y(e)&&e.click()}}(t);break;case A.esc:case A.tab:this.$emit(\"close\");break;default:return}},handleExpand:function(e,t){var n=this.activePath,r=e.level,i=n.slice(0,r-1),o=this.menus.slice(0,r);if(e.isLeaf||(i.push(e),o.push(e.children)),this.activePath=i,this.menus=o,!t){var a=i.map((function(e){return e.getValue()})),s=n.map((function(e){return e.getValue()}));Object(f.valueEquals)(a,s)||(this.$emit(\"active-item-change\",a),this.$emit(\"expand-change\",a))}},handleCheckChange:function(e){this.checkedValue=e},lazyLoad:function(e,t){var n=this,r=this.config;e||(e=e||{root:!0,level:0},this.store=new T([],r),this.menus=[this.store.getNodes()]),e.loading=!0,r.lazyLoad(e,(function(r){var i=e.root?null:e;if(r&&r.length&&n.store.appendNodes(r,i),e.loading=!1,e.loaded=!0,Array.isArray(n.checkedValue)){var o=n.checkedValue[n.loadCount++],a=n.config.value,s=n.config.leaf;if(Array.isArray(r)&&r.filter((function(e){return e[a]===o})).length>0){var u=n.store.getNodeByValue(o);u.data[s]||n.lazyLoad(u,(function(){n.handleExpand(u)})),n.loadCount===n.checkedValue.length&&n.$parent.computePresentText()}}t&&t(r)}))},calculateMultiCheckedValue:function(){this.checkedValue=this.getCheckedNodes(this.leafOnly).map((function(e){return e.getValueByOption()}))},scrollIntoView:function(){this.$isServer||(this.$refs.menu||[]).forEach((function(e){var t=e.$el;if(t){var n=t.querySelector(\".el-scrollbar__wrap\"),r=t.querySelector(\".el-cascader-node.is-active\")||t.querySelector(\".el-cascader-node.in-active-path\");C()(n,r)}}))},getNodeByValue:function(e){return this.store.getNodeByValue(e)},getFlattedNodes:function(e){var t=!this.config.lazy;return this.store.getFlattedNodes(e,t)},getCheckedNodes:function(e){var t=this.checkedValue;return this.multiple?this.getFlattedNodes(e).filter((function(e){return e.checked})):Object(f.isEmpty)(t)?[]:[this.getNodeByValue(t)]},clearCheckedNodes:function(){var e=this.config,t=this.leafOnly,n=e.multiple,r=e.emitPath;n?(this.getCheckedNodes(t).filter((function(e){return!e.isDisabled})).forEach((function(e){return e.doCheck(!1)})),this.calculateMultiCheckedValue()):this.checkedValue=r?[]:null}}},F=Object(m.a)(Q,r,[],!1,null,null,null);F.options.__file=\"packages/cascader-panel/src/cascader-panel.vue\";var R=F.exports;R.install=function(e){e.component(R.name,R)},t.default=R}";
|