@sysvale/show 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/@sysvale/show.esm.js +185 -181
- package/dist/@sysvale/show.min.js +1 -1
- package/dist/@sysvale/show.ssr.js +186 -182
- package/package.json +155 -155
package/README.md
CHANGED
@@ -60,193 +60,197 @@ function getFirstErrorMessage(response, fallbackMsg) {
|
|
60
60
|
return errors[firstKey][0] || fallbackMsg;
|
61
61
|
}
|
62
62
|
|
63
|
-
var SUCCESS_SWAL_DEFAULT_CONFIG = {
|
64
|
-
title: 'Informações salvas com sucesso!',
|
65
|
-
icon: 'success',
|
66
|
-
text: '',
|
67
|
-
showCloseButton: true,
|
68
|
-
confirmButtonText: 'Ok',
|
69
|
-
};
|
70
|
-
|
71
|
-
var ERROR_SWAL_DEFAULT_CONFIG = {
|
72
|
-
icon: 'error',
|
73
|
-
title: 'Erro',
|
74
|
-
text: 'mensagem de error',
|
75
|
-
showCancelButton: true,
|
76
|
-
showConfirmButton: false,
|
77
|
-
cancelButtonText: 'Fechar',
|
78
|
-
};
|
79
|
-
|
80
|
-
var script = {
|
81
|
-
props: {
|
82
|
-
service: {
|
83
|
-
type: Function,
|
84
|
-
required: true,
|
85
|
-
},
|
86
|
-
payload: {
|
87
|
-
type: Object,
|
88
|
-
default: function () { return ({}); },
|
89
|
-
},
|
90
|
-
payloadResolver: {
|
91
|
-
type: Function,
|
92
|
-
default: function (data) { return convertKeysToSnakeCase(data); },
|
93
|
-
},
|
94
|
-
dataResolver: {
|
95
|
-
type: Function,
|
96
|
-
default: function (data) { return convertKeysToCamelCase(data); },
|
97
|
-
},
|
98
|
-
successSwalConfig: {
|
99
|
-
type: Object,
|
100
|
-
default: function () { return SUCCESS_SWAL_DEFAULT_CONFIG; },
|
101
|
-
},
|
102
|
-
errorSwalConfig: {
|
103
|
-
type: Object,
|
104
|
-
default: function () { return ERROR_SWAL_DEFAULT_CONFIG; },
|
105
|
-
},
|
106
|
-
errorFeedbackResolver: {
|
107
|
-
type: Function,
|
108
|
-
default: null,
|
109
|
-
},
|
110
|
-
successFeedbackResolver: {
|
111
|
-
type: Function,
|
112
|
-
default: null,
|
113
|
-
},
|
114
|
-
showSuccessFeedback: {
|
115
|
-
type: Boolean,
|
116
|
-
default: false,
|
117
|
-
},
|
118
|
-
hideErrorFeedback: {
|
119
|
-
type: Boolean,
|
120
|
-
default: false,
|
121
|
-
},
|
122
|
-
immediate: {
|
123
|
-
type: Boolean,
|
124
|
-
default: false,
|
125
|
-
},
|
126
|
-
forceResetError: {
|
127
|
-
type: Boolean,
|
128
|
-
default: false,
|
129
|
-
},
|
130
|
-
initialData: {
|
131
|
-
default: null,
|
132
|
-
},
|
133
|
-
},
|
134
|
-
|
135
|
-
data: function data() {
|
136
|
-
return {
|
137
|
-
loading: false,
|
138
|
-
failed: false,
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
63
|
+
var SUCCESS_SWAL_DEFAULT_CONFIG = {
|
64
|
+
title: 'Informações salvas com sucesso!',
|
65
|
+
icon: 'success',
|
66
|
+
text: '',
|
67
|
+
showCloseButton: true,
|
68
|
+
confirmButtonText: 'Ok',
|
69
|
+
};
|
70
|
+
|
71
|
+
var ERROR_SWAL_DEFAULT_CONFIG = {
|
72
|
+
icon: 'error',
|
73
|
+
title: 'Erro',
|
74
|
+
text: 'mensagem de error',
|
75
|
+
showCancelButton: true,
|
76
|
+
showConfirmButton: false,
|
77
|
+
cancelButtonText: 'Fechar',
|
78
|
+
};
|
79
|
+
|
80
|
+
var script = {
|
81
|
+
props: {
|
82
|
+
service: {
|
83
|
+
type: Function,
|
84
|
+
required: true,
|
85
|
+
},
|
86
|
+
payload: {
|
87
|
+
type: Object,
|
88
|
+
default: function () { return ({}); },
|
89
|
+
},
|
90
|
+
payloadResolver: {
|
91
|
+
type: Function,
|
92
|
+
default: function (data) { return convertKeysToSnakeCase(data); },
|
93
|
+
},
|
94
|
+
dataResolver: {
|
95
|
+
type: Function,
|
96
|
+
default: function (data) { return convertKeysToCamelCase(data); },
|
97
|
+
},
|
98
|
+
successSwalConfig: {
|
99
|
+
type: Object,
|
100
|
+
default: function () { return SUCCESS_SWAL_DEFAULT_CONFIG; },
|
101
|
+
},
|
102
|
+
errorSwalConfig: {
|
103
|
+
type: Object,
|
104
|
+
default: function () { return ERROR_SWAL_DEFAULT_CONFIG; },
|
105
|
+
},
|
106
|
+
errorFeedbackResolver: {
|
107
|
+
type: Function,
|
108
|
+
default: null,
|
109
|
+
},
|
110
|
+
successFeedbackResolver: {
|
111
|
+
type: Function,
|
112
|
+
default: null,
|
113
|
+
},
|
114
|
+
showSuccessFeedback: {
|
115
|
+
type: Boolean,
|
116
|
+
default: false,
|
117
|
+
},
|
118
|
+
hideErrorFeedback: {
|
119
|
+
type: Boolean,
|
120
|
+
default: false,
|
121
|
+
},
|
122
|
+
immediate: {
|
123
|
+
type: Boolean,
|
124
|
+
default: false,
|
125
|
+
},
|
126
|
+
forceResetError: {
|
127
|
+
type: Boolean,
|
128
|
+
default: false,
|
129
|
+
},
|
130
|
+
initialData: {
|
131
|
+
default: null,
|
132
|
+
},
|
133
|
+
},
|
134
|
+
|
135
|
+
data: function data() {
|
136
|
+
return {
|
137
|
+
loading: false,
|
138
|
+
failed: false,
|
139
|
+
succeeded: false,
|
140
|
+
error: null,
|
141
|
+
data: this.initialData,
|
142
|
+
};
|
143
|
+
},
|
144
|
+
|
145
|
+
watch: {
|
146
|
+
forceResetError: function forceResetError(newValue) {
|
147
|
+
if (newValue) {
|
148
|
+
this.error = null;
|
149
|
+
}
|
150
|
+
},
|
151
|
+
},
|
152
|
+
|
153
|
+
mounted: function mounted() {
|
154
|
+
if (this.immediate) {
|
155
|
+
this.action();
|
156
|
+
}
|
157
|
+
},
|
158
|
+
|
159
|
+
methods: {
|
159
160
|
action: function action(payloadFromArgs) {
|
160
161
|
var this$1 = this;
|
161
|
-
|
162
|
-
this.startRequest();
|
163
|
-
var payload = payloadFromArgs || this.payload;
|
164
|
-
this.service(this.payloadResolver(payload))
|
165
|
-
.then(
|
162
|
+
|
163
|
+
this.startRequest();
|
164
|
+
var payload = payloadFromArgs || this.payload;
|
165
|
+
this.service(this.payloadResolver(payload))
|
166
|
+
.then(
|
166
167
|
function (ref) {
|
167
168
|
var data = ref.data;
|
168
|
-
|
169
|
-
this$1.data = this$1.dataResolver(data);
|
170
|
-
this$1
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
this$1
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
this$1.
|
187
|
-
this$1
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
169
|
+
|
170
|
+
this$1.data = this$1.dataResolver(data);
|
171
|
+
this$1.succeeded = true;
|
172
|
+
this$1.$emit('success', this$1.data);
|
173
|
+
|
174
|
+
if (this$1.showSuccessFeedback) {
|
175
|
+
if (this$1.successFeedbackResolver) {
|
176
|
+
this$1.successFeedbackResolver({ vm: this$1, data: this$1.data });
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
swal.fire(Object.assign({}, SUCCESS_SWAL_DEFAULT_CONFIG,
|
180
|
+
this$1.successSwalConfig)).then(function () {
|
181
|
+
this$1.$emit('success-feedback-ok', this$1.data);
|
182
|
+
});
|
183
|
+
}
|
184
|
+
}
|
185
|
+
).catch(
|
186
|
+
function (error) {
|
187
|
+
this$1.failed = true;
|
188
|
+
this$1.error = error;
|
189
|
+
this$1.$emit('error', error);
|
190
|
+
|
191
|
+
if (!this$1.hideErrorFeedback) {
|
192
|
+
var errorMessage = getFirstErrorMessage(
|
193
|
+
get(error, 'response.data', null),
|
194
|
+
'Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.'
|
195
|
+
);
|
196
|
+
|
197
|
+
if (this$1.errorFeedbackResolver) {
|
198
|
+
this$1.errorFeedbackResolver({ vm: this$1, error: error, errorMessage: errorMessage });
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
|
202
|
+
swal.fire(Object.assign({}, ERROR_SWAL_DEFAULT_CONFIG,
|
203
|
+
this$1.errorSwalConfig,
|
204
|
+
{text: errorMessage})).then(function (result) {
|
205
|
+
if (result.isDismissed) {
|
206
|
+
this$1.$emit('error-feedback-cancel', error);
|
207
|
+
}
|
208
|
+
if (result.isConfirmed) {
|
209
|
+
this$1.$emit('error-feedback-ok', error);
|
210
|
+
}
|
211
|
+
});
|
212
|
+
}
|
213
|
+
}
|
214
|
+
).finally(function () {
|
215
|
+
this$1.loading = false;
|
216
|
+
});
|
217
|
+
},
|
218
|
+
|
217
219
|
labelHelper: function labelHelper(label, loadingLabel) {
|
218
220
|
if ( loadingLabel === void 0 ) loadingLabel = 'Carregando...';
|
219
|
-
|
220
|
-
if (this.loading) {
|
221
|
-
return loadingLabel;
|
222
|
-
}
|
223
|
-
return label;
|
224
|
-
},
|
225
|
-
|
226
|
-
startRequest: function startRequest() {
|
227
|
-
this.loading = true;
|
228
|
-
this.failed = false;
|
229
|
-
this.
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
var
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
221
|
+
|
222
|
+
if (this.loading) {
|
223
|
+
return loadingLabel;
|
224
|
+
}
|
225
|
+
return label;
|
226
|
+
},
|
227
|
+
|
228
|
+
startRequest: function startRequest() {
|
229
|
+
this.loading = true;
|
230
|
+
this.failed = false;
|
231
|
+
this.succeeded = false;
|
232
|
+
this.error = null;
|
233
|
+
},
|
234
|
+
},
|
235
|
+
|
236
|
+
render: function render() {
|
237
|
+
var slotProvider = this.$slots || this.$scopedSlots;
|
238
|
+
var slot = slotProvider.default({
|
239
|
+
loading: this.loading,
|
240
|
+
failed: this.failed,
|
241
|
+
succeeded: this.succeeded,
|
242
|
+
error: this.error,
|
243
|
+
data: this.data,
|
244
|
+
action: this.action,
|
245
|
+
labelHelper: this.labelHelper,
|
246
|
+
errorMessage: getFirstErrorMessage(
|
247
|
+
get(this.error, 'response.data', null),
|
248
|
+
'Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.'
|
249
|
+
),
|
250
|
+
});
|
251
|
+
|
252
|
+
return Array.isArray(slot) ? slot[0] : slot;
|
253
|
+
},
|
250
254
|
};
|
251
255
|
|
252
256
|
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
@@ -1 +1 @@
|
|
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)},
|
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)},u=function(e){if(c(e))return e.map((function(e){return n(e)||c(e)?u(e):e}));var t={};return Object.keys(e).forEach((function(r){n(e[r])||c(e[r])?t[a(r)]=u(e[r]):t[a(r)]=e[r]})),t};function l(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,u){"boolean"!=typeof i&&(c=s,s=i,i=!1);var l,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?(l=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=l):t&&(l=i?function(e){t.call(this,u(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),l)if(d.functional){var f=d.render;d.render=function(e,t){return l.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,l):[l]}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 u(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,succeeded:!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.succeeded=!0,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=l(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.succeeded=!1,this.error=null}},render:function(){var e=(this.$slots||this.$scopedSlots).default({loading:this.loading,failed:this.failed,succeeded:this.succeeded,error:this.error,data:this.data,action:this.action,labelHelper:this.labelHelper,errorMessage:l(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:u,$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);
|
@@ -48,193 +48,197 @@ var convertKeysToSnakeCase = function (data) {
|
|
48
48
|
var ref = Object.keys(errors);
|
49
49
|
var firstKey = ref[0];
|
50
50
|
return errors[firstKey][0] || fallbackMsg;
|
51
|
-
}var SUCCESS_SWAL_DEFAULT_CONFIG = {
|
52
|
-
title: 'Informações salvas com sucesso!',
|
53
|
-
icon: 'success',
|
54
|
-
text: '',
|
55
|
-
showCloseButton: true,
|
56
|
-
confirmButtonText: 'Ok',
|
57
|
-
};
|
58
|
-
|
59
|
-
var ERROR_SWAL_DEFAULT_CONFIG = {
|
60
|
-
icon: 'error',
|
61
|
-
title: 'Erro',
|
62
|
-
text: 'mensagem de error',
|
63
|
-
showCancelButton: true,
|
64
|
-
showConfirmButton: false,
|
65
|
-
cancelButtonText: 'Fechar',
|
66
|
-
};
|
67
|
-
|
68
|
-
var script = {
|
69
|
-
props: {
|
70
|
-
service: {
|
71
|
-
type: Function,
|
72
|
-
required: true,
|
73
|
-
},
|
74
|
-
payload: {
|
75
|
-
type: Object,
|
76
|
-
default: function () { return ({}); },
|
77
|
-
},
|
78
|
-
payloadResolver: {
|
79
|
-
type: Function,
|
80
|
-
default: function (data) { return convertKeysToSnakeCase(data); },
|
81
|
-
},
|
82
|
-
dataResolver: {
|
83
|
-
type: Function,
|
84
|
-
default: function (data) { return convertKeysToCamelCase(data); },
|
85
|
-
},
|
86
|
-
successSwalConfig: {
|
87
|
-
type: Object,
|
88
|
-
default: function () { return SUCCESS_SWAL_DEFAULT_CONFIG; },
|
89
|
-
},
|
90
|
-
errorSwalConfig: {
|
91
|
-
type: Object,
|
92
|
-
default: function () { return ERROR_SWAL_DEFAULT_CONFIG; },
|
93
|
-
},
|
94
|
-
errorFeedbackResolver: {
|
95
|
-
type: Function,
|
96
|
-
default: null,
|
97
|
-
},
|
98
|
-
successFeedbackResolver: {
|
99
|
-
type: Function,
|
100
|
-
default: null,
|
101
|
-
},
|
102
|
-
showSuccessFeedback: {
|
103
|
-
type: Boolean,
|
104
|
-
default: false,
|
105
|
-
},
|
106
|
-
hideErrorFeedback: {
|
107
|
-
type: Boolean,
|
108
|
-
default: false,
|
109
|
-
},
|
110
|
-
immediate: {
|
111
|
-
type: Boolean,
|
112
|
-
default: false,
|
113
|
-
},
|
114
|
-
forceResetError: {
|
115
|
-
type: Boolean,
|
116
|
-
default: false,
|
117
|
-
},
|
118
|
-
initialData: {
|
119
|
-
default: null,
|
120
|
-
},
|
121
|
-
},
|
122
|
-
|
123
|
-
data: function data() {
|
124
|
-
return {
|
125
|
-
loading: false,
|
126
|
-
failed: false,
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
51
|
+
}var SUCCESS_SWAL_DEFAULT_CONFIG = {
|
52
|
+
title: 'Informações salvas com sucesso!',
|
53
|
+
icon: 'success',
|
54
|
+
text: '',
|
55
|
+
showCloseButton: true,
|
56
|
+
confirmButtonText: 'Ok',
|
57
|
+
};
|
58
|
+
|
59
|
+
var ERROR_SWAL_DEFAULT_CONFIG = {
|
60
|
+
icon: 'error',
|
61
|
+
title: 'Erro',
|
62
|
+
text: 'mensagem de error',
|
63
|
+
showCancelButton: true,
|
64
|
+
showConfirmButton: false,
|
65
|
+
cancelButtonText: 'Fechar',
|
66
|
+
};
|
67
|
+
|
68
|
+
var script = {
|
69
|
+
props: {
|
70
|
+
service: {
|
71
|
+
type: Function,
|
72
|
+
required: true,
|
73
|
+
},
|
74
|
+
payload: {
|
75
|
+
type: Object,
|
76
|
+
default: function () { return ({}); },
|
77
|
+
},
|
78
|
+
payloadResolver: {
|
79
|
+
type: Function,
|
80
|
+
default: function (data) { return convertKeysToSnakeCase(data); },
|
81
|
+
},
|
82
|
+
dataResolver: {
|
83
|
+
type: Function,
|
84
|
+
default: function (data) { return convertKeysToCamelCase(data); },
|
85
|
+
},
|
86
|
+
successSwalConfig: {
|
87
|
+
type: Object,
|
88
|
+
default: function () { return SUCCESS_SWAL_DEFAULT_CONFIG; },
|
89
|
+
},
|
90
|
+
errorSwalConfig: {
|
91
|
+
type: Object,
|
92
|
+
default: function () { return ERROR_SWAL_DEFAULT_CONFIG; },
|
93
|
+
},
|
94
|
+
errorFeedbackResolver: {
|
95
|
+
type: Function,
|
96
|
+
default: null,
|
97
|
+
},
|
98
|
+
successFeedbackResolver: {
|
99
|
+
type: Function,
|
100
|
+
default: null,
|
101
|
+
},
|
102
|
+
showSuccessFeedback: {
|
103
|
+
type: Boolean,
|
104
|
+
default: false,
|
105
|
+
},
|
106
|
+
hideErrorFeedback: {
|
107
|
+
type: Boolean,
|
108
|
+
default: false,
|
109
|
+
},
|
110
|
+
immediate: {
|
111
|
+
type: Boolean,
|
112
|
+
default: false,
|
113
|
+
},
|
114
|
+
forceResetError: {
|
115
|
+
type: Boolean,
|
116
|
+
default: false,
|
117
|
+
},
|
118
|
+
initialData: {
|
119
|
+
default: null,
|
120
|
+
},
|
121
|
+
},
|
122
|
+
|
123
|
+
data: function data() {
|
124
|
+
return {
|
125
|
+
loading: false,
|
126
|
+
failed: false,
|
127
|
+
succeeded: false,
|
128
|
+
error: null,
|
129
|
+
data: this.initialData,
|
130
|
+
};
|
131
|
+
},
|
132
|
+
|
133
|
+
watch: {
|
134
|
+
forceResetError: function forceResetError(newValue) {
|
135
|
+
if (newValue) {
|
136
|
+
this.error = null;
|
137
|
+
}
|
138
|
+
},
|
139
|
+
},
|
140
|
+
|
141
|
+
mounted: function mounted() {
|
142
|
+
if (this.immediate) {
|
143
|
+
this.action();
|
144
|
+
}
|
145
|
+
},
|
146
|
+
|
147
|
+
methods: {
|
147
148
|
action: function action(payloadFromArgs) {
|
148
149
|
var this$1 = this;
|
149
|
-
|
150
|
-
this.startRequest();
|
151
|
-
var payload = payloadFromArgs || this.payload;
|
152
|
-
this.service(this.payloadResolver(payload))
|
153
|
-
.then(
|
150
|
+
|
151
|
+
this.startRequest();
|
152
|
+
var payload = payloadFromArgs || this.payload;
|
153
|
+
this.service(this.payloadResolver(payload))
|
154
|
+
.then(
|
154
155
|
function (ref) {
|
155
156
|
var data = ref.data;
|
156
|
-
|
157
|
-
this$1.data = this$1.dataResolver(data);
|
158
|
-
this$1
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
this$1
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
this$1.
|
175
|
-
this$1
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
157
|
+
|
158
|
+
this$1.data = this$1.dataResolver(data);
|
159
|
+
this$1.succeeded = true;
|
160
|
+
this$1.$emit('success', this$1.data);
|
161
|
+
|
162
|
+
if (this$1.showSuccessFeedback) {
|
163
|
+
if (this$1.successFeedbackResolver) {
|
164
|
+
this$1.successFeedbackResolver({ vm: this$1, data: this$1.data });
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
swal.fire(Object.assign({}, SUCCESS_SWAL_DEFAULT_CONFIG,
|
168
|
+
this$1.successSwalConfig)).then(function () {
|
169
|
+
this$1.$emit('success-feedback-ok', this$1.data);
|
170
|
+
});
|
171
|
+
}
|
172
|
+
}
|
173
|
+
).catch(
|
174
|
+
function (error) {
|
175
|
+
this$1.failed = true;
|
176
|
+
this$1.error = error;
|
177
|
+
this$1.$emit('error', error);
|
178
|
+
|
179
|
+
if (!this$1.hideErrorFeedback) {
|
180
|
+
var errorMessage = getFirstErrorMessage(
|
181
|
+
get(error, 'response.data', null),
|
182
|
+
'Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.'
|
183
|
+
);
|
184
|
+
|
185
|
+
if (this$1.errorFeedbackResolver) {
|
186
|
+
this$1.errorFeedbackResolver({ vm: this$1, error: error, errorMessage: errorMessage });
|
187
|
+
return;
|
188
|
+
}
|
189
|
+
|
190
|
+
swal.fire(Object.assign({}, ERROR_SWAL_DEFAULT_CONFIG,
|
191
|
+
this$1.errorSwalConfig,
|
192
|
+
{text: errorMessage})).then(function (result) {
|
193
|
+
if (result.isDismissed) {
|
194
|
+
this$1.$emit('error-feedback-cancel', error);
|
195
|
+
}
|
196
|
+
if (result.isConfirmed) {
|
197
|
+
this$1.$emit('error-feedback-ok', error);
|
198
|
+
}
|
199
|
+
});
|
200
|
+
}
|
201
|
+
}
|
202
|
+
).finally(function () {
|
203
|
+
this$1.loading = false;
|
204
|
+
});
|
205
|
+
},
|
206
|
+
|
205
207
|
labelHelper: function labelHelper(label, loadingLabel) {
|
206
208
|
if ( loadingLabel === void 0 ) loadingLabel = 'Carregando...';
|
207
|
-
|
208
|
-
if (this.loading) {
|
209
|
-
return loadingLabel;
|
210
|
-
}
|
211
|
-
return label;
|
212
|
-
},
|
213
|
-
|
214
|
-
startRequest: function startRequest() {
|
215
|
-
this.loading = true;
|
216
|
-
this.failed = false;
|
217
|
-
this.
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
var
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
209
|
+
|
210
|
+
if (this.loading) {
|
211
|
+
return loadingLabel;
|
212
|
+
}
|
213
|
+
return label;
|
214
|
+
},
|
215
|
+
|
216
|
+
startRequest: function startRequest() {
|
217
|
+
this.loading = true;
|
218
|
+
this.failed = false;
|
219
|
+
this.succeeded = false;
|
220
|
+
this.error = null;
|
221
|
+
},
|
222
|
+
},
|
223
|
+
|
224
|
+
render: function render() {
|
225
|
+
var slotProvider = this.$slots || this.$scopedSlots;
|
226
|
+
var slot = slotProvider.default({
|
227
|
+
loading: this.loading,
|
228
|
+
failed: this.failed,
|
229
|
+
succeeded: this.succeeded,
|
230
|
+
error: this.error,
|
231
|
+
data: this.data,
|
232
|
+
action: this.action,
|
233
|
+
labelHelper: this.labelHelper,
|
234
|
+
errorMessage: getFirstErrorMessage(
|
235
|
+
get(this.error, 'response.data', null),
|
236
|
+
'Um erro aconteceu... por favor, tente novamente. Se o erro persistir, contate o suporte.'
|
237
|
+
),
|
238
|
+
});
|
239
|
+
|
240
|
+
return Array.isArray(slot) ? slot[0] : slot;
|
241
|
+
},
|
238
242
|
};function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
239
243
|
if (typeof shadowMode !== 'boolean') {
|
240
244
|
createInjectorSSR = createInjector;
|
@@ -318,7 +322,7 @@ var __vue_script__ = script;
|
|
318
322
|
/* scoped */
|
319
323
|
var __vue_scope_id__ = undefined;
|
320
324
|
/* module identifier */
|
321
|
-
var __vue_module_identifier__ = "data-v-
|
325
|
+
var __vue_module_identifier__ = "data-v-58d9f362";
|
322
326
|
/* functional template */
|
323
327
|
var __vue_is_functional_template__ = undefined;
|
324
328
|
/* style inject */
|
package/package.json
CHANGED
@@ -1,155 +1,155 @@
|
|
1
|
-
{
|
2
|
-
"name": "@sysvale/show",
|
3
|
-
"version": "0.
|
4
|
-
"description": "A set of components used at Sysvale",
|
5
|
-
"repository": {
|
6
|
-
"type": "git",
|
7
|
-
"url": "git+https://github.com/Sysvale/show.git"
|
8
|
-
},
|
9
|
-
"main": "dist/@sysvale/show.ssr.js",
|
10
|
-
"module": "dist/@sysvale/show.esm.js",
|
11
|
-
"unpkg": "dist/@sysvale/show.min.js",
|
12
|
-
"files": [
|
13
|
-
"dist/*"
|
14
|
-
],
|
15
|
-
"scripts": {
|
16
|
-
"serve": "vue-cli-service serve",
|
17
|
-
"test:unit": "vue-cli-service test:unit",
|
18
|
-
"test": "jest",
|
19
|
-
"lint": "vue-cli-service lint",
|
20
|
-
"storybook": "start-storybook -p 6006 --docs",
|
21
|
-
"build-storybook": "build-storybook -s public --docs",
|
22
|
-
"build": "cross-env NODE_ENV=production rollup --config build/rollup.config.js",
|
23
|
-
"build:ssr": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format cjs",
|
24
|
-
"build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
|
25
|
-
"build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife",
|
26
|
-
"chromatic": "npx chromatic --project-token=a0f13ffc7d61"
|
27
|
-
},
|
28
|
-
"dependencies": {
|
29
|
-
"lodash.camelcase": "^4.3.0",
|
30
|
-
"lodash.get": "^4.4.2",
|
31
|
-
"lodash.isobject": "^3.0.2",
|
32
|
-
"lodash.snakecase": "^4.1.1",
|
33
|
-
"sweetalert2": "^11.3.5",
|
34
|
-
"vue": "^2.6.12"
|
35
|
-
},
|
36
|
-
"devDependencies": {
|
37
|
-
"@babel/core": "^7.11.6",
|
38
|
-
"@rollup/plugin-alias": "^2.2.0",
|
39
|
-
"@rollup/plugin-buble": "^0.20.0",
|
40
|
-
"@rollup/plugin-replace": "^2.3.0",
|
41
|
-
"@storybook/addon-actions": "^6.1.0-alpha.10",
|
42
|
-
"@storybook/addon-essentials": "^6.1.0-alpha.10",
|
43
|
-
"@storybook/addon-links": "^6.1.0-alpha.10",
|
44
|
-
"@storybook/preset-scss": "^1.0.2",
|
45
|
-
"@storybook/vue": "^6.1.0-alpha.10",
|
46
|
-
"@vue/cli-plugin-babel": "~4.5.0",
|
47
|
-
"@vue/cli-plugin-eslint": "~4.5.0",
|
48
|
-
"@vue/cli-plugin-unit-jest": "~4.5.0",
|
49
|
-
"@vue/cli-service": "~4.5.0",
|
50
|
-
"@vue/eslint-config-airbnb": "^5.0.2",
|
51
|
-
"@vue/test-utils": "^1.1.0",
|
52
|
-
"babel-eslint": "^10.1.0",
|
53
|
-
"babel-loader": "^8.1.0",
|
54
|
-
"chromatic": "^6.0.4",
|
55
|
-
"cross-env": "^6.0.3",
|
56
|
-
"css-loader": "^4.3.0",
|
57
|
-
"eslint": "^6.7.2",
|
58
|
-
"eslint-plugin-import": "^2.20.2",
|
59
|
-
"eslint-plugin-vue": "^6.2.2",
|
60
|
-
"flush-promises": "^1.0.2",
|
61
|
-
"highlight.js": "^10.6.0",
|
62
|
-
"react-is": "^16.13.1",
|
63
|
-
"regenerator-runtime": "^0.13.9",
|
64
|
-
"rollup": "^1.29.0",
|
65
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
66
|
-
"rollup-plugin-terser": "^5.2.0",
|
67
|
-
"rollup-plugin-vue": "5.1.1",
|
68
|
-
"vue-hljs": "^2.0.0",
|
69
|
-
"vue-template-compiler": "^2.6.11"
|
70
|
-
},
|
71
|
-
"eslintConfig": {
|
72
|
-
"root": true,
|
73
|
-
"env": {
|
74
|
-
"node": true
|
75
|
-
},
|
76
|
-
"extends": [
|
77
|
-
"plugin:vue/essential",
|
78
|
-
"@vue/airbnb"
|
79
|
-
],
|
80
|
-
"parserOptions": {
|
81
|
-
"parser": "babel-eslint"
|
82
|
-
},
|
83
|
-
"rules": {
|
84
|
-
"vue/html-indent": [
|
85
|
-
"error",
|
86
|
-
"tab",
|
87
|
-
{
|
88
|
-
"attribute": 1,
|
89
|
-
"closeBracket": 0,
|
90
|
-
"alignAttributesVertically": true,
|
91
|
-
"ignores": []
|
92
|
-
}
|
93
|
-
],
|
94
|
-
"no-tabs": "off",
|
95
|
-
"indent": [
|
96
|
-
"error",
|
97
|
-
"tab",
|
98
|
-
{
|
99
|
-
"SwitchCase": 1
|
100
|
-
}
|
101
|
-
],
|
102
|
-
"quotes": [
|
103
|
-
"error",
|
104
|
-
"single",
|
105
|
-
{
|
106
|
-
"allowTemplateLiterals": true
|
107
|
-
}
|
108
|
-
]
|
109
|
-
},
|
110
|
-
"overrides": [
|
111
|
-
{
|
112
|
-
"files": [
|
113
|
-
"**/__tests__/*.{j,t}s?(x)",
|
114
|
-
"**/tests/unit/**/*.spec.{j,t}s?(x)"
|
115
|
-
],
|
116
|
-
"env": {
|
117
|
-
"jest": true
|
118
|
-
}
|
119
|
-
}
|
120
|
-
]
|
121
|
-
},
|
122
|
-
"browserslist": [
|
123
|
-
"> 1%",
|
124
|
-
"last 2 versions",
|
125
|
-
"not dead"
|
126
|
-
],
|
127
|
-
"jest": {
|
128
|
-
"preset": "@vue/cli-plugin-unit-jest",
|
129
|
-
"transform": {
|
130
|
-
".*\\.(js)$": "babel-jest"
|
131
|
-
},
|
132
|
-
"setupFilesAfterEnv": [
|
133
|
-
"./src/utils/setupTests.js"
|
134
|
-
],
|
135
|
-
"collectCoverage": true,
|
136
|
-
"collectCoverageFrom": [
|
137
|
-
"src/**/*.vue"
|
138
|
-
],
|
139
|
-
"coverageReporters": [
|
140
|
-
"lcov",
|
141
|
-
"text"
|
142
|
-
]
|
143
|
-
},
|
144
|
-
"babel": {
|
145
|
-
"presets": [
|
146
|
-
"@babel/preset-env"
|
147
|
-
]
|
148
|
-
},
|
149
|
-
"bugs": {
|
150
|
-
"url": "https://github.com/Sysvale/show/issues"
|
151
|
-
},
|
152
|
-
"homepage": "https://github.com/Sysvale/show#readme",
|
153
|
-
"author": "Sysvale",
|
154
|
-
"license": "MIT"
|
155
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@sysvale/show",
|
3
|
+
"version": "0.3.0",
|
4
|
+
"description": "A set of components used at Sysvale",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "git+https://github.com/Sysvale/show.git"
|
8
|
+
},
|
9
|
+
"main": "dist/@sysvale/show.ssr.js",
|
10
|
+
"module": "dist/@sysvale/show.esm.js",
|
11
|
+
"unpkg": "dist/@sysvale/show.min.js",
|
12
|
+
"files": [
|
13
|
+
"dist/*"
|
14
|
+
],
|
15
|
+
"scripts": {
|
16
|
+
"serve": "vue-cli-service serve",
|
17
|
+
"test:unit": "vue-cli-service test:unit",
|
18
|
+
"test": "jest",
|
19
|
+
"lint": "vue-cli-service lint",
|
20
|
+
"storybook": "start-storybook -p 6006 --docs",
|
21
|
+
"build-storybook": "build-storybook -s public --docs",
|
22
|
+
"build": "cross-env NODE_ENV=production rollup --config build/rollup.config.js",
|
23
|
+
"build:ssr": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format cjs",
|
24
|
+
"build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
|
25
|
+
"build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife",
|
26
|
+
"chromatic": "npx chromatic --project-token=a0f13ffc7d61"
|
27
|
+
},
|
28
|
+
"dependencies": {
|
29
|
+
"lodash.camelcase": "^4.3.0",
|
30
|
+
"lodash.get": "^4.4.2",
|
31
|
+
"lodash.isobject": "^3.0.2",
|
32
|
+
"lodash.snakecase": "^4.1.1",
|
33
|
+
"sweetalert2": "^11.3.5",
|
34
|
+
"vue": "^2.6.12"
|
35
|
+
},
|
36
|
+
"devDependencies": {
|
37
|
+
"@babel/core": "^7.11.6",
|
38
|
+
"@rollup/plugin-alias": "^2.2.0",
|
39
|
+
"@rollup/plugin-buble": "^0.20.0",
|
40
|
+
"@rollup/plugin-replace": "^2.3.0",
|
41
|
+
"@storybook/addon-actions": "^6.1.0-alpha.10",
|
42
|
+
"@storybook/addon-essentials": "^6.1.0-alpha.10",
|
43
|
+
"@storybook/addon-links": "^6.1.0-alpha.10",
|
44
|
+
"@storybook/preset-scss": "^1.0.2",
|
45
|
+
"@storybook/vue": "^6.1.0-alpha.10",
|
46
|
+
"@vue/cli-plugin-babel": "~4.5.0",
|
47
|
+
"@vue/cli-plugin-eslint": "~4.5.0",
|
48
|
+
"@vue/cli-plugin-unit-jest": "~4.5.0",
|
49
|
+
"@vue/cli-service": "~4.5.0",
|
50
|
+
"@vue/eslint-config-airbnb": "^5.0.2",
|
51
|
+
"@vue/test-utils": "^1.1.0",
|
52
|
+
"babel-eslint": "^10.1.0",
|
53
|
+
"babel-loader": "^8.1.0",
|
54
|
+
"chromatic": "^6.0.4",
|
55
|
+
"cross-env": "^6.0.3",
|
56
|
+
"css-loader": "^4.3.0",
|
57
|
+
"eslint": "^6.7.2",
|
58
|
+
"eslint-plugin-import": "^2.20.2",
|
59
|
+
"eslint-plugin-vue": "^6.2.2",
|
60
|
+
"flush-promises": "^1.0.2",
|
61
|
+
"highlight.js": "^10.6.0",
|
62
|
+
"react-is": "^16.13.1",
|
63
|
+
"regenerator-runtime": "^0.13.9",
|
64
|
+
"rollup": "^1.29.0",
|
65
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
66
|
+
"rollup-plugin-terser": "^5.2.0",
|
67
|
+
"rollup-plugin-vue": "5.1.1",
|
68
|
+
"vue-hljs": "^2.0.0",
|
69
|
+
"vue-template-compiler": "^2.6.11"
|
70
|
+
},
|
71
|
+
"eslintConfig": {
|
72
|
+
"root": true,
|
73
|
+
"env": {
|
74
|
+
"node": true
|
75
|
+
},
|
76
|
+
"extends": [
|
77
|
+
"plugin:vue/essential",
|
78
|
+
"@vue/airbnb"
|
79
|
+
],
|
80
|
+
"parserOptions": {
|
81
|
+
"parser": "babel-eslint"
|
82
|
+
},
|
83
|
+
"rules": {
|
84
|
+
"vue/html-indent": [
|
85
|
+
"error",
|
86
|
+
"tab",
|
87
|
+
{
|
88
|
+
"attribute": 1,
|
89
|
+
"closeBracket": 0,
|
90
|
+
"alignAttributesVertically": true,
|
91
|
+
"ignores": []
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"no-tabs": "off",
|
95
|
+
"indent": [
|
96
|
+
"error",
|
97
|
+
"tab",
|
98
|
+
{
|
99
|
+
"SwitchCase": 1
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"quotes": [
|
103
|
+
"error",
|
104
|
+
"single",
|
105
|
+
{
|
106
|
+
"allowTemplateLiterals": true
|
107
|
+
}
|
108
|
+
]
|
109
|
+
},
|
110
|
+
"overrides": [
|
111
|
+
{
|
112
|
+
"files": [
|
113
|
+
"**/__tests__/*.{j,t}s?(x)",
|
114
|
+
"**/tests/unit/**/*.spec.{j,t}s?(x)"
|
115
|
+
],
|
116
|
+
"env": {
|
117
|
+
"jest": true
|
118
|
+
}
|
119
|
+
}
|
120
|
+
]
|
121
|
+
},
|
122
|
+
"browserslist": [
|
123
|
+
"> 1%",
|
124
|
+
"last 2 versions",
|
125
|
+
"not dead"
|
126
|
+
],
|
127
|
+
"jest": {
|
128
|
+
"preset": "@vue/cli-plugin-unit-jest",
|
129
|
+
"transform": {
|
130
|
+
".*\\.(js)$": "babel-jest"
|
131
|
+
},
|
132
|
+
"setupFilesAfterEnv": [
|
133
|
+
"./src/utils/setupTests.js"
|
134
|
+
],
|
135
|
+
"collectCoverage": true,
|
136
|
+
"collectCoverageFrom": [
|
137
|
+
"src/**/*.vue"
|
138
|
+
],
|
139
|
+
"coverageReporters": [
|
140
|
+
"lcov",
|
141
|
+
"text"
|
142
|
+
]
|
143
|
+
},
|
144
|
+
"babel": {
|
145
|
+
"presets": [
|
146
|
+
"@babel/preset-env"
|
147
|
+
]
|
148
|
+
},
|
149
|
+
"bugs": {
|
150
|
+
"url": "https://github.com/Sysvale/show/issues"
|
151
|
+
},
|
152
|
+
"homepage": "https://github.com/Sysvale/show#readme",
|
153
|
+
"author": "Sysvale",
|
154
|
+
"license": "MIT"
|
155
|
+
}
|