@davincihealthcare/elty-design-system-vue 1.81.1 → 1.83.0

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.
@@ -7,6 +7,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
7
7
  status?: ElInlineBannerStatuses;
8
8
  title?: string;
9
9
  description: string;
10
+ html?: boolean;
10
11
  loading?: boolean;
11
12
  action?: Pick<InstanceType<typeof ElButton>["$props"], "label" | "variant" | "onClick" | "icon" | "iconRight" | "loading" | "loadOnClick">;
12
13
  icon?: InstanceType<typeof ElIcon>["$props"];
@@ -19,6 +20,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
19
20
  status?: ElInlineBannerStatuses;
20
21
  title?: string;
21
22
  description: string;
23
+ html?: boolean;
22
24
  loading?: boolean;
23
25
  action?: Pick<InstanceType<typeof ElButton>["$props"], "label" | "variant" | "onClick" | "icon" | "iconRight" | "loading" | "loadOnClick">;
24
26
  icon?: InstanceType<typeof ElIcon>["$props"];
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),i=require("./ElIcon.vue.cjs2.js"),s=require("./ElButton.vue.cjs2.js"),c=require("./ElSpinner.vue.cjs2.js"),u={class:"flex flex-row items-start gap-x-2 flex-grow basis-64"},d={class:"text-sm flex flex-col flex-grow mt-0.5"},p={key:0,class:"font-semibold min-h-6"},f={key:1},m=["error","warning","info"],v=t.defineComponent({__name:"ElInlineBanner",props:{status:{default:"info"},title:{default:void 0},description:{},loading:{type:Boolean},action:{default:void 0},icon:{default:void 0}},setup(o){const n=o,l=t.computed(()=>{var e;if((e=n.icon)!=null&&e.name)return n.icon.name;switch(n.status){case"info":return"InformationCircleIcon";case"warning":return"ExclamationTriangleIcon";case"error":return"InformationCircleIcon";default:return"InformationCircleIcon"}});return(e,g)=>{var r,a;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md",{"bg-brandBlue-50 text-brandBlue-800":e.status==="info","bg-yellow-50 text-yellow-700":e.status==="warning","bg-red-50 text-red-700":e.status==="error"}])},[t.createElementVNode("div",u,[e.loading?(t.openBlock(),t.createBlock(c.default,{key:0,class:"flex-shrink-0 px-1 pt-1"})):(t.openBlock(),t.createBlock(i.default,t.mergeProps({key:1},e.icon,{name:l.value,class:["w-6 h-6 flex-shrink-0",{"text-brandBlue-500":e.status==="info","text-yellow-500":e.status==="warning","text-red-500":e.status==="error"}]}),null,16,["name","class"])),t.createElementVNode("div",d,[e.title?(t.openBlock(),t.createElementBlock("span",p,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),e.description?(t.openBlock(),t.createElementBlock("span",f,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),e.action?(t.openBlock(),t.createBlock(s.default,t.mergeProps({key:0},e.action,{variant:e.action.variant??"tertiary",class:["flex-shrink-0",{underline:!e.action.variant||e.action.variant==="tertiary","text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100":e.status==="error","text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100":e.status==="warning","text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent":e.status==="info"}],label:(r=e.action)==null?void 0:r.label,onClick:(a=e.action)==null?void 0:a.onClick}),null,16,["variant","class","label","onClick"])):t.createCommentVNode("",!0)],2)}}});exports.default=v;exports.elInlineBannerStatuses=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("./ElIcon.vue.cjs2.js"),s=require("./ElButton.vue.cjs2.js"),c=require("./ElSpinner.vue.cjs2.js"),u={class:"flex flex-row items-start gap-x-2 flex-grow basis-64"},d={class:"text-sm flex flex-col flex-grow mt-0.5"},p=["innerHTML"],m=["innerHTML"],f={key:0,class:"font-semibold min-h-6"},k={key:1},g=["error","warning","info"],v=e.defineComponent({__name:"ElInlineBanner",props:{status:{default:"info"},title:{default:void 0},description:{},html:{type:Boolean},loading:{type:Boolean},action:{default:void 0},icon:{default:void 0}},setup(l){const n=l,a=e.computed(()=>{var t;if((t=n.icon)!=null&&t.name)return n.icon.name;switch(n.status){case"info":return"InformationCircleIcon";case"warning":return"ExclamationTriangleIcon";case"error":return"InformationCircleIcon";default:return"InformationCircleIcon"}});return(t,B)=>{var o,r;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md",{"bg-brandBlue-50 text-brandBlue-800":t.status==="info","bg-yellow-50 text-yellow-700":t.status==="warning","bg-red-50 text-red-700":t.status==="error"}])},[e.createElementVNode("div",u,[t.loading?(e.openBlock(),e.createBlock(c.default,{key:0,class:"flex-shrink-0 px-1 pt-1"})):(e.openBlock(),e.createBlock(i.default,e.mergeProps({key:1},t.icon,{name:a.value,class:["w-6 h-6 flex-shrink-0",{"text-brandBlue-500":t.status==="info","text-yellow-500":t.status==="warning","text-red-500":t.status==="error"}]}),null,16,["name","class"])),e.createElementVNode("div",d,[t.html?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"font-semibold min-h-6",innerHTML:t.title},null,8,p)):e.createCommentVNode("",!0),t.description?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:t.description},null,8,m)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.title?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.description?(e.openBlock(),e.createElementBlock("span",k,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)],64))])]),t.action?(e.openBlock(),e.createBlock(s.default,e.mergeProps({key:0},t.action,{variant:t.action.variant??"tertiary",class:["flex-shrink-0",{underline:!t.action.variant||t.action.variant==="tertiary","text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100":t.status==="error","text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100":t.status==="warning","text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent":t.status==="info"}],label:(o=t.action)==null?void 0:o.label,onClick:(r=t.action)==null?void 0:r.onClick}),null,16,["variant","class","label","onClick"])):e.createCommentVNode("",!0)],2)}}});exports.default=v;exports.elInlineBannerStatuses=g;
2
2
  //# sourceMappingURL=ElInlineBanner.vue.cjs2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElInlineBanner.vue.cjs2.js","sources":["../../src/ElInlineBanner.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInlineBannerStatuses = ['error', 'warning', 'info'] as const;\nexport type ElInlineBannerStatuses = (typeof elInlineBannerStatuses)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElButton from '@/ElButton.vue';\nimport ElSpinner from '@/ElSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n status?: ElInlineBannerStatuses;\n title?: string;\n description: string;\n loading?: boolean;\n action?: Pick<\n InstanceType<typeof ElButton>['$props'],\n 'label' | 'variant' | 'onClick' | 'icon' | 'iconRight' | 'loading' | 'loadOnClick'\n >;\n icon?: InstanceType<typeof ElIcon>['$props'];\n }>(),\n {\n status: 'info',\n title: undefined,\n action: undefined,\n icon: undefined,\n },\n);\n\nconst iconName = computed(() => {\n if (props.icon?.name) return props.icon.name;\n\n switch (props.status) {\n case 'info':\n return 'InformationCircleIcon';\n case 'warning':\n return 'ExclamationTriangleIcon';\n case 'error':\n return 'InformationCircleIcon';\n default:\n return 'InformationCircleIcon';\n }\n});\n</script>\n\n<template>\n <div\n class=\"inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md\"\n :class=\"{\n 'bg-brandBlue-50 text-brandBlue-800': status === 'info',\n 'bg-yellow-50 text-yellow-700': status === 'warning',\n 'bg-red-50 text-red-700': status === 'error',\n }\"\n >\n <div class=\"flex flex-row items-start gap-x-2 flex-grow basis-64\">\n <ElSpinner v-if=\"loading\" class=\"flex-shrink-0 px-1 pt-1\" />\n <ElIcon\n v-else\n v-bind=\"icon\"\n :name=\"iconName\"\n class=\"w-6 h-6 flex-shrink-0\"\n :class=\"{\n 'text-brandBlue-500': status === 'info',\n 'text-yellow-500': status === 'warning',\n 'text-red-500': status === 'error',\n }\"\n />\n <div class=\"text-sm flex flex-col flex-grow mt-0.5\">\n <span v-if=\"title\" class=\"font-semibold min-h-6\">{{ title }}</span>\n <span v-if=\"description\">{{ description }}</span>\n </div>\n </div>\n <ElButton\n v-if=\"action\"\n v-bind=\"action\"\n :variant=\"action.variant ?? 'tertiary'\"\n class=\"flex-shrink-0\"\n :class=\"{\n underline: !action.variant || action.variant === 'tertiary',\n 'text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100': status === 'error',\n 'text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100': status === 'warning',\n 'text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent': status === 'info',\n }\"\n :label=\"action?.label\"\n @click=\"action?.onClick\"\n />\n </div>\n</template>\n"],"names":["elInlineBannerStatuses","props","__props","iconName","computed","_a"],"mappings":"oZACaA,EAAyB,CAAC,QAAS,UAAW,MAAM,mMAUjE,MAAMC,EAAQC,EAoBRC,EAAWC,EAAAA,SAAS,IAAM,OAC9B,IAAIC,EAAAJ,EAAM,OAAN,MAAAI,EAAY,KAAM,OAAOJ,EAAM,KAAK,KAExC,OAAQA,EAAM,OAAQ,CACpB,IAAK,OACI,MAAA,wBACT,IAAK,UACI,MAAA,0BACT,IAAK,QACI,MAAA,wBACT,QACS,MAAA,uBACX,CAAA,CACD"}
