@form-create/component-elm-upload
Advanced tools
Comparing version 3.1.17 to 3.1.18
/*! | ||
* @form-create/component-elm-upload v3.1.17 | ||
* (c) 2018-2022 xaboy | ||
* @form-create/component-elm-upload v3.1.18 | ||
* (c) 2018-2023 xaboy | ||
* Github https://github.com/xaboy/form-create with upload | ||
@@ -144,2 +144,10 @@ * Released under the MIT License. | ||
inheritAttrs: false, | ||
formCreateParser: { | ||
toFormValue: function toFormValue(value) { | ||
return toArray(value); | ||
}, | ||
toValue: function toValue(formValue, ctx) { | ||
return ctx.prop.props.limit === 1 ? formValue[0] || '' : formValue; | ||
} | ||
}, | ||
props: { | ||
@@ -165,7 +173,2 @@ previewMask: undefined, | ||
this.fileList = toArray(n).map(parseFile); | ||
}, | ||
limit: function limit(n, o) { | ||
if (o === 1 || n === 1) { | ||
this.update(); | ||
} | ||
} | ||
@@ -188,3 +191,3 @@ }, | ||
}); | ||
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files); | ||
this.$emit('update:modelValue', files); | ||
}, | ||
@@ -191,0 +194,0 @@ handleCancel: function handleCancel() { |
/*! | ||
* @form-create/component-elm-upload v3.1.17 | ||
* (c) 2018-2022 xaboy | ||
* @form-create/component-elm-upload v3.1.18 | ||
* (c) 2018-2023 xaboy | ||
* Github https://github.com/xaboy/form-create with upload | ||
* Released under the MIT License. | ||
*/ | ||
import{openBlock as e,createElementBlock as t,createElementVNode as i,defineComponent as n,createVNode as r,Fragment as l,resolveComponent as o,mergeProps as a}from"vue";function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function u(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){c(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("._fc-exceed .el-upload{display:none}");var p={name:"IconUpload"},h={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},f=[i("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)];function m(e,t){return{url:e,name:v(e),uid:t}}function v(e){return(""+e).split("/").pop()}p.render=function(i,n,r,l,o,a){return e(),t("svg",h,f)};var y=n({name:"fcUpload",inheritAttrs:!1,props:{previewMask:void 0,onPreview:Function,modalTitle:String,modelValue:[Array,String]},emits:["update:modelValue","change","remove"],data:function(){return{previewVisible:!1,previewImage:"",fileList:[]}},created:function(){this.fileList=d(this.modelValue).map(m)},watch:{modelValue:function(e){this.fileList=d(e).map(m)},limit:function(e,t){1!==t&&1!==e||this.update()}},methods:{handlePreview:function(e){this.onPreview?this.onPreview.apply(this,arguments):(this.previewImage=e.url,this.previewVisible=!0)},update:function(e){var t=e.map((function(e){return e.url})).filter((function(e){return void 0!==e}));this.$emit("update:modelValue",1===this.limit?t[0]||"":t)},handleCancel:function(){this.previewVisible=!1},handleChange:function(e,t){this.$emit.apply(this,["change"].concat(Array.prototype.slice.call(arguments))),"success"===e.status&&this.update(t)},handleRemove:function(e,t){this.$emit.apply(this,["remove"].concat(Array.prototype.slice.call(arguments))),this.update(t)}},render:function(){var e,t,i,n,s=this,c=d(this.modelValue).length;return r(l,null,[r(o("ElUpload"),a({key:c,"list-type":"picture-card"},this.$attrs,{class:{"_fc-exceed":!!this.$attrs.limit&&this.$attrs.limit<=c},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,fileList:this.fileList}),u({default:function(){return[(null===(e=(t=s.$slots).default)||void 0===e?void 0:e.call(t))||r(o("ElIcon"),null,{default:function(){return[r(p,null,null)]}})]}},(i=this.$slots,n=["default"],Object.keys(i).reduce((function(e,t){return n&&-1!==n.indexOf(t)||e.push(i[t]),e}),[])))),r(o("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:function(){return[r("img",{style:"width: 100%",src:s.previewImage},null)]}})])}});export{y as default}; | ||
import{openBlock as e,createElementBlock as t,createElementVNode as i,defineComponent as n,createVNode as r,Fragment as l,resolveComponent as o,mergeProps as a}from"vue";function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function u(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){c(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("._fc-exceed .el-upload{display:none}");var p={name:"IconUpload"},h={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},f=[i("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)];function m(e,t){return{url:e,name:v(e),uid:t}}function v(e){return(""+e).split("/").pop()}p.render=function(i,n,r,l,o,a){return e(),t("svg",h,f)};var y=n({name:"fcUpload",inheritAttrs:!1,formCreateParser:{toFormValue:function(e){return d(e)},toValue:function(e,t){return 1===t.prop.props.limit?e[0]||"":e}},props:{previewMask:void 0,onPreview:Function,modalTitle:String,modelValue:[Array,String]},emits:["update:modelValue","change","remove"],data:function(){return{previewVisible:!1,previewImage:"",fileList:[]}},created:function(){this.fileList=d(this.modelValue).map(m)},watch:{modelValue:function(e){this.fileList=d(e).map(m)}},methods:{handlePreview:function(e){this.onPreview?this.onPreview.apply(this,arguments):(this.previewImage=e.url,this.previewVisible=!0)},update:function(e){var t=e.map((function(e){return e.url})).filter((function(e){return void 0!==e}));this.$emit("update:modelValue",t)},handleCancel:function(){this.previewVisible=!1},handleChange:function(e,t){this.$emit.apply(this,["change"].concat(Array.prototype.slice.call(arguments))),"success"===e.status&&this.update(t)},handleRemove:function(e,t){this.$emit.apply(this,["remove"].concat(Array.prototype.slice.call(arguments))),this.update(t)}},render:function(){var e,t,i,n,s=this,c=d(this.modelValue).length;return r(l,null,[r(o("ElUpload"),a({key:c,"list-type":"picture-card"},this.$attrs,{class:{"_fc-exceed":!!this.$attrs.limit&&this.$attrs.limit<=c},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,fileList:this.fileList}),u({default:function(){return[(null===(e=(t=s.$slots).default)||void 0===e?void 0:e.call(t))||r(o("ElIcon"),null,{default:function(){return[r(p,null,null)]}})]}},(i=this.$slots,n=["default"],Object.keys(i).reduce((function(e,t){return n&&-1!==n.indexOf(t)||e.push(i[t]),e}),[])))),r(o("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:function(){return[r("img",{style:"width: 100%",src:s.previewImage},null)]}})])}});export{y as default}; |
/*! | ||
* @form-create/component-elm-upload v3.1.17 | ||
* (c) 2018-2022 xaboy | ||
* @form-create/component-elm-upload v3.1.18 | ||
* (c) 2018-2023 xaboy | ||
* Github https://github.com/xaboy/form-create with upload | ||
@@ -148,2 +148,10 @@ * Released under the MIT License. | ||
inheritAttrs: false, | ||
formCreateParser: { | ||
toFormValue: function toFormValue(value) { | ||
return toArray(value); | ||
}, | ||
toValue: function toValue(formValue, ctx) { | ||
return ctx.prop.props.limit === 1 ? formValue[0] || '' : formValue; | ||
} | ||
}, | ||
props: { | ||
@@ -169,7 +177,2 @@ previewMask: undefined, | ||
this.fileList = toArray(n).map(parseFile); | ||
}, | ||
limit: function limit(n, o) { | ||
if (o === 1 || n === 1) { | ||
this.update(); | ||
} | ||
} | ||
@@ -192,3 +195,3 @@ }, | ||
}); | ||
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files); | ||
this.$emit('update:modelValue', files); | ||
}, | ||
@@ -195,0 +198,0 @@ handleCancel: function handleCancel() { |
/*! | ||
* @form-create/component-elm-upload v3.1.17 | ||
* (c) 2018-2022 xaboy | ||
* @form-create/component-elm-upload v3.1.18 | ||
* (c) 2018-2023 xaboy | ||
* Github https://github.com/xaboy/form-create with upload | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcUpload={},e.Vue)}(this,(function(e,t){"use strict";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("._fc-exceed .el-upload{display:none}");var l={name:"IconUpload"},a={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},s=[t.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)];function u(e,t){return{url:e,name:c(e),uid:t}}function c(e){return(""+e).split("/").pop()}l.render=function(e,n,i,r,o,l){return t.openBlock(),t.createElementBlock("svg",a,s)};var d=t.defineComponent({name:"fcUpload",inheritAttrs:!1,props:{previewMask:void 0,onPreview:Function,modalTitle:String,modelValue:[Array,String]},emits:["update:modelValue","change","remove"],data:function(){return{previewVisible:!1,previewImage:"",fileList:[]}},created:function(){this.fileList=o(this.modelValue).map(u)},watch:{modelValue:function(e){this.fileList=o(e).map(u)},limit:function(e,t){1!==t&&1!==e||this.update()}},methods:{handlePreview:function(e){this.onPreview?this.onPreview.apply(this,arguments):(this.previewImage=e.url,this.previewVisible=!0)},update:function(e){var t=e.map((function(e){return e.url})).filter((function(e){return void 0!==e}));this.$emit("update:modelValue",1===this.limit?t[0]||"":t)},handleCancel:function(){this.previewVisible=!1},handleChange:function(e,t){this.$emit.apply(this,["change"].concat(Array.prototype.slice.call(arguments))),"success"===e.status&&this.update(t)},handleRemove:function(e,t){this.$emit.apply(this,["remove"].concat(Array.prototype.slice.call(arguments))),this.update(t)}},render:function(){var e,n,r,a,s=this,u=o(this.modelValue).length;return t.createVNode(t.Fragment,null,[t.createVNode(t.resolveComponent("ElUpload"),t.mergeProps({key:u,"list-type":"picture-card"},this.$attrs,{class:{"_fc-exceed":!!this.$attrs.limit&&this.$attrs.limit<=u},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,fileList:this.fileList}),i({default:function(){return[(null===(e=(n=s.$slots).default)||void 0===e?void 0:e.call(n))||t.createVNode(t.resolveComponent("ElIcon"),null,{default:function(){return[t.createVNode(l,null,null)]}})]}},(r=this.$slots,a=["default"],Object.keys(r).reduce((function(e,t){return a&&-1!==a.indexOf(t)||e.push(r[t]),e}),[])))),t.createVNode(t.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:function(){return[t.createVNode("img",{style:"width: 100%",src:s.previewImage},null)]}})])}});e.default=d,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcUpload={},e.Vue)}(this,(function(e,t){"use strict";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("._fc-exceed .el-upload{display:none}");var l={name:"IconUpload"},a={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},s=[t.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)];function u(e,t){return{url:e,name:c(e),uid:t}}function c(e){return(""+e).split("/").pop()}l.render=function(e,n,i,r,o,l){return t.openBlock(),t.createElementBlock("svg",a,s)};var d=t.defineComponent({name:"fcUpload",inheritAttrs:!1,formCreateParser:{toFormValue:function(e){return o(e)},toValue:function(e,t){return 1===t.prop.props.limit?e[0]||"":e}},props:{previewMask:void 0,onPreview:Function,modalTitle:String,modelValue:[Array,String]},emits:["update:modelValue","change","remove"],data:function(){return{previewVisible:!1,previewImage:"",fileList:[]}},created:function(){this.fileList=o(this.modelValue).map(u)},watch:{modelValue:function(e){this.fileList=o(e).map(u)}},methods:{handlePreview:function(e){this.onPreview?this.onPreview.apply(this,arguments):(this.previewImage=e.url,this.previewVisible=!0)},update:function(e){var t=e.map((function(e){return e.url})).filter((function(e){return void 0!==e}));this.$emit("update:modelValue",t)},handleCancel:function(){this.previewVisible=!1},handleChange:function(e,t){this.$emit.apply(this,["change"].concat(Array.prototype.slice.call(arguments))),"success"===e.status&&this.update(t)},handleRemove:function(e,t){this.$emit.apply(this,["remove"].concat(Array.prototype.slice.call(arguments))),this.update(t)}},render:function(){var e,n,r,a,s=this,u=o(this.modelValue).length;return t.createVNode(t.Fragment,null,[t.createVNode(t.resolveComponent("ElUpload"),t.mergeProps({key:u,"list-type":"picture-card"},this.$attrs,{class:{"_fc-exceed":!!this.$attrs.limit&&this.$attrs.limit<=u},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,fileList:this.fileList}),i({default:function(){return[(null===(e=(n=s.$slots).default)||void 0===e?void 0:e.call(n))||t.createVNode(t.resolveComponent("ElIcon"),null,{default:function(){return[t.createVNode(l,null,null)]}})]}},(r=this.$slots,a=["default"],Object.keys(r).reduce((function(e,t){return a&&-1!==a.indexOf(t)||e.push(r[t]),e}),[])))),t.createVNode(t.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:function(){return[t.createVNode("img",{style:"width: 100%",src:s.previewImage},null)]}})])}});e.default=d,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@form-create/component-elm-upload", | ||
"version": "3.1.17", | ||
"version": "3.1.18", | ||
"description": "@form-create/element-ui 内置组件", | ||
@@ -50,3 +50,3 @@ "main": "./dist/index.min.js", | ||
}, | ||
"gitHead": "8473a0e324562f0afac1eccf8884900f8d98b6ac" | ||
"gitHead": "aba9c3b836f914ddadafa4ee22485244d676da59" | ||
} |
@@ -24,2 +24,10 @@ import toArray from '@form-create/utils/lib/toarray'; | ||
inheritAttrs: false, | ||
formCreateParser: { | ||
toFormValue(value) { | ||
return toArray(value); | ||
}, | ||
toValue(formValue, ctx) { | ||
return ctx.prop.props.limit === 1 ? (formValue[0] || '') : formValue; | ||
} | ||
}, | ||
props: { | ||
@@ -45,7 +53,2 @@ previewMask: undefined, | ||
this.fileList = toArray(n).map(parseFile); | ||
}, | ||
limit(n, o) { | ||
if (o === 1 || n === 1) { | ||
this.update(); | ||
} | ||
} | ||
@@ -64,3 +67,3 @@ }, | ||
let files = fileList.map((file) => file.url).filter((url) => url !== undefined); | ||
this.$emit('update:modelValue', this.limit === 1 ? (files[0] || '') : files); | ||
this.$emit('update:modelValue', files); | ||
}, | ||
@@ -67,0 +70,0 @@ handleCancel() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28312
589