ll-plus 2.7.13 → 2.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/input/index.d.ts +1 -1
- package/es/components/input/src/input.vue.d.ts +1 -1
- package/es/packages/components/input/src/input.vue2.mjs +5 -3
- package/es/packages/components/input/src/input.vue2.mjs.map +1 -1
- package/index.full.js +4 -2
- package/index.full.min.js +1 -1
- package/index.full.min.js.map +1 -1
- package/index.full.min.mjs +13 -13
- package/index.full.min.mjs.map +1 -1
- package/index.full.mjs +4 -2
- package/lib/components/input/index.d.ts +1 -1
- package/lib/components/input/src/input.vue.d.ts +1 -1
- package/lib/packages/components/input/src/input.vue2.js +4 -2
- package/lib/packages/components/input/src/input.vue2.js.map +1 -1
- package/package.json +1 -1
- package/theme-chalk/css/advanced-filtering.css +1 -1
- package/theme-chalk/css/api-component.css +1 -1
- package/theme-chalk/css/cascader.css +1 -1
- package/theme-chalk/css/checkbox.css +1 -1
- package/theme-chalk/css/code-editor.css +1 -1
- package/theme-chalk/css/color-picker.css +1 -1
- package/theme-chalk/css/cropper.css +1 -1
- package/theme-chalk/css/descriptions.css +1 -1
- package/theme-chalk/css/drawer.css +1 -1
- package/theme-chalk/css/dropdown-button-simple.css +1 -1
- package/theme-chalk/css/dropdown.css +1 -1
- package/theme-chalk/css/easy-cron.css +1 -1
- package/theme-chalk/css/form.css +1 -1
- package/theme-chalk/css/index.css +2 -2
- package/theme-chalk/css/input-number.css +1 -1
- package/theme-chalk/css/input.css +1 -1
- package/theme-chalk/css/key-value.css +1 -1
- package/theme-chalk/css/markdown-editor.css +1 -1
- package/theme-chalk/css/modal.css +1 -1
- package/theme-chalk/css/new-drawer.css +1 -1
- package/theme-chalk/css/new-modal.css +1 -1
- package/theme-chalk/css/number-range.css +1 -1
- package/theme-chalk/css/rich-text-editor.css +1 -1
- package/theme-chalk/css/segmented.css +1 -1
- package/theme-chalk/css/switch.css +1 -1
- package/theme-chalk/css/table.css +1 -1
- package/theme-chalk/css/tabs-simple.css +1 -1
- package/theme-chalk/css/tag-group.css +1 -1
- package/types/packages/components/input/index.d.ts +1 -1
- package/types/packages/components/input/src/input.vue.d.ts +1 -1
|
@@ -55,7 +55,7 @@ export declare const LlInput: import("ll-plus/es/utils").SFCWithInstall<import("
|
|
|
55
55
|
hasValue: import("vue").ComputedRef<string | number | undefined>;
|
|
56
56
|
handleMouseOver: () => void;
|
|
57
57
|
handleMouseOut: () => void;
|
|
58
|
-
onChange: (e: any) => void
|
|
58
|
+
onChange: (e: any) => Promise<void>;
|
|
59
59
|
componentType: ({
|
|
60
60
|
new (...args: any[]): import("@vue/runtime-core").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<Omit<{
|
|
61
61
|
id: StringConstructor;
|
|
@@ -54,7 +54,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
54
54
|
hasValue: import("vue").ComputedRef<string | number | undefined>;
|
|
55
55
|
handleMouseOver: () => void;
|
|
56
56
|
handleMouseOut: () => void;
|
|
57
|
-
onChange: (e: any) => void
|
|
57
|
+
onChange: (e: any) => Promise<void>;
|
|
58
58
|
componentType: ({
|
|
59
59
|
new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<Omit<{
|
|
60
60
|
id: StringConstructor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, useAttrs, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, createBlock, resolveDynamicComponent, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, nextTick, watch, useAttrs, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, createBlock, resolveDynamicComponent, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode } from 'vue';
|
|
2
2
|
import { Input } from 'ant-design-vue';
|
|
3
3
|
import '../../../utils/index.mjs';
|
|
4
4
|
import { inputProps } from './input.mjs';
|
|
@@ -25,12 +25,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
const handleMouseOut = () => {
|
|
26
26
|
isMouseOver.value = false;
|
|
27
27
|
};
|
|
28
|
-
const onChange = (e) => {
|
|
29
|
-
emit("change", e);
|
|
28
|
+
const onChange = async (e) => {
|
|
30
29
|
const { value } = e.target;
|
|
30
|
+
innerValue.value = value;
|
|
31
|
+
await nextTick();
|
|
31
32
|
if (!value && e.type === "click") {
|
|
32
33
|
emit("clear", value);
|
|
33
34
|
}
|
|
35
|
+
emit("change", e);
|
|
34
36
|
};
|
|
35
37
|
watch(
|
|
36
38
|
() => props.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue2.mjs","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\" @mouseover=\"handleMouseOver\" @mouseout=\"handleMouseOut\">\n <component\n :is=\"componentType\"\n ref=\"inputRef\"\n v-bind=\"computedAttrs\"\n v-model:value=\"innerValue\"\n :allow-clear=\"props.allowClear\"\n :disabled=\"props.disabled\"\n :class=\"{\n 'show-clear-icon':\n props.allowClear && hasValue && isMouseOver && !props.disabled\n }\"\n @change=\"onChange\"\n >\n <template v-for=\"item in Object.keys($slots)\" :key=\"item\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"prefixIcon\" #prefix>\n <ll-icon :icon-name=\"prefixIcon\" class=\"prefix-icon\" />\n </template>\n <template v-if=\"suffixIcon\" #suffix>\n <ll-icon :icon-name=\"suffixIcon\" class=\"suffix-icon\" />\n </template>\n </component>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, useAttrs, watch } from 'vue'\nimport { Input } from 'ant-design-vue'\nimport { createNamespace } from '@ll-plus/utils'\nimport { InputValue, inputProps } from './input'\nimport { omit } from 'lodash'\n\ndefineOptions({ name: 'LlInput' })\n\nconst bem = createNamespace('input')\n\nconst props = defineProps(inputProps)\n\nconst emit = defineEmits(['update:value', 'change', 'clear'])\n\nconst innerValue = ref<InputValue>('')\n\nconst inputRef = ref()\n\nconst isMouseOver = ref(false)\n\n// 判断当前输入框是否有值\nconst hasValue = computed(() => innerValue.value)\n\n// 鼠标移入事件\nconst handleMouseOver = () => {\n isMouseOver.value = true\n}\n\n// 鼠标移出事件\nconst handleMouseOut = () => {\n isMouseOver.value = false\n}\n\n// 输入框发送变化的回调\nconst onChange = (e: any) => {\n
|
|
1
|
+
{"version":3,"file":"input.vue2.mjs","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\" @mouseover=\"handleMouseOver\" @mouseout=\"handleMouseOut\">\n <component\n :is=\"componentType\"\n ref=\"inputRef\"\n v-bind=\"computedAttrs\"\n v-model:value=\"innerValue\"\n :allow-clear=\"props.allowClear\"\n :disabled=\"props.disabled\"\n :class=\"{\n 'show-clear-icon':\n props.allowClear && hasValue && isMouseOver && !props.disabled\n }\"\n @change=\"onChange\"\n >\n <template v-for=\"item in Object.keys($slots)\" :key=\"item\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"prefixIcon\" #prefix>\n <ll-icon :icon-name=\"prefixIcon\" class=\"prefix-icon\" />\n </template>\n <template v-if=\"suffixIcon\" #suffix>\n <ll-icon :icon-name=\"suffixIcon\" class=\"suffix-icon\" />\n </template>\n </component>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, useAttrs, watch, nextTick } from 'vue'\nimport { Input } from 'ant-design-vue'\nimport { createNamespace } from '@ll-plus/utils'\nimport { InputValue, inputProps } from './input'\nimport { omit } from 'lodash'\n\ndefineOptions({ name: 'LlInput' })\n\nconst bem = createNamespace('input')\n\nconst props = defineProps(inputProps)\n\nconst emit = defineEmits(['update:value', 'change', 'clear'])\n\nconst innerValue = ref<InputValue>('')\n\nconst inputRef = ref()\n\nconst isMouseOver = ref(false)\n\n// 判断当前输入框是否有值\nconst hasValue = computed(() => innerValue.value)\n\n// 鼠标移入事件\nconst handleMouseOver = () => {\n isMouseOver.value = true\n}\n\n// 鼠标移出事件\nconst handleMouseOut = () => {\n isMouseOver.value = false\n}\n\n// 输入框发送变化的回调\nconst onChange = async (e: any) => {\n const { value } = e.target\n innerValue.value = value\n await nextTick()\n if (!value && e.type === 'click') {\n emit('clear', value)\n }\n emit('change', e)\n}\n\n// 监听props.value的变化\nwatch(\n () => props.value,\n newValue => {\n innerValue.value = newValue\n },\n {\n immediate: true\n }\n)\n\n// 监听innerValue的变化,触发update:value事件\nwatch(\n innerValue,\n newValue => {\n emit('update:value', newValue)\n },\n {\n immediate: true\n }\n)\n\n// 根据showPassword属性决定组件类型\nconst componentType = props.showPassword ? Input.Password : Input\n\n// 计算属性,合并attrs和props\nconst computedAttrs = computed(() => {\n const attrs = { ...omit(useAttrs(), ['class', 'style']), props }\n return attrs\n})\n\n// 聚焦输入框\nconst focus = () => {\n inputRef.value.focus()\n}\n\n// 公开focus方法\ndefineExpose({ focus })\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,IAAM,MAAA,GAAA,GAAM,gBAAgB,OAAO,CAAA,CAAA;AAEnC,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAEb,IAAM,MAAA,UAAA,GAAa,IAAgB,EAAE,CAAA,CAAA;AAErC,IAAA,MAAM,WAAW,GAAI,EAAA,CAAA;AAErB,IAAM,MAAA,WAAA,GAAc,IAAI,KAAK,CAAA,CAAA;AAG7B,IAAA,MAAM,QAAW,GAAA,QAAA,CAAS,MAAM,UAAA,CAAW,KAAK,CAAA,CAAA;AAGhD,IAAA,MAAM,kBAAkB,MAAM;AAC5B,MAAA,WAAA,CAAY,KAAQ,GAAA,IAAA,CAAA;AAAA,KACtB,CAAA;AAGA,IAAA,MAAM,iBAAiB,MAAM;AAC3B,MAAA,WAAA,CAAY,KAAQ,GAAA,KAAA,CAAA;AAAA,KACtB,CAAA;AAGA,IAAM,MAAA,QAAA,GAAW,OAAO,CAAW,KAAA;AACjC,MAAM,MAAA,EAAE,KAAM,EAAA,GAAI,CAAE,CAAA,MAAA,CAAA;AACpB,MAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AACnB,MAAA,MAAM,QAAS,EAAA,CAAA;AACf,MAAA,IAAI,CAAC,KAAA,IAAS,CAAE,CAAA,IAAA,KAAS,OAAS,EAAA;AAChC,QAAA,IAAA,CAAK,SAAS,KAAK,CAAA,CAAA;AAAA,OACrB;AACA,MAAA,IAAA,CAAK,UAAU,CAAC,CAAA,CAAA;AAAA,KAClB,CAAA;AAGA,IAAA,KAAA;AAAA,MACE,MAAM,KAAM,CAAA,KAAA;AAAA,MACZ,CAAY,QAAA,KAAA;AACV,QAAA,UAAA,CAAW,KAAQ,GAAA,QAAA,CAAA;AAAA,OACrB;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AAGA,IAAA,KAAA;AAAA,MACE,UAAA;AAAA,MACA,CAAY,QAAA,KAAA;AACV,QAAA,IAAA,CAAK,gBAAgB,QAAQ,CAAA,CAAA;AAAA,OAC/B;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AAGA,IAAA,MAAM,aAAgB,GAAA,KAAA,CAAM,YAAe,GAAA,KAAA,CAAM,QAAW,GAAA,KAAA,CAAA;AAG5D,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM;AACnC,MAAM,MAAA,KAAA,GAAQ,EAAE,GAAG,IAAK,CAAA,QAAA,EAAY,EAAA,CAAC,OAAS,EAAA,OAAO,CAAC,CAAA,EAAG,KAAM,EAAA,CAAA;AAC/D,MAAO,OAAA,KAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAGD,IAAA,MAAM,QAAQ,MAAM;AAClB,MAAA,QAAA,CAAS,MAAM,KAAM,EAAA,CAAA;AAAA,KACvB,CAAA;AAGA,IAAa,QAAA,CAAA,EAAE,OAAO,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.full.js
CHANGED
|
@@ -69984,12 +69984,14 @@
|
|
|
69984
69984
|
const handleMouseOut = () => {
|
|
69985
69985
|
isMouseOver.value = false;
|
|
69986
69986
|
};
|
|
69987
|
-
const onChange = (e) => {
|
|
69988
|
-
emit("change", e);
|
|
69987
|
+
const onChange = async (e) => {
|
|
69989
69988
|
const { value } = e.target;
|
|
69989
|
+
innerValue.value = value;
|
|
69990
|
+
await require$$0.nextTick();
|
|
69990
69991
|
if (!value && e.type === "click") {
|
|
69991
69992
|
emit("clear", value);
|
|
69992
69993
|
}
|
|
69994
|
+
emit("change", e);
|
|
69993
69995
|
};
|
|
69994
69996
|
require$$0.watch(
|
|
69995
69997
|
() => props.value,
|
package/index.full.min.js
CHANGED
|
@@ -53,7 +53,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
53
53
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
54
54
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
55
55
|
*)
|
|
56
|
-
*/var rx=e.defineComponent({name:"LlInput",__name:"input",props:zh,emits:["update:value","change","clear"],setup(t,{expose:o,emit:n}){const r=ae("input"),u=t,d=n,i=e.ref(""),c=e.ref(),l=e.ref(!1),f=e.computed(()=>i.value),m=()=>{l.value=!0},g=()=>{l.value=!1},k=v=>{d("change",v);const{value:F}=v.target;!F&&v.type==="click"&&d("clear",F)};e.watch(()=>u.value,v=>{i.value=v},{immediate:!0}),e.watch(i,v=>{d("update:value",v)},{immediate:!0});const y=u.showPassword?ue.Input.Password:ue.Input,b=e.computed(()=>({...Wh.omit(e.useAttrs(),["class","style"]),props:u}));return o({focus:()=>{c.value.focus()}}),(v,F)=>{const A=e.resolveComponent("ll-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(r).b()),onMouseover:m,onMouseout:g},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps({ref_key:"inputRef",ref:c},b.value,{value:i.value,"onUpdate:value":F[0]||(F[0]=E=>i.value=E),"allow-clear":u.allowClear,disabled:u.disabled,class:{"show-clear-icon":u.allowClear&&f.value&&l.value&&!u.disabled},onChange:k}),e.createSlots({_:2},[e.renderList(Object.keys(v.$slots),E=>({name:E,fn:e.withCtx(I=>[e.renderSlot(v.$slots,E,e.normalizeProps(e.guardReactiveProps(I||{})))])})),v.prefixIcon?{name:"prefix",fn:e.withCtx(()=>[e.createVNode(A,{"icon-name":v.prefixIcon,class:"prefix-icon"},null,8,["icon-name"])]),key:"0"}:void 0,v.suffixIcon?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(A,{"icon-name":v.suffixIcon,class:"suffix-icon"},null,8,["icon-name"])]),key:"1"}:void 0]),1040,["value","allow-clear","disabled","class"]))],34)}}}),ax=ne(rx,[["__file","input.vue"]]);const Gh=ge(ax),Uh=ce({value:{type:Z([Number,String]),default:""},thousands:{type:Boolean,default:!1},isAmountChinese:{type:Boolean,default:!1},detailed:{type:Boolean,default:!1},integer:{type:Z(String),default:null}}),Yh={change:t=>!!t,"update:value":t=>!!t},ix={int8:{min:-128,max:127,precision:0},uint8:{min:0,max:255,precision:0},int16:{min:-32768,max:32767,precision:0},uint16:{min:0,max:65535,precision:0},int32:{min:-2147483648,max:2147483647,precision:0},uint32:{min:0,max:4294967295,precision:0},int64:{min:-9223372036854775808n,max:9223372036854775807n,precision:0},uint64:{min:0,max:18446744073709551615n,precision:0}},ux=["title"],dx={key:0},sx={key:1};var cx=e.defineComponent({name:"LlInputNumber",__name:"input-number",props:Uh,emits:Yh,setup(t,{expose:o,emit:n}){const r=t,u=n,d=ae("input-number"),i=e.useAttrs(),c=e.ref(""),l=e.ref(),f=e.computed(()=>{let B={};return r.integer&&(B=ix[r.integer]),B}),m=e.computed(()=>{const B={...i,...f.value};return r.thousands&&(B.formatter=v=>mu(v),B.parser=v=>v.replace(/\$\s?|(,*)/g,"")),B}),g=e.computed(()=>{let B="";return B=!r.isAmountChinese||Br(c.value)?"":np(Number(c.value)),B});e.watch(()=>r.value,B=>{k(B)},{immediate:!0});function k(B){c.value=Br(B)||isNaN(B)?null:B}function y(B){u("update:value",B),u("change",B)}return o({focus:()=>{l.value.focus()}}),(B,v)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(d).b())},[B.detailed?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(d).e("container"))},[e.createVNode(e.unref(ue.InputNumber),e.mergeProps({ref_key:"inputRef",ref:l,value:c.value,"onUpdate:value":v[0]||(v[0]=F=>c.value=F)},m.value,{onChange:y}),e.createSlots({_:2},[e.renderList(Object.keys(B.$slots),F=>({name:F,fn:e.withCtx(A=>[e.renderSlot(B.$slots,F,e.normalizeProps(e.guardReactiveProps(A||{})))])})),m.value.unit?{name:"addonAfter",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d).e("unit"))},e.toDisplayString(m.value.unit),3)]),key:"0"}:void 0]),1040,["value"])],2)),B.detailed?(e.openBlock(),e.createElementBlock("p",{key:1,class:e.normalizeClass(e.unref(d).e("detailed")),title:B.thousands?e.unref(mu)(c.value):c.value},[B.$attrs.addonBefore?(e.openBlock(),e.createElementBlock("span",dx,e.toDisplayString(B.$attrs.addonBefore),1)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(B.thousands?e.unref(mu)(c.value):c.value)+" ",1),B.$attrs.addonAfter?(e.openBlock(),e.createElementBlock("span",sx,e.toDisplayString(B.$attrs.addonAfter),1)):e.createCommentVNode("v-if",!0)],10,ux)):e.createCommentVNode("v-if",!0),B.isAmountChinese&&g.value?(e.openBlock(),e.createElementBlock("p",{key:2,class:e.normalizeClass(e.unref(d).e("amount-chinese-name"))},e.toDisplayString(g.value),3)):e.createCommentVNode("v-if",!0)],2))}}),lx=ne(cx,[["__file","input-number.vue"]]);const Gu=ge(lx),_h=()=>({key:null,value:null}),Kh=ce({value:{type:Z(Array),default:()=>[{key:"",value:""}]},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},keyLabel:{type:String,default:""},valueLabel:{type:String,default:""},addText:{type:String,default:"\u6DFB\u52A0"},keyValueType:{type:Z(String),default:"doubt"},keyType:{type:Z(Object),default:()=>({type:"input",placeholder:"\u8BF7\u8F93\u5165Key"})},keyTypes:{type:Z(Array),default:()=>[]},valueType:{type:Z(Object),default:()=>({type:"input",placeholder:"\u8BF7\u8F93\u5165Value"})},disabledValue:{type:Z(Array),default:()=>[]},disabledKey:{type:Z(Array),default:()=>[]},disabledDelete:{type:Z(Array),default:()=>[]},disabledAdd:{type:Boolean,default:!1},validate:{type:Boolean,default:!1},keepLast:{type:Boolean,default:!0}}),Xh={change:t=>!!t,add:t=>!!t,delete:t=>typeof t=="number","update:value":t=>!!t},fx=[{trigger:["blur","change"],message:"\u6B64\u5B57\u6BB5\u662F\u5FC5\u9700\u7684",validator:async(t,o)=>o?Promise.resolve():Promise.reject(new Error("\u6B64\u5B57\u6BB5\u662F\u5FC5\u9700\u7684"))}],Zh={layout:"horizontal",labelAlign:"left"},Jh=[{key:"other",labelCol:{span:24}}],qh=ce({disabled:{type:Boolean},disabledValue:{type:Z(Array)},disabledKey:{type:Z(Array)},disabledDelete:{type:Z(Array)},keyValueType:{type:Z(String)},keyType:{type:Z(Object)},keyTypes:{type:Z(Array)},valueType:{type:Z(Object)},value:{type:Z(Object),default:()=>({key:"",value:""})},idx:{type:Number,required:!0},keyValueTypeDict:{type:Object,default:()=>({})},showDelete:{type:Boolean,default:!0}}),$h={delete:()=>!0,change:()=>!0,"update:value":t=>!!t};var gx=e.defineComponent({name:"LlKeyValueItem",__name:"key-value-item",props:qh,emits:$h,setup(t,{expose:o,emit:n}){const r=t,u=n,d=e.useAttrs(),i=ae("key-value"),c=e.ref(r.value),l=e.ref(),f=e.computed(()=>r.keyType),m=e.computed(()=>{let I=r.valueType;return c.value.key&&!fu(r.keyValueTypeDict)&&(I=r.keyValueTypeDict[c.value.key]),I}),g=e.computed(()=>r.disabledKey?.includes(r.idx)||r.disabled||f.value?.disabled),k=e.computed(()=>r.disabledValue?.includes(r.idx)||r.disabled||m.value?.disabled),y=e.computed(()=>r.disabledDelete?.includes(r.idx)||r.disabled),b=e.computed(()=>c.value.key||c.value.key===0||c.value.value),B=()=>{u("delete")},v=async()=>{c.value.value=null,await l.value?.clearValidate()},F=async()=>await l.value?.validate(),A=async()=>await l.value?.resetFields(),E=async I=>await l.value?.clearValidate(I);return e.watch(c,async I=>{await e.nextTick().then(()=>{try{u("update:value",I),u("change")}catch(N){console.error(N)}})},{deep:!0}),o({validate:F,resetFields:A,clearValidate:E}),(I,N)=>{const x=e.resolveComponent("ll-select"),R=e.resolveComponent("ll-form-item"),M=e.resolveComponent("ll-icon"),j=e.resolveComponent("ll-button"),T=e.resolveComponent("a-popconfirm"),W=e.resolveComponent("ll-form");return e.openBlock(),e.createBlock(W,{ref_key:"form",ref:l,"form-columns":e.unref(Jh),"form-data":r.value,"form-options":e.unref(Zh)},{formItem:e.withCtx(({item:_})=>[_.key==="other"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i).e("item"))},[r.keyValueType!=="single"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i).m("left"))},[e.createVNode(R,{label:e.unref(d)["key-label"],"label-col":{span:24},rules:f.value.rules||[],name:"key"},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"key",{},()=>[e.unref(fu)(r.keyTypes)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(`ll-${f.value.type}`),e.mergeProps({key:1,value:c.value.key,"onUpdate:value":N[1]||(N[1]=V=>c.value.key=V)},f.value,{disabled:g.value,style:{width:"100%"}}),e.createSlots({_:2},[e.renderList(Object.keys(I.$slots),V=>({name:V,fn:e.withCtx(L=>[e.renderSlot(I.$slots,V,e.mergeProps(L||{},{content:"key"}))])}))]),1040,["value","disabled"])):(e.openBlock(),e.createBlock(x,{key:0,value:c.value.key,"onUpdate:value":N[0]||(N[0]=V=>c.value.key=V),options:r.keyTypes,disabled:g.value,style:{width:"100%"},placeholder:"\u8BF7\u9009\u62E9","allow-clear":"",onChange:v},null,8,["value","options","disabled"]))])]),_:3},8,["label","rules"])],2)):e.createCommentVNode("v-if",!0),r.keyValueType!=="single"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).m("separator")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.renderSlot(I.$slots,"separator",{},()=>[e.createTextVNode("~")])],6)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).m("right"))},[e.createVNode(R,{label:e.unref(d)["value-label"],"label-col":{span:24},rules:m.value.rules||[],name:"value"},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"value-warapper",e.normalizeProps(e.guardReactiveProps(m.value)),()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(`ll-${m.value.type}`),e.mergeProps({value:c.value.value,"onUpdate:value":N[2]||(N[2]=V=>c.value.value=V),disabled:k.value,style:{width:"100%"}},m.value),e.createSlots({_:2},[e.renderList(Object.keys(I.$slots),V=>({name:V,fn:e.withCtx(L=>[e.renderSlot(I.$slots,V,e.mergeProps(L||{},{content:"value"}))])}))]),1040,["value","disabled"]))])]),_:3},8,["label","rules"])],2),r.showDelete?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[b.value?(e.openBlock(),e.createBlock(T,{key:0,title:"\u786E\u5B9A\u8981\u79FB\u9664\u5417?","ok-text":"\u786E\u8BA4","cancel-text":"\u53D6\u6D88",placement:"topRight","overlay-class-name":e.unref(i).m("popconfirm"),"get-popup-container":V=>V.parentNode,"destroy-tooltip-on-hide":"",onConfirm:B},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).m("delete")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.createVNode(j,{type:"link",disabled:y.value},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"delete-icon",{},()=>[e.createVNode(M,{"icon-name":"icon-remove",class:"delete"})])]),_:3},8,["disabled"])],6)]),_:3},8,["overlay-class-name","get-popup-container"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).m("delete")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.createVNode(j,{type:"link",disabled:y.value,onClick:B},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"delete-icon",{},()=>[e.createVNode(M,{"icon-name":"icon-remove",class:"delete"})])]),_:3},8,["disabled"])],6))],64)):e.createCommentVNode("v-if",!0)],2)):e.createCommentVNode("v-if",!0)]),_:3},8,["form-columns","form-data","form-options"])}}}),px=ne(gx,[["__file","key-value-item.vue"]]),mx=e.defineComponent({name:"LlKeyValue",__name:"key-value",props:Kh,emits:Xh,setup(t,{expose:o,emit:n}){const r=t,u=n,d=ae("key-value"),i=ue.Form.useInjectFormItemContext(),c=e.ref([]),l=e.ref([]),f=e.computed(()=>{const v={};return r.keyTypes.map(F=>{v[F.value]=F.option}),v}),m=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.validate()))),g=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.resetFields()))),k=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.clearValidate()))),y=async()=>{const v=await m();if(r.validate&&!v)return!1;c.value.push(_h()),u("add",{index:c.value.length-1,item:c.value[c.value.length-1],value:c.value}),B()},b=v=>{c.value.splice(v,1),u("delete",v),B()},B=()=>{try{i.onFieldChange(),u("change",c.value),u("update:value",c.value)}catch(v){console.error(v)}};return e.watch(()=>r.value,v=>{c.value=v&&v.length>0?v:r.keepLast?[{key:null,value:null}]:v},{immediate:!0,deep:!0}),o({validate:m,resetFields:g,clearValidate:k}),(v,F)=>{const A=e.resolveComponent("ll-icon"),E=e.resolveComponent("ll-button"),I=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(d).b())},[e.createVNode(I,{spinning:r.loading},{default:e.withCtx(()=>[c.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(d).e("list"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(N,x)=>(e.openBlock(),e.createBlock(px,{key:N,ref_for:!0,ref:R=>l.value[x]=R,value:c.value[x],"onUpdate:value":R=>c.value[x]=R,idx:x,"key-label":r.keyLabel,"value-label":r.valueLabel,"key-value-type-dict":f.value,"key-value-type":r.keyValueType,"key-type":r.keyType,"key-types":r.keyTypes,"value-type":r.valueType,disabled:r.disabled,"disabled-value":r.disabledValue,"disabled-key":r.disabledKey,"disabled-delete":r.disabledDelete,"show-delete":r.keepLast?x>0:!0,onDelete:R=>b(x),onChange:B},e.createSlots({_:2},[e.renderList(Object.keys(v.$slots),R=>({name:R,fn:e.withCtx(M=>[e.renderSlot(v.$slots,R,e.mergeProps({ref_for:!0},M||{},{index:x}))])}))]),1032,["value","onUpdate:value","idx","key-label","value-label","key-value-type-dict","key-value-type","key-type","key-types","value-type","disabled","disabled-value","disabled-key","disabled-delete","show-delete","onDelete"]))),128))],2)):e.createCommentVNode("v-if",!0),e.createVNode(E,{class:e.normalizeClass(e.unref(d).e("add")),loading:v.loading,disabled:r.disabled||r.disabledAdd,onClick:y},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d).e("plus"))},[v.loading?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(A,{key:0,"icon-name":"icon-add",class:e.normalizeClass(e.unref(d).e("icon-add"))},null,8,["class"])),e.createTextVNode(" "+e.toDisplayString(r.addText),1)],2)]),_:1},8,["class","loading","disabled"])]),_:3},8,["spinning"])],2)}}}),kx=ne(mx,[["__file","key-value.vue"]]);const eb=ge(kx);function tb(t,o){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable})),n.push.apply(n,r)}return n}function Uu(t){for(var o=1;o<arguments.length;o++){var n=arguments[o]!=null?arguments[o]:{};o%2?tb(Object(n),!0).forEach(function(r){bx(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tb(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yx(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function ob(t,o){for(var n=0;n<o.length;n++){var r=o[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nb(r.key),r)}}function hx(t,o,n){return o&&ob(t.prototype,o),n&&ob(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bx(t,o,n){return o=nb(o),o in t?Object.defineProperty(t,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[o]=n,t}function Yu(){return Yu=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Yu.apply(this,arguments)}function vx(t,o){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,o||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function nb(t){var o=vx(t,"string");return typeof o=="symbol"?o:String(o)}var rb={exports:{}};(function(t){typeof window>"u"||function(o){var n=o.HTMLCanvasElement&&o.HTMLCanvasElement.prototype,r=o.Blob&&function(){try{return!!new Blob}catch{return!1}}(),u=r&&o.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),d=o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,c=(r||d)&&o.atob&&o.ArrayBuffer&&o.Uint8Array&&function(l){var f,m,g,k,y,b,B,v,F;if(f=l.match(i),!f)throw new Error("invalid data URI");for(m=f[2]?f[1]:"text/plain"+(f[3]||";charset=US-ASCII"),g=!!f[4],k=l.slice(f[0].length),g?y=atob(k):y=decodeURIComponent(k),b=new ArrayBuffer(y.length),B=new Uint8Array(b),v=0;v<y.length;v+=1)B[v]=y.charCodeAt(v);return r?new Blob([u?B:b],{type:m}):(F=new d,F.append(b),F.getBlob(m))};o.HTMLCanvasElement&&!n.toBlob&&(n.mozGetAsFile?n.toBlob=function(l,f,m){var g=this;setTimeout(function(){m&&n.toDataURL&&c?l(c(g.toDataURL(f,m))):l(g.mozGetAsFile("blob",f))})}:n.toDataURL&&c&&(n.msToBlob?n.toBlob=function(l,f,m){var g=this;setTimeout(function(){(f&&f!=="image/png"||m)&&n.toDataURL&&c?l(c(g.toDataURL(f,m))):l(g.msToBlob(f))})}:n.toBlob=function(l,f,m){var g=this;setTimeout(function(){l(c(g.toDataURL(f,m)))})})),t.exports?t.exports=c:o.dataURLtoBlob=c}(window)})(rb);var ab=rb.exports,Bx=function(o){return typeof Blob>"u"?!1:o instanceof Blob||Object.prototype.toString.call(o)==="[object Blob]"},ib={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},Fx=typeof window<"u"&&typeof window.document<"u",tr=Fx?window:{},_u=function(o){return o>0&&o<1/0},Ax=Array.prototype.slice;function Pc(t){return Array.from?Array.from(t):Ax.call(t)}var Cx=/^image\/.+$/;function Vc(t){return Cx.test(t)}function Ex(t){var o=Vc(t)?t.substr(6):"";return o==="jpeg"&&(o="jpg"),".".concat(o)}var ub=String.fromCharCode;function wx(t,o,n){var r="",u;for(n+=o,u=o;u<n;u+=1)r+=ub(t.getUint8(u));return r}var Sx=tr.btoa;function db(t,o){for(var n=[],r=8192,u=new Uint8Array(t);u.length>0;)n.push(ub.apply(null,Pc(u.subarray(0,r)))),u=u.subarray(r);return"data:".concat(o,";base64,").concat(Sx(n.join("")))}function Dx(t){var o=new DataView(t),n;try{var r,u,d;if(o.getUint8(0)===255&&o.getUint8(1)===216)for(var i=o.byteLength,c=2;c+1<i;){if(o.getUint8(c)===255&&o.getUint8(c+1)===225){u=c;break}c+=1}if(u){var l=u+4,f=u+10;if(wx(o,l,4)==="Exif"){var m=o.getUint16(f);if(r=m===18761,(r||m===19789)&&o.getUint16(f+2,r)===42){var g=o.getUint32(f+4,r);g>=8&&(d=f+g)}}}if(d){var k=o.getUint16(d,r),y,b;for(b=0;b<k;b+=1)if(y=d+b*12+2,o.getUint16(y,r)===274){y+=8,n=o.getUint16(y,r),o.setUint16(y,1,r);break}}}catch{n=1}return n}function Ix(t){var o=0,n=1,r=1;switch(t){case 2:n=-1;break;case 3:o=-180;break;case 4:r=-1;break;case 5:o=90,r=-1;break;case 6:o=90;break;case 7:o=90,n=-1;break;case 8:o=-90;break}return{rotate:o,scaleX:n,scaleY:r}}var xx=/\.\d*(?:0|9){12}\d*$/;function sb(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return xx.test(t)?Math.round(t*o)/o:t}function Fi(t){var o=t.aspectRatio,n=t.height,r=t.width,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",d=_u(r),i=_u(n);if(d&&i){var c=n*o;(u==="contain"||u==="none")&&c>r||u==="cover"&&c<r?n=r/o:r=n*o}else d?n=r/o:i&&(r=n*o);return{width:r,height:n}}function Tx(t){for(var o=Pc(new Uint8Array(t)),n=o.length,r=[],u=0;u+3<n;){var d=o[u],i=o[u+1];if(d===255&&i===218)break;if(d===255&&i===216)u+=2;else{var c=o[u+2]*256+o[u+3],l=u+c+2,f=o.slice(u,l);r.push(f),u=l}}return r.reduce(function(m,g){return g[0]===255&&g[1]===225?m.concat(g):m},[])}function jx(t,o){var n=Pc(new Uint8Array(t));if(n[2]!==255||n[3]!==224)return t;var r=n[4]*256+n[5],u=[255,216].concat(o,n.slice(4+r));return new Uint8Array(u)}var Nx=tr.ArrayBuffer,Qc=tr.FileReader,Hr=tr.URL||tr.webkitURL,Ox=/\.\w+$/,Rx=tr.Compressor,Lx=function(){function t(o,n){yx(this,t),this.file=o,this.exif=[],this.image=new Image,this.options=Uu(Uu({},ib),n),this.aborted=!1,this.result=null,this.init()}return hx(t,[{key:"init",value:function(){var n=this,r=this.file,u=this.options;if(!Bx(r)){this.fail(new Error("The first argument must be a File or Blob object."));return}var d=r.type;if(!Vc(d)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!Hr||!Qc){this.fail(new Error("The current browser does not support image compression."));return}Nx||(u.checkOrientation=!1,u.retainExif=!1);var i=d==="image/jpeg",c=i&&u.checkOrientation,l=i&&u.retainExif;if(Hr&&!c&&!l)this.load({url:Hr.createObjectURL(r)});else{var f=new Qc;this.reader=f,f.onload=function(m){var g=m.target,k=g.result,y={},b=1;c&&(b=Dx(k),b>1&&Yu(y,Ix(b))),l&&(n.exif=Tx(k)),c||l?!Hr||b>1?y.url=db(k,d):y.url=Hr.createObjectURL(r):y.url=k,n.load(y)},f.onabort=function(){n.fail(new Error("Aborted to read the image with FileReader."))},f.onerror=function(){n.fail(new Error("Failed to read the image with FileReader."))},f.onloadend=function(){n.reader=null},c||l?f.readAsArrayBuffer(r):f.readAsDataURL(r)}}},{key:"load",value:function(n){var r=this,u=this.file,d=this.image;d.onload=function(){r.draw(Uu(Uu({},n),{},{naturalWidth:d.naturalWidth,naturalHeight:d.naturalHeight}))},d.onabort=function(){r.fail(new Error("Aborted to load the image."))},d.onerror=function(){r.fail(new Error("Failed to load the image."))},tr.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(tr.navigator.userAgent)&&(d.crossOrigin="anonymous"),d.alt=u.name,d.src=n.url}},{key:"draw",value:function(n){var r=this,u=n.naturalWidth,d=n.naturalHeight,i=n.rotate,c=i===void 0?0:i,l=n.scaleX,f=l===void 0?1:l,m=n.scaleY,g=m===void 0?1:m,k=this.file,y=this.image,b=this.options,B=document.createElement("canvas"),v=B.getContext("2d"),F=Math.abs(c)%180===90,A=(b.resize==="contain"||b.resize==="cover")&&_u(b.width)&&_u(b.height),E=Math.max(b.maxWidth,0)||1/0,I=Math.max(b.maxHeight,0)||1/0,N=Math.max(b.minWidth,0)||0,x=Math.max(b.minHeight,0)||0,R=u/d,M=b.width,j=b.height;if(F){var T=[I,E];E=T[0],I=T[1];var W=[x,N];N=W[0],x=W[1];var _=[j,M];M=_[0],j=_[1]}A&&(R=M/j);var V=Fi({aspectRatio:R,width:E,height:I},"contain");E=V.width,I=V.height;var L=Fi({aspectRatio:R,width:N,height:x},"cover");if(N=L.width,x=L.height,A){var G=Fi({aspectRatio:R,width:M,height:j},b.resize);M=G.width,j=G.height}else{var Q=Fi({aspectRatio:R,width:M,height:j}),X=Q.width;M=X===void 0?u:X;var q=Q.height;j=q===void 0?d:q}M=Math.floor(sb(Math.min(Math.max(M,N),E))),j=Math.floor(sb(Math.min(Math.max(j,x),I)));var ie=-M/2,se=-j/2,me=M,Fe=j,Ie=[];if(A){var Ve=0,Te=0,He=u,Ye=d,st=Fi({aspectRatio:R,width:u,height:d},{contain:"cover",cover:"contain"}[b.resize]);He=st.width,Ye=st.height,Ve=(u-He)/2,Te=(d-Ye)/2,Ie.push(Ve,Te,He,Ye)}if(Ie.push(ie,se,me,Fe),F){var ot=[j,M];M=ot[0],j=ot[1]}B.width=M,B.height=j,Vc(b.mimeType)||(b.mimeType=k.type);var it="transparent";k.size>b.convertSize&&b.convertTypes.indexOf(b.mimeType)>=0&&(b.mimeType="image/jpeg");var At=b.mimeType==="image/jpeg";if(At&&(it="#fff"),v.fillStyle=it,v.fillRect(0,0,M,j),b.beforeDraw&&b.beforeDraw.call(this,v,B),!this.aborted&&(v.save(),v.translate(M/2,j/2),v.rotate(c*Math.PI/180),v.scale(f,g),v.drawImage.apply(v,[y].concat(Ie)),v.restore(),b.drew&&b.drew.call(this,v,B),!this.aborted)){var jt=function(qe){if(!r.aborted){var $t=function(un){return r.done({naturalWidth:u,naturalHeight:d,result:un})};if(qe&&At&&b.retainExif&&r.exif&&r.exif.length>0){var ro=function(un){return $t(ab(db(jx(un,r.exif),b.mimeType)))};if(qe.arrayBuffer)qe.arrayBuffer().then(ro).catch(function(){r.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var ct=new Qc;r.reader=ct,ct.onload=function(an){var un=an.target;ro(un.result)},ct.onabort=function(){r.fail(new Error("Aborted to read the compressed image with FileReader."))},ct.onerror=function(){r.fail(new Error("Failed to read the compressed image with FileReader."))},ct.onloadend=function(){r.reader=null},ct.readAsArrayBuffer(qe)}}else $t(qe)}};B.toBlob?B.toBlob(jt,b.mimeType,b.quality):jt(ab(B.toDataURL(b.mimeType,b.quality)))}}},{key:"done",value:function(n){var r=n.naturalWidth,u=n.naturalHeight,d=n.result,i=this.file,c=this.image,l=this.options;if(Hr&&c.src.indexOf("blob:")===0&&Hr.revokeObjectURL(c.src),d)if(l.strict&&!l.retainExif&&d.size>i.size&&l.mimeType===i.type&&!(l.width>r||l.height>u||l.minWidth>r||l.minHeight>u||l.maxWidth<r||l.maxHeight<u))d=i;else{var f=new Date;d.lastModified=f.getTime(),d.lastModifiedDate=f,d.name=i.name,d.name&&d.type!==i.type&&(d.name=d.name.replace(Ox,Ex(d.type)))}else d=i;this.result=d,l.success&&l.success.call(this,d)}},{key:"fail",value:function(n){var r=this.options;if(r.error)r.error.call(this,n);else throw n}},{key:"abort",value:function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))}}],[{key:"noConflict",value:function(){return window.Compressor=Rx,t}},{key:"setDefaults",value:function(n){Yu(ib,n)}}]),t}();/*! Bundled license information:
|
|
56
|
+
*/var rx=e.defineComponent({name:"LlInput",__name:"input",props:zh,emits:["update:value","change","clear"],setup(t,{expose:o,emit:n}){const r=ae("input"),u=t,d=n,i=e.ref(""),c=e.ref(),l=e.ref(!1),f=e.computed(()=>i.value),m=()=>{l.value=!0},g=()=>{l.value=!1},k=async v=>{const{value:F}=v.target;i.value=F,await e.nextTick(),!F&&v.type==="click"&&d("clear",F),d("change",v)};e.watch(()=>u.value,v=>{i.value=v},{immediate:!0}),e.watch(i,v=>{d("update:value",v)},{immediate:!0});const y=u.showPassword?ue.Input.Password:ue.Input,b=e.computed(()=>({...Wh.omit(e.useAttrs(),["class","style"]),props:u}));return o({focus:()=>{c.value.focus()}}),(v,F)=>{const A=e.resolveComponent("ll-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(r).b()),onMouseover:m,onMouseout:g},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps({ref_key:"inputRef",ref:c},b.value,{value:i.value,"onUpdate:value":F[0]||(F[0]=E=>i.value=E),"allow-clear":u.allowClear,disabled:u.disabled,class:{"show-clear-icon":u.allowClear&&f.value&&l.value&&!u.disabled},onChange:k}),e.createSlots({_:2},[e.renderList(Object.keys(v.$slots),E=>({name:E,fn:e.withCtx(I=>[e.renderSlot(v.$slots,E,e.normalizeProps(e.guardReactiveProps(I||{})))])})),v.prefixIcon?{name:"prefix",fn:e.withCtx(()=>[e.createVNode(A,{"icon-name":v.prefixIcon,class:"prefix-icon"},null,8,["icon-name"])]),key:"0"}:void 0,v.suffixIcon?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(A,{"icon-name":v.suffixIcon,class:"suffix-icon"},null,8,["icon-name"])]),key:"1"}:void 0]),1040,["value","allow-clear","disabled","class"]))],34)}}}),ax=ne(rx,[["__file","input.vue"]]);const Gh=ge(ax),Uh=ce({value:{type:Z([Number,String]),default:""},thousands:{type:Boolean,default:!1},isAmountChinese:{type:Boolean,default:!1},detailed:{type:Boolean,default:!1},integer:{type:Z(String),default:null}}),Yh={change:t=>!!t,"update:value":t=>!!t},ix={int8:{min:-128,max:127,precision:0},uint8:{min:0,max:255,precision:0},int16:{min:-32768,max:32767,precision:0},uint16:{min:0,max:65535,precision:0},int32:{min:-2147483648,max:2147483647,precision:0},uint32:{min:0,max:4294967295,precision:0},int64:{min:-9223372036854775808n,max:9223372036854775807n,precision:0},uint64:{min:0,max:18446744073709551615n,precision:0}},ux=["title"],dx={key:0},sx={key:1};var cx=e.defineComponent({name:"LlInputNumber",__name:"input-number",props:Uh,emits:Yh,setup(t,{expose:o,emit:n}){const r=t,u=n,d=ae("input-number"),i=e.useAttrs(),c=e.ref(""),l=e.ref(),f=e.computed(()=>{let B={};return r.integer&&(B=ix[r.integer]),B}),m=e.computed(()=>{const B={...i,...f.value};return r.thousands&&(B.formatter=v=>mu(v),B.parser=v=>v.replace(/\$\s?|(,*)/g,"")),B}),g=e.computed(()=>{let B="";return B=!r.isAmountChinese||Br(c.value)?"":np(Number(c.value)),B});e.watch(()=>r.value,B=>{k(B)},{immediate:!0});function k(B){c.value=Br(B)||isNaN(B)?null:B}function y(B){u("update:value",B),u("change",B)}return o({focus:()=>{l.value.focus()}}),(B,v)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(d).b())},[B.detailed?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(d).e("container"))},[e.createVNode(e.unref(ue.InputNumber),e.mergeProps({ref_key:"inputRef",ref:l,value:c.value,"onUpdate:value":v[0]||(v[0]=F=>c.value=F)},m.value,{onChange:y}),e.createSlots({_:2},[e.renderList(Object.keys(B.$slots),F=>({name:F,fn:e.withCtx(A=>[e.renderSlot(B.$slots,F,e.normalizeProps(e.guardReactiveProps(A||{})))])})),m.value.unit?{name:"addonAfter",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d).e("unit"))},e.toDisplayString(m.value.unit),3)]),key:"0"}:void 0]),1040,["value"])],2)),B.detailed?(e.openBlock(),e.createElementBlock("p",{key:1,class:e.normalizeClass(e.unref(d).e("detailed")),title:B.thousands?e.unref(mu)(c.value):c.value},[B.$attrs.addonBefore?(e.openBlock(),e.createElementBlock("span",dx,e.toDisplayString(B.$attrs.addonBefore),1)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(B.thousands?e.unref(mu)(c.value):c.value)+" ",1),B.$attrs.addonAfter?(e.openBlock(),e.createElementBlock("span",sx,e.toDisplayString(B.$attrs.addonAfter),1)):e.createCommentVNode("v-if",!0)],10,ux)):e.createCommentVNode("v-if",!0),B.isAmountChinese&&g.value?(e.openBlock(),e.createElementBlock("p",{key:2,class:e.normalizeClass(e.unref(d).e("amount-chinese-name"))},e.toDisplayString(g.value),3)):e.createCommentVNode("v-if",!0)],2))}}),lx=ne(cx,[["__file","input-number.vue"]]);const Gu=ge(lx),_h=()=>({key:null,value:null}),Kh=ce({value:{type:Z(Array),default:()=>[{key:"",value:""}]},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},keyLabel:{type:String,default:""},valueLabel:{type:String,default:""},addText:{type:String,default:"\u6DFB\u52A0"},keyValueType:{type:Z(String),default:"doubt"},keyType:{type:Z(Object),default:()=>({type:"input",placeholder:"\u8BF7\u8F93\u5165Key"})},keyTypes:{type:Z(Array),default:()=>[]},valueType:{type:Z(Object),default:()=>({type:"input",placeholder:"\u8BF7\u8F93\u5165Value"})},disabledValue:{type:Z(Array),default:()=>[]},disabledKey:{type:Z(Array),default:()=>[]},disabledDelete:{type:Z(Array),default:()=>[]},disabledAdd:{type:Boolean,default:!1},validate:{type:Boolean,default:!1},keepLast:{type:Boolean,default:!0}}),Xh={change:t=>!!t,add:t=>!!t,delete:t=>typeof t=="number","update:value":t=>!!t},fx=[{trigger:["blur","change"],message:"\u6B64\u5B57\u6BB5\u662F\u5FC5\u9700\u7684",validator:async(t,o)=>o?Promise.resolve():Promise.reject(new Error("\u6B64\u5B57\u6BB5\u662F\u5FC5\u9700\u7684"))}],Zh={layout:"horizontal",labelAlign:"left"},Jh=[{key:"other",labelCol:{span:24}}],qh=ce({disabled:{type:Boolean},disabledValue:{type:Z(Array)},disabledKey:{type:Z(Array)},disabledDelete:{type:Z(Array)},keyValueType:{type:Z(String)},keyType:{type:Z(Object)},keyTypes:{type:Z(Array)},valueType:{type:Z(Object)},value:{type:Z(Object),default:()=>({key:"",value:""})},idx:{type:Number,required:!0},keyValueTypeDict:{type:Object,default:()=>({})},showDelete:{type:Boolean,default:!0}}),$h={delete:()=>!0,change:()=>!0,"update:value":t=>!!t};var gx=e.defineComponent({name:"LlKeyValueItem",__name:"key-value-item",props:qh,emits:$h,setup(t,{expose:o,emit:n}){const r=t,u=n,d=e.useAttrs(),i=ae("key-value"),c=e.ref(r.value),l=e.ref(),f=e.computed(()=>r.keyType),m=e.computed(()=>{let I=r.valueType;return c.value.key&&!fu(r.keyValueTypeDict)&&(I=r.keyValueTypeDict[c.value.key]),I}),g=e.computed(()=>r.disabledKey?.includes(r.idx)||r.disabled||f.value?.disabled),k=e.computed(()=>r.disabledValue?.includes(r.idx)||r.disabled||m.value?.disabled),y=e.computed(()=>r.disabledDelete?.includes(r.idx)||r.disabled),b=e.computed(()=>c.value.key||c.value.key===0||c.value.value),B=()=>{u("delete")},v=async()=>{c.value.value=null,await l.value?.clearValidate()},F=async()=>await l.value?.validate(),A=async()=>await l.value?.resetFields(),E=async I=>await l.value?.clearValidate(I);return e.watch(c,async I=>{await e.nextTick().then(()=>{try{u("update:value",I),u("change")}catch(N){console.error(N)}})},{deep:!0}),o({validate:F,resetFields:A,clearValidate:E}),(I,N)=>{const x=e.resolveComponent("ll-select"),R=e.resolveComponent("ll-form-item"),M=e.resolveComponent("ll-icon"),j=e.resolveComponent("ll-button"),T=e.resolveComponent("a-popconfirm"),W=e.resolveComponent("ll-form");return e.openBlock(),e.createBlock(W,{ref_key:"form",ref:l,"form-columns":e.unref(Jh),"form-data":r.value,"form-options":e.unref(Zh)},{formItem:e.withCtx(({item:_})=>[_.key==="other"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i).e("item"))},[r.keyValueType!=="single"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i).m("left"))},[e.createVNode(R,{label:e.unref(d)["key-label"],"label-col":{span:24},rules:f.value.rules||[],name:"key"},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"key",{},()=>[e.unref(fu)(r.keyTypes)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(`ll-${f.value.type}`),e.mergeProps({key:1,value:c.value.key,"onUpdate:value":N[1]||(N[1]=V=>c.value.key=V)},f.value,{disabled:g.value,style:{width:"100%"}}),e.createSlots({_:2},[e.renderList(Object.keys(I.$slots),V=>({name:V,fn:e.withCtx(L=>[e.renderSlot(I.$slots,V,e.mergeProps(L||{},{content:"key"}))])}))]),1040,["value","disabled"])):(e.openBlock(),e.createBlock(x,{key:0,value:c.value.key,"onUpdate:value":N[0]||(N[0]=V=>c.value.key=V),options:r.keyTypes,disabled:g.value,style:{width:"100%"},placeholder:"\u8BF7\u9009\u62E9","allow-clear":"",onChange:v},null,8,["value","options","disabled"]))])]),_:3},8,["label","rules"])],2)):e.createCommentVNode("v-if",!0),r.keyValueType!=="single"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).m("separator")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.renderSlot(I.$slots,"separator",{},()=>[e.createTextVNode("~")])],6)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).m("right"))},[e.createVNode(R,{label:e.unref(d)["value-label"],"label-col":{span:24},rules:m.value.rules||[],name:"value"},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"value-warapper",e.normalizeProps(e.guardReactiveProps(m.value)),()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(`ll-${m.value.type}`),e.mergeProps({value:c.value.value,"onUpdate:value":N[2]||(N[2]=V=>c.value.value=V),disabled:k.value,style:{width:"100%"}},m.value),e.createSlots({_:2},[e.renderList(Object.keys(I.$slots),V=>({name:V,fn:e.withCtx(L=>[e.renderSlot(I.$slots,V,e.mergeProps(L||{},{content:"value"}))])}))]),1040,["value","disabled"]))])]),_:3},8,["label","rules"])],2),r.showDelete?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[b.value?(e.openBlock(),e.createBlock(T,{key:0,title:"\u786E\u5B9A\u8981\u79FB\u9664\u5417?","ok-text":"\u786E\u8BA4","cancel-text":"\u53D6\u6D88",placement:"topRight","overlay-class-name":e.unref(i).m("popconfirm"),"get-popup-container":V=>V.parentNode,"destroy-tooltip-on-hide":"",onConfirm:B},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).m("delete")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.createVNode(j,{type:"link",disabled:y.value},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"delete-icon",{},()=>[e.createVNode(M,{"icon-name":"icon-remove",class:"delete"})])]),_:3},8,["disabled"])],6)]),_:3},8,["overlay-class-name","get-popup-container"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).m("delete")),style:e.normalizeStyle({"margin-top":e.unref(d)["key-label"]||e.unref(d)["value-label"]?"26px":"0px"})},[e.createVNode(j,{type:"link",disabled:y.value,onClick:B},{default:e.withCtx(()=>[e.renderSlot(I.$slots,"delete-icon",{},()=>[e.createVNode(M,{"icon-name":"icon-remove",class:"delete"})])]),_:3},8,["disabled"])],6))],64)):e.createCommentVNode("v-if",!0)],2)):e.createCommentVNode("v-if",!0)]),_:3},8,["form-columns","form-data","form-options"])}}}),px=ne(gx,[["__file","key-value-item.vue"]]),mx=e.defineComponent({name:"LlKeyValue",__name:"key-value",props:Kh,emits:Xh,setup(t,{expose:o,emit:n}){const r=t,u=n,d=ae("key-value"),i=ue.Form.useInjectFormItemContext(),c=e.ref([]),l=e.ref([]),f=e.computed(()=>{const v={};return r.keyTypes.map(F=>{v[F.value]=F.option}),v}),m=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.validate()))),g=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.resetFields()))),k=async()=>(await e.nextTick(),Promise.all(l.value.filter(v=>!!v).map(v=>v.clearValidate()))),y=async()=>{const v=await m();if(r.validate&&!v)return!1;c.value.push(_h()),u("add",{index:c.value.length-1,item:c.value[c.value.length-1],value:c.value}),B()},b=v=>{c.value.splice(v,1),u("delete",v),B()},B=()=>{try{i.onFieldChange(),u("change",c.value),u("update:value",c.value)}catch(v){console.error(v)}};return e.watch(()=>r.value,v=>{c.value=v&&v.length>0?v:r.keepLast?[{key:null,value:null}]:v},{immediate:!0,deep:!0}),o({validate:m,resetFields:g,clearValidate:k}),(v,F)=>{const A=e.resolveComponent("ll-icon"),E=e.resolveComponent("ll-button"),I=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(d).b())},[e.createVNode(I,{spinning:r.loading},{default:e.withCtx(()=>[c.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(d).e("list"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(N,x)=>(e.openBlock(),e.createBlock(px,{key:N,ref_for:!0,ref:R=>l.value[x]=R,value:c.value[x],"onUpdate:value":R=>c.value[x]=R,idx:x,"key-label":r.keyLabel,"value-label":r.valueLabel,"key-value-type-dict":f.value,"key-value-type":r.keyValueType,"key-type":r.keyType,"key-types":r.keyTypes,"value-type":r.valueType,disabled:r.disabled,"disabled-value":r.disabledValue,"disabled-key":r.disabledKey,"disabled-delete":r.disabledDelete,"show-delete":r.keepLast?x>0:!0,onDelete:R=>b(x),onChange:B},e.createSlots({_:2},[e.renderList(Object.keys(v.$slots),R=>({name:R,fn:e.withCtx(M=>[e.renderSlot(v.$slots,R,e.mergeProps({ref_for:!0},M||{},{index:x}))])}))]),1032,["value","onUpdate:value","idx","key-label","value-label","key-value-type-dict","key-value-type","key-type","key-types","value-type","disabled","disabled-value","disabled-key","disabled-delete","show-delete","onDelete"]))),128))],2)):e.createCommentVNode("v-if",!0),e.createVNode(E,{class:e.normalizeClass(e.unref(d).e("add")),loading:v.loading,disabled:r.disabled||r.disabledAdd,onClick:y},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d).e("plus"))},[v.loading?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(A,{key:0,"icon-name":"icon-add",class:e.normalizeClass(e.unref(d).e("icon-add"))},null,8,["class"])),e.createTextVNode(" "+e.toDisplayString(r.addText),1)],2)]),_:1},8,["class","loading","disabled"])]),_:3},8,["spinning"])],2)}}}),kx=ne(mx,[["__file","key-value.vue"]]);const eb=ge(kx);function tb(t,o){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable})),n.push.apply(n,r)}return n}function Uu(t){for(var o=1;o<arguments.length;o++){var n=arguments[o]!=null?arguments[o]:{};o%2?tb(Object(n),!0).forEach(function(r){bx(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tb(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yx(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function ob(t,o){for(var n=0;n<o.length;n++){var r=o[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nb(r.key),r)}}function hx(t,o,n){return o&&ob(t.prototype,o),n&&ob(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bx(t,o,n){return o=nb(o),o in t?Object.defineProperty(t,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[o]=n,t}function Yu(){return Yu=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Yu.apply(this,arguments)}function vx(t,o){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,o||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function nb(t){var o=vx(t,"string");return typeof o=="symbol"?o:String(o)}var rb={exports:{}};(function(t){typeof window>"u"||function(o){var n=o.HTMLCanvasElement&&o.HTMLCanvasElement.prototype,r=o.Blob&&function(){try{return!!new Blob}catch{return!1}}(),u=r&&o.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),d=o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,c=(r||d)&&o.atob&&o.ArrayBuffer&&o.Uint8Array&&function(l){var f,m,g,k,y,b,B,v,F;if(f=l.match(i),!f)throw new Error("invalid data URI");for(m=f[2]?f[1]:"text/plain"+(f[3]||";charset=US-ASCII"),g=!!f[4],k=l.slice(f[0].length),g?y=atob(k):y=decodeURIComponent(k),b=new ArrayBuffer(y.length),B=new Uint8Array(b),v=0;v<y.length;v+=1)B[v]=y.charCodeAt(v);return r?new Blob([u?B:b],{type:m}):(F=new d,F.append(b),F.getBlob(m))};o.HTMLCanvasElement&&!n.toBlob&&(n.mozGetAsFile?n.toBlob=function(l,f,m){var g=this;setTimeout(function(){m&&n.toDataURL&&c?l(c(g.toDataURL(f,m))):l(g.mozGetAsFile("blob",f))})}:n.toDataURL&&c&&(n.msToBlob?n.toBlob=function(l,f,m){var g=this;setTimeout(function(){(f&&f!=="image/png"||m)&&n.toDataURL&&c?l(c(g.toDataURL(f,m))):l(g.msToBlob(f))})}:n.toBlob=function(l,f,m){var g=this;setTimeout(function(){l(c(g.toDataURL(f,m)))})})),t.exports?t.exports=c:o.dataURLtoBlob=c}(window)})(rb);var ab=rb.exports,Bx=function(o){return typeof Blob>"u"?!1:o instanceof Blob||Object.prototype.toString.call(o)==="[object Blob]"},ib={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},Fx=typeof window<"u"&&typeof window.document<"u",tr=Fx?window:{},_u=function(o){return o>0&&o<1/0},Ax=Array.prototype.slice;function Pc(t){return Array.from?Array.from(t):Ax.call(t)}var Cx=/^image\/.+$/;function Vc(t){return Cx.test(t)}function Ex(t){var o=Vc(t)?t.substr(6):"";return o==="jpeg"&&(o="jpg"),".".concat(o)}var ub=String.fromCharCode;function wx(t,o,n){var r="",u;for(n+=o,u=o;u<n;u+=1)r+=ub(t.getUint8(u));return r}var Sx=tr.btoa;function db(t,o){for(var n=[],r=8192,u=new Uint8Array(t);u.length>0;)n.push(ub.apply(null,Pc(u.subarray(0,r)))),u=u.subarray(r);return"data:".concat(o,";base64,").concat(Sx(n.join("")))}function Dx(t){var o=new DataView(t),n;try{var r,u,d;if(o.getUint8(0)===255&&o.getUint8(1)===216)for(var i=o.byteLength,c=2;c+1<i;){if(o.getUint8(c)===255&&o.getUint8(c+1)===225){u=c;break}c+=1}if(u){var l=u+4,f=u+10;if(wx(o,l,4)==="Exif"){var m=o.getUint16(f);if(r=m===18761,(r||m===19789)&&o.getUint16(f+2,r)===42){var g=o.getUint32(f+4,r);g>=8&&(d=f+g)}}}if(d){var k=o.getUint16(d,r),y,b;for(b=0;b<k;b+=1)if(y=d+b*12+2,o.getUint16(y,r)===274){y+=8,n=o.getUint16(y,r),o.setUint16(y,1,r);break}}}catch{n=1}return n}function Ix(t){var o=0,n=1,r=1;switch(t){case 2:n=-1;break;case 3:o=-180;break;case 4:r=-1;break;case 5:o=90,r=-1;break;case 6:o=90;break;case 7:o=90,n=-1;break;case 8:o=-90;break}return{rotate:o,scaleX:n,scaleY:r}}var xx=/\.\d*(?:0|9){12}\d*$/;function sb(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return xx.test(t)?Math.round(t*o)/o:t}function Fi(t){var o=t.aspectRatio,n=t.height,r=t.width,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",d=_u(r),i=_u(n);if(d&&i){var c=n*o;(u==="contain"||u==="none")&&c>r||u==="cover"&&c<r?n=r/o:r=n*o}else d?n=r/o:i&&(r=n*o);return{width:r,height:n}}function Tx(t){for(var o=Pc(new Uint8Array(t)),n=o.length,r=[],u=0;u+3<n;){var d=o[u],i=o[u+1];if(d===255&&i===218)break;if(d===255&&i===216)u+=2;else{var c=o[u+2]*256+o[u+3],l=u+c+2,f=o.slice(u,l);r.push(f),u=l}}return r.reduce(function(m,g){return g[0]===255&&g[1]===225?m.concat(g):m},[])}function jx(t,o){var n=Pc(new Uint8Array(t));if(n[2]!==255||n[3]!==224)return t;var r=n[4]*256+n[5],u=[255,216].concat(o,n.slice(4+r));return new Uint8Array(u)}var Nx=tr.ArrayBuffer,Qc=tr.FileReader,Hr=tr.URL||tr.webkitURL,Ox=/\.\w+$/,Rx=tr.Compressor,Lx=function(){function t(o,n){yx(this,t),this.file=o,this.exif=[],this.image=new Image,this.options=Uu(Uu({},ib),n),this.aborted=!1,this.result=null,this.init()}return hx(t,[{key:"init",value:function(){var n=this,r=this.file,u=this.options;if(!Bx(r)){this.fail(new Error("The first argument must be a File or Blob object."));return}var d=r.type;if(!Vc(d)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!Hr||!Qc){this.fail(new Error("The current browser does not support image compression."));return}Nx||(u.checkOrientation=!1,u.retainExif=!1);var i=d==="image/jpeg",c=i&&u.checkOrientation,l=i&&u.retainExif;if(Hr&&!c&&!l)this.load({url:Hr.createObjectURL(r)});else{var f=new Qc;this.reader=f,f.onload=function(m){var g=m.target,k=g.result,y={},b=1;c&&(b=Dx(k),b>1&&Yu(y,Ix(b))),l&&(n.exif=Tx(k)),c||l?!Hr||b>1?y.url=db(k,d):y.url=Hr.createObjectURL(r):y.url=k,n.load(y)},f.onabort=function(){n.fail(new Error("Aborted to read the image with FileReader."))},f.onerror=function(){n.fail(new Error("Failed to read the image with FileReader."))},f.onloadend=function(){n.reader=null},c||l?f.readAsArrayBuffer(r):f.readAsDataURL(r)}}},{key:"load",value:function(n){var r=this,u=this.file,d=this.image;d.onload=function(){r.draw(Uu(Uu({},n),{},{naturalWidth:d.naturalWidth,naturalHeight:d.naturalHeight}))},d.onabort=function(){r.fail(new Error("Aborted to load the image."))},d.onerror=function(){r.fail(new Error("Failed to load the image."))},tr.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(tr.navigator.userAgent)&&(d.crossOrigin="anonymous"),d.alt=u.name,d.src=n.url}},{key:"draw",value:function(n){var r=this,u=n.naturalWidth,d=n.naturalHeight,i=n.rotate,c=i===void 0?0:i,l=n.scaleX,f=l===void 0?1:l,m=n.scaleY,g=m===void 0?1:m,k=this.file,y=this.image,b=this.options,B=document.createElement("canvas"),v=B.getContext("2d"),F=Math.abs(c)%180===90,A=(b.resize==="contain"||b.resize==="cover")&&_u(b.width)&&_u(b.height),E=Math.max(b.maxWidth,0)||1/0,I=Math.max(b.maxHeight,0)||1/0,N=Math.max(b.minWidth,0)||0,x=Math.max(b.minHeight,0)||0,R=u/d,M=b.width,j=b.height;if(F){var T=[I,E];E=T[0],I=T[1];var W=[x,N];N=W[0],x=W[1];var _=[j,M];M=_[0],j=_[1]}A&&(R=M/j);var V=Fi({aspectRatio:R,width:E,height:I},"contain");E=V.width,I=V.height;var L=Fi({aspectRatio:R,width:N,height:x},"cover");if(N=L.width,x=L.height,A){var G=Fi({aspectRatio:R,width:M,height:j},b.resize);M=G.width,j=G.height}else{var Q=Fi({aspectRatio:R,width:M,height:j}),X=Q.width;M=X===void 0?u:X;var q=Q.height;j=q===void 0?d:q}M=Math.floor(sb(Math.min(Math.max(M,N),E))),j=Math.floor(sb(Math.min(Math.max(j,x),I)));var ie=-M/2,se=-j/2,me=M,Fe=j,Ie=[];if(A){var Ve=0,Te=0,He=u,Ye=d,st=Fi({aspectRatio:R,width:u,height:d},{contain:"cover",cover:"contain"}[b.resize]);He=st.width,Ye=st.height,Ve=(u-He)/2,Te=(d-Ye)/2,Ie.push(Ve,Te,He,Ye)}if(Ie.push(ie,se,me,Fe),F){var ot=[j,M];M=ot[0],j=ot[1]}B.width=M,B.height=j,Vc(b.mimeType)||(b.mimeType=k.type);var it="transparent";k.size>b.convertSize&&b.convertTypes.indexOf(b.mimeType)>=0&&(b.mimeType="image/jpeg");var At=b.mimeType==="image/jpeg";if(At&&(it="#fff"),v.fillStyle=it,v.fillRect(0,0,M,j),b.beforeDraw&&b.beforeDraw.call(this,v,B),!this.aborted&&(v.save(),v.translate(M/2,j/2),v.rotate(c*Math.PI/180),v.scale(f,g),v.drawImage.apply(v,[y].concat(Ie)),v.restore(),b.drew&&b.drew.call(this,v,B),!this.aborted)){var jt=function(qe){if(!r.aborted){var $t=function(un){return r.done({naturalWidth:u,naturalHeight:d,result:un})};if(qe&&At&&b.retainExif&&r.exif&&r.exif.length>0){var ro=function(un){return $t(ab(db(jx(un,r.exif),b.mimeType)))};if(qe.arrayBuffer)qe.arrayBuffer().then(ro).catch(function(){r.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var ct=new Qc;r.reader=ct,ct.onload=function(an){var un=an.target;ro(un.result)},ct.onabort=function(){r.fail(new Error("Aborted to read the compressed image with FileReader."))},ct.onerror=function(){r.fail(new Error("Failed to read the compressed image with FileReader."))},ct.onloadend=function(){r.reader=null},ct.readAsArrayBuffer(qe)}}else $t(qe)}};B.toBlob?B.toBlob(jt,b.mimeType,b.quality):jt(ab(B.toDataURL(b.mimeType,b.quality)))}}},{key:"done",value:function(n){var r=n.naturalWidth,u=n.naturalHeight,d=n.result,i=this.file,c=this.image,l=this.options;if(Hr&&c.src.indexOf("blob:")===0&&Hr.revokeObjectURL(c.src),d)if(l.strict&&!l.retainExif&&d.size>i.size&&l.mimeType===i.type&&!(l.width>r||l.height>u||l.minWidth>r||l.minHeight>u||l.maxWidth<r||l.maxHeight<u))d=i;else{var f=new Date;d.lastModified=f.getTime(),d.lastModifiedDate=f,d.name=i.name,d.name&&d.type!==i.type&&(d.name=d.name.replace(Ox,Ex(d.type)))}else d=i;this.result=d,l.success&&l.success.call(this,d)}},{key:"fail",value:function(n){var r=this.options;if(r.error)r.error.call(this,n);else throw n}},{key:"abort",value:function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))}}],[{key:"noConflict",value:function(){return window.Compressor=Rx,t}},{key:"setDefaults",value:function(n){Yu(ib,n)}}]),t}();/*! Bundled license information:
|
|
57
57
|
|
|
58
58
|
compressorjs/dist/compressor.esm.js:
|
|
59
59
|
(*!
|