@sysvale/show 0.3.0 → 1.1.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 +4 -0
- package/dist/@sysvale/show.es.js +4745 -0
- package/dist/@sysvale/show.umd.js +67 -0
- package/package.json +62 -153
- package/dist/@sysvale/show.esm.js +0 -464
- package/dist/@sysvale/show.min.js +0 -1
- package/dist/@sysvale/show.ssr.js +0 -432
package/package.json
CHANGED
@@ -1,155 +1,64 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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"
|
2
|
+
"name": "@sysvale/show",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "A set of components used at Sysvale",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "git+https://github.com/Sysvale/sys-hand-on-wheel.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
|
+
"exports": {
|
16
|
+
".": {
|
17
|
+
"import": "./dist/@sysvale/show.es.js",
|
18
|
+
"require": "./dist/@sysvale/show.umd.js"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"scripts": {
|
22
|
+
"dev": "vite",
|
23
|
+
"build": "vite build",
|
24
|
+
"preview": "vite preview",
|
25
|
+
"test": "vitest"
|
26
|
+
},
|
27
|
+
"dependencies": {
|
28
|
+
"lodash.camelcase": "^4.3.0",
|
29
|
+
"lodash.get": "^4.4.2",
|
30
|
+
"lodash.isempty": "^4.4.0",
|
31
|
+
"lodash.isequal": "^4.5.0",
|
32
|
+
"lodash.isobject": "^3.0.2",
|
33
|
+
"lodash.keyby": "^4.6.0",
|
34
|
+
"lodash.reduce": "^4.6.0",
|
35
|
+
"lodash.snakecase": "^4.1.1",
|
36
|
+
"sweetalert2": "^11.3.5",
|
37
|
+
"vue": "^3.2.37"
|
38
|
+
},
|
39
|
+
"devDependencies": {
|
40
|
+
"@babel/core": "^7.18.10",
|
41
|
+
"@rollup/plugin-typescript": "^8.4.0",
|
42
|
+
"@types/vue": "^2.0.0",
|
43
|
+
"@vitejs/plugin-vue": "^3.0.3",
|
44
|
+
"@vue/test-utils": "^2.0.2",
|
45
|
+
"babel-loader": "^8.2.5",
|
46
|
+
"concat": "^1.0.3",
|
47
|
+
"esbuild-linux-64": "^0.15.18",
|
48
|
+
"eslint": "^8.31.0",
|
49
|
+
"eslint-plugin-vue": "^9.9.0",
|
50
|
+
"jsdom": "^20.0.0",
|
51
|
+
"sass": "^1.55.0",
|
52
|
+
"typescript": "^4.6.4",
|
53
|
+
"vite": "^3.0.0",
|
54
|
+
"vitest": "^0.22.0",
|
55
|
+
"vue-loader": "^16.8.3",
|
56
|
+
"vue-tsc": "^0.38.4"
|
57
|
+
},
|
58
|
+
"bugs": {
|
59
|
+
"url": "https://github.com/Sysvale/sys-hand-on-wheel/issues"
|
60
|
+
},
|
61
|
+
"homepage": "https://github.com/Sysvale/sys-hand-on-wheel#readme",
|
62
|
+
"author": "Sysvale",
|
63
|
+
"license": "MIT"
|
155
64
|
}
|
@@ -1,464 +0,0 @@
|
|
1
|
-
import swal from 'sweetalert2';
|
2
|
-
import get from 'lodash.get';
|
3
|
-
import camelCase from 'lodash.camelcase';
|
4
|
-
import isObject from 'lodash.isobject';
|
5
|
-
import snakeCase from 'lodash.snakecase';
|
6
|
-
|
7
|
-
var isArray = function (arg) { return Array.isArray(arg); };
|
8
|
-
|
9
|
-
var convertKeysToCamelCase = function (data) {
|
10
|
-
if (isArray(data)) {
|
11
|
-
return data.map(function (element) {
|
12
|
-
if (isObject(element) || isArray(element)) {
|
13
|
-
return convertKeysToCamelCase(element);
|
14
|
-
}
|
15
|
-
return element;
|
16
|
-
});
|
17
|
-
}
|
18
|
-
var newData = {};
|
19
|
-
Object.keys(data).forEach(function (key) {
|
20
|
-
if (isObject(data[key]) || isArray(data[key])) {
|
21
|
-
newData[camelCase(key)] = convertKeysToCamelCase(data[key]);
|
22
|
-
} else {
|
23
|
-
newData[camelCase(key)] = data[key];
|
24
|
-
}
|
25
|
-
});
|
26
|
-
|
27
|
-
return newData;
|
28
|
-
};
|
29
|
-
|
30
|
-
var isArray$1 = function (arg) { return Array.isArray(arg); };
|
31
|
-
|
32
|
-
var convertKeysToSnakeCase = function (data) {
|
33
|
-
if (isArray$1(data)) {
|
34
|
-
return data.map(function (element) {
|
35
|
-
if (isObject(element) || isArray$1(element)) {
|
36
|
-
return convertKeysToSnakeCase(element);
|
37
|
-
}
|
38
|
-
return element;
|
39
|
-
});
|
40
|
-
}
|
41
|
-
var newData = {};
|
42
|
-
Object.keys(data).forEach(function (key) {
|
43
|
-
if (isObject(data[key]) || isArray$1(data[key])) {
|
44
|
-
newData[snakeCase(key)] = convertKeysToSnakeCase(data[key]);
|
45
|
-
} else {
|
46
|
-
newData[snakeCase(key)] = data[key];
|
47
|
-
}
|
48
|
-
});
|
49
|
-
|
50
|
-
return newData;
|
51
|
-
};
|
52
|
-
|
53
|
-
function getFirstErrorMessage(response, fallbackMsg) {
|
54
|
-
if ( fallbackMsg === void 0 ) fallbackMsg = 'Não conseguimos processar sua requisição. Tente novamente.';
|
55
|
-
|
56
|
-
var errors = get(response, 'errors', false);
|
57
|
-
if (!errors) { return fallbackMsg; }
|
58
|
-
var ref = Object.keys(errors);
|
59
|
-
var firstKey = ref[0];
|
60
|
-
return errors[firstKey][0] || fallbackMsg;
|
61
|
-
}
|
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
|
-
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: {
|
160
|
-
action: function action(payloadFromArgs) {
|
161
|
-
var this$1 = this;
|
162
|
-
|
163
|
-
this.startRequest();
|
164
|
-
var payload = payloadFromArgs || this.payload;
|
165
|
-
this.service(this.payloadResolver(payload))
|
166
|
-
.then(
|
167
|
-
function (ref) {
|
168
|
-
var data = ref.data;
|
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
|
-
|
219
|
-
labelHelper: function labelHelper(label, loadingLabel) {
|
220
|
-
if ( loadingLabel === void 0 ) loadingLabel = 'Carregando...';
|
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
|
-
},
|
254
|
-
};
|
255
|
-
|
256
|
-
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
257
|
-
if (typeof shadowMode !== 'boolean') {
|
258
|
-
createInjectorSSR = createInjector;
|
259
|
-
createInjector = shadowMode;
|
260
|
-
shadowMode = false;
|
261
|
-
}
|
262
|
-
// Vue.extend constructor export interop.
|
263
|
-
var options = typeof script === 'function' ? script.options : script;
|
264
|
-
// render functions
|
265
|
-
if (template && template.render) {
|
266
|
-
options.render = template.render;
|
267
|
-
options.staticRenderFns = template.staticRenderFns;
|
268
|
-
options._compiled = true;
|
269
|
-
// functional template
|
270
|
-
if (isFunctionalTemplate) {
|
271
|
-
options.functional = true;
|
272
|
-
}
|
273
|
-
}
|
274
|
-
// scopedId
|
275
|
-
if (scopeId) {
|
276
|
-
options._scopeId = scopeId;
|
277
|
-
}
|
278
|
-
var hook;
|
279
|
-
if (moduleIdentifier) {
|
280
|
-
// server build
|
281
|
-
hook = function (context) {
|
282
|
-
// 2.3 injection
|
283
|
-
context =
|
284
|
-
context || // cached call
|
285
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
286
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
|
287
|
-
// 2.2 with runInNewContext: true
|
288
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
289
|
-
context = __VUE_SSR_CONTEXT__;
|
290
|
-
}
|
291
|
-
// inject component styles
|
292
|
-
if (style) {
|
293
|
-
style.call(this, createInjectorSSR(context));
|
294
|
-
}
|
295
|
-
// register component module identifier for async chunk inference
|
296
|
-
if (context && context._registeredComponents) {
|
297
|
-
context._registeredComponents.add(moduleIdentifier);
|
298
|
-
}
|
299
|
-
};
|
300
|
-
// used by ssr in case component is cached and beforeCreate
|
301
|
-
// never gets called
|
302
|
-
options._ssrRegister = hook;
|
303
|
-
}
|
304
|
-
else if (style) {
|
305
|
-
hook = shadowMode
|
306
|
-
? function (context) {
|
307
|
-
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
|
308
|
-
}
|
309
|
-
: function (context) {
|
310
|
-
style.call(this, createInjector(context));
|
311
|
-
};
|
312
|
-
}
|
313
|
-
if (hook) {
|
314
|
-
if (options.functional) {
|
315
|
-
// register for functional component in vue file
|
316
|
-
var originalRender = options.render;
|
317
|
-
options.render = function renderWithStyleInjection(h, context) {
|
318
|
-
hook.call(context);
|
319
|
-
return originalRender(h, context);
|
320
|
-
};
|
321
|
-
}
|
322
|
-
else {
|
323
|
-
// inject component registration as beforeCreate hook
|
324
|
-
var existing = options.beforeCreate;
|
325
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
326
|
-
}
|
327
|
-
}
|
328
|
-
return script;
|
329
|
-
}
|
330
|
-
|
331
|
-
/* script */
|
332
|
-
var __vue_script__ = script;
|
333
|
-
|
334
|
-
/* template */
|
335
|
-
|
336
|
-
/* style */
|
337
|
-
var __vue_inject_styles__ = undefined;
|
338
|
-
/* scoped */
|
339
|
-
var __vue_scope_id__ = undefined;
|
340
|
-
/* module identifier */
|
341
|
-
var __vue_module_identifier__ = undefined;
|
342
|
-
/* functional template */
|
343
|
-
var __vue_is_functional_template__ = undefined;
|
344
|
-
/* style inject */
|
345
|
-
|
346
|
-
/* style inject SSR */
|
347
|
-
|
348
|
-
/* style inject shadow dom */
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
var __vue_component__ = /*#__PURE__*/normalizeComponent(
|
353
|
-
{},
|
354
|
-
__vue_inject_styles__,
|
355
|
-
__vue_script__,
|
356
|
-
__vue_scope_id__,
|
357
|
-
__vue_is_functional_template__,
|
358
|
-
__vue_module_identifier__,
|
359
|
-
false,
|
360
|
-
undefined,
|
361
|
-
undefined,
|
362
|
-
undefined
|
363
|
-
);
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
var components = /*#__PURE__*/Object.freeze({
|
368
|
-
__proto__: null,
|
369
|
-
RequestProvider: __vue_component__
|
370
|
-
});
|
371
|
-
|
372
|
-
function removeAccents(str) {
|
373
|
-
if ( str === void 0 ) str = '';
|
374
|
-
|
375
|
-
var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
|
376
|
-
var accentsOut = 'AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz';
|
377
|
-
var strLen = str.length;
|
378
|
-
var newStr = str.split('');
|
379
|
-
var x;
|
380
|
-
|
381
|
-
for (var i = 0; i < strLen; i += 1) {
|
382
|
-
x = accents.indexOf(str[i]);
|
383
|
-
if (x !== -1) {
|
384
|
-
newStr[i] = accentsOut[x];
|
385
|
-
}
|
386
|
-
}
|
387
|
-
|
388
|
-
newStr = newStr.join('');
|
389
|
-
newStr = newStr.split('.').join('');
|
390
|
-
newStr = newStr.split('-').join('');
|
391
|
-
newStr = newStr.split('/').join('');
|
392
|
-
|
393
|
-
return newStr;
|
394
|
-
}
|
395
|
-
|
396
|
-
function generateKey(length) {
|
397
|
-
if ( length === void 0 ) length = 8;
|
398
|
-
|
399
|
-
var result = '';
|
400
|
-
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
401
|
-
var charactersLength = characters.length;
|
402
|
-
for (var i = 0; i < length; i += 1) {
|
403
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
404
|
-
}
|
405
|
-
return result;
|
406
|
-
}
|
407
|
-
|
408
|
-
var utils = {
|
409
|
-
$showConvertKeysToCamelCase: convertKeysToCamelCase,
|
410
|
-
$showConvertKeysToSnakeCase: convertKeysToSnakeCase,
|
411
|
-
$showRemoveAccents: removeAccents,
|
412
|
-
$showGenerateKey: generateKey,
|
413
|
-
};
|
414
|
-
|
415
|
-
// install function executed by Vue.use()
|
416
|
-
function install(app) {
|
417
|
-
if (install.installed) { return; }
|
418
|
-
|
419
|
-
install.installed = true;
|
420
|
-
|
421
|
-
var version = Number(app.version.split('.')[0]);
|
422
|
-
|
423
|
-
if (version <= 2) {
|
424
|
-
Object.keys(utils).forEach(function (key) {
|
425
|
-
app.prototype[key] = utils[key];
|
426
|
-
});
|
427
|
-
}
|
428
|
-
|
429
|
-
if (version > 2) {
|
430
|
-
// ficará disponível apenas com o uso do Options API
|
431
|
-
Object.keys(utils).forEach(function (key) {
|
432
|
-
app.config.globalProperties[key] = utils[key];
|
433
|
-
});
|
434
|
-
}
|
435
|
-
|
436
|
-
Object.keys(components).forEach(function (componentName) {
|
437
|
-
app.component(
|
438
|
-
("Show" + componentName),
|
439
|
-
components[componentName]
|
440
|
-
);
|
441
|
-
});
|
442
|
-
}
|
443
|
-
|
444
|
-
// Create module definition for Vue.use()
|
445
|
-
var plugin = {
|
446
|
-
install: install,
|
447
|
-
};
|
448
|
-
|
449
|
-
// To auto-install when vue is found
|
450
|
-
/* global window global */
|
451
|
-
var GlobalVue = null;
|
452
|
-
|
453
|
-
if (typeof window !== 'undefined') {
|
454
|
-
GlobalVue = window.Vue;
|
455
|
-
} else if (typeof global !== 'undefined') {
|
456
|
-
GlobalVue = global.Vue;
|
457
|
-
}
|
458
|
-
|
459
|
-
if (GlobalVue) {
|
460
|
-
GlobalVue.use(plugin);
|
461
|
-
}
|
462
|
-
|
463
|
-
export default plugin;
|
464
|
-
export { __vue_component__ as RequestProvider };
|
@@ -1 +0,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)},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);
|