vxe-pc-ui 4.5.23 → 4.5.25
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/es/icon/style.css +1 -1
- package/es/select/src/select.js +8 -3
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tree/src/tree.js +11 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +45 -19
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +82 -27
- package/lib/index.umd.min.js +1 -1
- package/lib/select/src/select.js +8 -3
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tree/src/tree.js +14 -1
- package/lib/tree/src/tree.min.js +1 -1
- package/lib/ui/index.js +5 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/upload/src/upload.js +54 -19
- package/lib/upload/src/upload.min.js +1 -1
- package/package.json +1 -1
- package/packages/select/src/select.ts +8 -3
- package/packages/tree/src/tree.ts +11 -1
- package/packages/ui/index.ts +4 -2
- package/packages/upload/src/upload.ts +44 -19
- package/types/components/grid.d.ts +5 -5
- package/types/components/tree.d.ts +1 -0
- package/types/components/upload.d.ts +16 -4
- /package/es/icon/{iconfont.1744712843204.ttf → iconfont.1744861679657.ttf} +0 -0
- /package/es/icon/{iconfont.1744712843204.woff → iconfont.1744861679657.woff} +0 -0
- /package/es/icon/{iconfont.1744712843204.woff2 → iconfont.1744861679657.woff2} +0 -0
- /package/es/{iconfont.1744712843204.ttf → iconfont.1744861679657.ttf} +0 -0
- /package/es/{iconfont.1744712843204.woff → iconfont.1744861679657.woff} +0 -0
- /package/es/{iconfont.1744712843204.woff2 → iconfont.1744861679657.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1744712843204.ttf → iconfont.1744861679657.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1744712843204.woff → iconfont.1744861679657.woff} +0 -0
- /package/lib/icon/style/{iconfont.1744712843204.woff2 → iconfont.1744861679657.woff2} +0 -0
- /package/lib/{iconfont.1744712843204.ttf → iconfont.1744861679657.ttf} +0 -0
- /package/lib/{iconfont.1744712843204.woff → iconfont.1744861679657.woff} +0 -0
- /package/lib/{iconfont.1744712843204.woff2 → iconfont.1744861679657.woff2} +0 -0
package/lib/tree/src/tree.js
CHANGED
|
@@ -624,7 +624,20 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
624
624
|
isCheckedByRadioNode,
|
|
625
625
|
isCheckedByCheckboxNodeId,
|
|
626
626
|
isIndeterminateByCheckboxNode,
|
|
627
|
-
isCheckedByCheckboxNode
|
|
627
|
+
isCheckedByCheckboxNode,
|
|
628
|
+
getCheckboxIndeterminateNodes() {
|
|
629
|
+
const {
|
|
630
|
+
treeList,
|
|
631
|
+
indeterminateCheckboxMaps
|
|
632
|
+
} = reactData;
|
|
633
|
+
const indeterminateNodes = [];
|
|
634
|
+
_xeUtils.default.eachTree(treeList, node => {
|
|
635
|
+
if (indeterminateCheckboxMaps[getNodeId(node)]) {
|
|
636
|
+
indeterminateNodes.push(node);
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
return indeterminateNodes;
|
|
640
|
+
}
|
|
628
641
|
};
|
|
629
642
|
const cacheNodeMap = () => {
|
|
630
643
|
const {
|
package/lib/tree/src/tree.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_loading=_interopRequireDefault(require("../../loading/src/loading"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getNodeUniqueId(){return _xeUtils.default.uniqueId("node_")}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeTree",props:{data:Array,height:[String,Number],minHeight:{type:[String,Number],default:()=>(0,_ui.getConfig)().tree.minHeight},loading:Boolean,loadingConfig:Object,accordion:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.accordion},childrenField:{type:String,default:()=>(0,_ui.getConfig)().tree.childrenField},valueField:{type:String,default:()=>(0,_ui.getConfig)().tree.valueField},keyField:{type:String,default:()=>(0,_ui.getConfig)().tree.keyField},parentField:{type:String,default:()=>(0,_ui.getConfig)().tree.parentField},titleField:{type:String,default:()=>(0,_ui.getConfig)().tree.titleField},hasChildField:{type:String,default:()=>(0,_ui.getConfig)().tree.hasChildField},transform:Boolean,isCurrent:Boolean,isHover:Boolean,expandAll:Boolean,showLine:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showLine},trigger:String,indent:{type:Number,default:()=>(0,_ui.getConfig)().tree.indent},showRadio:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showRadio},checkNodeKey:{type:[String,Number],default:()=>(0,_ui.getConfig)().tree.checkNodeKey},radioConfig:Object,showCheckbox:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showCheckbox},checkNodeKeys:{type:Array,default:()=>(0,_ui.getConfig)().tree.checkNodeKeys},checkboxConfig:Object,nodeConfig:Object,lazy:Boolean,toggleMethod:Function,loadMethod:Function,showIcon:{type:Boolean,default:!0},iconOpen:{type:String,default:()=>(0,_ui.getConfig)().tree.iconOpen},iconClose:{type:String,default:()=>(0,_ui.getConfig)().tree.iconClose},iconLoaded:{type:String,default:()=>(0,_ui.getConfig)().tree.iconLoaded},size:{type:String,default:()=>(0,_ui.getConfig)().tree.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","update:checkNodeKey","update:checkNodeKeys","node-click","node-dblclick","current-change","radio-change","checkbox-change","load-success","load-error"],setup(O,e){const{emit:n,slots:w}=e;var t=_xeUtils.default.uniqueId();const y=(0,_ui.useSize)(O)["computeSize"],c=(0,_vue.ref)(),R=(0,_vue.reactive)({currentNode:null,nodeMaps:{},selectRadioKey:O.checkNodeKey,treeList:[],treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},indeterminateCheckboxMaps:{}}),s={},E={refElem:c},P=(0,_vue.computed)(()=>O.titleField||"title"),u=(0,_vue.computed)(()=>O.keyField||"id"),h=(0,_vue.computed)(()=>{var e=u.value;return O.valueField||e}),N=(0,_vue.computed)(()=>O.parentField||"parentId"),K=(0,_vue.computed)(()=>O.childrenField||"children"),T=(0,_vue.computed)(()=>O.hasChildField||"hasChild"),m=(0,_vue.computed)(()=>{var e=v.value["isCurrent"];return _xeUtils.default.isBoolean(e)?e:O.isCurrent}),b=(0,_vue.computed)(()=>{var e=v.value["isHover"];return _xeUtils.default.isBoolean(e)?e:O.isHover}),B=(0,_vue.computed)(()=>Object.assign({showIcon:!0},(0,_ui.getConfig)().tree.radioConfig,O.radioConfig)),j=(0,_vue.computed)(()=>Object.assign({showIcon:!0},(0,_ui.getConfig)().tree.checkboxConfig,O.checkboxConfig)),v=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tree.nodeConfig,O.nodeConfig)),M=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tree.loadingConfig,O.loadingConfig)),L=(0,_vue.computed)(()=>{var{height:e,minHeight:t}=O,a={};return e&&(a.height=(0,_dom.toCssUnit)(e)),t&&(a.minHeight=(0,_dom.toCssUnit)(t)),a}),U={computeRadioOpts:B,computeCheckboxOpts:j,computeNodeOpts:v},p={xID:t,props:O,context:e,internalData:s,reactData:R,getRefMaps:()=>E,getComputeMaps:()=>U},z=e=>{var t=h.value,e=_xeUtils.default.get(e,t);return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)};const a=e=>{var t=R["selectRadioKey"];return t===e};const A=e=>{var t=R["selectCheckboxMaps"];return!!t[e]};const D=e=>{var t=R["indeterminateCheckboxMaps"];return!!t[e]};const I=e=>{n("update:checkNodeKeys",e)},$=e=>{n("update:checkNodeKey",e)};const l=(e,t)=>{const a=Object.assign({},R.selectCheckboxMaps);e.forEach(e=>{t?a[e]=!0:a[e]&&delete a[e]}),R.selectCheckboxMaps=a},o=e=>{const t={};e&&e.forEach(e=>{t[e]=!0}),R.selectCheckboxMaps=t},d=(e,t,a)=>{t?a[e]||(a[e]=!0):a[e]&&delete a[e]},S=(e,t,a)=>{n(e,(0,_ui.createEvent)(a,{$tree:p},t))},g={dispatchEvent:S,clearCurrentNode(){return(R.currentNode=null,_vue.nextTick)()},getCurrentNodeId(){var e=R["currentNode"];return e?z(e):null},getCurrentNode(){var{currentNode:e,nodeMaps:t}=R;if(e){t=t[z(e)];if(t)return t.item}return null},setCurrentNodeId(e){var t=R["nodeMaps"],t=t[e];return R.currentNode=t?t.item:null,(0,_vue.nextTick)()},setCurrentNode(e){return R.currentNode=e,(0,_vue.nextTick)()},clearRadioNode(){return(R.selectRadioKey=null,_vue.nextTick)()},getRadioNodeId(){return R.selectRadioKey||null},getRadioNode(){var{selectRadioKey:e,nodeMaps:t}=R;if(e){t=t[e];if(t)return t.item}return null},setRadioNodeId(e){return R.selectRadioKey=e,(0,_vue.nextTick)()},setRadioNode:e=>(e&&(R.selectRadioKey=z(e)),(0,_vue.nextTick)()),setCheckboxNode:(e,t)=>(e&&(_xeUtils.default.isArray(e)||(e=[e]),l(e.map(e=>z(e)),t)),(0,_vue.nextTick)()),setCheckboxByNodeId:(e,t)=>(e&&(_xeUtils.default.isArray(e)||(e=[e]),l(e,t)),(0,_vue.nextTick)()),getCheckboxNodeIds(){var e=R["selectCheckboxMaps"];return Object.keys(e)},getCheckboxNodes(){const{nodeMaps:a,selectCheckboxMaps:e}=R,n=[];return _xeUtils.default.each(e,(e,t)=>{t=a[t];t&&n.push(t.item)}),n},clearCheckboxNode(){return R.selectCheckboxMaps={},(0,_vue.nextTick)()},setAllCheckboxNode(e){const t={};var a=K.value;return e&&_xeUtils.default.eachTree(R.treeList,e=>{e=z(e);t[e]=!0},{children:a}),R.selectCheckboxMaps=t,(0,_vue.nextTick)()},clearExpandNode(){return g.clearAllExpandNode()},clearAllExpandNode(){return _xeUtils.default.each(R.nodeMaps,e=>{e.treeLoaded=!1}),R.treeExpandedMaps={},(0,_vue.nextTick)()},setExpandByNodeId(e,t){const a=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{d(e,t,a)}),R.treeExpandedMaps=a),(0,_vue.nextTick)()},getExpandNodeIds(){var e=R["treeExpandedMaps"];return Object.keys(e)},getExpandNodes(){const{nodeMaps:a,treeExpandedMaps:e}=R,n=[];return _xeUtils.default.each(e,(e,t)=>{t=a[t];t&&n.push(t.item)}),n},setExpandNode(e,t){const a=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{e=z(e);d(e,t,a)}),R.treeExpandedMaps=a),(0,_vue.nextTick)()},toggleExpandByNodeId(e){const t=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{d(e,!t[e],t)}),R.treeExpandedMaps=t),(0,_vue.nextTick)()},toggleExpandNode(e){const t=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{e=z(e);d(e,!t[e],t)}),R.treeExpandedMaps=t),(0,_vue.nextTick)()},setAllExpandNode(e){const a={},n=K.value;return e&&_xeUtils.default.eachTree(R.treeList,e=>{var t=_xeUtils.default.get(e,n);t&&t.length&&(t=z(e),a[t]=!0)},{children:n}),R.treeExpandedMaps=a,(0,_vue.nextTick)()},reloadExpandNode(e){var t=O["lazy"];return t?(g.clearExpandLoaded(e),_(e)):(0,_vue.nextTick)()},clearExpandLoaded(e){var t=O["lazy"],a=R["nodeMaps"];return t&&(t=a[z(e)])&&(t.treeLoaded=!1),(0,_vue.nextTick)()},loadChildrenNode(r,e){const{lazy:t,transform:a}=O,i=R["nodeMaps"];if(!t)return Promise.resolve([]);const n=K.value,l=i[z(r)],s=l?l.level:0,c=l?l.nodes:[];return(e=>{const a=h.value;return Promise.resolve(e.map(e=>{var t,e=Object.assign({},e);return z(e)||(t=getNodeUniqueId(),_xeUtils.default.set(e,a,t)),e}))})(e).then(e=>(_xeUtils.default.eachTree(e,(e,t,a,n,o,d)=>{e=z(e);i[e]={item:r,itemIndex:-1,items:a,parent:o||l.item,nodes:c.concat(d),level:s+d.length,lineCount:0,treeLoaded:!1}},{children:n}),r[n]=e,a&&(r[n]=e),x(r),e))},isExpandByNode:e=>{var t=R["treeExpandedMaps"];return!!t[z(e)]},isCheckedByRadioNodeId:a,isCheckedByRadioNode:e=>a(z(e)),isCheckedByCheckboxNodeId:A,isIndeterminateByCheckboxNode:e=>D(z(e)),isCheckedByCheckboxNode:e=>A(z(e))},r=e=>{var{expandAll:t,transform:a}=O,n=s["initialized"],o=u.value,d=N.value,r=K.value;R.treeList=a?_xeUtils.default.toArrayTree(e,{key:o,parentKey:d,mapChildren:r}):e?e.slice(0):[];{a=R.treeList;const i=h.value,l=(o=K.value,{});_xeUtils.default.eachTree(a,(e,t,a,n,o,d)=>{let r=z(e);r||(r=getNodeUniqueId(),_xeUtils.default.set(e,i,r)),l[r]={item:e,itemIndex:t,items:a,parent:o,nodes:d,level:d.length,lineCount:0,treeLoaded:!1}},{children:o}),R.nodeMaps=l}t&&!n&&e&&e.length&&(s.initialized=!0,p.setAllExpandNode(!0))},i=(e,n,o)=>{var t=R["treeExpandedMaps"],a=K.value,d=z(e);o.lineCount++,t[d]&&_xeUtils.default.arrayEach(e[a],(e,t,a)=>{(!n||t<a.length-1)&&i(e,!1,o)})},x=e=>{const a=R["nodeMaps"];e&&(e=z(e),e=a[e])&&_xeUtils.default.lastArrayEach(e.nodes,e=>{var t=z(e),t=a[t];t&&(t.lineCount=0,i(e,!0,t))})},X=(e,t)=>{var{showRadio:a,showCheckbox:n,trigger:o}=O,d=B.value,r=j.value;let i=!1,l=!1,s=!1,c=!1;m.value?(i=!0,((e,t)=>{e.preventDefault();const a=v.value,{currentMethod:n,trigger:o}=a,d=K.value,r=_xeUtils.default.get(t,d),i=r&&r.length;let l=!!n;if(o==="child"){if(i)return}else if(o==="parent")if(!i)return;if(n)l=!n({node:t});var s;l||(s=!0,R.currentNode=t,S("current-change",{node:t,checked:!0},e))})(e,t)):R.currentNode&&(R.currentNode=null),"node"===o&&(c=!0,F(e,t)),a&&"node"===d.trigger&&(l=!0,H(e,t)),n&&"node"===r.trigger&&(s=!0,q(e,t)),S("node-click",{node:t,triggerCurrent:i,triggerRadio:l,triggerCheckbox:s,triggerExpand:c},e)},_=d=>{var e=j.value;const r=O["loadMethod"],i=e["checkStrictly"];return new Promise(e=>{if(r){var t=Object.assign({},R.treeExpandLazyLoadedMaps),a=R["nodeMaps"];const n=z(d),o=a[n];t[n]=!0,R.treeExpandLazyLoadedMaps=t,Promise.resolve(r({$tree:p,node:d})).then(a=>{var e=R["treeExpandLazyLoadedMaps"];if(o.treeLoaded=!0,e[n]&&(e[n]=!1),a=_xeUtils.default.isArray(a)?a:[])return g.loadChildrenNode(d,a).then(e=>{var t=Object.assign({},R.treeExpandedMaps);return e.length&&!t[n]&&(t[n]=!0),R.treeExpandedMaps=t,!i&&g.isCheckedByCheckboxNodeId(n)&&l(e.map(e=>z(e)),!0),x(d),S("load-success",{node:d,data:a},new Event("load-success")),(0,_vue.nextTick)()});x(d),S("load-success",{node:d,data:a},new Event("load-success"))}).catch(e=>{var t=R["treeExpandLazyLoadedMaps"];o.treeLoaded=!1,t[n]&&(t[n]=!1),x(d),S("load-error",{node:d,data:e},new Event("load-error"))}).finally(()=>(0,_vue.nextTick)())}else e()})},G=(e,t)=>{const{lazy:n,accordion:a,toggleMethod:o}=O,{nodeMaps:d,treeExpandLazyLoadedMaps:r}=R,i=Object.assign({},R.treeExpandedMaps),l=K.value,s=T.value,c=[];let u=o?e.filter(e=>o({$tree:p,expanded:t,node:e})):e;a&&(u=u.length?[u[u.length-1]]:[],e=z(u[0]),e=d[e])&&e.items.forEach(e=>{e=z(e);i[e]&&delete i[e]});const h=[];return t?u.forEach(e=>{var t,a=z(e);i[a]||(t=d[a],n&&e[s]&&!t.treeLoaded&&!r[a]?c.push(_(e)):e[l]&&e[l].length&&(i[a]=!0,h.push(e)))}):u.forEach(e=>{var t=z(e);i[t]&&(delete i[t],h.push(e))}),R.treeExpandedMaps=i,h.forEach(x),Promise.all(c)},F=(e,t)=>{var a=O["lazy"],{treeExpandedMaps:n,treeExpandLazyLoadedMaps:o}=R,d=z(t),n=!n[d];e.stopPropagation(),a&&o[d]||G([t],n)},f=(e,o,d)=>{var t=K.value,t=_xeUtils.default.get(e,t),e=z(e);if(t&&t.length){let a=!1,n=0;t.forEach(e=>{var e=z(e),t=o[e];(t||d[e])&&(t&&n++,a=!0)}),n===t.length?(o[e]||(o[e]=!0),d[e]&&delete d[e]):(o[e]&&delete o[e],d[e]=a)}else d[e]&&delete d[e]},J=()=>{var e=R["treeList"];const l=K.value;var t=j.value["checkStrictly"];if(!t){const s=Object.assign({},R.selectCheckboxMaps),c={};_xeUtils.default.eachTree(e,(e,t,a,n,o,d)=>{var r=_xeUtils.default.get(e,l);if(r&&r.length||f(e,s,c),t===a.length-1)for(let e=d.length-2;0<=e;e--){var i=d[e];f(i,s,c)}}),R.selectCheckboxMaps=s,R.indeterminateCheckboxMaps=c}},q=(e,a)=>{e.preventDefault(),e.stopPropagation();var{checkStrictly:n,checkMethod:o}=j.value;let t=!!o;if(!(t=o?!o({node:a}):t)){const r=Object.assign({},R.selectCheckboxMaps);var o=K.value,d=z(a);let t=!1;r[d]?delete r[d]:(t=!0,r[d]=t),n||_xeUtils.default.eachTree(_xeUtils.default.get(a,o),e=>{e=z(e);t?r[e]||(r[e]=!0):r[e]&&delete r[e]},{children:o}),R.selectCheckboxMaps=r,J();d=Object.keys(R.selectCheckboxMaps);I(d),S("checkbox-change",{node:a,value:d,checked:t},e)}},H=(e,t)=>{e.preventDefault(),e.stopPropagation();var a=B.value["checkMethod"];let n=!!a;(n=a?!a({node:t}):n)||(a=z(t),R.selectRadioKey=a,$(a),S("radio-change",{node:t,value:a,checked:!0},e))};Object.assign(p,g,{});const V=a=>{var{lazy:e,showRadio:t,showCheckbox:n,showLine:o,indent:d,iconOpen:r,iconClose:i,iconLoaded:l,showIcon:s}=O,{nodeMaps:c,treeExpandedMaps:u,currentNode:h,selectRadioKey:v,treeExpandLazyLoadedMaps:p}=R,g=K.value,x=P.value,_=T.value,g=_xeUtils.default.get(a,g),f=g&&g.length,C=w.icon,k=w.title,y=w.extra,E=z(a),N=u[E],c=c[E],x=_xeUtils.default.get(a,x);const m=[];f&&u[E]&&(o&&m.push((0,_vue.h)("div",{key:"line",class:"vxe-tree--node-child-line",style:{height:`calc(${c.lineCount} * var(--vxe-ui-tree-node-height) - var(--vxe-ui-tree-node-height) / 2)`,left:(c.level+1)*(d||1)+"px"}})),g.forEach(e=>{m.push(V(e))}));let b=!1,M=(t&&(b=E==v),!1),L=(n&&(M=A(E)),!1),U=!1,I=!1;return e&&(U=!!p[E],L=a[_],I=!!c.treeLoaded),(0,_vue.h)("div",{class:["vxe-tree--node-wrapper","node--level-"+c.level],nodeid:E},[(0,_vue.h)("div",{class:["vxe-tree--node-item",{"is--current":h&&E===z(h),"is-radio--checked":b,"is-checkbox--checked":M}],style:{paddingLeft:(c.level-1)*(d||1)+"px"},onClick(e){X(e,a)},onDblclick(e){var t;e=e,t=a,S("node-dblclick",{node:t},e)}},[s||o?(0,_vue.h)("div",{class:"vxe-tree--node-item-switcher"},s&&(!e||I?f:L)?[(0,_vue.h)("div",{class:"vxe-tree--node-item-icon",onClick(e){F(e,a)}},C?C({node:a,isExpand:N}):[(0,_vue.h)("i",{class:U?l||(0,_ui.getIcon)().TREE_NODE_LOADED:N?r||(0,_ui.getIcon)().TREE_NODE_OPEN:i||(0,_ui.getIcon)().TREE_NODE_CLOSE})])]:[]):(0,_vue.createCommentVNode)(),((t,e)=>{var a=O["showRadio"],{showIcon:n,checkMethod:o,visibleMethod:d}=B.value,d=!d||d({node:t});let r=!!o;return a&&n&&d?(o&&(r=!o({node:t})),(0,_vue.h)("div",{class:["vxe-tree--radio-option",{"is--checked":e,"is--disabled":r}],onClick:e=>{r||H(e,t)}},[(0,_vue.h)("span",{class:["vxe-radio--icon",e?(0,_ui.getIcon)().RADIO_CHECKED:(0,_ui.getIcon)().RADIO_UNCHECKED]})])):(0,_vue.createCommentVNode)()})(a,b),((t,e,a)=>{var n=O["showCheckbox"],{showIcon:o,checkMethod:d,visibleMethod:r}=j.value,e=D(e),r=!r||r({node:t});let i=!!d;return n&&o&&r?(d&&(i=!d({node:t})),(0,_vue.h)("div",{class:["vxe-tree--checkbox-option",{"is--checked":a,"is--indeterminate":e,"is--disabled":i}],onClick:e=>{i||q(e,t)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",e?(0,_ui.getIcon)().CHECKBOX_INDETERMINATE:a?(0,_ui.getIcon)().CHECKBOX_CHECKED:(0,_ui.getIcon)().CHECKBOX_UNCHECKED]})])):(0,_vue.createCommentVNode)()})(a,E,M),(0,_vue.h)("div",{class:"vxe-tree--node-item-inner"},[(0,_vue.h)("div",{class:"vxe-tree--node-item-title"},k?(0,_vn.getSlotVNs)(k({node:a,isExpand:N})):""+x),y?(0,_vue.h)("div",{class:"vxe-tree--node-item-extra"},(0,_vn.getSlotVNs)(y({node:a,isExpand:N}))):(0,_vue.createCommentVNode)()])]),f&&u[E]?(0,_vue.h)("div",{class:"vxe-tree--node-child-wrapper"},m):(0,_vue.createCommentVNode)()])};const C=(0,_vue.ref)(0),k=((0,_vue.watch)(()=>O.data?O.data.length:0,()=>{C.value++}),(0,_vue.watch)(()=>O.data,()=>{C.value++}),(0,_vue.watch)(C,()=>{r(O.data||[])}),(0,_vue.watch)(()=>O.checkNodeKey,e=>{R.selectRadioKey=e}),(0,_vue.ref)(0));return(0,_vue.watch)(()=>O.checkNodeKeys?O.checkNodeKeys.length:0,()=>{k.value++}),(0,_vue.watch)(()=>O.checkNodeKeys,()=>{k.value++}),(0,_vue.watch)(k,()=>{o(O.checkNodeKeys||[])}),(0,_vue.onUnmounted)(()=>{R.treeList=[],R.treeExpandedMaps={},R.nodeMaps={}}),r(O.data||[]),o(O.checkNodeKeys||[]),p.renderVN=()=>{var{loading:e,trigger:t,showLine:a}=O,n=y.value,o=B.value,d=j.value,r=L.value,i=M.value,l=b.value;const s=w.loading;return(0,_vue.h)("div",{ref:c,class:["vxe-tree",{["size--"+n]:n,"show--line":a,"checkbox--highlight":d.highlight,"radio--highlight":o.highlight,"node--hover":l,"node--trigger":"node"===t,"is--loading":e}],style:r},[(n=R.treeList,(0,_vue.h)("div",{class:"vxe-tree--node-list-wrapper"},n.map(e=>V(e)))),(0,_vue.h)(_loading.default,{class:"vxe-tree--loading",modelValue:e,icon:i.icon,text:i.text},s?{default:()=>s({$tree:p})}:{})])},p},render(){return this.renderVN()}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_ui=require("../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_loading=_interopRequireDefault(require("../../loading/src/loading"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getNodeUniqueId(){return _xeUtils.default.uniqueId("node_")}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeTree",props:{data:Array,height:[String,Number],minHeight:{type:[String,Number],default:()=>(0,_ui.getConfig)().tree.minHeight},loading:Boolean,loadingConfig:Object,accordion:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.accordion},childrenField:{type:String,default:()=>(0,_ui.getConfig)().tree.childrenField},valueField:{type:String,default:()=>(0,_ui.getConfig)().tree.valueField},keyField:{type:String,default:()=>(0,_ui.getConfig)().tree.keyField},parentField:{type:String,default:()=>(0,_ui.getConfig)().tree.parentField},titleField:{type:String,default:()=>(0,_ui.getConfig)().tree.titleField},hasChildField:{type:String,default:()=>(0,_ui.getConfig)().tree.hasChildField},transform:Boolean,isCurrent:Boolean,isHover:Boolean,expandAll:Boolean,showLine:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showLine},trigger:String,indent:{type:Number,default:()=>(0,_ui.getConfig)().tree.indent},showRadio:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showRadio},checkNodeKey:{type:[String,Number],default:()=>(0,_ui.getConfig)().tree.checkNodeKey},radioConfig:Object,showCheckbox:{type:Boolean,default:()=>(0,_ui.getConfig)().tree.showCheckbox},checkNodeKeys:{type:Array,default:()=>(0,_ui.getConfig)().tree.checkNodeKeys},checkboxConfig:Object,nodeConfig:Object,lazy:Boolean,toggleMethod:Function,loadMethod:Function,showIcon:{type:Boolean,default:!0},iconOpen:{type:String,default:()=>(0,_ui.getConfig)().tree.iconOpen},iconClose:{type:String,default:()=>(0,_ui.getConfig)().tree.iconClose},iconLoaded:{type:String,default:()=>(0,_ui.getConfig)().tree.iconLoaded},size:{type:String,default:()=>(0,_ui.getConfig)().tree.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","update:checkNodeKey","update:checkNodeKeys","node-click","node-dblclick","current-change","radio-change","checkbox-change","load-success","load-error"],setup(O,e){const{emit:n,slots:w}=e;var t=_xeUtils.default.uniqueId();const y=(0,_ui.useSize)(O)["computeSize"],c=(0,_vue.ref)(),R=(0,_vue.reactive)({currentNode:null,nodeMaps:{},selectRadioKey:O.checkNodeKey,treeList:[],treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},indeterminateCheckboxMaps:{}}),s={},E={refElem:c},P=(0,_vue.computed)(()=>O.titleField||"title"),u=(0,_vue.computed)(()=>O.keyField||"id"),h=(0,_vue.computed)(()=>{var e=u.value;return O.valueField||e}),N=(0,_vue.computed)(()=>O.parentField||"parentId"),T=(0,_vue.computed)(()=>O.childrenField||"children"),K=(0,_vue.computed)(()=>O.hasChildField||"hasChild"),m=(0,_vue.computed)(()=>{var e=v.value["isCurrent"];return _xeUtils.default.isBoolean(e)?e:O.isCurrent}),b=(0,_vue.computed)(()=>{var e=v.value["isHover"];return _xeUtils.default.isBoolean(e)?e:O.isHover}),B=(0,_vue.computed)(()=>Object.assign({showIcon:!0},(0,_ui.getConfig)().tree.radioConfig,O.radioConfig)),j=(0,_vue.computed)(()=>Object.assign({showIcon:!0},(0,_ui.getConfig)().tree.checkboxConfig,O.checkboxConfig)),v=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tree.nodeConfig,O.nodeConfig)),M=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tree.loadingConfig,O.loadingConfig)),L=(0,_vue.computed)(()=>{var{height:e,minHeight:t}=O,a={};return e&&(a.height=(0,_dom.toCssUnit)(e)),t&&(a.minHeight=(0,_dom.toCssUnit)(t)),a}),U={computeRadioOpts:B,computeCheckboxOpts:j,computeNodeOpts:v},p={xID:t,props:O,context:e,internalData:s,reactData:R,getRefMaps:()=>E,getComputeMaps:()=>U},z=e=>{var t=h.value,e=_xeUtils.default.get(e,t);return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)};const a=e=>{var t=R["selectRadioKey"];return t===e};const A=e=>{var t=R["selectCheckboxMaps"];return!!t[e]};const D=e=>{var t=R["indeterminateCheckboxMaps"];return!!t[e]};const I=e=>{n("update:checkNodeKeys",e)},$=e=>{n("update:checkNodeKey",e)};const l=(e,t)=>{const a=Object.assign({},R.selectCheckboxMaps);e.forEach(e=>{t?a[e]=!0:a[e]&&delete a[e]}),R.selectCheckboxMaps=a},o=e=>{const t={};e&&e.forEach(e=>{t[e]=!0}),R.selectCheckboxMaps=t},d=(e,t,a)=>{t?a[e]||(a[e]=!0):a[e]&&delete a[e]},S=(e,t,a)=>{n(e,(0,_ui.createEvent)(a,{$tree:p},t))},g={dispatchEvent:S,clearCurrentNode(){return(R.currentNode=null,_vue.nextTick)()},getCurrentNodeId(){var e=R["currentNode"];return e?z(e):null},getCurrentNode(){var{currentNode:e,nodeMaps:t}=R;if(e){t=t[z(e)];if(t)return t.item}return null},setCurrentNodeId(e){var t=R["nodeMaps"],t=t[e];return R.currentNode=t?t.item:null,(0,_vue.nextTick)()},setCurrentNode(e){return R.currentNode=e,(0,_vue.nextTick)()},clearRadioNode(){return(R.selectRadioKey=null,_vue.nextTick)()},getRadioNodeId(){return R.selectRadioKey||null},getRadioNode(){var{selectRadioKey:e,nodeMaps:t}=R;if(e){t=t[e];if(t)return t.item}return null},setRadioNodeId(e){return R.selectRadioKey=e,(0,_vue.nextTick)()},setRadioNode:e=>(e&&(R.selectRadioKey=z(e)),(0,_vue.nextTick)()),setCheckboxNode:(e,t)=>(e&&(_xeUtils.default.isArray(e)||(e=[e]),l(e.map(e=>z(e)),t)),(0,_vue.nextTick)()),setCheckboxByNodeId:(e,t)=>(e&&(_xeUtils.default.isArray(e)||(e=[e]),l(e,t)),(0,_vue.nextTick)()),getCheckboxNodeIds(){var e=R["selectCheckboxMaps"];return Object.keys(e)},getCheckboxNodes(){const{nodeMaps:a,selectCheckboxMaps:e}=R,n=[];return _xeUtils.default.each(e,(e,t)=>{t=a[t];t&&n.push(t.item)}),n},clearCheckboxNode(){return R.selectCheckboxMaps={},(0,_vue.nextTick)()},setAllCheckboxNode(e){const t={};var a=T.value;return e&&_xeUtils.default.eachTree(R.treeList,e=>{e=z(e);t[e]=!0},{children:a}),R.selectCheckboxMaps=t,(0,_vue.nextTick)()},clearExpandNode(){return g.clearAllExpandNode()},clearAllExpandNode(){return _xeUtils.default.each(R.nodeMaps,e=>{e.treeLoaded=!1}),R.treeExpandedMaps={},(0,_vue.nextTick)()},setExpandByNodeId(e,t){const a=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{d(e,t,a)}),R.treeExpandedMaps=a),(0,_vue.nextTick)()},getExpandNodeIds(){var e=R["treeExpandedMaps"];return Object.keys(e)},getExpandNodes(){const{nodeMaps:a,treeExpandedMaps:e}=R,n=[];return _xeUtils.default.each(e,(e,t)=>{t=a[t];t&&n.push(t.item)}),n},setExpandNode(e,t){const a=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{e=z(e);d(e,t,a)}),R.treeExpandedMaps=a),(0,_vue.nextTick)()},toggleExpandByNodeId(e){const t=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{d(e,!t[e],t)}),R.treeExpandedMaps=t),(0,_vue.nextTick)()},toggleExpandNode(e){const t=Object.assign({},R.treeExpandedMaps);return e&&((e=_xeUtils.default.isArray(e)?e:[e]).forEach(e=>{e=z(e);d(e,!t[e],t)}),R.treeExpandedMaps=t),(0,_vue.nextTick)()},setAllExpandNode(e){const a={},n=T.value;return e&&_xeUtils.default.eachTree(R.treeList,e=>{var t=_xeUtils.default.get(e,n);t&&t.length&&(t=z(e),a[t]=!0)},{children:n}),R.treeExpandedMaps=a,(0,_vue.nextTick)()},reloadExpandNode(e){var t=O["lazy"];return t?(g.clearExpandLoaded(e),_(e)):(0,_vue.nextTick)()},clearExpandLoaded(e){var t=O["lazy"],a=R["nodeMaps"];return t&&(t=a[z(e)])&&(t.treeLoaded=!1),(0,_vue.nextTick)()},loadChildrenNode(r,e){const{lazy:t,transform:a}=O,i=R["nodeMaps"];if(!t)return Promise.resolve([]);const n=T.value,l=i[z(r)],s=l?l.level:0,c=l?l.nodes:[];return(e=>{const a=h.value;return Promise.resolve(e.map(e=>{var t,e=Object.assign({},e);return z(e)||(t=getNodeUniqueId(),_xeUtils.default.set(e,a,t)),e}))})(e).then(e=>(_xeUtils.default.eachTree(e,(e,t,a,n,o,d)=>{e=z(e);i[e]={item:r,itemIndex:-1,items:a,parent:o||l.item,nodes:c.concat(d),level:s+d.length,lineCount:0,treeLoaded:!1}},{children:n}),r[n]=e,a&&(r[n]=e),x(r),e))},isExpandByNode:e=>{var t=R["treeExpandedMaps"];return!!t[z(e)]},isCheckedByRadioNodeId:a,isCheckedByRadioNode:e=>a(z(e)),isCheckedByCheckboxNodeId:A,isIndeterminateByCheckboxNode:e=>D(z(e)),isCheckedByCheckboxNode:e=>A(z(e)),getCheckboxIndeterminateNodes(){const{treeList:e,indeterminateCheckboxMaps:t}=R,a=[];return _xeUtils.default.eachTree(e,e=>{t[z(e)]&&a.push(e)}),a}},r=e=>{var{expandAll:t,transform:a}=O,n=s["initialized"],o=u.value,d=N.value,r=T.value;R.treeList=a?_xeUtils.default.toArrayTree(e,{key:o,parentKey:d,mapChildren:r}):e?e.slice(0):[];{a=R.treeList;const i=h.value,l=(o=T.value,{});_xeUtils.default.eachTree(a,(e,t,a,n,o,d)=>{let r=z(e);r||(r=getNodeUniqueId(),_xeUtils.default.set(e,i,r)),l[r]={item:e,itemIndex:t,items:a,parent:o,nodes:d,level:d.length,lineCount:0,treeLoaded:!1}},{children:o}),R.nodeMaps=l}t&&!n&&e&&e.length&&(s.initialized=!0,p.setAllExpandNode(!0))},i=(e,n,o)=>{var t=R["treeExpandedMaps"],a=T.value,d=z(e);o.lineCount++,t[d]&&_xeUtils.default.arrayEach(e[a],(e,t,a)=>{(!n||t<a.length-1)&&i(e,!1,o)})},x=e=>{const a=R["nodeMaps"];e&&(e=z(e),e=a[e])&&_xeUtils.default.lastArrayEach(e.nodes,e=>{var t=z(e),t=a[t];t&&(t.lineCount=0,i(e,!0,t))})},X=(e,t)=>{var{showRadio:a,showCheckbox:n,trigger:o}=O,d=B.value,r=j.value;let i=!1,l=!1,s=!1,c=!1;m.value?(i=!0,((e,t)=>{e.preventDefault();const a=v.value,{currentMethod:n,trigger:o}=a,d=T.value,r=_xeUtils.default.get(t,d),i=r&&r.length;let l=!!n;if(o==="child"){if(i)return}else if(o==="parent")if(!i)return;if(n)l=!n({node:t});var s;l||(s=!0,R.currentNode=t,S("current-change",{node:t,checked:!0},e))})(e,t)):R.currentNode&&(R.currentNode=null),"node"===o&&(c=!0,F(e,t)),a&&"node"===d.trigger&&(l=!0,H(e,t)),n&&"node"===r.trigger&&(s=!0,q(e,t)),S("node-click",{node:t,triggerCurrent:i,triggerRadio:l,triggerCheckbox:s,triggerExpand:c},e)},_=d=>{var e=j.value;const r=O["loadMethod"],i=e["checkStrictly"];return new Promise(e=>{if(r){var t=Object.assign({},R.treeExpandLazyLoadedMaps),a=R["nodeMaps"];const n=z(d),o=a[n];t[n]=!0,R.treeExpandLazyLoadedMaps=t,Promise.resolve(r({$tree:p,node:d})).then(a=>{var e=R["treeExpandLazyLoadedMaps"];if(o.treeLoaded=!0,e[n]&&(e[n]=!1),a=_xeUtils.default.isArray(a)?a:[])return g.loadChildrenNode(d,a).then(e=>{var t=Object.assign({},R.treeExpandedMaps);return e.length&&!t[n]&&(t[n]=!0),R.treeExpandedMaps=t,!i&&g.isCheckedByCheckboxNodeId(n)&&l(e.map(e=>z(e)),!0),x(d),S("load-success",{node:d,data:a},new Event("load-success")),(0,_vue.nextTick)()});x(d),S("load-success",{node:d,data:a},new Event("load-success"))}).catch(e=>{var t=R["treeExpandLazyLoadedMaps"];o.treeLoaded=!1,t[n]&&(t[n]=!1),x(d),S("load-error",{node:d,data:e},new Event("load-error"))}).finally(()=>(0,_vue.nextTick)())}else e()})},G=(e,t)=>{const{lazy:n,accordion:a,toggleMethod:o}=O,{nodeMaps:d,treeExpandLazyLoadedMaps:r}=R,i=Object.assign({},R.treeExpandedMaps),l=T.value,s=K.value,c=[];let u=o?e.filter(e=>o({$tree:p,expanded:t,node:e})):e;a&&(u=u.length?[u[u.length-1]]:[],e=z(u[0]),e=d[e])&&e.items.forEach(e=>{e=z(e);i[e]&&delete i[e]});const h=[];return t?u.forEach(e=>{var t,a=z(e);i[a]||(t=d[a],n&&e[s]&&!t.treeLoaded&&!r[a]?c.push(_(e)):e[l]&&e[l].length&&(i[a]=!0,h.push(e)))}):u.forEach(e=>{var t=z(e);i[t]&&(delete i[t],h.push(e))}),R.treeExpandedMaps=i,h.forEach(x),Promise.all(c)},F=(e,t)=>{var a=O["lazy"],{treeExpandedMaps:n,treeExpandLazyLoadedMaps:o}=R,d=z(t),n=!n[d];e.stopPropagation(),a&&o[d]||G([t],n)},f=(e,o,d)=>{var t=T.value,t=_xeUtils.default.get(e,t),e=z(e);if(t&&t.length){let a=!1,n=0;t.forEach(e=>{var e=z(e),t=o[e];(t||d[e])&&(t&&n++,a=!0)}),n===t.length?(o[e]||(o[e]=!0),d[e]&&delete d[e]):(o[e]&&delete o[e],d[e]=a)}else d[e]&&delete d[e]},J=()=>{var e=R["treeList"];const l=T.value;var t=j.value["checkStrictly"];if(!t){const s=Object.assign({},R.selectCheckboxMaps),c={};_xeUtils.default.eachTree(e,(e,t,a,n,o,d)=>{var r=_xeUtils.default.get(e,l);if(r&&r.length||f(e,s,c),t===a.length-1)for(let e=d.length-2;0<=e;e--){var i=d[e];f(i,s,c)}}),R.selectCheckboxMaps=s,R.indeterminateCheckboxMaps=c}},q=(e,a)=>{e.preventDefault(),e.stopPropagation();var{checkStrictly:n,checkMethod:o}=j.value;let t=!!o;if(!(t=o?!o({node:a}):t)){const r=Object.assign({},R.selectCheckboxMaps);var o=T.value,d=z(a);let t=!1;r[d]?delete r[d]:(t=!0,r[d]=t),n||_xeUtils.default.eachTree(_xeUtils.default.get(a,o),e=>{e=z(e);t?r[e]||(r[e]=!0):r[e]&&delete r[e]},{children:o}),R.selectCheckboxMaps=r,J();d=Object.keys(R.selectCheckboxMaps);I(d),S("checkbox-change",{node:a,value:d,checked:t},e)}},H=(e,t)=>{e.preventDefault(),e.stopPropagation();var a=B.value["checkMethod"];let n=!!a;(n=a?!a({node:t}):n)||(a=z(t),R.selectRadioKey=a,$(a),S("radio-change",{node:t,value:a,checked:!0},e))};Object.assign(p,g,{});const V=a=>{var{lazy:e,showRadio:t,showCheckbox:n,showLine:o,indent:d,iconOpen:r,iconClose:i,iconLoaded:l,showIcon:s}=O,{nodeMaps:c,treeExpandedMaps:u,currentNode:h,selectRadioKey:v,treeExpandLazyLoadedMaps:p}=R,g=T.value,x=P.value,_=K.value,g=_xeUtils.default.get(a,g),f=g&&g.length,C=w.icon,k=w.title,y=w.extra,E=z(a),N=u[E],c=c[E],x=_xeUtils.default.get(a,x);const m=[];f&&u[E]&&(o&&m.push((0,_vue.h)("div",{key:"line",class:"vxe-tree--node-child-line",style:{height:`calc(${c.lineCount} * var(--vxe-ui-tree-node-height) - var(--vxe-ui-tree-node-height) / 2)`,left:(c.level+1)*(d||1)+"px"}})),g.forEach(e=>{m.push(V(e))}));let b=!1,M=(t&&(b=E==v),!1),L=(n&&(M=A(E)),!1),U=!1,I=!1;return e&&(U=!!p[E],L=a[_],I=!!c.treeLoaded),(0,_vue.h)("div",{class:["vxe-tree--node-wrapper","node--level-"+c.level],nodeid:E},[(0,_vue.h)("div",{class:["vxe-tree--node-item",{"is--current":h&&E===z(h),"is-radio--checked":b,"is-checkbox--checked":M}],style:{paddingLeft:(c.level-1)*(d||1)+"px"},onClick(e){X(e,a)},onDblclick(e){var t;e=e,t=a,S("node-dblclick",{node:t},e)}},[s||o?(0,_vue.h)("div",{class:"vxe-tree--node-item-switcher"},s&&(!e||I?f:L)?[(0,_vue.h)("div",{class:"vxe-tree--node-item-icon",onClick(e){F(e,a)}},C?C({node:a,isExpand:N}):[(0,_vue.h)("i",{class:U?l||(0,_ui.getIcon)().TREE_NODE_LOADED:N?r||(0,_ui.getIcon)().TREE_NODE_OPEN:i||(0,_ui.getIcon)().TREE_NODE_CLOSE})])]:[]):(0,_vue.createCommentVNode)(),((t,e)=>{var a=O["showRadio"],{showIcon:n,checkMethod:o,visibleMethod:d}=B.value,d=!d||d({node:t});let r=!!o;return a&&n&&d?(o&&(r=!o({node:t})),(0,_vue.h)("div",{class:["vxe-tree--radio-option",{"is--checked":e,"is--disabled":r}],onClick:e=>{r||H(e,t)}},[(0,_vue.h)("span",{class:["vxe-radio--icon",e?(0,_ui.getIcon)().RADIO_CHECKED:(0,_ui.getIcon)().RADIO_UNCHECKED]})])):(0,_vue.createCommentVNode)()})(a,b),((t,e,a)=>{var n=O["showCheckbox"],{showIcon:o,checkMethod:d,visibleMethod:r}=j.value,e=D(e),r=!r||r({node:t});let i=!!d;return n&&o&&r?(d&&(i=!d({node:t})),(0,_vue.h)("div",{class:["vxe-tree--checkbox-option",{"is--checked":a,"is--indeterminate":e,"is--disabled":i}],onClick:e=>{i||q(e,t)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",e?(0,_ui.getIcon)().CHECKBOX_INDETERMINATE:a?(0,_ui.getIcon)().CHECKBOX_CHECKED:(0,_ui.getIcon)().CHECKBOX_UNCHECKED]})])):(0,_vue.createCommentVNode)()})(a,E,M),(0,_vue.h)("div",{class:"vxe-tree--node-item-inner"},[(0,_vue.h)("div",{class:"vxe-tree--node-item-title"},k?(0,_vn.getSlotVNs)(k({node:a,isExpand:N})):""+x),y?(0,_vue.h)("div",{class:"vxe-tree--node-item-extra"},(0,_vn.getSlotVNs)(y({node:a,isExpand:N}))):(0,_vue.createCommentVNode)()])]),f&&u[E]?(0,_vue.h)("div",{class:"vxe-tree--node-child-wrapper"},m):(0,_vue.createCommentVNode)()])};const C=(0,_vue.ref)(0),k=((0,_vue.watch)(()=>O.data?O.data.length:0,()=>{C.value++}),(0,_vue.watch)(()=>O.data,()=>{C.value++}),(0,_vue.watch)(C,()=>{r(O.data||[])}),(0,_vue.watch)(()=>O.checkNodeKey,e=>{R.selectRadioKey=e}),(0,_vue.ref)(0));return(0,_vue.watch)(()=>O.checkNodeKeys?O.checkNodeKeys.length:0,()=>{k.value++}),(0,_vue.watch)(()=>O.checkNodeKeys,()=>{k.value++}),(0,_vue.watch)(k,()=>{o(O.checkNodeKeys||[])}),(0,_vue.onUnmounted)(()=>{R.treeList=[],R.treeExpandedMaps={},R.nodeMaps={}}),r(O.data||[]),o(O.checkNodeKeys||[]),p.renderVN=()=>{var{loading:e,trigger:t,showLine:a}=O,n=y.value,o=B.value,d=j.value,r=L.value,i=M.value,l=b.value;const s=w.loading;return(0,_vue.h)("div",{ref:c,class:["vxe-tree",{["size--"+n]:n,"show--line":a,"checkbox--highlight":d.highlight,"radio--highlight":o.highlight,"node--hover":l,"node--trigger":"node"===t,"is--loading":e}],style:r},[(n=R.treeList,(0,_vue.h)("div",{class:"vxe-tree--node-list-wrapper"},n.map(e=>V(e)))),(0,_vue.h)(_loading.default,{class:"vxe-tree--loading",modelValue:e,icon:i.icon,text:i.text},s?{default:()=>s({$tree:p})}:{})])},p},render(){return this.renderVN()}});
|
package/lib/ui/index.js
CHANGED
|
@@ -26,7 +26,7 @@ Object.keys(_core).forEach(function (key) {
|
|
|
26
26
|
});
|
|
27
27
|
var _dynamics = require("../dynamics");
|
|
28
28
|
var _log = require("./src/log");
|
|
29
|
-
const version = exports.version = "4.5.
|
|
29
|
+
const version = exports.version = "4.5.25";
|
|
30
30
|
_core.VxeUI.uiVersion = version;
|
|
31
31
|
_core.VxeUI.dynamicApp = _dynamics.dynamicApp;
|
|
32
32
|
function config(options) {
|
|
@@ -367,8 +367,10 @@ _core.VxeUI.setup = setup;
|
|
|
367
367
|
showRemoveButton: true,
|
|
368
368
|
showButtonIcon: true,
|
|
369
369
|
showPreview: true,
|
|
370
|
-
dragToUpload: true
|
|
371
|
-
// imageConfig: {}
|
|
370
|
+
dragToUpload: true,
|
|
371
|
+
// imageConfig: {},
|
|
372
|
+
showLimitSize: true,
|
|
373
|
+
showLimitCount: true
|
|
372
374
|
},
|
|
373
375
|
watermark: {
|
|
374
376
|
rotate: -30,
|
package/lib/ui/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={version:!0,config:!0,setup:!0},_core=(exports.config=config,exports.default=void 0,exports.setup=setup,exports.version=void 0,require("@vxe-ui/core")),_dynamics=(Object.keys(_core).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_core[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _core[e]}})}),require("../dynamics")),_log=require("./src/log");const version=exports.version="4.5.23";function config(e){return"development"===process.env.NODE_ENV&&(0,_log.warnLog)("vxe.error.delFunc",["config","setConfig"]),(0,_core.setConfig)(e)}function setup(e){return"development"===process.env.NODE_ENV&&(0,_log.warnLog)("vxe.error.delFunc",["setup","setConfig"]),(0,_core.setConfig)(e)}_core.VxeUI.uiVersion=version,_core.VxeUI.dynamicApp=_dynamics.dynamicApp,_core.VxeUI.config=config,_core.VxeUI.setup=setup,(0,_core.setConfig)({alert:{},anchor:{},anchorLink:{},avatar:{},badge:{},breadcrumb:{separator:"/"},breadcrumbItem:{},button:{trigger:"hover",prefixTooltip:{enterable:!0},suffixTooltip:{enterable:!0}},buttonGroup:{},calendar:{minDate:new Date(1900,0,1),maxDate:new Date(2100,0,1),startDay:1,selectDay:1},card:{border:!0,padding:!0},carousel:{height:200,loop:!0,interval:5e3},carouselItem:{},checkbox:{},checkboxGroup:{},col:{},collapse:{padding:!0,expandConfig:{showIcon:!0}},collapsePane:{},countdown:{},colorPicker:{type:"hex",clearable:!0,showAlpha:!0,clickToCopy:!0,showColorExtractor:!0,showQuick:!0},datePicker:{startDate:new Date(1900,0,1),endDate:new Date(2100,0,1),startDay:1,selectDay:1,shortcutConfig:{align:"left",mode:"text",autoClose:!0}},drawer:{position:"right",showHeader:!0,lockView:!0,mask:!0,showTitleOverflow:!0,showClose:!0,padding:!0,cancelClosable:!0,confirmClosable:!0},empty:{},form:{validConfig:{showMessage:!0,autoPos:!0,theme:"beautify"},tooltipConfig:{enterable:!0},titleAsterisk:!0,titleOverflow:!1,padding:!0},formDesign:{height:400,showHeader:!0,showPc:!0},formGather:{},formGroup:{},formItem:{},formView:{},icon:{},iconPicker:{icons:["home","company","comment","setting","send","envelope","envelope-open","bell","search","print","pc","goods","chart-line","edit","delete","save","folder","microphone","flag","link","location","sunny","rmb","usd","user","add-user","add-users","star","unlock","time","text","feedback","calendar","association-form","cloud-download","cloud-upload","file","subtable","chart-bar-x","chart-bar-y","chart-line","chart-pie","chart-radar"]},image:{showPreview:!0,showPrintButton:!0,maskClosable:!0},imageGroup:{showPreview:!0,showPrintButton:!0},imagePreview:{showPrintButton:!0},input:{startDate:new Date(1900,0,1),endDate:new Date(2100,0,1),startDay:1,selectDay:1,digits:2,controls:!0},layoutAside:{},layoutBody:{},layoutContainer:{},layoutFooter:{},layoutHeader:{},link:{underline:!0},listDesign:{height:400,showPc:!0},listView:{},list:{virtualYConfig:{enabled:!0,gt:100}},loading:{showIcon:!0,showText:!0},modal:{top:16,showHeader:!0,minWidth:340,minHeight:140,lockView:!0,mask:!0,duration:3e3,marginSize:0,dblclickZoom:!0,showTitleOverflow:!0,animat:!0,showClose:!0,padding:!0,draggable:!0,showConfirmButton:null,cancelClosable:!0,confirmClosable:!0,zoomConfig:{minimizeMaxSize:10,minimizeVerticalOffset:{top:-24,left:0},minimizeHorizontalOffset:{top:0,left:32}},storageKey:"VXE_MODAL_POSITION"},noticeBar:{},numberInput:{digits:2,autoFill:!0,controls:!0},optgroup:{},option:{},pager:{pageSizePlacement:"top"},print:{},passwordInput:{controls:!0},printPageBreak:{},pulldown:{destroyOnClose:!0},radio:{strict:!0},radioButton:{strict:!0},radioGroup:{strict:!0},rate:{},result:{},row:{},select:{multiCharOverflow:8,remoteConfig:{enabled:!0,autoLoad:!0},virtualYConfig:{enabled:!0,gt:100,oSize:2}},split:{resize:!0,itemConfig:{minWidth:40,minHeight:40}},splitPane:{},slider:{max:100,min:0},steps:{},switch:{},tabPane:{},tableSelect:{gridConfig:{showOverflow:!0,showHeaderOverflow:!0,showFooterOverflow:!0,rowConfig:{isHover:!0},virtualXConfig:{enabled:!0,gt:0},virtualYConfig:{enabled:!0,gt:0}}},tabs:{},tag:{},textEllipsis:{underline:!0},text:{},textarea:{resize:"none"},tip:{},tooltip:{trigger:"hover",theme:"dark",enterDelay:500,leaveDelay:300,isArrow:!0},tree:{indent:20,minHeight:60,radioConfig:{strict:!0}},treeSelect:{treeConfig:{radioConfig:{},checkboxConfig:{}}},upload:{mode:"all",imageTypes:["jpg","jpeg","png","gif"],showList:!0,showUploadButton:!0,showButtonText:!0,showRemoveButton:!0,showButtonIcon:!0,showPreview:!0,dragToUpload:!0},watermark:{rotate:-30,gap:[100,100]},table:{},colgroup:{},column:{},toolbar:{},grid:{}});const iconPrefix="vxe-icon-";(0,_core.setIcon)({LOADING:iconPrefix+"spinner roll vxe-loading--default-icon",BUTTON_DROPDOWN:iconPrefix+"arrow-down",BUTTON_LOADING:iconPrefix+"spinner roll",BUTTON_TOOLTIP_ICON:iconPrefix+"question-circle-fill",MENU_ITEM_EXPAND_OPEN:iconPrefix+"arrow-down rotate180",MENU_ITEM_EXPAND_CLOSE:iconPrefix+"arrow-down",SELECT_LOADED:iconPrefix+"spinner roll",SELECT_OPEN:iconPrefix+"caret-down rotate180",SELECT_CLOSE:iconPrefix+"caret-down",ADD_OPTION:iconPrefix+"add",ICON_PICKER_OPEN:iconPrefix+"caret-down rotate180",ICON_PICKER_CLOSE:iconPrefix+"caret-down",PAGER_HOME:iconPrefix+"home-page",PAGER_END:iconPrefix+"end-page",PAGER_JUMP_PREV:iconPrefix+"arrow-double-left",PAGER_JUMP_NEXT:iconPrefix+"arrow-double-right",PAGER_PREV_PAGE:iconPrefix+"arrow-left",PAGER_NEXT_PAGE:iconPrefix+"arrow-right",PAGER_JUMP_MORE:iconPrefix+"ellipsis-h",RADIO_CHECKED:iconPrefix+"radio-checked-fill",RADIO_UNCHECKED:iconPrefix+"radio-unchecked",CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",INPUT_CLEAR:iconPrefix+"error-circle-fill",INPUT_SEARCH:iconPrefix+"search",NUMBER_INPUT_PREV_NUM:iconPrefix+"caret-up",NUMBER_INPUT_NEXT_NUM:iconPrefix+"caret-down",DATE_PICKER_DATE:iconPrefix+"calendar",PASSWORD_INPUT_SHOW_PWD:iconPrefix+"eye-fill-close",PASSWORD_INPUT_HIDE_PWD:iconPrefix+"eye-fill",MODAL_ZOOM_MIN:iconPrefix+"minus",MODAL_ZOOM_REVERT:iconPrefix+"recover",MODAL_ZOOM_IN:iconPrefix+"square",MODAL_ZOOM_OUT:iconPrefix+"maximize",MODAL_CLOSE:iconPrefix+"close",MODAL_INFO:iconPrefix+"info-circle-fill",MODAL_SUCCESS:iconPrefix+"success-circle-fill",MODAL_WARNING:iconPrefix+"warning-circle-fill",MODAL_ERROR:iconPrefix+"error-circle-fill",MODAL_QUESTION:iconPrefix+"question-circle-fill",MODAL_LOADING:iconPrefix+"spinner roll",DRAWER_CLOSE:iconPrefix+"close",FORM_PREFIX:iconPrefix+"question-circle-fill",FORM_SUFFIX:iconPrefix+"question-circle-fill",FORM_FOLDING:iconPrefix+"arrow-up rotate180",FORM_UNFOLDING:iconPrefix+"arrow-up",FORM_DESIGN_STYLE_SETTING:iconPrefix+"layout",FORM_DESIGN_PROPS_PC:iconPrefix+"pc",FORM_DESIGN_PROPS_MOBILE:iconPrefix+"mobile",FORM_DESIGN_PROPS_ADD:iconPrefix+"add",FORM_DESIGN_PROPS_EDIT:iconPrefix+"edit",FORM_DESIGN_WIDGET_ADD:iconPrefix+"square-plus-fill",FORM_DESIGN_WIDGET_COPY:iconPrefix+"copy",FORM_DESIGN_WIDGET_DELETE:iconPrefix+"delete",FORM_DESIGN_WIDGET_SWAP_LR:iconPrefix+"swap",FORM_DESIGN_WIDGET_OPTION_DELETE:iconPrefix+"delete",FORM_DESIGN_WIDGET_OPTION_EXPAND_OPEN:iconPrefix+"square-plus",FORM_DESIGN_WIDGET_OPTION_EXPAND_CLOSE:iconPrefix+"square-minus",LIST_DESIGN_FIELD_SETTING:iconPrefix+"custom-column",LIST_DESIGN_LIST_SETTING:iconPrefix+"menu",LIST_DESIGN_LIST_SETTING_SEARCH_DELETE:iconPrefix+"delete",LIST_DESIGN_LIST_SETTING_ACTIVE_DELETE:iconPrefix+"delete",UPLOAD_FILE_ERROR:iconPrefix+"warning-circle-fill",UPLOAD_FILE_ADD:iconPrefix+"upload",UPLOAD_FILE_REMOVE:iconPrefix+"delete",UPLOAD_FILE_DOWNLOAD:iconPrefix+"download",UPLOAD_IMAGE_RE_UPLOAD:iconPrefix+"repeat",UPLOAD_IMAGE_ADD:iconPrefix+"add",UPLOAD_IMAGE_REMOVE:iconPrefix+"close",UPLOAD_LOADING:iconPrefix+"spinner roll vxe-loading--default-icon",UPLOAD_FILE_TYPE_DEFAULT:iconPrefix+"file",UPLOAD_FILE_TYPE_XLSX:iconPrefix+"file-excel",UPLOAD_FILE_TYPE_XLS:iconPrefix+"file-excel",UPLOAD_FILE_TYPE_PDF:iconPrefix+"file-pdf",UPLOAD_FILE_TYPE_PNG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_GIF:iconPrefix+"file-image",UPLOAD_FILE_TYPE_JPG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_JPEG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_MD:iconPrefix+"file-markdown",UPLOAD_FILE_TYPE_PPD:iconPrefix+"file-ppt",UPLOAD_FILE_TYPE_DOCX:iconPrefix+"file-word",UPLOAD_FILE_TYPE_DOC:iconPrefix+"file-word",UPLOAD_FILE_TYPE_ZIP:iconPrefix+"file-zip",UPLOAD_FILE_TYPE_TXT:iconPrefix+"file-txt",IMAGE_PREVIEW_CLOSE:iconPrefix+"close",IMAGE_PREVIEW_PREVIOUS:iconPrefix+"arrow-left",IMAGE_PREVIEW_NEXT:iconPrefix+"arrow-right",IMAGE_PREVIEW_PCT_FULL:iconPrefix+"pct-full",IMAGE_PREVIEW_PCT_1_1:iconPrefix+"pct-1-1",IMAGE_PREVIEW_ZOOM_OUT:iconPrefix+"search-zoom-out",IMAGE_PREVIEW_ZOOM_IN:iconPrefix+"search-zoom-in",IMAGE_PREVIEW_ROTATE_LEFT:iconPrefix+"rotate-left",IMAGE_PREVIEW_ROTATE_RIGHT:iconPrefix+"rotate-right",IMAGE_PREVIEW_PRINT:iconPrefix+"print",IMAGE_PREVIEW_DOWNLOAD:iconPrefix+"download",ALERT_CLOSE:iconPrefix+"close",ALERT_INFO:iconPrefix+"info-circle-fill",ALERT_SUCCESS:iconPrefix+"success-circle-fill",ALERT_WARNING:iconPrefix+"warning-circle-fill",ALERT_ERROR:iconPrefix+"error-circle-fill",TREE_NODE_OPEN:iconPrefix+"caret-right rotate90",TREE_NODE_CLOSE:iconPrefix+"caret-right",TREE_NODE_LOADED:iconPrefix+"spinner roll",TREE_SELECT_LOADED:iconPrefix+"spinner roll",TREE_SELECT_OPEN:iconPrefix+"caret-down rotate180",TREE_SELECT_CLOSE:iconPrefix+"caret-down",TABLE_SELECT_LOADED:iconPrefix+"spinner roll",TABLE_SELECT_OPEN:iconPrefix+"caret-down rotate180",TABLE_SELECT_CLOSE:iconPrefix+"caret-down",TABS_TAB_BUTTON_LEFT:iconPrefix+"arrow-left",TABS_TAB_BUTTON_RIGHT:iconPrefix+"arrow-right",TABS_TAB_CLOSE:iconPrefix+"close",TABS_TAB_REFRESH:iconPrefix+"refresh",TABS_TAB_REFRESH_LOADING:iconPrefix+"refresh roll",TEXT_COPY:iconPrefix+"copy",TEXT_LOADING:iconPrefix+"spinner roll",CAROUSEL_HORIZONTAL_PREVIOUS:iconPrefix+"arrow-left",CAROUSEL_HORIZONTAL_NEXT:iconPrefix+"arrow-right",CAROUSEL_VERTICAL_PREVIOUS:iconPrefix+"arrow-up",CAROUSEL_VERTICAL_NEXT:iconPrefix+"arrow-down",COLLAPSE_OPEN:iconPrefix+"arrow-right rotate90",COLLAPSE_CLOSE:iconPrefix+"arrow-right",EMPTY_DEFAULT:iconPrefix+"empty",RESULT_INFO:iconPrefix+"info-circle-fill",RESULT_SUCCESS:iconPrefix+"success-circle-fill",RESULT_WARNING:iconPrefix+"warning-circle-fill",RESULT_ERROR:iconPrefix+"error-circle-fill",RESULT_QUESTION:iconPrefix+"question-circle-fill",RESULT_LOADING:iconPrefix+"spinner roll",RATE_CHECKED:iconPrefix+"star-fill",RATE_UNCHECKED:iconPrefix+"star",COLOR_COPY:iconPrefix+"copy",EYE_DROPPER:iconPrefix+"dropper",SPLIT_TOP_ACTION:iconPrefix+"arrow-up",SPLIT_BOTTOM_ACTION:iconPrefix+"arrow-down",SPLIT_LEFT_ACTION:iconPrefix+"arrow-left",SPLIT_RIGHT_ACTION:iconPrefix+"arrow-right"});var _default=exports.default=_core.VxeUI;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={version:!0,config:!0,setup:!0},_core=(exports.config=config,exports.default=void 0,exports.setup=setup,exports.version=void 0,require("@vxe-ui/core")),_dynamics=(Object.keys(_core).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_core[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _core[e]}})}),require("../dynamics")),_log=require("./src/log");const version=exports.version="4.5.25";function config(e){return"development"===process.env.NODE_ENV&&(0,_log.warnLog)("vxe.error.delFunc",["config","setConfig"]),(0,_core.setConfig)(e)}function setup(e){return"development"===process.env.NODE_ENV&&(0,_log.warnLog)("vxe.error.delFunc",["setup","setConfig"]),(0,_core.setConfig)(e)}_core.VxeUI.uiVersion=version,_core.VxeUI.dynamicApp=_dynamics.dynamicApp,_core.VxeUI.config=config,_core.VxeUI.setup=setup,(0,_core.setConfig)({alert:{},anchor:{},anchorLink:{},avatar:{},badge:{},breadcrumb:{separator:"/"},breadcrumbItem:{},button:{trigger:"hover",prefixTooltip:{enterable:!0},suffixTooltip:{enterable:!0}},buttonGroup:{},calendar:{minDate:new Date(1900,0,1),maxDate:new Date(2100,0,1),startDay:1,selectDay:1},card:{border:!0,padding:!0},carousel:{height:200,loop:!0,interval:5e3},carouselItem:{},checkbox:{},checkboxGroup:{},col:{},collapse:{padding:!0,expandConfig:{showIcon:!0}},collapsePane:{},countdown:{},colorPicker:{type:"hex",clearable:!0,showAlpha:!0,clickToCopy:!0,showColorExtractor:!0,showQuick:!0},datePicker:{startDate:new Date(1900,0,1),endDate:new Date(2100,0,1),startDay:1,selectDay:1,shortcutConfig:{align:"left",mode:"text",autoClose:!0}},drawer:{position:"right",showHeader:!0,lockView:!0,mask:!0,showTitleOverflow:!0,showClose:!0,padding:!0,cancelClosable:!0,confirmClosable:!0},empty:{},form:{validConfig:{showMessage:!0,autoPos:!0,theme:"beautify"},tooltipConfig:{enterable:!0},titleAsterisk:!0,titleOverflow:!1,padding:!0},formDesign:{height:400,showHeader:!0,showPc:!0},formGather:{},formGroup:{},formItem:{},formView:{},icon:{},iconPicker:{icons:["home","company","comment","setting","send","envelope","envelope-open","bell","search","print","pc","goods","chart-line","edit","delete","save","folder","microphone","flag","link","location","sunny","rmb","usd","user","add-user","add-users","star","unlock","time","text","feedback","calendar","association-form","cloud-download","cloud-upload","file","subtable","chart-bar-x","chart-bar-y","chart-line","chart-pie","chart-radar"]},image:{showPreview:!0,showPrintButton:!0,maskClosable:!0},imageGroup:{showPreview:!0,showPrintButton:!0},imagePreview:{showPrintButton:!0},input:{startDate:new Date(1900,0,1),endDate:new Date(2100,0,1),startDay:1,selectDay:1,digits:2,controls:!0},layoutAside:{},layoutBody:{},layoutContainer:{},layoutFooter:{},layoutHeader:{},link:{underline:!0},listDesign:{height:400,showPc:!0},listView:{},list:{virtualYConfig:{enabled:!0,gt:100}},loading:{showIcon:!0,showText:!0},modal:{top:16,showHeader:!0,minWidth:340,minHeight:140,lockView:!0,mask:!0,duration:3e3,marginSize:0,dblclickZoom:!0,showTitleOverflow:!0,animat:!0,showClose:!0,padding:!0,draggable:!0,showConfirmButton:null,cancelClosable:!0,confirmClosable:!0,zoomConfig:{minimizeMaxSize:10,minimizeVerticalOffset:{top:-24,left:0},minimizeHorizontalOffset:{top:0,left:32}},storageKey:"VXE_MODAL_POSITION"},noticeBar:{},numberInput:{digits:2,autoFill:!0,controls:!0},optgroup:{},option:{},pager:{pageSizePlacement:"top"},print:{},passwordInput:{controls:!0},printPageBreak:{},pulldown:{destroyOnClose:!0},radio:{strict:!0},radioButton:{strict:!0},radioGroup:{strict:!0},rate:{},result:{},row:{},select:{multiCharOverflow:8,remoteConfig:{enabled:!0,autoLoad:!0},virtualYConfig:{enabled:!0,gt:100,oSize:2}},split:{resize:!0,itemConfig:{minWidth:40,minHeight:40}},splitPane:{},slider:{max:100,min:0},steps:{},switch:{},tabPane:{},tableSelect:{gridConfig:{showOverflow:!0,showHeaderOverflow:!0,showFooterOverflow:!0,rowConfig:{isHover:!0},virtualXConfig:{enabled:!0,gt:0},virtualYConfig:{enabled:!0,gt:0}}},tabs:{},tag:{},textEllipsis:{underline:!0},text:{},textarea:{resize:"none"},tip:{},tooltip:{trigger:"hover",theme:"dark",enterDelay:500,leaveDelay:300,isArrow:!0},tree:{indent:20,minHeight:60,radioConfig:{strict:!0}},treeSelect:{treeConfig:{radioConfig:{},checkboxConfig:{}}},upload:{mode:"all",imageTypes:["jpg","jpeg","png","gif"],showList:!0,showUploadButton:!0,showButtonText:!0,showRemoveButton:!0,showButtonIcon:!0,showPreview:!0,dragToUpload:!0,showLimitSize:!0,showLimitCount:!0},watermark:{rotate:-30,gap:[100,100]},table:{},colgroup:{},column:{},toolbar:{},grid:{}});const iconPrefix="vxe-icon-";(0,_core.setIcon)({LOADING:iconPrefix+"spinner roll vxe-loading--default-icon",BUTTON_DROPDOWN:iconPrefix+"arrow-down",BUTTON_LOADING:iconPrefix+"spinner roll",BUTTON_TOOLTIP_ICON:iconPrefix+"question-circle-fill",MENU_ITEM_EXPAND_OPEN:iconPrefix+"arrow-down rotate180",MENU_ITEM_EXPAND_CLOSE:iconPrefix+"arrow-down",SELECT_LOADED:iconPrefix+"spinner roll",SELECT_OPEN:iconPrefix+"caret-down rotate180",SELECT_CLOSE:iconPrefix+"caret-down",ADD_OPTION:iconPrefix+"add",ICON_PICKER_OPEN:iconPrefix+"caret-down rotate180",ICON_PICKER_CLOSE:iconPrefix+"caret-down",PAGER_HOME:iconPrefix+"home-page",PAGER_END:iconPrefix+"end-page",PAGER_JUMP_PREV:iconPrefix+"arrow-double-left",PAGER_JUMP_NEXT:iconPrefix+"arrow-double-right",PAGER_PREV_PAGE:iconPrefix+"arrow-left",PAGER_NEXT_PAGE:iconPrefix+"arrow-right",PAGER_JUMP_MORE:iconPrefix+"ellipsis-h",RADIO_CHECKED:iconPrefix+"radio-checked-fill",RADIO_UNCHECKED:iconPrefix+"radio-unchecked",CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",INPUT_CLEAR:iconPrefix+"error-circle-fill",INPUT_SEARCH:iconPrefix+"search",NUMBER_INPUT_PREV_NUM:iconPrefix+"caret-up",NUMBER_INPUT_NEXT_NUM:iconPrefix+"caret-down",DATE_PICKER_DATE:iconPrefix+"calendar",PASSWORD_INPUT_SHOW_PWD:iconPrefix+"eye-fill-close",PASSWORD_INPUT_HIDE_PWD:iconPrefix+"eye-fill",MODAL_ZOOM_MIN:iconPrefix+"minus",MODAL_ZOOM_REVERT:iconPrefix+"recover",MODAL_ZOOM_IN:iconPrefix+"square",MODAL_ZOOM_OUT:iconPrefix+"maximize",MODAL_CLOSE:iconPrefix+"close",MODAL_INFO:iconPrefix+"info-circle-fill",MODAL_SUCCESS:iconPrefix+"success-circle-fill",MODAL_WARNING:iconPrefix+"warning-circle-fill",MODAL_ERROR:iconPrefix+"error-circle-fill",MODAL_QUESTION:iconPrefix+"question-circle-fill",MODAL_LOADING:iconPrefix+"spinner roll",DRAWER_CLOSE:iconPrefix+"close",FORM_PREFIX:iconPrefix+"question-circle-fill",FORM_SUFFIX:iconPrefix+"question-circle-fill",FORM_FOLDING:iconPrefix+"arrow-up rotate180",FORM_UNFOLDING:iconPrefix+"arrow-up",FORM_DESIGN_STYLE_SETTING:iconPrefix+"layout",FORM_DESIGN_PROPS_PC:iconPrefix+"pc",FORM_DESIGN_PROPS_MOBILE:iconPrefix+"mobile",FORM_DESIGN_PROPS_ADD:iconPrefix+"add",FORM_DESIGN_PROPS_EDIT:iconPrefix+"edit",FORM_DESIGN_WIDGET_ADD:iconPrefix+"square-plus-fill",FORM_DESIGN_WIDGET_COPY:iconPrefix+"copy",FORM_DESIGN_WIDGET_DELETE:iconPrefix+"delete",FORM_DESIGN_WIDGET_SWAP_LR:iconPrefix+"swap",FORM_DESIGN_WIDGET_OPTION_DELETE:iconPrefix+"delete",FORM_DESIGN_WIDGET_OPTION_EXPAND_OPEN:iconPrefix+"square-plus",FORM_DESIGN_WIDGET_OPTION_EXPAND_CLOSE:iconPrefix+"square-minus",LIST_DESIGN_FIELD_SETTING:iconPrefix+"custom-column",LIST_DESIGN_LIST_SETTING:iconPrefix+"menu",LIST_DESIGN_LIST_SETTING_SEARCH_DELETE:iconPrefix+"delete",LIST_DESIGN_LIST_SETTING_ACTIVE_DELETE:iconPrefix+"delete",UPLOAD_FILE_ERROR:iconPrefix+"warning-circle-fill",UPLOAD_FILE_ADD:iconPrefix+"upload",UPLOAD_FILE_REMOVE:iconPrefix+"delete",UPLOAD_FILE_DOWNLOAD:iconPrefix+"download",UPLOAD_IMAGE_RE_UPLOAD:iconPrefix+"repeat",UPLOAD_IMAGE_ADD:iconPrefix+"add",UPLOAD_IMAGE_REMOVE:iconPrefix+"close",UPLOAD_LOADING:iconPrefix+"spinner roll vxe-loading--default-icon",UPLOAD_FILE_TYPE_DEFAULT:iconPrefix+"file",UPLOAD_FILE_TYPE_XLSX:iconPrefix+"file-excel",UPLOAD_FILE_TYPE_XLS:iconPrefix+"file-excel",UPLOAD_FILE_TYPE_PDF:iconPrefix+"file-pdf",UPLOAD_FILE_TYPE_PNG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_GIF:iconPrefix+"file-image",UPLOAD_FILE_TYPE_JPG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_JPEG:iconPrefix+"file-image",UPLOAD_FILE_TYPE_MD:iconPrefix+"file-markdown",UPLOAD_FILE_TYPE_PPD:iconPrefix+"file-ppt",UPLOAD_FILE_TYPE_DOCX:iconPrefix+"file-word",UPLOAD_FILE_TYPE_DOC:iconPrefix+"file-word",UPLOAD_FILE_TYPE_ZIP:iconPrefix+"file-zip",UPLOAD_FILE_TYPE_TXT:iconPrefix+"file-txt",IMAGE_PREVIEW_CLOSE:iconPrefix+"close",IMAGE_PREVIEW_PREVIOUS:iconPrefix+"arrow-left",IMAGE_PREVIEW_NEXT:iconPrefix+"arrow-right",IMAGE_PREVIEW_PCT_FULL:iconPrefix+"pct-full",IMAGE_PREVIEW_PCT_1_1:iconPrefix+"pct-1-1",IMAGE_PREVIEW_ZOOM_OUT:iconPrefix+"search-zoom-out",IMAGE_PREVIEW_ZOOM_IN:iconPrefix+"search-zoom-in",IMAGE_PREVIEW_ROTATE_LEFT:iconPrefix+"rotate-left",IMAGE_PREVIEW_ROTATE_RIGHT:iconPrefix+"rotate-right",IMAGE_PREVIEW_PRINT:iconPrefix+"print",IMAGE_PREVIEW_DOWNLOAD:iconPrefix+"download",ALERT_CLOSE:iconPrefix+"close",ALERT_INFO:iconPrefix+"info-circle-fill",ALERT_SUCCESS:iconPrefix+"success-circle-fill",ALERT_WARNING:iconPrefix+"warning-circle-fill",ALERT_ERROR:iconPrefix+"error-circle-fill",TREE_NODE_OPEN:iconPrefix+"caret-right rotate90",TREE_NODE_CLOSE:iconPrefix+"caret-right",TREE_NODE_LOADED:iconPrefix+"spinner roll",TREE_SELECT_LOADED:iconPrefix+"spinner roll",TREE_SELECT_OPEN:iconPrefix+"caret-down rotate180",TREE_SELECT_CLOSE:iconPrefix+"caret-down",TABLE_SELECT_LOADED:iconPrefix+"spinner roll",TABLE_SELECT_OPEN:iconPrefix+"caret-down rotate180",TABLE_SELECT_CLOSE:iconPrefix+"caret-down",TABS_TAB_BUTTON_LEFT:iconPrefix+"arrow-left",TABS_TAB_BUTTON_RIGHT:iconPrefix+"arrow-right",TABS_TAB_CLOSE:iconPrefix+"close",TABS_TAB_REFRESH:iconPrefix+"refresh",TABS_TAB_REFRESH_LOADING:iconPrefix+"refresh roll",TEXT_COPY:iconPrefix+"copy",TEXT_LOADING:iconPrefix+"spinner roll",CAROUSEL_HORIZONTAL_PREVIOUS:iconPrefix+"arrow-left",CAROUSEL_HORIZONTAL_NEXT:iconPrefix+"arrow-right",CAROUSEL_VERTICAL_PREVIOUS:iconPrefix+"arrow-up",CAROUSEL_VERTICAL_NEXT:iconPrefix+"arrow-down",COLLAPSE_OPEN:iconPrefix+"arrow-right rotate90",COLLAPSE_CLOSE:iconPrefix+"arrow-right",EMPTY_DEFAULT:iconPrefix+"empty",RESULT_INFO:iconPrefix+"info-circle-fill",RESULT_SUCCESS:iconPrefix+"success-circle-fill",RESULT_WARNING:iconPrefix+"warning-circle-fill",RESULT_ERROR:iconPrefix+"error-circle-fill",RESULT_QUESTION:iconPrefix+"question-circle-fill",RESULT_LOADING:iconPrefix+"spinner roll",RATE_CHECKED:iconPrefix+"star-fill",RATE_UNCHECKED:iconPrefix+"star",COLOR_COPY:iconPrefix+"copy",EYE_DROPPER:iconPrefix+"dropper",SPLIT_TOP_ACTION:iconPrefix+"arrow-up",SPLIT_BOTTOM_ACTION:iconPrefix+"arrow-down",SPLIT_LEFT_ACTION:iconPrefix+"arrow-left",SPLIT_RIGHT_ACTION:iconPrefix+"arrow-right"});var _default=exports.default=_core.VxeUI;
|
package/lib/ui/src/log.js
CHANGED
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.warnLog = exports.errLog = void 0;
|
|
7
7
|
var _core = require("@vxe-ui/core");
|
|
8
|
-
const version = `ui v${"4.5.
|
|
8
|
+
const version = `ui v${"4.5.25"}`;
|
|
9
9
|
const warnLog = exports.warnLog = _core.log.create('warn', version);
|
|
10
10
|
const errLog = exports.errLog = _core.log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const version="ui v4.5.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const version="ui v4.5.25",warnLog=exports.warnLog=_core.log.create("warn",version),errLog=exports.errLog=_core.log.create("error",version);
|
package/lib/upload/src/upload.js
CHANGED
|
@@ -71,10 +71,26 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
71
71
|
type: [String, Number],
|
|
72
72
|
default: () => (0, _ui.getConfig)().upload.limitSize
|
|
73
73
|
},
|
|
74
|
+
showLimitSize: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: () => (0, _ui.getConfig)().upload.showLimitSize
|
|
77
|
+
},
|
|
78
|
+
limitSizeText: {
|
|
79
|
+
type: [String, Number, Function],
|
|
80
|
+
default: () => (0, _ui.getConfig)().upload.limitSizeText
|
|
81
|
+
},
|
|
74
82
|
limitCount: {
|
|
75
83
|
type: [String, Number],
|
|
76
84
|
default: () => (0, _ui.getConfig)().upload.limitCount
|
|
77
85
|
},
|
|
86
|
+
showLimitCount: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: () => (0, _ui.getConfig)().upload.showLimitCount
|
|
89
|
+
},
|
|
90
|
+
limitCountText: {
|
|
91
|
+
type: [String, Number, Function],
|
|
92
|
+
default: () => (0, _ui.getConfig)().upload.limitCountText
|
|
93
|
+
},
|
|
78
94
|
nameField: {
|
|
79
95
|
type: String,
|
|
80
96
|
default: () => (0, _ui.getConfig)().upload.nameField
|
|
@@ -100,7 +116,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
100
116
|
default: () => (0, _ui.getConfig)().upload.showProgress
|
|
101
117
|
},
|
|
102
118
|
progressText: {
|
|
103
|
-
type: String,
|
|
119
|
+
type: [String, Number, Function],
|
|
104
120
|
default: () => (0, _ui.getConfig)().upload.progressText
|
|
105
121
|
},
|
|
106
122
|
autoHiddenButton: {
|
|
@@ -112,7 +128,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
112
128
|
default: () => (0, _ui.getConfig)().upload.showUploadButton
|
|
113
129
|
},
|
|
114
130
|
buttonText: {
|
|
115
|
-
type: String,
|
|
131
|
+
type: [String, Number, Function],
|
|
116
132
|
default: () => (0, _ui.getConfig)().upload.buttonText
|
|
117
133
|
},
|
|
118
134
|
buttonIcon: {
|
|
@@ -143,7 +159,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
143
159
|
type: Boolean,
|
|
144
160
|
default: () => null
|
|
145
161
|
},
|
|
146
|
-
tipText: String,
|
|
162
|
+
tipText: [String, Number, Function],
|
|
147
163
|
hintText: String,
|
|
148
164
|
previewMethod: Function,
|
|
149
165
|
uploadMethod: Function,
|
|
@@ -235,7 +251,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
235
251
|
const computeSizeProp = (0, _vue.computed)(() => {
|
|
236
252
|
return props.sizeField || 'size';
|
|
237
253
|
});
|
|
238
|
-
const
|
|
254
|
+
const computeLimitMaxSize = (0, _vue.computed)(() => {
|
|
239
255
|
return _xeUtils.default.toNumber(props.limitSize) * 1024 * 1024;
|
|
240
256
|
});
|
|
241
257
|
const computeLimitMaxCount = (0, _vue.computed)(() => {
|
|
@@ -300,6 +316,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
300
316
|
if (_xeUtils.default.isString(tipText)) {
|
|
301
317
|
return tipText;
|
|
302
318
|
}
|
|
319
|
+
if (_xeUtils.default.isFunction(tipText)) {
|
|
320
|
+
return `${tipText({})}`;
|
|
321
|
+
}
|
|
303
322
|
const defTips = [];
|
|
304
323
|
if (isImage) {
|
|
305
324
|
if (multiple && limitCount) {
|
|
@@ -612,7 +631,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
612
631
|
const uploadFile = (files, evnt) => {
|
|
613
632
|
const {
|
|
614
633
|
multiple,
|
|
615
|
-
urlMode
|
|
634
|
+
urlMode,
|
|
635
|
+
showLimitSize,
|
|
636
|
+
limitSizeText,
|
|
637
|
+
showLimitCount,
|
|
638
|
+
limitCountText
|
|
616
639
|
} = props;
|
|
617
640
|
const {
|
|
618
641
|
fileList
|
|
@@ -623,26 +646,36 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
623
646
|
const typeProp = computeTypeProp.value;
|
|
624
647
|
const urlProp = computeUrlProp.value;
|
|
625
648
|
const sizeProp = computeSizeProp.value;
|
|
626
|
-
const
|
|
649
|
+
const limitMaxSize = computeLimitMaxSize.value;
|
|
627
650
|
const limitMaxCount = computeLimitMaxCount.value;
|
|
628
651
|
const limitSizeUnit = computeLimitSizeUnit.value;
|
|
629
652
|
let selectFiles = files;
|
|
630
653
|
if (multiple && limitMaxCount) {
|
|
631
654
|
// 校验文件数量
|
|
632
|
-
if (fileList.length >= limitMaxCount) {
|
|
655
|
+
if (showLimitCount && fileList.length >= limitMaxCount) {
|
|
633
656
|
if (_ui.VxeUI.modal) {
|
|
634
657
|
_ui.VxeUI.modal.notification({
|
|
635
658
|
title: (0, _ui.getI18n)('vxe.modal.errTitle'),
|
|
636
659
|
status: 'error',
|
|
637
|
-
content:
|
|
660
|
+
content: limitCountText ? `${_xeUtils.default.isFunction(limitCountText) ? limitCountText({
|
|
661
|
+
maxCount: limitMaxCount
|
|
662
|
+
}) : limitCountText}` : (0, _ui.getI18n)('vxe.upload.overCountErr', [limitMaxCount])
|
|
638
663
|
});
|
|
639
664
|
}
|
|
640
665
|
return;
|
|
641
666
|
}
|
|
642
667
|
const overNum = selectFiles.length - (limitMaxCount - fileList.length);
|
|
643
|
-
if (overNum > 0) {
|
|
668
|
+
if (showLimitCount && overNum > 0) {
|
|
644
669
|
const overExtraList = selectFiles.slice(limitMaxCount - fileList.length);
|
|
645
|
-
if (
|
|
670
|
+
if (limitCountText) {
|
|
671
|
+
_ui.VxeUI.modal.notification({
|
|
672
|
+
title: (0, _ui.getI18n)('vxe.modal.errTitle'),
|
|
673
|
+
status: 'error',
|
|
674
|
+
content: `${_xeUtils.default.isFunction(limitCountText) ? limitCountText({
|
|
675
|
+
maxCount: limitMaxCount
|
|
676
|
+
}) : limitCountText}`
|
|
677
|
+
});
|
|
678
|
+
} else if (_ui.VxeUI.modal) {
|
|
646
679
|
_ui.VxeUI.modal.notification({
|
|
647
680
|
title: (0, _ui.getI18n)('vxe.modal.errTitle'),
|
|
648
681
|
status: 'error',
|
|
@@ -667,15 +700,17 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
667
700
|
selectFiles = selectFiles.slice(0, limitMaxCount - fileList.length);
|
|
668
701
|
}
|
|
669
702
|
// 校验文件大小
|
|
670
|
-
if (
|
|
703
|
+
if (showLimitSize && limitMaxSize) {
|
|
671
704
|
for (let i = 0; i < files.length; i++) {
|
|
672
705
|
const file = files[0];
|
|
673
|
-
if (file.size >
|
|
706
|
+
if (file.size > limitMaxSize) {
|
|
674
707
|
if (_ui.VxeUI.modal) {
|
|
675
708
|
_ui.VxeUI.modal.notification({
|
|
676
709
|
title: (0, _ui.getI18n)('vxe.modal.errTitle'),
|
|
677
710
|
status: 'error',
|
|
678
|
-
content:
|
|
711
|
+
content: limitSizeText ? `${_xeUtils.default.isFunction(limitSizeText) ? limitSizeText({
|
|
712
|
+
maxSize: limitMaxSize
|
|
713
|
+
}) : limitSizeText}` : (0, _ui.getI18n)('vxe.upload.overSizeErr', [limitSizeUnit])
|
|
679
714
|
});
|
|
680
715
|
}
|
|
681
716
|
return;
|
|
@@ -1207,7 +1242,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1207
1242
|
class: (0, _ui.getIcon)().UPLOAD_LOADING
|
|
1208
1243
|
})]) : (0, _vue.createCommentVNode)(), showProgress && isLoading && cacheItem ? (0, _vue.h)('div', {
|
|
1209
1244
|
class: 'vxe-upload--file-item-loading-text'
|
|
1210
|
-
}, progressText ? _xeUtils.default.toFormatString(progressText
|
|
1245
|
+
}, progressText ? _xeUtils.default.toFormatString(`${_xeUtils.default.isFunction(progressText) ? progressText({}) : progressText}`, {
|
|
1211
1246
|
percent: cacheItem.percent
|
|
1212
1247
|
}) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _vue.createCommentVNode)(), showErrorStatus && isError ? (0, _vue.h)('div', {
|
|
1213
1248
|
class: 'vxe-upload--image-item-error'
|
|
@@ -1272,14 +1307,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1272
1307
|
$upload: $xeUpload
|
|
1273
1308
|
})) : [(0, _vue.h)(_button.default, {
|
|
1274
1309
|
class: 'vxe-upload--file-action-button',
|
|
1275
|
-
content: isMoreView || showButtonText ? buttonText ? `${buttonText}` : (0, _ui.getI18n)('vxe.upload.fileBtnText') : '',
|
|
1310
|
+
content: isMoreView || showButtonText ? buttonText ? `${_xeUtils.default.isFunction(buttonText) ? buttonText({}) : buttonText}` : (0, _ui.getI18n)('vxe.upload.fileBtnText') : '',
|
|
1276
1311
|
icon: showButtonIcon ? buttonIcon || (0, _ui.getIcon)().UPLOAD_FILE_ADD : '',
|
|
1277
1312
|
disabled: isDisabled
|
|
1278
1313
|
})]), showTipText && (defTipText || tipSlot) ? (0, _vue.h)('div', {
|
|
1279
1314
|
class: 'vxe-upload--file-action-tip'
|
|
1280
1315
|
}, tipSlot ? (0, _vn.getSlotVNs)(tipSlot({
|
|
1281
1316
|
$upload: $xeUpload
|
|
1282
|
-
})) : defTipText) : (0, _vue.createCommentVNode)()]);
|
|
1317
|
+
})) : `${defTipText}`) : (0, _vue.createCommentVNode)()]);
|
|
1283
1318
|
};
|
|
1284
1319
|
const renderAllMode = () => {
|
|
1285
1320
|
const {
|
|
@@ -1385,7 +1420,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1385
1420
|
class: (0, _ui.getIcon)().UPLOAD_LOADING
|
|
1386
1421
|
})]), showProgress ? (0, _vue.h)('div', {
|
|
1387
1422
|
class: 'vxe-upload--image-item-loading-text'
|
|
1388
|
-
}, progressText ? _xeUtils.default.toFormatString(progressText
|
|
1423
|
+
}, progressText ? _xeUtils.default.toFormatString(`${_xeUtils.default.isFunction(progressText) ? progressText({}) : progressText}`, {
|
|
1389
1424
|
percent: cacheItem.percent
|
|
1390
1425
|
}) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)(), !isLoading ? isError && showErrorStatus ? (0, _vue.h)('div', {
|
|
1391
1426
|
class: 'vxe-upload--image-item-error'
|
|
@@ -1460,11 +1495,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1460
1495
|
class: buttonIcon || (0, _ui.getIcon)().UPLOAD_IMAGE_ADD
|
|
1461
1496
|
})]) : (0, _vue.createCommentVNode)(), isMoreView || showButtonText ? (0, _vue.h)('div', {
|
|
1462
1497
|
class: 'vxe-upload--image-action-content'
|
|
1463
|
-
}, buttonText ? `${buttonText}` : (0, _ui.getI18n)('vxe.upload.imgBtnText')) : (0, _vue.createCommentVNode)(), showTipText && (defTipText || tipSlot) ? (0, _vue.h)('div', {
|
|
1498
|
+
}, buttonText ? `${_xeUtils.default.isFunction(buttonText) ? buttonText({}) : buttonText}` : (0, _ui.getI18n)('vxe.upload.imgBtnText')) : (0, _vue.createCommentVNode)(), showTipText && (defTipText || tipSlot) ? (0, _vue.h)('div', {
|
|
1464
1499
|
class: 'vxe-upload--image-action-hint'
|
|
1465
1500
|
}, tipSlot ? (0, _vn.getSlotVNs)(tipSlot({
|
|
1466
1501
|
$upload: $xeUpload
|
|
1467
|
-
})) : defTipText) : (0, _vue.createCommentVNode)()])])]);
|
|
1502
|
+
})) : `${defTipText}`) : (0, _vue.createCommentVNode)()])])]);
|
|
1468
1503
|
};
|
|
1469
1504
|
const renderImageMode = () => {
|
|
1470
1505
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_vn=require("../..//ui/src/vn"),_log=require("../../ui/src/log"),_dom=require("../../ui/src/dom"),_util=require("./util"),_button=_interopRequireDefault(require("../../button/src/button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeUpload",props:{modelValue:[Array,String,Object],showList:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showList},moreConfig:Object,readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},mode:{type:String,default:()=>(0,_ui.getConfig)().upload.mode},imageTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageTypes,!0)},imageConfig:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageConfig,!0)},imageStyle:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageStyle,!0)},fileTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.fileTypes,!0)},dragSort:Boolean,dragToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.dragToUpload,!0)},pasteToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.pasteToUpload,!0)},keyField:String,singleMode:Boolean,urlMode:Boolean,multiple:Boolean,limitSize:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitSize},limitCount:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitCount},nameField:{type:String,default:()=>(0,_ui.getConfig)().upload.nameField},typeField:{type:String,default:()=>(0,_ui.getConfig)().upload.typeField},urlField:{type:String,default:()=>(0,_ui.getConfig)().upload.urlField},sizeField:{type:String,default:()=>(0,_ui.getConfig)().upload.sizeField},showErrorStatus:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showErrorStatus},showProgress:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showProgress},progressText:{type:String,default:()=>(0,_ui.getConfig)().upload.progressText},autoHiddenButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.autoHiddenButton},showUploadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showUploadButton},buttonText:{type:String,default:()=>(0,_ui.getConfig)().upload.buttonText},buttonIcon:{type:String,default:()=>(0,_ui.getConfig)().upload.buttonIcon},showButtonText:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonText},showButtonIcon:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonIcon},showRemoveButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showRemoveButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showDownloadButton},showPreview:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showPreview},showTip:{type:Boolean,default:()=>null},tipText:String,hintText:String,previewMethod:Function,uploadMethod:Function,beforeRemoveMethod:Function,removeMethod:Function,beforeDownloadMethod:Function,downloadMethod:Function,getUrlMethod:Function,getThumbnailUrlMethod:Function,size:{type:String,default:()=>(0,_ui.getConfig)().upload.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","add","remove","remove-fail","download","download-fail","upload-success","upload-error","sort-dragend"],setup(C,e){const{emit:u,slots:y}=e,w=(0,_vue.inject)("$xeForm",null),I=(0,_vue.inject)("xeFormItemInfo",null),a=(0,_vue.inject)("$xeTable",null);var t=_xeUtils.default.uniqueId();const j=(0,_ui.useSize)(C)["computeSize"],g=(0,_vue.ref)(),p=(0,_vue.ref)(),c=(0,_vue.ref)(),m=(0,_vue.ref)(),b=(0,_vue.reactive)({isDragUploadStatus:!1,showMorePopup:!1,isActivated:!1,fileList:[],fileCacheMaps:{},isDragMove:!1,dragIndex:-1,dragTipText:""}),r={imagePreviewTypes:["jpg","jpeg","png","gif"],prevDragIndex:-1},l={refElem:g},U=(0,_vue.computed)(()=>{var e=C["readonly"];return null===e?!!w&&w.props.readonly:e}),M=(0,_vue.computed)(()=>{var e=C["disabled"];return null===e?!!w&&w.props.disabled:e}),D=(0,_vue.computed)(()=>C.keyField||"_X_KEY"),_=(0,_vue.computed)(()=>"image"===C.mode),T=(0,_vue.computed)(()=>C.nameField||"name"),B=(0,_vue.computed)(()=>C.typeField||"type"),E=(0,_vue.computed)(()=>C.urlField||"url"),S=(0,_vue.computed)(()=>C.sizeField||"size"),$=(0,_vue.computed)(()=>1024*_xeUtils.default.toNumber(C.limitSize)*1024),V=(0,_vue.computed)(()=>C.multiple?_xeUtils.default.toNumber(C.limitCount):1),f=(0,_vue.computed)(()=>{var e=C["multiple"],t=b["fileList"],o=V.value;return e?!o||t.length>=o:1<=t.length}),q=(0,_vue.computed)(()=>{var e=_xeUtils.default.toNumber(C.limitSize);return e?1048576<e?e/1048576+"T":1024<e?e/1024+"G":e+"M":""}),G=(0,_vue.computed)(()=>{var{showTip:e,tipText:t}=C;return _xeUtils.default.isBoolean(e)||(e=(0,_ui.getConfig)().upload.showTip,_xeUtils.default.isBoolean(e))?e:!!t}),H=(0,_vue.computed)(()=>{var{limitSize:e,fileTypes:t,multiple:o,limitCount:a}=C,l=C.tipText||C.hintText,i=_.value,u=q.value;return _xeUtils.default.isString(l)?l:(l=[],i?(o&&a&&l.push((0,_ui.getI18n)("vxe.upload.imgCountHint",[a])),e&&u&&l.push((0,_ui.getI18n)("vxe.upload.imgSizeHint",[u]))):(t&&t.length&&l.push((0,_ui.getI18n)("vxe.upload.fileTypeHint",[t.join("/")])),e&&u&&l.push((0,_ui.getI18n)("vxe.upload.fileSizeHint",[u])),o&&a&&l.push((0,_ui.getI18n)("vxe.upload.fileCountHint",[a]))),l.join((0,_ui.getI18n)("vxe.base.comma")))}),i=(0,_vue.computed)(()=>Object.assign({},C.imageConfig||C.imageStyle)),Y=(0,_vue.computed)(()=>{var{width:e,height:t}=i.value,o={};return e&&(o.width=(0,_dom.toCssUnit)(e)),t&&(o.height=(0,_dom.toCssUnit)(t)),o}),Q=(0,_vue.computed)(()=>Object.assign({showMoreButton:!0},C.moreConfig)),d={},h={xID:t,props:C,context:e,reactData:b,internalData:r,getRefMaps:()=>l,getComputeMaps:()=>d},P=()=>_xeUtils.default.uniqueId(),L=e=>{return e[D.value]},s=()=>{var{modelValue:e,multiple:t}=C,o=U.value;const l=D.value,i=T.value,u=B.value,n=E.value,r=S.value;e=e?(e?_xeUtils.default.isArray(e)?e:[e]:[]).map(e=>{if(!e||_xeUtils.default.isString(e)){var t=""+(e||""),o=_xeUtils.default.parseUrl(e);const a=(o?o.searchQuery[i]:"")||decodeURIComponent(""+(t||"")).split("/").pop()||"";return{[i]:a,[u]:(o?o.searchQuery[u]:"")||N(a),[n]:t,[r]:_xeUtils.default.toNumber(o?o.searchQuery[r]:0)||0,[l]:P()}}const a=e[i]||"";return e[i]=a,e[u]=e[u]||N(a),e[n]=e[n]||"",e[r]=e[r]||0,e[l]=e[l]||P(),e}):[];b.fileList=o||t?e:e.slice(0,1)},N=e=>{var t=e.lastIndexOf(".");return 0<t?e.substring(t+1).toLowerCase():""},O=(e,t,o)=>{u(e,(0,_ui.createEvent)(o,{$upload:h},t))},A=e=>{var{singleMode:t,urlMode:o}=C;const a=E.value,l=T.value;let i=e?e.slice(0):[];o&&(i=i.map(e=>{var t=e[a];if(t&&!_xeUtils.default.parseUrl(t).searchQuery[l])return""+t+(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(e[l]||"");return t})),u("update:modelValue",t?i[0]||null:i)},X=e=>{var t=C.getThumbnailUrlMethod||(0,_ui.getConfig)().upload.getThumbnailUrlMethod;return t?t({$upload:h,option:e}):n(e)},n=e=>{var t=C.getUrlMethod||(0,_ui.getConfig)().upload.getUrlMethod,o=E.value;return t?t({$upload:h,option:e}):e[o]},W=(e,t)=>{var o=C.previewMethod||(0,_ui.getConfig)().upload.previewMethod;if(C.showPreview)if(o)o({$upload:h,option:t});else{var a=t;var{imageTypes:o,showDownloadButton:t}=C;const i=B.value,u=C.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;var l=r["imagePreviewTypes"];l.concat(o||[]).some(e=>(""+e).toLowerCase()===(""+a[i]).toLowerCase())&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:[n(a)],showDownloadButton:t,beforeDownloadMethod:u?()=>u({$upload:h,option:a}):void 0})}},K=(e,t,o)=>{var a=C["showDownloadButton"];const l=b["fileList"],i=C.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;C.showPreview&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:l.map(e=>n(e)),activeIndex:o,showDownloadButton:a,beforeDownloadMethod:i?({index:e})=>i({$upload:h,option:l[e]}):void 0})},J=(o,e)=>{const a=C["showErrorStatus"],l=L(o);var t=C.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod;return t?Promise.resolve(t({$upload:h,file:e,option:o,updateProgress(e){var t=b["fileCacheMaps"],t=t[L(o)];t&&(t.percent=Math.max(0,Math.min(99,_xeUtils.default.toNumber(e))))}})).then(e=>{var t=b["fileCacheMaps"],t=t[l];t&&(t.percent=100),Object.assign(o,e),O("upload-success",{option:o,data:e},null)}).catch(e=>{var t=b["fileCacheMaps"],t=t[l];t&&(t.status="error"),a?Object.assign(o,e):b.fileList=b.fileList.filter(e=>L(e)!==l),O("upload-error",{option:o,data:e},null)}).finally(()=>{var e=b["fileCacheMaps"],e=e[l];e&&(e.loading=!1)}):(t=b["fileCacheMaps"],(e=t[l])&&(e.loading=!1),Promise.resolve())},Z=e=>{const{uploadMethod:t,urlMode:o}=C;var a,l=b["fileCacheMaps"],l=l[L(e)];(t||(0,_ui.getConfig)().upload.uploadMethod)&&l&&(a=l.file,l.loading=!0,l.status="",l.percent=0,J(e,a).then(()=>{o&&A(b.fileList)}))},v=(t,a)=>{var{multiple:e,urlMode:o}=C,l=b["fileList"];const i=C.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod,u=D.value,n=T.value,r=B.value,d=E.value,s=S.value;var v=$.value;const p=V.value;var g=q.value;let c=t;if(e&&p){if(l.length>=p)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.overCountErr",[p])}));const h=c.length-(p-l.length);if(0<h){const x=c.slice(p-l.length);_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",width:null,slots:{default(){return(0,_vue.h)("div",{class:"vxe-upload--file-message-over-error"},[(0,_vue.h)("div",{},(0,_ui.getI18n)("vxe.upload.overCountExtraErr",[p,h])),(0,_vue.h)("div",{class:"vxe-upload--file-message-over-extra"},x.map((e,t)=>(0,_vue.h)("div",{key:t,class:"vxe-upload--file-message-over-extra-item"},e.name)))])}}})}c=c.slice(0,p-l.length)}if(v)for(let e=0;e<t.length;e++)if(t[0].size>v)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.overSizeErr",[g])}));const m=Object.assign({},b.fileCacheMaps),_=e?l:[],f=[];c.forEach(e=>{var t=e["name"],o=P(),t={[n]:t,[r]:N(t),[s]:e.size,[d]:URL.createObjectURL(e),[u]:o},o=(i&&(m[o]={file:e,loading:!0,status:"",percent:0}),(0,_vue.reactive)(t));i&&f.push(J(o,e)),_.push(o),O("add",{option:o},a)}),b.fileList=_,b.fileCacheMaps=m,Promise.all(o?f:[]).then(()=>{A(_),w&&I&&w.triggerItemEvent(a,I.itemConfig.field,_)})},ee=t=>{var{multiple:e,imageTypes:o,fileTypes:a}=C,l=M.value,i=_.value;return l?Promise.resolve({status:!1,files:[],file:null}):(0,_util.readLocalFile)({multiple:e,types:i?o:a}).then(e=>(v(e.files,t),e))},te=e=>{ee(e).catch(()=>{})},oe=(e,t,o)=>{var a=b["fileList"];a.splice(o,1),A(a),w&&I&&w.triggerItemEvent(e,I.itemConfig.field,a),O("remove",{option:t},e)},ae=(t,o,a)=>{var e=C.beforeRemoveMethod||(0,_ui.getConfig)().upload.beforeRemoveMethod;const l=C.removeMethod||(0,_ui.getConfig)().upload.removeMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?l?Promise.resolve(l({$upload:h,option:o})).then(()=>{oe(t,o,a)}).catch(e=>e):oe(t,o,a):O("remove-fail",{option:o},t)})},le=(e,t)=>{O("download",{option:t},e)},ie=(t,o)=>{var e=C.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;const a=C.downloadMethod||(0,_ui.getConfig)().upload.downloadMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?a?Promise.resolve(a({$upload:h,option:o})).then(()=>{le(t,o)}).catch(e=>e):le(t,o):O("download-fail",{option:o},t)})},ue=e=>{var t,o,a,l=e.currentTarget,{clientX:e,clientY:i}=e;l&&({x:l,y:t,height:o,width:a}=l.getBoundingClientRect(),e<l||l+a<e||i<t||t+o<i)&&(b.isDragUploadStatus=!1)},ne=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),b.isDragUploadStatus=!0)},re=(e,t)=>{var o=C["imageTypes"],a=r["imagePreviewTypes"];if(_.value){const l=a.concat(o&&o.length?o:[]);t=t.filter(e=>{const t=(""+(e.type.split("/")[1]||"")).toLowerCase();return!!l.some(e=>(""+e).toLowerCase()===t)})}t.length?v(t,e):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.uploadTypeErr")})},de=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),(t=se(t)).length)&&re(e,t),b.isDragUploadStatus=!1},se=e=>{const t=[];return _xeUtils.default.arrayEach(e,e=>{e=e.getAsFile();e&&t.push(e)}),t},x=()=>{const s=U.value,v=_.value;_ui.VxeUI.modal&&_ui.VxeUI.modal.open({title:s?(0,_ui.getI18n)("vxe.upload.morePopup.readTitle"):(0,_ui.getI18n)("vxe.upload.morePopup."+(v?"imageTitle":"fileTitle")),width:660,height:500,escClosable:!0,showMaximize:!0,resize:!0,maskClosable:!0,slots:{default(){var{showErrorStatus:e,dragToUpload:t,dragSort:o}=C,{isActivated:a,isDragMove:l,isDragUploadStatus:i,dragIndex:u}=b;const n=b["fileList"];var r=M.value,d={};return t&&-1===u&&(d.onDragover=ne,d.onDragleave=ue,d.onDrop=de),(0,_vue.h)("div",Object.assign({ref:p,class:["vxe-upload--more-popup",{"is--readonly":s,"is--disabled":r,"is--active":a,"show--error":e,"is--drag":i}]},d),[v?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--image-more-list"},{default:()=>z(n,!0).concat(R(!0))}):(0,_vue.h)("div",{class:"vxe-upload--image-more-list"},z(n,!0).concat(R(!0))):(0,_vue.h)("div",{class:"vxe-upload--file-more-list"},[k(!0),o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>F(n,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},F(n,!0))]),o?(0,_vue.h)("div",{ref:m,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),i?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])}},onShow(){b.showMorePopup=!0},onHide(){b.showMorePopup=!1}})},ve=(e,t,o)=>{var a,l=b["showMorePopup"],i=g.value,u=p.value,u=l?u:i;u&&(i=u.getBoundingClientRect(),u=c.value,a=m.value,l=l?a:u)&&(a=t.getBoundingClientRect(),l.style.display="block",l.style.top=Math.max(1,a.y-i.y)+"px",l.style.left=Math.max(1,a.x-i.x)+"px",l.style.height=a.height+"px",l.style.width=a.width-1+"px",l.setAttribute("drag-pos",o))},pe=e=>{e.stopPropagation(),e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0);const t=e.currentTarget;e=t.parentElement,e=_xeUtils.default.findIndexOf(Array.from(e.children),e=>t===e);b.isDragMove=!0,b.dragIndex=e,setTimeout(()=>{b.isDragMove=!1},500)},ge=t=>{t.stopPropagation(),t.preventDefault();var o=b["dragIndex"];if(-1!==o){var a=_.value;const i=t.currentTarget;var l=i.parentElement,l=_xeUtils.default.findIndexOf(Array.from(l.children),e=>i===e);let e="";e=a?t.clientX-i.getBoundingClientRect().x<i.clientWidth/2?"left":"right":t.clientY-i.getBoundingClientRect().y<i.clientHeight/2?"top":"bottom",o===l?ve(0,i,e):(ve(0,i,e),r.prevDragIndex=l,r.prevDragPos=e)}},ce=e=>{var{fileList:t,dragIndex:o}=b,{prevDragIndex:a,prevDragPos:l}=r,i="bottom"===l||"right"===l?1:0,u=t[o];const n=t[a];u&&n&&(t.splice(o,1),a=_xeUtils.default.findIndexOf(t,e=>n===e)+i,t.splice(a,0,u),O("sort-dragend",{oldItem:u,newItem:n,dragPos:l,offsetIndex:i,_index:{newIndex:a,oldIndex:o}},e)),t=c.value,u=m.value,t&&(t.style.display=""),u&&(u.style.display=""),b.dragIndex=-1},me=e=>{a&&e.stopPropagation(),b.isActivated=!0},_e=e=>{var t=C["pasteToUpload"],o=b["isActivated"];o&&t&&(o=e.clipboardData||e.originalEvent.clipboardData)&&(t=o["items"],t)&&(o=se(t)).length&&(e.preventDefault(),re(e,o))},fe=e=>{var t=g.value,o=p.value;let a=(0,_dom.getEventTargetNode)(e,t).flag;!a&&o&&(o=(t=o.parentElement||o)&&t.parentElement,a=(0,_dom.getEventTargetNode)(e,o).flag),b.isActivated=a},he=()=>{b.isActivated=!1};t={dispatchEvent:O,choose(){return ee(null)}};Object.assign(h,t,{});const F=(e,u)=>{const{showRemoveButton:n,showDownloadButton:r,showProgress:d,progressText:s,showPreview:v,showErrorStatus:p,dragSort:g}=C,c=b["fileCacheMaps"],m=M.value,_=U.value,f=T.value,h=B.value,x=y.corner,w={};return g&&1<e.length&&(w.onDragstart=pe,w.onDragover=ge,w.onDragend=ce),e.map((t,o)=>{var e=L(t),a=c[e];const l=a&&a.loading,i=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:g?e:o,class:["vxe-upload--file-item",{"is--preview":v,"is--loading":l,"is--error":i}],fileid:e,draggable:!!g||null},w),[(0,_vue.h)("div",{class:"vxe-upload--file-item-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)()["UPLOAD_FILE_TYPE_"+(""+t[h]).toLocaleUpperCase()]||(0,_ui.getIcon)().UPLOAD_FILE_TYPE_DEFAULT})]),(0,_vue.h)("div",{class:"vxe-upload--file-item-name",onClick(e){l||i||W(e,t)}},""+(t[f]||"")),l?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]):(0,_vue.createCommentVNode)(),d&&l&&a?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-text"},s?_xeUtils.default.toFormatString(s,{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)(),p&&i?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-upload--file-item-btn-wrapper"},[x?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(x({option:t,isMoreView:u,readonly:_}))):(0,_vue.createCommentVNode)(),r&&!l?(0,_vue.h)("div",{class:"vxe-upload--file-item-download-btn",onClick(e){ie(e,t)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_DOWNLOAD})]):(0,_vue.createCommentVNode)(),!n||_||m||l?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-item-remove-btn",onClick(e){ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_REMOVE})])])])})},k=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:l,showButtonIcon:i,autoHiddenButton:u}=C,n=M.value,r=U.value,d=G.value,s=H.value,v=f.value,p=y.default,g=y.tip||y.hint;return r||!t?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action"},[u&&v?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action-btn",onClick:te},p?(0,_vn.getSlotVNs)(p({$upload:h})):[(0,_vue.h)(_button.default,{class:"vxe-upload--file-action-button",content:e||l?o?""+o:(0,_ui.getI18n)("vxe.upload.fileBtnText"):"",icon:i?a||(0,_ui.getIcon)().UPLOAD_FILE_ADD:"",disabled:n})]),d&&(s||g)?(0,_vue.h)("div",{class:"vxe-upload--file-action-tip"},g?(0,_vn.getSlotVNs)(g({$upload:h})):s):(0,_vue.createCommentVNode)()])},z=(e,u)=>{const{showRemoveButton:n,showProgress:r,progressText:d,showPreview:s,showErrorStatus:v,dragSort:p}=C,g=b["fileCacheMaps"],c=M.value,m=U.value,_=i.value,f=Y.value,h=y.corner,x={onMousedown:me};return p&&1<e.length&&(x.onDragstart=pe,x.onDragover=ge,x.onDragend=ce),e.map((t,o)=>{var e=L(t),a=g[e];const l=a&&a.loading,i=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:p?e:o,class:["vxe-upload--image-item",{"is--preview":s,"is--circle":_.circle,"is--loading":l,"is--error":i}],fileid:e,draggable:!!p||null},x),[(0,_vue.h)("div",{class:"vxe-upload--image-item-box",style:u?null:f,title:(0,_ui.getI18n)("vxe.upload.viewItemTitle"),onClick(e){l||i||K(e,t,o)}},[l&&a?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading"},[(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]),r?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-text"},d?_xeUtils.default.toFormatString(d,{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)(),l?(0,_vue.createCommentVNode)():i&&v?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.h)("div",{class:"vxe-upload--image-item-img-wrapper"},[(0,_vue.h)("img",{class:"vxe-upload--image-item-img",src:X(t)})]),(0,_vue.h)("div",{class:"vxe-upload--image-item-btn-wrapper",onClick(e){e.stopPropagation()}},[h?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(h({option:t,isMoreView:u,readonly:m}))):(0,_vue.createCommentVNode)(),!n||m||c||l?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--image-item-remove-btn",onClick(e){e.stopPropagation(),ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_IMAGE_REMOVE})])])])])})},R=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:l,showButtonIcon:i,autoHiddenButton:u}=C,n=U.value,r=G.value,d=H.value,s=f.value,v=Y.value,p=y.default,g=y.tip||y.hint;return n||!t||u&&s?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{key:"action",class:"vxe-upload--image-action"},[(0,_vue.h)("div",{class:"vxe-upload--image-action-btn",onClick:te},p?p({$upload:h}):[(0,_vue.h)("div",{class:"vxe-upload--image-action-box",style:e?null:v},[i?(0,_vue.h)("div",{class:"vxe-upload--image-action-icon"},[(0,_vue.h)("i",{class:a||(0,_ui.getIcon)().UPLOAD_IMAGE_ADD})]):(0,_vue.createCommentVNode)(),e||l?(0,_vue.h)("div",{class:"vxe-upload--image-action-content"},o?""+o:(0,_ui.getI18n)("vxe.upload.imgBtnText")):(0,_vue.createCommentVNode)(),r&&(d||g)?(0,_vue.h)("div",{class:"vxe-upload--image-action-hint"},g?(0,_vn.getSlotVNs)(g({$upload:h})):d):(0,_vue.createCommentVNode)()])])])};const o=(0,_vue.ref)(0);return(0,_vue.watch)(()=>C.modelValue?C.modelValue.length:0,()=>{o.value++}),(0,_vue.watch)(()=>C.modelValue,()=>{o.value++}),(0,_vue.watch)(o,()=>{s()}),(0,_vue.onMounted)(()=>{"development"===process.env.NODE_ENV&&(C.multiple&&C.singleMode&&(0,_log.errLog)("vxe.error.errConflicts",["multiple","single-mode"]),C.imageStyle)&&(0,_log.warnLog)("vxe.error.delProp",["image-style","image-config"]),C.dragSort&&(0,_dom.initTpImg)(),_ui.globalEvents.on(h,"paste",_e),_ui.globalEvents.on(h,"mousedown",fe),_ui.globalEvents.on(h,"blur",he)}),(0,_vue.onUnmounted)(()=>{b.isDragUploadStatus=!1,_ui.globalEvents.off(h,"paste"),_ui.globalEvents.off(h,"mousedown"),_ui.globalEvents.off(h,"blur")}),s(),h.renderVN=()=>{var{showErrorStatus:e,dragToUpload:t,pasteToUpload:o,dragSort:a}=C,{isDragUploadStatus:l,showMorePopup:i,isActivated:u,dragIndex:n}=b,r=j.value,d=M.value,s=U.value,v=_.value,p={onMousedown:me};return t&&-1===n&&(p.onDragover=ne,p.onDragleave=ue,p.onDrop=de),(0,_vue.h)("div",Object.assign({ref:g,class:["vxe-upload",{["size--"+r]:r,"is--active":u,"is--readonly":s,"is--disabled":d,"is--paste":o,"show--error":e,"is--drag":l}]},p),[(v?()=>{var{showList:e,dragSort:t}=C;const{fileList:o,isDragMove:a}=b,{maxCount:l,showMoreButton:i}=Q.value;let u=o,n=0;return l&&o.length>l&&(n=o.length-l,u=o.slice(0,l)),(0,_vue.h)("div",{key:"image",class:"vxe-upload--image-wrapper"},e?[t?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(a?"":"-disabled"),tag:"div",class:"vxe-upload--image-list"},{default:()=>z(u,!1).concat([i&&n?(0,_vue.h)("div",{key:"om",class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),R(!1)])}):(0,_vue.h)("div",{class:"vxe-upload--image-list"},z(u,!1).concat([i&&n?(0,_vue.h)("div",{class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),R(!1)]))]:[(0,_vue.h)("div",{class:"vxe-upload--image-list"},[R(!1)])])}:()=>{var{showList:e,moreConfig:t,dragSort:o}=C,{fileList:a,isDragMove:l}=b,{maxCount:i,showMoreButton:u,layout:n}=Q.value,n="horizontal"===n;let r=a,d=0;return i&&a.length>i&&(d=a.length-i,r=a.slice(0,i)),(0,_vue.h)("div",{key:"all",class:"vxe-upload--file-wrapper"},e?[u&&t&&n?(0,_vue.createCommentVNode)():k(!0),r.length||u&&n?(0,_vue.h)("div",{class:["vxe-upload--file-list-wrapper",{"is--horizontal":n}]},[r.length?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>F(r,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},F(r,!1)):(0,_vue.createCommentVNode)(),u&&d?(0,_vue.h)("div",{class:"vxe-upload--file-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[a.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),u&&t&&n?k(!1):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]:[k(!1)])})(),a?(0,_vue.h)("div",{ref:c,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),l&&!i?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])},h},render(){return this.renderVN()}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_vn=require("../..//ui/src/vn"),_log=require("../../ui/src/log"),_dom=require("../../ui/src/dom"),_util=require("./util"),_button=_interopRequireDefault(require("../../button/src/button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeUpload",props:{modelValue:[Array,String,Object],showList:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showList},moreConfig:Object,readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},mode:{type:String,default:()=>(0,_ui.getConfig)().upload.mode},imageTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageTypes,!0)},imageConfig:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageConfig,!0)},imageStyle:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageStyle,!0)},fileTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.fileTypes,!0)},dragSort:Boolean,dragToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.dragToUpload,!0)},pasteToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.pasteToUpload,!0)},keyField:String,singleMode:Boolean,urlMode:Boolean,multiple:Boolean,limitSize:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitSize},showLimitSize:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitSize},limitSizeText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitSizeText},limitCount:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitCount},showLimitCount:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitCount},limitCountText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitCountText},nameField:{type:String,default:()=>(0,_ui.getConfig)().upload.nameField},typeField:{type:String,default:()=>(0,_ui.getConfig)().upload.typeField},urlField:{type:String,default:()=>(0,_ui.getConfig)().upload.urlField},sizeField:{type:String,default:()=>(0,_ui.getConfig)().upload.sizeField},showErrorStatus:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showErrorStatus},showProgress:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showProgress},progressText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.progressText},autoHiddenButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.autoHiddenButton},showUploadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showUploadButton},buttonText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.buttonText},buttonIcon:{type:String,default:()=>(0,_ui.getConfig)().upload.buttonIcon},showButtonText:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonText},showButtonIcon:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonIcon},showRemoveButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showRemoveButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showDownloadButton},showPreview:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showPreview},showTip:{type:Boolean,default:()=>null},tipText:[String,Number,Function],hintText:String,previewMethod:Function,uploadMethod:Function,beforeRemoveMethod:Function,removeMethod:Function,beforeDownloadMethod:Function,downloadMethod:Function,getUrlMethod:Function,getThumbnailUrlMethod:Function,size:{type:String,default:()=>(0,_ui.getConfig)().upload.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","add","remove","remove-fail","download","download-fail","upload-success","upload-error","sort-dragend"],setup(U,e){const{emit:u,slots:w}=e,b=(0,_vue.inject)("$xeForm",null),T=(0,_vue.inject)("xeFormItemInfo",null),a=(0,_vue.inject)("$xeTable",null);var t=_xeUtils.default.uniqueId();const j=(0,_ui.useSize)(U)["computeSize"],g=(0,_vue.ref)(),p=(0,_vue.ref)(),c=(0,_vue.ref)(),m=(0,_vue.ref)(),M=(0,_vue.reactive)({isDragUploadStatus:!1,showMorePopup:!1,isActivated:!1,fileList:[],fileCacheMaps:{},isDragMove:!1,dragIndex:-1,dragTipText:""}),r={imagePreviewTypes:["jpg","jpeg","png","gif"],prevDragIndex:-1},i={refElem:g},y=(0,_vue.computed)(()=>{var e=U["readonly"];return null===e?!!b&&b.props.readonly:e}),I=(0,_vue.computed)(()=>{var e=U["disabled"];return null===e?!!b&&b.props.disabled:e}),D=(0,_vue.computed)(()=>U.keyField||"_X_KEY"),_=(0,_vue.computed)(()=>"image"===U.mode),S=(0,_vue.computed)(()=>U.nameField||"name"),B=(0,_vue.computed)(()=>U.typeField||"type"),E=(0,_vue.computed)(()=>U.urlField||"url"),V=(0,_vue.computed)(()=>U.sizeField||"size"),$=(0,_vue.computed)(()=>1024*_xeUtils.default.toNumber(U.limitSize)*1024),L=(0,_vue.computed)(()=>U.multiple?_xeUtils.default.toNumber(U.limitCount):1),f=(0,_vue.computed)(()=>{var e=U["multiple"],t=M["fileList"],o=L.value;return e?!o||t.length>=o:1<=t.length}),q=(0,_vue.computed)(()=>{var e=_xeUtils.default.toNumber(U.limitSize);return e?1048576<e?e/1048576+"T":1024<e?e/1024+"G":e+"M":""}),G=(0,_vue.computed)(()=>{var{showTip:e,tipText:t}=U;return _xeUtils.default.isBoolean(e)||(e=(0,_ui.getConfig)().upload.showTip,_xeUtils.default.isBoolean(e))?e:!!t}),H=(0,_vue.computed)(()=>{var{limitSize:e,fileTypes:t,multiple:o,limitCount:a}=U,i=U.tipText||U.hintText,l=_.value,u=q.value;return _xeUtils.default.isString(i)?i:_xeUtils.default.isFunction(i)?""+i({}):(i=[],l?(o&&a&&i.push((0,_ui.getI18n)("vxe.upload.imgCountHint",[a])),e&&u&&i.push((0,_ui.getI18n)("vxe.upload.imgSizeHint",[u]))):(t&&t.length&&i.push((0,_ui.getI18n)("vxe.upload.fileTypeHint",[t.join("/")])),e&&u&&i.push((0,_ui.getI18n)("vxe.upload.fileSizeHint",[u])),o&&a&&i.push((0,_ui.getI18n)("vxe.upload.fileCountHint",[a]))),i.join((0,_ui.getI18n)("vxe.base.comma")))}),l=(0,_vue.computed)(()=>Object.assign({},U.imageConfig||U.imageStyle)),Y=(0,_vue.computed)(()=>{var{width:e,height:t}=l.value,o={};return e&&(o.width=(0,_dom.toCssUnit)(e)),t&&(o.height=(0,_dom.toCssUnit)(t)),o}),Q=(0,_vue.computed)(()=>Object.assign({showMoreButton:!0},U.moreConfig)),d={},h={xID:t,props:U,context:e,reactData:M,internalData:r,getRefMaps:()=>i,getComputeMaps:()=>d},P=()=>_xeUtils.default.uniqueId(),N=e=>{return e[D.value]},s=()=>{var{modelValue:e,multiple:t}=U,o=y.value;const i=D.value,l=S.value,u=B.value,n=E.value,r=V.value;e=e?(e?_xeUtils.default.isArray(e)?e:[e]:[]).map(e=>{if(!e||_xeUtils.default.isString(e)){var t=""+(e||""),o=_xeUtils.default.parseUrl(e);const a=(o?o.searchQuery[l]:"")||decodeURIComponent(""+(t||"")).split("/").pop()||"";return{[l]:a,[u]:(o?o.searchQuery[u]:"")||F(a),[n]:t,[r]:_xeUtils.default.toNumber(o?o.searchQuery[r]:0)||0,[i]:P()}}const a=e[l]||"";return e[l]=a,e[u]=e[u]||F(a),e[n]=e[n]||"",e[r]=e[r]||0,e[i]=e[i]||P(),e}):[];M.fileList=o||t?e:e.slice(0,1)},F=e=>{var t=e.lastIndexOf(".");return 0<t?e.substring(t+1).toLowerCase():""},O=(e,t,o)=>{u(e,(0,_ui.createEvent)(o,{$upload:h},t))},A=e=>{var{singleMode:t,urlMode:o}=U;const a=E.value,i=S.value;let l=e?e.slice(0):[];o&&(l=l.map(e=>{var t=e[a];if(t&&!_xeUtils.default.parseUrl(t).searchQuery[i])return""+t+(-1===t.indexOf("?")?"?":"&")+i+"="+encodeURIComponent(e[i]||"");return t})),u("update:modelValue",t?l[0]||null:l)},X=e=>{var t=U.getThumbnailUrlMethod||(0,_ui.getConfig)().upload.getThumbnailUrlMethod;return t?t({$upload:h,option:e}):n(e)},n=e=>{var t=U.getUrlMethod||(0,_ui.getConfig)().upload.getUrlMethod,o=E.value;return t?t({$upload:h,option:e}):e[o]},W=(e,t)=>{var o=U.previewMethod||(0,_ui.getConfig)().upload.previewMethod;if(U.showPreview)if(o)o({$upload:h,option:t});else{var a=t;var{imageTypes:o,showDownloadButton:t}=U;const l=B.value,u=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;var i=r["imagePreviewTypes"];i.concat(o||[]).some(e=>(""+e).toLowerCase()===(""+a[l]).toLowerCase())&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:[n(a)],showDownloadButton:t,beforeDownloadMethod:u?()=>u({$upload:h,option:a}):void 0})}},K=(e,t,o)=>{var a=U["showDownloadButton"];const i=M["fileList"],l=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;U.showPreview&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:i.map(e=>n(e)),activeIndex:o,showDownloadButton:a,beforeDownloadMethod:l?({index:e})=>l({$upload:h,option:i[e]}):void 0})},J=(o,e)=>{const a=U["showErrorStatus"],i=N(o);var t=U.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod;return t?Promise.resolve(t({$upload:h,file:e,option:o,updateProgress(e){var t=M["fileCacheMaps"],t=t[N(o)];t&&(t.percent=Math.max(0,Math.min(99,_xeUtils.default.toNumber(e))))}})).then(e=>{var t=M["fileCacheMaps"],t=t[i];t&&(t.percent=100),Object.assign(o,e),O("upload-success",{option:o,data:e},null)}).catch(e=>{var t=M["fileCacheMaps"],t=t[i];t&&(t.status="error"),a?Object.assign(o,e):M.fileList=M.fileList.filter(e=>N(e)!==i),O("upload-error",{option:o,data:e},null)}).finally(()=>{var e=M["fileCacheMaps"],e=e[i];e&&(e.loading=!1)}):(t=M["fileCacheMaps"],(e=t[i])&&(e.loading=!1),Promise.resolve())},Z=e=>{const{uploadMethod:t,urlMode:o}=U;var a,i=M["fileCacheMaps"],i=i[N(e)];(t||(0,_ui.getConfig)().upload.uploadMethod)&&i&&(a=i.file,i.loading=!0,i.status="",i.percent=0,J(e,a).then(()=>{o&&A(M.fileList)}))},v=(t,a)=>{var{multiple:e,urlMode:o,showLimitSize:i,limitSizeText:l,showLimitCount:u,limitCountText:n}=U,r=M["fileList"];const d=U.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod,s=D.value,v=S.value,p=B.value,g=E.value,c=V.value;var m=$.value;const _=L.value;var f=q.value;let h=t;if(e&&_){if(u&&r.length>=_)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:n?""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n):(0,_ui.getI18n)("vxe.upload.overCountErr",[_])}));const y=h.length-(_-r.length);if(u&&0<y){const I=h.slice(_-r.length);n?_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n)}):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",width:null,slots:{default(){return(0,_vue.h)("div",{class:"vxe-upload--file-message-over-error"},[(0,_vue.h)("div",{},(0,_ui.getI18n)("vxe.upload.overCountExtraErr",[_,y])),(0,_vue.h)("div",{class:"vxe-upload--file-message-over-extra"},I.map((e,t)=>(0,_vue.h)("div",{key:t,class:"vxe-upload--file-message-over-extra-item"},e.name)))])}}})}h=h.slice(0,_-r.length)}if(i&&m)for(let e=0;e<t.length;e++)if(t[0].size>m)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:l?""+(_xeUtils.default.isFunction(l)?l({maxSize:m}):l):(0,_ui.getI18n)("vxe.upload.overSizeErr",[f])}));const x=Object.assign({},M.fileCacheMaps),C=e?r:[],w=[];h.forEach(e=>{var t=e["name"],o=P(),t={[v]:t,[p]:F(t),[c]:e.size,[g]:URL.createObjectURL(e),[s]:o},o=(d&&(x[o]={file:e,loading:!0,status:"",percent:0}),(0,_vue.reactive)(t));d&&w.push(J(o,e)),C.push(o),O("add",{option:o},a)}),M.fileList=C,M.fileCacheMaps=x,Promise.all(o?w:[]).then(()=>{A(C),b&&T&&b.triggerItemEvent(a,T.itemConfig.field,C)})},ee=t=>{var{multiple:e,imageTypes:o,fileTypes:a}=U,i=I.value,l=_.value;return i?Promise.resolve({status:!1,files:[],file:null}):(0,_util.readLocalFile)({multiple:e,types:l?o:a}).then(e=>(v(e.files,t),e))},te=e=>{ee(e).catch(()=>{})},oe=(e,t,o)=>{var a=M["fileList"];a.splice(o,1),A(a),b&&T&&b.triggerItemEvent(e,T.itemConfig.field,a),O("remove",{option:t},e)},ae=(t,o,a)=>{var e=U.beforeRemoveMethod||(0,_ui.getConfig)().upload.beforeRemoveMethod;const i=U.removeMethod||(0,_ui.getConfig)().upload.removeMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?i?Promise.resolve(i({$upload:h,option:o})).then(()=>{oe(t,o,a)}).catch(e=>e):oe(t,o,a):O("remove-fail",{option:o},t)})},ie=(e,t)=>{O("download",{option:t},e)},le=(t,o)=>{var e=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;const a=U.downloadMethod||(0,_ui.getConfig)().upload.downloadMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?a?Promise.resolve(a({$upload:h,option:o})).then(()=>{ie(t,o)}).catch(e=>e):ie(t,o):O("download-fail",{option:o},t)})},ue=e=>{var t,o,a,i=e.currentTarget,{clientX:e,clientY:l}=e;i&&({x:i,y:t,height:o,width:a}=i.getBoundingClientRect(),e<i||i+a<e||l<t||t+o<l)&&(M.isDragUploadStatus=!1)},ne=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),M.isDragUploadStatus=!0)},re=(e,t)=>{var o=U["imageTypes"],a=r["imagePreviewTypes"];if(_.value){const i=a.concat(o&&o.length?o:[]);t=t.filter(e=>{const t=(""+(e.type.split("/")[1]||"")).toLowerCase();return!!i.some(e=>(""+e).toLowerCase()===t)})}t.length?v(t,e):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.uploadTypeErr")})},de=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),(t=se(t)).length)&&re(e,t),M.isDragUploadStatus=!1},se=e=>{const t=[];return _xeUtils.default.arrayEach(e,e=>{e=e.getAsFile();e&&t.push(e)}),t},x=()=>{const s=y.value,v=_.value;_ui.VxeUI.modal&&_ui.VxeUI.modal.open({title:s?(0,_ui.getI18n)("vxe.upload.morePopup.readTitle"):(0,_ui.getI18n)("vxe.upload.morePopup."+(v?"imageTitle":"fileTitle")),width:660,height:500,escClosable:!0,showMaximize:!0,resize:!0,maskClosable:!0,slots:{default(){var{showErrorStatus:e,dragToUpload:t,dragSort:o}=U,{isActivated:a,isDragMove:i,isDragUploadStatus:l,dragIndex:u}=M;const n=M["fileList"];var r=I.value,d={};return t&&-1===u&&(d.onDragover=ne,d.onDragleave=ue,d.onDrop=de),(0,_vue.h)("div",Object.assign({ref:p,class:["vxe-upload--more-popup",{"is--readonly":s,"is--disabled":r,"is--active":a,"show--error":e,"is--drag":l}]},d),[v?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--image-more-list"},{default:()=>k(n,!0).concat(R(!0))}):(0,_vue.h)("div",{class:"vxe-upload--image-more-list"},k(n,!0).concat(R(!0))):(0,_vue.h)("div",{class:"vxe-upload--file-more-list"},[z(!0),o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>C(n,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},C(n,!0))]),o?(0,_vue.h)("div",{ref:m,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),l?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])}},onShow(){M.showMorePopup=!0},onHide(){M.showMorePopup=!1}})},ve=(e,t,o)=>{var a,i=M["showMorePopup"],l=g.value,u=p.value,u=i?u:l;u&&(l=u.getBoundingClientRect(),u=c.value,a=m.value,i=i?a:u)&&(a=t.getBoundingClientRect(),i.style.display="block",i.style.top=Math.max(1,a.y-l.y)+"px",i.style.left=Math.max(1,a.x-l.x)+"px",i.style.height=a.height+"px",i.style.width=a.width-1+"px",i.setAttribute("drag-pos",o))},pe=e=>{e.stopPropagation(),e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0);const t=e.currentTarget;e=t.parentElement,e=_xeUtils.default.findIndexOf(Array.from(e.children),e=>t===e);M.isDragMove=!0,M.dragIndex=e,setTimeout(()=>{M.isDragMove=!1},500)},ge=t=>{t.stopPropagation(),t.preventDefault();var o=M["dragIndex"];if(-1!==o){var a=_.value;const l=t.currentTarget;var i=l.parentElement,i=_xeUtils.default.findIndexOf(Array.from(i.children),e=>l===e);let e="";e=a?t.clientX-l.getBoundingClientRect().x<l.clientWidth/2?"left":"right":t.clientY-l.getBoundingClientRect().y<l.clientHeight/2?"top":"bottom",o===i?ve(0,l,e):(ve(0,l,e),r.prevDragIndex=i,r.prevDragPos=e)}},ce=e=>{var{fileList:t,dragIndex:o}=M,{prevDragIndex:a,prevDragPos:i}=r,l="bottom"===i||"right"===i?1:0,u=t[o];const n=t[a];u&&n&&(t.splice(o,1),a=_xeUtils.default.findIndexOf(t,e=>n===e)+l,t.splice(a,0,u),O("sort-dragend",{oldItem:u,newItem:n,dragPos:i,offsetIndex:l,_index:{newIndex:a,oldIndex:o}},e)),t=c.value,u=m.value,t&&(t.style.display=""),u&&(u.style.display=""),M.dragIndex=-1},me=e=>{a&&e.stopPropagation(),M.isActivated=!0},_e=e=>{var t=U["pasteToUpload"],o=M["isActivated"];o&&t&&(o=e.clipboardData||e.originalEvent.clipboardData)&&(t=o["items"],t)&&(o=se(t)).length&&(e.preventDefault(),re(e,o))},fe=e=>{var t=g.value,o=p.value;let a=(0,_dom.getEventTargetNode)(e,t).flag;!a&&o&&(o=(t=o.parentElement||o)&&t.parentElement,a=(0,_dom.getEventTargetNode)(e,o).flag),M.isActivated=a},he=()=>{M.isActivated=!1};t={dispatchEvent:O,choose(){return ee(null)}};Object.assign(h,t,{});const C=(e,u)=>{const{showRemoveButton:n,showDownloadButton:r,showProgress:d,progressText:s,showPreview:v,showErrorStatus:p,dragSort:g}=U,c=M["fileCacheMaps"],m=I.value,_=y.value,f=S.value,h=B.value,x=w.corner,C={};return g&&1<e.length&&(C.onDragstart=pe,C.onDragover=ge,C.onDragend=ce),e.map((t,o)=>{var e=N(t),a=c[e];const i=a&&a.loading,l=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:g?e:o,class:["vxe-upload--file-item",{"is--preview":v,"is--loading":i,"is--error":l}],fileid:e,draggable:!!g||null},C),[(0,_vue.h)("div",{class:"vxe-upload--file-item-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)()["UPLOAD_FILE_TYPE_"+(""+t[h]).toLocaleUpperCase()]||(0,_ui.getIcon)().UPLOAD_FILE_TYPE_DEFAULT})]),(0,_vue.h)("div",{class:"vxe-upload--file-item-name",onClick(e){i||l||W(e,t)}},""+(t[f]||"")),i?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]):(0,_vue.createCommentVNode)(),d&&i&&a?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-text"},s?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(s)?s({}):s),{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)(),p&&l?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-upload--file-item-btn-wrapper"},[x?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(x({option:t,isMoreView:u,readonly:_}))):(0,_vue.createCommentVNode)(),r&&!i?(0,_vue.h)("div",{class:"vxe-upload--file-item-download-btn",onClick(e){le(e,t)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_DOWNLOAD})]):(0,_vue.createCommentVNode)(),!n||_||m||i?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-item-remove-btn",onClick(e){ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_REMOVE})])])])})},z=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:i,showButtonIcon:l,autoHiddenButton:u}=U,n=I.value,r=y.value,d=G.value,s=H.value,v=f.value,p=w.default,g=w.tip||w.hint;return r||!t?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action"},[u&&v?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action-btn",onClick:te},p?(0,_vn.getSlotVNs)(p({$upload:h})):[(0,_vue.h)(_button.default,{class:"vxe-upload--file-action-button",content:e||i?o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.fileBtnText"):"",icon:l?a||(0,_ui.getIcon)().UPLOAD_FILE_ADD:"",disabled:n})]),d&&(s||g)?(0,_vue.h)("div",{class:"vxe-upload--file-action-tip"},g?(0,_vn.getSlotVNs)(g({$upload:h})):""+s):(0,_vue.createCommentVNode)()])},k=(e,u)=>{const{showRemoveButton:n,showProgress:r,progressText:d,showPreview:s,showErrorStatus:v,dragSort:p}=U,g=M["fileCacheMaps"],c=I.value,m=y.value,_=l.value,f=Y.value,h=w.corner,x={onMousedown:me};return p&&1<e.length&&(x.onDragstart=pe,x.onDragover=ge,x.onDragend=ce),e.map((t,o)=>{var e=N(t),a=g[e];const i=a&&a.loading,l=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:p?e:o,class:["vxe-upload--image-item",{"is--preview":s,"is--circle":_.circle,"is--loading":i,"is--error":l}],fileid:e,draggable:!!p||null},x),[(0,_vue.h)("div",{class:"vxe-upload--image-item-box",style:u?null:f,title:(0,_ui.getI18n)("vxe.upload.viewItemTitle"),onClick(e){i||l||K(e,t,o)}},[i&&a?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading"},[(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]),r?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-text"},d?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(d)?d({}):d),{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)(),i?(0,_vue.createCommentVNode)():l&&v?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.h)("div",{class:"vxe-upload--image-item-img-wrapper"},[(0,_vue.h)("img",{class:"vxe-upload--image-item-img",src:X(t)})]),(0,_vue.h)("div",{class:"vxe-upload--image-item-btn-wrapper",onClick(e){e.stopPropagation()}},[h?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(h({option:t,isMoreView:u,readonly:m}))):(0,_vue.createCommentVNode)(),!n||m||c||i?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--image-item-remove-btn",onClick(e){e.stopPropagation(),ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_IMAGE_REMOVE})])])])])})},R=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:i,showButtonIcon:l,autoHiddenButton:u}=U,n=y.value,r=G.value,d=H.value,s=f.value,v=Y.value,p=w.default,g=w.tip||w.hint;return n||!t||u&&s?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{key:"action",class:"vxe-upload--image-action"},[(0,_vue.h)("div",{class:"vxe-upload--image-action-btn",onClick:te},p?p({$upload:h}):[(0,_vue.h)("div",{class:"vxe-upload--image-action-box",style:e?null:v},[l?(0,_vue.h)("div",{class:"vxe-upload--image-action-icon"},[(0,_vue.h)("i",{class:a||(0,_ui.getIcon)().UPLOAD_IMAGE_ADD})]):(0,_vue.createCommentVNode)(),e||i?(0,_vue.h)("div",{class:"vxe-upload--image-action-content"},o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.imgBtnText")):(0,_vue.createCommentVNode)(),r&&(d||g)?(0,_vue.h)("div",{class:"vxe-upload--image-action-hint"},g?(0,_vn.getSlotVNs)(g({$upload:h})):""+d):(0,_vue.createCommentVNode)()])])])};const o=(0,_vue.ref)(0);return(0,_vue.watch)(()=>U.modelValue?U.modelValue.length:0,()=>{o.value++}),(0,_vue.watch)(()=>U.modelValue,()=>{o.value++}),(0,_vue.watch)(o,()=>{s()}),(0,_vue.onMounted)(()=>{"development"===process.env.NODE_ENV&&(U.multiple&&U.singleMode&&(0,_log.errLog)("vxe.error.errConflicts",["multiple","single-mode"]),U.imageStyle)&&(0,_log.warnLog)("vxe.error.delProp",["image-style","image-config"]),U.dragSort&&(0,_dom.initTpImg)(),_ui.globalEvents.on(h,"paste",_e),_ui.globalEvents.on(h,"mousedown",fe),_ui.globalEvents.on(h,"blur",he)}),(0,_vue.onUnmounted)(()=>{M.isDragUploadStatus=!1,_ui.globalEvents.off(h,"paste"),_ui.globalEvents.off(h,"mousedown"),_ui.globalEvents.off(h,"blur")}),s(),h.renderVN=()=>{var{showErrorStatus:e,dragToUpload:t,pasteToUpload:o,dragSort:a}=U,{isDragUploadStatus:i,showMorePopup:l,isActivated:u,dragIndex:n}=M,r=j.value,d=I.value,s=y.value,v=_.value,p={onMousedown:me};return t&&-1===n&&(p.onDragover=ne,p.onDragleave=ue,p.onDrop=de),(0,_vue.h)("div",Object.assign({ref:g,class:["vxe-upload",{["size--"+r]:r,"is--active":u,"is--readonly":s,"is--disabled":d,"is--paste":o,"show--error":e,"is--drag":i}]},p),[(v?()=>{var{showList:e,dragSort:t}=U;const{fileList:o,isDragMove:a}=M,{maxCount:i,showMoreButton:l}=Q.value;let u=o,n=0;return i&&o.length>i&&(n=o.length-i,u=o.slice(0,i)),(0,_vue.h)("div",{key:"image",class:"vxe-upload--image-wrapper"},e?[t?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(a?"":"-disabled"),tag:"div",class:"vxe-upload--image-list"},{default:()=>k(u,!1).concat([l&&n?(0,_vue.h)("div",{key:"om",class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),R(!1)])}):(0,_vue.h)("div",{class:"vxe-upload--image-list"},k(u,!1).concat([l&&n?(0,_vue.h)("div",{class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),R(!1)]))]:[(0,_vue.h)("div",{class:"vxe-upload--image-list"},[R(!1)])])}:()=>{var{showList:e,moreConfig:t,dragSort:o}=U,{fileList:a,isDragMove:i}=M,{maxCount:l,showMoreButton:u,layout:n}=Q.value,n="horizontal"===n;let r=a,d=0;return l&&a.length>l&&(d=a.length-l,r=a.slice(0,l)),(0,_vue.h)("div",{key:"all",class:"vxe-upload--file-wrapper"},e?[u&&t&&n?(0,_vue.createCommentVNode)():z(!0),r.length||u&&n?(0,_vue.h)("div",{class:["vxe-upload--file-list-wrapper",{"is--horizontal":n}]},[r.length?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>C(r,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},C(r,!1)):(0,_vue.createCommentVNode)(),u&&d?(0,_vue.h)("div",{class:"vxe-upload--file-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[a.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),u&&t&&n?z(!1):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]:[z(!1)])})(),a?(0,_vue.h)("div",{ref:c,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),i&&!l?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])},h},render(){return this.renderVN()}});
|
package/package.json
CHANGED
|
@@ -558,6 +558,9 @@ export default defineComponent({
|
|
|
558
558
|
const valueField = computeValueField.value
|
|
559
559
|
const selectValue = option[valueField]
|
|
560
560
|
const remoteItem = remoteValMaps[selectValue]
|
|
561
|
+
if (!reactData.visiblePanel) {
|
|
562
|
+
return
|
|
563
|
+
}
|
|
561
564
|
if (remoteItem) {
|
|
562
565
|
remoteItem.item = option
|
|
563
566
|
} else {
|
|
@@ -699,9 +702,11 @@ export default defineComponent({
|
|
|
699
702
|
if (isEsc || isTab) {
|
|
700
703
|
hideOptionPanel()
|
|
701
704
|
} else if (isEnter) {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
+
if (currentOption) {
|
|
706
|
+
evnt.preventDefault()
|
|
707
|
+
evnt.stopPropagation()
|
|
708
|
+
changeOptionEvent(evnt, currentOption)
|
|
709
|
+
}
|
|
705
710
|
} else if (isUpArrow || isDwArrow) {
|
|
706
711
|
evnt.preventDefault()
|
|
707
712
|
let offsetOption = findOffsetOption(currentOption, isDwArrow)
|
|
@@ -612,7 +612,17 @@ export default defineComponent({
|
|
|
612
612
|
isCheckedByRadioNode,
|
|
613
613
|
isCheckedByCheckboxNodeId,
|
|
614
614
|
isIndeterminateByCheckboxNode,
|
|
615
|
-
isCheckedByCheckboxNode
|
|
615
|
+
isCheckedByCheckboxNode,
|
|
616
|
+
getCheckboxIndeterminateNodes () {
|
|
617
|
+
const { treeList, indeterminateCheckboxMaps } = reactData
|
|
618
|
+
const indeterminateNodes: any[] = []
|
|
619
|
+
XEUtils.eachTree(treeList, (node) => {
|
|
620
|
+
if (indeterminateCheckboxMaps[getNodeId(node)]) {
|
|
621
|
+
indeterminateNodes.push(node)
|
|
622
|
+
}
|
|
623
|
+
})
|
|
624
|
+
return indeterminateNodes
|
|
625
|
+
}
|
|
616
626
|
}
|
|
617
627
|
|
|
618
628
|
const cacheNodeMap = () => {
|
package/packages/ui/index.ts
CHANGED
|
@@ -351,8 +351,10 @@ setConfig({
|
|
|
351
351
|
showRemoveButton: true,
|
|
352
352
|
showButtonIcon: true,
|
|
353
353
|
showPreview: true,
|
|
354
|
-
dragToUpload: true
|
|
355
|
-
// imageConfig: {}
|
|
354
|
+
dragToUpload: true,
|
|
355
|
+
// imageConfig: {},
|
|
356
|
+
showLimitSize: true,
|
|
357
|
+
showLimitCount: true
|
|
356
358
|
},
|
|
357
359
|
watermark: {
|
|
358
360
|
rotate: -30,
|