1
+ {"version":3,"file":"ElInlineBanner.vue.cjs2.js","sources":["../../src/ElInlineBanner.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInlineBannerStatuses = ['error', 'warning', 'info'] as const;\nexport type ElInlineBannerStatuses = (typeof elInlineBannerStatuses)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElButton from '@/ElButton.vue';\nimport ElSpinner from '@/ElSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n status?: ElInlineBannerStatuses;\n title?: string;\n description: string;\n html?: boolean;\n loading?: boolean;\n action?: Pick<\n InstanceType<typeof ElButton>['$props'],\n 'label' | 'variant' | 'onClick' | 'icon' | 'iconRight' | 'loading' | 'loadOnClick'\n >;\n icon?: InstanceType<typeof ElIcon>['$props'];\n }>(),\n {\n status: 'info',\n title: undefined,\n action: undefined,\n icon: undefined,\n },\n);\n\nconst iconName = computed(() => {\n if (props.icon?.name) return props.icon.name;\n\n switch (props.status) {\n case 'info':\n return 'InformationCircleIcon';\n case 'warning':\n return 'ExclamationTriangleIcon';\n case 'error':\n return 'InformationCircleIcon';\n default:\n return 'InformationCircleIcon';\n }\n});\n</script>\n\n<template>\n <div\n class=\"inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md\"\n :class=\"{\n 'bg-brandBlue-50 text-brandBlue-800': status === 'info',\n 'bg-yellow-50 text-yellow-700': status === 'warning',\n 'bg-red-50 text-red-700': status === 'error',\n }\"\n >\n <div class=\"flex flex-row items-start gap-x-2 flex-grow basis-64\">\n <ElSpinner v-if=\"loading\" class=\"flex-shrink-0 px-1 pt-1\" />\n <ElIcon\n v-else\n v-bind=\"icon\"\n :name=\"iconName\"\n class=\"w-6 h-6 flex-shrink-0\"\n :class=\"{\n 'text-brandBlue-500': status === 'info',\n 'text-yellow-500': status === 'warning',\n 'text-red-500': status === 'error',\n }\"\n />\n <div class=\"text-sm flex flex-col flex-grow mt-0.5\">\n <template v-if=\"!!html\">\n <span v-if=\"title\" class=\"font-semibold min-h-6\" v-html=\"title\"></span>\n <span v-if=\"description\" v-html=\"description\"></span>\n </template>\n <template v-else>\n <span v-if=\"title\" class=\"font-semibold min-h-6\">{{ title }}</span>\n <span v-if=\"description\">{{ description }}</span>\n </template>\n </div>\n </div>\n <ElButton\n v-if=\"action\"\n v-bind=\"action\"\n :variant=\"action.variant ?? 'tertiary'\"\n class=\"flex-shrink-0\"\n :class=\"{\n underline: !action.variant || action.variant === 'tertiary',\n 'text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100': status === 'error',\n 'text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100': status === 'warning',\n 'text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent': status === 'info',\n }\"\n :label=\"action?.label\"\n @click=\"action?.onClick\"\n />\n </div>\n</template>\n"],"names":["elInlineBannerStatuses","props","__props","iconName","computed","_a"],"mappings":"obACaA,EAAyB,CAAC,QAAS,UAAW,MAAM,uNAUjE,MAAMC,EAAQC,EAqBRC,EAAWC,EAAAA,SAAS,IAAM,OAC9B,IAAIC,EAAAJ,EAAM,OAAN,MAAAI,EAAY,KAAM,OAAOJ,EAAM,KAAK,KAExC,OAAQA,EAAM,OAAQ,CACpB,IAAK,OACI,MAAA,wBACT,IAAK,UACI,MAAA,0BACT,IAAK,QACI,MAAA,wBACT,QACS,MAAA,uBACX,CAAA,CACD"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as m,computed as p,openBlock as t,createElementBlock as r,normalizeClass as g,createElementVNode as l,createBlock as a,mergeProps as c,toDisplayString as d,createCommentVNode as o}from"vue";import v from"./ElIcon.vue.esm2.js";import w from"./ElButton.vue.esm2.js";import b from"./ElSpinner.vue.esm2.js";const y={class:"flex flex-row items-start gap-x-2 flex-grow basis-64"},h={class:"text-sm flex flex-col flex-grow mt-0.5"},k={key:0,class:"font-semibold min-h-6"},B={key:1},$=["error","warning","info"],S=m({__name:"ElInlineBanner",props:{status:{default:"info"},title:{default:void 0},description:{},loading:{type:Boolean},action:{default:void 0},icon:{default:void 0}},setup(u){const n=u,f=p(()=>{var e;if((e=n.icon)!=null&&e.name)return n.icon.name;switch(n.status){case"info":return"InformationCircleIcon";case"warning":return"ExclamationTriangleIcon";case"error":return"InformationCircleIcon";default:return"InformationCircleIcon"}});return(e,x)=>{var i,s;return t(),r("div",{class:g(["inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md",{"bg-brandBlue-50 text-brandBlue-800":e.status==="info","bg-yellow-50 text-yellow-700":e.status==="warning","bg-red-50 text-red-700":e.status==="error"}])},[l("div",y,[e.loading?(t(),a(b,{key:0,class:"flex-shrink-0 px-1 pt-1"})):(t(),a(v,c({key:1},e.icon,{name:f.value,class:["w-6 h-6 flex-shrink-0",{"text-brandBlue-500":e.status==="info","text-yellow-500":e.status==="warning","text-red-500":e.status==="error"}]}),null,16,["name","class"])),l("div",h,[e.title?(t(),r("span",k,d(e.title),1)):o("",!0),e.description?(t(),r("span",B,d(e.description),1)):o("",!0)])]),e.action?(t(),a(w,c({key:0},e.action,{variant:e.action.variant??"tertiary",class:["flex-shrink-0",{underline:!e.action.variant||e.action.variant==="tertiary","text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100":e.status==="error","text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100":e.status==="warning","text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent":e.status==="info"}],label:(i=e.action)==null?void 0:i.label,onClick:(s=e.action)==null?void 0:s.onClick}),null,16,["variant","class","label","onClick"])):o("",!0)],2)}}});export{S as default,$ as elInlineBannerStatuses};
1
+ import{defineComponent as p,computed as g,openBlock as n,createElementBlock as t,normalizeClass as y,createElementVNode as l,createBlock as o,mergeProps as c,Fragment as d,createCommentVNode as r,toDisplayString as u}from"vue";import h from"./ElIcon.vue.esm2.js";import v from"./ElButton.vue.esm2.js";import w from"./ElSpinner.vue.esm2.js";const b={class:"flex flex-row items-start gap-x-2 flex-grow basis-64"},k={class:"text-sm flex flex-col flex-grow mt-0.5"},B=["innerHTML"],C=["innerHTML"],I={key:0,class:"font-semibold min-h-6"},x={key:1},N=["error","warning","info"],$=p({__name:"ElInlineBanner",props:{status:{default:"info"},title:{default:void 0},description:{},html:{type:Boolean},loading:{type:Boolean},action:{default:void 0},icon:{default:void 0}},setup(m){const a=m,f=g(()=>{var e;if((e=a.icon)!=null&&e.name)return a.icon.name;switch(a.status){case"info":return"InformationCircleIcon";case"warning":return"ExclamationTriangleIcon";case"error":return"InformationCircleIcon";default:return"InformationCircleIcon"}});return(e,T)=>{var i,s;return n(),t("div",{class:y(["inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md",{"bg-brandBlue-50 text-brandBlue-800":e.status==="info","bg-yellow-50 text-yellow-700":e.status==="warning","bg-red-50 text-red-700":e.status==="error"}])},[l("div",b,[e.loading?(n(),o(w,{key:0,class:"flex-shrink-0 px-1 pt-1"})):(n(),o(h,c({key:1},e.icon,{name:f.value,class:["w-6 h-6 flex-shrink-0",{"text-brandBlue-500":e.status==="info","text-yellow-500":e.status==="warning","text-red-500":e.status==="error"}]}),null,16,["name","class"])),l("div",k,[e.html?(n(),t(d,{key:0},[e.title?(n(),t("span",{key:0,class:"font-semibold min-h-6",innerHTML:e.title},null,8,B)):r("",!0),e.description?(n(),t("span",{key:1,innerHTML:e.description},null,8,C)):r("",!0)],64)):(n(),t(d,{key:1},[e.title?(n(),t("span",I,u(e.title),1)):r("",!0),e.description?(n(),t("span",x,u(e.description),1)):r("",!0)],64))])]),e.action?(n(),o(v,c({key:0},e.action,{variant:e.action.variant??"tertiary",class:["flex-shrink-0",{underline:!e.action.variant||e.action.variant==="tertiary","text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100":e.status==="error","text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100":e.status==="warning","text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent":e.status==="info"}],label:(i=e.action)==null?void 0:i.label,onClick:(s=e.action)==null?void 0:s.onClick}),null,16,["variant","class","label","onClick"])):r("",!0)],2)}}});export{$ as default,N as elInlineBannerStatuses};
2
2
  //# sourceMappingURL=ElInlineBanner.vue.esm2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElInlineBanner.vue.esm2.js","sources":["../../src/ElInlineBanner.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInlineBannerStatuses = ['error', 'warning', 'info'] as const;\nexport type ElInlineBannerStatuses = (typeof elInlineBannerStatuses)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElButton from '@/ElButton.vue';\nimport ElSpinner from '@/ElSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n status?: ElInlineBannerStatuses;\n title?: string;\n description: string;\n loading?: boolean;\n action?: Pick<\n InstanceType<typeof ElButton>['$props'],\n 'label' | 'variant' | 'onClick' | 'icon' | 'iconRight' | 'loading' | 'loadOnClick'\n >;\n icon?: InstanceType<typeof ElIcon>['$props'];\n }>(),\n {\n status: 'info',\n title: undefined,\n action: undefined,\n icon: undefined,\n },\n);\n\nconst iconName = computed(() => {\n if (props.icon?.name) return props.icon.name;\n\n switch (props.status) {\n case 'info':\n return 'InformationCircleIcon';\n case 'warning':\n return 'ExclamationTriangleIcon';\n case 'error':\n return 'InformationCircleIcon';\n default:\n return 'InformationCircleIcon';\n }\n});\n</script>\n\n<template>\n <div\n class=\"inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md\"\n :class=\"{\n 'bg-brandBlue-50 text-brandBlue-800': status === 'info',\n 'bg-yellow-50 text-yellow-700': status === 'warning',\n 'bg-red-50 text-red-700': status === 'error',\n }\"\n >\n <div class=\"flex flex-row items-start gap-x-2 flex-grow basis-64\">\n <ElSpinner v-if=\"loading\" class=\"flex-shrink-0 px-1 pt-1\" />\n <ElIcon\n v-else\n v-bind=\"icon\"\n :name=\"iconName\"\n class=\"w-6 h-6 flex-shrink-0\"\n :class=\"{\n 'text-brandBlue-500': status === 'info',\n 'text-yellow-500': status === 'warning',\n 'text-red-500': status === 'error',\n }\"\n />\n <div class=\"text-sm flex flex-col flex-grow mt-0.5\">\n <span v-if=\"title\" class=\"font-semibold min-h-6\">{{ title }}</span>\n <span v-if=\"description\">{{ description }}</span>\n </div>\n </div>\n <ElButton\n v-if=\"action\"\n v-bind=\"action\"\n :variant=\"action.variant ?? 'tertiary'\"\n class=\"flex-shrink-0\"\n :class=\"{\n underline: !action.variant || action.variant === 'tertiary',\n 'text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100': status === 'error',\n 'text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100': status === 'warning',\n 'text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent': status === 'info',\n }\"\n :label=\"action?.label\"\n @click=\"action?.onClick\"\n />\n </div>\n</template>\n"],"names":["elInlineBannerStatuses","props","__props","iconName","computed","_a"],"mappings":"kfACaA,EAAyB,CAAC,QAAS,UAAW,MAAM,mLAUjE,MAAMC,EAAQC,EAoBRC,EAAWC,EAAS,IAAM,OAC9B,IAAIC,EAAAJ,EAAM,OAAN,MAAAI,EAAY,KAAM,OAAOJ,EAAM,KAAK,KAExC,OAAQA,EAAM,OAAQ,CACpB,IAAK,OACI,MAAA,wBACT,IAAK,UACI,MAAA,0BACT,IAAK,QACI,MAAA,wBACT,QACS,MAAA,uBACX,CAAA,CACD"}
