Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@form-create/component-elm-upload

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@form-create/component-elm-upload - npm Package Compare versions

Comparing version 2.5.31 to 2.5.32

4

dist/index.js
/*!
* @form-create/component-elm-upload v2.5.31
* @form-create/component-elm-upload v2.5.32
* (c) 2018-2023 xaboy

@@ -7,3 +7,3 @@ * Github https://github.com/xaboy/form-create with @form-create/component-elm-upload

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).FcUpload=t()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t,i=1;i<arguments.length;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)}var t=["attrs","props","domProps"],i=["class","style","directives"],n=["on","nativeOn"],o=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},r=function(r){return r.reduce(function(r,s){for(var a in s)if(r[a])if(-1!==t.indexOf(a))r[a]=e({},r[a],s[a]);else if(-1!==i.indexOf(a)){var l=r[a]instanceof Array?r[a]:[r[a]],c=s[a]instanceof Array?s[a]:[s[a]];r[a]=l.concat(c)}else if(-1!==n.indexOf(a))for(var p in s[a])if(r[a][p]){var u=r[a][p]instanceof Array?r[a][p]:[r[a][p]],d=s[a][p]instanceof Array?s[a][p]:[s[a][p]];r[a][p]=u.concat(d)}else r[a][p]=s[a][p];else if("hook"==a)for(var f in s[a])r[a][f]=r[a][f]?o(r[a][f],s[a][f]):s[a][f];else r[a]=s[a];else r[a]=s[a];return r},{})};function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function l(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function c(e,t){return{url:e,name:p(e),uid:t}}function p(e){return(""+e).split("/").pop()}!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("._fc-upload .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-upload .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-upload .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-upload .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-upload .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-upload .el-upload {\n display: block;\n}\n\n._fc-upload .fc-upload-btn, ._fc-upload .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n");return{name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default:function(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,modalTitle:String,handleIcon:{type:[String,Boolean],default:function(){}},value:[Array,String]},data:function(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created:function(){void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=l(this.value).map(c)},watch:{value:function(e){this.$refs.upload.uploadFiles.every(function(e){return!e.status||"success"===e.status})&&(this.$refs.upload.uploadFiles=l(e).map(c),this.uploadList=this.$refs.upload.uploadFiles)},limit:function(e,t){1!==t&&1!==e||this.update()}},methods:{key:function(e){return e},isDisabled:function(){return!0===this.formCreateInject.prop.props.disabled},onRemove:function(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick:function(e){this.onHandle(e)},makeItem:function(e,t){var i=this.$createElement;return"image"===this.uploadType?i("img",{attrs:{src:e.url},key:this.key("img"+t)}):i("i",{class:"el-icon-tickets",key:this.key("i"+t)})},makeRemoveIcon:function(e,t){var i=this;return(0,this.$createElement)("i",{class:"el-icon-delete",on:{click:function(){return i.onRemove(e)}},key:this.key("ri"+t)})},makeHandleIcon:function(e,t){var i=this;return(0,this.$createElement)("i",{class:!0===this.handleIcon||void 0===this.handleIcon?"el-icon-view":this.handleIcon,on:{click:function(){return i.handleClick(e)}},key:this.key("hi"+t)})},makeProgress:function(e,t){return(0,this.$createElement)("ElProgress",r([{},{props:{percentage:e.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+t)}]))},makeIcons:function(e,t){var i=this.$createElement,n=[];if(this.allowRemove||!1!==this.handleIcon)return("file"!==this.uploadType&&!1!==this.handleIcon||"file"===this.uploadType&&this.handleIcon)&&n.push(this.makeHandleIcon(e,t)),this.allowRemove&&n.push(this.makeRemoveIcon(e,t)),i("div",{class:"fc-upload-cover"},[n])},makeFiles:function(){var e=this,t=this.$createElement;return this.uploadList.map(function(i,n){return e.$scopedSlots.fileList?e.$scopedSlots.fileList({file:i,index:n,vm:e}):t("div",{key:e.key(n),class:"fc-files"},[void 0!==i.percentage&&"success"!==i.status?e.makeProgress(i,n):[e.makeItem(i,n),e.makeIcons(i,n)]])})},makeUpload:function(){var e,t,i=this.$createElement,n=!this.limit||this.limit>this.uploadList.length;return i("ElUpload",r([{},this.formCreateInject.prop,{ref:"upload",style:{display:"inline-block"},key:this.key("upload")}]),[n?i("template",{slot:"default"},[this.$slots.default||i("div",{class:"fc-upload-btn"},[i("i",{class:"el-icon-upload2"})])]):null,(e=this.$slots,t=["default"],Object.keys(e).reduce(function(i,n){return t&&-1!==t.indexOf(n)||i.push(e[n]),i},[]))])},update:function(){var e=this.$refs.upload.uploadFiles.map(function(e){return e.url}).filter(function(e){return void 0!==e});this.cacheFiles.length===e.length&&e.length||(this.cacheFiles=s(e),this.$emit("input",1===this.limit?e[0]||"":e))},handleCancel:function(){this.previewVisible=!1}},render:function(){var e=arguments[0];return this.$refs.upload&&(void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=this.$refs.upload.showFileList),this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),e("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showFileList?[]:this.makeFiles(),this.makeUpload()],e("el-dialog",r([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[e("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted:function(){var e=this;this.uploadList=this.$refs.upload.uploadFiles,this.$watch(function(){return e.$refs.upload.uploadFiles},function(){e.update()},{deep:!0})}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).FcUpload=t()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t,i=1;i<arguments.length;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)}var t=["attrs","props","domProps"],i=["class","style","directives"],n=["on","nativeOn"],o=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},r=function(r){return r.reduce(function(r,s){for(var a in s)if(r[a])if(-1!==t.indexOf(a))r[a]=e({},r[a],s[a]);else if(-1!==i.indexOf(a)){var l=r[a]instanceof Array?r[a]:[r[a]],c=s[a]instanceof Array?s[a]:[s[a]];r[a]=l.concat(c)}else if(-1!==n.indexOf(a))for(var p in s[a])if(r[a][p]){var u=r[a][p]instanceof Array?r[a][p]:[r[a][p]],d=s[a][p]instanceof Array?s[a][p]:[s[a][p]];r[a][p]=u.concat(d)}else r[a][p]=s[a][p];else if("hook"==a)for(var f in s[a])r[a][f]=r[a][f]?o(r[a][f],s[a][f]):s[a][f];else r[a]=s[a];else r[a]=s[a];return r},{})};function s(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function l(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function c(e,t){return{url:e,name:p(e),uid:t}}function p(e){return(""+e).split("/").pop()}!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("._fc-upload .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-upload .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-upload .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-upload .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-upload .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-upload .el-upload {\n display: block;\n}\n\n._fc-upload .fc-upload-btn, ._fc-upload .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n");return{name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default:function(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,modalTitle:String,handleIcon:{type:[String,Boolean],default:function(){}},value:[Array,String]},data:function(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created:function(){void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=l(this.value).map(c)},watch:{value:function(e){this.$refs.upload.uploadFiles.every(function(e){return!e.status||"success"===e.status})&&(this.$refs.upload.uploadFiles=l(e).map(c),this.uploadList=this.$refs.upload.uploadFiles)},limit:function(e,t){1!==t&&1!==e||this.update()}},methods:{key:function(e){return e},isDisabled:function(){return!0===this.formCreateInject.prop.props.disabled},onRemove:function(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick:function(e){this.onHandle(e)},makeItem:function(e,t){var i=this.$createElement;return"image"===this.uploadType?i("img",{attrs:{src:e.url},key:this.key("img"+t)}):i("i",{class:"el-icon-tickets",key:this.key("i"+t)})},makeRemoveIcon:function(e,t){var i=this;return(0,this.$createElement)("i",{class:"el-icon-delete",on:{click:function(){return i.onRemove(e)}},key:this.key("ri"+t)})},makeHandleIcon:function(e,t){var i=this;return(0,this.$createElement)("i",{class:!0===this.handleIcon||void 0===this.handleIcon?"el-icon-view":this.handleIcon,on:{click:function(){return i.handleClick(e)}},key:this.key("hi"+t)})},makeProgress:function(e,t){return(0,this.$createElement)("ElProgress",r([{},{props:{percentage:e.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+t)}]))},makeIcons:function(e,t){var i=this.$createElement,n=[];if(this.allowRemove||!1!==this.handleIcon)return("file"!==this.uploadType&&!1!==this.handleIcon||"file"===this.uploadType&&this.handleIcon)&&n.push(this.makeHandleIcon(e,t)),this.allowRemove&&n.push(this.makeRemoveIcon(e,t)),i("div",{class:"fc-upload-cover"},[n])},makeFiles:function(){var e=this,t=this.$createElement;return this.uploadList.map(function(i,n){return e.$scopedSlots.fileList?e.$scopedSlots.fileList({file:i,index:n,vm:e}):t("div",{key:e.key(n),class:"fc-files"},[void 0!==i.percentage&&"success"!==i.status?e.makeProgress(i,n):[e.makeItem(i,n),e.makeIcons(i,n)]])})},makeUpload:function(){var e,t,i=this.$createElement,n=!this.limit||this.limit>this.uploadList.length;return i("ElUpload",r([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[n?i("template",{slot:"default"},[this.$slots.default||i("div",{class:"fc-upload-btn"},[i("i",{class:"el-icon-upload2"})])]):null,(e=this.$slots,t=["default"],Object.keys(e).reduce(function(i,n){return t&&-1!==t.indexOf(n)||i.push(e[n]),i},[]))])},update:function(){var e=this.$refs.upload.uploadFiles.map(function(e){return e.url}).filter(function(e){return void 0!==e});this.cacheFiles.length===e.length&&e.length||(this.cacheFiles=s(e),this.$emit("input",1===this.limit?e[0]||"":e))},handleCancel:function(){this.previewVisible=!1}},render:function(){var e=arguments[0];return this.$refs.upload&&(void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=this.$refs.upload.showFileList),this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),e("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showFileList?[]:this.makeFiles(),this.makeUpload()],e("el-dialog",r([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[e("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted:function(){var e=this;this.uploadList=this.$refs.upload.uploadFiles,this.$watch(function(){return e.$refs.upload.uploadFiles},function(){e.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}}});
//# sourceMappingURL=index.js.map
{
"name": "@form-create/component-elm-upload",
"version": "2.5.31",
"version": "2.5.32",
"description": "@form-create/element-ui 内置组件",

@@ -42,3 +42,3 @@ "main": "./dist/index.js",

},
"gitHead": "a963ffacbba371b5589112e605846dc993944dc0"
"gitHead": "8b4a977f33789d6866a98ecd2559858a4d5a20ec"
}

@@ -138,5 +138,7 @@ import toArray from '@form-create/utils/lib/toarray';

const isShow = (!this.limit || this.limit > this.uploadList.length);
return <ElUpload {...this.formCreateInject.prop} ref="upload"
style={{display: 'inline-block'}}
key={this.key('upload')}>
return <ElUpload {...this.formCreateInject.prop} {...{
style: {display: 'inline-block'},
key: this.key('upload'),
ref: 'upload'
}}>
{isShow ? <template slot="default">

@@ -187,3 +189,4 @@ {this.$slots.default || <div class='fc-upload-btn'>

}, {deep: true});
this.$emit('fc.el', this.$refs.upload);
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc