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.9 to 2.5.10

4

dist/index.js
/*!
* @form-create/component-elm-upload v2.5.9
* @form-create/component-elm-upload v2.5.10
* (c) 2018-2021 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)}},s=function(s){return s.reduce(function(s,a){for(var l in a)if(s[l])if(-1!==t.indexOf(l))s[l]=e({},s[l],a[l]);else if(-1!==i.indexOf(l)){var r=s[l]instanceof Array?s[l]:[s[l]],u=a[l]instanceof Array?a[l]:[a[l]];s[l]=r.concat(u)}else if(-1!==n.indexOf(l))for(var c in a[l])if(s[l][c]){var p=s[l][c]instanceof Array?s[l][c]:[s[l][c]],d=a[l][c]instanceof Array?a[l][c]:[a[l][c]];s[l][c]=p.concat(d)}else s[l][c]=a[l][c];else if("hook"==l)for(var f in a[l])s[l][f]=s[l][f]?o(s[l][f],a[l][f]):a[l][f];else s[l]=a[l];else s[l]=a[l];return s},{})};function a(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function l(e,t){return{url:e,name:r(e),uid:t}}function r(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:{formCreateRule:{type:Object,default:function(){return{props:{}}}},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:""}},created:function(){void 0===this.formCreateRule.props.showFileList&&(this.formCreateRule.props.showFileList=!1),this.formCreateRule.props.fileList=a(this.value).map(l)},watch:{value:function(e){this.$refs.upload.uploadFiles.every(function(e){return!e.status||"success"===e.status})&&(this.$refs.upload.uploadFiles=a(e).map(l),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.formCreateRule.props.disabled},onRemove:function(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick:function(e){this.isDisabled()||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",s([{},{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",s([{},this.formCreateRule,{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.$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.formCreateRule.props.showFileList&&(this.formCreateRule.props.showFileList=this.$refs.upload.showFileList),this.formCreateRule.props.fileList=this.$refs.upload.fileList),e("div",{class:"_fc-upload"},[[this.formCreateRule.props.showFileList?[]:this.makeFiles(),this.makeUpload()],e("el-dialog",{attrs:{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)}},s=function(s){return s.reduce(function(s,r){for(var a in r)if(s[a])if(-1!==t.indexOf(a))s[a]=e({},s[a],r[a]);else if(-1!==i.indexOf(a)){var l=s[a]instanceof Array?s[a]:[s[a]],p=r[a]instanceof Array?r[a]:[r[a]];s[a]=l.concat(p)}else if(-1!==n.indexOf(a))for(var c in r[a])if(s[a][c]){var d=s[a][c]instanceof Array?s[a][c]:[s[a][c]],u=r[a][c]instanceof Array?r[a][c]:[r[a][c]];s[a][c]=d.concat(u)}else s[a][c]=r[a][c];else if("hook"==a)for(var f in r[a])s[a][f]=s[a][f]?o(s[a][f],r[a][f]):r[a][f];else s[a]=r[a];else s[a]=r[a];return s},{})};function r(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function a(e,t){return{url:e,name:l(e),uid:t}}function l(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:""}},created:function(){void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=r(this.value).map(a)},watch:{value:function(e){this.$refs.upload.uploadFiles.every(function(e){return!e.status||"success"===e.status})&&(this.$refs.upload.uploadFiles=r(e).map(a),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.isDisabled()||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",s([{},{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",s([{},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.$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",{attrs:{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})}}});
//# sourceMappingURL=index.js.map
{
"name": "@form-create/component-elm-upload",
"version": "2.5.9",
"version": "2.5.10",
"description": "@form-create/element-ui 内置组件",

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

"dependencies": {
"@form-create/utils": "^2.5.9"
"@form-create/utils": "^2.5.10"
},

@@ -43,3 +43,3 @@ "bugs": {

},
"gitHead": "b4e39524136df76ad16c92a3697fdfe94ac296a7"
"gitHead": "7c08cb39580a4d60e2c9ec78823b47e9a0c4f115"
}

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

props: {
formCreateRule: {
formCreateInject: {
type: Object,
default: () => ({props: {}})
required: true,
},

@@ -62,6 +62,6 @@ onHandle: {

created() {
if (this.formCreateRule.props.showFileList === undefined) {
this.formCreateRule.props.showFileList = false;
if (this.formCreateInject.prop.props.showFileList === undefined) {
this.formCreateInject.prop.props.showFileList = false;
}
this.formCreateRule.props.fileList = toArray(this.value).map(parseFile);
this.formCreateInject.prop.props.fileList = toArray(this.value).map(parseFile);
},

@@ -88,3 +88,3 @@ watch: {

isDisabled() {
return this.formCreateRule.props.disabled === true;
return this.formCreateInject.prop.props.disabled === true;
},

@@ -143,3 +143,3 @@ onRemove(file) {

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

@@ -164,11 +164,12 @@ key={this.key('upload')}>

if (this.$refs.upload) {
if (this.formCreateRule.props.showFileList === undefined) {
this.formCreateRule.props.showFileList = this.$refs.upload.showFileList;
if (this.formCreateInject.prop.props.showFileList === undefined) {
this.formCreateInject.prop.props.showFileList = this.$refs.upload.showFileList;
}
this.formCreateRule.props.fileList = this.$refs.upload.fileList;
this.formCreateInject.prop.props.fileList = this.$refs.upload.fileList;
}
return (
<div
class='_fc-upload'>{[this.formCreateRule.props.showFileList ? [] : this.makeFiles(), this.makeUpload()]}
<el-dialog appendToBody={true} modal={this.previewMask} title={this.modalTitle} visible={this.previewVisible}
class='_fc-upload'>{[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()]}
<el-dialog appendToBody={true} modal={this.previewMask} title={this.modalTitle}
visible={this.previewVisible}
on-close={this.handleCancel}>

@@ -175,0 +176,0 @@ <img alt="example" style="width: 100%" src={this.previewImage}/>

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