1
+ {"version":3,"file":"ElInlineBanner.vue.esm2.js","sources":["../../src/ElInlineBanner.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInlineBannerStatuses = ['error', 'warning', 'info'] as const;\nexport type ElInlineBannerStatuses = (typeof elInlineBannerStatuses)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElButton from '@/ElButton.vue';\nimport ElSpinner from '@/ElSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n status?: ElInlineBannerStatuses;\n title?: string;\n description: string;\n html?: boolean;\n loading?: boolean;\n action?: Pick<\n InstanceType<typeof ElButton>['$props'],\n 'label' | 'variant' | 'onClick' | 'icon' | 'iconRight' | 'loading' | 'loadOnClick'\n >;\n icon?: InstanceType<typeof ElIcon>['$props'];\n }>(),\n {\n status: 'info',\n title: undefined,\n action: undefined,\n icon: undefined,\n },\n);\n\nconst iconName = computed(() => {\n if (props.icon?.name) return props.icon.name;\n\n switch (props.status) {\n case 'info':\n return 'InformationCircleIcon';\n case 'warning':\n return 'ExclamationTriangleIcon';\n case 'error':\n return 'InformationCircleIcon';\n default:\n return 'InformationCircleIcon';\n }\n});\n</script>\n\n<template>\n <div\n class=\"inline-flex flex-wrap items-center justify-center gap-x-2 gap-y-4 w-full min-w-72 p-4 rounded-md\"\n :class=\"{\n 'bg-brandBlue-50 text-brandBlue-800': status === 'info',\n 'bg-yellow-50 text-yellow-700': status === 'warning',\n 'bg-red-50 text-red-700': status === 'error',\n }\"\n >\n <div class=\"flex flex-row items-start gap-x-2 flex-grow basis-64\">\n <ElSpinner v-if=\"loading\" class=\"flex-shrink-0 px-1 pt-1\" />\n <ElIcon\n v-else\n v-bind=\"icon\"\n :name=\"iconName\"\n class=\"w-6 h-6 flex-shrink-0\"\n :class=\"{\n 'text-brandBlue-500': status === 'info',\n 'text-yellow-500': status === 'warning',\n 'text-red-500': status === 'error',\n }\"\n />\n <div class=\"text-sm flex flex-col flex-grow mt-0.5\">\n <template v-if=\"!!html\">\n <span v-if=\"title\" class=\"font-semibold min-h-6\" v-html=\"title\"></span>\n <span v-if=\"description\" v-html=\"description\"></span>\n </template>\n <template v-else>\n <span v-if=\"title\" class=\"font-semibold min-h-6\">{{ title }}</span>\n <span v-if=\"description\">{{ description }}</span>\n </template>\n </div>\n </div>\n <ElButton\n v-if=\"action\"\n v-bind=\"action\"\n :variant=\"action.variant ?? 'tertiary'\"\n class=\"flex-shrink-0\"\n :class=\"{\n underline: !action.variant || action.variant === 'tertiary',\n 'text-red-700 hover:text-red-500 hover:bg-transparent active:text-red-500 active:bg-red-100': status === 'error',\n 'text-yellow-700 hover:text-yellow-500 hover:bg-transparent active:text-yellow-500 active:bg-yellow-100': status === 'warning',\n 'text-brandBlue-800 hover:text-brandBlue-500 hover:bg-transparent': status === 'info',\n }\"\n :label=\"action?.label\"\n @click=\"action?.onClick\"\n />\n </div>\n</template>\n"],"names":["elInlineBannerStatuses","props","__props","iconName","computed","_a"],"mappings":"giBACaA,EAAyB,CAAC,QAAS,UAAW,MAAM,uMAUjE,MAAMC,EAAQC,EAqBRC,EAAWC,EAAS,IAAM,OAC9B,IAAIC,EAAAJ,EAAM,OAAN,MAAAI,EAAY,KAAM,OAAOJ,EAAM,KAAK,KAExC,OAAQA,EAAM,OAAQ,CACpB,IAAK,OACI,MAAA,wBACT,IAAK,UACI,MAAA,0BACT,IAAK,QACI,MAAA,wBACT,QACS,MAAA,uBACX,CAAA,CACD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("./input.cjs.js"),k=require("./ElInputContainer.vue.cjs2.js"),x=require("../ElFile.vue.cjs2.js"),M=require("../ElIcon.vue.cjs2.js"),_=require("../ElToast.vue.cjs2.js"),F={class:"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20"},q=["for"],C={key:0,class:"text-xs"},V=["id","accept","disabled","name","multiple"],E=["image","document","csv","excel","any","zip","patientsImportDataFpfV5","patientsImportDataHippocrates","patientsImportDataIatros","patientsImportDataMdb2000","patientsImportDataMillewin","patientsImportDataPhronesis","patientsImportDataFastamb","patientsImportDataMedico2000","patientsImportDataTServe","patientsImportDataProfim","patientsImportDataMillewinAttachments","patientsImportDataAdvmednet"],A=e.defineComponent({__name:"ElInputFile",props:{...d.withCommonElInputProps(),modelValue:{type:Array,required:!0},content:{type:String,default:void 0},multiple:{type:Boolean,default:!1},fileType:{type:String,default:"document",required:!1}},emits:["update:modelValue"],setup(i,{emit:f}){const s=i,o=e.ref(!1),u=e.ref(),v=f,b=e.toRef(s.modelValue),c=e.computed(()=>{switch(s.fileType){case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":return[".mdb"];case"patientsImportDataHippocrates":return[".xml"];case"patientsImportDataIatros":return[".xml",".mdb",".sql",".backup"];case"patientsImportDataMillewin":return[".sql",".backup",".db3"];case"patientsImportDataPhronesis":return[".sqlite",".sqlite3",".db",".db3",".s3db",".sl3",".gz"];case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":return[".zip"];case"image":return["image/jpeg","image/png"];case"document":return[".doc",".docx",".xml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pdf"];case"csv":return[".csv"];case"excel":return[".xlsx"];default:return["*"]}}),g=e.computed(()=>{const t=[s.validation];switch(s.fileType){case"image":t.push("ext:jpg,png,jpeg");break;case"document":t.push("ext:doc,docs,xml,pdf");break;case"csv":t.push("ext:csv");break;case"excel":t.push("ext:xlsx");break;case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":t.push("ext:mdb");break;case"patientsImportDataHippocrates":t.push("ext:xml");break;case"patientsImportDataIatros":t.push("ext:xml,mdb,sql,backup");break;case"patientsImportDataMillewin":t.push("ext:sql,backup,.db3");break;case"patientsImportDataPhronesis":t.push("ext:sqlite,sqlite3,db,db3,s3db,sl3,gz");break;case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":t.push("ext:zip");break}return t}),{value:n,errorMessage:h,uuid:p}=d.useInput(b,g,s.name,t=>{v("update:modelValue",t)}),I=t=>{const a=t.target;a&&m(a.files)},D=t=>{t.dataTransfer&&(m(t.dataTransfer.files),o.value=!1)},m=t=>{var a;y(t),(a=u.value)!=null&&a.value&&(u.value.value=null)},y=t=>{if(!t)return;const a=[...t];if(!a.every(r=>c.value.some(l=>r.name.toLowerCase().endsWith(l)||r.type.toLowerCase()===l||l==="*")))return _.toast("Formato non supportato, verifica di aver inserito un file/s con il formato corretto",{state:"error"});n.value=[...n.value,...a],!s.multiple&&n.value.length>1&&(n.value=[n.value[0]])},w=t=>{n.value=n.value.filter((a,r)=>r!==t)};return(t,a)=>(e.openBlock(),e.createBlock(k.default,e.mergeProps(t.$attrs,{name:e.unref(p),label:t.label,"error-message":s.errorMessage===!1?!1:s.errorMessage||e.unref(h),"hidden-error-message":t.hiddenErrorMessage,class:"relative inline-block w-full"}),{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.unref(n).length==0||i.multiple?(e.openBlock(),e.createElementBlock("label",{key:0,tabIndex:"0",for:e.unref(p),class:e.normalizeClass(["min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full",{"bg-white":!o.value,"bg-primary-light-hover":o.value,"hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused":!t.disabled,"border-gray-300 text-gray-300 cursor-not-allowed":t.disabled,"border-primary":!t.disabled&&!o.value,"border-primary-hover":!t.disabled&&o.value}]),onDragover:a[0]||(a[0]=e.withModifiers(r=>o.value=!0,["prevent"])),onDrop:e.withModifiers(D,["prevent"]),onDragenter:a[1]||(a[1]=e.withModifiers(r=>o.value=!0,["prevent"])),onDragleave:a[2]||(a[2]=e.withModifiers(r=>o.value=!1,["prevent"]))},[e.createVNode(M.default,{name:"ArrowUpCircleIcon",class:e.normalizeClass({"w-5 h-5":i.content,"w-7 h-7":!i.content,"cursor-pointer":!t.disabled})},null,8,["class"]),i.content?(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(i.content),1)):e.createCommentVNode("",!0)],42,q)):e.createCommentVNode("",!0),e.createElementVNode("input",{id:e.unref(p),ref_key:"inputField",ref:u,type:"file",class:"hidden",accept:c.value.join(","),disabled:t.disabled,name:s.name||e.unref(p),multiple:i.multiple,onChange:e.withModifiers(I,["prevent"])},null,40,V),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(r,l)=>(e.openBlock(),e.createBlock(x.default,{key:`file-${l}`,variant:"primary",name:r.name,format:r.type,class:"w-full",disabled:t.disabled,onClose:B=>w(l)},null,8,["name","format","disabled","onClose"]))),128))])]),_:1},16,["name","label","error-message","hidden-error-message"]))}});exports.default=A;exports.elInputFileTypes=E;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("./input.cjs.js"),k=require("./ElInputContainer.vue.cjs2.js"),x=require("../ElFile.vue.cjs2.js"),M=require("../ElIcon.vue.cjs2.js"),_=require("../ElToast.vue.cjs2.js"),F={class:"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20"},q=["for"],C={key:0,class:"text-xs"},V=["id","accept","disabled","name","multiple"],E=["image","document","csv","excel","any","zip","patientsImportDataFpfV5","patientsImportDataHippocrates","patientsImportDataIatros","patientsImportDataMdb2000","patientsImportDataMillewin","patientsImportDataPhronesis","patientsImportDataFastamb","patientsImportDataMedico2000","patientsImportDataTServe","patientsImportDataProfim","patientsImportDataMillewinAttachments","patientsImportDataAdvmednet"],A=e.defineComponent({__name:"ElInputFile",props:{...m.withCommonElInputProps(),modelValue:{type:Array,required:!0},content:{type:String,default:void 0},multiple:{type:Boolean,default:!1},fileType:{type:String,default:"document",required:!1}},emits:["update:modelValue"],setup(i,{emit:f}){const s=i,o=e.ref(!1),u=e.ref(),v=f,b=e.toRef(s.modelValue),c=e.computed(()=>{switch(s.fileType){case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":case"patientsImportDataHippocrates":return[".mdb"];case"patientsImportDataIatros":return[".xml",".mdb",".sql",".backup"];case"patientsImportDataMillewin":return[".sql",".backup",".db3"];case"patientsImportDataPhronesis":return[".sqlite",".sqlite3",".db",".db3",".s3db",".sl3",".gz"];case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":return[".zip"];case"image":return["image/jpeg","image/png"];case"document":return[".doc",".docx",".xml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pdf"];case"csv":return[".csv"];case"excel":return[".xlsx"];default:return["*"]}}),g=e.computed(()=>{const t=[s.validation];switch(s.fileType){case"image":t.push("ext:jpg,png,jpeg");break;case"document":t.push("ext:doc,docs,xml,pdf");break;case"csv":t.push("ext:csv");break;case"excel":t.push("ext:xlsx");break;case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":case"patientsImportDataHippocrates":t.push("ext:mdb");break;case"patientsImportDataIatros":t.push("ext:xml,mdb,sql,backup");break;case"patientsImportDataMillewin":t.push("ext:sql,backup,.db3");break;case"patientsImportDataPhronesis":t.push("ext:sqlite,sqlite3,db,db3,s3db,sl3,gz");break;case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":t.push("ext:zip");break}return t}),{value:n,errorMessage:h,uuid:p}=m.useInput(b,g,s.name,t=>{v("update:modelValue",t)}),I=t=>{const a=t.target;a&&d(a.files)},D=t=>{t.dataTransfer&&(d(t.dataTransfer.files),o.value=!1)},d=t=>{var a;y(t),(a=u.value)!=null&&a.value&&(u.value.value=null)},y=t=>{if(!t)return;const a=[...t];if(!a.every(r=>c.value.some(l=>r.name.toLowerCase().endsWith(l)||r.type.toLowerCase()===l||l==="*")))return _.toast("Formato non supportato, verifica di aver inserito un file/s con il formato corretto",{state:"error"});n.value=[...n.value,...a],!s.multiple&&n.value.length>1&&(n.value=[n.value[0]])},w=t=>{n.value=n.value.filter((a,r)=>r!==t)};return(t,a)=>(e.openBlock(),e.createBlock(k.default,e.mergeProps(t.$attrs,{name:e.unref(p),label:t.label,"error-message":s.errorMessage===!1?!1:s.errorMessage||e.unref(h),"hidden-error-message":t.hiddenErrorMessage,class:"relative inline-block w-full"}),{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.unref(n).length==0||i.multiple?(e.openBlock(),e.createElementBlock("label",{key:0,tabIndex:"0",for:e.unref(p),class:e.normalizeClass(["min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full",{"bg-white":!o.value,"bg-primary-light-hover":o.value,"hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused":!t.disabled,"border-gray-300 text-gray-300 cursor-not-allowed":t.disabled,"border-primary":!t.disabled&&!o.value,"border-primary-hover":!t.disabled&&o.value}]),onDragover:a[0]||(a[0]=e.withModifiers(r=>o.value=!0,["prevent"])),onDrop:e.withModifiers(D,["prevent"]),onDragenter:a[1]||(a[1]=e.withModifiers(r=>o.value=!0,["prevent"])),onDragleave:a[2]||(a[2]=e.withModifiers(r=>o.value=!1,["prevent"]))},[e.createVNode(M.default,{name:"ArrowUpCircleIcon",class:e.normalizeClass({"w-5 h-5":i.content,"w-7 h-7":!i.content,"cursor-pointer":!t.disabled})},null,8,["class"]),i.content?(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(i.content),1)):e.createCommentVNode("",!0)],42,q)):e.createCommentVNode("",!0),e.createElementVNode("input",{id:e.unref(p),ref_key:"inputField",ref:u,type:"file",class:"hidden",accept:c.value.join(","),disabled:t.disabled,name:s.name||e.unref(p),multiple:i.multiple,onChange:e.withModifiers(I,["prevent"])},null,40,V),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(r,l)=>(e.openBlock(),e.createBlock(x.default,{key:`file-${l}`,variant:"primary",name:r.name,format:r.type,class:"w-full",disabled:t.disabled,onClose:B=>w(l)},null,8,["name","format","disabled","onClose"]))),128))])]),_:1},16,["name","label","error-message","hidden-error-message"]))}});exports.default=A;exports.elInputFileTypes=E;
2
2
  //# sourceMappingURL=ElInputFile.vue.cjs2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputFile.vue.cjs2.js","sources":["../../../src/forms/ElInputFile.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputFileTypes = [\n 'image',\n 'document',\n 'csv',\n 'excel',\n 'any',\n 'zip',\n 'patientsImportDataFpfV5',\n 'patientsImportDataHippocrates',\n 'patientsImportDataIatros',\n 'patientsImportDataMdb2000',\n 'patientsImportDataMillewin',\n 'patientsImportDataPhronesis',\n 'patientsImportDataFastamb',\n 'patientsImportDataMedico2000',\n 'patientsImportDataTServe',\n 'patientsImportDataProfim',\n 'patientsImportDataMillewinAttachments',\n 'patientsImportDataAdvmednet',\n] as const;\nexport type ElInputFileType = (typeof elInputFileTypes)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, toRef, PropType } from 'vue';\nimport { useInput, withCommonElInputProps } from '@/forms/input';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElFile from '@/ElFile.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport { toast } from '@/ElToast.vue';\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n type: Array as () => File[],\n required: true,\n },\n content: {\n type: String,\n default: undefined,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n fileType: {\n type: String as PropType<ElInputFileType>,\n default: 'document',\n required: false,\n },\n});\n\nconst dragging = ref(false);\nconst inputField = ref<HTMLFormElement>();\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', files: File[]): void;\n}>();\n\nconst modelValue = toRef(props.modelValue);\n\nconst computedAcceptedFileExtensionsOrMimeType = computed<string[]>(() => {\n switch (props.fileType) {\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n return ['.mdb'];\n case 'patientsImportDataHippocrates':\n return ['.xml'];\n case 'patientsImportDataIatros':\n return ['.xml', '.mdb', '.sql', '.backup'];\n case 'patientsImportDataMillewin':\n return ['.sql', '.backup', '.db3'];\n case 'patientsImportDataPhronesis':\n return ['.sqlite', '.sqlite3', '.db', '.db3', '.s3db', '.sl3', '.gz'];\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n return ['.zip'];\n case 'image':\n return ['image/jpeg', 'image/png'];\n case 'document':\n // any pdf or word-like document\n return [\n '.doc',\n '.docx',\n '.xml',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.pdf',\n ];\n case 'csv':\n return ['.csv'];\n case 'excel':\n return ['.xlsx'];\n default:\n return ['*'];\n }\n});\nconst computedValidation = computed(() => {\n const validations = [props.validation];\n switch (props.fileType) {\n case 'image':\n validations.push('ext:jpg,png,jpeg');\n break;\n case 'document':\n validations.push('ext:doc,docs,xml,pdf');\n break;\n case 'csv':\n validations.push('ext:csv');\n break;\n case 'excel':\n validations.push('ext:xlsx');\n break;\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n validations.push('ext:mdb');\n break;\n case 'patientsImportDataHippocrates':\n validations.push('ext:xml');\n break;\n case 'patientsImportDataIatros':\n validations.push('ext:xml,mdb,sql,backup');\n break;\n case 'patientsImportDataMillewin':\n validations.push('ext:sql,backup,.db3');\n break;\n case 'patientsImportDataPhronesis':\n validations.push('ext:sqlite,sqlite3,db,db3,s3db,sl3,gz');\n break;\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n validations.push('ext:zip');\n break;\n default:\n break;\n }\n return validations;\n});\n\nconst { value, errorMessage, uuid } = useInput(modelValue, computedValidation, props.name, (newValue: File[]) => {\n emit('update:modelValue', newValue);\n});\n\nconst onChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (!target) return;\n loadFilesAndClearInput(target.files);\n};\n\nconst onDrop = (event: DragEvent) => {\n if (!event.dataTransfer) return;\n loadFilesAndClearInput(event.dataTransfer.files);\n dragging.value = false;\n};\n\nconst loadFilesAndClearInput = (newFiles: FileList | null) => {\n loadFiles(newFiles);\n if (inputField.value?.value) inputField.value.value = null;\n};\n\nconst loadFiles = (newFiles: FileList | null) => {\n if (!newFiles) return;\n const newFilesArray = [...newFiles];\n\n if (\n !newFilesArray.every(file =>\n computedAcceptedFileExtensionsOrMimeType.value.some(\n extensionOrMimeType =>\n file.name.toLowerCase().endsWith(extensionOrMimeType) ||\n file.type.toLowerCase() === extensionOrMimeType ||\n extensionOrMimeType === '*',\n ),\n )\n ) {\n return toast('Formato non supportato, verifica di aver inserito un file/s con il formato corretto', { state: 'error' });\n }\n\n value.value = [...value.value, ...newFilesArray];\n if (!props.multiple && value.value.length > 1) {\n value.value = [value.value[0]];\n }\n};\n\nconst removeFile = (idx: number) => {\n value.value = value.value.filter((_, i) => i !== idx);\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n class=\"relative inline-block w-full\"\n >\n <div class=\"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20\">\n <label\n v-if=\"value.length == 0 || multiple\"\n tabIndex=\"0\"\n :for=\"uuid\"\n class=\"min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full\"\n :class=\"{\n 'bg-white': !dragging,\n 'bg-primary-light-hover': dragging,\n 'hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused':\n !disabled,\n 'border-gray-300 text-gray-300 cursor-not-allowed': disabled,\n 'border-primary': !disabled && !dragging,\n 'border-primary-hover': !disabled && dragging,\n }\"\n @dragover.prevent=\"dragging = true\"\n @drop.prevent=\"onDrop\"\n @dragenter.prevent=\"dragging = true\"\n @dragleave.prevent=\"dragging = false\"\n >\n <ElIcon\n name=\"ArrowUpCircleIcon\"\n :class=\"{\n 'w-5 h-5': content,\n 'w-7 h-7': !content,\n 'cursor-pointer': !disabled,\n }\"\n ></ElIcon>\n <span v-if=\"content\" class=\"text-xs\">{{ content }}</span>\n </label>\n <input\n :id=\"uuid\"\n ref=\"inputField\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"computedAcceptedFileExtensionsOrMimeType.join(',')\"\n :disabled=\"disabled\"\n :name=\"props.name || uuid\"\n :multiple=\"multiple\"\n @change.prevent=\"onChange\"\n />\n <ElFile\n v-for=\"(file, index) in value\"\n :key=\"`file-${index}`\"\n variant=\"primary\"\n :name=\"file.name\"\n :format=\"file.type\"\n class=\"w-full\"\n :disabled=\"disabled\"\n @close=\"removeFile(index)\"\n />\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elInputFileTypes","props","__props","dragging","ref","inputField","emit","__emit","modelValue","toRef","computedAcceptedFileExtensionsOrMimeType","computed","computedValidation","validations","value","errorMessage","uuid","useInput","newValue","onChange","event","target","loadFilesAndClearInput","onDrop","newFiles","loadFiles","_a","newFilesArray","file","extensionOrMimeType","toast","removeFile","idx","_","i"],"mappings":"qcACaA,EAAmB,CAC9B,QACA,WACA,MACA,QACA,MACA,MACA,0BACA,gCACA,2BACA,4BACA,6BACA,8BACA,4BACA,+BACA,2BACA,2BACA,wCACA,6BACF,kSAYA,MAAMC,EAAQC,EAqBRC,EAAWC,MAAI,EAAK,EACpBC,EAAaD,EAAAA,MAEbE,EAAOC,E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"ts\">\nexport const elInputFileTypes = [\n 'image',\n 'document',\n 'csv',\n 'excel',\n 'any',\n 'zip',\n 'patientsImportDataFpfV5',\n 'patientsImportDataHippocrates',\n 'patientsImportDataIatros',\n 'patientsImportDataMdb2000',\n 'patientsImportDataMillewin',\n 'patientsImportDataPhronesis',\n 'patientsImportDataFastamb',\n 'patientsImportDataMedico2000',\n 'patientsImportDataTServe',\n 'patientsImportDataProfim',\n 'patientsImportDataMillewinAttachments',\n 'patientsImportDataAdvmednet',\n] as const;\nexport type ElInputFileType = (typeof elInputFileTypes)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, toRef, PropType } from 'vue';\nimport { useInput, withCommonElInputProps } from '@/forms/input';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElFile from '@/ElFile.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport { toast } from '@/ElToast.vue';\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n type: Array as () => File[],\n required: true,\n },\n content: {\n type: String,\n default: undefined,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n fileType: {\n type: String as PropType<ElInputFileType>,\n default: 'document',\n required: false,\n },\n});\n\nconst dragging = ref(false);\nconst inputField = ref<HTMLFormElement>();\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', files: File[]): void;\n}>();\n\nconst modelValue = toRef(props.modelValue);\n\nconst computedAcceptedFileExtensionsOrMimeType = computed<string[]>(() => {\n switch (props.fileType) {\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n case 'patientsImportDataHippocrates':\n return ['.mdb'];\n case 'patientsImportDataIatros':\n return ['.xml', '.mdb', '.sql', '.backup'];\n case 'patientsImportDataMillewin':\n return ['.sql', '.backup', '.db3'];\n case 'patientsImportDataPhronesis':\n return ['.sqlite', '.sqlite3', '.db', '.db3', '.s3db', '.sl3', '.gz'];\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n return ['.zip'];\n case 'image':\n return ['image/jpeg', 'image/png'];\n case 'document':\n // any pdf or word-like document\n return [\n '.doc',\n '.docx',\n '.xml',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.pdf',\n ];\n case 'csv':\n return ['.csv'];\n case 'excel':\n return ['.xlsx'];\n default:\n return ['*'];\n }\n});\nconst computedValidation = computed(() => {\n const validations = [props.validation];\n switch (props.fileType) {\n case 'image':\n validations.push('ext:jpg,png,jpeg');\n break;\n case 'document':\n validations.push('ext:doc,docs,xml,pdf');\n break;\n case 'csv':\n validations.push('ext:csv');\n break;\n case 'excel':\n validations.push('ext:xlsx');\n break;\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n case 'patientsImportDataHippocrates':\n validations.push('ext:mdb');\n break;\n case 'patientsImportDataIatros':\n validations.push('ext:xml,mdb,sql,backup');\n break;\n case 'patientsImportDataMillewin':\n validations.push('ext:sql,backup,.db3');\n break;\n case 'patientsImportDataPhronesis':\n validations.push('ext:sqlite,sqlite3,db,db3,s3db,sl3,gz');\n break;\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n validations.push('ext:zip');\n break;\n default:\n break;\n }\n return validations;\n});\n\nconst { value, errorMessage, uuid } = useInput(modelValue, computedValidation, props.name, (newValue: File[]) => {\n emit('update:modelValue', newValue);\n});\n\nconst onChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (!target) return;\n loadFilesAndClearInput(target.files);\n};\n\nconst onDrop = (event: DragEvent) => {\n if (!event.dataTransfer) return;\n loadFilesAndClearInput(event.dataTransfer.files);\n dragging.value = false;\n};\n\nconst loadFilesAndClearInput = (newFiles: FileList | null) => {\n loadFiles(newFiles);\n if (inputField.value?.value) inputField.value.value = null;\n};\n\nconst loadFiles = (newFiles: FileList | null) => {\n if (!newFiles) return;\n const newFilesArray = [...newFiles];\n\n if (\n !newFilesArray.every(file =>\n computedAcceptedFileExtensionsOrMimeType.value.some(\n extensionOrMimeType =>\n file.name.toLowerCase().endsWith(extensionOrMimeType) ||\n file.type.toLowerCase() === extensionOrMimeType ||\n extensionOrMimeType === '*',\n ),\n )\n ) {\n return toast('Formato non supportato, verifica di aver inserito un file/s con il formato corretto', { state: 'error' });\n }\n\n value.value = [...value.value, ...newFilesArray];\n if (!props.multiple && value.value.length > 1) {\n value.value = [value.value[0]];\n }\n};\n\nconst removeFile = (idx: number) => {\n value.value = value.value.filter((_, i) => i !== idx);\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n class=\"relative inline-block w-full\"\n >\n <div class=\"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20\">\n <label\n v-if=\"value.length == 0 || multiple\"\n tabIndex=\"0\"\n :for=\"uuid\"\n class=\"min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full\"\n :class=\"{\n 'bg-white': !dragging,\n 'bg-primary-light-hover': dragging,\n 'hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused':\n !disabled,\n 'border-gray-300 text-gray-300 cursor-not-allowed': disabled,\n 'border-primary': !disabled && !dragging,\n 'border-primary-hover': !disabled && dragging,\n }\"\n @dragover.prevent=\"dragging = true\"\n @drop.prevent=\"onDrop\"\n @dragenter.prevent=\"dragging = true\"\n @dragleave.prevent=\"dragging = false\"\n >\n <ElIcon\n name=\"ArrowUpCircleIcon\"\n :class=\"{\n 'w-5 h-5': content,\n 'w-7 h-7': !content,\n 'cursor-pointer': !disabled,\n }\"\n ></ElIcon>\n <span v-if=\"content\" class=\"text-xs\">{{ content }}</span>\n </label>\n <input\n :id=\"uuid\"\n ref=\"inputField\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"computedAcceptedFileExtensionsOrMimeType.join(',')\"\n :disabled=\"disabled\"\n :name=\"props.name || uuid\"\n :multiple=\"multiple\"\n @change.prevent=\"onChange\"\n />\n <ElFile\n v-for=\"(file, index) in value\"\n :key=\"`file-${index}`\"\n variant=\"primary\"\n :name=\"file.name\"\n :format=\"file.type\"\n class=\"w-full\"\n :disabled=\"disabled\"\n @close=\"removeFile(index)\"\n />\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elInputFileTypes","props","__props","dragging","ref","inputField","emit","__emit","modelValue","toRef","computedAcceptedFileExtensionsOrMimeType","computed","computedValidation","validations","value","errorMessage","uuid","useInput","newValue","onChange","event","target","loadFilesAndClearInput","onDrop","newFiles","loadFiles","_a","newFilesArray","file","extensionOrMimeType","toast","removeFile","idx","_","i"],"mappings":"qcACaA,EAAmB,CAC9B,QACA,WACA,MACA,QACA,MACA,MACA,0BACA,gCACA,2BACA,4BACA,6BACA,8BACA,4BACA,+BACA,2BACA,2BACA,wCACA,6BACF,kSAYA,MAAMC,EAAQC,EAqBRC,EAAWC,MAAI,EAAK,EACpBC,EAAaD,EAAAA,MAEbE,EAAOC,EAIPC,EAAaC,EAAAA,MAAMR,EAAM,UAAU,EAEnCS,EAA2CC,EAAAA,SAAmB,IAAM,CACxE,OAAQV,EAAM,SAAU,CACtB,IAAK,0BACL,IAAK,4BACL,IAAK,4BACL,IAAK,2BACL,IAAK,gCACH,MAAO,CAAC,MAAM,EAChB,IAAK,2BACH,MAAO,CAAC,OAAQ,OAAQ,OAAQ,SAAS,EAC3C,IAAK,6BACI,MAAA,CAAC,OAAQ,UAAW,MAAM,EACnC,IAAK,8BACH,MAAO,CAAC,UAAW,WAAY,MAAO,OAAQ,QAAS,OAAQ,KAAK,EAC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AAQ,GAAA,EAGbmB,EAA0BE,GAA8B,OAC5DC,EAAUD,CAAQ,GACdE,EAAArB,EAAW,QAAX,MAAAqB,EAAkB,QAAOrB,EAAW,MAAM,MAAQ,KAAA,EAGlDoB,EAAaD,GAA8B,CAC/C,GAAI,CAACA,EAAU,OACT,MAAAG,EAAgB,CAAC,GAAGH,CAAQ,EAElC,GACE,CAACG,EAAc,MAAMC,GACnBlB,EAAyC,MAAM,KAE3CmB,GAAAD,EAAK,KAAK,YAAA,EAAc,SAASC,CAAmB,GACpDD,EAAK,KAAK,YAAY,IAAMC,GAC5BA,IAAwB,GAC5B,CAAA,EAGF,OAAOC,EAAM,MAAA,sFAAuF,CAAE,MAAO,OAAS,CAAA,EAGxHhB,EAAM,MAAQ,CAAC,GAAGA,EAAM,MAAO,GAAGa,CAAa,EAC3C,CAAC1B,EAAM,UAAYa,EAAM,MAAM,OAAS,IAC1CA,EAAM,MAAQ,CAACA,EAAM,MAAM,CAAC,CAAC,EAC/B,EAGIiB,EAAcC,GAAgB,CAC5BlB,EAAA,MAAQA,EAAM,MAAM,OAAO,CAACmB,EAAGC,IAAMA,IAAMF,CAAG,CAAA"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as $,ref as b,toRef as z,computed as g,openBlock as p,createBlock as h,mergeProps as P,unref as i,withCtx as T,createElementVNode as I,createElementBlock as c,normalizeClass as D,withModifiers as m,createVNode as E,toDisplayString as S,createCommentVNode as y,Fragment as j,renderList as B}from"vue";import{withCommonElInputProps as H,useInput as L}from"./input.esm.js";import N from"./ElInputContainer.vue.esm2.js";import R from"../ElFile.vue.esm2.js";import U from"../ElIcon.vue.esm2.js";import{toast as W}from"../ElToast.vue.esm2.js";const G={class:"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20"},J=["for"],K={key:0,class:"text-xs"},Q=["id","accept","disabled","name","multiple"],ae=["image","document","csv","excel","any","zip","patientsImportDataFpfV5","patientsImportDataHippocrates","patientsImportDataIatros","patientsImportDataMdb2000","patientsImportDataMillewin","patientsImportDataPhronesis","patientsImportDataFastamb","patientsImportDataMedico2000","patientsImportDataTServe","patientsImportDataProfim","patientsImportDataMillewinAttachments","patientsImportDataAdvmednet"],re=$({__name:"ElInputFile",props:{...H(),modelValue:{type:Array,required:!0},content:{type:String,default:void 0},multiple:{type:Boolean,default:!1},fileType:{type:String,default:"document",required:!1}},emits:["update:modelValue"],setup(n,{emit:w}){const r=n,o=b(!1),u=b(),x=w,k=z(r.modelValue),f=g(()=>{switch(r.fileType){case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":return[".mdb"];case"patientsImportDataHippocrates":return[".xml"];case"patientsImportDataIatros":return[".xml",".mdb",".sql",".backup"];case"patientsImportDataMillewin":return[".sql",".backup",".db3"];case"patientsImportDataPhronesis":return[".sqlite",".sqlite3",".db",".db3",".s3db",".sl3",".gz"];case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":return[".zip"];case"image":return["image/jpeg","image/png"];case"document":return[".doc",".docx",".xml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pdf"];case"csv":return[".csv"];case"excel":return[".xlsx"];default:return["*"]}}),F=g(()=>{const e=[r.validation];switch(r.fileType){case"image":e.push("ext:jpg,png,jpeg");break;case"document":e.push("ext:doc,docs,xml,pdf");break;case"csv":e.push("ext:csv");break;case"excel":e.push("ext:xlsx");break;case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":e.push("ext:mdb");break;case"patientsImportDataHippocrates":e.push("ext:xml");break;case"patientsImportDataIatros":e.push("ext:xml,mdb,sql,backup");break;case"patientsImportDataMillewin":e.push("ext:sql,backup,.db3");break;case"patientsImportDataPhronesis":e.push("ext:sqlite,sqlite3,db,db3,s3db,sl3,gz");break;case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":e.push("ext:zip");break}return e}),{value:s,errorMessage:M,uuid:d}=L(k,F,r.name,e=>{x("update:modelValue",e)}),C=e=>{const t=e.target;t&&v(t.files)},V=e=>{e.dataTransfer&&(v(e.dataTransfer.files),o.value=!1)},v=e=>{var t;A(e),(t=u.value)!=null&&t.value&&(u.value.value=null)},A=e=>{if(!e)return;const t=[...e];if(!t.every(a=>f.value.some(l=>a.name.toLowerCase().endsWith(l)||a.type.toLowerCase()===l||l==="*")))return W("Formato non supportato, verifica di aver inserito un file/s con il formato corretto",{state:"error"});s.value=[...s.value,...t],!r.multiple&&s.value.length>1&&(s.value=[s.value[0]])},q=e=>{s.value=s.value.filter((t,a)=>a!==e)};return(e,t)=>(p(),h(N,P(e.$attrs,{name:i(d),label:e.label,"error-message":r.errorMessage===!1?!1:r.errorMessage||i(M),"hidden-error-message":e.hiddenErrorMessage,class:"relative inline-block w-full"}),{default:T(()=>[I("div",G,[i(s).length==0||n.multiple?(p(),c("label",{key:0,tabIndex:"0",for:i(d),class:D(["min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full",{"bg-white":!o.value,"bg-primary-light-hover":o.value,"hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused":!e.disabled,"border-gray-300 text-gray-300 cursor-not-allowed":e.disabled,"border-primary":!e.disabled&&!o.value,"border-primary-hover":!e.disabled&&o.value}]),onDragover:t[0]||(t[0]=m(a=>o.value=!0,["prevent"])),onDrop:m(V,["prevent"]),onDragenter:t[1]||(t[1]=m(a=>o.value=!0,["prevent"])),onDragleave:t[2]||(t[2]=m(a=>o.value=!1,["prevent"]))},[E(U,{name:"ArrowUpCircleIcon",class:D({"w-5 h-5":n.content,"w-7 h-7":!n.content,"cursor-pointer":!e.disabled})},null,8,["class"]),n.content?(p(),c("span",K,S(n.content),1)):y("",!0)],42,J)):y("",!0),I("input",{id:i(d),ref_key:"inputField",ref:u,type:"file",class:"hidden",accept:f.value.join(","),disabled:e.disabled,name:r.name||i(d),multiple:n.multiple,onChange:m(C,["prevent"])},null,40,Q),(p(!0),c(j,null,B(i(s),(a,l)=>(p(),h(R,{key:`file-${l}`,variant:"primary",name:a.name,format:a.type,class:"w-full",disabled:e.disabled,onClose:X=>q(l)},null,8,["name","format","disabled","onClose"]))),128))])]),_:1},16,["name","label","error-message","hidden-error-message"]))}});export{re as default,ae as elInputFileTypes};
1
+ import{defineComponent as $,ref as b,toRef as z,computed as g,openBlock as p,createBlock as h,mergeProps as P,unref as i,withCtx as T,createElementVNode as I,createElementBlock as u,normalizeClass as D,withModifiers as m,createVNode as E,toDisplayString as S,createCommentVNode as y,Fragment as j,renderList as B}from"vue";import{withCommonElInputProps as H,useInput as L}from"./input.esm.js";import N from"./ElInputContainer.vue.esm2.js";import R from"../ElFile.vue.esm2.js";import U from"../ElIcon.vue.esm2.js";import{toast as W}from"../ElToast.vue.esm2.js";const G={class:"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20"},J=["for"],K={key:0,class:"text-xs"},Q=["id","accept","disabled","name","multiple"],ae=["image","document","csv","excel","any","zip","patientsImportDataFpfV5","patientsImportDataHippocrates","patientsImportDataIatros","patientsImportDataMdb2000","patientsImportDataMillewin","patientsImportDataPhronesis","patientsImportDataFastamb","patientsImportDataMedico2000","patientsImportDataTServe","patientsImportDataProfim","patientsImportDataMillewinAttachments","patientsImportDataAdvmednet"],re=$({__name:"ElInputFile",props:{...H(),modelValue:{type:Array,required:!0},content:{type:String,default:void 0},multiple:{type:Boolean,default:!1},fileType:{type:String,default:"document",required:!1}},emits:["update:modelValue"],setup(n,{emit:w}){const r=n,o=b(!1),c=b(),x=w,k=z(r.modelValue),f=g(()=>{switch(r.fileType){case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":case"patientsImportDataHippocrates":return[".mdb"];case"patientsImportDataIatros":return[".xml",".mdb",".sql",".backup"];case"patientsImportDataMillewin":return[".sql",".backup",".db3"];case"patientsImportDataPhronesis":return[".sqlite",".sqlite3",".db",".db3",".s3db",".sl3",".gz"];case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":return[".zip"];case"image":return["image/jpeg","image/png"];case"document":return[".doc",".docx",".xml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pdf"];case"csv":return[".csv"];case"excel":return[".xlsx"];default:return["*"]}}),F=g(()=>{const e=[r.validation];switch(r.fileType){case"image":e.push("ext:jpg,png,jpeg");break;case"document":e.push("ext:doc,docs,xml,pdf");break;case"csv":e.push("ext:csv");break;case"excel":e.push("ext:xlsx");break;case"patientsImportDataFpfV5":case"patientsImportDataMdb2000":case"patientsImportDataFastamb":case"patientsImportDataProfim":case"patientsImportDataHippocrates":e.push("ext:mdb");break;case"patientsImportDataIatros":e.push("ext:xml,mdb,sql,backup");break;case"patientsImportDataMillewin":e.push("ext:sql,backup,.db3");break;case"patientsImportDataPhronesis":e.push("ext:sqlite,sqlite3,db,db3,s3db,sl3,gz");break;case"patientsImportDataTServe":case"patientsImportDataMedico2000":case"patientsImportDataMillewinAttachments":case"patientsImportDataAdvmednet":case"zip":e.push("ext:zip");break}return e}),{value:s,errorMessage:M,uuid:d}=L(k,F,r.name,e=>{x("update:modelValue",e)}),C=e=>{const t=e.target;t&&v(t.files)},V=e=>{e.dataTransfer&&(v(e.dataTransfer.files),o.value=!1)},v=e=>{var t;A(e),(t=c.value)!=null&&t.value&&(c.value.value=null)},A=e=>{if(!e)return;const t=[...e];if(!t.every(a=>f.value.some(l=>a.name.toLowerCase().endsWith(l)||a.type.toLowerCase()===l||l==="*")))return W("Formato non supportato, verifica di aver inserito un file/s con il formato corretto",{state:"error"});s.value=[...s.value,...t],!r.multiple&&s.value.length>1&&(s.value=[s.value[0]])},q=e=>{s.value=s.value.filter((t,a)=>a!==e)};return(e,t)=>(p(),h(N,P(e.$attrs,{name:i(d),label:e.label,"error-message":r.errorMessage===!1?!1:r.errorMessage||i(M),"hidden-error-message":e.hiddenErrorMessage,class:"relative inline-block w-full"}),{default:T(()=>[I("div",G,[i(s).length==0||n.multiple?(p(),u("label",{key:0,tabIndex:"0",for:i(d),class:D(["min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full",{"bg-white":!o.value,"bg-primary-light-hover":o.value,"hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused":!e.disabled,"border-gray-300 text-gray-300 cursor-not-allowed":e.disabled,"border-primary":!e.disabled&&!o.value,"border-primary-hover":!e.disabled&&o.value}]),onDragover:t[0]||(t[0]=m(a=>o.value=!0,["prevent"])),onDrop:m(V,["prevent"]),onDragenter:t[1]||(t[1]=m(a=>o.value=!0,["prevent"])),onDragleave:t[2]||(t[2]=m(a=>o.value=!1,["prevent"]))},[E(U,{name:"ArrowUpCircleIcon",class:D({"w-5 h-5":n.content,"w-7 h-7":!n.content,"cursor-pointer":!e.disabled})},null,8,["class"]),n.content?(p(),u("span",K,S(n.content),1)):y("",!0)],42,J)):y("",!0),I("input",{id:i(d),ref_key:"inputField",ref:c,type:"file",class:"hidden",accept:f.value.join(","),disabled:e.disabled,name:r.name||i(d),multiple:n.multiple,onChange:m(C,["prevent"])},null,40,Q),(p(!0),u(j,null,B(i(s),(a,l)=>(p(),h(R,{key:`file-${l}`,variant:"primary",name:a.name,format:a.type,class:"w-full",disabled:e.disabled,onClose:X=>q(l)},null,8,["name","format","disabled","onClose"]))),128))])]),_:1},16,["name","label","error-message","hidden-error-message"]))}});export{re as default,ae as elInputFileTypes};
2
2
  //# sourceMappingURL=ElInputFile.vue.esm2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputFile.vue.esm2.js","sources":["../../../src/forms/ElInputFile.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputFileTypes = [\n 'image',\n 'document',\n 'csv',\n 'excel',\n 'any',\n 'zip',\n 'patientsImportDataFpfV5',\n 'patientsImportDataHippocrates',\n 'patientsImportDataIatros',\n 'patientsImportDataMdb2000',\n 'patientsImportDataMillewin',\n 'patientsImportDataPhronesis',\n 'patientsImportDataFastamb',\n 'patientsImportDataMedico2000',\n 'patientsImportDataTServe',\n 'patientsImportDataProfim',\n 'patientsImportDataMillewinAttachments',\n 'patientsImportDataAdvmednet',\n] as const;\nexport type ElInputFileType = (typeof elInputFileTypes)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, toRef, PropType } from 'vue';\nimport { useInput, withCommonElInputProps } from '@/forms/input';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElFile from '@/ElFile.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport { toast } from '@/ElToast.vue';\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n type: Array as () => File[],\n required: true,\n },\n content: {\n type: String,\n default: undefined,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n fileType: {\n type: String as PropType<ElInputFileType>,\n default: 'document',\n required: false,\n },\n});\n\nconst dragging = ref(false);\nconst inputField = ref<HTMLFormElement>();\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', files: File[]): void;\n}>();\n\nconst modelValue = toRef(props.modelValue);\n\nconst computedAcceptedFileExtensionsOrMimeType = computed<string[]>(() => {\n switch (props.fileType) {\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n return ['.mdb'];\n case 'patientsImportDataHippocrates':\n return ['.xml'];\n case 'patientsImportDataIatros':\n return ['.xml', '.mdb', '.sql', '.backup'];\n case 'patientsImportDataMillewin':\n return ['.sql', '.backup', '.db3'];\n case 'patientsImportDataPhronesis':\n return ['.sqlite', '.sqlite3', '.db', '.db3', '.s3db', '.sl3', '.gz'];\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n return ['.zip'];\n case 'image':\n return ['image/jpeg', 'image/png'];\n case 'document':\n // any pdf or word-like document\n return [\n '.doc',\n '.docx',\n '.xml',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.pdf',\n ];\n case 'csv':\n return ['.csv'];\n case 'excel':\n return ['.xlsx'];\n default:\n return ['*'];\n }\n});\nconst computedValidation = computed(() => {\n const validations = [props.validation];\n switch (props.fileType) {\n case 'image':\n validations.push('ext:jpg,png,jpeg');\n break;\n case 'document':\n validations.push('ext:doc,docs,xml,pdf');\n break;\n case 'csv':\n validations.push('ext:csv');\n break;\n case 'excel':\n validations.push('ext:xlsx');\n break;\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n validations.push('ext:mdb');\n break;\n case 'patientsImportDataHippocrates':\n validations.push('ext:xml');\n break;\n case 'patientsImportDataIatros':\n validations.push('ext:xml,mdb,sql,backup');\n break;\n case 'patientsImportDataMillewin':\n validations.push('ext:sql,backup,.db3');\n break;\n case 'patientsImportDataPhronesis':\n validations.push('ext:sqlite,sqlite3,db,db3,s3db,sl3,gz');\n break;\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n validations.push('ext:zip');\n break;\n default:\n break;\n }\n return validations;\n});\n\nconst { value, errorMessage, uuid } = useInput(modelValue, computedValidation, props.name, (newValue: File[]) => {\n emit('update:modelValue', newValue);\n});\n\nconst onChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (!target) return;\n loadFilesAndClearInput(target.files);\n};\n\nconst onDrop = (event: DragEvent) => {\n if (!event.dataTransfer) return;\n loadFilesAndClearInput(event.dataTransfer.files);\n dragging.value = false;\n};\n\nconst loadFilesAndClearInput = (newFiles: FileList | null) => {\n loadFiles(newFiles);\n if (inputField.value?.value) inputField.value.value = null;\n};\n\nconst loadFiles = (newFiles: FileList | null) => {\n if (!newFiles) return;\n const newFilesArray = [...newFiles];\n\n if (\n !newFilesArray.every(file =>\n computedAcceptedFileExtensionsOrMimeType.value.some(\n extensionOrMimeType =>\n file.name.toLowerCase().endsWith(extensionOrMimeType) ||\n file.type.toLowerCase() === extensionOrMimeType ||\n extensionOrMimeType === '*',\n ),\n )\n ) {\n return toast('Formato non supportato, verifica di aver inserito un file/s con il formato corretto', { state: 'error' });\n }\n\n value.value = [...value.value, ...newFilesArray];\n if (!props.multiple && value.value.length > 1) {\n value.value = [value.value[0]];\n }\n};\n\nconst removeFile = (idx: number) => {\n value.value = value.value.filter((_, i) => i !== idx);\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n class=\"relative inline-block w-full\"\n >\n <div class=\"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20\">\n <label\n v-if=\"value.length == 0 || multiple\"\n tabIndex=\"0\"\n :for=\"uuid\"\n class=\"min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full\"\n :class=\"{\n 'bg-white': !dragging,\n 'bg-primary-light-hover': dragging,\n 'hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused':\n !disabled,\n 'border-gray-300 text-gray-300 cursor-not-allowed': disabled,\n 'border-primary': !disabled && !dragging,\n 'border-primary-hover': !disabled && dragging,\n }\"\n @dragover.prevent=\"dragging = true\"\n @drop.prevent=\"onDrop\"\n @dragenter.prevent=\"dragging = true\"\n @dragleave.prevent=\"dragging = false\"\n >\n <ElIcon\n name=\"ArrowUpCircleIcon\"\n :class=\"{\n 'w-5 h-5': content,\n 'w-7 h-7': !content,\n 'cursor-pointer': !disabled,\n }\"\n ></ElIcon>\n <span v-if=\"content\" class=\"text-xs\">{{ content }}</span>\n </label>\n <input\n :id=\"uuid\"\n ref=\"inputField\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"computedAcceptedFileExtensionsOrMimeType.join(',')\"\n :disabled=\"disabled\"\n :name=\"props.name || uuid\"\n :multiple=\"multiple\"\n @change.prevent=\"onChange\"\n />\n <ElFile\n v-for=\"(file, index) in value\"\n :key=\"`file-${index}`\"\n variant=\"primary\"\n :name=\"file.name\"\n :format=\"file.type\"\n class=\"w-full\"\n :disabled=\"disabled\"\n @close=\"removeFile(index)\"\n />\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elInputFileTypes","props","__props","dragging","ref","inputField","emit","__emit","modelValue","toRef","computedAcceptedFileExtensionsOrMimeType","computed","computedValidation","validations","value","errorMessage","uuid","useInput","newValue","onChange","event","target","loadFilesAndClearInput","onDrop","newFiles","loadFiles","_a","newFilesArray","file","extensionOrMimeType","toast","removeFile","idx","_","i"],"mappings":"ssBACaA,GAAmB,CAC9B,QACA,WACA,MACA,QACA,MACA,MACA,0BACA,gCACA,2BACA,4BACA,6BACA,8BACA,4BACA,+BACA,2BACA,2BACA,wCACA,6BACF,4PAYA,MAAMC,EAAQC,EAqBRC,EAAWC,EAAI,EAAK,EACpBC,EAAaD,IAEbE,EAAOC,EAIPC,EAAaC,EAAMR,EAAM,UAAU,EAEnCS,EAA2CC,EAAmB,IAAM,CACxE,OAAQV,EAAM,SAAU,CACtB,IAAK,0BACL,IAAK,4BACL,IAAK,4BACL,IAAK,2BACH,MAAO,CAAC,MAAM,EAChB,IAAK,gCACH,MAAO,CAAC,MAAM,EAChB,IAAK,2BACH,MAAO,CAAC,OAAQ,OAAQ,OAAQ,SAAS,EAC3C,IAAK,6BACI,MAAA,CAAC,OAAQ,UAAW,MAAM,EACnC,IAAK,8BACH,MAAO,CAAC,UAAW,WAA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EAAM,eACYE,EAAAF,EAAM,aAAa,KAAK,EAC/CjB,EAAS,MAAQ,GAAA,EAGbmB,EAA0BE,GAA8B,OAC5DC,EAAUD,CAAQ,GACdE,EAAArB,EAAW,QAAX,MAAAqB,EAAkB,QAAOrB,EAAW,MAAM,MAAQ,KAAA,EAGlDoB,EAAaD,GAA8B,CAC/C,GAAI,CAACA,EAAU,OACT,MAAAG,EAAgB,CAAC,GAAGH,CAAQ,EAElC,GACE,CAACG,EAAc,MAAMC,GACnBlB,EAAyC,MAAM,KAE3CmB,GAAAD,EAAK,KAAK,YAAA,EAAc,SAASC,CAAmB,GACpDD,EAAK,KAAK,YAAY,IAAMC,GAC5BA,IAAwB,GAC5B,CAAA,EAGF,OAAOC,EAAM,sFAAuF,CAAE,MAAO,OAAS,CAAA,EAGxHhB,EAAM,MAAQ,CAAC,GAAGA,EAAM,MAAO,GAAGa,CAAa,EAC3C,CAAC1B,EAAM,UAAYa,EAAM,MAAM,OAAS,IAC1CA,EAAM,MAAQ,CAACA,EAAM,MAAM,CAAC,CAAC,EAC/B,EAGIiB,EAAcC,GAAgB,CAC5BlB,EAAA,MAAQA,EAAM,MAAM,OAAO,CAACmB,EAAGC,IAAMA,IAAMF,CAAG,CAAA"}
1
+ {"version":3,"file":"ElInputFile.vue.esm2.js","sources":["../../../src/forms/ElInputFile.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputFileTypes = [\n 'image',\n 'document',\n 'csv',\n 'excel',\n 'any',\n 'zip',\n 'patientsImportDataFpfV5',\n 'patientsImportDataHippocrates',\n 'patientsImportDataIatros',\n 'patientsImportDataMdb2000',\n 'patientsImportDataMillewin',\n 'patientsImportDataPhronesis',\n 'patientsImportDataFastamb',\n 'patientsImportDataMedico2000',\n 'patientsImportDataTServe',\n 'patientsImportDataProfim',\n 'patientsImportDataMillewinAttachments',\n 'patientsImportDataAdvmednet',\n] as const;\nexport type ElInputFileType = (typeof elInputFileTypes)[number];\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, toRef, PropType } from 'vue';\nimport { useInput, withCommonElInputProps } from '@/forms/input';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElFile from '@/ElFile.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport { toast } from '@/ElToast.vue';\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n type: Array as () => File[],\n required: true,\n },\n content: {\n type: String,\n default: undefined,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n fileType: {\n type: String as PropType<ElInputFileType>,\n default: 'document',\n required: false,\n },\n});\n\nconst dragging = ref(false);\nconst inputField = ref<HTMLFormElement>();\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', files: File[]): void;\n}>();\n\nconst modelValue = toRef(props.modelValue);\n\nconst computedAcceptedFileExtensionsOrMimeType = computed<string[]>(() => {\n switch (props.fileType) {\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n case 'patientsImportDataHippocrates':\n return ['.mdb'];\n case 'patientsImportDataIatros':\n return ['.xml', '.mdb', '.sql', '.backup'];\n case 'patientsImportDataMillewin':\n return ['.sql', '.backup', '.db3'];\n case 'patientsImportDataPhronesis':\n return ['.sqlite', '.sqlite3', '.db', '.db3', '.s3db', '.sl3', '.gz'];\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n return ['.zip'];\n case 'image':\n return ['image/jpeg', 'image/png'];\n case 'document':\n // any pdf or word-like document\n return [\n '.doc',\n '.docx',\n '.xml',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.pdf',\n ];\n case 'csv':\n return ['.csv'];\n case 'excel':\n return ['.xlsx'];\n default:\n return ['*'];\n }\n});\nconst computedValidation = computed(() => {\n const validations = [props.validation];\n switch (props.fileType) {\n case 'image':\n validations.push('ext:jpg,png,jpeg');\n break;\n case 'document':\n validations.push('ext:doc,docs,xml,pdf');\n break;\n case 'csv':\n validations.push('ext:csv');\n break;\n case 'excel':\n validations.push('ext:xlsx');\n break;\n case 'patientsImportDataFpfV5':\n case 'patientsImportDataMdb2000':\n case 'patientsImportDataFastamb':\n case 'patientsImportDataProfim':\n case 'patientsImportDataHippocrates':\n validations.push('ext:mdb');\n break;\n case 'patientsImportDataIatros':\n validations.push('ext:xml,mdb,sql,backup');\n break;\n case 'patientsImportDataMillewin':\n validations.push('ext:sql,backup,.db3');\n break;\n case 'patientsImportDataPhronesis':\n validations.push('ext:sqlite,sqlite3,db,db3,s3db,sl3,gz');\n break;\n case 'patientsImportDataTServe':\n case 'patientsImportDataMedico2000':\n case 'patientsImportDataMillewinAttachments':\n case 'patientsImportDataAdvmednet':\n case 'zip':\n validations.push('ext:zip');\n break;\n default:\n break;\n }\n return validations;\n});\n\nconst { value, errorMessage, uuid } = useInput(modelValue, computedValidation, props.name, (newValue: File[]) => {\n emit('update:modelValue', newValue);\n});\n\nconst onChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (!target) return;\n loadFilesAndClearInput(target.files);\n};\n\nconst onDrop = (event: DragEvent) => {\n if (!event.dataTransfer) return;\n loadFilesAndClearInput(event.dataTransfer.files);\n dragging.value = false;\n};\n\nconst loadFilesAndClearInput = (newFiles: FileList | null) => {\n loadFiles(newFiles);\n if (inputField.value?.value) inputField.value.value = null;\n};\n\nconst loadFiles = (newFiles: FileList | null) => {\n if (!newFiles) return;\n const newFilesArray = [...newFiles];\n\n if (\n !newFilesArray.every(file =>\n computedAcceptedFileExtensionsOrMimeType.value.some(\n extensionOrMimeType =>\n file.name.toLowerCase().endsWith(extensionOrMimeType) ||\n file.type.toLowerCase() === extensionOrMimeType ||\n extensionOrMimeType === '*',\n ),\n )\n ) {\n return toast('Formato non supportato, verifica di aver inserito un file/s con il formato corretto', { state: 'error' });\n }\n\n value.value = [...value.value, ...newFilesArray];\n if (!props.multiple && value.value.length > 1) {\n value.value = [value.value[0]];\n }\n};\n\nconst removeFile = (idx: number) => {\n value.value = value.value.filter((_, i) => i !== idx);\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n class=\"relative inline-block w-full\"\n >\n <div class=\"flex flex-col gap-2 min-w-0 sm:min-w-80 min-h-20\">\n <label\n v-if=\"value.length == 0 || multiple\"\n tabIndex=\"0\"\n :for=\"uuid\"\n class=\"min-h-20 p-4 flex flex-col gap-2 items-center justify-center rounded border outline-none border-dashed w-full\"\n :class=\"{\n 'bg-white': !dragging,\n 'bg-primary-light-hover': dragging,\n 'hover:bg-primary-light-hover hover:text-primary-hover hover:border-primary-hover group-focus-within:bg-primary-light-focused group-focus-within:text-primary-focused group-focus-within:border-primary-light-focused':\n !disabled,\n 'border-gray-300 text-gray-300 cursor-not-allowed': disabled,\n 'border-primary': !disabled && !dragging,\n 'border-primary-hover': !disabled && dragging,\n }\"\n @dragover.prevent=\"dragging = true\"\n @drop.prevent=\"onDrop\"\n @dragenter.prevent=\"dragging = true\"\n @dragleave.prevent=\"dragging = false\"\n >\n <ElIcon\n name=\"ArrowUpCircleIcon\"\n :class=\"{\n 'w-5 h-5': content,\n 'w-7 h-7': !content,\n 'cursor-pointer': !disabled,\n }\"\n ></ElIcon>\n <span v-if=\"content\" class=\"text-xs\">{{ content }}</span>\n </label>\n <input\n :id=\"uuid\"\n ref=\"inputField\"\n type=\"file\"\n class=\"hidden\"\n :accept=\"computedAcceptedFileExtensionsOrMimeType.join(',')\"\n :disabled=\"disabled\"\n :name=\"props.name || uuid\"\n :multiple=\"multiple\"\n @change.prevent=\"onChange\"\n />\n <ElFile\n v-for=\"(file, index) in value\"\n :key=\"`file-${index}`\"\n variant=\"primary\"\n :name=\"file.name\"\n :format=\"file.type\"\n class=\"w-full\"\n :disabled=\"disabled\"\n @close=\"removeFile(index)\"\n />\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elInputFileTypes","props","__props","dragging","ref","inputField","emit","__emit","modelValue","toRef","computedAcceptedFileExtensionsOrMimeType","computed","computedValidation","validations","value","errorMessage","uuid","useInput","newValue","onChange","event","target","loadFilesAndClearInput","onDrop","newFiles","loadFiles","_a","newFilesArray","file","extensionOrMimeType","toast","removeFile","idx","_","i"],"mappings":"ssBACaA,GAAmB,CAC9B,QACA,WACA,MACA,QACA,MACA,MACA,0BACA,gCACA,2BACA,4BACA,6BACA,8BACA,4BACA,+BACA,2BACA,2BACA,wCACA,6BACF,4PAYA,MAAMC,EAAQC,EAqBRC,EAAWC,EAAI,EAAK,EACpBC,EAAaD,IAEbE,EAAOC,EAIPC,EAAaC,EAAMR,EAAM,UAAU,EAEnCS,EAA2CC,EAAmB,IAAM,CACxE,OAAQV,EAAM,SAAU,CACtB,IAAK,0BACL,IAAK,4BACL,IAAK,4BACL,IAAK,2BACL,IAAK,gCACH,MAAO,CAAC,MAAM,EAChB,IAAK,2BACH,MAAO,CAAC,OAAQ,OAAQ,OAAQ,SAAS,EAC3C,IAAK,6BACI,MAAA,CAAC,OAAQ,UAAW,MAAM,EACnC,IAAK,8BACH,MAAO,CAAC,UAAW,WAAY,MAAO,OAAQ,QAAS,OAAQ,KAAK,EACtE,IAAK,2BACL,IAAK,+BACL,IAAK,wCACL,IAAK,8BACL,IAAK,MACH,MAAO,CAAC,MAAM,EAChB,IAAK,QACI,MAAA,CAAC,aAAc,WAAW,EACnC,IAAK,WAEI,MAAA,CACL,OACA,QACA,OACA,qBACA,0EACA,MAAA,EAEJ,IAAK,MACH,MAAO,CAAC,MAAM,EAChB,IAAK,QACH,MAAO,CAAC,OAAO,EACjB,QACE,MAAO,CAAC,GAAG,CACf,CAAA,CACD,EACKW,EAAqBD,EAAS,IAAM,CAClC,MAAAE,EAAc,CAACZ,EAAM,UAAU,EACrC,OAAQA,EAAM,SAAU,CACtB,IAAK,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F,CAAE,MAAO,OAAS,CAAA,EAGxHhB,EAAM,MAAQ,CAAC,GAAGA,EAAM,MAAO,GAAGa,CAAa,EAC3C,CAAC1B,EAAM,UAAYa,EAAM,MAAM,OAAS,IAC1CA,EAAM,MAAQ,CAACA,EAAM,MAAM,CAAC,CAAC,EAC/B,EAGIiB,EAAcC,GAAgB,CAC5BlB,EAAA,MAAQA,EAAM,MAAM,OAAO,CAACmB,EAAGC,IAAMA,IAAMF,CAAG,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davincihealthcare/elty-design-system-vue",
3
- "version": "1.81.1",
3
+ "version": "1.83.0",
4
4
  "license": "UNLICENSED",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "types": "dist/index.d.ts",