@sysvale/show
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -234,3 +234,3 @@ import swal from 'sweetalert2'; | ||
render: function render() { | ||
var slotProvider = this.$scopedSlots || this.$slots; | ||
var slotProvider = this.$slots || this.$scopedSlots; | ||
var slot = slotProvider.default({ | ||
@@ -237,0 +237,0 @@ loading: this.loading, |
@@ -1,1 +0,1 @@ | ||
var SHOW=function(e,t,r,o,n,a){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r,o=o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o,n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;var i=function(e){return Array.isArray(e)},s=function(e){if(i(e))return e.map((function(e){return n(e)||i(e)?s(e):e}));var t={};return Object.keys(e).forEach((function(r){n(e[r])||i(e[r])?t[o(r)]=s(e[r]):t[o(r)]=e[r]})),t},c=function(e){return Array.isArray(e)},l=function(e){if(c(e))return e.map((function(e){return n(e)||c(e)?l(e):e}));var t={};return Object.keys(e).forEach((function(r){n(e[r])||c(e[r])?t[a(r)]=l(e[r]):t[a(r)]=e[r]})),t};function u(e,t){void 0===t&&(t="Não conseguimos processar sua requisição. Tente novamente.");var o=r(e,"errors",!1);return o&&o[Object.keys(o)[0]][0]||t}var d={title:"Informações salvas com sucesso!",icon:"success",text:"",showCloseButton:!0,confirmButtonText:"Ok"},f={icon:"error",title:"Erro",text:"mensagem de error",showCancelButton:!0,showConfirmButton:!1,cancelButtonText:"Fechar"};function p(e,t,r,o,n,a,i,s,c,l){"boolean"!=typeof i&&(c=s,s=i,i=!1);var u,d="function"==typeof r?r.options:r;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,n&&(d.functional=!0)),o&&(d._scopeId=o),a?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=u):t&&(u=i?function(e){t.call(this,l(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),u)if(d.functional){var f=d.render;d.render=function(e,t){return u.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,u):[u]}return r}var h=p({},void 0,{props:{service:{type:Function,required:!0},payload:{type:Object,default:function(){return{}}},payloadResolver:{type:Function,default:function(e){return l(e)}},dataResolver:{type:Function,default:function(e){return s(e)}},successSwalConfig:{type:Object,default:function(){return d}},errorSwalConfig:{type:Object,default:function(){return f}},errorFeedbackResolver:{type:Function,default:null},successFeedbackResolver:{type:Function,default:null},showSuccessFeedback:{type:Boolean,default:!1},hideErrorFeedback:{type:Boolean,default:!1},immediate:{type:Boolean,default:!1},forceResetError:{type:Boolean,default:!1},initialData:{default:null}},data:function(){return{loading:!1,failed:!1,error:null,data:this.initialData}},watch:{forceResetError:function(e){e&&(this.error=null)}},mounted:function(){this.immediate&&this.action()},methods:{action:function(e){var o=this;this.startRequest();var n=e||this.payload;this.service(this.payloadResolver(n)).then((function(e){var r=e.data;if(o.data=o.dataResolver(r),o.$emit("success",o.data),o.showSuccessFeedback){if(o.successFeedbackResolver)return void o.successFeedbackResolver({vm:o,data:o.data});t.fire(Object.assign({},d,o.successSwalConfig)).then((function(){o.$emit("success-feedback-ok",o.data)}))}})).catch((function(e){if(o.failed=!0,o.error=e,o.$emit("error",e),!o.hideErrorFeedback){var n=u(r(e,"response.data",null),"Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.");if(o.errorFeedbackResolver)return void o.errorFeedbackResolver({vm:o,error:e,errorMessage:n});t.fire(Object.assign({},f,o.errorSwalConfig,{text:n})).then((function(t){t.isDismissed&&o.$emit("error-feedback-cancel",e),t.isConfirmed&&o.$emit("error-feedback-ok",e)}))}})).finally((function(){o.loading=!1}))},labelHelper:function(e,t){return void 0===t&&(t="Carregando..."),this.loading?t:e},startRequest:function(){this.loading=!0,this.failed=!1,this.error=null}},render:function(){var e=(this.$scopedSlots||this.$slots).default({loading:this.loading,failed:this.failed,error:this.error,data:this.data,action:this.action,labelHelper:this.labelHelper,errorMessage:u(r(this.error,"response.data",null),"Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.")});return Array.isArray(e)?e[0]:e}},void 0,void 0,void 0,!1,void 0,void 0,void 0),v=Object.freeze({__proto__:null,RequestProvider:h});var y={$showConvertKeysToCamelCase:s,$showConvertKeysToSnakeCase:l,$showRemoveAccents:function(e){void 0===e&&(e="");for(var t,r=e.length,o=e.split(""),n=0;n<r;n+=1)-1!==(t="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž".indexOf(e[n]))&&(o[n]="AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"[t]);return o=(o=(o=(o=o.join("")).split(".").join("")).split("-").join("")).split("/").join("")},$showGenerateKey:function(e){void 0===e&&(e=8);for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length,n=0;n<e;n+=1)t+=r.charAt(Math.floor(Math.random()*o));return t}};var b={install:function e(t){if(!e.installed){e.installed=!0;var r=Number(t.version.split(".")[0]);r<=2&&Object.keys(y).forEach((function(e){t.prototype[e]=y[e]})),r>2&&Object.keys(y).forEach((function(e){t.config.globalProperties[e]=y[e]})),Object.keys(v).forEach((function(e){t.component("Show"+e,v[e])}))}}},m=null;return"undefined"!=typeof window?m=window.Vue:"undefined"!=typeof global&&(m=global.Vue),m&&m.use(b),e.RequestProvider=h,e.default=b,e}({},swal,get,camelCase,isObject,snakeCase); | ||
var SHOW=function(e,t,r,o,n,a){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r,o=o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o,n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;var i=function(e){return Array.isArray(e)},s=function(e){if(i(e))return e.map((function(e){return n(e)||i(e)?s(e):e}));var t={};return Object.keys(e).forEach((function(r){n(e[r])||i(e[r])?t[o(r)]=s(e[r]):t[o(r)]=e[r]})),t},c=function(e){return Array.isArray(e)},l=function(e){if(c(e))return e.map((function(e){return n(e)||c(e)?l(e):e}));var t={};return Object.keys(e).forEach((function(r){n(e[r])||c(e[r])?t[a(r)]=l(e[r]):t[a(r)]=e[r]})),t};function u(e,t){void 0===t&&(t="Não conseguimos processar sua requisição. Tente novamente.");var o=r(e,"errors",!1);return o&&o[Object.keys(o)[0]][0]||t}var d={title:"Informações salvas com sucesso!",icon:"success",text:"",showCloseButton:!0,confirmButtonText:"Ok"},f={icon:"error",title:"Erro",text:"mensagem de error",showCancelButton:!0,showConfirmButton:!1,cancelButtonText:"Fechar"};function p(e,t,r,o,n,a,i,s,c,l){"boolean"!=typeof i&&(c=s,s=i,i=!1);var u,d="function"==typeof r?r.options:r;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,n&&(d.functional=!0)),o&&(d._scopeId=o),a?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=u):t&&(u=i?function(e){t.call(this,l(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),u)if(d.functional){var f=d.render;d.render=function(e,t){return u.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,u):[u]}return r}var h=p({},void 0,{props:{service:{type:Function,required:!0},payload:{type:Object,default:function(){return{}}},payloadResolver:{type:Function,default:function(e){return l(e)}},dataResolver:{type:Function,default:function(e){return s(e)}},successSwalConfig:{type:Object,default:function(){return d}},errorSwalConfig:{type:Object,default:function(){return f}},errorFeedbackResolver:{type:Function,default:null},successFeedbackResolver:{type:Function,default:null},showSuccessFeedback:{type:Boolean,default:!1},hideErrorFeedback:{type:Boolean,default:!1},immediate:{type:Boolean,default:!1},forceResetError:{type:Boolean,default:!1},initialData:{default:null}},data:function(){return{loading:!1,failed:!1,error:null,data:this.initialData}},watch:{forceResetError:function(e){e&&(this.error=null)}},mounted:function(){this.immediate&&this.action()},methods:{action:function(e){var o=this;this.startRequest();var n=e||this.payload;this.service(this.payloadResolver(n)).then((function(e){var r=e.data;if(o.data=o.dataResolver(r),o.$emit("success",o.data),o.showSuccessFeedback){if(o.successFeedbackResolver)return void o.successFeedbackResolver({vm:o,data:o.data});t.fire(Object.assign({},d,o.successSwalConfig)).then((function(){o.$emit("success-feedback-ok",o.data)}))}})).catch((function(e){if(o.failed=!0,o.error=e,o.$emit("error",e),!o.hideErrorFeedback){var n=u(r(e,"response.data",null),"Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.");if(o.errorFeedbackResolver)return void o.errorFeedbackResolver({vm:o,error:e,errorMessage:n});t.fire(Object.assign({},f,o.errorSwalConfig,{text:n})).then((function(t){t.isDismissed&&o.$emit("error-feedback-cancel",e),t.isConfirmed&&o.$emit("error-feedback-ok",e)}))}})).finally((function(){o.loading=!1}))},labelHelper:function(e,t){return void 0===t&&(t="Carregando..."),this.loading?t:e},startRequest:function(){this.loading=!0,this.failed=!1,this.error=null}},render:function(){var e=(this.$slots||this.$scopedSlots).default({loading:this.loading,failed:this.failed,error:this.error,data:this.data,action:this.action,labelHelper:this.labelHelper,errorMessage:u(r(this.error,"response.data",null),"Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.")});return Array.isArray(e)?e[0]:e}},void 0,void 0,void 0,!1,void 0,void 0,void 0),v=Object.freeze({__proto__:null,RequestProvider:h});var y={$showConvertKeysToCamelCase:s,$showConvertKeysToSnakeCase:l,$showRemoveAccents:function(e){void 0===e&&(e="");for(var t,r=e.length,o=e.split(""),n=0;n<r;n+=1)-1!==(t="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž".indexOf(e[n]))&&(o[n]="AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"[t]);return o=(o=(o=(o=o.join("")).split(".").join("")).split("-").join("")).split("/").join("")},$showGenerateKey:function(e){void 0===e&&(e=8);for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length,n=0;n<e;n+=1)t+=r.charAt(Math.floor(Math.random()*o));return t}};var b={install:function e(t){if(!e.installed){e.installed=!0;var r=Number(t.version.split(".")[0]);r<=2&&Object.keys(y).forEach((function(e){t.prototype[e]=y[e]})),r>2&&Object.keys(y).forEach((function(e){t.config.globalProperties[e]=y[e]})),Object.keys(v).forEach((function(e){t.component("Show"+e,v[e])}))}}},m=null;return"undefined"!=typeof window?m=window.Vue:"undefined"!=typeof global&&(m=global.Vue),m&&m.use(b),e.RequestProvider=h,e.default=b,e}({},swal,get,camelCase,isObject,snakeCase); |
@@ -222,3 +222,3 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});function _interopDefault(e){return(e&&(typeof e==='object')&&'default'in e)?e['default']:e}var swal=_interopDefault(require('sweetalert2')),get=_interopDefault(require('lodash.get')),camelCase=_interopDefault(require('lodash.camelcase')),isObject=_interopDefault(require('lodash.isobject')),snakeCase=_interopDefault(require('lodash.snakecase'));var isArray = function (arg) { return Array.isArray(arg); }; | ||
render: function render() { | ||
var slotProvider = this.$scopedSlots || this.$slots; | ||
var slotProvider = this.$slots || this.$scopedSlots; | ||
var slot = slotProvider.default({ | ||
@@ -322,3 +322,3 @@ loading: this.loading, | ||
/* module identifier */ | ||
var __vue_module_identifier__ = "data-v-1c63dfe6"; | ||
var __vue_module_identifier__ = "data-v-4282f00e"; | ||
/* functional template */ | ||
@@ -325,0 +325,0 @@ var __vue_is_functional_template__ = undefined; |
{ | ||
"name": "@sysvale/show", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A set of components used at Sysvale", | ||
@@ -132,6 +132,13 @@ "repository": { | ||
}, | ||
"setupFilesAfterEnv": ["./src/utils/setupTests.js"], | ||
"setupFilesAfterEnv": [ | ||
"./src/utils/setupTests.js" | ||
], | ||
"collectCoverage": true, | ||
"collectCoverageFrom": ["src/**/*.vue"], | ||
"coverageReporters": ["lcov", "text"] | ||
"collectCoverageFrom": [ | ||
"src/**/*.vue" | ||
], | ||
"coverageReporters": [ | ||
"lcov", | ||
"text" | ||
] | ||
}, | ||
@@ -138,0 +145,0 @@ "babel": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
34990
1