@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),H=require("@cldemo/ui-kit/common/log"),l=require("@cldemo/ui-kit/common/base"),Z=require("@cldemo/ui-kit/common/Element"),G=require("./Index.vue_vue_type_script_setup_true_lang-vLqCsSbV.js"),te=require("@cldemo/ui-kit/common/Element/Event"),$=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js"),ne=["aria-disabled"],q=t.defineComponent({name:"ClInputnumberstepperButton",__name:"Button",props:{className:{},disabled:{type:Boolean},checkDownBeforeCallback:{type:Function}},emits:["onLongDownStart","onLongDownEnd"],setup(c,{emit:T}){const n=c,C=T,g=t.useTemplateRef("refElButton"),a={longDownInterval:null,isMoveBoundary:!1,isLongDownActive:!1,isKeyDown:!1,dragEvent:null,sessionSource:null},p=t.computed(()=>{const o=l.getJsonMerge({"inputNumberStepper-controls":!0},Z.getClassNameJson(n.className));return o["inputNumberStepper-controls-disabled"]=!!n.disabled,o}),y=()=>{C("onLongDownStart")},O=o=>{C("onLongDownEnd",o)},w=()=>{let o=!0;if(n.checkDownBeforeCallback){try{o=n.checkDownBeforeCallback()}catch(i){H.warn("ClInputnumberstepperButton","长按开始回调执行失败,按允许处理",i),o=!0}o=l.isBoolean(o)?o:!0}return o},s=()=>{a.longDownInterval&&(clearInterval(a.longDownInterval),a.longDownInterval=null)},k=o=>{a.isLongDownActive&&a.sessionSource!==o||(a.isLongDownActive=!0,a.sessionSource=o,y(),s(),a.longDownInterval=setInterval(()=>{n.disabled?D():y()},200))},N=o=>{if(a.sessionSource!=="mouse")return;const i=o.target;g.value===o.target||g.value?.contains(i)?a.isMoveBoundary&&(a.isMoveBoundary=!1,!n.disabled&&w()&&k("mouse")):(s(),a.isMoveBoundary=!0)},D=(o,i)=>{if(a.isLongDownActive){if(o&&a.sessionSource&&o!==a.sessionSource)return;s(),a.isLongDownActive=!1,a.sessionSource=null,a.isKeyDown=!1,O(i)}},F=()=>{const o={start(i){if(n.disabled)return!1;const B=i,_=i;let x=!1;return(B.buttons===1||i.type==="touchstart"||(_.touches?.length??0)>0)&&(x=w(),x&&(a.isMoveBoundary=!1,k("mouse"))),x},ing:i=>{N(i)},end:()=>{D("mouse")}};g.value&&(a.dragEvent=new te.Drag(g.value,o))};t.onMounted(()=>{t.nextTick(()=>{F()})}),t.onBeforeUnmount(()=>{D(),a.dragEvent&&(a.dragEvent.end(),a.dragEvent=null)});const R=o=>{const i=o.key;if(i==="Enter"||i===" "){if(n.disabled)return;o.preventDefault(),!a.isKeyDown&&!a.isLongDownActive&&w()&&(a.isKeyDown=!0,k("keyboard"))}},A=o=>{const i=o.key;(i==="Enter"||i===" ")&&a.isKeyDown&&D("keyboard")},I=()=>{(a.isKeyDown||a.isLongDownActive)&&D(void 0,!0)};return(o,i)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"refElButton",ref:g,class:t.normalizeClass(p.value),role:"button",tabindex:"0","aria-disabled":n.disabled,onKeydown:R,onKeyup:A,onBlur:I},[t.renderSlot(o.$slots,"icon")],42,ne))}}),oe=["id"],ae=t.defineComponent({name:"ClInputNumberStepper",components:{ClInputNumber:G._sfc_main,ClInputnumberstepperButton:q,ClIconFont:$._sfc_main},__name:"Index",props:{id:String,value:{type:[String,Number],default:""},className:{type:String,default:""},disabled:{type:Boolean,default:!1},size:{type:String,default:"large"},btnShowType:{type:String,default:"fixed"},btnTheme:{type:String,default:"leftRight",validator:c=>["leftRight","upDown"].indexOf(c)!==-1},btnShape:{type:String,default:"square",validator:c=>["square","circle"].indexOf(c)!==-1},placeholder:{type:String,default:""},isClean:{type:Boolean,default:!0},isTextRead:{type:Boolean,default:!1},min:Number,max:Number,isLoop:{type:Boolean,default:!1},decimal:{type:Number,default:0},fillZeroCount:{type:Number,default:0},btnStep:{type:Number,default:1},btnClsIconSub:{type:String,default:""},btnClsIconAdd:{type:String,default:""},operateBtnDownBeforeCallback:{type:Function,default:void 0},calculationOperateValueCallback:{type:Function,default:void 0},isPlaintext:{type:Boolean,default:!1}},emits:["update:value","update:modelValue","onChange","onError"],setup(c,{emit:T}){const n=c,C=T,g=t.useTemplateRef("refElInput"),a=t.reactive({isFocus:!1}),p=t.ref(""),y=t.reactive({subtractDisabled:!1,addDisabled:!1}),O=n.id,w={upDown:{subtract:"angle-up",add:"angle-down"},leftRight:{subtract:"minus",add:"plus"}};let s=null;const k=()=>{const e=n.btnStep;return l.isFinite(e)&&e>0?e:1},N=t.computed(()=>{const e=n.decimal,u=k().toString();let S=e;if(u.indexOf(".")>-1){const r=u.split(".")[1].length;e<r&&(S=r)}return S===-1?-1:Math.max(0,Math.min(100,Math.round(S)))}),D=t.computed(()=>n.fillZeroCount>0&&l.isFinite(n.fillZeroCount)),F=t.computed(()=>{if(l.isNonEmptyString(n.btnClsIconSub))return"";const e=n.btnTheme||"leftRight";return w[e]?w[e].subtract:""}),R=t.computed(()=>{if(l.isNonEmptyString(n.btnClsIconAdd))return"";const e=n.btnTheme||"leftRight";return w[e]?w[e].add:""}),A=t.computed(()=>{if(n.isPlaintext){let u={"cl-plaintext-stepper":!0};return u=l.getJsonMerge(u,Z.getClassNameJson(n.className)),u}let e={"panel-input-number-stepper":!0,"inputNumberStepper-disabled":n.disabled||!1};return e=l.getJsonMerge(e,Z.getClassNameJson(n.className)),e[`inputNumberStepper-btn-${n.btnTheme||"leftRight"}`]=!0,e[`inputNumberStepper-btn-${n.btnShowType||"fixed"}`]=!0,(n.btnTheme||"leftRight")==="leftRight"&&n.btnShape==="circle"&&(e["inputNumberStepper-btnShape-circle"]=!0),e["inputNumberStepper-focus"]=a.isFocus,e[`inputNumberStepper-${n.size||"large"}`]=!0,e}),I=()=>{const e=p.value;C("update:value",e),C("update:modelValue",e),C("onChange",e)},o=e=>{l.isEmpty(e)||g.value?.setValue(e),p.value=e},i=(e,u)=>{l.isUndefined(e)&&(e=""),l.isString(e)&&(e=l.removeReplace(e));const S=e.toString();let r=e,K=!1,M=!1,V=!1;if(n.calculationOperateValueCallback){let d=null;try{const b=n.calculationOperateValueCallback({value:e,type:u});b&&(d=b)}catch{C("onError","数值计算回调执行失败")}d&&(l.isString(d.value)||typeof d.value=="number"&&l.isFinite(d.value))&&(r=d.value,K=d.subtractDisabled||!1,M=d.addDisabled||!1)}else{const d=u&&!l.isEmpty(u);if(d||!l.isEmpty(e)){const b=l.isEmpty(e)?0:Number(e);if(l.isFinite(b)){const h=n.min,m=n.max,{isLoop:v=!1}=n,E=l.isUndefined(h),L=l.isUndefined(m),z=k();let f=b;if(d){f+=z*(u==="subtract"?-1:1);const j=f.toString();if(j.indexOf(".")>-1){const ee=j.split(".")[1].length,P=N.value;P>=0&&ee>P&&(f=Number(f.toFixed(P)))}}!E&&f<=h?(v||(K=!0),r=f<h&&v&&!L?m:h,V=f!==r):!L&&f>=m?(v||(M=!0),r=f>m&&v&&!E?h:m,V=f!==r):r=f}}}if(typeof r=="number"&&N.value>0&&(r.toString().indexOf(".")>-1||S.indexOf(".")>-1)&&(r=r.toFixed(N.value)),!l.isString(r)&&!(typeof r=="number"&&l.isFinite(r))&&(r=""),D.value&&!l.isEmpty(r)&&l.isFinite(r)){const d=n.fillZeroCount;d>10&&H.warn("ClInputNumberStepper","fillZeroCount 超过 10,按 10 处理",d);const b=r.toString(),h=b.charAt(0)==="-",m=h?b.slice(1):b,v=m.indexOf("."),E=v>-1?m.slice(0,v):m,L=v>-1?m.slice(v):"",f=!/[eE]/.test(m)&&E.length<d?l.getFillZero(E,Math.min(d,10)):E;r=(h?"-":"")+f+L}return o(r.toString()),y.subtractDisabled=K,y.addDisabled=M,V},B=e=>{a.isFocus=e,e&&g.value?.focus()},_=e=>["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].indexOf(e.key)!==-1;t.onBeforeUnmount(()=>{s&&(clearTimeout(s),s=null)}),t.watch(()=>n.value,(e,u)=>{e!==u&&e!==p.value&&i(e)&&I()},{immediate:!0});const x=e=>{n.disabled||(e=l.removeReplace(e),o(e),s&&(clearTimeout(s),s=null),s=setTimeout(()=>{l.isEmpty(p.value)?(y.subtractDisabled=!1,y.addDisabled=!1):i(p.value),I()},100))},Q=e=>{if(!n.disabled&&!n.isTextRead&&_(e)){e.preventDefault(),s&&(clearTimeout(s),s=null);const u=e.key;u==="ArrowLeft"||u==="ArrowDown"?i(p.value,"subtract"):i(p.value,"add"),I(),B(!0)}},W=e=>{!n.disabled&&!n.isTextRead&&_(e)&&(s&&(clearTimeout(s),s=null),B(!0))},X=()=>{B(!0)},Y=e=>{B(!1),n.disabled||o(e)},J=e=>{s&&(clearTimeout(s),s=null),i(p.value,e)},U=e=>{s&&(clearTimeout(s),s=null),I(),e||B(!0)};return(e,u)=>(t.openBlock(),t.createElementBlock("div",{id:t.unref(O),class:t.normalizeClass(A.value)},[t.createVNode(G._sfc_main,{ref_key:"refElInput",ref:g,value:p.value,placeholder:c.placeholder,disabled:c.disabled,isReadonly:c.isTextRead,isClean:c.isClean,isNumber:!D.value,decimal:N.value,isPlaintext:c.isPlaintext,theme:"icon",onOnChange:x,onOnKeydown:Q,onOnKeyup:W,onOnFocus:X,onOnBlur:Y},t.createSlots({_:2},[e.$slots.textPrepend?{name:"prepend",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"textPrepend")]),key:"0"}:void 0]),1032,["value","placeholder","disabled","isReadonly","isClean","isNumber","decimal","isPlaintext"]),c.isPlaintext?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(q,{className:"inputNumberStepper-subtract","aria-label":"减少",disabled:c.disabled||y.subtractDisabled,checkDownBeforeCallback:c.operateBtnDownBeforeCallback,onOnLongDownStart:u[0]||(u[0]=S=>J("subtract")),onOnLongDownEnd:U},{icon:t.withCtx(()=>[t.createVNode($._sfc_main,{name:F.value,className:c.btnClsIconSub},null,8,["name","className"])]),_:1},8,["disabled","checkDownBeforeCallback"]),t.createVNode(q,{className:"inputNumberStepper-add","aria-label":"增加",disabled:c.disabled||y.addDisabled,checkDownBeforeCallback:c.operateBtnDownBeforeCallback,onOnLongDownStart:u[1]||(u[1]=S=>J("add")),onOnLongDownEnd:U},{icon:t.withCtx(()=>[t.createVNode($._sfc_main,{name:R.value,className:c.btnClsIconAdd},null,8,["name","className"])]),_:1},8,["disabled","checkDownBeforeCallback"])],64))],10,oe))}});exports._sfc_main=ae;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),t=require("@cldemo/ui-kit/common/base"),pe=require("@cldemo/ui-kit/common/Element"),ve=require("@cldemo/ui-kit/common/log"),Ee=require("./Index.vue_vue_type_script_setup_true_lang-CZNVHUR1.js"),D=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 O={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 d=[];return t.isNonEmptyString(n)&&(n.split(",").forEach(i=>{for(const[v,H]of Object.entries(O.format))t.isExistValue(H,i.toLocaleLowerCase())&&d.push(v)}),d=t.getArrUnique(d)),d},getIcon:n=>{let d="";return t.isEmpty(n)?d=O.icon.default:d=t.isExistJsonKey(O.icon,n)?O.icon[n]:O.icon.default,d},getSuffix:n=>{let d=[];return t.isEmpty(n)||(n.forEach(g=>{const i=O.suffix[g.toLocaleLowerCase()];t.isUndefined(i)||(d=d.concat(i))}),t.isEmpty(d)&&(d=n)),d=t.getArrUnique(d),d},getRegexBySuffix:n=>{if(t.isEmpty(n))return null;const d=`\\.(?:${n.join("|")})$`;return new RegExp(d,"i")},getMime:n=>{let d=[];return t.isEmpty(n)||n.forEach(g=>{const i=O.mime[g];t.isUndefined(i)||(d=d.concat(i))}),d=t.getArrUnique(d),d},getRegexByMime:n=>{if(t.isEmpty(n))return null;const d=`^(?:${n.join("|").replace(/\//g,"\\/")})$`;return new RegExp(d,"i")},getImageThumbnail:(n,d,g)=>{let i=null;try{const v=document.createElement("canvas");v.width=d,v.height=g,v.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,d,g),i=v.toDataURL("image/gif")}catch{i=null}return i}},we=(n,d)=>{let g=n;const i=e.reactive({mime:[],suffix:[],isCheckImgWH:!1});let v=null;const H=m=>{g=t.getJsonMerge(g,m),j()},I=m=>{const p=g.checkMsg;return t.isString(p)&&!t.isEmpty(p)?p:t.isObject(p)&&!t.isEmpty(p[m])?p[m]:d.value[m]},j=()=>{const m=t.isNonEmptyString(g.checkFormat)?O.getSuffix(g.checkFormat.split(",")):[],p=O.getMime(m),S=!t.isEmpty(g.checkWidth)&&!t.isEmpty(g.checkHeight);i.mime=p,i.suffix=m,i.isCheckImgWH=S},z=m=>{const p=O.getIcon(m);return{type:m,icon:p,isImage:m==="img",isVideo:m==="video",isAudio:m==="audio",isTxt:m==="txt",isZip:m==="zip"}},R=(m,p)=>{if(t.isUndefined(v)){v={};for(const[s,a]of Object.entries(O.format)){const w=O.getSuffix(a),k=O.getMime(w),F=O.getRegexBySuffix(w),U=O.getRegexByMime(k);v[s]={suffix:w,mime:k,regSuffix:F,regMime:U}}}let S="";return Object.keys(v).forEach(s=>{if(S.length===0){const a=v[s];(a.regSuffix&&a.regSuffix.test(m)||p&&a.regMime&&a.regMime.test(p))&&(S=s)}}),z(S)},G=m=>{const p=O.getFormatGroup(t.isEmpty(m)?g.checkFormat:m),S=p.length===1?p[0]:"";return z(S)},q=m=>{if(!t.isString(m))return R("");if(m.startsWith("data:")||m.startsWith("blob:")){const S=m.match(/^[a-z]+:([a-zA-Z0-9.+-]+\/[a-zA-Z0-9.+-]+)/);return R("",S?S[1]:"")}const p=m.substring(m.lastIndexOf("/")+1).split("?")[0].split("#")[0];return R(p)},A=(m,p,S,s,a)=>{const w=t.isFinite(S)&&S>0?S:0,k=t.isFinite(s)&&s>0?s:0;let F=a;(F==="height"||F==="contain")&&k===0&&(F="width");let U=1;switch(F){case"height":U=k>0?k/p:1;break;case"contain":U=Math.min(w>0?w/m:1,k>0?k/p:1);break;case"width":default:U=w>0?w/m:1;break}return U>1&&(U=1),{tw:Math.round(m*U),th:Math.round(p*U)}},te=(m,p,S,s)=>new Promise((a,w)=>{const k=document.createElement("img");k.onload=F=>{const U=F.target.width,P=F.target.height,{tw:J,th:W}=A(U,P,p,S,s),_=F.target.src;a({src:_,w:U,h:P,tw:J,th:W,isImage:!0})},k.onerror=()=>{w(new Error("fail: temp create image"))},k.src=m}),ie=(m,p)=>{const S=t.isEmpty(g.checkWidth)?0:parseInt(g.checkWidth,10),s=t.isEmpty(g.checkHeight)?0:parseInt(g.checkHeight,10);if(!t.isFinite(S)||!t.isFinite(s)||S===0||s===0)return!0;let a=!0;switch(g.checkWHType){case"greater":a=m>=S&&p>=s;break;case"less":a=m<=S&&p<=s;break;case"equal":a=m===S&&p===s;break;default:a=!0;break}return a},ne=(m,p)=>new Promise((S,s)=>{if(m instanceof File){const a=new FileReader;a.onload=w=>{te(w.target.result,p.maxWidth,p.maxHeight,p.imgFit).then(k=>{(i.isCheckImgWH?ie(k.w,k.h):!0)?S(k):s(new Error(I("checkImageWHLabel")))}).catch(k=>{s(k)})},a.onerror=()=>{s(new Error("fail: new FileReader image onload()"))},a.readAsDataURL(m)}else s(new Error("fail: file is not a File instance"))}),Y=async(m,p)=>{let S=[];const s=[],a=[],w=O.getRegexBySuffix(i.suffix),k=O.getRegexByMime(i.mime),F=W=>{const _=t.isEmpty(W)?NaN:parseInt(W,10);return t.isFinite(_)?_*1024:null},U=F(g.checkMinSize),P=F(g.checkMaxSize),J=m.length;for(let W=0;W<J;W+=1){const _=[],L=m[W],r={suffix:!1,mime:!1,size:!1},y=L.name;w&&!w.test(y)&&(r.suffix=!0);const b=L.type;!t.isEmpty(b)&&k&&!k.test(b)&&(r.mime=!0),U&&L.size<U&&(r.size=!0),P&&L.size>P&&(r.size=!0),(r.suffix||r.mime)&&_.push(I("checkSuffixMimeLabel")),r.size&&_.push(I("checkSizeLabel"));const h=R(y,b);let T=null;h.isImage&&(T=await ne(L,p).catch(B=>{_.push(B.message)})),t.isUndefined(T)&&(T={}),T=t.getJsonMerge(T,h),T.fileName=y,T.file=L,_.length===0?(s.push(L),a.push(T)):J===1?S=_.map(B=>`${I("uploadFile")} ${B}`):S.push(`${y}:${_.join(",")}`)}return new Promise(W=>{setTimeout(()=>{W({errorMsg:S,passFiles:s,passFilesInfo:a,original:m})},200)})};return j(),{optBase:i,getTypeByFormat:G,getTypeByUrl:q,createTempImg:te,checkFile:Y,setBaseOptions:H}},ye=()=>({setFileInfo:(d,g)=>{const i=g&&g.fileUrl?g.fileUrl:"";if(!t.isString(i))return{name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0};const v=t.isEmpty(i);let H="";v||i.startsWith("blob:")?H=d.fileName:H=i.substr(i.lastIndexOf("/")+1);let I="",j=0,z=0;return d.isImage&&(I=v?d.src:i,j=d.tw||0,z=d.th||0),{name:H,url:i,imgSrc:I,imgWidth:j,imgHeight:z}}}),be=()=>{const n=(g,i)=>{window.open(g)};return{downloadHref:n,downloadBlob:g=>{if(!t.isEmpty(g)){const i=g.lastIndexOf("/"),v=g.substring(i+1),H=g.replace(/\\/g,"/"),I=new XMLHttpRequest;I.open("GET",H,!0),I.responseType="blob",I.onload=()=>{if(I.status===200){const j=window.URL||window.webkitURL||window,z=new Blob([I.response]),R=document.createElementNS("http://www.w3.org/1999/xhtml","a");R.href=j.createObjectURL(z),R.download=v,R.click(),setTimeout(()=>URL.revokeObjectURL(R.href),1e3)}else n(g)},I.onerror=()=>{n(g)},I.send()}}}},xe=["name","accept"],Fe=["name"],Ue={class:"fileUpload-label"},Me={key:0,class:"fileUpload-img"},Ie={class:"fileUpload-img-container"},Te=["src","width","height"],Ce={key:0,class:"file-complete-img-msg"},_e=["title"],Ne=["title"],He={key:1,class:"fileUpload-video"},Re=["src"],We=["title"],Oe={key:2,class:"fileUpload-file"},ze=["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:d,emit:g}){const i=n,v=g,{optPageLanguage:H,getPageLanguage:I}=Se.useLanguage();I("fileUpload");const j=e.inject("$FileuploadTop",null);j||ve.warn("FileUpload","Default 主题缺少 $FileuploadTop 注入,使用空校验配置");const{setFileInfo:z}=ye(),R=()=>t.getJsonMerge(j?.getFileCheckInfo()??{},{checkFormat:i.checkFormat,checkWidth:i.checkWidth,checkHeight:i.checkHeight,checkWHType:i.checkWHType,checkMinSize:i.checkMinSize,checkMaxSize:i.checkMaxSize}),{optBase:G,getTypeByFormat:q,getTypeByUrl:A,createTempImg:te,checkFile:ie,setBaseOptions:ne}=we(R(),H),{downloadBlob:Y,downloadHref:m}=be(),p=e.useTemplateRef("refElTopParent"),S=()=>{const l=p.value;if(!l)return{maxWidth:0,maxHeight:0};const f=4,C=l.clientWidth>0?Math.max(l.clientWidth-f,0):0;let V=0;if(i.imgFit==="height"||i.imgFit==="contain"){const $=l.parentElement;$&&$.clientHeight>0&&(V=getComputedStyle($).height==="auto"?0:Math.max($.clientHeight-f,0))}return{maxWidth:C,maxHeight:V}},s=e.reactive({isImage:!1,isVideo:!1,icon:"",completeMsgTxt:"",isInitFileInput:!0,runOperateType:"init"}),a=e.reactive({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),w={file:null};let k=0,F=null;const U=`fileUpload_${t.getRandom(8)}`,P=e.computed(()=>{let l=i.name;return t.isEmpty(l)&&(l=`fileUpload_${t.getRandom(8)}`),l}),J=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})),_=e.computed(()=>({"fileUpload-complete":!0,"fileUpload-disabled":i.disabled})),L=l=>{v("onChange",l)},r=l=>{v("onError",l)},y=()=>{v("onRemove")},b=(l,f)=>{v("onPreview",l,f)},h=(l,f)=>{v("onSaveFile",l,f)},T=l=>{s.isImage=l.isImage,s.isVideo=l.isVideo,s.icon=l.icon},B=()=>{const l=q();t.isNonEmptyString(i.defaultIcon)&&(l.icon=i.defaultIcon),T(l)},x=l=>{l!=="load"&&(s.isInitFileInput=!0);let f="";switch(l){case"remove":case"clean":{f="init",B();break}case"fail":{let C=!0;s.isImage?(!t.isEmpty(a.url)||!t.isEmpty(a.imgSrc))&&(C=!1):t.isEmpty(a.url)||(C=!1),f=C?"init":"complete";break}default:f=l}s.runOperateType=f},X=l=>{const f=a;for(const[C,V]of Object.entries(l))t.isUndefined(f[C])||(f[C]=V);w.file=l.file??w.file},K=(l,f)=>{ae(),T(l);const C=z(l,f);X(C),x("complete")},le=()=>{let l=null;return t.isString(a.url)&&a.url.startsWith("blob:")?l=w.file:t.isEmpty(a.url)?s.isImage&&!t.isEmpty(a.imgSrc)?l=a.imgSrc:l=w.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 f={...S(),imgFit:i.imgFit};ie(l,f).then(C=>{if(s.runOperateType==="load")if(C.passFiles.length>0){const V=C.passFiles[0],$=C.passFilesInfo[0];if($.isImage)i.isServerCallback?(h(V,$),ue()):(K($,{}),w.file=V,L($.src));else if(i.isServerCallback)h(V,$),ue();else{const re={};if($.isVideo){const de=URL.createObjectURL(V);re.fileUrl=de}K($,re),w.file=V,L(V)}}else x("fail"),C.errorMsg.length>0&&r(C.errorMsg)}).catch(()=>{s.runOperateType==="load"&&(x("fail"),r(["文件校验失败,请重试"]))})}},oe=l=>{if(!t.isNonEmptyString(l)){(t.isString(l)||t.isUndefined(l))&&ge();return}const f=++k,C=A(l);if(s.isImage&&C.isImage){const{maxWidth:V,maxHeight:$}=S();te(l,V,$,i.imgFit).then(re=>{if(f!==k)return;const de=t.getJsonMerge(re,C);K(de,{fileUrl:l})}).catch(()=>{f===k&&(x("fail"),r(["图片加载失败,请检查图片地址"]))})}else K(C,{fileUrl:l})},ae=()=>{t.isString(a.url)&&a.url.startsWith("blob:")&&URL.revokeObjectURL(a.url)},ee=()=>{F&&(clearTimeout(F),F=null)},ue=()=>{ee(),F=setTimeout(()=>{s.runOperateType==="load"&&(x("fail"),r(["服务端保存超时,请重试"]))},6e4)},ge=()=>{k+=1,w.file=null,X({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("init")},ce=()=>{if(t.isEmpty(i.value)){B();return}T(A(i.value))},fe=()=>{let l=i.defaultHoverTitle;s.isImage&&G.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,f)=>{if(l!==f){const C=le();l!==C&&(ee(),ce(),oe(l))}}),e.watch([()=>i.checkFormat,()=>i.checkWidth,()=>i.checkHeight,()=>i.checkWHType,()=>i.checkMinSize,()=>i.checkMaxSize],()=>{if(ee(),ne(R()),ce(),fe(),s.runOperateType==="load")return;const l=le();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(),w.file=null,X({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("remove");const l=document.getElementById(U);l&&(l.value=""),y()},u=l=>{const f=t.isEmpty(a.url)?a.imgSrc:a.url;b(f,"image"),l.preventDefault(),l.stopPropagation()},M=l=>{t.isEmpty(a.url)||b(a.url,"video"),l.preventDefault(),l.stopPropagation()},E=l=>{t.isEmpty(a.url)?m(a.imgSrc,a.name):Y(a.url),l.preventDefault(),l.stopPropagation()},N=l=>{if(t.isString(a.url)&&a.url.startsWith("blob:")){const f=document.createElement("a");f.href=a.url,f.download=a.name,f.click()}else Y(a.url);l.preventDefault(),l.stopPropagation()};return d({saveServerCallback:l=>{if(ee(),s.runOperateType!=="load")return;if(!l||!l.res||!t.isBoolean(l.res.success)){x("fail"),r(["文件保存失败,请重试"]);return}if(!l.res.success){x("fail"),r(["文件保存失败,请重试"]);return}if(!l.req){x("fail"),r(["文件保存失败,请重试"]);return}let f="";if(t.isString(l.res.fileUrl)?f=l.res.fileUrl:t.isArray(l.res.fileUrl)&&l.res.fileUrl.length>0&&t.isString(l.res.fileUrl[0])&&(f=l.res.fileUrl[0]),t.isEmpty(f)){w.file=null,X({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("init");return}K(l.req,{fileUrl:f}),L(f)},getValue:()=>le(),cleanReduction:()=>{ee(),k+=1,ae(),w.file=null,X({name:"",url:"",imgSrc:"",imgWidth:0,imgHeight:0}),x("clean")}}),e.onBeforeUnmount(()=>{ee(),ae()}),(l,f)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(J.value),ref_key:"refElTopParent",ref:p},[e.createElementVNode("div",{class:"fileUpload-default-container",onDrop:ke,onDragover:f[0]||(f[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("label",{for:U},[s.isInitFileInput&&!n.disabled?(e.openBlock(),e.createElementBlock("input",{key:0,type:"file",id:U,name:P.value,onChange:o,accept:e.unref(G).mime.join(",")},null,40,xe)):(e.openBlock(),e.createElementBlock("input",{key:1,id:U,name:P.value,style:{display:"none !important"}},null,8,Fe)),s.runOperateType==="init"?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(W.value)},[e.createVNode(D._sfc_main,{name:s.icon,class:"fileUpload-icon"},null,8,["name"]),e.createElementVNode("span",Ue,[e.renderSlot(l.$slots,"label")])],2)):s.runOperateType==="complete"?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(_.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,Te)]),n.isShowCompleteMsg?(e.openBlock(),e.createElementBlock("span",Ce,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(H).common.preview,onClick:e.withModifiers(u,["stop"])},[e.createVNode(D._sfc_main,{name:"search-plus"})],8,_e)):(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(H).common.download,onClick:e.withModifiers(E,["stop"])},[e.createVNode(D._sfc_main,{name:"download"})],8,Ne)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[],64))])):s.isVideo?(e.openBlock(),e.createElementBlock("span",He,[e.createElementVNode("video",{src:a.url},null,8,Re),n.isShowPreview&&!n.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:"preview-icon",onClick:e.withModifiers(M,["stop"])},[e.createVNode(D._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(H).common.download,onClick:e.withModifiers(N,["stop"])},[e.createVNode(D._sfc_main,{name:"download"})],8,We)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[],64))])):(e.openBlock(),e.createElementBlock("span",Oe,[e.createVNode(D._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(H).common.delete,onClick:e.withModifiers(c,["stop"])},[e.createVNode(D._sfc_main,{name:"close"})],8,ze))],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[],64))])],32),s.runOperateType==="load"?(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(Ee._sfc_main,{theme:"circleBubble",size:"large"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))],2))}}),Pe=["id","name","multiple","accept"],$e=["id","name","disabled","accept"],Ve=["for"],De={key:0,class:"fileUpload-list"},qe={key:0,class:"fileUpload-item-icon fileUpload-item-img"},Ae=["src"],Je=["title","onClick"],Ge={key:1,class:"fileUpload-item-icon fileUpload-item-video"},Xe=["src"],Ke=["onClick"],Ze={class:"fileUpload-item-name"},Qe={class:"fileUpload-item-operate"},Ye=["title","onClick"],et=["title","onClick"],tt=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:d,emit:g}){const i=n,v=g,H=`fileupload-${t.getRandom(5)}`,{optPageLanguage:I,getPageLanguage:j}=Se.useLanguage();j("fileUpload");const z=e.inject("$FileuploadTop",null);z||ve.warn("FileUpload","Button 主题缺少 $FileuploadTop 注入,使用空校验配置");const R=()=>t.getJsonMerge(z?.getFileCheckInfo()??{},{checkFormat:i.checkFormat,checkWidth:i.checkWidth,checkHeight:i.checkHeight,checkWHType:i.checkWHType,checkMinSize:i.checkMinSize,checkMaxSize:i.checkMaxSize}),{setFileInfo:G}=ye(),{optBase:q,getTypeByUrl:A,checkFile:te,setBaseOptions:ie}=we(R(),I),{downloadBlob:ne,downloadHref:Y}=be(),m=e.useTemplateRef("refElButton"),p=e.useTemplateRef("refElLabel"),S=t.getRandom(8),s=e.reactive({elFileId:`btnFile${S}`,isInitFileInput:!0}),a=e.ref([]),w=e.ref([]);let k=null,F=null,U=null;const P=e.computed(()=>{let o=i.name;return t.isEmpty(o)&&(o=`fileUpload_${t.getRandom(8)}`),o}),J=e.computed(()=>{let o={"fileUpload-button":!0};return o=t.getJsonMerge(o,pe.getClassNameJson(i.className)),o}),W=(o,c)=>{v("onChange",o,c)},_=o=>{v("onError",o)},L=()=>{v("onRemove")},r=(o,c,u)=>{v("onPreview",o,c,u)},y=(o,c)=>{v("onSaveFile",o,c)},b=()=>{h(),k=setTimeout(()=>{k=null,s.isInitFileInput||(B("fail"),_(["服务端保存超时,请重试"]))},6e4)},h=()=>{k&&(clearTimeout(k),k=null)},T=()=>{a.value.forEach(o=>{t.isString(o.url)&&o.url.startsWith("blob:")&&URL.revokeObjectURL(o.url)})},B=o=>{switch(o){case"load":i.isShowUploadIng&&m.value?.loadStart();break;case"fail":case"complete":i.isShowUploadIng&&m.value?.loadStop();break}s.isInitFileInput=o!=="load"},x=(o,c)=>{i.isMultiple||(T(),a.value=[]);const u=[],M=[];a.value.forEach(E=>{u.push(E),M.push(E.rId)});for(let E=0;E<o.length;E++){let N=c.length>E?{fileUrl:c[E]}:{};t.isEmpty(N.fileUrl)&&o[E].isVideo&&o[E].file&&(N={fileUrl:URL.createObjectURL(o[E].file)});let Z=G(o[E],N);Z.rId=t.getRandom(9),Z=t.getJsonMerge(o[E],Z),u.push(Z),M.push(Z.rId)}a.value=u,B("complete"),e.nextTick(()=>{w.value=M})},X=()=>{const o=[];return a.value.forEach(c=>{let u=null;t.isString(c.url)&&c.url.startsWith("blob:")?u=c.file:t.isEmpty(c.url)?c.isImage&&!t.isEmpty(c.imgSrc)?u=c.imgSrc:u=c.file:u=c.url,t.isUndefined(u)||o.push(u)}),o.length===0?"":i.isMultiple?o:o[0]},K=o=>{if(t.isArray(o)){T(),a.value=[];const M=[],E=[];o.forEach(N=>{if(t.isNonEmptyString(N)){const Z=A(N);M.push(Z),E.push(N)}}),x(M,E);return}if(!t.isNonEmptyString(o)){t.isString(o)&&le();return}T(),a.value=[];const c=[],u=[];o.split(",").filter(M=>t.isNonEmptyString(M)).forEach(M=>{const E=A(M);c.push(E),u.push(M)}),x(c,u)},le=()=>{T(),B("init"),a.value=[]},me=()=>{K(i.value)};e.onMounted(()=>{e.nextTick(()=>{me()})}),e.onBeforeUnmount(()=>{h(),F&&(clearTimeout(F),F=null),T()}),e.watch(()=>i.value,(o,c)=>{if(o!==c){const u=X();o!==u&&(h(),K(o))}}),e.watch([()=>i.checkFormat,()=>i.checkWidth,()=>i.checkHeight,()=>i.checkWHType,()=>i.checkMinSize,()=>i.checkMaxSize],()=>{s.isInitFileInput&&h(),ie(R())});const oe=o=>{i.disabled||s.isInitFileInput&&o.currentTarget.files.length>0&&(B("load"),te(o.currentTarget.files,{}).then(c=>{if(!s.isInitFileInput){if(c.passFiles.length>0)if(i.isServerCallback){const u=i.isMultiple?c.passFiles:c.passFiles[0],M=i.isMultiple?c.passFilesInfo:c.passFilesInfo[0];y(u,M),b()}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&&(B("fail"),_(["文件校验失败,请重试"]));c.errorMsg.length>0&&(_(c.errorMsg),c.passFiles.length===0&&B("fail"))}}).catch(()=>{s.isInitFileInput||(B("fail"),_(["文件校验失败,请重试"]))}))},ae=(o,c)=>{const u=t.isEmpty(o.url)?o.src:o.url;r(u,"image",c)},ee=(o,c)=>{t.isEmpty(o.url)||r(o.url,"video",c)},ue=o=>{if(U===o)return;U=o,h(),s.isInitFileInput||B("complete");const c=a.value.find(N=>N.rId===o);c&&t.isString(c.url)&&c.url.startsWith("blob:")&&URL.revokeObjectURL(c.url);const u=[],M=[];a.value.forEach(N=>{N.rId!==o&&(u.push(N),M.push(N.rId))}),w.value=M;const E=document.getElementById(s.elFileId);E&&(E.value=""),e.nextTick(()=>{u.length>0?(a.value=u,U=null,L()):F=setTimeout(()=>{F=null,a.value=a.value.filter(N=>N.rId!==o),U=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),u=document.createElement("a");u.href=c,u.download=o.name,u.click(),setTimeout(()=>{URL.revokeObjectURL(c)},1e3)}else ne(o.url)},ce=()=>{p.value?.click()};return d({saveServerCallback:o=>{if(h(),!s.isInitFileInput){if(t.isUndefined(o)||t.isUndefined(o.res)||!t.isBoolean(o.res.success)||t.isUndefined(o.req)){B("fail"),_(["文件保存失败,请重试"]);return}if(o.res.success){let c=[];const u=[];if(t.isNonEmptyString(o.res.fileUrl)?(c.push(o.res.fileUrl),u.push(0)):t.isArray(o.res.fileUrl)&&o.res.fileUrl.forEach((se,Q)=>{t.isNonEmptyString(se)&&(c.push(se),u.push(Q))}),c.length===0){B("complete");return}const M=i.isMultiple?o.req:[o.req];let E=[],N=[];if(!i.isMultiple)E=c,N=M;else{const se=a.value.map(Q=>Q.url).filter(Q=>t.isNonEmptyString(Q));c.forEach((Q,l)=>{const f=u[l];se.indexOf(Q)>-1||t.isUndefined(M[f])||(se.push(Q),E.push(Q),N.push(M[f]))})}if(E.length===0){B("complete");return}x(N,E);const Z=i.isMultiple?E:E[0];W(Z)}else B("fail"),_(["文件保存失败,请重试"])}},getValue:()=>X(),cleanReduction:()=>{h(),le()}}),(o,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(J.value)},[s.isInitFileInput&&!n.disabled?(e.openBlock(),e.createElementBlock("input",{key:0,type:"file",id:s.elFileId,name:P.value,multiple:n.isMultiple,accept:e.unref(q).mime.join(","),onChange:oe},null,40,Pe)):(e.openBlock(),e.createElementBlock("input",{key:1,id:s.elFileId,name:P.value,disabled:n.disabled,accept:e.unref(q).mime.join(","),style:{display:"none !important"},onChange:oe},null,40,$e)),e.createElementVNode("label",{ref_key:"refElLabel",ref:p,for:s.elFileId},[e.createVNode(Be._sfc_main,{ref_key:"refElButton",ref:m,className:n.buttonClass,isShowBackDrop:!0,disabled:n.disabled,label:n.buttonLabel||e.unref(I).common.upload,iconName:n.buttonIcon,color:n.buttonColor,onOnClick:ce},null,8,["className","disabled","label","iconName","color"])],8,Ve)],2),e.renderSlot(o.$slots,"label"),a.value.length>0&&n.isShowUploadResult?(e.openBlock(),e.createElementBlock("ul",De,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,M)=>(e.openBlock(),e.createBlock(e.Transition,{key:`${u.rId}-${M}`,name:"fileUploadButton","enter-active-class":"fileupload-anim-in","leave-active-class":"fileupload-anim-out"},{default:e.withCtx(()=>[w.value.indexOf(u.rId)>-1?(e.openBlock(),e.createElementBlock("li",{key:`${H}-${u.rId}-${M}`,class:"fileUpload-item"},[u.isImage?(e.openBlock(),e.createElementBlock("span",qe,[e.createElementVNode("img",{src:u.imgSrc},null,8,Ae),n.isShowPreview?(e.openBlock(),e.createElementBlock("i",{key:0,class:"preview-icon",title:e.unref(I).common.preview,onClick:e.withModifiers(E=>ae(u,M),["stop"])},[e.createVNode(D._sfc_main,{name:"search-plus"})],8,Je)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])):u.isVideo?(e.openBlock(),e.createElementBlock("span",Ge,[e.createElementVNode("video",{src:u.url},null,8,Xe),n.isShowPreview?(e.openBlock(),e.createElementBlock("span",{key:0,class:"preview-icon",onClick:e.withModifiers(E=>ee(u,M),["stop"])},[e.createVNode(D._sfc_main,{name:"play"})],8,Ke)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))])):(e.openBlock(),e.createBlock(D._sfc_main,{key:2,name:u.icon,class:"fileUpload-item-icon"},null,8,["name"])),e.createElementVNode("span",Ze,e.toDisplayString(u.name),1),e.createElementVNode("span",Qe,[n.isShowDownload?(e.openBlock(),e.createElementBlock("i",{key:0,class:"download-icon",title:e.unref(I).common.download,onClick:e.withModifiers(E=>ge(u),["stop"])},[e.createVNode(D._sfc_main,{name:"download"})],8,Ye)):(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(I).common.delete,onClick:e.withModifiers(E=>ue(u.rId),["stop"])},[e.createVNode(D._sfc_main,{name:"close"})],8,et))])])):e.createCommentVNode("",!0)]),_:2},1024))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64))],64))}}),it=["id"],nt={key:0,class:"cl-plaintext-value"},lt=["src","alt"],ot=["src"],at={key:0},st=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},plaintextSeparator:{type:String,default:","}},emits:["update:value","update:modelValue","onChange","onRemove","onError"],setup(n,{expose:d,emit:g}){const i=n,v=g,H=e.inject("$ClGlobals",null),I=e.useAttrs(),j=i.id,z=e.useTemplateRef("refElFileDefault"),R=e.useTemplateRef("refElFileButton");let G=0,q=0;const A=e.computed(()=>t.isFunction(i.serverFileCallback)),te=["jpg","jpeg","png","gif","webp","bmp","svg"],ie=["mp4","webm","ogg","ogv","mov","avi","mkv"],ne=r=>{const y=r.split("?")[0].split("#")[0],b=y.split("/"),h=b.length>0?b[b.length-1]:y;return t.isEmpty(h)?r:decodeURIComponent(h)},Y=e.computed(()=>{const r=i.value,y=Array.isArray(r)?r:t.isEmpty(r)?[]:[r],b=[];return y.forEach(h=>{if(t.isString(h)){t.isNonEmptyString(h)&&b.push({url:h,name:ne(h),type:"file"});return}h&&t.isNonEmptyString(h.name)&&b.push({url:"",name:h.name,type:"file"})}),b.map(h=>{if(t.isEmpty(h.url))return h;const T=h.name.lastIndexOf("."),B=T>-1?h.name.slice(T+1).toLowerCase():"";let x="file";return te.indexOf(B)>-1?x="image":ie.indexOf(B)>-1&&(x="video"),{...h,type:x}})}),m=e.computed(()=>Y.value.filter(r=>r.type!=="file")),p=e.computed(()=>{const r=t.isString(i.plaintextSeparator)?i.plaintextSeparator:",";return Y.value.filter(y=>y.type==="file").map(y=>y.name).join(r)}),S=e.computed(()=>{let r={"panel-file-upload":!0};return r=t.getJsonMerge(r,pe.getClassNameJson(i.className)),r}),s=(r,y,b)=>{v("update:value",r),v("update:modelValue",r),v("onChange",y,b)},a=()=>{v("onRemove")},w=()=>{let r=null;switch(i.theme){case"default":r=z.value?.getValue();break;case"button":r=R.value?.getValue();break}return r},k=(r,y)=>{switch(r){case"default":z.value?.saveServerCallback(y);break;case"button":R.value?.saveServerCallback(y);break}},F=(r,y)=>{const b=w(),h=A.value?b:r;s(b,h,y)},U=r=>{t.isArray(r)&&v("onError",r)},P=()=>{q+=1,a();const r=w();s(r,r)},J=async(r,y,b)=>{const h=H?.preview;h&&await h.show({type:y,src:r,showIndex:b??0})},W=async(r,y)=>{const b=i.theme,h=++G,T=q;let B=!0;if(i.serverFileCallback)try{const X=!i.isMultiple&&t.isObject(y)&&t.isBoolean(y.isImage)?y.isImage:!1,K=pe.getElementData(I);B=await i.serverFileCallback(r,X,K)}catch{h===G&&q===T&&i.theme===b&&k(b,{req:y,res:{success:!1}});return}let x={};if(t.isBoolean(B)?x.success=B:t.isUndefined(B)?x.success=!0:t.isString(B)||t.isArray(B)?(x.success=!0,x.fileUrl=B):t.isObject(B)?x=B:x.success=!1,i.theme!==b){v("onError",["保存期间主题已切换,本次保存结果未写入"]);return}h!==G||q!==T||k(b,{req:y,res:x})};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})})),d({getValue:()=>w(),cleanReduction:()=>{switch(i.theme){case"default":z.value?.cleanReduction();break;case"button":R.value?.cleanReduction();break}s("","")}}),(r,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(S.value),id:e.unref(j)},[n.isPlaintext?(e.openBlock(),e.createElementBlock("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(b,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`plain-${h}`},[b.type==="image"?(e.openBlock(),e.createElementBlock("img",{key:0,src:b.url,alt:b.name,class:"cl-plaintext-media"},null,8,lt)):(e.openBlock(),e.createElementBlock("video",{key:1,src:b.url,controls:"",class:"cl-plaintext-media"},null,8,ot))],64))),128)),p.value?(e.openBlock(),e.createElementBlock("span",at,e.toDisplayString(p.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(tt,{key:2,ref_key:"refElFileButton",ref:R,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:A.value,isShowUploadResult:n.isShowUploadResult,isShowUploadIng:n.isShowUploadIng,isShowPreview:n.isShowPreview,isShowDownload:n.isShowDownload,onOnChange:F,onOnError:U,onOnRemove:P,onOnPreview:J,onOnSaveFile:W},{label:e.withCtx(()=>[e.renderSlot(r.$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:z,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:A.value,isShowPreview:n.isShowPreview,isShowDownload:n.isShowDownload,onOnChange:F,onOnError:U,onOnRemove:P,onOnPreview:J,onOnSaveFile:W},{label:e.withCtx(()=>[e.renderSlot(r.$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,it))}});exports._sfc_main=st;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("vue"),o=require("@cldemo/ui-kit/common/base"),A=require("@cldemo/ui-kit/common/Element"),W=require("./language-BJ4aVgHI.js"),H=require("./Validate.vue_vue_type_script_setup_true_lang-W46p_d7L.js"),Q=require("./Index.vue_vue_type_script_setup_true_lang-Dbf-3Nik.js");;/* empty css */const X=["id"],Y=["id"],Z=l.defineComponent({name:"ClSelectCascade",__name:"Index",props:{id:String,value:[String,Number],className:{type:String,default:""},disabled:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},placeholder:String,isClear:{type:Boolean,default:!1},isSearch:{type:Boolean,default:!1},parentKey:{type:String,default:"parentId"},topParentValue:{type:String,default:"0"},width:String,isCheckValidate:{type:Boolean,default:!1},validateRules:{type:Array,default:()=>[{r:"required"}]},isShowInMsg:{type:Boolean,default:!0},isPlaintext:{type:Boolean,default:!1},plaintextLevelSeparator:{type:String,default:" > "}},emits:{"update:value":p=>!0,"update:modelValue":p=>!0,onChange:p=>!0},setup(p,{expose:B,emit:L}){const c=p,_=L,{optPageLanguage:D,getPageLanguage:N}=W.useLanguage();N("common");const x=`selectCascade-${o.getRandom(5)}`,C=c.id,u=l.reactive({lastValue:c.value,isFirstDataFinish:!1}),m=l.ref([]),d={dataJson:{},dataGroup:{},parentIdsJson:{}},I=l.ref(0),k=l.computed(()=>D.value.pleaseSelect),F=l.computed(()=>{const{placeholder:e}=c;return o.isNonEmptyString(e)?e.split("|"):[]}),K=l.computed(()=>{const{width:e}=c;return o.isNonEmptyString(e)?e.split("|"):[]}),q=l.computed(()=>{let e={"panel-select-cascade":!0};return e=o.getJsonMerge(e,A.getClassNameJson(c.className)),e}),b=e=>{e!==u.lastValue&&(u.lastValue=e,_("update:value",e),_("update:modelValue",e),_("onChange",e))},J=e=>o.isExistJsonKey(d.dataGroup,e),M=e=>J(e)?d.dataGroup[e]:[],E=e=>o.isExistJsonKey(d.dataJson,e)?d.dataJson[e]:null,S=()=>`top_${c.topParentValue}`,P=e=>{const{parentKey:t,topParentValue:s}=c,a={},n={};o.isEmpty(e)||e.forEach(r=>{const i=o.getJsonClone(r);if(o.isEmpty(i?.id)||o.isEmpty(i?.[t]))return;const h=i.id.toString(),f=i[t].toString();a[h]=i;const g=f===s.toString()?S():f;o.isExistJsonKey(n,g)||(n[g]=[]),n[g].push(i)}),d.dataJson=a,d.dataGroup=n,I.value+=1},y=(e,t)=>{const s={idx:e,pId:t,placeholder:k.value,list:[],sty:{},selected:""};if(!o.isEmpty(t)){const i=M(t);s.list=o.getListClone(i)}const a=F.value,n=a.length;n>0&&(n>e?s.placeholder=o.isEmpty(a[e])?k.value:a[e]:n===1&&(s.placeholder=a[0]));const r=K.value;return r.length>e&&(o.isEmpty(r[e])||(s.sty.width=r[e],s.sty.flex="none")),s},V=(e,t)=>{const{parentKey:s,topParentValue:a}=c;let n=[];if(t&&t.indexOf(e)>-1)return[];const r=t?t.concat([e]):[e];if(o.isExistJsonKey(d.parentIdsJson,e))n=d.parentIdsJson[e];else{const i=E(e);if(i!=null){const h=i[s].toString();if(h!==a.toString()){const f=E(h);if(f!=null){n.push(h);const g=V(h,r);g.length>0&&(n=n.concat(g))}}}d.parentIdsJson[e]=n}return n},v=e=>{let t=o.isUndefined(e)?c.value:e;t!=null&&!o.isEmpty(t)&&!o.isExistJsonKey(d.dataJson,t.toString())&&(t="");const s=[];if(t==null||o.isEmpty(t))s.push(y(0,S())),s.push(y(1,""));else{const a=t.toString(),n=[...V(a)].reverse(),r=n.length;if(r>0){n.forEach((h,f)=>{const g=f===0?S():n[f-1],w=y(f,g);w.selected=h,s.push(w)});const i=y(r,n[r-1]);i.selected=a,s.push(i)}else{const i=y(0,S());i.selected=a,s.push(i)}}m.value=s},G=()=>{P(c.list),v(),u.isFirstDataFinish=!0,u.lastValue=c.value};l.onMounted(()=>{l.nextTick(()=>{G()})}),l.watch(()=>c.value,e=>{e!==u.lastValue&&u.isFirstDataFinish&&(v(),u.lastValue=e)}),l.watch(()=>c.list,e=>{if(!u.isFirstDataFinish){u.isFirstDataFinish=!0;return}d.parentIdsJson={},P(e);const{value:t}=c,s=t!=null&&!o.isEmpty(t)&&o.isExistJsonKey(d.dataJson,t.toString())?t:"";v(s),u.lastValue=s});const O=()=>!0,R=(e,t)=>{let s="";if(o.isEmpty(e)&&t===0)v("");else if(o.isEmpty(e)){if(m.value.splice(t+1),t>0){const a=m.value[t-1];a&&(s=a.selected)}}else{const a=e.toString();J(a)?(m.value.splice(t+1),m.value.push(y(t+1,a))):(s=e,m.value.splice(t+1))}b(s)},j=()=>u.lastValue,T=e=>{const t=V(e),s=t.length>0?t.slice().reverse().concat([e]):[e],a=[];return s.forEach(n=>{const r=d.dataJson[n];r!=null&&!o.isEmpty(r.name)&&a.push(r.name)}),a},$=()=>{const e=u.lastValue;let t="";return e!=null&&!o.isEmpty(e)&&(t=T(e.toString()).join(" → ")),{value:e,show:t||(e!=null?e.toString():"")}},U=e=>{const t=[],s=new Set;let a=e;for(;o.isNonEmptyString(a)&&!s.has(a);){s.add(a);const n=E(a);if(n==null)break;o.isNonEmptyString(n.name)&&t.unshift(n.name);const r=n[c.parentKey],i=r!=null?String(r):"";if(i===""||i===String(c.topParentValue))break;a=i}return t},z=l.computed(()=>{c.list,I.value;const e=u.lastValue;if(e==null||o.isEmpty(e))return"";const t=o.isString(c.plaintextLevelSeparator)?c.plaintextLevelSeparator:" > ",s=U(e.toString());return s.length>0?s.join(t):e.toString()});return B({getValue:j,getValueData:$,setValue:e=>{v(e),u.lastValue=e}}),(e,t)=>p.isPlaintext?(l.openBlock(),l.createElementBlock("div",{key:0,id:l.unref(C),class:"cl-plaintext-value"},l.toDisplayString(z.value),9,X)):(l.openBlock(),l.createElementBlock("div",{key:1,id:l.unref(C),class:l.normalizeClass(q.value)},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value,(s,a)=>(l.openBlock(),l.createElementBlock("div",{key:`${x}-${a}`,class:"selectCascade-item",style:l.normalizeStyle(s.sty)},[l.createVNode(H._sfc_main,{isShowMsg:p.isShowInMsg,isCheck:p.isCheckValidate,checkValue:s.selected,rules:p.validateRules},{default:l.withCtx(()=>[l.createVNode(Q._sfc_main,{isClear:p.isClear,isSearch:p.isSearch,placeholder:s.placeholder,list:s.list,disabled:p.disabled,value:s.selected,"onUpdate:value":n=>s.selected=n,onOpenBefore:O,onOnChange:n=>R(n,a)},null,8,["isClear","isSearch","placeholder","list","disabled","value","onUpdate:value","onOnChange"])]),_:2},1032,["isShowMsg","isCheck","checkValue","rules"])],4))),128))],10,Y))}});exports._sfc_main=Z;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),n=require("@cldemo/ui-kit/common/base"),le=require("@cldemo/ui-kit/common/Element"),ce=require("@cldemo/ui-kit/common/log"),ae=require("./SlideUpDown.vue_vue_type_script_setup_true_lang-Cp45S0a9.js");;/* empty css */const de={class:"tree-ul"},pe=["onClick"],ue=["aria-checked","onClick"],he=["tabindex","aria-disabled","onClick","onDblclick","onKeydown"],fe=["innerHTML"],ge={key:1},Q=170,X=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:D}){const E=k,c=D,v=`tree-${n.getRandom(5)}`;let B=!1;const l=s.inject("$TreeTop",{isCheckChildren:()=>(B||(B=!0,ce.warn("ClTreeUl","未检测到 ClTree 容器提供 $TreeTop,子级判断降级为 false")),!1)}),f={dbClickTimeOut:null},R=s.computed(()=>new Set(E.firstOpenIds)),V=s.computed(()=>new Set(E.selectIds)),A=s.computed(()=>new Set(E.selectUnIds)),L=s.computed(()=>new Set(E.openIds)),_=u=>{n.isUndefined(u)||c("onSelect",u.toString())},O=u=>{n.isUndefined(u)||c("onShrink",u.toString())},C=u=>n.isUndefined(u.id)?"":u.id.toString(),N=u=>{const m=C(u);return V.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(),P=L.value.has(I);m["tree-node-open"]=P,m["tree-node-closed"]=!P}return m},H=u=>{const m=n.isUndefined(u.id)?"":u.id.toString(),I={"tree-node-text":!0};return I["tree-node-select"]=V.value.has(m),I["tree-node-selectUn"]=A.value.has(m),I};s.onBeforeUnmount(()=>{f.dbClickTimeOut&&window.clearTimeout(f.dbClickTimeOut)});const j=u=>{E.disabled||(window.clearTimeout(f.dbClickTimeOut),O(u.id))},F=u=>{E.disabled||(window.clearTimeout(f.dbClickTimeOut),_(u.id))},x=u=>{if(!E.disabled)if(l.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)},Q)):window.clearTimeout(f.dbClickTimeOut)}else window.clearTimeout(f.dbClickTimeOut),f.dbClickTimeOut=window.setTimeout(()=>{E.disabled||_(u.id)},Q)},J=u=>{E.disabled||l.isCheckChildren(u.id)&&(f.dbClickTimeOut&&window.clearTimeout(f.dbClickTimeOut),O(u.id))},M=u=>{_(u)},K=u=>{O(u)};return(u,m)=>(s.openBlock(),s.createElementBlock("ul",de,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(k.list,(I,P)=>(s.openBlock(),s.createElementBlock("li",{key:`${v}-${I.id}-${P}`,class:s.normalizeClass(b(I))},[s.createElementVNode("i",{class:"tree-shrink",onClick:s.withModifiers(T=>j(I),["stop"])},null,8,pe),s.createElementVNode("span",{class:s.normalizeClass(H(I))},[k.multiple?(s.openBlock(),s.createElementBlock("i",{key:0,class:"tree-node-checkbox",role:"checkbox","aria-checked":N(I),onClick:s.withModifiers(T=>F(I),["stop"])},null,8,ue)):(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(T=>x(I),["stop"]),onDblclick:s.withModifiers(T=>J(I),["stop"]),onKeydown:s.withKeys(s.withModifiers(T=>x(I),["prevent"]),["enter"])},[I.showTextLabelHtml?(s.openBlock(),s.createElementBlock("span",{key:0,innerHTML:I.showTextLabel},null,8,fe)):(s.openBlock(),s.createElementBlock("span",ge,s.toDisplayString(I.showTextLabel),1))],40,he)],2),R.value.has(C(I))?(s.openBlock(),s.createBlock(ae._sfc_main,{key:0},{default:s.withCtx(()=>[s.withDirectives(s.createVNode(X,{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:M,onOnShrink:K},null,8,["list","multiple","isSingleSelectParent","disabled","firstOpenIds","openIds","selectIds","selectUnIds"]),[[s.vShow,L.value.has(C(I))]])]),_:2},1024)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[],64))],2))),128))]))}}),Ie=["id"],Se=["id"],me=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},plaintextSeparator:{type:String,default:","},plaintextLevelSeparator:{type:String,default:" > "}},emits:["update:value","update:modelValue","onChange","onInit"],setup(k,{expose:D,emit:E}){const c=k,v=E,B=c.id,l=s.reactive({firstOpenIds:[],openParentIds:[],selectedIds:[],selectedUnIds:[],list:[]}),f={dataJson:{},dataGroup:{},childLastIdsJson:{},prevSearchOpenParentIds:"",prevSearchFoldParentIds:""},R=s.computed(()=>({multiple:c.multiple,disabled:c.disabled,isSingleSelectParent:c.isSingleSelectParent})),V=s.computed(()=>n.getJsonMerge({"panel-tree":!0},le.getClassNameJson(c.className))),A=t=>{v("update:value",t),v("update:modelValue",t)},L=(t,e)=>{A(t),v("onChange",t,e)},_=()=>{s.nextTick(()=>{v("onInit")})},O=t=>{const e=n.isUndefined(t)?"":t.toString();return n.isExistJsonKey(f.dataGroup,e)},C=t=>{const e=n.isUndefined(t)?"":t.toString();return O(e)?f.dataGroup[e]:[]},N=s.ref(0),b=t=>{const e=t.toString();return n.isExistJsonKey(f.dataJson,e)?f.dataJson[e]:null},H=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[c.parentKey],a=d!=null?String(d):"";if(a===""||a===String(c.topParentValue))break;i=a}return e},j=s.computed(()=>{if(c.list,N.value,n.isEmpty(l.selectedIds))return"";const t=n.isString(c.plaintextLevelSeparator)?c.plaintextLevelSeparator:" > ",e=n.isString(c.plaintextSeparator)?c.plaintextSeparator:",";return U(l.selectedIds,c.isOutMerge).map(i=>{const p=H(i);return n.removeHTMLTags(p.length>0?p.join(t):i)}).join(e)}),F=(t,e,r)=>{const i=[],p=e+1;return r===void 0&&(r=new Set),r.has(t)||(r.add(t),C(t).forEach(d=>{const a={...d},o=a.id.toString(),h=O(o);a.isEnd=!h,a.level=p,h&&(a.list=F(o,p,r)),i.push(a)})),i},x=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),J=t=>{const e=c.searchKeyword,r=c.highlightMode;if(!n.isNonEmptyString(t)||n.isEmpty(e))return x(String(t));const i=n.isNonEmptyString(c.highlightColor)?c.highlightColor:"#ffe58f",p=S=>`<mark style="background:${i}">${x(S)}</mark>`;if(r==="full")return t.includes(e)?p(t):x(t);const d=t.indexOf(e);if(d===-1)return x(t);const a=x(t.slice(0,d)),o=p(t.slice(d,d+e.length)),h=x(t.slice(d+e.length));return`${a}${o}${h}`},M=t=>{const{parentKey:e,topParentValue:r}=c,i=n.isNonEmptyString(r)?r:"0",p={},d={};n.isEmpty(t)||t.forEach(a=>{const o=n.getJsonClone(a),h=!n.isEmpty(c.searchKeyword)&&!n.isEmpty(c.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 w=o.id.toString(),y=o[e].toString();p[w]=o,n.isExistJsonKey(d,y)||(d[y]=[]),d[y].push(o)}),f.dataJson=p,f.dataGroup=d,f.childLastIdsJson={},l.list=F(i,0),N.value+=1},K=(t,e)=>{let r=[];const{parentKey:i,topParentValue:p}=c,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=K(o,e);r=r.concat(h)}}return r},u=t=>{const e=K(t);return e.splice(0,1),e.reverse(),e},m=(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),O(i)&&C(i).forEach(p=>{const d=p.id.toString(),a=m(d,e);r=r.concat(a)})),r},I=t=>{const e=m(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(l.selectedIds):e,o=n.isUndefined(r)?n.getArrClone(l.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=u(t);return S.reverse(),S.length>0&&S.forEach(g=>{let w=0,y=0;f.dataGroup[g].forEach(ie=>{const Y=ie.id.toString();n.isExistValue(a,Y)&&(w+=1),n.isExistValue(o,Y)&&(y+=1)});const q=f.dataGroup[g].length;w===0&&y===0?(p.del.push(g),a=n.getArrRemoveById(a,g),d.del.push(g),o=n.getArrRemoveById(o,g)):w===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}},T=(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;O(t)?(e.add(t),C(t).forEach(i=>{const p=T(i.id.toString(),e);p.length>0&&(r=r.concat(p))})):r.push(t),f.childLastIdsJson[t]=r}return r},G=(t,e)=>{const{parentKey:r,topParentValue:i}=c,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===C(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?G(h,e):o}else return o},Z=t=>{const e=[],r=n.getArrConvertJson(t);return t.forEach(p=>{const d=C(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)}}),G(e)},ee=t=>{let e=[];return t.forEach(r=>{const i=T(r);e.push(...i)}),e=n.getArrUnique(e),e},U=(t,e)=>c.multiple?(n.isBoolean(e)?e:c.isOutMerge)?Z(t):ee(t):t,z=t=>{const e=[];return t.forEach(r=>{const i=b(r);n.isUndefined(i)||e.push(i)}),e},$=t=>{const e=c.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=I(d);r.push(...h),r.push(d),r=n.getArrUnique(r),i=n.getArrUnique(i)}}),l.selectedIds=r;const p=n.getArrRemoveById(i,r);l.selectedUnIds=n.getArrClone(p),l.firstOpenIds=n.getArrUnique(l.firstOpenIds.concat(p)),l.openParentIds=n.getArrUnique(l.openParentIds.concat(p))},te=()=>{if(M(c.list),n.isNonEmptyString(c.value)){const t=c.value.split(",");$(t)}_()};s.onMounted(()=>{s.nextTick(()=>{te()})}),s.watch(()=>c.list,t=>{M(t);const e=l.selectedIds,r=n.isNonEmptyString(c.value)?c.value.split(","):[];l.selectedIds=[],$(n.getArrUnique(e.concat(r)));const i=U(l.selectedIds);i.join(",")!==c.value&&A(i.join(","))}),s.watch(()=>c.value,t=>{if(t!==void 0){const e=l.selectedIds,r=n.isNonEmptyString(t)?t.split(","):[],i=U(r),p=U(e);n.isEqualArr(i,p)||(l.selectedIds=[],$(r))}});const ne=()=>{const t=n.isNonEmptyString(f.prevSearchFoldParentIds)?f.prevSearchFoldParentIds.split(","):[];l.firstOpenIds=n.getArrRemoveById(l.firstOpenIds,t),(n.isNonEmptyString(c.searchFoldParentIds)?c.searchFoldParentIds.split(","):[]).forEach(r=>{const i=r.toString();l.firstOpenIds.indexOf(i)===-1&&l.firstOpenIds.push(i)}),f.prevSearchFoldParentIds=n.isNonEmptyString(c.searchFoldParentIds)?c.searchFoldParentIds:""},se=()=>{const t=n.isNonEmptyString(f.prevSearchOpenParentIds)?f.prevSearchOpenParentIds.split(","):[];l.firstOpenIds=n.getArrRemoveById(l.firstOpenIds,t),l.openParentIds=n.getArrRemoveById(l.openParentIds,t),(n.isNonEmptyString(c.searchOpenParentIds)?c.searchOpenParentIds.split(","):[]).forEach(r=>{const i=r.toString();l.firstOpenIds.indexOf(i)===-1&&l.firstOpenIds.push(i),l.openParentIds.indexOf(i)===-1&&l.openParentIds.push(i)}),f.prevSearchOpenParentIds=n.isNonEmptyString(c.searchOpenParentIds)?c.searchOpenParentIds:""};s.watch(()=>c.searchOpenParentIds,()=>se()),s.watch(()=>c.searchFoldParentIds,()=>ne());const W=t=>{Array.isArray(t)&&t.forEach(e=>{if(!e)return;const r=!n.isEmpty(c.searchKeyword)&&!n.isEmpty(c.highlightMode);e.showTextLabelHtml=r,e.showTextLabel=r?J(n.isString(e.name)?e.name:""):n.isString(e.name)?e.name:"",Array.isArray(e.list)&&W(e.list)})};s.watch(()=>[c.searchKeyword,c.highlightMode,c.highlightColor],()=>W(l.list));const re=t=>{const e=t.toString();n.isExistValue(l.firstOpenIds,e)||l.firstOpenIds.push(e),s.nextTick(()=>{const r=l.openParentIds.indexOf(e);r===-1?l.openParentIds.push(e):l.openParentIds.splice(r,1)})},oe=t=>{const e=t.toString();if(c.multiple){const p=l.selectedIds.indexOf(e)===-1,d=I(e),a=P(e);let o=n.getArrClone(l.selectedIds),h=n.getArrClone(l.selectedUnIds);a.select.del.forEach(w=>{const y=o.indexOf(w);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(w=>{const y=h.indexOf(w);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(w=>{const y=o.indexOf(w),q=h.indexOf(w);p?y===-1&&o.push(w):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),l.selectedIds=o,l.selectedUnIds=h}else l.selectedIds=[e],l.selectedUnIds=[];const r=U(l.selectedIds);L(r.join(","),z(r))};return s.provide("$TreeTop",{isCheckChildren:O}),D({getValue:()=>U(l.selectedIds).join(","),getValueData:()=>{const t=U(l.selectedIds);return z(t)},setValue:t=>{const e=n.isNonEmptyString(t)?t.split(","):[];l.selectedIds=[],$(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,Ie)):(s.openBlock(),s.createElementBlock("div",{key:1,class:s.normalizeClass(V.value),id:s.unref(B)},[l.list.length>0?(s.openBlock(),s.createBlock(X,s.mergeProps({key:0,list:l.list,firstOpenIds:l.firstOpenIds,openIds:l.openParentIds,selectIds:l.selectedIds,selectUnIds:l.selectedUnIds},R.value,{onOnSelect:oe,onOnShrink:re}),null,16,["list","firstOpenIds","openIds","selectIds","selectUnIds"])):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[],64))],10,Se))}});exports._sfc_main=me;
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Z, reactive as ee, ref as N, computed as v, onMounted as te, nextTick as se, watch as x, openBlock as V, createElementBlock as E, unref as B, toDisplayString as ne, normalizeClass as ae, Fragment as oe, renderList as le, normalizeStyle as ie, createVNode as F, withCtx as re } from "vue";
|
|
2
|
-
import o from "@cldemo/ui-kit/common/base";
|
|
3
|
-
import ce from "@cldemo/ui-kit/common/Element";
|
|
4
|
-
import { a as ue } from "./language-CZZEj4e3.js";
|
|
5
|
-
import { _ as de } from "./Validate.vue_vue_type_script_setup_true_lang-Jyse_5LL.js";
|
|
6
|
-
import { _ as pe } from "./Index.vue_vue_type_script_setup_true_lang-BO4cal3i.js";
|
|
7
|
-
/* empty css */
|
|
8
|
-
const fe = ["id"], he = ["id"], Ie = /* @__PURE__ */ Z({
|
|
9
|
-
name: "ClSelectCascade",
|
|
10
|
-
__name: "Index",
|
|
11
|
-
props: {
|
|
12
|
-
id: String,
|
|
13
|
-
// desc: 自定义元素ID
|
|
14
|
-
value: [String, Number],
|
|
15
|
-
// desc: 选中的值
|
|
16
|
-
className: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: ""
|
|
19
|
-
// desc: 自定义CSS类名
|
|
20
|
-
},
|
|
21
|
-
disabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: !1
|
|
24
|
-
// desc: 是否禁用
|
|
25
|
-
},
|
|
26
|
-
list: {
|
|
27
|
-
type: Array,
|
|
28
|
-
default: () => []
|
|
29
|
-
// desc: 级联数据列表
|
|
30
|
-
},
|
|
31
|
-
placeholder: String,
|
|
32
|
-
// desc: 各层级占位符,多个用 | 分隔
|
|
33
|
-
isClear: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: !1
|
|
36
|
-
// desc: 是否可清空
|
|
37
|
-
},
|
|
38
|
-
isSearch: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: !1
|
|
41
|
-
// desc: 是否可搜索
|
|
42
|
-
},
|
|
43
|
-
parentKey: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: "parentId"
|
|
46
|
-
// desc: 父级键名字段
|
|
47
|
-
},
|
|
48
|
-
topParentValue: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: "0"
|
|
51
|
-
// desc: 顶级父值
|
|
52
|
-
},
|
|
53
|
-
width: String,
|
|
54
|
-
// desc: 各层级下拉宽度,多个用 | 分隔,需带单位(px/%)
|
|
55
|
-
isCheckValidate: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: !1
|
|
58
|
-
// desc: 是否启用校验
|
|
59
|
-
},
|
|
60
|
-
validateRules: {
|
|
61
|
-
type: Array,
|
|
62
|
-
default: () => [{ r: "required" }]
|
|
63
|
-
// desc: 校验规则
|
|
64
|
-
},
|
|
65
|
-
isShowInMsg: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: !0
|
|
68
|
-
// desc: 校验信息是否在消息中显示
|
|
69
|
-
},
|
|
70
|
-
isPlaintext: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: !1
|
|
73
|
-
// desc: 是否纯文本只读模式,只渲染选中项层级文本不挂载各级下拉
|
|
74
|
-
},
|
|
75
|
-
plaintextLevelSeparator: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: " > "
|
|
78
|
-
// desc: 纯文本模式下级联层级之间的分隔符
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
emits: {
|
|
82
|
-
"update:value": (d) => !0,
|
|
83
|
-
// desc: 值变化时触发
|
|
84
|
-
"update:modelValue": (d) => !0,
|
|
85
|
-
// desc: 标准 v-model 支持(等价 update:value)
|
|
86
|
-
onChange: (d) => !0
|
|
87
|
-
// desc: 选中变化时触发
|
|
88
|
-
},
|
|
89
|
-
setup(d, { expose: K, emit: b }) {
|
|
90
|
-
const r = d, C = b, { optPageLanguage: M, getPageLanguage: $ } = ue();
|
|
91
|
-
$("common");
|
|
92
|
-
const G = `selectCascade-${o.getRandom(5)}`, J = r.id, c = ee({
|
|
93
|
-
lastValue: r.value,
|
|
94
|
-
isFirstDataFinish: !1
|
|
95
|
-
}), g = N([]), u = {
|
|
96
|
-
dataJson: {},
|
|
97
|
-
dataGroup: {},
|
|
98
|
-
parentIdsJson: {}
|
|
99
|
-
}, P = N(0), k = v(() => M.value.pleaseSelect), O = v(() => {
|
|
100
|
-
const { placeholder: e } = r;
|
|
101
|
-
return o.isNonEmptyString(e) ? e.split("|") : [];
|
|
102
|
-
}), R = v(() => {
|
|
103
|
-
const { width: e } = r;
|
|
104
|
-
return o.isNonEmptyString(e) ? e.split("|") : [];
|
|
105
|
-
}), j = v(() => {
|
|
106
|
-
let e = { "panel-select-cascade": !0 };
|
|
107
|
-
return e = o.getJsonMerge(e, ce.getClassNameJson(r.className)), e;
|
|
108
|
-
}), T = (e) => {
|
|
109
|
-
e !== c.lastValue && (c.lastValue = e, C("update:value", e), C("update:modelValue", e), C("onChange", e));
|
|
110
|
-
}, w = (e) => o.isExistJsonKey(u.dataGroup, e), U = (e) => w(e) ? u.dataGroup[e] : [], I = (e) => o.isExistJsonKey(u.dataJson, e) ? u.dataJson[e] : null, S = () => `top_${r.topParentValue}`, L = (e) => {
|
|
111
|
-
const { parentKey: t, topParentValue: s } = r, a = {}, n = {};
|
|
112
|
-
o.isEmpty(e) || e.forEach((i) => {
|
|
113
|
-
const l = o.getJsonClone(i);
|
|
114
|
-
if (o.isEmpty(l?.id) || o.isEmpty(l?.[t]))
|
|
115
|
-
return;
|
|
116
|
-
const f = l.id.toString(), p = l[t].toString();
|
|
117
|
-
a[f] = l;
|
|
118
|
-
const h = p === s.toString() ? S() : p;
|
|
119
|
-
o.isExistJsonKey(n, h) || (n[h] = []), n[h].push(l);
|
|
120
|
-
}), u.dataJson = a, u.dataGroup = n, P.value += 1;
|
|
121
|
-
}, m = (e, t) => {
|
|
122
|
-
const s = {
|
|
123
|
-
idx: e,
|
|
124
|
-
pId: t,
|
|
125
|
-
placeholder: k.value,
|
|
126
|
-
list: [],
|
|
127
|
-
sty: {},
|
|
128
|
-
selected: ""
|
|
129
|
-
};
|
|
130
|
-
if (!o.isEmpty(t)) {
|
|
131
|
-
const l = U(t);
|
|
132
|
-
s.list = o.getListClone(l);
|
|
133
|
-
}
|
|
134
|
-
const a = O.value, n = a.length;
|
|
135
|
-
n > 0 && (n > e ? s.placeholder = o.isEmpty(a[e]) ? k.value : a[e] : n === 1 && (s.placeholder = a[0]));
|
|
136
|
-
const i = R.value;
|
|
137
|
-
return i.length > e && (o.isEmpty(i[e]) || (s.sty.width = i[e], s.sty.flex = "none")), s;
|
|
138
|
-
}, _ = (e, t) => {
|
|
139
|
-
const { parentKey: s, topParentValue: a } = r;
|
|
140
|
-
let n = [];
|
|
141
|
-
if (t && t.indexOf(e) > -1)
|
|
142
|
-
return [];
|
|
143
|
-
const i = t ? t.concat([e]) : [e];
|
|
144
|
-
if (o.isExistJsonKey(u.parentIdsJson, e))
|
|
145
|
-
n = u.parentIdsJson[e];
|
|
146
|
-
else {
|
|
147
|
-
const l = I(e);
|
|
148
|
-
if (l != null) {
|
|
149
|
-
const f = l[s].toString();
|
|
150
|
-
if (f !== a.toString()) {
|
|
151
|
-
const p = I(f);
|
|
152
|
-
if (p != null) {
|
|
153
|
-
n.push(f);
|
|
154
|
-
const h = _(f, i);
|
|
155
|
-
h.length > 0 && (n = n.concat(h));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
u.parentIdsJson[e] = n;
|
|
160
|
-
}
|
|
161
|
-
return n;
|
|
162
|
-
}, y = (e) => {
|
|
163
|
-
let t = o.isUndefined(e) ? r.value : e;
|
|
164
|
-
t != null && !o.isEmpty(t) && !o.isExistJsonKey(u.dataJson, t.toString()) && (t = "");
|
|
165
|
-
const s = [];
|
|
166
|
-
if (t == null || o.isEmpty(t))
|
|
167
|
-
s.push(m(0, S())), s.push(m(1, ""));
|
|
168
|
-
else {
|
|
169
|
-
const a = t.toString(), n = [..._(a)].reverse(), i = n.length;
|
|
170
|
-
if (i > 0) {
|
|
171
|
-
n.forEach((f, p) => {
|
|
172
|
-
const h = p === 0 ? S() : n[p - 1], D = m(p, h);
|
|
173
|
-
D.selected = f, s.push(D);
|
|
174
|
-
});
|
|
175
|
-
const l = m(i, n[i - 1]);
|
|
176
|
-
l.selected = a, s.push(l);
|
|
177
|
-
} else {
|
|
178
|
-
const l = m(0, S());
|
|
179
|
-
l.selected = a, s.push(l);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
g.value = s;
|
|
183
|
-
}, q = () => {
|
|
184
|
-
L(r.list), y(), c.isFirstDataFinish = !0, c.lastValue = r.value;
|
|
185
|
-
};
|
|
186
|
-
te(() => {
|
|
187
|
-
se(() => {
|
|
188
|
-
q();
|
|
189
|
-
});
|
|
190
|
-
}), x(
|
|
191
|
-
() => r.value,
|
|
192
|
-
(e) => {
|
|
193
|
-
e !== c.lastValue && c.isFirstDataFinish && (y(), c.lastValue = e);
|
|
194
|
-
}
|
|
195
|
-
), x(
|
|
196
|
-
() => r.list,
|
|
197
|
-
(e) => {
|
|
198
|
-
if (!c.isFirstDataFinish) {
|
|
199
|
-
c.isFirstDataFinish = !0;
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
u.parentIdsJson = {}, L(e);
|
|
203
|
-
const { value: t } = r, s = t != null && !o.isEmpty(t) && o.isExistJsonKey(u.dataJson, t.toString()) ? t : "";
|
|
204
|
-
y(s), c.lastValue = s;
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
const z = () => !0, A = (e, t) => {
|
|
208
|
-
let s = "";
|
|
209
|
-
if (o.isEmpty(e) && t === 0)
|
|
210
|
-
y("");
|
|
211
|
-
else if (o.isEmpty(e)) {
|
|
212
|
-
if (g.value.splice(t + 1), t > 0) {
|
|
213
|
-
const a = g.value[t - 1];
|
|
214
|
-
a && (s = a.selected);
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
const a = e.toString();
|
|
218
|
-
w(a) ? (g.value.splice(t + 1), g.value.push(m(t + 1, a))) : (s = e, g.value.splice(t + 1));
|
|
219
|
-
}
|
|
220
|
-
T(s);
|
|
221
|
-
}, W = () => c.lastValue, H = (e) => {
|
|
222
|
-
const t = _(e), s = t.length > 0 ? t.slice().reverse().concat([e]) : [e], a = [];
|
|
223
|
-
return s.forEach((n) => {
|
|
224
|
-
const i = u.dataJson[n];
|
|
225
|
-
i != null && !o.isEmpty(i.name) && a.push(i.name);
|
|
226
|
-
}), a;
|
|
227
|
-
}, Q = () => {
|
|
228
|
-
const e = c.lastValue;
|
|
229
|
-
let t = "";
|
|
230
|
-
return e != null && !o.isEmpty(e) && (t = H(e.toString()).join(" → ")), {
|
|
231
|
-
value: e,
|
|
232
|
-
show: t || (e != null ? e.toString() : "")
|
|
233
|
-
};
|
|
234
|
-
}, X = (e) => {
|
|
235
|
-
const t = [], s = /* @__PURE__ */ new Set();
|
|
236
|
-
let a = e;
|
|
237
|
-
for (; o.isNonEmptyString(a) && !s.has(a); ) {
|
|
238
|
-
s.add(a);
|
|
239
|
-
const n = I(a);
|
|
240
|
-
if (n == null) break;
|
|
241
|
-
o.isNonEmptyString(n.name) && t.unshift(n.name);
|
|
242
|
-
const i = n[r.parentKey], l = i != null ? String(i) : "";
|
|
243
|
-
if (l === "" || l === String(r.topParentValue)) break;
|
|
244
|
-
a = l;
|
|
245
|
-
}
|
|
246
|
-
return t;
|
|
247
|
-
}, Y = v(() => {
|
|
248
|
-
r.list, P.value;
|
|
249
|
-
const e = c.lastValue;
|
|
250
|
-
if (e == null || o.isEmpty(e))
|
|
251
|
-
return "";
|
|
252
|
-
const t = o.isString(r.plaintextLevelSeparator) ? r.plaintextLevelSeparator : " > ", s = X(e.toString());
|
|
253
|
-
return s.length > 0 ? s.join(t) : e.toString();
|
|
254
|
-
});
|
|
255
|
-
return K({
|
|
256
|
-
getValue: W,
|
|
257
|
-
getValueData: Q,
|
|
258
|
-
setValue: (e) => {
|
|
259
|
-
y(e), c.lastValue = e;
|
|
260
|
-
}
|
|
261
|
-
}), (e, t) => d.isPlaintext ? (V(), E("div", {
|
|
262
|
-
key: 0,
|
|
263
|
-
id: B(J),
|
|
264
|
-
class: "cl-plaintext-value"
|
|
265
|
-
}, ne(Y.value), 9, fe)) : (V(), E("div", {
|
|
266
|
-
key: 1,
|
|
267
|
-
id: B(J),
|
|
268
|
-
class: ae(j.value)
|
|
269
|
-
}, [
|
|
270
|
-
(V(!0), E(oe, null, le(g.value, (s, a) => (V(), E("div", {
|
|
271
|
-
key: `${G}-${a}`,
|
|
272
|
-
class: "selectCascade-item",
|
|
273
|
-
style: ie(s.sty)
|
|
274
|
-
}, [
|
|
275
|
-
F(de, {
|
|
276
|
-
isShowMsg: d.isShowInMsg,
|
|
277
|
-
isCheck: d.isCheckValidate,
|
|
278
|
-
checkValue: s.selected,
|
|
279
|
-
rules: d.validateRules
|
|
280
|
-
}, {
|
|
281
|
-
default: re(() => [
|
|
282
|
-
F(pe, {
|
|
283
|
-
isClear: d.isClear,
|
|
284
|
-
isSearch: d.isSearch,
|
|
285
|
-
placeholder: s.placeholder,
|
|
286
|
-
list: s.list,
|
|
287
|
-
disabled: d.disabled,
|
|
288
|
-
value: s.selected,
|
|
289
|
-
"onUpdate:value": (n) => s.selected = n,
|
|
290
|
-
onOpenBefore: z,
|
|
291
|
-
onOnChange: (n) => A(n, a)
|
|
292
|
-
}, null, 8, ["isClear", "isSearch", "placeholder", "list", "disabled", "value", "onUpdate:value", "onOnChange"])
|
|
293
|
-
]),
|
|
294
|
-
_: 2
|
|
295
|
-
}, 1032, ["isShowMsg", "isCheck", "checkValue", "rules"])
|
|
296
|
-
], 4))), 128))
|
|
297
|
-
], 10, he));
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
export {
|
|
301
|
-
Ie as _
|
|
302
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue");;/* empty css */;/* empty css */const s=require("@cldemo/ui-kit/common/base"),G=require("@cldemo/ui-kit/common/Element"),P=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js"),H=["id"],Q=["type","inputmode","name","value","placeholder","disabled","readonly"],W={key:0,class:"input-floating-label"},X={key:3,class:"input-suffix"},F=e.defineComponent({name:"ClInputContainer",components:{ClIconFont:P._sfc_main},__name:"Container",props:{id:String,name:String,value:[String,Number],inputType:{type:String,default:"text"},inputmode:{type:String,default:""},autocomplete:{type:String,default:"off"},placeholder:String,label:String,isFloating:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},isReadonly:{type:Boolean,default:!1},isClean:{type:Boolean,default:!0},isShowSuffix:{type:Boolean,default:!1}},emits:["onInputText","onKeydown","onKeyup","onFocus","onBlur","onClear"],setup(o,{expose:S,emit:E}){const n=o,l=E,w=n.id,r=e.useTemplateRef("refElInput"),v=e.computed(()=>{let a=n.name;return s.isEmpty(a)&&(a=`input_${s.getRandom(8)}`),a}),y=e.computed(()=>s.isEmpty(n.inputmode)?void 0:n.inputmode),u=e.computed(()=>{const a={};return s.isNonEmptyString(n.autocomplete)&&(a.autocomplete=n.autocomplete),a}),p=e.computed(()=>n.isClean&&!n.disabled&&!n.isReadonly),h=e.computed(()=>p.value&&!s.isEmpty(n.value)),c=e.computed(()=>n.isFloating?n.label||n.placeholder:""),m=e.computed(()=>({"input-container":!0,"input-clean":n.isClean,"input-suffix":n.isShowSuffix,"input-floating":n.isFloating})),x=a=>{const k=a.target;k&&l("onInputText",k.value)},b=a=>{l("onKeydown",a)},I=a=>{l("onKeyup",a)},g=()=>{l("onFocus")},B=()=>{l("onBlur")},C=()=>{l("onClear")};return S({getInputElement:()=>r.value,focus:()=>{r.value?.focus()}}),(a,k)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(w),class:e.normalizeClass(m.value)},[e.createElementVNode("input",e.mergeProps({ref_key:"refElInput",ref:r,type:o.inputType,inputmode:y.value,name:v.value},u.value,{class:"form-control",value:o.value,placeholder:o.placeholder,disabled:o.disabled,readonly:o.isReadonly,onInput:x,onKeydown:b,onKeyup:I,onFocus:g,onBlur:B}),null,16,Q),c.value?(e.openBlock(),e.createElementBlock("label",W,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createBlock(P._sfc_main,{key:1,name:"close-circle-fill",class:"input-clear-icon","aria-label":"清除输入内容",role:"button",tabindex:"-1",onClick:e.withModifiers(C,["stop"]),onKeydown:[e.withKeys(e.withModifiers(C,["stop"]),["enter"]),e.withKeys(e.withModifiers(C,["stop","prevent"]),["space"])]},null,8,["onKeydown"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[],64)),o.isShowSuffix?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(a.$slots,"suffix")])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[],64))],10,H))}}),Y=["id"],Z={key:0,class:"cl-plaintext-value"},_={key:0,class:"input-group-prepend"},ee={class:"input-group-text"},te={key:2,class:"input-group-append"},ne={class:"input-group-text"},oe=e.defineComponent({name:"ClInput",components:{ClInputContainer:F},__name:"Index",props:{id:String,name:String,value:[String,Number],className:String,disabled:{type:Boolean,default:!1},theme:{type:String,default:"default"},inputType:String,inputmode:{type:String,default:""},autocomplete:{type:String,default:"off"},width:String,placeholder:String,label:String,isFloating:{type:Boolean,default:!1},isReadonly:{type:Boolean,default:!1},isClean:{type:Boolean,default:!0},isPlaintext:{type:Boolean,default:!1},changeDelayTime:{type:Number,default:200}},emits:["update:value","update:modelValue","onChange","onFocus","onBlur","onChangeBlur","onKeyupEnter","onClear","onInit","onKeydown","onKeyup","onChangeDelay"],setup(o,{expose:S,emit:E}){const n=o,l=E,w=n.id,r=e.useTemplateRef("refElContainer"),v=e.ref(!1),y=s.isString(n.value)?n.value:n.value!==void 0&&s.isNumber(n.value)&&s.isFinite(n.value)?n.value.toString():"",u=e.ref(y),p=e.ref(y),h=e.ref(y),c={prevDelayValue:y,valueDelayRun:!1};let m=null;const x=e.computed(()=>{let t={"panel-input":!0,"input-disabled":n.disabled,"input-readonly":n.isReadonly};return t=s.getJsonMerge(t,G.getClassNameJson(n.className)),s.isEmpty(n.theme,"default")||(t[`input-${n.theme}`]=!0),t}),b=e.computed(()=>{const t={};return s.isNonEmptyString(n.width)&&(t.width=n.width),t}),I=t=>{g(),c.valueDelayRun=!0,m=setTimeout(()=>{m=null,p.value===t&&(c.valueDelayRun=!1,c.prevDelayValue!==t&&(c.prevDelayValue=t,l("onChangeDelay",t)))},n.changeDelayTime)},g=()=>{m&&(clearTimeout(m),m=null),c.valueDelayRun=!1},B=t=>{if(t!==p.value){p.value=t;const i=d(t);l("update:value",i),l("update:modelValue",i),l("onChange",i),I(i)}},C=t=>{v.value=!0,h.value=t,l("onFocus",t)},V=t=>{v.value=!1,l("onBlur",t),t!==h.value&&(h.value=t,l("onChangeBlur",t))},T=t=>{l("onKeyupEnter",t)},a=t=>{l("onKeydown",t)},k=t=>{l("onKeyup",t)},z=()=>{l("onClear")},J=()=>{e.nextTick(()=>{l("onInit")})},d=t=>s.isString(t)||s.isNumber(t)&&s.isFinite(t)?t.toString():"",K=()=>{r.value?.focus()},L=()=>{const t=d(n.value);s.isEmpty(t)||(u.value=t,p.value=t),J()};e.onMounted(()=>{L()}),e.onBeforeUnmount(()=>{g()}),e.watch(()=>n.value,t=>{const i=d(t);i!==u.value&&(u.value=i,p.value=i,c.prevDelayValue=i,c.valueDelayRun&&g())});const D=t=>{u.value=t,B(t)},R=t=>{a(t)},$=t=>{const i=t.key,f=t.keyCode;if(i==="Enter"||f===13){const A=t.target,j=d(A.value);T(j)}else k(t)},N=()=>{const t=d(u.value);C(t)},O=()=>{const t=d(u.value);V(t)},q=()=>{u.value="",B(""),z(),K()},U=()=>{const t=r.value;return t?t.getInputElement():null},M=()=>d(u.value);return S({getValue:M,getValueData:()=>({value:M(),show:u.value}),setValue:(t,i)=>{const f=d(t);u.value=f,p.value=f,c.prevDelayValue=f,c.valueDelayRun&&g(),i&&(l("update:value",f),l("update:modelValue",f))},focus:()=>{K()},getInputElement:U}),(t,i)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(w),class:e.normalizeClass(x.value),style:e.normalizeStyle(b.value)},[o.isPlaintext?(e.openBlock(),e.createElementBlock("div",Z,e.toDisplayString(u.value),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.$slots.prepend||t.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass({"input-group":!0,"input-group-focus":v.value})},[t.$slots.prepend?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("span",ee,[e.renderSlot(t.$slots,"prepend")])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),e.createVNode(F,{ref_key:"refElContainer",ref:r,value:u.value,inputType:o.inputType,inputmode:o.inputmode,autocomplete:o.autocomplete,name:o.name,placeholder:o.placeholder,disabled:o.disabled,isReadonly:o.isReadonly,isClean:o.isClean,isShowSuffix:!!t.$slots.suffix,label:o.label,isFloating:o.isFloating,onOnInputText:D,onOnKeydown:R,onOnKeyup:$,onOnFocus:N,onOnBlur:O,onOnClear:q},e.createSlots({_:2},[t.$slots.suffix?{name:"suffix",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"suffix")]),key:"0"}:{name:"suffix",fn:e.withCtx(()=>[]),key:"1"}]),1032,["value","inputType","inputmode","autocomplete","name","placeholder","disabled","isReadonly","isClean","isShowSuffix","label","isFloating"]),t.$slots.append?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("span",ne,[e.renderSlot(t.$slots,"append")])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[],64))],2)):(e.openBlock(),e.createBlock(F,{key:1,ref_key:"refElContainer",ref:r,value:u.value,inputType:o.inputType,inputmode:o.inputmode,autocomplete:o.autocomplete,name:o.name,placeholder:o.placeholder,disabled:o.disabled,isReadonly:o.isReadonly,isClean:o.isClean,isShowSuffix:!!t.$slots.suffix,label:o.label,isFloating:o.isFloating,onOnInputText:D,onOnKeydown:R,onOnKeyup:$,onOnFocus:N,onOnBlur:O,onOnClear:q},e.createSlots({_:2},[t.$slots.suffix?{name:"suffix",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"suffix")]),key:"0"}:{name:"suffix",fn:e.withCtx(()=>[]),key:"1"}]),1032,["value","inputType","inputmode","autocomplete","name","placeholder","disabled","isReadonly","isClean","isShowSuffix","label","isFloating"]))],64))],14,Y))}});exports._sfc_main=oe;
|
|
@@ -1 +0,0 @@
|
|
|
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/Element"),_=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js"),P=require("./index-q2CbfC2a.js"),A=["id"],L={key:0,class:"cl-plaintext-value"},j=["id","name","value","disabled","checked","onClick"],K=["for"],R={key:0},z=e.defineComponent({name:"ClCheckbox",directives:{cltooltip:P.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:d=>["tooltip","clickCallback"].includes(d)},checkChangeBefore:{type:Function,default:void 0},isPlaintext:{type:Boolean,default:!1},plaintextSeparator:{type:String,default:","}},emits:["update:value","update:modelValue","onChange","onInit","onError","onTipClick"],setup(d,{expose:C,emit:S}){const s=d,p=S,k=`checkbox-${i.getRandom(5)}`,v=i.isEmpty(s.name)?k+"_name":s.name,V=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},b=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;n&&i.isNonEmptyString(n.name)&&l.push(n.name)}),l.join(t)}),I=e.computed(()=>i.getJsonMerge({"panel-checkbox":!0},M.getClassNameJson(s.className))),w=e.computed(()=>{const t={checkbox:!0,"checkbox-default":!0};return t["checkbox-inline"]=s.isInline,t["checkbox-circle"]=s.circle,t}),q=t=>{const l={},{width:o}=s;return t&&!i.isEmpty(t.width)?l.width=t.width:i.isEmpty(o)||(l.width=s.width),l},B=t=>{p("update:value",t),p("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);B(t),p("onChange",t,l,o)},g=()=>{m._initEmitted||(m._initEmitted=!0,e.nextTick(()=>{p("onInit")}))},x=()=>{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},h=()=>{if(c.value&&!i.isEmpty(a.value)){const t=x();i.isEqualArr(a.value,t)||(a.value=t,B(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),h()};e.onMounted(()=>{e.nextTick(()=>{$()})}),e.watch(c,t=>{t&&g()}),e.watch(()=>s.list,t=>{c.value||(c.value=!0,t.length===0&&h(),g())}),e.watch([()=>s.value,()=>s.list],([t,l])=>{const o=l;!c.value&&o.length>0&&(c.value=!0,g()),f(o),y(t),h()});const J=t=>{p("onTipClick",t)},T=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){p("onError",l)}finally{m.isProcessing=!1}}};return C({getValue:()=>x().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),h())},runInitComplete:()=>{c.value||(c.value=!0,f(s.list),y(s.value),h(),g())}}),(t,l)=>{const o=e.resolveDirective("cltooltip");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(I.value),id:e.unref(V)},[d.isPlaintext?(e.openBlock(),e.createElementBlock("div",L,e.toDisplayString(N.value),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[],64)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`${k}-${n.id??""}-${u}`},[n.isShow||n.isShow===void 0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(w.value),style:e.normalizeStyle(q(n))},[e.createElementVNode("span",null,[e.createElementVNode("span",null,[e.createElementVNode("input",{type:"checkbox",id:`${k}_${e.unref(v)}_${n.id??""}`,name:e.unref(v),value:n.id??"",disabled:n.isDisabled||d.disabled,checked:a.value.includes(String(n.id??"")),onClick:F=>T(n)},null,8,j),e.createElementVNode("label",{for:`${k}_${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",R,[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,K)]),n.tipMsg&&n.tipMsg.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.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=>J(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,A)}}});exports._sfc_main=z;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),s=require("@cldemo/ui-kit/common/base"),W=require("@cldemo/ui-kit/common/Element"),X=require("@cldemo/ui-kit/common/globalConfig"),Y=require("./language-BJ4aVgHI.js");;/* empty css */const Z=["id"],ee={key:0,class:"cl-plaintext-value"},te={key:2,class:"selectTag-container"},le=["aria-selected","aria-disabled","tabindex"],ie=["aria-selected","aria-disabled","tabindex","onClick","onKeydown"],se=["innerHTML"],ne={key:1},ae=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},plaintextSeparator:{type:String,default:","}},emits:{"update:value":u=>!0,"update:modelValue":u=>!0,onChange:(u,C,w,n)=>!0,onInit:(u,C,w)=>!0,onError:u=>!0},setup(u,{expose:C,emit:w}){const n=u,y=w,{optPageLanguage:K,getPageLanguage:R}=Y.useLanguage();R("common");const J=`s-${s.getRandom(5)}`,N=n.id,T=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 P=t.computed(()=>{const e=n.list;return s.isArray(e)?e.filter(l=>!s.isEmpty(l)):[]}),j=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;o&&s.isNonEmptyString(o.name)&&l.push(o.name)}),l.join(e)}),z=t.computed(()=>{const{theme:e}=n,l={"panel-select-tag":!0};let i=T.theme;return e&&(i=e),s.isEmpty(i)||(l[`selectTag-${i}`]=!0),s.getJsonMerge(l,W.getClassNameJson(n.className))}),H=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=m(l);c.value=s.getArrClone(e);const{value:o,isAll:a,info:r}=m(e);n.isShowAll&&(h.value=a),k(o),y("onChange",o,r,a,{value:i.value,info:i.info})}},G=()=>{t.nextTick(()=>{const{value:e,isAll:l,info:i}=m(c.value);y("onInit",e,i,l)})},m=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()),O=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},Q=()=>{const e=X.getGlobalConfig("selectTag");e?.theme&&(T.theme=e.theme)},B=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},b=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},S=()=>{if(g.value){let e=[];s.isEmpty(c.value)||(e=B(c.value),s.isEqualArr(c.value,e)||(c.value=e,k(e.join(",")))),n.isShowAll&&(h.value=e.length>0&&e.length===v.length)}},x=()=>{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(",")))},U=()=>{Q(),g.value=!s.isEmpty(n.list),b(n.list),x(),S()};t.onMounted(()=>{t.nextTick(()=>{U()})}),t.watch(g,e=>{e&&G()}),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),b(a),l===o&&x(),S()});const V=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=B(i);let a=!0;if(n.checkChangeBefore){const{value:r}=m(o),d=m(s.getArrClone(c.value));try{a=await n.checkChangeBefore(r,d.value),a=s.isBoolean(a)?a:!0}catch(f){a=!1,y("onError",f instanceof Error?f.message:String(f))}}a&&e===E&&L(o)}},I=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 f=p[o[0]];(f&&!s.isEmpty(f.type)?f.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:f}=m(a),F=m(o);try{d=await n.checkChangeBefore(f,F.value),d=s.isBoolean(d)?d:!0}catch(_){d=!1,y("onError",_ instanceof Error?_.message:String(_))}}d&&l===E&&L(a)}},$=()=>B(c.value).join(",");return C({getValue:$,getValueData:()=>{const{value:e,info:l}=m($().split(","));return n.type==="radio"&&s.isEmpty(e)?null:l},setValue:e=>{A(e),b(n.list),S()},runInitComplete:()=>{g.value||(g.value=!0,A(n.value),b(n.list),x(),S())}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",{id:t.unref(N),class:t.normalizeClass(z.value)},[u.isPlaintext?(t.openBlock(),t.createElementBlock("div",ee,t.toDisplayString(j.value),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64)),u.isPlaintext?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",te,[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(H.value),onClick:l[0]||(l[0]=i=>V()),onKeydown:[l[1]||(l[1]=t.withKeys(t.withModifiers(i=>V(),["prevent"]),["enter"])),l[2]||(l[2]=t.withKeys(t.withModifiers(i=>V(),["prevent"]),["space"]))]},[t.createElementVNode("span",null,t.toDisplayString(u.showAllLabel||t.unref(K).checkboxAll),1)],46,le)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[],64)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.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(O(i)),onClick:a=>I(i),onKeydown:[t.withKeys(t.withModifiers(a=>I(i),["prevent"]),["enter"]),t.withKeys(t.withModifiers(a=>I(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,se)):(t.openBlock(),t.createElementBlock("span",ne,t.toDisplayString(i.name),1))])],46,ie))),128))]))],10,Z))}});exports._sfc_main=ae;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),l=require("@cldemo/ui-kit/common/base"),N=require("@cldemo/ui-kit/common/Element"),q=require("./Index.vue_vue_type_script_setup_true_lang-CFZ5jK-q.js");;/* empty css */;/* empty css */const M=["id"],w=["name","placeholder","disabled","aria-label"],g="100px",R=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}},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,m=t.useTemplateRef("refElTextarea"),p=t.reactive({height:a.height||g}),r=t.ref(l.isString(a.value)?a.value:""),o={lastValue:l.isString(a.value)?a.value:"",prevDelayValue:l.isString(a.value)?a.value:"",valueDelayRun:!1},k=t.computed(()=>{let e=a.name;return l.isEmpty(e)&&(e=`textarea_${l.getRandom(8)}`),e}),C=t.computed(()=>a.isClean&&!a.disabled&&!l.isEmpty(r.value)),D=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,N.getClassNameJson(a.className)),e}),T=t.computed(()=>{const e=r.value;return l.isString(e)?e.replace(/<\/?br\s*\/?>/gi,`
|
|
2
|
-
`):""}),_=t.computed(()=>{const{width:e,heightMax:n}=a,u={};return l.isNonEmptyString(e)&&(u.width=e),a.isPlaintext||(l.isEmpty(p.height)||(u.height=p.height),l.isNonEmptyString(n)&&(u["max-height"]=n)),u});let i;const B=e=>{i&&(clearTimeout(i),i=null),o.valueDelayRun=!0,i=setTimeout(()=>{o.valueDelayRun=!1,o.prevDelayValue!==e&&(o.prevDelayValue=e,s("onChangeDelay",e))},Math.max(a.changeDelayTime,0))},h=e=>{e!==o.lastValue&&(o.lastValue=e,s("update:value",e),s("update:modelValue",e),s("onChange",e),B(e))},d=()=>{if(a.isAutoHeight){const e=m.value;if(e){e.style.height=a.height||g;const n=e.scrollHeight+e.scrollTop+(e.offsetHeight-e.clientHeight);e.style.height="100%",p.height=n>0?`${n}px`:a.height||g}}},f=()=>{m.value?.focus()},S=()=>{t.nextTick(()=>{s("onInit")})};t.onMounted(()=>{S()}),t.onBeforeUnmount(()=>{i&&(clearTimeout(i),i=null)}),t.watch(()=>a.value,(e,n)=>{e!==n&&(r.value=l.isString(e)?e:"",o.lastValue=l.isString(e)?e:"",requestAnimationFrame(()=>d()),o.valueDelayRun||(o.prevDelayValue=e||""))});const V=e=>{const n=e.target;if(!n)return;const u=n.value;requestAnimationFrame(()=>d()),h(u)},H=e=>{e.key==="Enter"&&s("onKeydownEnter",e)},b=e=>{e.key==="Enter"&&s("onKeyupEnter",e)},I=()=>{r.value="",h(""),f()},P=()=>{s("onFocus")},F=()=>{s("onBlur")},y=()=>l.trim(r.value);return v({getValue:y,getValueData:()=>({value:y(),show:r.value}),setValue:e=>{i&&(clearTimeout(i),i=null,o.valueDelayRun=!1);const n=l.isEmpty(e)?"":e;o.lastValue=n,o.prevDelayValue=n,r.value=n,d()},initHeight:()=>{p.height=a.height||g,a.isAutoHeight&&d()},focus:()=>{f()},getParentElement:()=>m.value?.parentElement||null}),(e,n)=>(t.openBlock(),t.createElementBlock("div",{id:t.unref(E),class:t.normalizeClass(D.value),style:t.normalizeStyle(_.value)},[c.isPlaintext?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(T.value),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.withDirectives(t.createElementVNode("textarea",{ref_key:"refElTextarea",ref:m,class:"form-control text-area","onUpdate:modelValue":n[0]||(n[0]=u=>r.value=u),name:k.value,placeholder:c.placeholder,disabled:c.disabled,"aria-label":c.placeholder||"文本输入区域",onInput:V,onKeydown:H,onKeyup:b,onFocus:P,onBlur:F},null,40,w),[[t.vModelText,r.value]]),C.value?(t.openBlock(),t.createBlock(q._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,M))}});exports._sfc_main=R;
|