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.0-alpha.1 to 2.5.0-alpha.4

4

dist/index.js
/*!
* @form-create/component-elm-upload v2.5.0-alpha.1
* @form-create/component-elm-upload v2.5.0-alpha.4
* (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]],c=a[l]instanceof Array?a[l]:[a[l]];s[l]=r.concat(c)}else if(-1!==n.indexOf(l))for(var u in a[l])if(s[l][u]){var p=s[l][u]instanceof Array?s[l][u]:[s[l][u]],d=a[l][u]instanceof Array?a[l][u]:[a[l][u]];s[l][u]=p.concat(d)}else s[l][u]=a[l][u];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=this.$createElement,t=!this.limit||this.limit>this.uploadList.length;return e("ElUpload",s([{},this.formCreateRule,{ref:"upload",style:{display:"inline-block"},key:this.key("upload")}]),[t?e("template",{slot:"default"},[this.$slots.default?this.$slots.default:e("div",{class:"fc-upload-btn"},[e("i",{class:"el-icon-upload2"})])]):null])},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:{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,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:{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.0-alpha.1",
"version": "2.5.0-alpha.4",
"description": "@form-create/element-ui 内置组件",

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

"dependencies": {
"@form-create/utils": "^2.5.0-alpha.1"
"@form-create/utils": "^2.5.0-alpha.4"
},

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

},
"gitHead": "db6aa6042489b71fcac24819012b38f8cfb69ae1"
"gitHead": "3c6f57069cf418bfc2c2787b72dd7e3ff652cb7c"
}
import toArray from '@form-create/utils/lib/toarray';
import getSlot from '@form-create/utils/lib/slot';
import './style.css';

@@ -143,6 +144,6 @@

{isShow ? <template slot="default">
{this.$slots.default ? this.$slots.default : <div class='fc-upload-btn'>
{this.$slots.default || <div class='fc-upload-btn'>
<i class="el-icon-upload2"/>
</div>}
</template> : null}
</template> : null}{getSlot(this.$slots, ['default'])}
</ElUpload>;

@@ -149,0 +150,0 @@ },

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