@qynpm/ui 1.0.34 → 1.0.36
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/README.md +91 -56
- package/dist/index.cjs +7 -6
- package/dist/index.mjs +63 -61
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +1 -1
- package/dist/qy-drawer/index.cjs +1 -1
- package/dist/qy-drawer/index.mjs +1 -1
- package/dist/qy-file-picker/index.cjs +1 -1
- package/dist/qy-file-picker/index.mjs +1 -1
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +1 -1
- package/dist/qy-iframe/index.cjs +1 -1
- package/dist/qy-iframe/index.mjs +1 -1
- package/dist/qy-image/index.cjs +1 -1
- package/dist/qy-image/index.mjs +1 -1
- package/dist/qy-image-preview/index.cjs +1 -1
- package/dist/qy-image-preview/index.mjs +2 -2
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-input-number/index.cjs +1 -1
- package/dist/qy-input-number/index.mjs +1 -1
- package/dist/qy-input-tag/index.cjs +1 -0
- package/dist/qy-input-tag/index.mjs +7 -0
- package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
- package/dist/qy-menu-actions/index.cjs +1 -1
- package/dist/qy-menu-actions/index.mjs +1 -1
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +5 -2
- package/dist/qy-popover/index.cjs +1 -1
- package/dist/qy-popover/index.mjs +1 -1
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +1 -1
- package/dist/qy-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +1 -1
- package/dist/qy-selection-dialog/index.cjs +1 -1
- package/dist/qy-selection-dialog/index.mjs +1 -1
- package/dist/qy-tree-select/index.cjs +1 -1
- package/dist/qy-tree-select/index.mjs +1 -1
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +5 -2
- package/dist/shared/{index-IXbvJ9d7.mjs → index-4SkLDBra.mjs} +1 -1
- package/dist/shared/index-BYX0biqw.mjs +766 -0
- package/dist/shared/{index-n04hARNG.cjs → index-Bli6Gx5d.cjs} +1 -1
- package/dist/shared/{index-BBZQowyp.mjs → index-BuUtJrIy.mjs} +9 -9
- package/dist/shared/index-BxxwEr52.mjs +107 -0
- package/dist/shared/index-C1i-hd-W.cjs +1 -0
- package/dist/shared/{index-Dyyp1ix9.cjs → index-C7lRQtzs.cjs} +1 -1
- package/dist/shared/{index-C_adKysL.mjs → index-CdnHMuo3.mjs} +1 -1
- package/dist/shared/index-D654b42n.mjs +2754 -0
- package/dist/shared/{index-D6-K5xSD.cjs → index-DlGwHshu.cjs} +1 -1
- package/dist/shared/{index-BeubtXXl.cjs → index-DnHfk7NM.cjs} +1 -1
- package/dist/shared/index-DnNIseRJ.cjs +1 -0
- package/dist/shared/{index-ccugL1Ie.mjs → index-Dr-Q5krU.mjs} +4 -4
- package/dist/shared/index-aIqtIYsu.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-CqSJ_8hG.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DIWWHODS.mjs +197 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs +143 -0
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DoL8xnpo.mjs → index.vue_vue_type_script_setup_true_lang-IyZesuKm.mjs} +9 -9
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-ccFLNRry.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs +148 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DHK86rdP.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DVXf-yUs.cjs +1 -0
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-BJXS2dVf.mjs → index.vue_vue_type_style_index_0_lang-DsOg_Rum.mjs} +19 -17
- package/dist/shared/utils-BjEXwY3L.cjs +1 -0
- package/dist/shared/utils-DoyI5oM8.mjs +148 -0
- package/index.d.ts +113 -56
- package/package.json +489 -483
- package/qy-alert/index.d.ts +64 -64
- package/qy-autocomplete/index.d.ts +5 -5
- package/qy-avatar/index.d.ts +67 -67
- package/qy-badge/index.d.ts +63 -63
- package/qy-card/index.d.ts +64 -64
- package/qy-cascader/index.d.ts +198 -198
- package/qy-collapse/index.d.ts +59 -59
- package/qy-collapse-item/index.d.ts +45 -45
- package/qy-descriptions/index.d.ts +47 -47
- package/qy-descriptions-item/index.d.ts +46 -46
- package/qy-dialog/index.d.ts +63 -63
- package/qy-divider/index.d.ts +53 -53
- package/qy-drawer/index.d.ts +55 -55
- package/qy-empty/index.d.ts +51 -51
- package/qy-file-picker/index.d.ts +4 -1
- package/qy-iframe/index.d.ts +66 -66
- package/qy-image/index.d.ts +28 -28
- package/qy-image-preview/index.d.ts +20 -20
- package/qy-image-upload/index.d.ts +69 -12
- package/qy-input/index.d.ts +76 -18
- package/qy-input-number/index.d.ts +64 -30
- package/qy-input-tag/index.d.ts +69 -0
- package/qy-link/index.d.ts +69 -69
- package/qy-loading/index.d.ts +25 -25
- package/qy-menu-actions/index.d.ts +29 -29
- package/qy-money-input/index.d.ts +87 -12
- package/qy-progress/index.d.ts +74 -74
- package/qy-result/index.d.ts +64 -64
- package/qy-scrollbar/index.d.ts +85 -85
- package/qy-skeleton/index.d.ts +54 -54
- package/qy-skeleton-item/index.d.ts +48 -48
- package/qy-step/index.d.ts +55 -55
- package/qy-steps/index.d.ts +62 -62
- package/qy-tab-pane/index.d.ts +40 -40
- package/qy-table-column-settings/index.d.ts +18 -18
- package/qy-tabs/index.d.ts +84 -84
- package/qy-tree/index.d.ts +132 -132
- package/qy-tree-select/index.d.ts +123 -123
- package/qy-upload/index.d.ts +99 -5
- package/dist/shared/index-BkX9xlbI.cjs +0 -1
- package/dist/shared/index-C_1KP3l9.mjs +0 -129
- package/dist/shared/index-Dw5upK-A.cjs +0 -1
- package/dist/shared/index-fh9l84rU.mjs +0 -3541
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-5gku7Zwv.cjs +0 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-B0CXLnL1.mjs +0 -132
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DccRGtZE.cjs +0 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-M0qKRXd2.cjs +0 -1
- package/dist/shared/utils-D2KAQCCB.cjs +0 -1
- package/dist/shared/utils-DUntDntI.mjs +0 -112
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-q37rBg6Z.mjs → index.vue_vue_type_script_setup_true_lang-CGsXVhJy.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CglCPcj-.cjs → index.vue_vue_type_script_setup_true_lang-Dk83TGiU.cjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("vue"),re=require("element-plus"),ce=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie=n.defineComponent({name:"QyTreeSelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Object,Array,null],default:void 0},data:{default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},childrenKey:{default:"children"},disabledKey:{default:"disabled"},props:{default:()=>({})},nodeKey:{default:void 0},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},filterMethod:{type:Function,default:void 0},remote:{type:Boolean,default:!1},remoteMethod:{type:Function,default:void 0},remoteShowSuffix:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},multipleLimit:{default:0},collapseTags:{type:Boolean,default:!1},collapseTagsTooltip:{type:Boolean,default:!1},checkStrictly:{type:Boolean,default:!1},showCheckbox:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},renderAfterExpand:{type:Boolean,default:!0},expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:{type:Boolean,default:!1},checkOnClickLeaf:{type:Boolean,default:!0},checkDescendants:{type:Boolean,default:!1},defaultExpandedKeys:{default:void 0},defaultCheckedKeys:{default:void 0},accordion:{type:Boolean,default:!1},indent:{default:18},highlightCurrent:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},load:{type:Function,default:void 0},cacheData:{default:()=>[]},filterNodeMethod:{type:Function,default:void 0},size:{default:void 0},teleported:{type:Boolean,default:!0},appendTo:{default:void 0},fitInputWidth:{type:Boolean,default:!1},popperClass:{default:""}},emits:["update:modelValue","change","clear","visible-change","focus","blur","node-click","node-expand","node-collapse","check-change","check"],setup(a,{expose:D,emit:E}){const u=Symbol("invalid-tree-select-value"),o=a,c=E,O=n.useAttrs(),v=n.ref(null),y=n.computed(()=>o.data===void 0?o.options:o.data),M=n.ref(o.defaultExpandedKeys?[...o.defaultExpandedKeys]:void 0),j=n.ref(o.defaultCheckedKeys?[...o.defaultCheckedKeys]:void 0);let C=new WeakSet,p=new Set;n.watch(y,e=>{C=new WeakSet,p=new Set,S(e)},{immediate:!0,deep:!1});const T=n.computed(()=>Object.fromEntries(Object.entries(O).filter(([e])=>e==="class"||e==="style"||e==="id"||e==="title"||e.startsWith("data-")||e.startsWith("aria-")))),z=n.computed(()=>["qy-tree-select__popper",o.popperClass].filter(Boolean).join(" ")),$=n.computed(()=>{const e=x(o.modelValue);if(e!==u&&F(e)&&!o.nodeKey)throw new Error("QyTreeSelect object values require nodeKey");return e===u?void 0:ae(e)}),R=n.computed(()=>{const e=o.props??{};return{value:h(e.value??o.nodeKey??o.valueKey),label:h(e.label??o.labelKey),children:h(e.children??o.childrenKey),disabled:h(e.disabled??o.disabledKey),isLeaf:h(e.isLeaf),class:q(e.class)}});function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:k(e)?n.toRaw(e):u}function x(e){return e==null?e:Array.isArray(e)?e.every(t=>K(t)!==u)?e:u:K(e)}function F(e){return Array.isArray(e)?e.some(k):k(e)}function b(e){return k(e)?n.toRaw(e):null}function S(e){for(const t of e??[])w(t)}function w(e){const t=n.toRaw(e);C.add(t),p.add(t);const l=m("children",t);if(Array.isArray(l))for(const d of l){const r=b(d);r&&w(r)}}function i(e){const t=b(e);return t!==null&&C.has(t)}function m(e,t){var f;const l=(f=o.props)==null?void 0:f[e],d=e==="value"?o.valueKey:e==="label"?o.labelKey:e==="children"?o.childrenKey:e==="disabled"?o.disabledKey:void 0,r=l??d;return typeof r=="function"?r(t):typeof r=="string"?t[r]:void 0}function h(e){return typeof e=="function"?t=>e(t):e}function q(e){return typeof e!="function"?e:(t,l)=>{const d=s(l);return d&&i(t)?e(t,d):""}}function g(e){return typeof e=="string"||typeof e=="number"?e:null}function s(e){var l;if(!e||!i(e.data))return null;const t=b(e.data);return t?Object.freeze({key:g(e.key),parentKey:g((l=e.parent)==null?void 0:l.key),data:t,label:typeof e.label=="string"?e.label:String(m("label",t)??""),level:typeof e.level=="number"?e.level:0,expanded:e.expanded===!0,checked:e.checked===!0,indeterminate:e.indeterminate===!0,disabled:e.disabled===!0,leaf:e.isLeaf===!0,visible:e.visible!==!1,loading:e.loading===!0,loaded:e.loaded===!0,childCount:Array.isArray(e.childNodes)?e.childNodes.length:0}):null}function W(e){return Object.freeze({key:null,parentKey:null,data:{},label:"",level:0,expanded:!1,checked:!1,indeterminate:!1,disabled:!1,leaf:!1,visible:!0,loading:e.loading===!0,loaded:e.loaded===!0,childCount:Array.isArray(e.childNodes)?e.childNodes.length:0})}function I(e,t,l){const d=s(l);return!d||!i(t)?!1:o.filterNodeMethod?o.filterNodeMethod(e,t,d):String(d.label).toLocaleLowerCase().includes(String(e??"").toLocaleLowerCase())}function P(e,t,l){if(!o.load)return t([]);const d=e.level===0||e.data===void 0||e.data===null,r=y.value,f=s(e)??(d?W(e):null);if(!f)return l();o.load(f,L=>{(d?y.value!==r:!i(f.data))||(S(L),t(L))},l)}function U(e){const t=x(N(e));t!==u&&c("update:modelValue",t)}function Q(e){const t=x(N(e));t!==u&&c("change",t)}function H(){c("clear")}function G(e){c("visible-change",e)}function J(e){c("focus",e)}function X(e){c("blur",e)}function Y(e,t){const l=s(t);l&&i(e)&&c("node-click",e,l)}function Z(e,t){const l=s(t);l&&i(e)&&c("node-expand",e,l)}function _(e,t){const l=s(t);l&&i(e)&&c("node-collapse",e,l)}function ee(e,t,l){i(e)&&c("check-change",e,t,l)}function B(e){return(e??[]).map(b).filter(t=>t!==null&&i(t))}function A(e){return(e??[]).map(g).filter(t=>t!==null)}function te(e,t){i(e)&&c("check",e,{checkedKeys:A(t==null?void 0:t.checkedKeys),checkedNodes:B(t==null?void 0:t.checkedNodes),halfCheckedKeys:A(t==null?void 0:t.halfCheckedKeys),halfCheckedNodes:B(t==null?void 0:t.halfCheckedNodes)})}function V(e){for(const t of p)if(Object.is(n.toRaw(m("value",t)),n.toRaw(e)))return t}function le(e){if(o.nodeKey){for(const t of p)if(Object.is(t[o.nodeKey],e))return t}}function ae(e){if(!o.nodeKey||e===null||e===void 0)return e;const t=l=>{const d=V(l);return(d?g(d[o.nodeKey]):null)??l};return Array.isArray(e)?e.map(t):t(e)}function N(e){if(!o.nodeKey)return e;const t=l=>{const d=le(l);return d?m("value",d):l};return Array.isArray(e)?e.map(t):t(e)}function ne(e,t){return(e??[]).flatMap(l=>{const d=K(N(l.value));if(d===u)return[];const r=V(d);return[Object.freeze({value:d,label:typeof l.currentLabel=="string"?l.currentLabel:String(l.currentLabel??""),data:r?n.toRaw(r):void 0,closable:l.isDisabled!==!0,remove:()=>t==null?void 0:t(new MouseEvent("click"),l)})]})}function oe(){var e,t;(t=(e=v.value)==null?void 0:e.focus)==null||t.call(e)}function de(){var e,t;(t=(e=v.value)==null?void 0:e.blur)==null||t.call(e)}return D({focus:oe,blur:de}),(e,t)=>(n.openBlock(),n.createBlock(n.unref(re.ElTreeSelect),n.mergeProps({ref_key:"treeSelectRef",ref:v,class:"qy-tree-select"},T.value,{"model-value":$.value,data:y.value,props:R.value,"node-key":a.nodeKey,placeholder:a.placeholder,disabled:a.disabled,clearable:a.clearable,filterable:a.filterable,"filter-method":a.filterMethod,remote:a.remote,"remote-method":a.remoteMethod,"remote-show-suffix":a.remoteShowSuffix,loading:a.loading,multiple:a.multiple,"multiple-limit":a.multipleLimit,"collapse-tags":a.collapseTags,"collapse-tags-tooltip":a.collapseTagsTooltip,"check-strictly":a.checkStrictly,"show-checkbox":a.showCheckbox,"default-expand-all":a.defaultExpandAll,"render-after-expand":a.renderAfterExpand,"expand-on-click-node":a.expandOnClickNode,"check-on-click-node":a.checkOnClickNode,"check-on-click-leaf":a.checkOnClickLeaf,"check-descendants":a.checkDescendants,"default-expanded-keys":M.value,"default-checked-keys":j.value,accordion:a.accordion,indent:a.indent,"highlight-current":a.highlightCurrent,lazy:a.lazy,load:P,"cache-data":a.cacheData,"filter-node-method":I,size:a.size,teleported:a.teleported,"append-to":a.appendTo,"fit-input-width":a.fitInputWidth,"popper-class":z.value,"onUpdate:modelValue":U,onChange:Q,onClear:H,onVisibleChange:G,onFocus:J,onBlur:X,onNodeClick:Y,onNodeExpand:Z,onNodeCollapse:_,onCheckChange:ee,onCheck:te}),n.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.empty?{name:"empty",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"empty",{},void 0,!0)]),key:"1"}:void 0,e.$slots.loading?{name:"loading",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"loading",{},void 0,!0)]),key:"2"}:void 0,e.$slots.default?{name:"default",fn:n.withCtx(l=>[n.renderSlot(e.$slots,"default",{data:l.data,node:s(l.node)},void 0,!0)]),key:"3"}:void 0,e.$slots.tag?{name:"tag",fn:n.withCtx(l=>[n.renderSlot(e.$slots,"tag",{data:ne(l.data,l.deleteTag)},void 0,!0)]),key:"4"}:void 0]),1040,["model-value","data","props","node-key","placeholder","disabled","clearable","filterable","filter-method","remote","remote-method","remote-show-suffix","loading","multiple","multiple-limit","collapse-tags","collapse-tags-tooltip","check-strictly","show-checkbox","default-expand-all","render-after-expand","expand-on-click-node","check-on-click-node","check-on-click-leaf","check-descendants","default-expanded-keys","default-checked-keys","accordion","indent","highlight-current","lazy","cache-data","size","teleported","append-to","fit-input-width","popper-class"]))}}),ue=ce._export_sfc(ie,[["__scopeId","data-v-
|
|
1
|
+
"use strict";const n=require("vue"),re=require("element-plus"),ce=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie=n.defineComponent({name:"QyTreeSelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Object,Array,null],default:void 0},data:{default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},childrenKey:{default:"children"},disabledKey:{default:"disabled"},props:{default:()=>({})},nodeKey:{default:void 0},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},filterMethod:{type:Function,default:void 0},remote:{type:Boolean,default:!1},remoteMethod:{type:Function,default:void 0},remoteShowSuffix:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},multipleLimit:{default:0},collapseTags:{type:Boolean,default:!1},collapseTagsTooltip:{type:Boolean,default:!1},checkStrictly:{type:Boolean,default:!1},showCheckbox:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},renderAfterExpand:{type:Boolean,default:!0},expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:{type:Boolean,default:!1},checkOnClickLeaf:{type:Boolean,default:!0},checkDescendants:{type:Boolean,default:!1},defaultExpandedKeys:{default:void 0},defaultCheckedKeys:{default:void 0},accordion:{type:Boolean,default:!1},indent:{default:18},highlightCurrent:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},load:{type:Function,default:void 0},cacheData:{default:()=>[]},filterNodeMethod:{type:Function,default:void 0},size:{default:void 0},teleported:{type:Boolean,default:!0},appendTo:{default:void 0},fitInputWidth:{type:Boolean,default:!1},popperClass:{default:""}},emits:["update:modelValue","change","clear","visible-change","focus","blur","node-click","node-expand","node-collapse","check-change","check"],setup(a,{expose:D,emit:E}){const u=Symbol("invalid-tree-select-value"),o=a,c=E,O=n.useAttrs(),v=n.ref(null),y=n.computed(()=>o.data===void 0?o.options:o.data),M=n.ref(o.defaultExpandedKeys?[...o.defaultExpandedKeys]:void 0),j=n.ref(o.defaultCheckedKeys?[...o.defaultCheckedKeys]:void 0);let C=new WeakSet,p=new Set;n.watch(y,e=>{C=new WeakSet,p=new Set,S(e)},{immediate:!0,deep:!1});const T=n.computed(()=>Object.fromEntries(Object.entries(O).filter(([e])=>e==="class"||e==="style"||e==="id"||e==="title"||e.startsWith("data-")||e.startsWith("aria-")))),z=n.computed(()=>["qy-tree-select__popper",o.popperClass].filter(Boolean).join(" ")),$=n.computed(()=>{const e=x(o.modelValue);if(e!==u&&F(e)&&!o.nodeKey)throw new Error("QyTreeSelect object values require nodeKey");return e===u?void 0:ae(e)}),R=n.computed(()=>{const e=o.props??{};return{value:h(e.value??o.nodeKey??o.valueKey),label:h(e.label??o.labelKey),children:h(e.children??o.childrenKey),disabled:h(e.disabled??o.disabledKey),isLeaf:h(e.isLeaf),class:q(e.class)}});function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:k(e)?n.toRaw(e):u}function x(e){return e==null?e:Array.isArray(e)?e.every(t=>K(t)!==u)?e:u:K(e)}function F(e){return Array.isArray(e)?e.some(k):k(e)}function b(e){return k(e)?n.toRaw(e):null}function S(e){for(const t of e??[])w(t)}function w(e){const t=n.toRaw(e);C.add(t),p.add(t);const l=m("children",t);if(Array.isArray(l))for(const d of l){const r=b(d);r&&w(r)}}function i(e){const t=b(e);return t!==null&&C.has(t)}function m(e,t){var f;const l=(f=o.props)==null?void 0:f[e],d=e==="value"?o.valueKey:e==="label"?o.labelKey:e==="children"?o.childrenKey:e==="disabled"?o.disabledKey:void 0,r=l??d;return typeof r=="function"?r(t):typeof r=="string"?t[r]:void 0}function h(e){return typeof e=="function"?t=>e(t):e}function q(e){return typeof e!="function"?e:(t,l)=>{const d=s(l);return d&&i(t)?e(t,d):""}}function g(e){return typeof e=="string"||typeof e=="number"?e:null}function s(e){var l;if(!e||!i(e.data))return null;const t=b(e.data);return t?Object.freeze({key:g(e.key),parentKey:g((l=e.parent)==null?void 0:l.key),data:t,label:typeof e.label=="string"?e.label:String(m("label",t)??""),level:typeof e.level=="number"?e.level:0,expanded:e.expanded===!0,checked:e.checked===!0,indeterminate:e.indeterminate===!0,disabled:e.disabled===!0,leaf:e.isLeaf===!0,visible:e.visible!==!1,loading:e.loading===!0,loaded:e.loaded===!0,childCount:Array.isArray(e.childNodes)?e.childNodes.length:0}):null}function W(e){return Object.freeze({key:null,parentKey:null,data:{},label:"",level:0,expanded:!1,checked:!1,indeterminate:!1,disabled:!1,leaf:!1,visible:!0,loading:e.loading===!0,loaded:e.loaded===!0,childCount:Array.isArray(e.childNodes)?e.childNodes.length:0})}function I(e,t,l){const d=s(l);return!d||!i(t)?!1:o.filterNodeMethod?o.filterNodeMethod(e,t,d):String(d.label).toLocaleLowerCase().includes(String(e??"").toLocaleLowerCase())}function P(e,t,l){if(!o.load)return t([]);const d=e.level===0||e.data===void 0||e.data===null,r=y.value,f=s(e)??(d?W(e):null);if(!f)return l();o.load(f,L=>{(d?y.value!==r:!i(f.data))||(S(L),t(L))},l)}function U(e){const t=x(N(e));t!==u&&c("update:modelValue",t)}function Q(e){const t=x(N(e));t!==u&&c("change",t)}function H(){c("clear")}function G(e){c("visible-change",e)}function J(e){c("focus",e)}function X(e){c("blur",e)}function Y(e,t){const l=s(t);l&&i(e)&&c("node-click",e,l)}function Z(e,t){const l=s(t);l&&i(e)&&c("node-expand",e,l)}function _(e,t){const l=s(t);l&&i(e)&&c("node-collapse",e,l)}function ee(e,t,l){i(e)&&c("check-change",e,t,l)}function B(e){return(e??[]).map(b).filter(t=>t!==null&&i(t))}function A(e){return(e??[]).map(g).filter(t=>t!==null)}function te(e,t){i(e)&&c("check",e,{checkedKeys:A(t==null?void 0:t.checkedKeys),checkedNodes:B(t==null?void 0:t.checkedNodes),halfCheckedKeys:A(t==null?void 0:t.halfCheckedKeys),halfCheckedNodes:B(t==null?void 0:t.halfCheckedNodes)})}function V(e){for(const t of p)if(Object.is(n.toRaw(m("value",t)),n.toRaw(e)))return t}function le(e){if(o.nodeKey){for(const t of p)if(Object.is(t[o.nodeKey],e))return t}}function ae(e){if(!o.nodeKey||e===null||e===void 0)return e;const t=l=>{const d=V(l);return(d?g(d[o.nodeKey]):null)??l};return Array.isArray(e)?e.map(t):t(e)}function N(e){if(!o.nodeKey)return e;const t=l=>{const d=le(l);return d?m("value",d):l};return Array.isArray(e)?e.map(t):t(e)}function ne(e,t){return(e??[]).flatMap(l=>{const d=K(N(l.value));if(d===u)return[];const r=V(d);return[Object.freeze({value:d,label:typeof l.currentLabel=="string"?l.currentLabel:String(l.currentLabel??""),data:r?n.toRaw(r):void 0,closable:l.isDisabled!==!0,remove:()=>t==null?void 0:t(new MouseEvent("click"),l)})]})}function oe(){var e,t;(t=(e=v.value)==null?void 0:e.focus)==null||t.call(e)}function de(){var e,t;(t=(e=v.value)==null?void 0:e.blur)==null||t.call(e)}return D({focus:oe,blur:de}),(e,t)=>(n.openBlock(),n.createBlock(n.unref(re.ElTreeSelect),n.mergeProps({ref_key:"treeSelectRef",ref:v,class:"qy-tree-select"},T.value,{"model-value":$.value,data:y.value,props:R.value,"node-key":a.nodeKey,placeholder:a.placeholder,disabled:a.disabled,clearable:a.clearable,filterable:a.filterable,"filter-method":a.filterMethod,remote:a.remote,"remote-method":a.remoteMethod,"remote-show-suffix":a.remoteShowSuffix,loading:a.loading,multiple:a.multiple,"multiple-limit":a.multipleLimit,"collapse-tags":a.collapseTags,"collapse-tags-tooltip":a.collapseTagsTooltip,"check-strictly":a.checkStrictly,"show-checkbox":a.showCheckbox,"default-expand-all":a.defaultExpandAll,"render-after-expand":a.renderAfterExpand,"expand-on-click-node":a.expandOnClickNode,"check-on-click-node":a.checkOnClickNode,"check-on-click-leaf":a.checkOnClickLeaf,"check-descendants":a.checkDescendants,"default-expanded-keys":M.value,"default-checked-keys":j.value,accordion:a.accordion,indent:a.indent,"highlight-current":a.highlightCurrent,lazy:a.lazy,load:P,"cache-data":a.cacheData,"filter-node-method":I,size:a.size,teleported:a.teleported,"append-to":a.appendTo,"fit-input-width":a.fitInputWidth,"popper-class":z.value,"onUpdate:modelValue":U,onChange:Q,onClear:H,onVisibleChange:G,onFocus:J,onBlur:X,onNodeClick:Y,onNodeExpand:Z,onNodeCollapse:_,onCheckChange:ee,onCheck:te}),n.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.empty?{name:"empty",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"empty",{},void 0,!0)]),key:"1"}:void 0,e.$slots.loading?{name:"loading",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"loading",{},void 0,!0)]),key:"2"}:void 0,e.$slots.default?{name:"default",fn:n.withCtx(l=>[n.renderSlot(e.$slots,"default",{data:l.data,node:s(l.node)},void 0,!0)]),key:"3"}:void 0,e.$slots.tag?{name:"tag",fn:n.withCtx(l=>[n.renderSlot(e.$slots,"tag",{data:ne(l.data,l.deleteTag)},void 0,!0)]),key:"4"}:void 0]),1040,["model-value","data","props","node-key","placeholder","disabled","clearable","filterable","filter-method","remote","remote-method","remote-show-suffix","loading","multiple","multiple-limit","collapse-tags","collapse-tags-tooltip","check-strictly","show-checkbox","default-expand-all","render-after-expand","expand-on-click-node","check-on-click-node","check-on-click-leaf","check-descendants","default-expanded-keys","default-checked-keys","accordion","indent","highlight-current","lazy","cache-data","size","teleported","append-to","fit-input-width","popper-class"]))}}),ue=ce._export_sfc(ie,[["__scopeId","data-v-daef2030"]]);exports.TreeSelect=ue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as L, ref as g, computed as a, watch as P, openBlock as _, createElementBlock as $, normalizeStyle as N, normalizeClass as Q, createBlock as V, unref as i, withCtx as n, renderSlot as p, createElementVNode as c, createVNode as u, createCommentVNode as j } from "vue";
|
|
2
2
|
import { ElImage as D, ElIcon as w } from "element-plus";
|
|
3
3
|
import { PictureFilled as z } from "@element-plus/icons-vue";
|
|
4
|
-
import { n as I, r as F, o as O } from "./utils-
|
|
4
|
+
import { n as I, r as F, o as O } from "./utils-DoyI5oM8.mjs";
|
|
5
5
|
import { _ as R } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
6
6
|
const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-image__state qy-image__state--empty" }, G = /* @__PURE__ */ L({
|
|
7
7
|
name: "QyImage",
|
|
@@ -29,16 +29,16 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
29
29
|
})), S = a(() => ({
|
|
30
30
|
width: h(v.value.width),
|
|
31
31
|
height: h(v.value.height)
|
|
32
|
-
})),
|
|
32
|
+
})), k = a(() => e.placeholder || l.value), y = a(() => e.preview && !!f.value), B = a(() => (e.previewList.length ? e.previewList : [e.src]).map((r) => I(r)).filter(Boolean));
|
|
33
33
|
P(
|
|
34
34
|
() => [e.src, e.compressor],
|
|
35
|
-
|
|
35
|
+
E,
|
|
36
36
|
{
|
|
37
37
|
immediate: !0,
|
|
38
38
|
deep: !0
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
|
-
async function
|
|
41
|
+
async function E() {
|
|
42
42
|
const t = ++m;
|
|
43
43
|
if (o.value = "", l.value = !1, !!e.src)
|
|
44
44
|
try {
|
|
@@ -52,7 +52,7 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
52
52
|
l.value = !1, o.value = f.value;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function b(t) {
|
|
56
56
|
s("load", t);
|
|
57
57
|
}
|
|
58
58
|
function x(t) {
|
|
@@ -60,7 +60,7 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
60
60
|
}
|
|
61
61
|
function C() {
|
|
62
62
|
y.value && (O({
|
|
63
|
-
urlList:
|
|
63
|
+
urlList: B.value,
|
|
64
64
|
initialIndex: e.initialIndex
|
|
65
65
|
}), s("preview", f.value));
|
|
66
66
|
}
|
|
@@ -78,7 +78,7 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
78
78
|
src: o.value,
|
|
79
79
|
fit: d.fit,
|
|
80
80
|
lazy: d.lazy,
|
|
81
|
-
onLoad:
|
|
81
|
+
onLoad: b,
|
|
82
82
|
onError: x
|
|
83
83
|
}, {
|
|
84
84
|
placeholder: n(() => [
|
|
@@ -101,7 +101,7 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
101
101
|
], !0)
|
|
102
102
|
]),
|
|
103
103
|
_: 3
|
|
104
|
-
}, 8, ["src", "fit", "lazy"])) :
|
|
104
|
+
}, 8, ["src", "fit", "lazy"])) : k.value ? p(t.$slots, "empty", {}, () => [
|
|
105
105
|
c("div", A, [
|
|
106
106
|
u(i(w), { size: 20 }, {
|
|
107
107
|
default: n(() => [
|
|
@@ -113,7 +113,7 @@ const U = { class: "qy-image__state qy-image__state--error" }, A = { class: "qy-
|
|
|
113
113
|
], !0, 1) : j("", !0)
|
|
114
114
|
], 6));
|
|
115
115
|
}
|
|
116
|
-
}), W = /* @__PURE__ */ R(G, [["__scopeId", "data-v-
|
|
116
|
+
}), W = /* @__PURE__ */ R(G, [["__scopeId", "data-v-02c4930c"]]);
|
|
117
117
|
export {
|
|
118
118
|
W as I
|
|
119
119
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineComponent as q, ref as p, computed as B, openBlock as c, createElementBlock as u, normalizeClass as g, createVNode as S, withCtx as I, createElementVNode as h, withModifiers as t, withKeys as y, toDisplayString as K, createCommentVNode as k } from "vue";
|
|
2
|
+
import { U as M } from "./index-BYX0biqw.mjs";
|
|
3
|
+
import { _ as N } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const U = ["tabindex", "aria-disabled", "onClick", "onKeydown"], _ = { class: "qy-file-picker__label" }, E = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "qy-file-picker__hint"
|
|
7
|
+
}, P = ["disabled"], R = /* @__PURE__ */ q({
|
|
8
|
+
name: "QyFilePicker",
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: { default: null },
|
|
12
|
+
extensions: { default: () => [] },
|
|
13
|
+
maxSizeMb: { default: 20 },
|
|
14
|
+
disabled: { type: Boolean, default: !1 },
|
|
15
|
+
drag: { type: Boolean, default: !0 },
|
|
16
|
+
placeholder: { default: "请选择文件" }
|
|
17
|
+
},
|
|
18
|
+
emits: ["update:modelValue", "change", "clear", "invalid"],
|
|
19
|
+
setup(e, { expose: x, emit: V }) {
|
|
20
|
+
const a = e, i = V, d = p(null), n = p(!1), D = B(() => a.modelValue ? [a.modelValue] : []);
|
|
21
|
+
let o = !1;
|
|
22
|
+
function C() {
|
|
23
|
+
var l;
|
|
24
|
+
a.disabled || (l = d.value) == null || l.openFileDialog();
|
|
25
|
+
}
|
|
26
|
+
function f() {
|
|
27
|
+
var l;
|
|
28
|
+
o = !0, (l = d.value) == null || l.clearFiles(), o = !1, i("update:modelValue", null), i("change", null), i("clear");
|
|
29
|
+
}
|
|
30
|
+
function F() {
|
|
31
|
+
a.disabled || f();
|
|
32
|
+
}
|
|
33
|
+
function m() {
|
|
34
|
+
!a.disabled && a.drag && (n.value = !0);
|
|
35
|
+
}
|
|
36
|
+
function b() {
|
|
37
|
+
n.value = !1;
|
|
38
|
+
}
|
|
39
|
+
function w(l) {
|
|
40
|
+
if (o) return;
|
|
41
|
+
const s = l[0] ?? null;
|
|
42
|
+
i("update:modelValue", s), i("change", s);
|
|
43
|
+
}
|
|
44
|
+
function z(l) {
|
|
45
|
+
i("invalid", l);
|
|
46
|
+
}
|
|
47
|
+
return x({
|
|
48
|
+
openFileDialog: C,
|
|
49
|
+
clear: f
|
|
50
|
+
}), (l, s) => (c(), u("div", {
|
|
51
|
+
class: g(["qy-file-picker", { "is-disabled": e.disabled, "is-dragover": n.value }])
|
|
52
|
+
}, [
|
|
53
|
+
S(M, {
|
|
54
|
+
ref_key: "uploadRef",
|
|
55
|
+
ref: d,
|
|
56
|
+
variant: "file-list",
|
|
57
|
+
"auto-upload": !1,
|
|
58
|
+
"selected-files": D.value,
|
|
59
|
+
"file-type": e.extensions,
|
|
60
|
+
"file-size": e.maxSizeMb,
|
|
61
|
+
disabled: e.disabled,
|
|
62
|
+
"disable-drag": !e.drag,
|
|
63
|
+
multiple: !1,
|
|
64
|
+
limit: 1,
|
|
65
|
+
"show-text": !1,
|
|
66
|
+
"show-paste-input": !1,
|
|
67
|
+
"onUpdate:selectedFiles": w,
|
|
68
|
+
onInvalid: z
|
|
69
|
+
}, {
|
|
70
|
+
trigger: I(({ open: r }) => {
|
|
71
|
+
var v;
|
|
72
|
+
return [
|
|
73
|
+
h("div", {
|
|
74
|
+
class: g(["qy-file-picker__dropzone", { "is-click-only": !e.drag }]),
|
|
75
|
+
role: "button",
|
|
76
|
+
tabindex: e.disabled ? -1 : 0,
|
|
77
|
+
"aria-disabled": e.disabled ? "true" : void 0,
|
|
78
|
+
onClick: r,
|
|
79
|
+
onKeydown: [
|
|
80
|
+
y(t(r, ["prevent"]), ["enter"]),
|
|
81
|
+
y(t(r, ["prevent"]), ["space"])
|
|
82
|
+
],
|
|
83
|
+
onDragenter: t(m, ["prevent"]),
|
|
84
|
+
onDragover: t(m, ["prevent"]),
|
|
85
|
+
onDragleave: t(b, ["prevent"]),
|
|
86
|
+
onDrop: b
|
|
87
|
+
}, [
|
|
88
|
+
h("span", _, K(((v = e.modelValue) == null ? void 0 : v.name) || e.placeholder), 1),
|
|
89
|
+
e.drag ? (c(), u("span", E, " 点击选择或拖拽单个文件到此处 ")) : k("", !0)
|
|
90
|
+
], 42, U)
|
|
91
|
+
];
|
|
92
|
+
}),
|
|
93
|
+
_: 1
|
|
94
|
+
}, 8, ["selected-files", "file-type", "file-size", "disabled", "disable-drag"]),
|
|
95
|
+
e.modelValue ? (c(), u("button", {
|
|
96
|
+
key: 0,
|
|
97
|
+
class: "qy-file-picker__clear",
|
|
98
|
+
type: "button",
|
|
99
|
+
disabled: e.disabled,
|
|
100
|
+
onClick: t(F, ["stop"])
|
|
101
|
+
}, " 清空 ", 8, P)) : k("", !0)
|
|
102
|
+
], 2));
|
|
103
|
+
}
|
|
104
|
+
}), G = /* @__PURE__ */ N(R, [["__scopeId", "data-v-71a5d74d"]]);
|
|
105
|
+
export {
|
|
106
|
+
G as F
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("element-plus"),l=require("vue"),de=require("@element-plus/icons-vue"),g=require("element-plus"),Le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");/*! js-cookie v3.0.8 | MIT */function E(r){for(var x=1;x<arguments.length;x++){var k=arguments[x];for(var a in k)a!=="__proto__"&&(r[a]=k[a])}return r}var Ie={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function H(r,x){function k(u,V,f){if(!(typeof document>"u")){f=E({},x,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var y="";for(var s in f)f[s]&&(y+="; "+s,f[s]!==!0&&(y+="="+f[s].split(";")[0]));return document.cookie=u+"="+r.write(V,u)+y}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var V=document.cookie?document.cookie.split("; "):[],f={},y=0;y<V.length;y++){var s=V[y].split("="),S=s.slice(1).join("=");try{var b=decodeURIComponent(s[0]);if(b in f||(f[b]=r.read(S,b)),u===b)break}catch{}}return u?f[u]:f}}return Object.create({set:k,get:a,remove:function(u,V){k(u,"",E({},V,{expires:-1}))},withAttributes:function(u){return H(this.converter,E({},this.attributes,u))},withConverter:function(u){return H(E({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(x)},converter:{value:Object.freeze(r)}})}var ce=H(Ie,{path:"/"});const Ae="Admin-Token";function Pe(r=Ae){return ce.get(r)}const _e=["accept","multiple","disabled"],Oe=["disabled"],$e={class:"qy-upload__hint"},Ke=["placeholder","disabled"],We=["src"],He={key:1,class:"qy-upload__tip"},Xe={class:"error"},Je={class:"error"},Qe=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},selectedFiles:{type:Array,default:()=>[]},autoUpload:{type:Boolean,default:!0},variant:{type:String,default:"media-card"},defaultValue:{type:Object,default:()=>({files:"",text:""})},valueFormat:{type:String,default:"object"},showText:{type:Boolean,default:!0},showPasteInput:{type:Boolean,default:!1},pastePlaceholder:{type:String,default:"输入文字"},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})},uploadRequest:{type:Function,default:null}},emits:["update:modelValue","update:selectedFiles","selectedFilesChange","change","success","error","remove","invalid"],setup(r,{expose:x,emit:k}){const a=r,u=k,V=l.ref(null),f=l.ref(null),y=l.ref(null),s=l.ref([]),S=l.ref(null),b=l.ref(null),U=[],X=new WeakMap;let L=Date.now(),I=!1;const A=l.ref(!1),P=l.ref([]),J=l.ref(0),B=l.ref(!1),Q=l.ref(""),G=l.ref(""),q=new Set,D=l.ref(!1),h=l.ref(""),_=l.ref(!1);l.onMounted(()=>{a.modelValue!==void 0||!a.autoUpload||ee(a.defaultValue)});const pe=l.computed(()=>({large:"160px",default:"140px",small:"80px"})[a.size]??a.size),T=l.computed(()=>a.disabled),fe=l.computed(()=>s.value.some(e=>e.status==="uploading")),me=l.computed(()=>a.variant==="file-list"||a.supportVideo?"text":"picture-card"),ve=l.computed(()=>a.supportVideo?1:!a.autoUpload&&!a.multiple?2:a.limit),ge=l.computed(()=>{var e;return a.isShowTip&&(a.fileSize||((e=w.value)==null?void 0:e.length))}),w=l.computed(()=>{var e;return(e=a.fileType)!=null&&e.length?a.fileType.map(t=>String(t).trim().replace(/^\./,"").toLowerCase()).filter(Boolean):a.variant==="file-list"?[]:a.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),j=l.computed(()=>{if(!a.autoUpload&&!a.multiple)return!1;const e=a.supportVideo?1:a.limit;return s.value.length>=e}),Y=l.computed(()=>w.value.map(e=>`.${e}`).join(",")),ye=l.computed(()=>({"qy-upload--reached-limit":j.value,"qy-upload--disabled":a.disabled,"qy-upload--video":a.supportVideo,"qy-upload--without-text":!a.showText&&!a.showPasteInput}));l.watch(h,()=>{I||F()}),l.watch(()=>a.modelValue,e=>{a.autoUpload&&e!==void 0&&ee(e)},{immediate:!0,deep:!0}),l.watch(()=>[a.autoUpload,a.selectedFiles],([e,t])=>{e||(s.value=R(t))},{immediate:!0,deep:!0});function Z(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function he(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:Z(e),text:""}:e&&typeof e=="object"?{files:Z(e.files),text:e.text??""}:{files:[],text:""}}function we(e=[]){return e.map((t,n)=>({name:String(t).split("/").pop()||`file-${n}`,url:t,status:"success",uid:Date.now()+n}))}function R(e=[]){return e.filter(Boolean).map((t,n)=>{const i=l.toRaw(t);return{name:i.name,raw:i,status:"ready",uid:xe(i,n)}})}function xe(e,t){if(e.uid!=null)return e.uid;const n=X.get(e);return n??(L+=t+1,X.set(e,L),L)}function O(e=s.value){return e.map(t=>{const n=t.raw??(t instanceof File?t:null);return n?l.toRaw(n):null}).filter(Boolean)}function z(e){u("update:selectedFiles",e),u("selectedFilesChange",e)}function Ve(e,t){if(a.autoUpload)return;const n=e==null?void 0:e.raw;if(n&&!$(n)){s.value=R(a.selectedFiles);return}const i=O(t);n&&!i.includes(n)&&i.push(n);const o=a.multiple?i:i.slice(-1);s.value=R(o),z(o)}function ke(e){const t=new Set(e.map(i=>i.url)),n=s.value.filter(i=>i.status==="uploading"&&!t.has(i.url));return[...e,...n]}function ee(e){const t=he(e);I=!0,h.value=t.text,s.value=ke(we(t.files)),l.nextTick(()=>{I=!1})}function te(e){return a.valueFormat==="array"?e.files:a.valueFormat==="string"?e.files.join(","):e}function be(){var e;(e=S.value)==null||e.focus()}function Ue(e){e.target.value=""}function F(e){const i={files:(e??s.value).filter(o=>o.status==="success"&&o.url).map(o=>o.url),text:h.value};u("update:modelValue",te(i)),u("change",i),a.callBack&&a.callBack(i)}function Ce(e,t){if(!a.autoUpload){const n=O(t);s.value=R(n),z(n),u("remove",e,t);return}F(t),u("remove",e,t)}function le(e){var n;const t=(e==null?void 0:e.name)||"";return t.includes(".")&&((n=t.split(".").pop())==null?void 0:n.toLowerCase())||""}function ne(e){var o,d,p;const t=((d=(o=e==null?void 0:e.type)==null?void 0:o.toLowerCase)==null?void 0:d.call(o))||"",n={"image/jpeg":["jpg","jpeg"],"image/png":["png"],"image/gif":["gif"],"image/bmp":["bmp"],"image/webp":["webp"],"video/mp4":["mp4"],"video/quicktime":["mov"],"video/x-msvideo":["avi"],"video/webm":["webm"]};if(n[t])return n[t];const i=(p=t.split("/")[1])==null?void 0:p.split("+")[0];return i?[i]:[]}function Be(e){if(!w.value.length)return!0;const t=le(e),n=ne(e);return[t,...n].some(i=>w.value.includes(i))}function $(e){if(a.fileSize>0&&e.size>a.fileSize*1024*1024){const n={code:"size",file:e,message:`文件大小不能超过${a.fileSize}M`};return g.ElMessage.warning(n.message),u("invalid",n),!1}if(!Be(e)){const n={code:"extension",file:e,message:`格式不支持,仅允许: ${w.value.join("/")}`};return g.ElMessage.warning(n.message),u("invalid",n),!1}return!0}async function Re(e,t,n,i){const o=ae(e);try{const d=await a.uploadRequest({file:e,formData:o,api:a.api,name:a.name,tokenKey:a.tokenKey,extraData:a.extraData}),p=Fe(d);if(!p){const c=new Error("上传失败,未返回文件地址");g.ElMessage.error(c.message),u("error",c),n==null||n(c);return}g.ElMessage.success("上传成功"),t==null||t({...typeof d=="object"&&d?d:{},url:p})}catch(d){g.ElMessage.error("上传失败"),u("error",d),n==null||n(d)}finally{i.close()}}function ae(e){const t=new FormData;return t.append(a.name,e),a.extraData&&Object.entries(a.extraData).forEach(([n,i])=>t.append(n,i)),t}function Fe(e){var i,o;if(typeof e=="string")return e;const t=e||{},n=t.urls??t.url??((i=t.data)==null?void 0:i.urls)??((o=t.data)==null?void 0:o.url)??"";return Array.isArray(n)?n[0]||"":n||""}function ie(e,t,n,i){const o=g.ElLoading.service({target:f.value,text:"上传中",background:"rgba(255,255,255,0.7)"});if(a.uploadRequest){Re(e,n,i,o);return}const d=a.api.startsWith("http")?a.api:window.location.origin+a.api.replace(/^([^/])/,"/$1"),p=ae(e),c=new XMLHttpRequest;U.push(c);const N=()=>{const m=U.indexOf(c);m!==-1&&U.splice(m,1),o.close()};c.open("POST",d);const v=Pe(a.tokenKey);v&&c.setRequestHeader("Authorization",`Bearer ${v}`),c.upload.onprogress=m=>{m.total>0&&(t==null||t({percent:m.loaded/m.total*100}))},c.onload=()=>{if(N(),c.status<200||c.status>=300){const m=`上传失败 (HTTP ${c.status})`;g.ElMessage.error(m),u("error",{msg:m,status:c.status}),i==null||i(new Error(m));return}try{const m=JSON.parse(c.responseText);m.code===200&&m.urls?(g.ElMessage.success("上传成功"),n==null||n({...m,url:m.urls})):(g.ElMessage.error(m.msg||"上传失败"),u("error",m),i==null||i(m))}catch{g.ElMessage.error("上传失败,响应格式错误"),u("error",new Error("Response parse error")),i==null||i(new Error("Response parse error"))}},c.onerror=()=>{N(),g.ElMessage.error("上传失败,网络异常"),u("error",new Error("Network error")),i==null||i(new Error("Network error"))},c.send(p)}function oe(e){return a.disabled?!1:$(e)}function Me(e,t){const n=s.value.find(i=>{var o;return i.uid===(e==null?void 0:e.uid)||((o=i.raw)==null?void 0:o.uid)===(e==null?void 0:e.uid)});n&&(n.url=t,n.status="success")}function Ne(e){ie(e.file,e.onProgress,t=>{Me(e.file,t.url),e.onSuccess(t),F(),u("success",t)},t=>e.onError(t))}function Se(e){var i;if(!e.url)return;const t=((i=e.url.split(".").pop())==null?void 0:i.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){Q.value=e.url,G.value=e.name||"视频预览",B.value=!0;return}const n=s.value.filter(o=>{var d;return o.status==="success"&&o.url&&!["mp4","mov","avi","webm"].includes((d=o.url.split(".").pop())==null?void 0:d.toLowerCase())});P.value=n.map(o=>o.url),J.value=n.findIndex(o=>o.uid===e.uid)||0,A.value=!0}function qe(){A.value=!1,P.value=[]}function De(e,t){if(e.name&&le(e))return e;const n=ne(e).find(i=>w.value.includes(i));return n?new File([e],`paste-${Date.now()+t}.${n}`,{type:e.type,lastModified:e.lastModified}):e}function K(e){if(!a.autoUpload){const t=O(),n=e.filter(o=>$(o));if(!n.length)return;const i=a.multiple?[...t,...n].slice(0,a.limit):n.slice(-1);s.value=R(i),z(i);return}for(let t=0;t<e.length;t++){const n=De(e[t],t);if(!oe(n))continue;const i=Date.now()+t,o=URL.createObjectURL(n);q.add(o),s.value.push({uid:i,name:n.name||`file-${i}`,status:"uploading",percentage:0,url:o}),ie(n,d=>{const p=s.value.find(c=>c.uid===i);p&&(p.percentage=d.percent)},d=>{const p=s.value.find(c=>c.uid===i);p&&(p.status="success",p.url=d.url,F(),u("success",d))},()=>ze(i))}}function Te(e){const t=e.target,n=Array.from(t.files||[]);if(t.value="",a.disabled||!n.length)return;const i=a.supportVideo||!a.multiple?n.slice(0,1):n;K(i)}function je(e){const t=Array.from((e==null?void 0:e.files)||[]).filter(d=>{var p;return(p=d.type)==null?void 0:p.startsWith("image/")});if(t.length)return t;const n=e==null?void 0:e.items;if(!n)return[];const i=[],o=new Set;for(let d=0;d<n.length;d++){const p=n[d];if(p.kind==="file"&&p.type.startsWith("image/")){const c=p.getAsFile();c&&!o.has(c)&&(o.add(c),i.push(c))}}return i}function M(e){if(a.disabled)return;const t=je(e.clipboardData);t.length&&(e.preventDefault(),K(t))}function re(){a.disabled||a.disableDrag||(D.value=!0)}function se(){D.value=!1}function ue(e){var n;if(D.value=!1,a.disabled||a.disableDrag||j.value)return;const t=Array.from(((n=e.dataTransfer)==null?void 0:n.files)||[]);t.length&&K(t)}function ze(e){var n;const t=s.value.findIndex(i=>i.uid===e);t!==-1&&((n=s.value[t].url)!=null&&n.startsWith("blob:")&&(URL.revokeObjectURL(s.value[t].url),q.delete(s.value[t].url)),s.value.splice(t,1))}l.onBeforeUnmount(()=>{U.forEach(e=>e.abort()),U.length=0,q.forEach(e=>URL.revokeObjectURL(e)),q.clear()});function W(){var e;a.disabled||j.value||(e=y.value)==null||e.click()}function Ee(){s.value=[],h.value="",z([]),a.autoUpload&&F()}return x({openFileDialog:W,getPathList:()=>s.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:Ee,getValue:()=>({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value}),getModelValue:()=>te({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value})}),(e,t)=>{var N;const n=C.ElIcon,i=C.ElInput,o=C.ElPopover,d=C.ElUpload,p=C.ElImageViewer,c=C.ElDialog;return l.openBlock(),l.createElementBlock("div",{ref_key:"rootRef",ref:f,class:l.normalizeClass(["qy-upload",ye.value]),style:l.normalizeStyle({"--qy-upload-size":pe.value})},[l.createElementVNode("input",{ref_key:"nativeInputRef",ref:y,class:"qy-upload__native-input",type:"file",accept:Y.value,multiple:r.supportVideo?!1:r.multiple,disabled:T.value,onChange:Te},null,40,_e),l.createVNode(d,{ref_key:"uploadRef",ref:V,"file-list":s.value,"onUpdate:fileList":t[7]||(t[7]=v=>s.value=v),action:"#",multiple:r.supportVideo?!1:r.multiple,limit:ve.value,"auto-upload":r.autoUpload,"list-type":me.value,accept:Y.value,disabled:T.value,"http-request":Ne,"before-upload":oe,"on-change":Ve,"on-preview":Se,"on-remove":Ce},l.createSlots({default:l.withCtx(()=>[r.variant!=="file-list"&&!j.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["qy-upload__trigger",{"is-dragover":D.value}]),onPaste:M,onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.createVNode(n,{class:"qy-upload__icon"},{default:l.withCtx(()=>[l.createVNode(l.unref(de.Plus))]),_:1}),r.supportVideo?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[10]||(t[10]=l.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),l.createElementVNode("span",$e,"支持 "+l.toDisplayString(w.value.join(" / "))+",不超过 "+l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),r.showText?(l.openBlock(),l.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:t[4]||(t[4]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createVNode(o,{visible:_.value,"onUpdate:visible":t[3]||(t[3]=v=>_.value=v),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:be},{reference:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!h.value}])},l.toDisplayString(h.value||r.pastePlaceholder),3)]),default:l.withCtx(()=>[l.createVNode(i,{ref_key:"inputRef",ref:S,modelValue:h.value,"onUpdate:modelValue":t[1]||(t[1]=v=>h.value=v),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:r.pastePlaceholder,disabled:r.disabled,onBlur:t[2]||(t[2]=v=>_.value=!1),onPaste:l.withModifiers(M,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):r.showPasteInput?(l.openBlock(),l.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:t[6]||(t[6]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createElementVNode("input",{ref_key:"pasteInputRef",ref:b,class:"qy-upload__paste-input",placeholder:r.pastePlaceholder,disabled:r.disabled,onPaste:l.withModifiers(M,["stop"]),onInput:Ue,onClick:t[5]||(t[5]=l.withModifiers(()=>{},["stop"]))},null,40,Ke)],32)):l.createCommentVNode("",!0)],34)):l.createCommentVNode("",!0)]),_:2},[r.variant==="file-list"?{name:"trigger",fn:l.withCtx(()=>[l.createElementVNode("div",{class:"qy-upload__file-trigger",onClick:t[0]||(t[0]=l.withModifiers(()=>{},["stop"])),onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.renderSlot(e.$slots,"trigger",{open:W,disabled:T.value,uploading:fe.value},()=>[l.createElementVNode("button",{class:"qy-upload__file-button",type:"button",disabled:T.value,onClick:W}," 选择文件 ",8,Oe)],!0)],32)]),key:"0"}:void 0]),1032,["file-list","multiple","limit","auto-upload","list-type","accept","disabled"]),A.value?(l.openBlock(),l.createBlock(p,{key:0,"url-list":P.value,"initial-index":J.value,onClose:qe},null,8,["url-list","initial-index"])):l.createCommentVNode("",!0),l.createVNode(c,{modelValue:B.value,"onUpdate:modelValue":t[8]||(t[8]=v=>B.value=v),title:G.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[9]||(t[9]=v=>B.value=!1)},{default:l.withCtx(()=>[B.value?(l.openBlock(),l.createElementBlock("video",{key:0,src:Q.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,We)):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),ge.value?(l.openBlock(),l.createElementBlock("div",He,[l.createVNode(n,null,{default:l.withCtx(()=>[l.createVNode(l.unref(de.InfoFilled))]),_:1}),l.createElementVNode("span",null,[t[13]||(t[13]=l.createTextVNode(" 请上传 ",-1)),r.fileSize?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[11]||(t[11]=l.createTextVNode("大小不超过 ",-1)),l.createElementVNode("b",Xe,l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),(N=w.value)!=null&&N.length?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[t[12]||(t[12]=l.createTextVNode(",格式为 ",-1)),l.createElementVNode("b",Je,l.toDisplayString(w.value.join("/")),1)],64)):l.createCommentVNode("",!0),t[14]||(t[14]=l.createTextVNode(" 的文件。 ",-1))])])):l.createCommentVNode("",!0)],6)}}}),Ge=Le._export_sfc(Qe,[["__scopeId","data-v-3f7a045b"]]);exports.Upload=Ge;exports.api=ce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),d=require("element-plus"),v=require("@element-plus/icons-vue"),s=require("./utils-
|
|
1
|
+
"use strict";const e=require("vue"),d=require("element-plus"),v=require("@element-plus/icons-vue"),s=require("./utils-BjEXwY3L.cjs"),E=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),S={class:"qy-image__state qy-image__state--error"},V={class:"qy-image__state qy-image__state--empty"},k=e.defineComponent({name:"QyImage",__name:"index",props:{src:{default:""},width:{},height:{},size:{default:64},fit:{default:"cover"},placeholder:{type:Boolean,default:!0},lazy:{type:Boolean,default:!0},compressor:{type:[Boolean,Object],default:!0},preview:{type:Boolean,default:!1},previewList:{default:()=>[]},initialIndex:{default:0}},emits:["load","error","fallback","preview"],setup(n,{emit:h}){const t=n,i=h,l=e.ref(!1),o=e.ref("");let c=0;const u=e.computed(()=>s.normalizeImageSrc(t.src)),m=e.computed(()=>({width:t.width??t.size,height:t.height??t.size})),y=e.computed(()=>({width:f(m.value.width),height:f(m.value.height)})),g=e.computed(()=>t.placeholder||l.value),p=e.computed(()=>t.preview&&!!u.value),w=e.computed(()=>(t.previewList.length?t.previewList:[t.src]).map(a=>s.normalizeImageSrc(a)).filter(Boolean));e.watch(()=>[t.src,t.compressor],_,{immediate:!0,deep:!0});async function _(){const r=++c;if(o.value="",l.value=!1,!!t.src)try{const a=await s.resolveQyImageDisplaySrc(t.src,{compressor:t.compressor});if(r!==c)return;o.value=a.src,a.source==="fallback"&&i("fallback",a.src)}catch{if(r!==c)return;l.value=!1,o.value=u.value}}function z(r){i("load",r)}function I(r){l.value=!0,i("error",r)}function q(){p.value&&(s.openQyImagePreview({urlList:w.value,initialIndex:t.initialIndex}),i("preview",u.value))}function f(r){return typeof r=="number"?`${r}px`:r}return(r,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["qy-image",{"qy-image--previewable":p.value}]),style:e.normalizeStyle(y.value),onClick:q},[o.value&&!l.value?(e.openBlock(),e.createBlock(e.unref(d.ElImage),{key:0,class:"qy-image__inner",src:o.value,fit:n.fit,lazy:n.lazy,onLoad:z,onError:I},{placeholder:e.withCtx(()=>[e.renderSlot(r.$slots,"placeholder",{},()=>[a[0]||(a[0]=e.createElementVNode("div",{class:"qy-image__state"},[e.createElementVNode("span",{class:"qy-image__loading"})],-1))],!0)]),error:e.withCtx(()=>[e.renderSlot(r.$slots,"error",{},()=>[e.createElementVNode("div",S,[e.createVNode(e.unref(d.ElIcon),{size:20},{default:e.withCtx(()=>[e.createVNode(e.unref(v.PictureFilled))]),_:1})])],!0)]),_:3},8,["src","fit","lazy"])):g.value?e.renderSlot(r.$slots,"empty",{},()=>[e.createElementVNode("div",V,[e.createVNode(e.unref(d.ElIcon),{size:20},{default:e.withCtx(()=>[e.createVNode(e.unref(v.PictureFilled))]),_:1})])],!0,1):e.createCommentVNode("",!0)],6))}}),x=E._export_sfc(k,[["__scopeId","data-v-02c4930c"]]);exports.Image=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as V, computed as h, ref as w, onBeforeUnmount as I, openBlock as o, createElementBlock as s, normalizeClass as v, createBlock as $, withCtx as T, createElementVNode as l, Fragment as b, renderList as C, normalizeStyle as M, createCommentVNode as m, toDisplayString as y } from "vue";
|
|
2
|
-
import { _ as D } from "./index.vue_vue_type_style_index_0_lang-
|
|
2
|
+
import { _ as D } from "./index.vue_vue_type_style_index_0_lang-DsOg_Rum.mjs";
|
|
3
3
|
import { _ as E } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
4
|
const N = { class: "qy-menu-actions__panel" }, U = ["disabled", "data-action-key", "onClick"], W = {
|
|
5
5
|
key: 0,
|