@qynpm/ui 1.0.32 → 1.0.34
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 +184 -86
- package/dist/index.cjs +7 -4
- package/dist/index.mjs +79 -72
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-button/index.cjs +1 -1
- package/dist/qy-button/index.mjs +1 -1
- package/dist/qy-checkbox/index.cjs +1 -1
- package/dist/qy-checkbox/index.mjs +1 -1
- package/dist/qy-checkbox-group/index.cjs +1 -1
- package/dist/qy-checkbox-group/index.mjs +1 -1
- package/dist/qy-collapse/index.cjs +1 -1
- package/dist/qy-collapse/index.mjs +1 -1
- package/dist/qy-color-picker/index.cjs +1 -0
- package/dist/qy-color-picker/index.mjs +7 -0
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +2 -2
- package/dist/qy-drawer/index.cjs +1 -1
- package/dist/qy-drawer/index.mjs +1 -1
- package/dist/qy-dropdown/index.cjs +1 -1
- package/dist/qy-dropdown/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-fullscreen/index.cjs +1 -1
- package/dist/qy-fullscreen/index.mjs +1 -1
- package/dist/qy-icon/index.cjs +1 -1
- package/dist/qy-icon/index.mjs +2 -2
- package/dist/qy-icon-picker/index.cjs +1 -1
- package/dist/qy-icon-picker/index.mjs +1 -1
- package/dist/qy-iframe/index.cjs +1 -0
- package/dist/qy-iframe/index.mjs +7 -0
- package/dist/qy-image/index.cjs +1 -1
- package/dist/qy-image/index.mjs +1 -1
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +1 -1
- 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 +1 -1
- package/dist/qy-popconfirm/index.cjs +2 -0
- package/dist/qy-popconfirm/index.mjs +8 -0
- package/dist/qy-radio/index.cjs +1 -1
- package/dist/qy-radio/index.mjs +1 -1
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/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-result/index.cjs +1 -1
- package/dist/qy-result/index.mjs +1 -1
- package/dist/qy-scrollbar/index.cjs +1 -1
- package/dist/qy-scrollbar/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-select/index.cjs +1 -1
- package/dist/qy-select/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-switch/index.cjs +1 -1
- package/dist/qy-switch/index.mjs +1 -1
- package/dist/qy-table-column-settings/index.cjs +1 -1
- package/dist/qy-table-column-settings/index.mjs +1 -1
- package/dist/qy-tag/index.cjs +1 -1
- package/dist/qy-tag/index.mjs +1 -1
- package/dist/qy-tree/index.cjs +1 -1
- package/dist/qy-tree/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 +1 -1
- package/dist/qy-watermark/index.cjs +1 -0
- package/dist/qy-watermark/index.mjs +7 -0
- package/dist/shared/{index-D-YyFaZ6.cjs → index-3qEac4h8.cjs} +1 -1
- package/dist/shared/{index-hEy-3mcr.mjs → index-BBZQowyp.mjs} +8 -8
- package/dist/shared/{index-B6xIO6kg.cjs → index-Bi9wgcgT.cjs} +1 -1
- package/dist/shared/{index-BWDaV6FO.cjs → index-CwY_jv_I.cjs} +1 -1
- package/dist/shared/index-D6-K5xSD.cjs +1 -0
- package/dist/shared/{index-xuTVtF4x.mjs → index-DY-CA7Vr.mjs} +1 -1
- package/dist/shared/index-Dw5upK-A.cjs +1 -0
- package/dist/shared/{index-1LT6Q6XJ.mjs → index-Dwf-JfXM.mjs} +1 -1
- package/dist/shared/{index-CpvFUems.cjs → index-Dyyp1ix9.cjs} +1 -1
- package/dist/shared/{index-kiAR2M_e.mjs → index-IXbvJ9d7.mjs} +1 -1
- package/dist/shared/{index-BmJPEXUM.mjs → index-S8HW36Mc.mjs} +2 -2
- package/dist/shared/index-ccugL1Ie.mjs +71 -0
- package/dist/shared/index-fh9l84rU.mjs +3541 -0
- package/dist/shared/{index-CltDZpF9.cjs → index-n04hARNG.cjs} +1 -1
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-C91DUwOD.mjs → index.vue_vue_type_script_setup_true_lang-C6-hVGUO.mjs} +1 -1
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-COAUEujY.mjs +48 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-Cr9PdvyR.cjs +1 -0
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CuXBYNXZ.cjs → index.vue_vue_type_script_setup_true_lang-DOuk75uN.cjs} +1 -1
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DP-jqqo2.mjs → index.vue_vue_type_script_setup_true_lang-S-rQ0p3E.mjs} +1 -1
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DkDEcB4G.cjs → index.vue_vue_type_script_setup_true_lang-lvZQ_Cu6.cjs} +1 -1
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-CL_IFx-Z.cjs → index.vue_vue_type_style_index_0_lang-BcZb1U13.cjs} +1 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-BoaO6MKl.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-C4Yk-UdJ.mjs +172 -0
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-DXQ9l1XF.mjs → index.vue_vue_type_style_index_0_lang-CIcZet5j.mjs} +3 -3
- package/dist/shared/index.vue_vue_type_style_index_0_lang-Ch3QcF8t.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-b0y8p1p1.mjs +215 -0
- package/index.d.ts +108 -63
- package/package.json +483 -459
- 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-color-picker/index.d.ts +36 -0
- package/qy-descriptions/index.d.ts +47 -47
- package/qy-descriptions-item/index.d.ts +46 -46
- package/qy-dialog/index.d.ts +60 -2
- 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-iframe/index.d.ts +66 -0
- package/qy-image/index.d.ts +28 -28
- package/qy-image-preview/index.d.ts +20 -20
- 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-popconfirm/index.d.ts +55 -0
- 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-watermark/index.d.ts +72 -0
- package/dist/shared/index-4wZQbpy3.mjs +0 -3457
- package/dist/shared/index-BvKFjDgX.cjs +0 -1
- /package/dist/shared/{index-AirHUQwm.cjs → index-AMu0L6uU.cjs} +0 -0
- /package/dist/shared/{index-D6ybNdgn.mjs → index-B1b3BksF.mjs} +0 -0
- /package/dist/shared/{index-BpI0jwYK.cjs → index-BPaVDCe6.cjs} +0 -0
- /package/dist/shared/{index-CCZttbsg.cjs → index-BdTlpKtr.cjs} +0 -0
- /package/dist/shared/{index-CwzztWPU.cjs → index-BeubtXXl.cjs} +0 -0
- /package/dist/shared/{index-Bxz4crCd.cjs → index-BkX9xlbI.cjs} +0 -0
- /package/dist/shared/{index-DLLDXfic.cjs → index-Bvot0uXo.cjs} +0 -0
- /package/dist/shared/{index-CaNxcPSD.mjs → index-C91mzAI3.mjs} +0 -0
- /package/dist/shared/{index-CmRclPWX.mjs → index-C_1KP3l9.mjs} +0 -0
- /package/dist/shared/{index-DfR8Z9MN.mjs → index-C_adKysL.mjs} +0 -0
- /package/dist/shared/{index-DEZF-Fkt.mjs → index-D5S48q1B.mjs} +0 -0
- /package/dist/shared/{index-Co0_4YEV.mjs → index-D8E_xu0N.mjs} +0 -0
- /package/dist/shared/{index-Bmw9BNXm.cjs → index-DCzxcvkn.cjs} +0 -0
- /package/dist/shared/{index-C31wpivi.mjs → index-DK0hjfWr.mjs} +0 -0
- /package/dist/shared/{index-D_rRdrge.mjs → index-DZRFSGxO.mjs} +0 -0
- /package/dist/shared/{index-BDdhBEFr.cjs → index-Dc6gLgAz.cjs} +0 -0
- /package/dist/shared/{index-C-ZAw_DP.mjs → index-DcohgM8A.mjs} +0 -0
- /package/dist/shared/{index-BxvS3vlc.cjs → index-Di4bIOiB.cjs} +0 -0
- /package/dist/shared/{index-Bs2OQHXk.mjs → index-JjHutKmT.mjs} +0 -0
- /package/dist/shared/{index-seQHtqdh.mjs → index-Od6HC8Un.mjs} +0 -0
- /package/dist/shared/{index-rcu9CzSn.cjs → index-nSFTxVz8.cjs} +0 -0
- /package/dist/shared/{index-DIs6iPjF.cjs → index-nos4Y-fm.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-S6QPMZay.cjs → index.vue_vue_type_script_setup_true_lang-CglCPcj-.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-BLF3RNlY.mjs → index.vue_vue_type_script_setup_true_lang-q37rBg6Z.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DUgOOzEZ.cjs → index.vue_vue_type_style_index_0_lang-BXTkWo5P.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-lmRmXLwB.cjs → index.vue_vue_type_style_index_0_lang-BnPRHCwR.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DWiolYb3.mjs → index.vue_vue_type_style_index_0_lang-C1n-zAZh.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-B-FeHatv.mjs → index.vue_vue_type_style_index_0_lang-CVdFZeHK.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DzfGx6ce.mjs → index.vue_vue_type_style_index_0_lang-KHk9wRYT.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-CUqnwExG.mjs → index.vue_vue_type_style_index_0_lang-Tzo8o6M8.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DOfJV2oz.cjs → index.vue_vue_type_style_index_0_lang-WGzoSatU.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-Cn3P9d4L.cjs → index.vue_vue_type_style_index_0_lang-hbNK_h45.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-70d23c1d"]]);exports.TreeSelect=ue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as p, useAttrs as b, computed as h, openBlock as t, createBlock as s, unref as v, mergeProps as x, withCtx as i, renderSlot as g, createElementBlock as C, Fragment as V, renderList as _, createTextVNode as z, toDisplayString as B } from "vue";
|
|
2
2
|
import { ElCheckboxGroup as $ } from "element-plus";
|
|
3
|
-
import { C as A } from "./index-
|
|
3
|
+
import { C as A } from "./index-B1b3BksF.mjs";
|
|
4
4
|
const k = /* @__PURE__ */ p({
|
|
5
5
|
name: "QyCheckboxGroup",
|
|
6
6
|
inheritAttrs: !1,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineComponent as d, useAttrs as u, computed as a, openBlock as m, createBlock as p, unref as h, mergeProps as g, withCtx as _, renderSlot as v } from "vue";
|
|
2
|
+
import { ElWatermark as x } from "element-plus";
|
|
3
|
+
const w = /* @__PURE__ */ d({
|
|
4
|
+
name: "QyWatermark",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
content: { default: "" },
|
|
9
|
+
image: {},
|
|
10
|
+
zIndex: { default: 9 },
|
|
11
|
+
rotate: { default: -22 },
|
|
12
|
+
width: {},
|
|
13
|
+
height: {},
|
|
14
|
+
gap: { default: () => [100, 100] },
|
|
15
|
+
offset: {},
|
|
16
|
+
font: {}
|
|
17
|
+
},
|
|
18
|
+
setup(o) {
|
|
19
|
+
const t = o, s = u(), f = a(() => {
|
|
20
|
+
const r = {};
|
|
21
|
+
for (const [e, c] of Object.entries(s))
|
|
22
|
+
(e === "class" || e === "style" || e === "id" || e === "title" || e === "role" || e.startsWith("data-") || e.startsWith("aria-")) && (r[e] = c);
|
|
23
|
+
return r;
|
|
24
|
+
}), n = a(() => ({
|
|
25
|
+
content: t.content,
|
|
26
|
+
image: t.image,
|
|
27
|
+
zIndex: t.zIndex,
|
|
28
|
+
rotate: t.rotate,
|
|
29
|
+
width: t.width,
|
|
30
|
+
height: t.height,
|
|
31
|
+
gap: t.gap,
|
|
32
|
+
offset: t.offset,
|
|
33
|
+
font: t.font
|
|
34
|
+
})), i = a(() => ({
|
|
35
|
+
...n.value,
|
|
36
|
+
...f.value
|
|
37
|
+
})), l = a(() => JSON.stringify(n.value));
|
|
38
|
+
return (r, e) => (m(), p(h(x), g({ key: l.value }, i.value), {
|
|
39
|
+
default: _(() => [
|
|
40
|
+
v(r.$slots, "default")
|
|
41
|
+
]),
|
|
42
|
+
_: 3
|
|
43
|
+
}, 16));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
w as _
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),l=require("element-plus"),d=e.defineComponent({name:"QyWatermark",inheritAttrs:!1,__name:"index",props:{content:{default:""},image:{},zIndex:{default:9},rotate:{default:-22},width:{},height:{},gap:{default:()=>[100,100]},offset:{},font:{}},setup(a){const t=a,o=e.useAttrs(),c=e.computed(()=>{const n={};for(const[r,f]of Object.entries(o))(r==="class"||r==="style"||r==="id"||r==="title"||r==="role"||r.startsWith("data-")||r.startsWith("aria-"))&&(n[r]=f);return n}),s=e.computed(()=>({content:t.content,image:t.image,zIndex:t.zIndex,rotate:t.rotate,width:t.width,height:t.height,gap:t.gap,offset:t.offset,font:t.font})),i=e.computed(()=>({...s.value,...c.value})),u=e.computed(()=>JSON.stringify(s.value));return(n,r)=>(e.openBlock(),e.createBlock(e.unref(l.ElWatermark),e.mergeProps({key:u.value},i.value),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16))}});exports._sfc_main=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),m=require("element-plus"),f=require("./index-
|
|
1
|
+
"use strict";const e=require("vue"),m=require("element-plus"),f=require("./index-DCzxcvkn.cjs"),b=e.defineComponent({name:"QyCheckboxGroup",inheritAttrs:!1,__name:"index",props:{modelValue:{default:()=>[]},options:{default:()=>[]},disabled:{type:Boolean,default:!1},min:{},max:{},size:{default:void 0},ariaLabel:{}},emits:["update:modelValue","change"],setup(d,{emit:i}){const l=d,s=i,o=e.useAttrs(),n=e.computed(()=>Object.fromEntries(Object.entries(o).filter(([a])=>a==="class"||a==="style"||a==="role"||a==="title"||a==="id"||a.startsWith("data-")||a.startsWith("aria-"))));function r(a){s("update:modelValue",a.slice())}function u(a){s("change",a.slice())}return(a,p)=>(e.openBlock(),e.createBlock(e.unref(m.ElCheckboxGroup),e.mergeProps(n.value,{"model-value":l.modelValue,disabled:l.disabled,min:l.min,max:l.max,size:l.size,"aria-label":l.ariaLabel,"onUpdate:modelValue":r,onChange:u}),{default:e.withCtx(()=>[a.$slots.default?e.renderSlot(a.$slots,"default",{},void 0,void 0,0):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(l.options,(t,c)=>(e.openBlock(),e.createBlock(f.Checkbox,{key:`${String(t.value)}-${c}`,"model-value":l.modelValue.includes(t.value),value:t.value,disabled:l.disabled||t.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:2},1032,["model-value","value","disabled"]))),128))]),_:3},16,["model-value","disabled","min","max","size","aria-label"]))}});exports._sfc_main=b;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as C, useAttrs as G, computed as d, ref as S, openBlock as o, createBlock as u, unref as $, mergeProps as i, withCtx as f, renderSlot as m, createElementBlock as E, Fragment as O, renderList as w, resolveDynamicComponent as x, createTextVNode as A, toDisplayString as P } from "vue";
|
|
2
2
|
import { ElRadioButton as j, ElRadioGroup as D } from "element-plus";
|
|
3
|
-
import { R as N } from "./index-
|
|
3
|
+
import { R as N } from "./index-DK0hjfWr.mjs";
|
|
4
4
|
const I = /* @__PURE__ */ C({
|
|
5
5
|
name: "QyRadioGroup",
|
|
6
6
|
inheritAttrs: !1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("vue"),u=require("element-plus"),R=require("./index-
|
|
1
|
+
"use strict";const a=require("vue"),u=require("element-plus"),R=require("./index-BdTlpKtr.cjs"),_=a.defineComponent({name:"QyRadioGroup",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[Boolean,String,Number,null],default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},disabled:{type:Boolean,default:!1},size:{default:void 0},name:{default:void 0},type:{default:"radio"},border:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(s,{expose:i,emit:c}){const l=s,d=c,f=a.useAttrs(),m=a.computed(()=>Object.fromEntries(Object.entries(f).filter(([e])=>e==="class"||e==="style"||e==="role"||e==="title"||e==="id"||e.startsWith("data-")||e.startsWith("aria-")))),n=a.ref(null),b=a.computed(()=>l.type==="button"?u.ElRadioButton:R.Radio),p=a.computed(()=>l.options.map(e=>{const r=e[l.labelKey],t=e[l.valueKey],o=v(t)?t:e.value??e.label??"";return{raw:e,label:String(r??e.label??e.value??""),value:o,disabled:!!e[l.disabledKey]}}));function v(e){return typeof e=="boolean"||typeof e=="string"||typeof e=="number"}function y(e){const r={modelValue:l.modelValue??void 0,value:e.value,label:e.label,disabled:e.disabled,size:l.size,name:l.name};return l.type==="button"?r:{...r,border:l.border}}function g(e,r){return`${String(e.value??e.label)}-${r}`}function h(e){d("update:modelValue",e)}function V(e){d("change",e)}function B(){return n.value}return i({getRadioGroupInstance:B}),(e,r)=>(a.openBlock(),a.createBlock(a.unref(u.ElRadioGroup),a.mergeProps({ref_key:"radioGroupRef",ref:n},m.value,{"model-value":l.modelValue,disabled:l.disabled,size:l.size,name:l.name,"onUpdate:modelValue":h,onChange:V}),{default:a.withCtx(()=>[e.$slots.default?a.renderSlot(e.$slots,"default",{},void 0,void 0,0):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(p.value,(t,o)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(b.value),a.mergeProps({key:g(t,o)},{ref_for:!0},y(t)),{default:a.withCtx(()=>[a.renderSlot(e.$slots,"option",{option:t.raw,label:t.label,value:t.value,disabled:t.disabled},()=>[a.createTextVNode(a.toDisplayString(t.label),1)])]),_:2},1040))),128))]),_:3},16,["model-value","disabled","size","name"]))}});exports._sfc_main=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),E=require("./index-
|
|
1
|
+
"use strict";const e=require("vue"),E=require("./index-Bi9wgcgT.cjs"),K=require("./index-nSFTxVz8.cjs"),j=require("../qy-popover/index.cjs"),L=require("./index-AMu0L6uU.cjs");function F(l,p){const f=p==null?"":String(p),n=l&&f?l.resolve(f):void 0;return Object.freeze({value:f,known:!!n,canonicalName:n==null?void 0:n.name,definition:n})}function Y(l,p,f=""){const n=(l==null?void 0:l.list())??[],c=p===void 0?void 0:new Set(p.map(r=>{var s;return(s=l==null?void 0:l.resolve(r))==null?void 0:s.name}).filter(r=>!!r).map(P)),h=String(f).trim().toLocaleLowerCase();return Object.freeze(n.filter(r=>c&&!c.has(P(r.name))?!1:h?[r.name,r.label,...r.keywords??[]].some(s=>typeof s=="string"&&s.toLocaleLowerCase().includes(h)):!0))}function P(l){return L.normalizeQyIconName(l).toLocaleLowerCase()}const W={class:"qy-icon-picker"},G=["onKeydown"],H={class:"qy-icon-picker__preview","aria-hidden":"true"},J={key:1,class:"qy-icon-picker__missing","aria-hidden":"true"},X=["id"],Z={class:"qy-icon-picker__search","data-testid":"qy-icon-picker-search"},ee=["aria-label"],ae=["id","data-qy-icon-option","data-qy-icon-active","aria-selected","tabindex","onClick","onFocus","onKeydown"],ne={class:"qy-icon-picker__option-label"},oe={key:1,class:"qy-icon-picker__empty"};let te=0;const le=e.defineComponent({name:"QyIconPicker",__name:"index",props:{modelValue:{default:""},allowedNames:{},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},size:{default:"default"},placeholder:{default:"点击选择图标"},searchPlaceholder:{default:"搜索图标名称、标签或关键词"},emptyText:{default:"暂无匹配图标"},panelWidth:{default:540},open:{type:Boolean,default:void 0},id:{},ariaLabel:{}},emits:["update:modelValue","change","clear","update:open","open-change"],setup(l,{expose:p,emit:f}){const n=l,c=f,h=e.inject(L.QY_ICON_REGISTRY_KEY,null),r=e.ref(""),s=e.ref(!1),i=e.ref(-1),b=e.ref([]),y=e.ref(null),x=e.ref(null),w=e.ref("pointer"),Q=`qy-icon-picker-${++te}`,v=e.computed(()=>F(h,n.modelValue)),d=e.computed(()=>Y(h,n.allowedNames,r.value)),k=e.computed(()=>n.open!==void 0),m=e.computed(()=>k.value?n.open===!0:s.value),R=e.computed(()=>"click"),g=e.computed(()=>`${n.id||Q}-panel`);e.watch(m,(a,o)=>{!a||o||(r.value="",i.value=M(),b.value=[],w.value==="keyboard"&&e.nextTick(()=>{var t,u;return(u=(t=x.value)==null?void 0:t.focus)==null?void 0:u.call(t)}))}),e.watch(d,()=>{if(!d.value.length){i.value=-1;return}i.value>=d.value.length&&(i.value=0),i.value<0&&(i.value=0)});function N(){n.disabled||(w.value="keyboard",I("keyboard"))}function T(a){n.disabled||k.value&&n.open!==!1||(a.stopImmediatePropagation(),I("pointer"))}function z(a){q(a)}function $(a){a===m.value&&(k.value||(s.value=a),c("open-change",a),a||e.nextTick(()=>{var o,t;return(t=(o=y.value)==null?void 0:o.focus)==null?void 0:t.call(o)}))}function q(a){a&&n.disabled||a!==m.value&&(k.value||(s.value=a),c("update:open",a))}function I(a="programmatic"){w.value=a,q(!0)}function B(){q(!1),e.nextTick(()=>{var a,o;return(o=(a=y.value)==null?void 0:a.focus)==null?void 0:o.call(a)})}function V(){n.disabled||(c("update:modelValue",""),c("change",""),c("clear"))}function C(a){n.disabled||(c("update:modelValue",a.name),c("change",a.name),B())}function S(a){if(a.key==="Escape"){a.preventDefault(),B();return}if(!d.value.length||!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(a.key))return;a.preventDefault();const o=a.key==="ArrowUp"||a.key==="ArrowLeft"?-1:1,t=d.value.length;i.value=(i.value+o+t)%t,e.nextTick(()=>{var u;return(u=b.value[i.value])==null?void 0:u.focus()})}function M(){const a=v.value.canonicalName;if(!a)return d.value.length?0:-1;const o=d.value.findIndex(({name:t})=>t===a);return o>=0?o:d.value.length?0:-1}function A(a,o){a instanceof HTMLElement&&(b.value[o]=a)}function O(a){return`${g.value}-${encodeURIComponent(a)}`}function D(){var a,o;(o=(a=y.value)==null?void 0:a.focus)==null||o.call(a)}function U(){var a,o;(o=(a=y.value)==null?void 0:a.blur)==null||o.call(a)}return p({focus:D,blur:U,open:I,close:B}),(a,o)=>(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(e.unref(j.QyPopover),{ref:"popoverRef",class:"qy-icon-picker__popover",open:m.value,trigger:R.value,placement:"bottom-start",width:n.panelWidth,"show-delay":0,"hide-delay":0,disabled:n.disabled||k.value&&n.open===!1,"onUpdate:open":z,onOpenChange:$},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:"qy-icon-picker__trigger","data-testid":"qy-icon-picker-trigger",onClick:T,onKeydown:[e.withKeys(e.withModifiers(N,["prevent"]),["enter"]),e.withKeys(e.withModifiers(N,["prevent"]),["space"])]},[e.createVNode(e.unref(K.QyInput),{ref_key:"triggerRef",ref:y,id:n.id,"model-value":v.value.value,size:n.size,disabled:n.disabled,clearable:n.clearable,readonly:"",placeholder:n.placeholder,"aria-label":n.ariaLabel,"aria-haspopup":"listbox","aria-expanded":m.value?"true":"false","aria-controls":g.value,onClear:V},{prefix:e.withCtx(()=>[e.createElementVNode("span",H,[v.value.definition?(e.openBlock(),e.createBlock(e.unref(E.QyIcon),{key:0,name:v.value.definition.name,size:18},null,8,["name"])):(e.openBlock(),e.createElementBlock("span",J,"?"))])]),suffix:e.withCtx(()=>[n.clearable&&v.value.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"qy-icon-picker__clear","data-testid":"qy-icon-picker-clear","aria-label":"清空图标",onClick:e.withModifiers(V,["stop","prevent"])},[...o[1]||(o[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])])):e.createCommentVNode("",!0)]),_:1},8,["id","model-value","size","disabled","clearable","placeholder","aria-label","aria-expanded","aria-controls"])],40,G)]),default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:g.value,class:"qy-icon-picker__panel",onKeydown:S},[e.createElementVNode("div",Z,[e.createVNode(e.unref(K.QyInput),{ref_key:"searchRef",ref:x,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=t=>r.value=t),type:"search",clearable:"",placeholder:n.searchPlaceholder,"aria-label":"搜索图标"},null,8,["modelValue","placeholder"])]),d.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qy-icon-picker__grid",role:"listbox","aria-label":n.ariaLabel||"图标列表"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(t,u)=>(e.openBlock(),e.createElementBlock("div",{id:O(t.name),key:t.name,ref_for:!0,ref:_=>A(_,u),class:e.normalizeClass(["qy-icon-picker__option",{"is-active":i.value===u}]),"data-qy-icon-option":t.name,"data-qy-icon-active":i.value===u?"true":void 0,role:"option","aria-selected":v.value.canonicalName===t.name?"true":"false",tabindex:i.value===u?0:-1,onClick:_=>C(t),onFocus:_=>i.value=u,onKeydown:[e.withKeys(e.withModifiers(_=>C(t),["prevent"]),["enter"]),e.withKeys(e.withModifiers(_=>C(t),["prevent"]),["space"])]},[e.createVNode(e.unref(E.QyIcon),{name:t.name,size:18,"aria-hidden":"true"},null,8,["name"]),e.createElementVNode("span",ne,e.toDisplayString(t.label||t.name),1)],42,ae))),128))],8,ee)):(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(a.$slots,"empty",{},()=>[e.createTextVNode(e.toDisplayString(n.emptyText),1)])]))],40,X)):e.createCommentVNode("",!0)]),_:3},8,["open","trigger","width","disabled"])]))}});exports._sfc_main=le;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("vue"),F=require("element-plus"),W=["id","role","aria-disabled","tabindex","disabled","onKeydown"],j={class:"qy-color-picker__value","aria-hidden":"true"};let G=0;const H=()=>`qy-color-picker-${++G}`,J=a.defineComponent({name:"QyColorPicker",inheritAttrs:!1,__name:"index",props:{modelValue:{default:null},format:{default:void 0},showAlpha:{type:Boolean,default:!1},predefine:{default:void 0},size:{default:"default"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1}},emits:["update:modelValue","active-change","change","visible-change"],setup(R,{emit:D}){const n=R,i=D,c=a.useAttrs(),g=a.ref(null),k=a.ref(null),p=a.ref(null),r=a.ref(u(n.modelValue)),h=a.ref(r.value),t=a.ref(!1),o=a.ref(null),s=a.ref(!1),f=a.ref(!1),w=H(),L=a.computed(()=>typeof c.id=="string"&&c.id||w),_=`qy-color-picker__popper--${w}`,z=a.computed(()=>n.format||(n.showAlpha?"rgb":"hex")),m=a.computed(()=>u(n.modelValue)),B=a.computed(()=>String(c.role||"button")),I=a.computed(()=>c["aria-disabled"]??(n.disabled?"true":"false")),K=a.computed(()=>n.disabled?void 0:c.tabindex??0),N=a.computed(()=>{const e={};for(const[l,d]of Object.entries(c)){const b=l.toLowerCase();(l==="class"||l==="style"||l==="id"||l==="title"||l==="tabindex"||l==="role"||b.startsWith("data-")||b.startsWith("aria-")||["onkeydown","onkeyup","onkeypress"].includes(b))&&(e[l]=d)}return e});a.watch(()=>n.modelValue,e=>{r.value=u(e),t.value&&(h.value=r.value)});function u(e){return e==null||e===""?null:String(e)}function S(){if(!n.disabled){if(t.value){v();return}V()}}function C(){n.disabled||t.value||V()}function T(){t.value&&v()}function V(){t.value||n.disabled||(h.value=u(n.modelValue),r.value=h.value,o.value=null,s.value=!1,f.value=!1,t.value=!0,$(),i("visible-change",!0),a.nextTick(()=>{var e,l;return(l=(e=p.value)==null?void 0:e.show)==null?void 0:l.call(e)}))}function M(e){!t.value||o.value||(r.value=u(e),i("active-change",r.value))}function O(e){!t.value||o.value==="cancel"||(r.value=u(e),s.value||(s.value=!0,o.value="commit",i("update:modelValue",r.value)))}function Q(e){!t.value||o.value==="cancel"||(r.value=u(e),s.value||(s.value=!0,o.value="commit",i("update:modelValue",r.value)),f.value||(f.value=!0,i("change",r.value)),y())}function U(){!t.value||o.value==="cancel"||(s.value||(s.value=!0,o.value="commit",r.value=null,i("update:modelValue",null)),f.value||(f.value=!0,i("change",null)),y())}function v(){var e,l;!t.value||o.value||(o.value="cancel",r.value=u(n.modelValue),(l=(e=p.value)==null?void 0:e.hide)==null||l.call(e),y())}function y(){var e,l;t.value&&(t.value=!1,P(),(l=(e=p.value)==null?void 0:e.hide)==null||l.call(e),i("visible-change",!1),a.nextTick(()=>{var d;return(d=k.value)==null?void 0:d.focus()}))}function E(e){var l,d;return e instanceof Node?(l=g.value)!=null&&l.contains(e)?!0:!!((d=e.closest)!=null&&d.call(e,`.${_}`)):!1}function x(e){t.value&&!E(e.target)&&v()}function q(e){t.value&&!E(e.target)&&v()}function A(e){t.value&&e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),v())}function $(){document.addEventListener("pointerdown",x,!0),document.addEventListener("focusin",q,!0),document.addEventListener("keydown",A,!0)}function P(){document.removeEventListener("pointerdown",x,!0),document.removeEventListener("focusin",q,!0),document.removeEventListener("keydown",A,!0)}return a.onBeforeUnmount(()=>{P()}),(e,l)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"rootRef",ref:g,class:"qy-color-picker","data-qy-color-picker":""},[a.createElementVNode("button",a.mergeProps({ref_key:"triggerRef",ref:k,type:"button",class:"qy-color-picker__trigger"},N.value,{id:L.value,role:B.value,"aria-disabled":I.value,tabindex:K.value,disabled:n.disabled,class:{"is-disabled":n.disabled,"is-open":t.value},onClick:S,onKeydown:[a.withKeys(a.withModifiers(C,["prevent"]),["enter"]),a.withKeys(a.withModifiers(C,["prevent"]),["space"]),a.withKeys(a.withModifiers(T,["prevent"]),["esc"])]}),[a.createElementVNode("span",{class:a.normalizeClass(["qy-color-picker__swatch",{"is-empty":!m.value}]),style:a.normalizeStyle(m.value?{backgroundColor:m.value}:void 0),"aria-hidden":"true"},null,6),a.createElementVNode("span",j,a.toDisplayString(m.value||"选择颜色"),1),l[0]||(l[0]=a.createElementVNode("span",{class:"qy-color-picker__arrow","aria-hidden":"true"},"⌄",-1))],16,W),a.createVNode(a.unref(F.ElColorPicker),{ref_key:"rendererRef",ref:p,class:"qy-color-picker__renderer","model-value":r.value,"show-alpha":n.showAlpha,"color-format":z.value,predefine:n.predefine,size:n.size,disabled:!1,clearable:n.clearable,teleported:!0,tabindex:-1,"popper-class":_,"aria-hidden":"true",onActiveChange:M,"onUpdate:modelValue":O,onChange:Q,onClear:U},null,8,["model-value","show-alpha","color-format","predefine","size","clearable"])],512))}});exports._sfc_main=J;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { defineComponent as J, useAttrs as X, ref as o, computed as c, watch as Y, onBeforeUnmount as Z, openBlock as ee, createElementBlock as ae, createElementVNode as b, mergeProps as le, withKeys as _, withModifiers as w, normalizeStyle as ne, normalizeClass as te, toDisplayString as re, createVNode as oe, unref as ie, nextTick as B } from "vue";
|
|
2
|
+
import { ElColorPicker as ue } from "element-plus";
|
|
3
|
+
const se = ["id", "role", "aria-disabled", "tabindex", "disabled", "onKeydown"], de = {
|
|
4
|
+
class: "qy-color-picker__value",
|
|
5
|
+
"aria-hidden": "true"
|
|
6
|
+
};
|
|
7
|
+
let ce = 0;
|
|
8
|
+
const fe = () => `qy-color-picker-${++ce}`, me = /* @__PURE__ */ J({
|
|
9
|
+
name: "QyColorPicker",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: { default: null },
|
|
14
|
+
format: { default: void 0 },
|
|
15
|
+
showAlpha: { type: Boolean, default: !1 },
|
|
16
|
+
predefine: { default: void 0 },
|
|
17
|
+
size: { default: "default" },
|
|
18
|
+
disabled: { type: Boolean, default: !1 },
|
|
19
|
+
clearable: { type: Boolean, default: !1 }
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:modelValue", "active-change", "change", "visible-change"],
|
|
22
|
+
setup(I, { emit: K }) {
|
|
23
|
+
const l = I, i = K, f = X(), C = o(null), V = o(null), m = o(null), t = o(u(l.modelValue)), g = o(t.value), n = o(!1), r = o(null), s = o(!1), v = o(!1), E = fe(), N = c(() => typeof f.id == "string" && f.id || E), x = `qy-color-picker__popper--${E}`, S = c(
|
|
24
|
+
() => l.format || (l.showAlpha ? "rgb" : "hex")
|
|
25
|
+
), h = c(() => u(l.modelValue)), O = c(() => String(f.role || "button")), Q = c(
|
|
26
|
+
() => f["aria-disabled"] ?? (l.disabled ? "true" : "false")
|
|
27
|
+
), T = c(
|
|
28
|
+
() => l.disabled ? void 0 : f.tabindex ?? 0
|
|
29
|
+
), U = c(() => {
|
|
30
|
+
const e = {};
|
|
31
|
+
for (const [a, d] of Object.entries(f)) {
|
|
32
|
+
const k = a.toLowerCase();
|
|
33
|
+
(a === "class" || a === "style" || a === "id" || a === "title" || a === "tabindex" || a === "role" || k.startsWith("data-") || k.startsWith("aria-") || ["onkeydown", "onkeyup", "onkeypress"].includes(k)) && (e[a] = d);
|
|
34
|
+
}
|
|
35
|
+
return e;
|
|
36
|
+
});
|
|
37
|
+
Y(
|
|
38
|
+
() => l.modelValue,
|
|
39
|
+
(e) => {
|
|
40
|
+
t.value = u(e), n.value && (g.value = t.value);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
function u(e) {
|
|
44
|
+
return e == null || e === "" ? null : String(e);
|
|
45
|
+
}
|
|
46
|
+
function $() {
|
|
47
|
+
if (!l.disabled) {
|
|
48
|
+
if (n.value) {
|
|
49
|
+
p();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
R();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function A() {
|
|
56
|
+
l.disabled || n.value || R();
|
|
57
|
+
}
|
|
58
|
+
function F() {
|
|
59
|
+
n.value && p();
|
|
60
|
+
}
|
|
61
|
+
function R() {
|
|
62
|
+
n.value || l.disabled || (g.value = u(l.modelValue), t.value = g.value, r.value = null, s.value = !1, v.value = !1, n.value = !0, H(), i("visible-change", !0), B(() => {
|
|
63
|
+
var e, a;
|
|
64
|
+
return (a = (e = m.value) == null ? void 0 : e.show) == null ? void 0 : a.call(e);
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
function W(e) {
|
|
68
|
+
!n.value || r.value || (t.value = u(e), i("active-change", t.value));
|
|
69
|
+
}
|
|
70
|
+
function j(e) {
|
|
71
|
+
!n.value || r.value === "cancel" || (t.value = u(e), s.value || (s.value = !0, r.value = "commit", i("update:modelValue", t.value)));
|
|
72
|
+
}
|
|
73
|
+
function M(e) {
|
|
74
|
+
!n.value || r.value === "cancel" || (t.value = u(e), s.value || (s.value = !0, r.value = "commit", i("update:modelValue", t.value)), v.value || (v.value = !0, i("change", t.value)), y());
|
|
75
|
+
}
|
|
76
|
+
function G() {
|
|
77
|
+
!n.value || r.value === "cancel" || (s.value || (s.value = !0, r.value = "commit", t.value = null, i("update:modelValue", null)), v.value || (v.value = !0, i("change", null)), y());
|
|
78
|
+
}
|
|
79
|
+
function p() {
|
|
80
|
+
var e, a;
|
|
81
|
+
!n.value || r.value || (r.value = "cancel", t.value = u(l.modelValue), (a = (e = m.value) == null ? void 0 : e.hide) == null || a.call(e), y());
|
|
82
|
+
}
|
|
83
|
+
function y() {
|
|
84
|
+
var e, a;
|
|
85
|
+
n.value && (n.value = !1, z(), (a = (e = m.value) == null ? void 0 : e.hide) == null || a.call(e), i("visible-change", !1), B(() => {
|
|
86
|
+
var d;
|
|
87
|
+
return (d = V.value) == null ? void 0 : d.focus();
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
function P(e) {
|
|
91
|
+
var a, d;
|
|
92
|
+
return e instanceof Node ? (a = C.value) != null && a.contains(e) ? !0 : !!((d = e.closest) != null && d.call(e, `.${x}`)) : !1;
|
|
93
|
+
}
|
|
94
|
+
function q(e) {
|
|
95
|
+
n.value && !P(e.target) && p();
|
|
96
|
+
}
|
|
97
|
+
function D(e) {
|
|
98
|
+
n.value && !P(e.target) && p();
|
|
99
|
+
}
|
|
100
|
+
function L(e) {
|
|
101
|
+
n.value && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), p());
|
|
102
|
+
}
|
|
103
|
+
function H() {
|
|
104
|
+
document.addEventListener("pointerdown", q, !0), document.addEventListener("focusin", D, !0), document.addEventListener("keydown", L, !0);
|
|
105
|
+
}
|
|
106
|
+
function z() {
|
|
107
|
+
document.removeEventListener("pointerdown", q, !0), document.removeEventListener("focusin", D, !0), document.removeEventListener("keydown", L, !0);
|
|
108
|
+
}
|
|
109
|
+
return Z(() => {
|
|
110
|
+
z();
|
|
111
|
+
}), (e, a) => (ee(), ae("div", {
|
|
112
|
+
ref_key: "rootRef",
|
|
113
|
+
ref: C,
|
|
114
|
+
class: "qy-color-picker",
|
|
115
|
+
"data-qy-color-picker": ""
|
|
116
|
+
}, [
|
|
117
|
+
b("button", le({
|
|
118
|
+
ref_key: "triggerRef",
|
|
119
|
+
ref: V,
|
|
120
|
+
type: "button",
|
|
121
|
+
class: "qy-color-picker__trigger"
|
|
122
|
+
}, U.value, {
|
|
123
|
+
id: N.value,
|
|
124
|
+
role: O.value,
|
|
125
|
+
"aria-disabled": Q.value,
|
|
126
|
+
tabindex: T.value,
|
|
127
|
+
disabled: l.disabled,
|
|
128
|
+
class: { "is-disabled": l.disabled, "is-open": n.value },
|
|
129
|
+
onClick: $,
|
|
130
|
+
onKeydown: [
|
|
131
|
+
_(w(A, ["prevent"]), ["enter"]),
|
|
132
|
+
_(w(A, ["prevent"]), ["space"]),
|
|
133
|
+
_(w(F, ["prevent"]), ["esc"])
|
|
134
|
+
]
|
|
135
|
+
}), [
|
|
136
|
+
b("span", {
|
|
137
|
+
class: te(["qy-color-picker__swatch", { "is-empty": !h.value }]),
|
|
138
|
+
style: ne(h.value ? { backgroundColor: h.value } : void 0),
|
|
139
|
+
"aria-hidden": "true"
|
|
140
|
+
}, null, 6),
|
|
141
|
+
b("span", de, re(h.value || "选择颜色"), 1),
|
|
142
|
+
a[0] || (a[0] = b("span", {
|
|
143
|
+
class: "qy-color-picker__arrow",
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
}, "⌄", -1))
|
|
146
|
+
], 16, se),
|
|
147
|
+
oe(ie(ue), {
|
|
148
|
+
ref_key: "rendererRef",
|
|
149
|
+
ref: m,
|
|
150
|
+
class: "qy-color-picker__renderer",
|
|
151
|
+
"model-value": t.value,
|
|
152
|
+
"show-alpha": l.showAlpha,
|
|
153
|
+
"color-format": S.value,
|
|
154
|
+
predefine: l.predefine,
|
|
155
|
+
size: l.size,
|
|
156
|
+
disabled: !1,
|
|
157
|
+
clearable: l.clearable,
|
|
158
|
+
teleported: !0,
|
|
159
|
+
tabindex: -1,
|
|
160
|
+
"popper-class": x,
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
onActiveChange: W,
|
|
163
|
+
"onUpdate:modelValue": j,
|
|
164
|
+
onChange: M,
|
|
165
|
+
onClear: G
|
|
166
|
+
}, null, 8, ["model-value", "show-alpha", "color-format", "predefine", "size", "clearable"])
|
|
167
|
+
], 512));
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
export {
|
|
171
|
+
me as _
|
|
172
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as oe, inject as le, ref as m, computed as _, watch as E, nextTick as L, openBlock as d, createElementBlock as f, createVNode as P, unref as q, withCtx as Q, createElementVNode as I, Fragment as te, renderList as re, withKeys as R, withModifiers as C, normalizeClass as ie, toDisplayString as O, renderSlot as ce, createTextVNode as ue, createCommentVNode as U, createBlock as se } from "vue";
|
|
2
|
-
import { Q as D } from "./index-
|
|
3
|
-
import { Q as j } from "./index-
|
|
2
|
+
import { Q as D } from "./index-DY-CA7Vr.mjs";
|
|
3
|
+
import { Q as j } from "./index-JjHutKmT.mjs";
|
|
4
4
|
import { QyPopover as de } from "../qy-popover/index.mjs";
|
|
5
|
-
import { n as pe, Q as fe } from "./index-
|
|
5
|
+
import { n as pe, Q as fe } from "./index-C91mzAI3.mjs";
|
|
6
6
|
function ve(l, p) {
|
|
7
7
|
const v = p == null ? "" : String(p), a = l && v ? l.resolve(v) : void 0;
|
|
8
8
|
return Object.freeze({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),N=require("@element-plus/icons-vue"),T=require("element-plus"),f=[],_={class:"qy-popconfirm__message"},ee={key:0,class:"qy-popconfirm__icon","aria-hidden":"true"},te={"data-testid":"qy-popconfirm-title",class:"qy-popconfirm__title"},ne={class:"qy-popconfirm__actions"},oe=t.defineComponent({name:"QyPopconfirm",inheritAttrs:!1,__name:"index",props:{title:{type:String,required:!0},open:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},placement:{type:String,default:"bottom"},width:{type:[Number,String],default:220},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},variant:{type:String,default:"warning"},confirmType:{type:String,default:"primary"},showIcon:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1},closeOnConfirm:{type:Boolean,default:!0}},emits:["update:open","open-change","confirm","cancel","close"],setup(i,{emit:$}){const o=i,c=$,z=t.useAttrs(),g=t.ref(null),C=t.ref(null),B=t.computed(()=>o.open!==void 0),L=o.open===!0&&!o.disabled,k=t.ref(L),s=t.ref(L),a=t.ref(L),r=t.ref(null),m=t.ref(!1),y=t.ref(null),h={};let u=!1,p,w,b=!1,E=null;const S=t.computed(()=>o.disabled?!1:B.value?o.open===!0:k.value),M=t.computed(()=>{const e={};for(const[n,v]of Object.entries(z))(n==="class"||n==="style"||n==="id"||n==="title"||n==="tabindex"||n==="role"||n.startsWith("data-")||n.startsWith("aria-")||/^onKey(?:down|up|press)/i.test(n))&&(e[n]=v);return e}),O=t.computed(()=>typeof o.width=="number"?`${o.width}px`:o.width),H=t.computed(()=>({"--qy-popconfirm-width":O.value,"--qy-popconfirm-mobile-gutter":"24px"})),K=t.computed(()=>o.variant==="danger"?N.CircleCloseFilled:o.variant==="info"?N.InfoFilled:N.WarningFilled);function q(){return f[f.length-1]===h}function x(){f.includes(h)||f.push(h)}function V(){const e=f.indexOf(h);e>=0&&f.splice(e,1)}function D(e){var I,W;const n=document.activeElement;if(n instanceof HTMLElement&&((I=g.value)!=null&&I.contains(n))){y.value=n;return}const v=e==null?void 0:e.target;v instanceof HTMLElement&&((W=C.value)!=null&&W.contains(v))&&(y.value=v)}function Q(){const e=y.value;y.value=null,e!=null&&e.isConnected&&e.focus()}function d(){if(u)return;const e=S.value;s.value!==e&&(u=!0,p=e,w=e?void 0:r.value??(o.disabled?"disabled":"external"),s.value=e)}function l(e,n){e&&o.disabled||(!e&&n&&r.value===null&&(r.value=n),B.value?o.open!==e&&c("update:open",e):k.value!==e&&(k.value=e,c("update:open",e)),d())}function U(){var e;return r.value?r.value:E instanceof Node&&((e=g.value)!=null&&e.contains(E))?"trigger":"outside"}function j(e){if(e){D(),l(!0);return}if(o.confirmLoading)return;const n=U();!q()&&n!=="external"&&n!=="disabled"||l(!1,n)}function G(e){var n;!(e.target instanceof Node)||!((n=C.value)!=null&&n.contains(e.target))||o.confirmLoading||(a.value||s.value?(r.value="trigger",l(!1,"trigger")):(D(e),l(!0)))}function J(){o.disabled||o.confirmLoading||m.value||(m.value=!0,c("confirm"),o.closeOnConfirm&&l(!1,"confirm"))}function X(){o.disabled||o.confirmLoading||(c("cancel"),l(!1,"cancel"))}function A(e){e.key!=="Escape"&&e.code!=="Escape"||o.confirmLoading||!a.value||!q()||(e.preventDefault(),l(!1,"escape"))}function R(e){E=e.target}function P(e){E=e.target}function F(e){var n;o.confirmLoading||!a.value||!q()||e.target instanceof Node&&((n=g.value)!=null&&n.contains(e.target)||e.target instanceof Element&&e.target.closest(".qy-popconfirm-popper")||l(!1,"outside"))}function Y(){!u||p!==!0||(u=!1,p=void 0,a.value=!0,x(),r.value=null,w=void 0,c("open-change",!0),d())}function Z(){!u||p!==!1||(u=!1,p=void 0,a.value=!1,V(),c("open-change",!1),c("close",w??r.value??"external"),r.value=null,w=void 0,m.value=!1,b=!1,Q(),d())}return t.watch(S,()=>d()),t.watch(()=>o.open,(e,n)=>{e!==n&&(e===!1&&(a.value||s.value)&&r.value===null&&(r.value="external"),d())}),t.watch(()=>o.disabled,e=>{e&&(a.value||s.value)&&(r.value="disabled"),d()}),t.watch(()=>o.confirmLoading,e=>{e?b=!0:b&&(b=!1,a.value&&(m.value=!1))}),t.onMounted(()=>{a.value&&x(),window.addEventListener("keydown",A),document.addEventListener("pointerdown",R,!0),document.addEventListener("mousedown",P,!0),document.addEventListener("click",F)}),t.onBeforeUnmount(()=>{V(),window.removeEventListener("keydown",A),document.removeEventListener("pointerdown",R,!0),document.removeEventListener("mousedown",P,!0),document.removeEventListener("click",F)}),(e,n)=>(t.openBlock(),t.createElementBlock("span",t.mergeProps({ref_key:"rootRef",ref:g,class:"qy-popconfirm"},M.value,{onClickCapture:G}),[t.createVNode(t.unref(T.ElPopover),{visible:s.value,trigger:"click",placement:i.placement,width:i.width,disabled:i.disabled,"popper-style":H.value,"popper-class":"qy-popconfirm-popper","onUpdate:visible":j,onAfterEnter:Y,onAfterLeave:Z},{reference:t.withCtx(()=>[t.createElementVNode("span",{ref_key:"referenceRef",ref:C,"data-qy-popconfirm-reference":""},[t.renderSlot(e.$slots,"reference")],512)]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["qy-popconfirm__content",`is-${i.variant}`]),"data-qy-popconfirm-content":""},[t.createElementVNode("div",_,[i.showIcon?(t.openBlock(),t.createElementBlock("span",ee,[t.renderSlot(e.$slots,"icon",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(K.value)))])])):t.createCommentVNode("",!0),t.createElementVNode("span",te,[t.renderSlot(e.$slots,"title",{},()=>[t.createTextVNode(t.toDisplayString(i.title),1)])])]),t.createElementVNode("div",ne,[t.createVNode(t.unref(T.ElButton),{"data-testid":"qy-popconfirm-cancel",size:"small",disabled:i.disabled||i.confirmLoading,onClick:X},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.cancelText),1)]),_:1},8,["disabled"]),t.createVNode(t.unref(T.ElButton),{"data-testid":"qy-popconfirm-confirm",size:"small",type:i.confirmType,loading:i.confirmLoading,disabled:i.disabled||i.confirmLoading||m.value,onClick:J},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.confirmText),1)]),_:1},8,["type","loading","disabled"])])],2)]),_:3},8,["visible","placement","width","disabled","popper-style"])],16))}});exports._sfc_main=oe;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { defineComponent as ce, useAttrs as ue, ref as l, computed as d, watch as k, onMounted as fe, onBeforeUnmount as de, openBlock as x, createElementBlock as j, mergeProps as me, createVNode as A, unref as N, withCtx as q, createElementVNode as y, normalizeClass as pe, renderSlot as R, createBlock as ve, resolveDynamicComponent as ge, createCommentVNode as ye, createTextVNode as F, toDisplayString as I } from "vue";
|
|
2
|
+
import { CircleCloseFilled as he, InfoFilled as be, WarningFilled as we } from "@element-plus/icons-vue";
|
|
3
|
+
import { ElPopover as Le, ElButton as G } from "element-plus";
|
|
4
|
+
const m = [], Ce = { class: "qy-popconfirm__message" }, Ee = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "qy-popconfirm__icon",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
}, ke = {
|
|
9
|
+
"data-testid": "qy-popconfirm-title",
|
|
10
|
+
class: "qy-popconfirm__title"
|
|
11
|
+
}, qe = { class: "qy-popconfirm__actions" }, Se = /* @__PURE__ */ ce({
|
|
12
|
+
name: "QyPopconfirm",
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "index",
|
|
15
|
+
props: {
|
|
16
|
+
title: { type: String, required: !0 },
|
|
17
|
+
open: { type: Boolean, default: void 0 },
|
|
18
|
+
disabled: { type: Boolean, default: !1 },
|
|
19
|
+
placement: { type: String, default: "bottom" },
|
|
20
|
+
width: { type: [Number, String], default: 220 },
|
|
21
|
+
confirmText: { type: String, default: "确认" },
|
|
22
|
+
cancelText: { type: String, default: "取消" },
|
|
23
|
+
variant: { type: String, default: "warning" },
|
|
24
|
+
confirmType: { type: String, default: "primary" },
|
|
25
|
+
showIcon: { type: Boolean, default: !0 },
|
|
26
|
+
confirmLoading: { type: Boolean, default: !1 },
|
|
27
|
+
closeOnConfirm: { type: Boolean, default: !0 }
|
|
28
|
+
},
|
|
29
|
+
emits: ["update:open", "open-change", "confirm", "cancel", "close"],
|
|
30
|
+
setup(i, { emit: J }) {
|
|
31
|
+
const t = i, s = J, X = ue(), h = l(null), T = l(null), P = d(() => t.open !== void 0), B = t.open === !0 && !t.disabled, D = l(B), c = l(B), a = l(B), o = l(null), p = l(!1), b = l(null), w = {};
|
|
32
|
+
let u = !1, v, L, C = !1, E = null;
|
|
33
|
+
const W = d(() => t.disabled ? !1 : P.value ? t.open === !0 : D.value), Y = d(() => {
|
|
34
|
+
const e = {};
|
|
35
|
+
for (const [n, g] of Object.entries(X))
|
|
36
|
+
(n === "class" || n === "style" || n === "id" || n === "title" || n === "tabindex" || n === "role" || n.startsWith("data-") || n.startsWith("aria-") || /^onKey(?:down|up|press)/i.test(n)) && (e[n] = g);
|
|
37
|
+
return e;
|
|
38
|
+
}), Z = d(
|
|
39
|
+
() => typeof t.width == "number" ? `${t.width}px` : t.width
|
|
40
|
+
), _ = d(() => ({
|
|
41
|
+
"--qy-popconfirm-width": Z.value,
|
|
42
|
+
"--qy-popconfirm-mobile-gutter": "24px"
|
|
43
|
+
})), ee = d(() => t.variant === "danger" ? he : t.variant === "info" ? be : we);
|
|
44
|
+
function S() {
|
|
45
|
+
return m[m.length - 1] === w;
|
|
46
|
+
}
|
|
47
|
+
function $() {
|
|
48
|
+
m.includes(w) || m.push(w);
|
|
49
|
+
}
|
|
50
|
+
function z() {
|
|
51
|
+
const e = m.indexOf(w);
|
|
52
|
+
e >= 0 && m.splice(e, 1);
|
|
53
|
+
}
|
|
54
|
+
function M(e) {
|
|
55
|
+
var Q, U;
|
|
56
|
+
const n = document.activeElement;
|
|
57
|
+
if (n instanceof HTMLElement && ((Q = h.value) != null && Q.contains(n))) {
|
|
58
|
+
b.value = n;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const g = e == null ? void 0 : e.target;
|
|
62
|
+
g instanceof HTMLElement && ((U = T.value) != null && U.contains(g)) && (b.value = g);
|
|
63
|
+
}
|
|
64
|
+
function ne() {
|
|
65
|
+
const e = b.value;
|
|
66
|
+
b.value = null, e != null && e.isConnected && e.focus();
|
|
67
|
+
}
|
|
68
|
+
function f() {
|
|
69
|
+
if (u) return;
|
|
70
|
+
const e = W.value;
|
|
71
|
+
c.value !== e && (u = !0, v = e, L = e ? void 0 : o.value ?? (t.disabled ? "disabled" : "external"), c.value = e);
|
|
72
|
+
}
|
|
73
|
+
function r(e, n) {
|
|
74
|
+
e && t.disabled || (!e && n && o.value === null && (o.value = n), P.value ? t.open !== e && s("update:open", e) : D.value !== e && (D.value = e, s("update:open", e)), f());
|
|
75
|
+
}
|
|
76
|
+
function te() {
|
|
77
|
+
var e;
|
|
78
|
+
return o.value ? o.value : E instanceof Node && ((e = h.value) != null && e.contains(E)) ? "trigger" : "outside";
|
|
79
|
+
}
|
|
80
|
+
function ie(e) {
|
|
81
|
+
if (e) {
|
|
82
|
+
M(), r(!0);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (t.confirmLoading) return;
|
|
86
|
+
const n = te();
|
|
87
|
+
!S() && n !== "external" && n !== "disabled" || r(!1, n);
|
|
88
|
+
}
|
|
89
|
+
function oe(e) {
|
|
90
|
+
var n;
|
|
91
|
+
!(e.target instanceof Node) || !((n = T.value) != null && n.contains(e.target)) || t.confirmLoading || (a.value || c.value ? (o.value = "trigger", r(!1, "trigger")) : (M(e), r(!0)));
|
|
92
|
+
}
|
|
93
|
+
function ae() {
|
|
94
|
+
t.disabled || t.confirmLoading || p.value || (p.value = !0, s("confirm"), t.closeOnConfirm && r(!1, "confirm"));
|
|
95
|
+
}
|
|
96
|
+
function re() {
|
|
97
|
+
t.disabled || t.confirmLoading || (s("cancel"), r(!1, "cancel"));
|
|
98
|
+
}
|
|
99
|
+
function V(e) {
|
|
100
|
+
e.key !== "Escape" && e.code !== "Escape" || t.confirmLoading || !a.value || !S() || (e.preventDefault(), r(!1, "escape"));
|
|
101
|
+
}
|
|
102
|
+
function O(e) {
|
|
103
|
+
E = e.target;
|
|
104
|
+
}
|
|
105
|
+
function H(e) {
|
|
106
|
+
E = e.target;
|
|
107
|
+
}
|
|
108
|
+
function K(e) {
|
|
109
|
+
var n;
|
|
110
|
+
t.confirmLoading || !a.value || !S() || e.target instanceof Node && ((n = h.value) != null && n.contains(e.target) || e.target instanceof Element && e.target.closest(".qy-popconfirm-popper") || r(!1, "outside"));
|
|
111
|
+
}
|
|
112
|
+
function le() {
|
|
113
|
+
!u || v !== !0 || (u = !1, v = void 0, a.value = !0, $(), o.value = null, L = void 0, s("open-change", !0), f());
|
|
114
|
+
}
|
|
115
|
+
function se() {
|
|
116
|
+
!u || v !== !1 || (u = !1, v = void 0, a.value = !1, z(), s("open-change", !1), s("close", L ?? o.value ?? "external"), o.value = null, L = void 0, p.value = !1, C = !1, ne(), f());
|
|
117
|
+
}
|
|
118
|
+
return k(W, () => f()), k(
|
|
119
|
+
() => t.open,
|
|
120
|
+
(e, n) => {
|
|
121
|
+
e !== n && (e === !1 && (a.value || c.value) && o.value === null && (o.value = "external"), f());
|
|
122
|
+
}
|
|
123
|
+
), k(
|
|
124
|
+
() => t.disabled,
|
|
125
|
+
(e) => {
|
|
126
|
+
e && (a.value || c.value) && (o.value = "disabled"), f();
|
|
127
|
+
}
|
|
128
|
+
), k(
|
|
129
|
+
() => t.confirmLoading,
|
|
130
|
+
(e) => {
|
|
131
|
+
e ? C = !0 : C && (C = !1, a.value && (p.value = !1));
|
|
132
|
+
}
|
|
133
|
+
), fe(() => {
|
|
134
|
+
a.value && $(), window.addEventListener("keydown", V), document.addEventListener("pointerdown", O, !0), document.addEventListener("mousedown", H, !0), document.addEventListener("click", K);
|
|
135
|
+
}), de(() => {
|
|
136
|
+
z(), window.removeEventListener("keydown", V), document.removeEventListener("pointerdown", O, !0), document.removeEventListener("mousedown", H, !0), document.removeEventListener("click", K);
|
|
137
|
+
}), (e, n) => (x(), j("span", me({
|
|
138
|
+
ref_key: "rootRef",
|
|
139
|
+
ref: h,
|
|
140
|
+
class: "qy-popconfirm"
|
|
141
|
+
}, Y.value, { onClickCapture: oe }), [
|
|
142
|
+
A(N(Le), {
|
|
143
|
+
visible: c.value,
|
|
144
|
+
trigger: "click",
|
|
145
|
+
placement: i.placement,
|
|
146
|
+
width: i.width,
|
|
147
|
+
disabled: i.disabled,
|
|
148
|
+
"popper-style": _.value,
|
|
149
|
+
"popper-class": "qy-popconfirm-popper",
|
|
150
|
+
"onUpdate:visible": ie,
|
|
151
|
+
onAfterEnter: le,
|
|
152
|
+
onAfterLeave: se
|
|
153
|
+
}, {
|
|
154
|
+
reference: q(() => [
|
|
155
|
+
y("span", {
|
|
156
|
+
ref_key: "referenceRef",
|
|
157
|
+
ref: T,
|
|
158
|
+
"data-qy-popconfirm-reference": ""
|
|
159
|
+
}, [
|
|
160
|
+
R(e.$slots, "reference")
|
|
161
|
+
], 512)
|
|
162
|
+
]),
|
|
163
|
+
default: q(() => [
|
|
164
|
+
y("div", {
|
|
165
|
+
class: pe(["qy-popconfirm__content", `is-${i.variant}`]),
|
|
166
|
+
"data-qy-popconfirm-content": ""
|
|
167
|
+
}, [
|
|
168
|
+
y("div", Ce, [
|
|
169
|
+
i.showIcon ? (x(), j("span", Ee, [
|
|
170
|
+
R(e.$slots, "icon", {}, () => [
|
|
171
|
+
(x(), ve(ge(ee.value)))
|
|
172
|
+
])
|
|
173
|
+
])) : ye("", !0),
|
|
174
|
+
y("span", ke, [
|
|
175
|
+
R(e.$slots, "title", {}, () => [
|
|
176
|
+
F(I(i.title), 1)
|
|
177
|
+
])
|
|
178
|
+
])
|
|
179
|
+
]),
|
|
180
|
+
y("div", qe, [
|
|
181
|
+
A(N(G), {
|
|
182
|
+
"data-testid": "qy-popconfirm-cancel",
|
|
183
|
+
size: "small",
|
|
184
|
+
disabled: i.disabled || i.confirmLoading,
|
|
185
|
+
onClick: re
|
|
186
|
+
}, {
|
|
187
|
+
default: q(() => [
|
|
188
|
+
F(I(i.cancelText), 1)
|
|
189
|
+
]),
|
|
190
|
+
_: 1
|
|
191
|
+
}, 8, ["disabled"]),
|
|
192
|
+
A(N(G), {
|
|
193
|
+
"data-testid": "qy-popconfirm-confirm",
|
|
194
|
+
size: "small",
|
|
195
|
+
type: i.confirmType,
|
|
196
|
+
loading: i.confirmLoading,
|
|
197
|
+
disabled: i.disabled || i.confirmLoading || p.value,
|
|
198
|
+
onClick: ae
|
|
199
|
+
}, {
|
|
200
|
+
default: q(() => [
|
|
201
|
+
F(I(i.confirmText), 1)
|
|
202
|
+
]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["type", "loading", "disabled"])
|
|
205
|
+
])
|
|
206
|
+
], 2)
|
|
207
|
+
]),
|
|
208
|
+
_: 3
|
|
209
|
+
}, 8, ["visible", "placement", "width", "disabled", "popper-style"])
|
|
210
|
+
], 16));
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
export {
|
|
214
|
+
Se as _
|
|
215
|
+
};
|