@cldemo/ui-kit 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/buildLibs/all/index.cjs +8 -8
- package/buildLibs/all/index.js +12157 -12048
- package/buildLibs/common/globalConfig.cjs +1 -1
- package/buildLibs/common/globalConfig.js +29 -15
- package/buildLibs/common/i18n/en.cjs +1 -1
- package/buildLibs/common/i18n/en.js +3 -1
- package/buildLibs/common/i18n/zh_CN.cjs +1 -1
- package/buildLibs/common/i18n/zh_CN.js +3 -1
- package/buildLibs/common/index.cjs +1 -1
- package/buildLibs/common/index.js +26 -24
- package/buildLibs/mobile/index.cjs +5 -5
- package/buildLibs/mobile/index.js +5902 -5852
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-CKoVf-v1.js → Index.vue_vue_type_script_setup_true_lang-88gNFuK4.js} +2 -2
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-BQXxDHbe.js +254 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-D0g1xGPL.js → Index.vue_vue_type_script_setup_true_lang-BR0S3Sfl.js} +3 -3
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-RRUPY9bd.js → Index.vue_vue_type_script_setup_true_lang-BrfAVhNV.js} +153 -145
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-DdLVG0R0.js → Index.vue_vue_type_script_setup_true_lang-Bw_jRoEX.js} +67 -59
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-C6Zd584S.js +2536 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-BOcOO9-n.js → Index.vue_vue_type_script_setup_true_lang-CD66oCaI.js} +386 -375
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-CEBiLDTm.js +310 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-C0DgaU5I.js → Index.vue_vue_type_script_setup_true_lang-CRlBvcCg.js} +53 -47
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-DqZBB8fM.js → Index.vue_vue_type_script_setup_true_lang-CdYh3Pzs.js} +1 -1
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-XiSSYx4X.js → Index.vue_vue_type_script_setup_true_lang-D7YeNBdk.js} +120 -113
- package/buildLibs/{utils/Shared/Index.vue_vue_type_script_setup_true_lang-DKMVQrVU.js → modules/shared/Index.vue_vue_type_script_setup_true_lang-D9sq4n9i.js} +66 -60
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-CRKrLCa6.js → Index.vue_vue_type_script_setup_true_lang-DFeBj9IN.js} +209 -201
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-D7bJ5UAn.js → Index.vue_vue_type_script_setup_true_lang-DY3tZQZe.js} +63 -55
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-D_73B6av.js +1533 -0
- package/buildLibs/modules/shared/{Validate.vue_vue_type_script_setup_true_lang-3s_3ut9M.js → Validate.vue_vue_type_script_setup_true_lang-hn1Tat7L.js} +102 -92
- package/buildLibs/types/All/index.d.ts +1 -1
- package/buildLibs/types/Common/globalConfig.d.ts +29 -0
- package/buildLibs/types/Common/globalTypes.d.ts +11 -0
- package/buildLibs/types/Common/i18n/en.d.ts +2 -0
- package/buildLibs/types/Common/i18n/zh_CN.d.ts +2 -0
- package/buildLibs/types/Common/index.d.ts +1 -1
- package/buildLibs/types/Element/CheckBox/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/Input/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputNumber/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputNumberStepper/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputTextarea/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/Radio/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/DateTime/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/FileUpload/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/Select/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectCascade/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectMove/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectTag/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectTree/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/Tree/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/componentsInstalls.d.ts +90 -0
- package/buildLibs/utils/Element/ClCheckbox.cjs +1 -1
- package/buildLibs/utils/Element/ClCheckbox.js +1 -1
- package/buildLibs/utils/Element/ClInput.cjs +1 -1
- package/buildLibs/utils/Element/ClInput.js +1 -1
- package/buildLibs/utils/Element/ClInputCaptcha.cjs +1 -1
- package/buildLibs/utils/Element/ClInputCaptcha.js +1 -1
- package/buildLibs/utils/Element/ClInputNumber.cjs +1 -1
- package/buildLibs/utils/Element/ClInputNumber.js +1 -1
- package/buildLibs/utils/Element/ClInputNumberStepper.cjs +1 -1
- package/buildLibs/utils/Element/ClInputNumberStepper.js +1 -1
- package/buildLibs/utils/Element/ClInputPassword.cjs +1 -1
- package/buildLibs/utils/Element/ClInputPassword.js +1 -1
- package/buildLibs/utils/Element/ClInputSearch.cjs +1 -1
- package/buildLibs/utils/Element/ClInputSearch.js +1 -1
- package/buildLibs/utils/Element/ClInputTextarea.cjs +1 -1
- package/buildLibs/utils/Element/ClInputTextarea.js +1 -1
- package/buildLibs/utils/Element/ClRadio.cjs +1 -1
- package/buildLibs/utils/Element/ClRadio.js +1 -1
- package/buildLibs/utils/Element/__provide__/Validate.cjs +1 -1
- package/buildLibs/utils/Element/__provide__/Validate.js +13 -3
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-C1OgPpoJ.js → Index.vue_vue_type_script_setup_true_lang-0S6ab-Lp.js} +120 -113
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-neC9NxKi.js → Index.vue_vue_type_script_setup_true_lang-2Fe9SkjL.js} +209 -201
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-2THK822S.js +254 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-BO4cal3i.js → Index.vue_vue_type_script_setup_true_lang-2dwwjiTV.js} +386 -375
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-5itnjwU_.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-ChnRq_PS.js → Index.vue_vue_type_script_setup_true_lang-B0MJO0JM.js} +2 -2
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BIO6Me43.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BN9ybiKv.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BpG7AHvM.js +1 -0
- package/buildLibs/{modules/shared/Index.vue_vue_type_script_setup_true_lang-CAe8mhTl.js → utils/Shared/Index.vue_vue_type_script_setup_true_lang-CATwJnes.js} +66 -60
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CW4fM0by.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-DxYJbPyJ.js → Index.vue_vue_type_script_setup_true_lang-C_exHzjc.js} +3 -3
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CsCn637u.js +2 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-D_XMW7K4.js → Index.vue_vue_type_script_setup_true_lang-D4a5Iaue.js} +153 -145
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DXPZYc0c.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DY4m6Xyj.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DZCt32jb.js +1533 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DZF2gj7X.js +2536 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-De1eNjwC.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-C6Evk0-z.js → Index.vue_vue_type_script_setup_true_lang-DtAy8lm9.js} +53 -47
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DvN-fBNd.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DwBf338f.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Cg_benGj.js → Index.vue_vue_type_script_setup_true_lang-F9tBnc_7.js} +63 -55
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-HfnOtuMz.js +310 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Dwkuei2j.js → Index.vue_vue_type_script_setup_true_lang-VjIva6RM.js} +1 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-j7gxlOeM.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-CgdGs-U2.js → Index.vue_vue_type_script_setup_true_lang-lKDQFZtY.js} +67 -59
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Dzm58mMQ.js → Index.vue_vue_type_script_setup_true_lang-nAMiORzN.js} +1 -1
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-CizRrQsH.js → Index.vue_vue_type_script_setup_true_lang-oovIcT38.js} +1 -1
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-BIFHYrzc.js → Index.vue_vue_type_script_setup_true_lang-qqnmaRnk.js} +1 -1
- package/buildLibs/utils/Web/ClColorPicker.cjs +1 -1
- package/buildLibs/utils/Web/ClColorPicker.js +1 -1
- package/buildLibs/utils/Web/ClCropperPreview.cjs +1 -1
- package/buildLibs/utils/Web/ClCropperPreview.js +1 -1
- package/buildLibs/utils/Web/ClDateTime.cjs +1 -1
- package/buildLibs/utils/Web/ClDateTime.js +1 -1
- package/buildLibs/utils/Web/ClFileUpload.cjs +1 -1
- package/buildLibs/utils/Web/ClFileUpload.js +1 -1
- package/buildLibs/utils/Web/ClInputTag.cjs +1 -1
- package/buildLibs/utils/Web/ClInputTag.js +1 -1
- package/buildLibs/utils/Web/ClPaginate.cjs +1 -1
- package/buildLibs/utils/Web/ClPaginate.js +1 -1
- package/buildLibs/utils/Web/ClSelect.cjs +1 -1
- package/buildLibs/utils/Web/ClSelect.js +1 -1
- package/buildLibs/utils/Web/ClSelectCascade.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectCascade.js +1 -1
- package/buildLibs/utils/Web/ClSelectMove.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectMove.js +655 -647
- package/buildLibs/utils/Web/ClSelectTag.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectTag.js +1 -1
- package/buildLibs/utils/Web/ClSelectTree.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectTree.js +71 -63
- package/buildLibs/utils/Web/ClTable.cjs +1 -1
- package/buildLibs/utils/Web/ClTable.js +1 -1
- package/buildLibs/utils/Web/ClTree.cjs +1 -1
- package/buildLibs/utils/Web/ClTree.js +1 -1
- package/buildLibs/utils/Web/ClXEditable.cjs +1 -1
- package/buildLibs/utils/Web/ClXEditable.js +10 -10
- package/buildLibs/web/index.cjs +7 -7
- package/buildLibs/web/index.js +10792 -10685
- package/docs/components/Element/Checkbox.md +2 -1
- package/docs/components/Element/Form.md +15 -0
- package/docs/components/Element/Input.md +2 -1
- package/docs/components/Element/InputNumber.md +2 -1
- package/docs/components/Element/InputNumberStepper.md +2 -1
- package/docs/components/Element/InputTextarea.md +2 -1
- package/docs/components/Element/Radio.md +2 -1
- package/docs/components/Web/DateTime.md +2 -1
- package/docs/components/Web/FileUpload.md +2 -1
- package/docs/components/Web/Select.md +2 -1
- package/docs/components/Web/SelectCascade.md +1 -0
- package/docs/components/Web/SelectMove.md +2 -1
- package/docs/components/Web/SelectTag.md +1 -0
- package/docs/components/Web/SelectTree.md +2 -1
- package/docs/components/Web/Tree.md +2 -1
- package/package.json +1 -1
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-CiNidFJt.js +0 -246
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-DC6727pS.js +0 -2528
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-EXqjkKwS.js +0 -302
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-Hg16dgRQ.js +0 -1527
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-5aX79Fcf.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BRvOcf4B.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-Ba8Z8fOP.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BjNP5odR.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CQ3RGLek.js +0 -302
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CY5fRV6o.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CYN4r-Mx.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-C_7ArHlU.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CuJjJvft.js +0 -2
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CwjigRBx.js +0 -2528
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-D6cmq0Tf.js +0 -1527
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-Dbf-3Nik.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DgD_gHit.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-FowII7_3.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-c7oxeU_j.js +0 -246
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-vLqCsSbV.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),s=require("@cldemo/ui-kit/common/base"),Y=require("@cldemo/ui-kit/common/Element"),K=require("@cldemo/ui-kit/common/globalConfig"),Z=require("./language-BJ4aVgHI.js");;/* empty css */const ee=["id"],te={key:0,class:"cl-plaintext-value"},le={key:2,class:"selectTag-container"},ie=["aria-selected","aria-disabled","tabindex"],se=["aria-selected","aria-disabled","tabindex","onClick","onKeydown"],ne=["innerHTML"],ae={key:1},oe=t.defineComponent({name:"ClSelectTag",__name:"Index",props:{id:String,value:[String,Number],className:String,disabled:Boolean,type:{type:String,required:!0,validator:u=>["checkbox","radio"].indexOf(u)!==-1},list:{type:Array,default:()=>[]},theme:String,width:String,isShowAll:Boolean,showAllLabel:String,isInitRadioValue:{type:Boolean,default:!0},isRadioClickCancel:Boolean,checkChangeBefore:Function,isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0},plaintextSeparator:{type:String,default:","}},emits:{"update:value":u=>!0,"update:modelValue":u=>!0,onChange:(u,C,x,n)=>!0,onInit:(u,C,x)=>!0,onError:u=>!0},setup(u,{expose:C,emit:x}){const n=u,y=x,{optPageLanguage:P,getPageLanguage:R}=Z.useLanguage();R("common");const J=`s-${s.getRandom(5)}`,N=n.id,_=t.reactive({theme:""}),h=t.ref(!1),D=e=>{let l=[];return s.isEmpty(e)||(l=e.toString().split(",")),l},c=t.ref(D(n.value));let v=[],p={};const q=t.ref(0),g=t.ref(!1);let E=0;const j=t.computed(()=>{const e=n.list;return s.isArray(e)?e.filter(l=>!s.isEmpty(l)):[]}),z=t.computed(()=>{const e=s.isString(n.plaintextSeparator)?n.plaintextSeparator:",";n.list,q.value;const l=[];return c.value.forEach(i=>{const o=s.isExistJsonKey(p,i)?p[i]:void 0;l.push(o&&s.isNonEmptyString(o.name)?o.name:i)}),l.filter(i=>s.isNonEmptyString(i)).join(e)}),H=t.computed(()=>K.getPlaintextOutText("selectTag",n.plaintextEmptyText,z.value,n.value)),O=t.computed(()=>{const{theme:e}=n,l={"panel-select-tag":!0};let i=_.theme;return e&&(i=e),s.isEmpty(i)||(l[`selectTag-${i}`]=!0),s.getJsonMerge(l,Y.getClassNameJson(n.className))}),G=t.computed(()=>{const e={};return s.isEmpty(n.width)||(e.width=n.width),e}),k=e=>{y("update:value",e),y("update:modelValue",e)},L=e=>{if(!s.isEqualArr(c.value,e)){const l=s.getArrClone(c.value),i=f(l);c.value=s.getArrClone(e);const{value:o,isAll:a,info:r}=f(e);n.isShowAll&&(h.value=a),k(o),y("onChange",o,r,a,{value:i.value,info:i.info})}},Q=()=>{t.nextTick(()=>{const{value:e,isAll:l,info:i}=f(c.value);y("onInit",e,i,l)})},f=e=>{const l=[];s.isEmpty(e)||e.forEach(r=>{s.isExistJsonKey(p,r)&&l.push(s.getJsonClone(p[r]))});const i=e.join(","),o=l.length>0&&l.length===v.length;let a;return n.type==="radio"?(a={},l.length>0&&(a=l[0])):a=l,{value:i,info:a,isAll:o}},M=e=>!s.isEmpty(e.id)&&c.value.includes(e.id.toString()),U=e=>{const l={};return e.isHtml?l.width="auto":s.isEmpty(e.width)?s.isEmpty(n.width)||(l.width=n.width):l.width=e.width,l},W=()=>{const e=K.getGlobalConfig("selectTag");e?.theme&&(_.theme=e.theme)},w=e=>{const l=[];if(e.length>0){const i=p[e[0]],o=i&&!s.isEmpty(i.type)?i.type:n.type;e.forEach(a=>{if(s.isExistJsonKey(p,a)){const r=p[a];if((s.isEmpty(r.type)?n.type:r.type)===o)switch(o){case"radio":l.length===0&&l.push(a);break;case"checkbox":l.push(a);break}}})}return l},S=e=>{if(p={},v=[],!s.isEmpty(e)){const l=s.getArrClone(c.value);e.forEach(i=>{if(s.isEmpty(i?.id))return;const o=i.id.toString();p[o]=i,i.isDisabled?s.isExistValue(l,o)&&v.push(o):v.push(o)})}q.value+=1},b=()=>{if(g.value){let e=[];s.isEmpty(c.value)||(e=w(c.value),s.isEqualArr(c.value,e)||(c.value=e,k(e.join(",")))),n.isShowAll&&(h.value=e.length>0&&e.length===v.length)}},B=()=>{if(n.type==="radio"&&n.isInitRadioValue&&s.isEmpty(c.value)&&!s.isEmpty(n.list)){const e=n.list.find(l=>!l.isDisabled);if(e&&!s.isEmpty(e.id)){const l=e.id.toString();c.value=[l],k(l)}}},A=e=>{const l=D(e);s.isEqualArr(c.value,l)||(c.value=l,k(l.join(",")))},X=()=>{W(),g.value=!s.isEmpty(n.list),S(n.list),B(),b()};t.onMounted(()=>{t.nextTick(()=>{X()})}),t.watch(g,e=>{e&&Q()}),t.watch([()=>n.list,()=>n.value,()=>n.type],([e,l],[i,o])=>{const a=e;!g.value&&a!==i&&(g.value=!0),l!==o&&A(l),S(a),l===o&&B(),b()});const T=async()=>{if(!n.disabled&&!s.isEmpty(n.list)){const e=++E;if(!n.list.some(r=>!r.isDisabled))return;const i=[];n.list.forEach(r=>{if(s.isEmpty(r.id))return;const d=r.id.toString();r.isDisabled?s.isExistValue(c.value,d)&&i.push(d):h.value||i.push(d)});const o=w(i);let a=!0;if(n.checkChangeBefore){const{value:r}=f(o),d=f(s.getArrClone(c.value));try{a=await n.checkChangeBefore(r,d.value),a=s.isBoolean(a)?a:!0}catch(m){a=!1,y("onError",m instanceof Error?m.message:String(m))}}a&&e===E&&L(o)}},V=async e=>{if(!e.isDisabled&&!n.disabled&&!s.isEmpty(e.id)){const l=++E;let i=n.type;i=s.isEmpty(e.type)?i:e.type;const o=s.getArrClone(c.value);let a=[];const r=e.id.toString();if(o.length===0)a=[r];else if(i==="radio")s.isEqualArr(o,[r])?a=n.isRadioClickCancel?[]:o:a=[r];else{const m=p[o[0]];(m&&!s.isEmpty(m.type)?m.type:n.type)==="radio"?a=[r]:s.isExistValue(o,r)?a=s.getArrRemoveById(o,r):(a=s.getArrClone(o),a.push(r))}let d=!0;if(n.checkChangeBefore){const{value:m}=f(a),F=f(o);try{d=await n.checkChangeBefore(m,F.value),d=s.isBoolean(d)?d:!0}catch(I){d=!1,y("onError",I instanceof Error?I.message:String(I))}}d&&l===E&&L(a)}},$=()=>w(c.value).join(",");return C({getValue:$,getValueData:()=>{const{value:e,info:l}=f($().split(","));return n.type==="radio"&&s.isEmpty(e)?null:l},setValue:e=>{A(e),S(n.list),b()},runInitComplete:()=>{g.value||(g.value=!0,A(n.value),S(n.list),B(),b())}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",{id:t.unref(N),class:t.normalizeClass(O.value)},[u.isPlaintext?(t.openBlock(),t.createElementBlock("div",te,t.toDisplayString(H.value),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64)),u.isPlaintext?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",le,[u.isShowAll?(t.openBlock(),t.createElementBlock("li",{key:0,role:"option","aria-selected":h.value,"aria-disabled":u.disabled,tabindex:u.disabled?-1:0,class:t.normalizeClass({"selectTag-item":!0,"selectTag-active":h.value,"selectTag-disabled":u.disabled}),style:t.normalizeStyle(G.value),onClick:l[0]||(l[0]=i=>T()),onKeydown:[l[1]||(l[1]=t.withKeys(t.withModifiers(i=>T(),["prevent"]),["enter"])),l[2]||(l[2]=t.withKeys(t.withModifiers(i=>T(),["prevent"]),["space"]))]},[t.createElementVNode("span",null,t.toDisplayString(u.showAllLabel||t.unref(P).checkboxAll),1)],46,ie)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.value,(i,o)=>(t.openBlock(),t.createElementBlock("li",{key:`${J}-${i.id}-${o}`,role:"option","aria-selected":M(i),"aria-disabled":i.isDisabled||u.disabled,tabindex:i.isDisabled||u.disabled?-1:0,class:t.normalizeClass({"selectTag-item":!0,"selectTag-active":M(i),"selectTag-disabled":i.isDisabled||u.disabled}),style:t.normalizeStyle(U(i)),onClick:a=>V(i),onKeydown:[t.withKeys(t.withModifiers(a=>V(i),["prevent"]),["enter"]),t.withKeys(t.withModifiers(a=>V(i),["prevent"]),["space"])]},[t.renderSlot(e.$slots,"default",{data:i},()=>[i.isHtml?(t.openBlock(),t.createElementBlock("span",{key:0,innerHTML:t.unref(s).encodeHTML(i.name)},null,8,ne)):(t.openBlock(),t.createElementBlock("span",ae,t.toDisplayString(i.name),1))])],46,se))),128))]))],10,ee))}});exports._sfc_main=oe;
|
|
@@ -2,8 +2,8 @@ import { defineComponent as Q, ref as M, computed as f, watch as x, openBlock as
|
|
|
2
2
|
import l from "@cldemo/ui-kit/common/base";
|
|
3
3
|
import Y from "@cldemo/ui-kit/common/Element";
|
|
4
4
|
import { _ as Z } from "./Index.vue_vue_type_script_setup_true_lang-C2LGy18j.js";
|
|
5
|
-
import { _ as ee } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
6
|
-
import { _ as te } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
import { _ as ee } from "./Index.vue_vue_type_script_setup_true_lang-D4a5Iaue.js";
|
|
6
|
+
import { _ as te } from "./Index.vue_vue_type_script_setup_true_lang-2dwwjiTV.js";
|
|
7
7
|
import { a as ae } from "./language-CZZEj4e3.js";
|
|
8
8
|
const ie = ["id"], ne = { class: "paginate-statistic" }, se = { class: "paginate-list" }, le = {
|
|
9
9
|
class: "pagination",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),t=require("@cldemo/ui-kit/common/base"),Ee=require("@cldemo/ui-kit/common/globalConfig"),pe=require("@cldemo/ui-kit/common/Element"),ve=require("@cldemo/ui-kit/common/log"),xe=require("./Index.vue_vue_type_script_setup_true_lang-CZNVHUR1.js"),q=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js"),Se=require("./language-BJ4aVgHI.js"),Be=require("./Index.vue_vue_type_script_setup_true_lang-D_YbdXMB.js");;/* empty css */const z={format:{img:["jpg","jpe","jpeg","png","gif","bmp","ico"],video:["mp4","rmvb","3gp","avi","asf","asf","dv","mov","mpg4","mpeg","mpg","wm","wmx","flv","mkv","mp4a","rm","wmv","swf","swfl"],audio:["mp3","ogg","wav","wma","mid","ra","ram"],zip:["rar","zip"],excel:["xls","xlsx","csv"],pdf:["pdf"],txt:["txt"],doc:["doc","docx"]},icon:{img:"image",video:"video",audio:"music",txt:"text",zip:"zip",excel:"excel",pdf:"pdf",doc:"word",default:"file"},suffix:{jpg:["jpg","jpe","jpeg"],jpe:["jpg","jpe","jpeg"],jpeg:["jpg","jpe","jpeg"],png:["png"],gif:["gif"],bmp:["bmp"],ico:["ico"],mp4:["mp4"],rmvb:["rmvb"],"3gp":["3gp"],avi:["avi"],asf:["asf"],dv:["dv"],mov:["mov"],mpg4:["mpg4"],mpeg:["mpeg"],mpg:["mpg"],wm:["wm"],wmx:["wmx"],flv:["flv"],mkv:["mkv"],mp4a:["mp4a"],rm:["rm"],wmv:["wmv"],swf:["swf"],swfl:["swfl"],mp3:["mp3"],ogg:["ogg"],wav:["wav"],wma:["wma"],mid:["mid"],ra:["ra"],ram:["ram"],rar:["rar"],zip:["zip"],txt:["txt"],xls:["xls","xlsx","csv"],xlsx:["xls","xlsx","csv"],csv:["xls","xlsx","csv"],pdf:["pdf"],doc:["doc","docx"]},mime:{jpg:["image/jpg","image/jpeg","image/pjpeg"],jpe:["image/jpg","image/jpeg","image/pjpeg"],jpeg:["image/jpg","image/jpeg","image/pjpeg"],png:["image/png","image/x-png"],gif:["image/gif"],bmp:["image/bmp"],ico:["ico"],mp4:["video/mp4"],rmvb:["audio/x-pn-realaudio"],"3gp":["video/3gpp"],avi:["video/x-msvideo"],asf:["video/x-ms-asf"],dv:["video/x-dv"],mov:["video/quicktime"],mpg4:["video/mp4"],mpeg:["video/mpeg"],mpg:["video/mpeg"],wm:["video/x-ms-wmv"],wmx:["video/x-ms-wmx"],flv:["video/x-flv"],mkv:["video/x-matroska"],mp4a:["audio/mp4"],rm:["audio/x-pn-realaudio"],wmv:["audio/x-ms-wmv"],swf:["application/x-shockwave-flash"],swfl:["application/x-shockwave-flash"],mp3:["audio/mpeg"],ogg:["audio/ogg"],wav:["audio/wav"],wma:["audio/x-ms-wma"],mid:["audio/midi"],ra:["audio/x-pn-realaudio"],ram:["audio/x-pn-realaudio"],rar:["application/x-rar-compressed"],zip:["application/zip","application/x-zip-compressed"],txt:["text/plain"],xls:["application/vnd.ms-excel","application/wps-office.xls"],xlsx:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/wps-office.xlsx"],csv:["text/csv"],pdf:["application/pdf"],doc:["application/msword"],docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},getFormatGroup:n=>{let p=[];return t.isNonEmptyString(n)&&(n.split(",").forEach(i=>{for(const[S,N]of Object.entries(z.format))t.isExistValue(N,i.toLocaleLowerCase())&&p.push(S)}),p=t.getArrUnique(p)),p},getIcon:n=>{let p="";return t.isEmpty(n)?p=z.icon.default:p=t.isExistJsonKey(z.icon,n)?z.icon[n]:z.icon.default,p},getSuffix:n=>{let p=[];return t.isEmpty(n)||(n.forEach(f=>{const i=z.suffix[f.toLocaleLowerCase()];t.isUndefined(i)||(p=p.concat(i))}),t.isEmpty(p)&&(p=n)),p=t.getArrUnique(p),p},getRegexBySuffix:n=>{if(t.isEmpty(n))return null;const p=`\\.(?:${n.join("|")})$`;return new RegExp(p,"i")},getMime:n=>{let p=[];return t.isEmpty(n)||n.forEach(f=>{const i=z.mime[f];t.isUndefined(i)||(p=p.concat(i))}),p=t.getArrUnique(p),p},getRegexByMime:n=>{if(t.isEmpty(n))return null;const p=`^(?:${n.join("|").replace(/\//g,"\\/")})$`;return new RegExp(p,"i")},getImageThumbnail:(n,p,f)=>{let i=null;try{const S=document.createElement("canvas");S.width=p,S.height=f,S.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,p,f),i=S.toDataURL("image/gif")}catch{i=null}return i}},we=(n,p)=>{let f=n;const i=e.reactive({mime:[],suffix:[],isCheckImgWH:!1});let S=null;const N=r=>{f=t.getJsonMerge(f,r),j()},T=r=>{const g=f.checkMsg;return t.isString(g)&&!t.isEmpty(g)?g:t.isObject(g)&&!t.isEmpty(g[r])?g[r]:p.value[r]},j=()=>{const r=t.isNonEmptyString(f.checkFormat)?z.getSuffix(f.checkFormat.split(",")):[],g=z.getMime(r),w=!t.isEmpty(f.checkWidth)&&!t.isEmpty(f.checkHeight);i.mime=g,i.suffix=r,i.isCheckImgWH=w},P=r=>{const g=z.getIcon(r);return{type:r,icon:g,isImage:r==="img",isVideo:r==="video",isAudio:r==="audio",isTxt:r==="txt",isZip:r==="zip"}},H=(r,g)=>{if(t.isUndefined(S)){S={};for(const[s,a]of Object.entries(z.format)){const E=z.getSuffix(a),k=z.getMime(E),B=z.getRegexBySuffix(E),F=z.getRegexByMime(k);S[s]={suffix:E,mime:k,regSuffix:B,regMime:F}}}let w="";return Object.keys(S).forEach(s=>{if(w.length===0){const a=S[s];(a.regSuffix&&a.regSuffix.test(r)||g&&a.regMime&&a.regMime.test(g))&&(w=s)}}),P(w)},X=r=>{const g=z.getFormatGroup(t.isEmpty(r)?f.checkFormat:r),w=g.length===1?g[0]:"";return P(w)},A=r=>{if(!t.isString(r))return H("");if(r.startsWith("data:")||r.startsWith("blob:")){const w=r.match(/^[a-z]+:([a-zA-Z0-9.+-]+\/[a-zA-Z0-9.+-]+)/);return H("",w?w[1]:"")}const g=r.substring(r.lastIndexOf("/")+1).split("?")[0].split("#")[0];return H(g)},J=(r,g,w,s,a)=>{const E=t.isFinite(w)&&w>0?w:0,k=t.isFinite(s)&&s>0?s:0;let B=a;(B==="height"||B==="contain")&&k===0&&(B="width");let F=1;switch(B){case"height":F=k>0?k/g:1;break;case"contain":F=Math.min(E>0?E/r:1,k>0?k/g:1);break;case"width":default:F=E>0?E/r:1;break}return F>1&&(F=1),{tw:Math.round(r*F),th:Math.round(g*F)}},te=(r,g,w,s)=>new Promise((a,E)=>{const k=document.createElement("img");k.onload=B=>{const F=B.target.width,$=B.target.height,{tw:G,th:W}=J(F,$,g,w,s),I=B.target.src;a({src:I,w:F,h:$,tw:G,th:W,isImage:!0})},k.onerror=()=>{E(new Error("fail: temp create image"))},k.src=r}),ne=(r,g)=>{const w=t.isEmpty(f.checkWidth)?0:parseInt(f.checkWidth,10),s=t.isEmpty(f.checkHeight)?0:parseInt(f.checkHeight,10);if(!t.isFinite(w)||!t.isFinite(s)||w===0||s===0)return!0;let a=!0;switch(f.checkWHType){case"greater":a=r>=w&&g>=s;break;case"less":a=r<=w&&g<=s;break;case"equal":a=r===w&&g===s;break;default:a=!0;break}return a},le=(r,g)=>new Promise((w,s)=>{if(r instanceof File){const a=new FileReader;a.onload=E=>{te(E.target.result,g.maxWidth,g.maxHeight,g.imgFit).then(k=>{(i.isCheckImgWH?ne(k.w,k.h):!0)?w(k):s(new Error(T("checkImageWHLabel")))}).catch(k=>{s(k)})},a.onerror=()=>{s(new Error("fail: new FileReader image onload()"))},a.readAsDataURL(r)}else s(new Error("fail: file is not a File instance"))}),Y=async(r,g)=>{let w=[];const s=[],a=[],E=z.getRegexBySuffix(i.suffix),k=z.getRegexByMime(i.mime),B=W=>{const I=t.isEmpty(W)?NaN:parseInt(W,10);return t.isFinite(I)?I*1024:null},F=B(f.checkMinSize),$=B(f.checkMaxSize),G=r.length;for(let W=0;W<G;W+=1){const I=[],L=r[W],O={suffix:!1,mime:!1,size:!1},u=L.name;E&&!E.test(u)&&(O.suffix=!0);const y=L.type;!t.isEmpty(y)&&k&&!k.test(y)&&(O.mime=!0),F&&L.size<F&&(O.size=!0),$&&L.size>$&&(O.size=!0),(O.suffix||O.mime)&&I.push(T("checkSuffixMimeLabel")),O.size&&I.push(T("checkSizeLabel"));const v=H(u,y);let d=null;v.isImage&&(d=await le(L,g).catch(M=>{I.push(M.message)})),t.isUndefined(d)&&(d={}),d=t.getJsonMerge(d,v),d.fileName=u,d.file=L,I.length===0?(s.push(L),a.push(d)):G===1?w=I.map(M=>`${T("uploadFile")} ${M}`):w.push(`${u}:${I.join(",")}`)}return new Promise(W=>{setTimeout(()=>{W({errorMsg:w,passFiles:s,passFilesInfo:a,original:r})},200)})};return j(),{optBase:i,getTypeByFormat:X,getTypeByUrl:A,createTempImg:te,checkFile:Y,setBaseOptions:N}},ye=()=>({setFileInfo:(p,f)=>{const i=f&&f.fileUrl?f.fileUrl:"";if(!t.isString(i))return{name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0};const S=t.isEmpty(i);let N="";S||i.startsWith("blob:")?N=p.fileName:N=i.substr(i.lastIndexOf("/")+1);let T="",j=0,P=0;return p.isImage&&(T=S?p.src:i,j=p.tw||0,P=p.th||0),{name:N,url:i,imgSrc:T,imgWidth:j,imgHeight:P}}}),be=()=>{const n=(f,i)=>{window.open(f)};return{downloadHref:n,downloadBlob:f=>{if(!t.isEmpty(f)){const i=f.lastIndexOf("/"),S=f.substring(i+1),N=f.replace(/\\/g,"/"),T=new XMLHttpRequest;T.open("GET",N,!0),T.responseType="blob",T.onload=()=>{if(T.status===200){const j=window.URL||window.webkitURL||window,P=new Blob([T.response]),H=document.createElementNS("http://www.w3.org/1999/xhtml","a");H.href=j.createObjectURL(P),H.download=S,H.click(),setTimeout(()=>URL.revokeObjectURL(H.href),1e3)}else n(f)},T.onerror=()=>{n(f)},T.send()}}}},Fe=["name","accept"],Ue=["name"],Te={class:"fileUpload-label"},Me={key:0,class:"fileUpload-img"},Ie={class:"fileUpload-img-container"},Ce=["src","width","height"],_e={key:0,class:"file-complete-img-msg"},Ne=["title"],He=["title"],Re={key:1,class:"fileUpload-video"},We=["src"],Oe=["title"],ze={key:2,class:"fileUpload-file"},Pe=["title"],Le={key:0,class:"fileUpload-load"},je=e.defineComponent({name:"ClFileUploadDefault",__name:"Default",props:{name:String,value:[String,Array,Object],className:String,disabled:{type:Boolean,default:!1},defaultHoverTitle:String,defaultIcon:String,checkFormat:String,checkMinSize:[String,Number],checkMaxSize:[String,Number],checkWidth:[String,Number],checkHeight:[String,Number],checkWHType:{type:String,default:"equal",validator:n=>["equal","greater","less"].includes(n)},imgFit:{type:String,default:"width",validator:n=>["width","height","contain"].includes(n)},isServerCallback:Boolean,isShowPreview:{type:Boolean,default:!0},isShowDownload:{type:Boolean,default:!0},isShowCompleteMsg:{type:Boolean,default:!0}},emits:["onChange","onError","onRemove","onPreview","onSaveFile"],setup(n,{expose:p,emit:f}){const i=n,S=f,{optPageLanguage:N,getPageLanguage:T}=Se.useLanguage();T("fileUpload");const j=e.inject("$FileuploadTop",null);j||ve.warn("FileUpload","Default 主题缺少 $FileuploadTop 注入,使用空校验配置");const{setFileInfo:P}=ye(),H=()=>t.getJsonMerge(j?.getFileCheckInfo()??{},{checkFormat:i.checkFormat,checkWidth:i.checkWidth,checkHeight:i.checkHeight,checkWHType:i.checkWHType,checkMinSize:i.checkMinSize,checkMaxSize:i.checkMaxSize}),{optBase:X,getTypeByFormat:A,getTypeByUrl:J,createTempImg:te,checkFile:ne,setBaseOptions:le}=we(H(),N),{downloadBlob:Y,downloadHref:r}=be(),g=e.useTemplateRef("refElTopParent"),w=()=>{const l=g.value;if(!l)return{maxWidth:0,maxHeight:0};const h=4,C=l.clientWidth>0?Math.max(l.clientWidth-h,0):0;let D=0;if(i.imgFit==="height"||i.imgFit==="contain"){const V=l.parentElement;V&&V.clientHeight>0&&(D=getComputedStyle(V).height==="auto"?0:Math.max(V.clientHeight-h,0))}return{maxWidth:C,maxHeight:D}},s=e.reactive({isImage:!1,isVideo:!1,icon:"",completeMsgTxt:"",isInitFileInput:!0,runOperateType:"init"}),a=e.reactive({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),E={file:null};let k=0,B=null;const F=`fileUpload_${t.getRandom(8)}`,$=e.computed(()=>{let l=i.name;return t.isEmpty(l)&&(l=`fileUpload_${t.getRandom(8)}`),l}),G=e.computed(()=>{let l={"fileUpload-default":!0};return l=t.getJsonMerge(l,pe.getClassNameJson(i.className)),l}),W=e.computed(()=>({"fileUpload-wait":!0,"fileUpload-disabled":i.disabled})),I=e.computed(()=>({"fileUpload-complete":!0,"fileUpload-disabled":i.disabled})),L=l=>{S("onChange",l)},O=l=>{S("onError",l)},u=()=>{S("onRemove")},y=(l,h)=>{S("onPreview",l,h)},v=(l,h)=>{S("onSaveFile",l,h)},d=l=>{s.isImage=l.isImage,s.isVideo=l.isVideo,s.icon=l.icon},M=()=>{const l=A();t.isNonEmptyString(i.defaultIcon)&&(l.icon=i.defaultIcon),d(l)},x=l=>{l!=="load"&&(s.isInitFileInput=!0);let h="";switch(l){case"remove":case"clean":{h="init",M();break}case"fail":{let C=!0;s.isImage?(!t.isEmpty(a.url)||!t.isEmpty(a.imgSrc))&&(C=!1):t.isEmpty(a.url)||(C=!1),h=C?"init":"complete";break}default:h=l}s.runOperateType=h},R=l=>{const h=a;for(const[C,D]of Object.entries(l))t.isUndefined(h[C])||(h[C]=D);E.file=l.file??E.file},K=(l,h)=>{ae(),d(l);const C=P(l,h);R(C),x("complete")},ie=()=>{let l=null;return t.isString(a.url)&&a.url.startsWith("blob:")?l=E.file:t.isEmpty(a.url)?s.isImage&&!t.isEmpty(a.imgSrc)?l=a.imgSrc:l=E.file:l=a.url,t.isUndefined(l)&&(l=""),l},me=l=>{if(l.length>0&&s.runOperateType!=="load"){s.isInitFileInput=!1,x("load"),k+=1;const h={...w(),imgFit:i.imgFit};ne(l,h).then(C=>{if(s.runOperateType==="load")if(C.passFiles.length>0){const D=C.passFiles[0],V=C.passFilesInfo[0];if(V.isImage)i.isServerCallback?(v(D,V),ue()):(K(V,{}),E.file=D,L(V.src));else if(i.isServerCallback)v(D,V),ue();else{const re={};if(V.isVideo){const de=URL.createObjectURL(D);re.fileUrl=de}K(V,re),E.file=D,L(D)}}else x("fail"),C.errorMsg.length>0&&O(C.errorMsg)}).catch(()=>{s.runOperateType==="load"&&(x("fail"),O(["文件校验失败,请重试"]))})}},oe=l=>{if(!t.isNonEmptyString(l)){(t.isString(l)||t.isUndefined(l))&&ge();return}const h=++k,C=J(l);if(s.isImage&&C.isImage){const{maxWidth:D,maxHeight:V}=w();te(l,D,V,i.imgFit).then(re=>{if(h!==k)return;const de=t.getJsonMerge(re,C);K(de,{fileUrl:l})}).catch(()=>{h===k&&(x("fail"),O(["图片加载失败,请检查图片地址"]))})}else K(C,{fileUrl:l})},ae=()=>{t.isString(a.url)&&a.url.startsWith("blob:")&&URL.revokeObjectURL(a.url)},ee=()=>{B&&(clearTimeout(B),B=null)},ue=()=>{ee(),B=setTimeout(()=>{s.runOperateType==="load"&&(x("fail"),O(["服务端保存超时,请重试"]))},6e4)},ge=()=>{k+=1,E.file=null,R({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("init")},ce=()=>{if(t.isEmpty(i.value)){M();return}d(J(i.value))},fe=()=>{let l=i.defaultHoverTitle;s.isImage&&X.isCheckImgWH&&t.isEmpty(l)&&(l=`${i.checkWidth}x${i.checkHeight}`),s.completeMsgTxt=l},he=()=>{ce(),fe(),oe(i.value)};e.onMounted(()=>{e.nextTick(()=>{he()})}),e.watch(()=>i.value,(l,h)=>{if(l!==h){const C=ie();l!==C&&(ee(),ce(),oe(l))}}),e.watch([()=>i.checkFormat,()=>i.checkWidth,()=>i.checkHeight,()=>i.checkWHType,()=>i.checkMinSize,()=>i.checkMaxSize],()=>{if(ee(),le(H()),ce(),fe(),s.runOperateType==="load")return;const l=ie();i.value===l&&oe(i.value)});const ke=l=>{l.preventDefault(),l.stopPropagation(),!i.disabled&&l.dataTransfer&&me(l.dataTransfer.files)},o=l=>{i.disabled||me(l.currentTarget.files)},c=()=>{ee(),k+=1,ae(),E.file=null,R({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("remove");const l=document.getElementById(F);l&&(l.value=""),u()},m=l=>{const h=t.isEmpty(a.url)?a.imgSrc:a.url;y(h,"image"),l.preventDefault(),l.stopPropagation()},U=l=>{t.isEmpty(a.url)||y(a.url,"video"),l.preventDefault(),l.stopPropagation()},b=l=>{t.isEmpty(a.url)?r(a.imgSrc,a.name):Y(a.url),l.preventDefault(),l.stopPropagation()},_=l=>{if(t.isString(a.url)&&a.url.startsWith("blob:")){const h=document.createElement("a");h.href=a.url,h.download=a.name,h.click()}else Y(a.url);l.preventDefault(),l.stopPropagation()};return p({saveServerCallback:l=>{if(ee(),s.runOperateType!=="load")return;if(!l||!l.res||!t.isBoolean(l.res.success)){x("fail"),O(["文件保存失败,请重试"]);return}if(!l.res.success){x("fail"),O(["文件保存失败,请重试"]);return}if(!l.req){x("fail"),O(["文件保存失败,请重试"]);return}let h="";if(t.isString(l.res.fileUrl)?h=l.res.fileUrl:t.isArray(l.res.fileUrl)&&l.res.fileUrl.length>0&&t.isString(l.res.fileUrl[0])&&(h=l.res.fileUrl[0]),t.isEmpty(h)){E.file=null,R({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("init");return}K(l.req,{fileUrl:h}),L(h)},getValue:()=>ie(),cleanReduction:()=>{ee(),k+=1,ae(),E.file=null,R({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("clean")}}),e.onBeforeUnmount(()=>{ee(),ae()}),(l,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(G.value),ref_key:"refElTopParent",ref:g},[e.createElementVNode("div",{class:"fileUpload-default-container",onDrop:ke,onDragover:h[0]||(h[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("label",{for:F},[s.isInitFileInput&&!n.disabled?(e.openBlock(),e.createElementBlock("input",{key:0,type:"file",id:F,name:$.value,onChange:o,accept:e.unref(X).mime.join(",")},null,40,Fe)):(e.openBlock(),e.createElementBlock("input",{key:1,id:F,name:$.value,style:{display:"none !important"}},null,8,Ue)),s.runOperateType==="init"?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(W.value)},[e.createVNode(q._sfc_main,{name:s.icon,class:"fileUpload-icon"},null,8,["name"]),e.createElementVNode("span",Te,[e.renderSlot(l.$slots,"label")])],2)):s.runOperateType==="complete"?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(I.value)},[s.isImage?(e.openBlock(),e.createElementBlock("span",Me,[e.createElementVNode("span",Ie,[e.createElementVNode("img",{src:a.imgSrc,width:a.imgWidth,height:a.imgHeight},null,8,Ce)]),n.isShowCompleteMsg?(e.openBlock(),e.createElementBlock("span",_e,e.toDisplayString(s.completeMsgTxt),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),n.isShowPreview&&!n.disabled?(e.openBlock(),e.createElementBlock("i",{key:2,class:"preview-icon",title:e.unref(N).common.preview,onClick:e.withModifiers(m,["stop"])},[e.createVNode(q._sfc_main,{name:"search-plus"})],8,Ne)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[],64)),n.isShowDownload&&!n.disabled?(e.openBlock(),e.createElementBlock("i",{key:4,class:"download-icon",title:e.unref(N).common.download,onClick:e.withModifiers(b,["stop"])},[e.createVNode(q._sfc_main,{name:"download"})],8,He)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[],64))])):s.isVideo?(e.openBlock(),e.createElementBlock("span",Re,[e.createElementVNode("video",{src:a.url},null,8,We),n.isShowPreview&&!n.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:"preview-icon",onClick:e.withModifiers(U,["stop"])},[e.createVNode(q._sfc_main,{name:"play"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),n.isShowDownload&&!n.disabled?(e.openBlock(),e.createElementBlock("i",{key:2,class:"download-icon",title:e.unref(N).common.download,onClick:e.withModifiers(_,["stop"])},[e.createVNode(q._sfc_main,{name:"download"})],8,Oe)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[],64))])):(e.openBlock(),e.createElementBlock("span",ze,[e.createVNode(q._sfc_main,{name:s.icon,class:"fileUpload-icon"},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(a.name),1)])),n.disabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[],64)):(e.openBlock(),e.createElementBlock("a",{key:3,class:"file-complete-remove",href:"javascript:",title:e.unref(N).common.delete,onClick:e.withModifiers(c,["stop"])},[e.createVNode(q._sfc_main,{name:"close"})],8,Pe))],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[],64))])],32),s.runOperateType==="load"?(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(xe._sfc_main,{theme:"circleBubble",size:"large"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))],2))}}),$e=["id","name","multiple","accept"],Ve=["id","name","disabled","accept"],De=["for"],qe={key:0,class:"fileUpload-list"},Ae={key:0,class:"fileUpload-item-icon fileUpload-item-img"},Je=["src"],Ge=["title","onClick"],Xe={key:1,class:"fileUpload-item-icon fileUpload-item-video"},Ke=["src"],Ze=["onClick"],Qe={class:"fileUpload-item-name"},Ye={class:"fileUpload-item-operate"},et=["title","onClick"],tt=["title","onClick"],it=e.defineComponent({name:"ClFileUploadButton",__name:"Button",props:{name:String,value:[String,Array,Object],className:String,disabled:{type:Boolean,default:!1},isMultiple:Boolean,buttonClass:String,buttonLabel:String,buttonIcon:{type:String,default:""},buttonColor:{type:String,default:"default"},checkFormat:String,checkMinSize:[String,Number],checkMaxSize:[String,Number],checkWidth:[String,Number],checkHeight:[String,Number],checkWHType:{type:String,default:"equal",validator:n=>["equal","greater","less"].includes(n)},isServerCallback:Boolean,isShowUploadResult:{type:Boolean,default:!0},isShowUploadIng:{type:Boolean,default:!0},isShowPreview:{type:Boolean,default:!0},isShowDownload:{type:Boolean,default:!0}},emits:["onChange","onError","onRemove","onPreview","onSaveFile"],setup(n,{expose:p,emit:f}){const i=n,S=f,N=`fileupload-${t.getRandom(5)}`,{optPageLanguage:T,getPageLanguage:j}=Se.useLanguage();j("fileUpload");const P=e.inject("$FileuploadTop",null);P||ve.warn("FileUpload","Button 主题缺少 $FileuploadTop 注入,使用空校验配置");const H=()=>t.getJsonMerge(P?.getFileCheckInfo()??{},{checkFormat:i.checkFormat,checkWidth:i.checkWidth,checkHeight:i.checkHeight,checkWHType:i.checkWHType,checkMinSize:i.checkMinSize,checkMaxSize:i.checkMaxSize}),{setFileInfo:X}=ye(),{optBase:A,getTypeByUrl:J,checkFile:te,setBaseOptions:ne}=we(H(),T),{downloadBlob:le,downloadHref:Y}=be(),r=e.useTemplateRef("refElButton"),g=e.useTemplateRef("refElLabel"),w=t.getRandom(8),s=e.reactive({elFileId:`btnFile${w}`,isInitFileInput:!0}),a=e.ref([]),E=e.ref([]);let k=null,B=null,F=null;const $=e.computed(()=>{let o=i.name;return t.isEmpty(o)&&(o=`fileUpload_${t.getRandom(8)}`),o}),G=e.computed(()=>{let o={"fileUpload-button":!0};return o=t.getJsonMerge(o,pe.getClassNameJson(i.className)),o}),W=(o,c)=>{S("onChange",o,c)},I=o=>{S("onError",o)},L=()=>{S("onRemove")},O=(o,c,m)=>{S("onPreview",o,c,m)},u=(o,c)=>{S("onSaveFile",o,c)},y=()=>{v(),k=setTimeout(()=>{k=null,s.isInitFileInput||(M("fail"),I(["服务端保存超时,请重试"]))},6e4)},v=()=>{k&&(clearTimeout(k),k=null)},d=()=>{a.value.forEach(o=>{t.isString(o.url)&&o.url.startsWith("blob:")&&URL.revokeObjectURL(o.url)})},M=o=>{switch(o){case"load":i.isShowUploadIng&&r.value?.loadStart();break;case"fail":case"complete":i.isShowUploadIng&&r.value?.loadStop();break}s.isInitFileInput=o!=="load"},x=(o,c)=>{i.isMultiple||(d(),a.value=[]);const m=[],U=[];a.value.forEach(b=>{m.push(b),U.push(b.rId)});for(let b=0;b<o.length;b++){let _=c.length>b?{fileUrl:c[b]}:{};t.isEmpty(_.fileUrl)&&o[b].isVideo&&o[b].file&&(_={fileUrl:URL.createObjectURL(o[b].file)});let Z=X(o[b],_);Z.rId=t.getRandom(9),Z=t.getJsonMerge(o[b],Z),m.push(Z),U.push(Z.rId)}a.value=m,M("complete"),e.nextTick(()=>{E.value=U})},R=()=>{const o=[];return a.value.forEach(c=>{let m=null;t.isString(c.url)&&c.url.startsWith("blob:")?m=c.file:t.isEmpty(c.url)?c.isImage&&!t.isEmpty(c.imgSrc)?m=c.imgSrc:m=c.file:m=c.url,t.isUndefined(m)||o.push(m)}),o.length===0?"":i.isMultiple?o:o[0]},K=o=>{if(t.isArray(o)){d(),a.value=[];const U=[],b=[];o.forEach(_=>{if(t.isNonEmptyString(_)){const Z=J(_);U.push(Z),b.push(_)}}),x(U,b);return}if(!t.isNonEmptyString(o)){t.isString(o)&&ie();return}d(),a.value=[];const c=[],m=[];o.split(",").filter(U=>t.isNonEmptyString(U)).forEach(U=>{const b=J(U);c.push(b),m.push(U)}),x(c,m)},ie=()=>{d(),M("init"),a.value=[]},me=()=>{K(i.value)};e.onMounted(()=>{e.nextTick(()=>{me()})}),e.onBeforeUnmount(()=>{v(),B&&(clearTimeout(B),B=null),d()}),e.watch(()=>i.value,(o,c)=>{if(o!==c){const m=R();o!==m&&(v(),K(o))}}),e.watch([()=>i.checkFormat,()=>i.checkWidth,()=>i.checkHeight,()=>i.checkWHType,()=>i.checkMinSize,()=>i.checkMaxSize],()=>{s.isInitFileInput&&v(),ne(H())});const oe=o=>{i.disabled||s.isInitFileInput&&o.currentTarget.files.length>0&&(M("load"),te(o.currentTarget.files,{}).then(c=>{if(!s.isInitFileInput){if(c.passFiles.length>0)if(i.isServerCallback){const m=i.isMultiple?c.passFiles:c.passFiles[0],U=i.isMultiple?c.passFilesInfo:c.passFilesInfo[0];u(m,U),y()}else i.isMultiple?(x(c.passFilesInfo,[]),W(c.passFiles,c.passFilesInfo)):(x(c.passFilesInfo,[]),W(c.passFiles[0],c.passFilesInfo[0]));else c.errorMsg.length===0&&(M("fail"),I(["文件校验失败,请重试"]));c.errorMsg.length>0&&(I(c.errorMsg),c.passFiles.length===0&&M("fail"))}}).catch(()=>{s.isInitFileInput||(M("fail"),I(["文件校验失败,请重试"]))}))},ae=(o,c)=>{const m=t.isEmpty(o.url)?o.src:o.url;O(m,"image",c)},ee=(o,c)=>{t.isEmpty(o.url)||O(o.url,"video",c)},ue=o=>{if(F===o)return;F=o,v(),s.isInitFileInput||M("complete");const c=a.value.find(_=>_.rId===o);c&&t.isString(c.url)&&c.url.startsWith("blob:")&&URL.revokeObjectURL(c.url);const m=[],U=[];a.value.forEach(_=>{_.rId!==o&&(m.push(_),U.push(_.rId))}),E.value=U;const b=document.getElementById(s.elFileId);b&&(b.value=""),e.nextTick(()=>{m.length>0?(a.value=m,F=null,L()):B=setTimeout(()=>{B=null,a.value=a.value.filter(_=>_.rId!==o),F=null,L()},500)})},ge=o=>{if(o.isImage&&t.isEmpty(o.url))Y(o.imgSrc,o.name);else if(t.isString(o.url)&&o.url.startsWith("blob:")){const c=document.createElement("a");c.href=o.url,c.download=o.name,c.click()}else if(t.isEmpty(o.url)&&o.file){const c=URL.createObjectURL(o.file),m=document.createElement("a");m.href=c,m.download=o.name,m.click(),setTimeout(()=>{URL.revokeObjectURL(c)},1e3)}else le(o.url)},ce=()=>{g.value?.click()};return p({saveServerCallback:o=>{if(v(),!s.isInitFileInput){if(t.isUndefined(o)||t.isUndefined(o.res)||!t.isBoolean(o.res.success)||t.isUndefined(o.req)){M("fail"),I(["文件保存失败,请重试"]);return}if(o.res.success){let c=[];const m=[];if(t.isNonEmptyString(o.res.fileUrl)?(c.push(o.res.fileUrl),m.push(0)):t.isArray(o.res.fileUrl)&&o.res.fileUrl.forEach((se,Q)=>{t.isNonEmptyString(se)&&(c.push(se),m.push(Q))}),c.length===0){M("complete");return}const U=i.isMultiple?o.req:[o.req];let b=[],_=[];if(!i.isMultiple)b=c,_=U;else{const se=a.value.map(Q=>Q.url).filter(Q=>t.isNonEmptyString(Q));c.forEach((Q,l)=>{const h=m[l];se.indexOf(Q)>-1||t.isUndefined(U[h])||(se.push(Q),b.push(Q),_.push(U[h]))})}if(b.length===0){M("complete");return}x(_,b);const Z=i.isMultiple?b:b[0];W(Z)}else M("fail"),I(["文件保存失败,请重试"])}},getValue:()=>R(),cleanReduction:()=>{v(),ie()}}),(o,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(G.value)},[s.isInitFileInput&&!n.disabled?(e.openBlock(),e.createElementBlock("input",{key:0,type:"file",id:s.elFileId,name:$.value,multiple:n.isMultiple,accept:e.unref(A).mime.join(","),onChange:oe},null,40,$e)):(e.openBlock(),e.createElementBlock("input",{key:1,id:s.elFileId,name:$.value,disabled:n.disabled,accept:e.unref(A).mime.join(","),style:{display:"none !important"},onChange:oe},null,40,Ve)),e.createElementVNode("label",{ref_key:"refElLabel",ref:g,for:s.elFileId},[e.createVNode(Be._sfc_main,{ref_key:"refElButton",ref:r,className:n.buttonClass,isShowBackDrop:!0,disabled:n.disabled,label:n.buttonLabel||e.unref(T).common.upload,iconName:n.buttonIcon,color:n.buttonColor,onOnClick:ce},null,8,["className","disabled","label","iconName","color"])],8,De)],2),e.renderSlot(o.$slots,"label"),a.value.length>0&&n.isShowUploadResult?(e.openBlock(),e.createElementBlock("ul",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(m,U)=>(e.openBlock(),e.createBlock(e.Transition,{key:`${m.rId}-${U}`,name:"fileUploadButton","enter-active-class":"fileupload-anim-in","leave-active-class":"fileupload-anim-out"},{default:e.withCtx(()=>[E.value.indexOf(m.rId)>-1?(e.openBlock(),e.createElementBlock("li",{key:`${N}-${m.rId}-${U}`,class:"fileUpload-item"},[m.isImage?(e.openBlock(),e.createElementBlock("span",Ae,[e.createElementVNode("img",{src:m.imgSrc},null,8,Je),n.isShowPreview?(e.openBlock(),e.createElementBlock("i",{key:0,class:"preview-icon",title:e.unref(T).common.preview,onClick:e.withModifiers(b=>ae(m,U),["stop"])},[e.createVNode(q._sfc_main,{name:"search-plus"})],8,Ge)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])):m.isVideo?(e.openBlock(),e.createElementBlock("span",Xe,[e.createElementVNode("video",{src:m.url},null,8,Ke),n.isShowPreview?(e.openBlock(),e.createElementBlock("span",{key:0,class:"preview-icon",onClick:e.withModifiers(b=>ee(m,U),["stop"])},[e.createVNode(q._sfc_main,{name:"play"})],8,Ze)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])):(e.openBlock(),e.createBlock(q._sfc_main,{key:2,name:m.icon,class:"fileUpload-item-icon"},null,8,["name"])),e.createElementVNode("span",Qe,e.toDisplayString(m.name),1),e.createElementVNode("span",Ye,[n.isShowDownload?(e.openBlock(),e.createElementBlock("i",{key:0,class:"download-icon",title:e.unref(T).common.download,onClick:e.withModifiers(b=>ge(m),["stop"])},[e.createVNode(q._sfc_main,{name:"download"})],8,et)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),n.disabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[],64)):(e.openBlock(),e.createElementBlock("a",{key:2,class:"file-complete-remove",href:"javascript:",title:e.unref(T).common.delete,onClick:e.withModifiers(b=>ue(m.rId),["stop"])},[e.createVNode(q._sfc_main,{name:"close"})],8,tt))])])):e.createCommentVNode("",!0)]),_:2},1024))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))],64))}}),nt=["id"],lt={key:0,class:"cl-plaintext-value"},ot=["src","alt"],at=["src"],st={key:0},ct=e.defineComponent({name:"ClFileUpload",__name:"Index",props:{id:String,name:String,value:[String,Array,Object],className:String,disabled:{type:Boolean,default:!1},theme:{type:String,default:"default",validator:n=>["default","button"].includes(n)},isMultiple:{type:Boolean,default:!1},defaultHoverTitle:String,defaultIcon:String,isShowCompleteMsg:{type:Boolean,default:!0},buttonClass:String,buttonLabel:String,buttonIcon:String,buttonColor:String,checkFormat:String,checkMinSize:[String,Number],checkMaxSize:[String,Number],checkWidth:[String,Number],checkHeight:[String,Number],checkWHType:{type:String,default:"equal"},imgFit:{type:String,default:"width"},isShowPreview:{type:Boolean,default:!0},isShowDownload:{type:Boolean,default:!0},isShowUploadResult:{type:Boolean,default:!0},isShowUploadIng:{type:Boolean,default:!0},serverFileCallback:Function,isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0},plaintextSeparator:{type:String,default:","}},emits:["update:value","update:modelValue","onChange","onRemove","onError"],setup(n,{expose:p,emit:f}){const i=n,S=f,N=e.inject("$ClGlobals",null),T=e.useAttrs(),j=i.id,P=e.useTemplateRef("refElFileDefault"),H=e.useTemplateRef("refElFileButton");let X=0,A=0;const J=e.computed(()=>t.isFunction(i.serverFileCallback)),te=["jpg","jpeg","png","gif","webp","bmp","svg"],ne=["mp4","webm","ogg","ogv","mov","avi","mkv"],le=u=>{const y=u.split("?")[0].split("#")[0],v=y.split("/"),d=v.length>0?v[v.length-1]:y;return t.isEmpty(d)?u:decodeURIComponent(d)},Y=e.computed(()=>{const u=i.value,y=Array.isArray(u)?u:t.isEmpty(u)?[]:[u],v=[];return y.forEach(d=>{if(t.isString(d)){t.isNonEmptyString(d)&&v.push({url:d,name:le(d),type:"file"});return}d&&t.isNonEmptyString(d.name)&&v.push({url:"",name:d.name,type:"file"})}),v.map(d=>{if(t.isEmpty(d.url))return d;const M=d.name.lastIndexOf("."),x=M>-1?d.name.slice(M+1).toLowerCase():"";let R="file";return te.indexOf(x)>-1?R="image":ne.indexOf(x)>-1&&(R="video"),{...d,type:R}})}),r=e.computed(()=>Y.value.filter(u=>u.type!=="file")),g=e.computed(()=>{const u=t.isString(i.plaintextSeparator)?i.plaintextSeparator:",";return Y.value.filter(y=>y.type==="file").map(y=>y.name).join(u)}),w=e.computed(()=>r.value.length>0?g.value:Ee.getPlaintextOutText("fileUpload",i.plaintextEmptyText,g.value)),s=e.computed(()=>{let u={"panel-file-upload":!0};return u=t.getJsonMerge(u,pe.getClassNameJson(i.className)),u}),a=(u,y,v)=>{S("update:value",u),S("update:modelValue",u),S("onChange",y,v)},E=()=>{S("onRemove")},k=()=>{let u=null;switch(i.theme){case"default":u=P.value?.getValue();break;case"button":u=H.value?.getValue();break}return u},B=(u,y)=>{switch(u){case"default":P.value?.saveServerCallback(y);break;case"button":H.value?.saveServerCallback(y);break}},F=(u,y)=>{const v=k(),d=J.value?v:u;a(v,d,y)},$=u=>{t.isArray(u)&&S("onError",u)},G=()=>{A+=1,E();const u=k();a(u,u)},W=async(u,y,v)=>{const d=N?.preview;d&&await d.show({type:y,src:u,showIndex:v??0})},I=async(u,y)=>{const v=i.theme,d=++X,M=A;let x=!0;if(i.serverFileCallback)try{const K=!i.isMultiple&&t.isObject(y)&&t.isBoolean(y.isImage)?y.isImage:!1,ie=pe.getElementData(T);x=await i.serverFileCallback(u,K,ie)}catch{d===X&&A===M&&i.theme===v&&B(v,{req:y,res:{success:!1}});return}let R={};if(t.isBoolean(x)?R.success=x:t.isUndefined(x)?R.success=!0:t.isString(x)||t.isArray(x)?(R.success=!0,R.fileUrl=x):t.isObject(x)?R=x:R.success=!1,i.theme!==v){S("onError",["保存期间主题已切换,本次保存结果未写入"]);return}d!==X||A!==M||B(v,{req:y,res:R})};return e.provide("$FileuploadTop",e.reactive({getFileCheckInfo:()=>({checkFormat:i.checkFormat,checkWidth:i.checkWidth,checkHeight:i.checkHeight,checkWHType:i.checkWHType,checkMinSize:i.checkMinSize,checkMaxSize:i.checkMaxSize})})),p({getValue:()=>k(),cleanReduction:()=>{switch(i.theme){case"default":P.value?.cleanReduction();break;case"button":H.value?.cleanReduction();break}a("","")}}),(u,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value),id:e.unref(j)},[n.isPlaintext?(e.openBlock(),e.createElementBlock("div",lt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(v,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`plain-${d}`},[v.type==="image"?(e.openBlock(),e.createElementBlock("img",{key:0,src:v.url,alt:v.name,class:"cl-plaintext-media"},null,8,ot)):(e.openBlock(),e.createElementBlock("video",{key:1,src:v.url,controls:"",class:"cl-plaintext-media"},null,8,at))],64))),128)),w.value?(e.openBlock(),e.createElementBlock("span",st,e.toDisplayString(w.value),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),!n.isPlaintext&&n.theme==="button"?(e.openBlock(),e.createBlock(it,{key:2,ref_key:"refElFileButton",ref:H,value:n.value,name:n.name,disabled:n.disabled,isMultiple:n.isMultiple,buttonClass:n.buttonClass,buttonLabel:n.buttonLabel,buttonIcon:n.buttonIcon,buttonColor:n.buttonColor,checkFormat:n.checkFormat,checkMinSize:n.checkMinSize,checkMaxSize:n.checkMaxSize,checkWidth:n.checkWidth,checkHeight:n.checkHeight,checkWHType:n.checkWHType,isServerCallback:J.value,isShowUploadResult:n.isShowUploadResult,isShowUploadIng:n.isShowUploadIng,isShowPreview:n.isShowPreview,isShowDownload:n.isShowDownload,onOnChange:F,onOnError:$,onOnRemove:G,onOnPreview:W,onOnSaveFile:I},{label:e.withCtx(()=>[e.renderSlot(u.$slots,"label")]),_:3},8,["value","name","disabled","isMultiple","buttonClass","buttonLabel","buttonIcon","buttonColor","checkFormat","checkMinSize","checkMaxSize","checkWidth","checkHeight","checkWHType","isServerCallback","isShowUploadResult","isShowUploadIng","isShowPreview","isShowDownload"])):!n.isPlaintext&&n.theme==="default"?(e.openBlock(),e.createBlock(je,{key:3,ref_key:"refElFileDefault",ref:P,value:n.value,name:n.name,disabled:n.disabled,defaultHoverTitle:n.defaultHoverTitle,defaultIcon:n.defaultIcon,isShowCompleteMsg:n.isShowCompleteMsg,checkFormat:n.checkFormat,checkMinSize:n.checkMinSize,checkMaxSize:n.checkMaxSize,checkWidth:n.checkWidth,checkHeight:n.checkHeight,checkWHType:n.checkWHType,imgFit:n.imgFit,isServerCallback:J.value,isShowPreview:n.isShowPreview,isShowDownload:n.isShowDownload,onOnChange:F,onOnError:$,onOnRemove:G,onOnPreview:W,onOnSaveFile:I},{label:e.withCtx(()=>[e.renderSlot(u.$slots,"label")]),_:3},8,["value","name","disabled","defaultHoverTitle","defaultIcon","isShowCompleteMsg","checkFormat","checkMinSize","checkMaxSize","checkWidth","checkHeight","checkWHType","imgFit","isServerCallback","isShowPreview","isShowDownload"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[],64))],10,nt))}});exports._sfc_main=ct;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("vue"),n=require("@cldemo/ui-kit/common/base"),ce=require("@cldemo/ui-kit/common/Element"),ae=require("@cldemo/ui-kit/common/globalConfig"),de=require("@cldemo/ui-kit/common/log"),pe=require("./SlideUpDown.vue_vue_type_script_setup_true_lang-Cp45S0a9.js");;/* empty css */const ue={class:"tree-ul"},he=["onClick"],fe=["aria-checked","onClick"],ge=["tabindex","aria-disabled","onClick","onDblclick","onKeydown"],Ie=["innerHTML"],Se={key:1},X=170,Z=s.defineComponent({name:"ClTreeUl",__name:"Ul",props:{list:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},isSingleSelectParent:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},firstOpenIds:{type:Array,default:()=>[]},openIds:{type:Array,default:()=>[]},selectIds:{type:Array,default:()=>[]},selectUnIds:{type:Array,default:()=>[]}},emits:["onSelect","onShrink"],setup(k,{emit:$}){const E=k,l=$,U=`tree-${n.getRandom(5)}`;let B=!1;const c=s.inject("$TreeTop",{isCheckChildren:()=>(B||(B=!0,de.warn("ClTreeUl","未检测到 ClTree 容器提供 $TreeTop,子级判断降级为 false")),!1)}),f={dbClickTimeOut:null},D=s.computed(()=>new Set(E.firstOpenIds)),L=s.computed(()=>new Set(E.selectIds)),A=s.computed(()=>new Set(E.selectUnIds)),N=s.computed(()=>new Set(E.openIds)),_=u=>{n.isUndefined(u)||l("onSelect",u.toString())},x=u=>{n.isUndefined(u)||l("onShrink",u.toString())},w=u=>n.isUndefined(u.id)?"":u.id.toString(),F=u=>{const m=w(u);return L.value.has(m)?"true":A.value.has(m)?"mixed":"false"},b=u=>{const m={"tree-node":!0};if(m["tree-node-end"]=u.isEnd,!u.isEnd){const I=n.isUndefined(u.id)?"":u.id.toString(),T=N.value.has(I);m["tree-node-open"]=T,m["tree-node-closed"]=!T}return m},R=u=>{const m=n.isUndefined(u.id)?"":u.id.toString(),I={"tree-node-text":!0};return I["tree-node-select"]=L.value.has(m),I["tree-node-selectUn"]=A.value.has(m),I};s.onBeforeUnmount(()=>{f.dbClickTimeOut&&window.clearTimeout(f.dbClickTimeOut)});const H=u=>{E.disabled||(window.clearTimeout(f.dbClickTimeOut),x(u.id))},j=u=>{E.disabled||(window.clearTimeout(f.dbClickTimeOut),_(u.id))},V=u=>{if(!E.disabled)if(c.isCheckChildren(u.id)){let m=!0;!E.multiple&&!E.isSingleSelectParent&&(m=!1),m?(window.clearTimeout(f.dbClickTimeOut),f.dbClickTimeOut=window.setTimeout(()=>{E.disabled||_(u.id)},X)):window.clearTimeout(f.dbClickTimeOut)}else window.clearTimeout(f.dbClickTimeOut),f.dbClickTimeOut=window.setTimeout(()=>{E.disabled||_(u.id)},X)},C=u=>{E.disabled||c.isCheckChildren(u.id)&&(f.dbClickTimeOut&&window.clearTimeout(f.dbClickTimeOut),x(u.id))},J=u=>{_(u)},M=u=>{x(u)};return(u,m)=>(s.openBlock(),s.createElementBlock("ul",ue,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(k.list,(I,T)=>(s.openBlock(),s.createElementBlock("li",{key:`${U}-${I.id}-${T}`,class:s.normalizeClass(b(I))},[s.createElementVNode("i",{class:"tree-shrink",onClick:s.withModifiers(P=>H(I),["stop"])},null,8,he),s.createElementVNode("span",{class:s.normalizeClass(R(I))},[k.multiple?(s.openBlock(),s.createElementBlock("i",{key:0,class:"tree-node-checkbox",role:"checkbox","aria-checked":F(I),onClick:s.withModifiers(P=>j(I),["stop"])},null,8,fe)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[],64)),s.createElementVNode("a",{href:"javascript:",tabindex:k.disabled?-1:0,"aria-disabled":k.disabled,onClick:s.withModifiers(P=>V(I),["stop"]),onDblclick:s.withModifiers(P=>C(I),["stop"]),onKeydown:s.withKeys(s.withModifiers(P=>V(I),["prevent"]),["enter"])},[I.showTextLabelHtml?(s.openBlock(),s.createElementBlock("span",{key:0,innerHTML:I.showTextLabel},null,8,Ie)):(s.openBlock(),s.createElementBlock("span",Se,s.toDisplayString(I.showTextLabel),1))],40,ge)],2),D.value.has(w(I))?(s.openBlock(),s.createBlock(pe._sfc_main,{key:0},{default:s.withCtx(()=>[s.withDirectives(s.createVNode(Z,{list:I.list,multiple:k.multiple,isSingleSelectParent:k.isSingleSelectParent,disabled:k.disabled,firstOpenIds:k.firstOpenIds,openIds:k.openIds,selectIds:k.selectIds,selectUnIds:k.selectUnIds,onOnSelect:J,onOnShrink:M},null,8,["list","multiple","isSingleSelectParent","disabled","firstOpenIds","openIds","selectIds","selectUnIds"]),[[s.vShow,N.value.has(w(I))]])]),_:2},1024)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[],64))],2))),128))]))}}),me=["id"],ye=["id"],ke=s.defineComponent({name:"ClTree",__name:"Index",props:{id:String,value:String,className:String,disabled:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},isSingleSelectParent:{type:Boolean,default:!1},isOutMerge:{type:Boolean,default:!0},parentKey:{type:String,default:"parentId"},topParentValue:{type:String,default:"0"},searchOpenParentIds:{type:String,default:""},searchFoldParentIds:{type:String,default:""},searchKeyword:{type:String,default:""},highlightMode:{type:String,default:""},highlightColor:{type:String,default:""},isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0},plaintextSeparator:{type:String,default:","},plaintextLevelSeparator:{type:String,default:" > "}},emits:["update:value","update:modelValue","onChange","onInit"],setup(k,{expose:$,emit:E}){const l=k,U=E,B=l.id,c=s.reactive({firstOpenIds:[],openParentIds:[],selectedIds:[],selectedUnIds:[],list:[]}),f={dataJson:{},dataGroup:{},childLastIdsJson:{},prevSearchOpenParentIds:"",prevSearchFoldParentIds:""},D=s.computed(()=>({multiple:l.multiple,disabled:l.disabled,isSingleSelectParent:l.isSingleSelectParent})),L=s.computed(()=>n.getJsonMerge({"panel-tree":!0},ce.getClassNameJson(l.className))),A=t=>{U("update:value",t),U("update:modelValue",t)},N=(t,e)=>{A(t),U("onChange",t,e)},_=()=>{s.nextTick(()=>{U("onInit")})},x=t=>{const e=n.isUndefined(t)?"":t.toString();return n.isExistJsonKey(f.dataGroup,e)},w=t=>{const e=n.isUndefined(t)?"":t.toString();return x(e)?f.dataGroup[e]:[]},F=s.ref(0),b=t=>{const e=t.toString();return n.isExistJsonKey(f.dataJson,e)?f.dataJson[e]:null},R=t=>{const e=[],r=new Set;let i=t;for(;n.isNonEmptyString(i)&&!r.has(i);){r.add(i);const p=b(i);if(!p)break;n.isNonEmptyString(p.name)&&e.unshift(p.name);const d=p[l.parentKey],a=d!=null?String(d):"";if(a===""||a===String(l.topParentValue))break;i=a}return e},H=s.computed(()=>{if(l.list,F.value,n.isEmpty(c.selectedIds))return"";const t=n.isString(l.plaintextLevelSeparator)?l.plaintextLevelSeparator:" > ",e=n.isString(l.plaintextSeparator)?l.plaintextSeparator:",";return v(c.selectedIds,l.isOutMerge).map(i=>{const p=R(i);return n.removeHTMLTags(p.length>0?p.join(t):i)}).join(e)}),j=s.computed(()=>ae.getPlaintextOutText("tree",l.plaintextEmptyText,H.value,l.value)),V=(t,e,r)=>{const i=[],p=e+1;return r===void 0&&(r=new Set),r.has(t)||(r.add(t),w(t).forEach(d=>{const a={...d},o=a.id.toString(),h=x(o);a.isEnd=!h,a.level=p,h&&(a.list=V(o,p,r)),i.push(a)})),i},C=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),J=t=>{const e=l.searchKeyword,r=l.highlightMode;if(!n.isNonEmptyString(t)||n.isEmpty(e))return C(String(t));const i=n.isNonEmptyString(l.highlightColor)?l.highlightColor:"#ffe58f",p=S=>`<mark style="background:${i}">${C(S)}</mark>`;if(r==="full")return t.includes(e)?p(t):C(t);const d=t.indexOf(e);if(d===-1)return C(t);const a=C(t.slice(0,d)),o=p(t.slice(d,d+e.length)),h=C(t.slice(d+e.length));return`${a}${o}${h}`},M=t=>{const{parentKey:e,topParentValue:r}=l,i=n.isNonEmptyString(r)?r:"0",p={},d={};n.isEmpty(t)||t.forEach(a=>{const o=n.getJsonClone(a),h=!n.isEmpty(l.searchKeyword)&&!n.isEmpty(l.highlightMode);o.showTextLabelHtml=h,o.showTextLabel=h?J(n.isString(o.name)?o.name:""):n.isString(o.name)?o.name:"";const S=n.isString(o.id)||typeof o.id=="number"&&n.isFinite(o.id),g=n.isString(o[e])||typeof o[e]=="number"&&n.isFinite(o[e]);if(!S||!g)return;const O=o.id.toString(),y=o[e].toString();p[O]=o,n.isExistJsonKey(d,y)||(d[y]=[]),d[y].push(o)}),f.dataJson=p,f.dataGroup=d,f.childLastIdsJson={},c.list=V(i,0),F.value+=1},u=(t,e)=>{let r=[];const{parentKey:i,topParentValue:p}=l,d=n.isNonEmptyString(p)?p:"0",a=n.isEmpty(t)?"":t.toString();if(e===void 0&&(e=new Set),n.isExistJsonKey(f.dataJson,a)&&!e.has(a)){e.add(a),r.push(a);const o=f.dataJson[a][i].toString();if(o!==d){const h=u(o,e);r=r.concat(h)}}return r},m=t=>{const e=u(t);return e.splice(0,1),e.reverse(),e},I=(t,e)=>{let r=[];const i=n.isEmpty(t)?"":t.toString();return e===void 0&&(e=new Set),e.has(i)||(e.add(i),r.push(i),x(i)&&w(i).forEach(p=>{const d=p.id.toString(),a=I(d,e);r=r.concat(a)})),r},T=t=>{const e=I(t);return e.splice(0,1),e},P=(t,e,r,i)=>{const p={add:[],del:[]},d={add:[],del:[]};let a=n.isUndefined(e)?n.getArrClone(c.selectedIds):e,o=n.isUndefined(r)?n.getArrClone(c.selectedUnIds):r;const h=a.indexOf(t);i?h===-1&&a.push(t):h===-1?a.push(t):a.splice(h,1),o=n.getArrRemoveById(o,t);const S=m(t);return S.reverse(),S.length>0&&S.forEach(g=>{let O=0,y=0;f.dataGroup[g].forEach(le=>{const Q=le.id.toString();n.isExistValue(a,Q)&&(O+=1),n.isExistValue(o,Q)&&(y+=1)});const q=f.dataGroup[g].length;O===0&&y===0?(p.del.push(g),a=n.getArrRemoveById(a,g),d.del.push(g),o=n.getArrRemoveById(o,g)):O===q?(p.add.push(g),a.push(g),d.del.push(g),o=n.getArrRemoveById(o,g)):(p.del.push(g),a=n.getArrRemoveById(a,g),d.add.push(g),o.push(g))}),{select:p,selectUn:d}},G=(t,e)=>{let r=[];if(e===void 0&&(e=new Set),n.isExistJsonKey(f.childLastIdsJson,t)&&f.childLastIdsJson[t].length>0)r=f.childLastIdsJson[t];else{if(e.has(t))return r;x(t)?(e.add(t),w(t).forEach(i=>{const p=G(i.id.toString(),e);p.length>0&&(r=r.concat(p))})):r.push(t),f.childLastIdsJson[t]=r}return r},z=(t,e)=>{const{parentKey:r,topParentValue:i}=l,p=n.isNonEmptyString(i)?i:"0",d={},a=[];let o=[];if(e===void 0&&(e=new Set),t.forEach(h=>{const S=b(h);if(!n.isUndefined(S)){const g=S[r].toString();g===p?o.push(h):(n.isExistJsonKey(d,g)||(d[g]=[]),d[g].push(h))}}),!n.isEmpty(d))for(const[h,S]of Object.entries(d))S.length===w(h).length?a.push(h):o=o.concat(S);if(a.length>0){o.push(...a);const h=n.getArrUnique(o),S=a.some(g=>!e.has(g));return a.forEach(g=>e.add(g)),S?z(h,e):o}else return o},ee=t=>{const e=[],r=n.getArrConvertJson(t);return t.forEach(p=>{const d=w(p);if(n.isEmpty(d))e.push(p);else{const a=[];d.forEach(o=>{n.isExistJsonKey(r,o.id.toString())&&a.push(o.id)}),d.length!==a.length&&e.push(p)}}),z(e)},te=t=>{let e=[];return t.forEach(r=>{const i=G(r);e.push(...i)}),e=n.getArrUnique(e),e},v=(t,e)=>l.multiple?(n.isBoolean(e)?e:l.isOutMerge)?ee(t):te(t):t,W=t=>{const e=[];return t.forEach(r=>{const i=b(r);n.isUndefined(i)||e.push(i)}),e},K=t=>{const e=l.multiple?t:t.slice(0,1);let r=[],i=[];e.forEach(d=>{const a=b(d);if(!n.isUndefined(a)){const o=P(d,r,i,!0);r=n.getArrRemoveById(r,o.select.del),o.select.add.length>0&&r.push(...o.select.add),i=n.getArrRemoveById(i,o.selectUn.del),o.selectUn.add.length>0&&i.push(...o.selectUn.add);const h=T(d);r.push(...h),r.push(d),r=n.getArrUnique(r),i=n.getArrUnique(i)}}),c.selectedIds=r;const p=n.getArrRemoveById(i,r);c.selectedUnIds=n.getArrClone(p),c.firstOpenIds=n.getArrUnique(c.firstOpenIds.concat(p)),c.openParentIds=n.getArrUnique(c.openParentIds.concat(p))},ne=()=>{if(M(l.list),n.isNonEmptyString(l.value)){const t=l.value.split(",");K(t)}_()};s.onMounted(()=>{s.nextTick(()=>{ne()})}),s.watch(()=>l.list,t=>{M(t);const e=c.selectedIds,r=n.isNonEmptyString(l.value)?l.value.split(","):[];c.selectedIds=[],K(n.getArrUnique(e.concat(r)));const i=v(c.selectedIds);i.join(",")!==l.value&&A(i.join(","))}),s.watch(()=>l.value,t=>{if(t!==void 0){const e=c.selectedIds,r=n.isNonEmptyString(t)?t.split(","):[],i=v(r),p=v(e);n.isEqualArr(i,p)||(c.selectedIds=[],K(r))}});const se=()=>{const t=n.isNonEmptyString(f.prevSearchFoldParentIds)?f.prevSearchFoldParentIds.split(","):[];c.firstOpenIds=n.getArrRemoveById(c.firstOpenIds,t),(n.isNonEmptyString(l.searchFoldParentIds)?l.searchFoldParentIds.split(","):[]).forEach(r=>{const i=r.toString();c.firstOpenIds.indexOf(i)===-1&&c.firstOpenIds.push(i)}),f.prevSearchFoldParentIds=n.isNonEmptyString(l.searchFoldParentIds)?l.searchFoldParentIds:""},re=()=>{const t=n.isNonEmptyString(f.prevSearchOpenParentIds)?f.prevSearchOpenParentIds.split(","):[];c.firstOpenIds=n.getArrRemoveById(c.firstOpenIds,t),c.openParentIds=n.getArrRemoveById(c.openParentIds,t),(n.isNonEmptyString(l.searchOpenParentIds)?l.searchOpenParentIds.split(","):[]).forEach(r=>{const i=r.toString();c.firstOpenIds.indexOf(i)===-1&&c.firstOpenIds.push(i),c.openParentIds.indexOf(i)===-1&&c.openParentIds.push(i)}),f.prevSearchOpenParentIds=n.isNonEmptyString(l.searchOpenParentIds)?l.searchOpenParentIds:""};s.watch(()=>l.searchOpenParentIds,()=>re()),s.watch(()=>l.searchFoldParentIds,()=>se());const Y=t=>{Array.isArray(t)&&t.forEach(e=>{if(!e)return;const r=!n.isEmpty(l.searchKeyword)&&!n.isEmpty(l.highlightMode);e.showTextLabelHtml=r,e.showTextLabel=r?J(n.isString(e.name)?e.name:""):n.isString(e.name)?e.name:"",Array.isArray(e.list)&&Y(e.list)})};s.watch(()=>[l.searchKeyword,l.highlightMode,l.highlightColor],()=>Y(c.list));const oe=t=>{const e=t.toString();n.isExistValue(c.firstOpenIds,e)||c.firstOpenIds.push(e),s.nextTick(()=>{const r=c.openParentIds.indexOf(e);r===-1?c.openParentIds.push(e):c.openParentIds.splice(r,1)})},ie=t=>{const e=t.toString();if(l.multiple){const p=c.selectedIds.indexOf(e)===-1,d=T(e),a=P(e);let o=n.getArrClone(c.selectedIds),h=n.getArrClone(c.selectedUnIds);a.select.del.forEach(O=>{const y=o.indexOf(O);y>-1&&o.splice(y,1)}),a.select.add.length>0&&(o=o.concat(a.select.add),o=n.getArrUnique(o)),a.selectUn.del.forEach(O=>{const y=h.indexOf(O);y>-1&&h.splice(y,1)}),a.selectUn.add.length>0&&(h=h.concat(a.selectUn.add),h=n.getArrUnique(h)),d.length>0&&d.forEach(O=>{const y=o.indexOf(O),q=h.indexOf(O);p?y===-1&&o.push(O):y>-1&&o.splice(y,1),q>-1&&h.splice(q,1)});const S=o.indexOf(e);S>-1?o.splice(S,1):o.push(e);const g=h.indexOf(e);g>-1&&h.splice(g,1),c.selectedIds=o,c.selectedUnIds=h}else c.selectedIds=[e],c.selectedUnIds=[];const r=v(c.selectedIds);N(r.join(","),W(r))};return s.provide("$TreeTop",{isCheckChildren:x}),$({getValue:()=>v(c.selectedIds).join(","),getValueData:()=>{const t=v(c.selectedIds);return W(t)},setValue:t=>{const e=n.isNonEmptyString(t)?t.split(","):[];c.selectedIds=[],K(e)}}),(t,e)=>k.isPlaintext?(s.openBlock(),s.createElementBlock("div",{key:0,id:s.unref(B),class:"cl-plaintext-value"},s.toDisplayString(j.value),9,me)):(s.openBlock(),s.createElementBlock("div",{key:1,class:s.normalizeClass(L.value),id:s.unref(B)},[c.list.length>0?(s.openBlock(),s.createBlock(Z,s.mergeProps({key:0,list:c.list,firstOpenIds:c.firstOpenIds,openIds:c.openParentIds,selectIds:c.selectedIds,selectUnIds:c.selectedUnIds},D.value,{onOnSelect:ie,onOnShrink:oe}),null,16,["list","firstOpenIds","openIds","selectIds","selectUnIds"])):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[],64))],10,ye))}});exports._sfc_main=ke;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue");;/* empty css */;/* empty css */const i=require("@cldemo/ui-kit/common/base"),M=require("@cldemo/ui-kit/common/globalConfig"),A=require("@cldemo/ui-kit/common/Element"),_=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js"),L=require("./index-q2CbfC2a.js"),j=["id"],K={key:0,class:"cl-plaintext-value"},R=["id","name","value","disabled","checked","onClick"],z=["for"],O={key:0},W=e.defineComponent({name:"ClCheckbox",directives:{cltooltip:L.tooltipDirectives},__name:"Index",props:{id:String,name:{type:String,required:!0},value:{type:String,required:!0},className:String,disabled:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},circle:{type:Boolean,default:!1},width:String,isInline:{type:Boolean,default:!0},tipMode:{type:String,default:"tooltip",validator:p=>["tooltip","clickCallback"].includes(p)},checkChangeBefore:{type:Function,default:void 0},isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0},plaintextSeparator:{type:String,default:","}},emits:["update:value","update:modelValue","onChange","onInit","onError","onTipClick"],setup(p,{expose:C,emit:S}){const s=p,d=S,h=`checkbox-${i.getRandom(5)}`,v=i.isEmpty(s.name)?h+"_name":s.name,b=s.id,a=e.ref(i.split(s.value)),c=e.ref(!1);let r={};const E=e.ref(0),m={isProcessing:!1,_initEmitted:!1},V=e.computed(()=>{if(s.isPlaintext)return[];const t=s.list;return i.isArray(t)?t.filter(l=>!i.isEmpty(l)):[]}),N=e.computed(()=>{const t=i.isString(s.plaintextSeparator)?s.plaintextSeparator:",";s.list,E.value;const l=[];return a.value.forEach(o=>{const n=i.isExistJsonKey(r,o)?r[o]:void 0;l.push(n&&i.isNonEmptyString(n.name)?n.name:o)}),l.filter(o=>i.isNonEmptyString(o)).join(t)}),I=e.computed(()=>M.getPlaintextOutText("checkbox",s.plaintextEmptyText,N.value,s.value)),w=e.computed(()=>i.getJsonMerge({"panel-checkbox":!0},A.getClassNameJson(s.className))),q=e.computed(()=>{const t={checkbox:!0,"checkbox-default":!0};return t["checkbox-inline"]=s.isInline,t["checkbox-circle"]=s.circle,t}),T=t=>{const l={},{width:o}=s;return t&&!i.isEmpty(t.width)?l.width=t.width:i.isEmpty(o)||(l.width=s.width),l},x=t=>{d("update:value",t),d("update:modelValue",t)},D=t=>{const l=[];i.isEmpty(t)||i.split(t).forEach(n=>{i.isExistJsonKey(r,n)&&l.push(i.getJsonClone(r[n]))});const o=l.length>0&&l.length===(s.list?.length??0);x(t),d("onChange",t,l,o)},k=()=>{m._initEmitted||(m._initEmitted=!0,e.nextTick(()=>{d("onInit")}))},B=()=>{const t=[];return a.value.forEach(l=>{i.isExistJsonKey(r,l)&&t.push(l)}),t},f=t=>{r=i.isEmpty(t)?{}:i.getJsonByList(t),E.value+=1},g=()=>{if(c.value&&!i.isEmpty(a.value)){const t=B();i.isEqualArr(a.value,t)||(a.value=t,x(t.join(",")))}},y=t=>{const l=i.split(t);let o=i.isEqualArr(a.value,l);o&&(o=t===a.value.join(",")),o||(a.value=l)},$=()=>{c.value=(s.list?.length??0)!==0,f(s.list),g()};e.onMounted(()=>{e.nextTick(()=>{$()})}),e.watch(c,t=>{t&&k()}),e.watch(()=>s.list,t=>{c.value||(c.value=!0,t.length===0&&g(),k())}),e.watch([()=>s.value,()=>s.list],([t,l])=>{const o=l;!c.value&&o.length>0&&(c.value=!0,k()),f(o),y(t),g()});const P=t=>{d("onTipClick",t)},J=async t=>{if(!(!t||t.isDisabled||s.disabled||m.isProcessing)&&!i.isEmpty(t.id)){m.isProcessing=!0;try{const l=String(t.id??"");let o=i.getArrClone(a.value);i.isExistValue(a.value,l)?o=i.getArrRemoveById(o,l):o.push(l);const n=o.join(",");let u=!0;if(s.checkChangeBefore)try{u=await s.checkChangeBefore(n),u=i.isBoolean(u)?u:!0}catch{u=!1}if(s.disabled||t.isDisabled)return;u&&(a.value=o,D(n))}catch(l){d("onError",l)}finally{m.isProcessing=!1}}};return C({getValue:()=>B().join(","),getValueData:()=>{const t=[];return a.value.forEach(l=>{i.isExistJsonKey(r,l)&&t.push(i.getJsonClone(r[l]))}),t},setValue:t=>{m.isProcessing||(y(t),g())},runInitComplete:()=>{c.value||(c.value=!0,f(s.list),y(s.value),g(),k())}}),(t,l)=>{const o=e.resolveDirective("cltooltip");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(w.value),id:e.unref(b)},[p.isPlaintext?(e.openBlock(),e.createElementBlock("div",K,e.toDisplayString(I.value),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`${h}-${n.id??""}-${u}`},[n.isShow||n.isShow===void 0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(q.value),style:e.normalizeStyle(T(n))},[e.createElementVNode("span",null,[e.createElementVNode("span",null,[e.createElementVNode("input",{type:"checkbox",id:`${h}_${e.unref(v)}_${n.id??""}`,name:e.unref(v),value:n.id??"",disabled:n.isDisabled||p.disabled,checked:a.value.includes(String(n.id??"")),onClick:F=>J(n)},null,8,R),e.createElementVNode("label",{for:`${h}_${e.unref(v)}_${n.id??""}`},[e.renderSlot(t.$slots,"default",{data:n},()=>[n.icon&&n.icon.length>0?e.withDirectives((e.openBlock(),e.createElementBlock("span",O,[e.createVNode(_._sfc_main,{name:n.icon},null,8,["name"])])),[[o,{html:n.name,className:"tooltip-modal"}]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(n.name),1)],64))])],8,z)]),n.tipMsg&&n.tipMsg.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p.tipMode==="tooltip"?e.withDirectives((e.openBlock(),e.createBlock(_._sfc_main,{key:0,name:e.unref(i).isNonEmptyString(n.tipIcon)?void 0:"question-circle",className:e.unref(i).isNonEmptyString(n.tipIcon)?n.tipIcon:void 0,class:"checkbox-icon-tip"},null,8,["name","className"])),[[o,{html:n.tipMsg,className:"tooltip-modal"}]]):(e.openBlock(),e.createBlock(_._sfc_main,{key:1,name:e.unref(i).isNonEmptyString(n.tipIcon)?void 0:"question-circle",className:e.unref(i).isNonEmptyString(n.tipIcon)?n.tipIcon:void 0,class:"checkbox-icon-tip",onClick:e.withModifiers(F=>P(n),["stop"])},null,8,["name","className","onClick"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])],6)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))],64))),128))],10,j)}}});exports._sfc_main=W;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as X, useTemplateRef as Y, ref as T, computed as
|
|
1
|
+
import { defineComponent as X, useTemplateRef as Y, ref as T, computed as S, onMounted as _, watch as F, openBlock as ee, createBlock as te, unref as ne, createSlots as ae, withCtx as x, renderSlot as I, nextTick as B } from "vue";
|
|
2
2
|
import l from "@cldemo/ui-kit/common/base";
|
|
3
|
-
import
|
|
4
|
-
import { _ as w } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import N from "@cldemo/ui-kit/common/Element";
|
|
4
|
+
import { _ as w } from "./Index.vue_vue_type_script_setup_true_lang-D4a5Iaue.js";
|
|
5
5
|
const pe = /* @__PURE__ */ X({
|
|
6
6
|
name: "ClInputNumber",
|
|
7
7
|
components: {
|
|
@@ -87,7 +87,7 @@ const pe = /* @__PURE__ */ X({
|
|
|
87
87
|
type: Number,
|
|
88
88
|
default: 0,
|
|
89
89
|
// desc: 小数位数(-1 为不限制)
|
|
90
|
-
validator: (
|
|
90
|
+
validator: (i) => i >= -1 && i <= 100 && i % 1 === 0
|
|
91
91
|
},
|
|
92
92
|
isThousand: {
|
|
93
93
|
type: Boolean,
|
|
@@ -103,26 +103,31 @@ const pe = /* @__PURE__ */ X({
|
|
|
103
103
|
type: Number,
|
|
104
104
|
default: 200,
|
|
105
105
|
// desc: 变更延迟时间(毫秒)
|
|
106
|
-
validator: (
|
|
106
|
+
validator: (i) => l.isFinite(i) && i >= 0
|
|
107
107
|
},
|
|
108
108
|
isPlaintext: {
|
|
109
109
|
type: Boolean,
|
|
110
110
|
default: !1
|
|
111
111
|
// desc: 是否纯文本只读模式,只渲染显示文本(含千分位与小数位)不挂载输入框
|
|
112
|
+
},
|
|
113
|
+
plaintextEmptyText: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: void 0
|
|
116
|
+
// desc: 纯文本只读模式下值为空时的显示文本(默认 "-",显式传空串则显示空白;未显式传时依次读取组件配置段与 plaintextGlobal 段)
|
|
112
117
|
}
|
|
113
118
|
},
|
|
114
119
|
emits: ["update:value", "update:modelValue", "onChange", "onFocus", "onBlur", "onChangeBlur", "onKeyupEnter", "onClear", "onInit", "onKeydown", "onKeyup", "onChangeDelay"],
|
|
115
|
-
setup(
|
|
116
|
-
const u =
|
|
120
|
+
setup(i, { expose: O, emit: R }) {
|
|
121
|
+
const u = i, m = R, k = u.id, y = Y("refElInput"), c = T(u.value), f = T(u.value), K = S(() => {
|
|
117
122
|
let e = { "panel-input-number": !0 };
|
|
118
|
-
return e = l.getJsonMerge(e,
|
|
119
|
-
}), $ =
|
|
123
|
+
return e = l.getJsonMerge(e, N.getClassNameJson(u.className)), l.getStringByJson(e, " ");
|
|
124
|
+
}), $ = S(() => l.isNonEmptyString(u.inputmode) ? u.inputmode : u.decimal === 0 ? "numeric" : "decimal"), E = (e) => {
|
|
120
125
|
if (e !== f.value) {
|
|
121
126
|
f.value = e;
|
|
122
127
|
const t = d(e);
|
|
123
128
|
m("update:value", t), m("update:modelValue", t), m("onChange", t);
|
|
124
129
|
}
|
|
125
|
-
},
|
|
130
|
+
}, V = (e) => {
|
|
126
131
|
let t = l.isNumber(e);
|
|
127
132
|
if (!t)
|
|
128
133
|
if (l.isNaN(+e))
|
|
@@ -133,11 +138,11 @@ const pe = /* @__PURE__ */ X({
|
|
|
133
138
|
}
|
|
134
139
|
return t;
|
|
135
140
|
}, h = (e, t, n = !0, a = !0) => {
|
|
136
|
-
let
|
|
141
|
+
let s = e;
|
|
137
142
|
if (u.isNumber) {
|
|
138
143
|
let o = l.removeReplace(e);
|
|
139
144
|
if (o.length > 0)
|
|
140
|
-
if (
|
|
145
|
+
if (V(o)) {
|
|
141
146
|
if (o !== "-") {
|
|
142
147
|
const { decimal: r } = u;
|
|
143
148
|
if (n && r !== 0 && (r === -1 || r >= 0 && r <= 100) && r !== -1) {
|
|
@@ -159,27 +164,27 @@ const pe = /* @__PURE__ */ X({
|
|
|
159
164
|
o = t;
|
|
160
165
|
else
|
|
161
166
|
o = "";
|
|
162
|
-
|
|
167
|
+
s = o;
|
|
163
168
|
}
|
|
164
|
-
return
|
|
169
|
+
return s;
|
|
165
170
|
}, D = (e, t) => {
|
|
166
171
|
const n = t.split(""), a = new RegExp(
|
|
167
172
|
"^" + n.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(".*?")
|
|
168
|
-
),
|
|
173
|
+
), s = e.match(a);
|
|
169
174
|
let o;
|
|
170
|
-
return
|
|
175
|
+
return s && (o = s[0].length), o;
|
|
171
176
|
}, L = (e, t, n) => {
|
|
172
|
-
const a =
|
|
173
|
-
let
|
|
174
|
-
|
|
177
|
+
const a = N.getFocusSelection(e);
|
|
178
|
+
let s = t.substring(0, a.start);
|
|
179
|
+
s = l.removeReplace(s);
|
|
175
180
|
const o = t.substring(a.start);
|
|
176
|
-
let p =
|
|
177
|
-
|
|
181
|
+
let p = V(s);
|
|
182
|
+
s.indexOf(".") > -1 && o.indexOf(".") > -1 && (p = !1);
|
|
178
183
|
let r = a.start;
|
|
179
|
-
p ? r = D(n,
|
|
180
|
-
|
|
184
|
+
p ? r = D(n, s) : r = n.lastIndexOf(o), (l.isUndefined(r) || r > n.length || r < 0) && (r = n.length), B(() => {
|
|
185
|
+
N.setFocusSelection(e, r, r);
|
|
181
186
|
});
|
|
182
|
-
},
|
|
187
|
+
}, C = () => {
|
|
183
188
|
const e = c.value;
|
|
184
189
|
if (l.isEmpty(e))
|
|
185
190
|
return e;
|
|
@@ -196,8 +201,8 @@ const pe = /* @__PURE__ */ X({
|
|
|
196
201
|
t = p.indexOf("e") > -1 ? t : p;
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
|
-
const a = t.split("."),
|
|
200
|
-
a[0] = u.isThousand ? l.getFormatThousands(
|
|
204
|
+
const a = t.split("."), s = l.isEmpty(a[0]) ? "0" : a[0];
|
|
205
|
+
a[0] = u.isThousand ? l.getFormatThousands(s) : s, n === 0 ? t = a[0] : a.length === 2 ? (a[1] = n === -1 ? a[1] : l.getFillZero(a[1], n, "r"), t = a.join(".")) : t = a[0];
|
|
201
206
|
}
|
|
202
207
|
return t;
|
|
203
208
|
}
|
|
@@ -205,12 +210,12 @@ const pe = /* @__PURE__ */ X({
|
|
|
205
210
|
let t = "";
|
|
206
211
|
if (!l.isEmpty(e) && (t = e.toString(), u.isNumber && t !== "-")) {
|
|
207
212
|
const { decimal: n } = u, a = t.split(".");
|
|
208
|
-
let
|
|
213
|
+
let s = l.removeReplace(a[0]);
|
|
209
214
|
if (a.length === 2 && n !== 0) {
|
|
210
215
|
let o = "";
|
|
211
|
-
n === -1 ? o = a[1] : o = l.getFillZero(a[1], n, "r"),
|
|
216
|
+
n === -1 ? o = a[1] : o = l.getFillZero(a[1], n, "r"), s += `.${o}`;
|
|
212
217
|
}
|
|
213
|
-
t =
|
|
218
|
+
t = s;
|
|
214
219
|
}
|
|
215
220
|
return t;
|
|
216
221
|
}, P = () => {
|
|
@@ -223,14 +228,14 @@ const pe = /* @__PURE__ */ X({
|
|
|
223
228
|
};
|
|
224
229
|
_(() => {
|
|
225
230
|
J();
|
|
226
|
-
}),
|
|
231
|
+
}), F(
|
|
227
232
|
() => u.value,
|
|
228
233
|
(e, t) => {
|
|
229
234
|
if (e !== t && e !== c.value) {
|
|
230
235
|
let n = !0;
|
|
231
236
|
if (u.isNumber) {
|
|
232
|
-
const a = l.removeReplace(e),
|
|
233
|
-
o && p ? n = !1 : !o && !p && (n = Number(a) !== Number(
|
|
237
|
+
const a = l.removeReplace(e), s = l.removeReplace(c.value), o = l.isEmpty(a), p = l.isEmpty(s);
|
|
238
|
+
o && p ? n = !1 : !o && !p && (n = Number(a) !== Number(s));
|
|
234
239
|
}
|
|
235
240
|
if (n) {
|
|
236
241
|
const a = h(e, t);
|
|
@@ -238,23 +243,23 @@ const pe = /* @__PURE__ */ X({
|
|
|
238
243
|
}
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
|
-
),
|
|
246
|
+
), F([() => u.isNumber, () => u.decimal, () => u.isThousand], () => {
|
|
242
247
|
const e = h(c.value, "");
|
|
243
|
-
c.value = e,
|
|
248
|
+
c.value = e, E(e);
|
|
244
249
|
});
|
|
245
250
|
const M = (e) => {
|
|
246
251
|
const t = h(e, f.value, !1, u.isImmediateThousand);
|
|
247
252
|
c.value = t, y.value?.setValue(t), u.isNumber && B(() => {
|
|
248
253
|
const n = y.value?.getInputElement();
|
|
249
254
|
n && c.value === t && L(n, e, String(t));
|
|
250
|
-
}),
|
|
255
|
+
}), E(t);
|
|
251
256
|
}, U = () => {
|
|
252
|
-
const e =
|
|
257
|
+
const e = C();
|
|
253
258
|
c.value = e, f.value = e;
|
|
254
259
|
const t = d(e);
|
|
255
260
|
m("onFocus", t);
|
|
256
261
|
}, j = () => {
|
|
257
|
-
const e =
|
|
262
|
+
const e = C();
|
|
258
263
|
c.value = e, f.value = e;
|
|
259
264
|
const t = d(e);
|
|
260
265
|
m("onBlur", t);
|
|
@@ -272,11 +277,11 @@ const pe = /* @__PURE__ */ X({
|
|
|
272
277
|
m("onInit");
|
|
273
278
|
}, Q = (e) => {
|
|
274
279
|
m("onChangeDelay", d(e));
|
|
275
|
-
},
|
|
280
|
+
}, b = () => d(c.value);
|
|
276
281
|
return O({
|
|
277
|
-
getValue:
|
|
282
|
+
getValue: b,
|
|
278
283
|
getValueData: () => ({
|
|
279
|
-
value:
|
|
284
|
+
value: b(),
|
|
280
285
|
show: l.isEmpty(c.value) ? "" : c.value.toString()
|
|
281
286
|
}),
|
|
282
287
|
setValue: (e, t) => {
|
|
@@ -295,21 +300,22 @@ const pe = /* @__PURE__ */ X({
|
|
|
295
300
|
ref: y,
|
|
296
301
|
id: ne(k),
|
|
297
302
|
value: c.value,
|
|
298
|
-
name:
|
|
303
|
+
name: i.name,
|
|
299
304
|
className: K.value,
|
|
300
|
-
inputType:
|
|
305
|
+
inputType: i.inputType,
|
|
301
306
|
inputmode: $.value,
|
|
302
|
-
autocomplete:
|
|
303
|
-
placeholder:
|
|
304
|
-
label:
|
|
305
|
-
isFloating:
|
|
306
|
-
disabled:
|
|
307
|
-
isReadonly:
|
|
308
|
-
isClean:
|
|
309
|
-
width:
|
|
310
|
-
theme:
|
|
311
|
-
isPlaintext:
|
|
312
|
-
|
|
307
|
+
autocomplete: i.autocomplete,
|
|
308
|
+
placeholder: i.placeholder,
|
|
309
|
+
label: i.label,
|
|
310
|
+
isFloating: i.isFloating,
|
|
311
|
+
disabled: i.disabled,
|
|
312
|
+
isReadonly: i.isReadonly,
|
|
313
|
+
isClean: i.isClean,
|
|
314
|
+
width: i.width,
|
|
315
|
+
theme: i.theme,
|
|
316
|
+
isPlaintext: i.isPlaintext,
|
|
317
|
+
plaintextEmptyText: i.plaintextEmptyText,
|
|
318
|
+
changeDelayTime: i.changeDelayTime,
|
|
313
319
|
onOnChange: M,
|
|
314
320
|
onOnFocus: U,
|
|
315
321
|
onOnBlur: j,
|
|
@@ -323,26 +329,26 @@ const pe = /* @__PURE__ */ X({
|
|
|
323
329
|
}, ae({ _: 2 }, [
|
|
324
330
|
e.$slots.prepend ? {
|
|
325
331
|
name: "prepend",
|
|
326
|
-
fn:
|
|
327
|
-
|
|
332
|
+
fn: x(() => [
|
|
333
|
+
I(e.$slots, "prepend")
|
|
328
334
|
]),
|
|
329
335
|
key: "0"
|
|
330
336
|
} : void 0,
|
|
331
337
|
e.$slots.append ? {
|
|
332
338
|
name: "append",
|
|
333
|
-
fn:
|
|
334
|
-
|
|
339
|
+
fn: x(() => [
|
|
340
|
+
I(e.$slots, "append")
|
|
335
341
|
]),
|
|
336
342
|
key: "1"
|
|
337
343
|
} : void 0,
|
|
338
344
|
e.$slots.suffix ? {
|
|
339
345
|
name: "suffix",
|
|
340
|
-
fn:
|
|
341
|
-
|
|
346
|
+
fn: x(() => [
|
|
347
|
+
I(e.$slots, "suffix")
|
|
342
348
|
]),
|
|
343
349
|
key: "2"
|
|
344
350
|
} : void 0
|
|
345
|
-
]), 1032, ["id", "value", "name", "className", "inputType", "inputmode", "autocomplete", "placeholder", "label", "isFloating", "disabled", "isReadonly", "isClean", "width", "theme", "isPlaintext", "changeDelayTime"]));
|
|
351
|
+
]), 1032, ["id", "value", "name", "className", "inputType", "inputmode", "autocomplete", "placeholder", "label", "isFloating", "disabled", "isReadonly", "isClean", "width", "theme", "isPlaintext", "plaintextEmptyText", "changeDelayTime"]));
|
|
346
352
|
}
|
|
347
353
|
});
|
|
348
354
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("vue"),l=require("@cldemo/ui-kit/common/base"),I=require("@cldemo/ui-kit/common/Element"),T=require("./Index.vue_vue_type_script_setup_true_lang-DXPZYc0c.js"),A=i.defineComponent({name:"ClInputNumber",components:{ClInput:T._sfc_main},__name:"Index",props:{id:String,name:{type:String,default:""},value:{type:[String,Number],default:""},className:{type:String,default:""},disabled:{type:Boolean,default:!1},theme:{type:String,default:"default"},inputType:{type:String,default:""},inputmode:{type:String,default:""},autocomplete:{type:String,default:"off"},width:{type:String,default:""},placeholder:{type:String,default:""},label:String,isFloating:{type:Boolean,default:!1},isReadonly:{type:Boolean,default:!1},isClean:{type:Boolean,default:!0},isNumber:{type:Boolean,default:!0},decimal:{type:Number,default:0,validator:s=>s>=-1&&s<=100&&s%1===0},isThousand:{type:Boolean,default:!0},isImmediateThousand:{type:Boolean,default:!0},changeDelayTime:{type:Number,default:200,validator:s=>l.isFinite(s)&&s>=0},isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0}},emits:["update:value","update:modelValue","onChange","onFocus","onBlur","onChangeBlur","onKeyupEnter","onClear","onInit","onKeydown","onKeyup","onChangeDelay"],setup(s,{expose:b,emit:S}){const o=s,p=S,F=o.id,h=i.useTemplateRef("refElInput"),m=i.ref(o.value),f=i.ref(o.value),B=i.computed(()=>{let e={"panel-input-number":!0};return e=l.getJsonMerge(e,I.getClassNameJson(o.className)),l.getStringByJson(e," ")}),w=i.computed(()=>l.isNonEmptyString(o.inputmode)?o.inputmode:o.decimal===0?"numeric":"decimal"),N=e=>{if(e!==f.value){f.value=e;const t=g(e);p("update:value",t),p("update:modelValue",t),p("onChange",t)}},C=e=>{let t=l.isNumber(e);if(!t)if(l.isNaN(+e))e==="-"&&(t=!0);else{const n=e.split(".");n.length===2&&(t=(l.isNumber(n[0])||l.isEmpty(n[0]))&&(l.isEmpty(n[1])||l.isNumber(n[1])))}return t},v=(e,t,n=!0,a=!0)=>{let r=e;if(o.isNumber){let u=l.removeReplace(e);if(u.length>0)if(C(u)){if(u!=="-"){const{decimal:c}=o;if(n&&c!==0&&(c===-1||c>=0&&c<=100)&&c!==-1){const y=parseFloat(u);if(l.isFinite(y)){const x=y.toFixed(c);u=x.indexOf("e")>-1?u:x}}if(a){const y=u.split("."),x=l.isEmpty(y[0])?"0":y[0];if(u=o.isThousand?l.getFormatThousands(x):x,y.length===2&&c!==0){const z=c===-1?y[1]:y[1].slice(0,c);u+=`.${z}`}}}}else u=t;else u="";r=u}return r},O=(e,t)=>{const n=t.split(""),a=new RegExp("^"+n.map(d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*?")),r=e.match(a);let u;return r&&(u=r[0].length),u},R=(e,t,n)=>{const a=I.getFocusSelection(e);let r=t.substring(0,a.start);r=l.removeReplace(r);const u=t.substring(a.start);let d=C(r);r.indexOf(".")>-1&&u.indexOf(".")>-1&&(d=!1);let c=a.start;d?c=O(n,r):c=n.lastIndexOf(u),(l.isUndefined(c)||c>n.length||c<0)&&(c=n.length),i.nextTick(()=>{I.setFocusSelection(e,c,c)})},E=()=>{const e=m.value;if(l.isEmpty(e))return e;{let t=e.toString();if(o.isNumber){const{decimal:n}=o;if(t=l.removeReplace(t),t==="-")return t;if(n!==0&&n!==-1){const u=parseFloat(t);if(l.isFinite(u)&&n>=0&&n<=100){const d=u.toFixed(n);t=d.indexOf("e")>-1?t:d}}const a=t.split("."),r=l.isEmpty(a[0])?"0":a[0];a[0]=o.isThousand?l.getFormatThousands(r):r,n===0?t=a[0]:a.length===2?(a[1]=n===-1?a[1]:l.getFillZero(a[1],n,"r"),t=a.join(".")):t=a[0]}return t}},g=e=>{let t="";if(!l.isEmpty(e)&&(t=e.toString(),o.isNumber&&t!=="-")){const{decimal:n}=o,a=t.split(".");let r=l.removeReplace(a[0]);if(a.length===2&&n!==0){let u="";n===-1?u=a[1]:u=l.getFillZero(a[1],n,"r"),r+=`.${u}`}t=r}return t},k=()=>{h.value?.focus()},K=()=>{if(!l.isEmpty(o.value)){const e=v(o.value,"");m.value=e,f.value=e}};i.onMounted(()=>{K()}),i.watch(()=>o.value,(e,t)=>{if(e!==t&&e!==m.value){let n=!0;if(o.isNumber){const a=l.removeReplace(e),r=l.removeReplace(m.value),u=l.isEmpty(a),d=l.isEmpty(r);u&&d?n=!1:!u&&!d&&(n=Number(a)!==Number(r))}if(n){const a=v(e,t);m.value=a,f.value=a}}}),i.watch([()=>o.isNumber,()=>o.decimal,()=>o.isThousand],()=>{const e=v(m.value,"");m.value=e,N(e)});const D=e=>{const t=v(e,f.value,!1,o.isImmediateThousand);m.value=t,h.value?.setValue(t),o.isNumber&&i.nextTick(()=>{const n=h.value?.getInputElement();n&&m.value===t&&R(n,e,String(t))}),N(t)},$=()=>{const e=E();m.value=e,f.value=e;const t=g(e);p("onFocus",t)},L=()=>{const e=E();m.value=e,f.value=e;const t=g(e);p("onBlur",t)},P=e=>{p("onChangeBlur",g(e))},q=e=>{p("onKeyupEnter",g(e))},J=e=>{p("onKeydown",e)},M=e=>{p("onKeyup",e)},U=()=>{p("onClear")},j=()=>{p("onInit")},Z=e=>{p("onChangeDelay",g(e))},V=()=>g(m.value);return b({getValue:V,getValueData:()=>({value:V(),show:l.isEmpty(m.value)?"":m.value.toString()}),setValue:(e,t)=>{const n=l.isEmpty(e)?"":v(e,"");if(m.value=n,f.value=n,h.value?.setValue(n),t){const a=g(n);p("update:value",a),p("update:modelValue",a),p("onChange",a)}},focus:()=>{k()},getInputElement:()=>h.value?.getInputElement()??null}),(e,t)=>(i.openBlock(),i.createBlock(T._sfc_main,{ref_key:"refElInput",ref:h,id:i.unref(F),value:m.value,name:s.name,className:B.value,inputType:s.inputType,inputmode:w.value,autocomplete:s.autocomplete,placeholder:s.placeholder,label:s.label,isFloating:s.isFloating,disabled:s.disabled,isReadonly:s.isReadonly,isClean:s.isClean,width:s.width,theme:s.theme,isPlaintext:s.isPlaintext,plaintextEmptyText:s.plaintextEmptyText,changeDelayTime:s.changeDelayTime,onOnChange:D,onOnFocus:$,onOnBlur:L,onOnChangeBlur:P,onOnKeyupEnter:q,onOnKeydown:J,onOnKeyup:M,onOnClear:U,onOnInit:j,onOnChangeDelay:Z},i.createSlots({_:2},[e.$slots.prepend?{name:"prepend",fn:i.withCtx(()=>[i.renderSlot(e.$slots,"prepend")]),key:"0"}:void 0,e.$slots.append?{name:"append",fn:i.withCtx(()=>[i.renderSlot(e.$slots,"append")]),key:"1"}:void 0,e.$slots.suffix?{name:"suffix",fn:i.withCtx(()=>[i.renderSlot(e.$slots,"suffix")]),key:"2"}:void 0]),1032,["id","value","name","className","inputType","inputmode","autocomplete","placeholder","label","isFloating","disabled","isReadonly","isClean","width","theme","isPlaintext","plaintextEmptyText","changeDelayTime"]))}});exports._sfc_main=A;
|
|
@@ -3,12 +3,12 @@ import t from "@cldemo/ui-kit/common/base";
|
|
|
3
3
|
import oe from "@cldemo/ui-kit/common/Element";
|
|
4
4
|
import { _ as Ge } from "./List.vue_vue_type_script_setup_true_lang-CRkZfB8a.js";
|
|
5
5
|
import { _ as Qe } from "./Index.vue_vue_type_script_setup_true_lang-cOsTL39H.js";
|
|
6
|
-
import { _ as Xe } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
6
|
+
import { _ as Xe } from "./Index.vue_vue_type_script_setup_true_lang-F9tBnc_7.js";
|
|
7
7
|
import { _ as Ye } from "./Index.vue_vue_type_script_setup_true_lang-L4NDsLxm.js";
|
|
8
|
-
import { _ as Ze } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
8
|
+
import { _ as Ze } from "./Index.vue_vue_type_script_setup_true_lang-D4a5Iaue.js";
|
|
9
9
|
import { _ as et } from "./Index.vue_vue_type_script_setup_true_lang-DWkYiuK9.js";
|
|
10
10
|
import { _ as tt } from "./Index.vue_vue_type_script_setup_true_lang-C2LGy18j.js";
|
|
11
|
-
import { _ as nt } from "./Index.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { _ as nt } from "./Index.vue_vue_type_script_setup_true_lang-VjIva6RM.js";
|
|
12
12
|
import { _ as Me } from "./One.vue_vue_type_script_setup_true_lang-cviYcHLZ.js";
|
|
13
13
|
import { _ as it } from "./Ing.vue_vue_type_script_setup_true_lang-DLgw8gwh.js";
|
|
14
14
|
import { a as at } from "./language-CZZEj4e3.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),l=require("@cldemo/ui-kit/common/base"),N=require("@cldemo/ui-kit/common/globalConfig"),M=require("@cldemo/ui-kit/common/Element"),w=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js");;/* empty css */;/* empty css */const R=["id"],A=["name","placeholder","disabled","aria-label"],d="100px",K=t.defineComponent({name:"ClInputTextarea",__name:"Index",props:{id:{type:String,default:""},name:{type:String,default:""},value:{type:String,default:""},className:{type:String,default:""},disabled:{type:Boolean,default:!1},width:{type:String,default:""},height:{type:String,default:"100px"},placeholder:{type:String,default:""},isClean:{type:Boolean,default:!1},isAutoHeight:{type:Boolean,default:!1},changeDelayTime:{type:Number,default:200},heightMax:{type:String,default:""},isPlaintext:{type:Boolean,default:!1},plaintextEmptyText:{type:String,default:void 0}},emits:["update:value","update:modelValue","onChange","onInit","onKeydownEnter","onKeyupEnter","onFocus","onBlur","onChangeDelay"],setup(c,{expose:v,emit:x}){const a=c,s=x,E=a.id,p=t.useTemplateRef("refElTextarea"),m=t.reactive({height:a.height||d}),u=t.ref(l.isString(a.value)?a.value:""),i={lastValue:l.isString(a.value)?a.value:"",prevDelayValue:l.isString(a.value)?a.value:"",valueDelayRun:!1},T=t.computed(()=>{let e=a.name;return l.isEmpty(e)&&(e=`textarea_${l.getRandom(8)}`),e}),k=t.computed(()=>a.isClean&&!a.disabled&&!l.isEmpty(u.value)),C=t.computed(()=>{let e={"panel-input-textarea":!0,"textarea-clean":a.isClean&&!a.isPlaintext};return a.isPlaintext&&(e["cl-plaintext-value"]=!0,e["cl-plaintext-value-pre"]=!0),e=l.getJsonMerge(e,M.getClassNameJson(a.className)),e}),D=t.computed(()=>{const e=u.value;return l.isString(e)?e.replace(/<\/?br\s*\/?>/gi,`
|
|
2
|
+
`):""}),_=t.computed(()=>N.getPlaintextOutText("inputTextarea",a.plaintextEmptyText,D.value,a.value)),B=t.computed(()=>{const{width:e,heightMax:n}=a,r={};return l.isNonEmptyString(e)&&(r.width=e),a.isPlaintext||(l.isEmpty(m.height)||(r.height=m.height),l.isNonEmptyString(n)&&(r["max-height"]=n)),r});let o;const S=e=>{o&&(clearTimeout(o),o=null),i.valueDelayRun=!0,o=setTimeout(()=>{i.valueDelayRun=!1,i.prevDelayValue!==e&&(i.prevDelayValue=e,s("onChangeDelay",e))},Math.max(a.changeDelayTime,0))},h=e=>{e!==i.lastValue&&(i.lastValue=e,s("update:value",e),s("update:modelValue",e),s("onChange",e),S(e))},g=()=>{if(a.isAutoHeight){const e=p.value;if(e){e.style.height=a.height||d;const n=e.scrollHeight+e.scrollTop+(e.offsetHeight-e.clientHeight);e.style.height="100%",m.height=n>0?`${n}px`:a.height||d}}},f=()=>{p.value?.focus()},V=()=>{t.nextTick(()=>{s("onInit")})};t.onMounted(()=>{V()}),t.onBeforeUnmount(()=>{o&&(clearTimeout(o),o=null)}),t.watch(()=>a.value,(e,n)=>{e!==n&&(u.value=l.isString(e)?e:"",i.lastValue=l.isString(e)?e:"",requestAnimationFrame(()=>g()),i.valueDelayRun||(i.prevDelayValue=e||""))});const P=e=>{const n=e.target;if(!n)return;const r=n.value;requestAnimationFrame(()=>g()),h(r)},b=e=>{e.key==="Enter"&&s("onKeydownEnter",e)},H=e=>{e.key==="Enter"&&s("onKeyupEnter",e)},I=()=>{u.value="",h(""),f()},q=()=>{s("onFocus")},F=()=>{s("onBlur")},y=()=>l.trim(u.value);return v({getValue:y,getValueData:()=>({value:y(),show:u.value}),setValue:e=>{o&&(clearTimeout(o),o=null,i.valueDelayRun=!1);const n=l.isEmpty(e)?"":e;i.lastValue=n,i.prevDelayValue=n,u.value=n,g()},initHeight:()=>{m.height=a.height||d,a.isAutoHeight&&g()},focus:()=>{f()},getParentElement:()=>p.value?.parentElement||null}),(e,n)=>(t.openBlock(),t.createElementBlock("div",{id:t.unref(E),class:t.normalizeClass(C.value),style:t.normalizeStyle(B.value)},[c.isPlaintext?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(_.value),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.withDirectives(t.createElementVNode("textarea",{ref_key:"refElTextarea",ref:p,class:"form-control text-area","onUpdate:modelValue":n[0]||(n[0]=r=>u.value=r),name:T.value,placeholder:c.placeholder,disabled:c.disabled,"aria-label":c.placeholder||"文本输入区域",onInput:P,onKeydown:b,onKeyup:H,onFocus:q,onBlur:F},null,40,A),[[t.vModelText,u.value]]),k.value?(t.openBlock(),t.createBlock(w._sfc_main,{key:0,name:"close-circle-fill",class:"textarea-clear-icon","aria-label":"清除输入内容",onClick:t.withModifiers(I,["stop"])})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64))],64))],14,R))}});exports._sfc_main=K;
|