@burh/nuxt-core 1.0.380 → 1.0.382

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.
@@ -1,241 +1,241 @@
1
- <template>
2
- <div class="form-group">
3
- <slot name="label">
4
- <label
5
- v-if="label"
6
- :class="[
7
- { 'is-invalid': error },
8
- { 'label-required': required },
9
- labelClasses
10
- ]"
11
- >
12
- {{ label }}
13
- <span v-if="required" class="label-required-text"
14
- >Obrigatório</span
15
- >
16
- </label>
17
- </slot>
18
- <div
19
- :class="[
20
- { 'input-group': hasIcon },
21
- { focused: focused },
22
- { 'input-group-alternative': alternative },
23
- { 'has-label': label || $slots.label },
24
- inputGroupClasses
25
- ]"
26
- >
27
- <div
28
- v-if="prependIcon || $slots.prepend"
29
- class="input-group-prepend"
30
- >
31
- <span class="input-group-text">
32
- <slot name="prepend">
33
- <i :class="prependIcon"></i>
34
- </slot>
35
- </span>
36
- </div>
37
- <slot v-bind="slotData" v-if="type !== 'textarea'">
38
- <input
39
- v-if="!mask.length"
40
- :value="value"
41
- :type="type"
42
- v-on="listeners"
43
- v-bind="$attrs"
44
- :valid="!error"
45
- :required="required"
46
- class="form-control"
47
- :class="[
48
- { 'is-valid': valid === true },
49
- { 'is-invalid': error },
50
- inputClasses
51
- ]"
52
- />
53
- <the-mask
54
- v-else
55
- class="form-control"
56
- v-on="listeners"
57
- v-bind="$attrs"
58
- type="text"
59
- :required="required"
60
- :mask="mask"
61
- :class="[
62
- { 'is-valid': valid === true },
63
- { 'is-invalid': error },
64
- inputClasses
65
- ]"
66
- />
67
- </slot>
68
- <slot v-bind="slotData" v-else>
69
- <textarea
70
- :value="value"
71
- v-on="listeners"
72
- v-bind="$attrs"
73
- :required="required"
74
- class="form-control form-control-textarea"
75
- :valid="!error"
76
- :class="[
77
- { 'is-valid': valid === true },
78
- { 'is-invalid': error },
79
- inputClasses
80
- ]"
81
- />
82
- </slot>
83
- <div v-if="appendIcon || $slots.append" class="input-group-append">
84
- <span class="input-group-text">
85
- <slot name="append">
86
- <i :class="appendIcon"></i>
87
- </slot>
88
- </span>
89
- </div>
90
- <slot name="infoBlock"></slot>
91
- <slot name="error">
92
- <div
93
- v-if="error"
94
- class="invalid-feedback"
95
- style="display: block;"
96
- >
97
- {{ error }}
98
- </div>
99
- </slot>
100
- <slot name="success">
101
- <div class="valid-feedback" v-if="!error && valid">
102
- {{ successMessage }}
103
- </div>
104
- </slot>
105
- </div>
106
- </div>
107
- </template>
108
- <script>
109
- import { TheMask } from 'vue-the-mask';
110
-
111
- export default {
112
- inheritAttrs: false,
113
- name: 'base-input',
114
- props: {
115
- required: {
116
- type: Boolean,
117
- description: 'Whether input is required (adds an asterix *)'
118
- },
119
- group: {
120
- type: Boolean,
121
- description:
122
- 'Whether input is an input group (manual override in special cases)'
123
- },
124
- valid: {
125
- type: Boolean,
126
- description: 'Whether is valid',
127
- default: undefined
128
- },
129
- alternative: {
130
- type: Boolean,
131
- description: 'Whether input is of alternative layout'
132
- },
133
- label: {
134
- type: String,
135
- description: 'Input label (text before input)'
136
- },
137
- error: {
138
- type: String,
139
- description: 'Input error (below input)'
140
- },
141
- successMessage: {
142
- type: String,
143
- description: 'Input success message',
144
- default: 'Looks good!'
145
- },
146
- labelClasses: {
147
- type: String,
148
- description: 'Input label css classes',
149
- default: 'form-control-label'
150
- },
151
- inputClasses: {
152
- type: String,
153
- description: 'Input css classes'
154
- },
155
- inputGroupClasses: {
156
- type: String,
157
- description: 'Input group css classes'
158
- },
159
- value: {
160
- type: [String, Number],
161
- description: 'Input value'
162
- },
163
- type: {
164
- type: String,
165
- description: 'Input type',
166
- default: 'text'
167
- },
168
- appendIcon: {
169
- type: String,
170
- description: 'Append icon (right)'
171
- },
172
- prependIcon: {
173
- type: String,
174
- description: 'Prepend icon (left)'
175
- },
176
- mask: {
177
- type: Array,
178
- default: () => {
179
- return [];
180
- },
181
- description: 'Masks Array'
182
- }
183
- },
184
- components: {
185
- TheMask
186
- },
187
- data() {
188
- return {
189
- focused: false
190
- };
191
- },
192
- computed: {
193
- listeners() {
194
- return {
195
- ...this.$listeners,
196
- input: this.updateValue,
197
- focus: this.onFocus,
198
- blur: this.onBlur
199
- };
200
- },
201
- slotData() {
202
- return {
203
- focused: this.focused,
204
- error: this.error,
205
- ...this.listeners
206
- };
207
- },
208
- hasIcon() {
209
- const { append, prepend } = this.$slots;
210
- return (
211
- append !== undefined ||
212
- prepend !== undefined ||
213
- this.appendIcon !== undefined ||
214
- this.prependIcon !== undefined ||
215
- this.group
216
- );
217
- }
218
- },
219
- methods: {
220
- updateValue(evt) {
221
- let value = this.mask.length ? evt : evt.target.value;
222
-
223
- this.$emit('input', value);
224
- },
225
- onFocus(evt) {
226
- this.focused = true;
227
- this.$emit('focus', evt);
228
- },
229
- onBlur(evt) {
230
- this.focused = false;
231
- this.$emit('blur', evt);
232
- }
233
- }
234
- };
235
- </script>
236
- <style lang="scss" scoped>
237
- .form-control-textarea {
238
- height: 180px;
239
- resize: none;
240
- }
241
- </style>
1
+ <template>
2
+ <div class="form-group">
3
+ <slot name="label">
4
+ <label
5
+ v-if="label"
6
+ :class="[
7
+ { 'is-invalid': error },
8
+ { 'label-required': required },
9
+ labelClasses
10
+ ]"
11
+ >
12
+ {{ label }}
13
+ <span v-if="required" class="label-required-text"
14
+ >Obrigatório</span
15
+ >
16
+ </label>
17
+ </slot>
18
+ <div
19
+ :class="[
20
+ { 'input-group': hasIcon },
21
+ { focused: focused },
22
+ { 'input-group-alternative': alternative },
23
+ { 'has-label': label || $slots.label },
24
+ inputGroupClasses
25
+ ]"
26
+ >
27
+ <div
28
+ v-if="prependIcon || $slots.prepend"
29
+ class="input-group-prepend"
30
+ >
31
+ <span class="input-group-text">
32
+ <slot name="prepend">
33
+ <i :class="prependIcon"></i>
34
+ </slot>
35
+ </span>
36
+ </div>
37
+ <slot v-bind="slotData" v-if="type !== 'textarea'">
38
+ <input
39
+ v-if="!mask.length"
40
+ :value="value"
41
+ :type="type"
42
+ v-on="listeners"
43
+ v-bind="$attrs"
44
+ :valid="!error"
45
+ :required="required"
46
+ class="form-control"
47
+ :class="[
48
+ { 'is-valid': valid === true },
49
+ { 'is-invalid': error },
50
+ inputClasses
51
+ ]"
52
+ />
53
+ <the-mask
54
+ v-else
55
+ class="form-control"
56
+ v-on="listeners"
57
+ v-bind="$attrs"
58
+ type="text"
59
+ :required="required"
60
+ :mask="mask"
61
+ :class="[
62
+ { 'is-valid': valid === true },
63
+ { 'is-invalid': error },
64
+ inputClasses
65
+ ]"
66
+ />
67
+ </slot>
68
+ <slot v-bind="slotData" v-else>
69
+ <textarea
70
+ :value="value"
71
+ v-on="listeners"
72
+ v-bind="$attrs"
73
+ :required="required"
74
+ class="form-control form-control-textarea"
75
+ :valid="!error"
76
+ :class="[
77
+ { 'is-valid': valid === true },
78
+ { 'is-invalid': error },
79
+ inputClasses
80
+ ]"
81
+ />
82
+ </slot>
83
+ <div v-if="appendIcon || $slots.append" class="input-group-append">
84
+ <span class="input-group-text">
85
+ <slot name="append">
86
+ <i :class="appendIcon"></i>
87
+ </slot>
88
+ </span>
89
+ </div>
90
+ <slot name="infoBlock"></slot>
91
+ <slot name="error">
92
+ <div
93
+ v-if="error"
94
+ class="invalid-feedback"
95
+ style="display: block;"
96
+ >
97
+ {{ error }}
98
+ </div>
99
+ </slot>
100
+ <slot name="success">
101
+ <div class="valid-feedback" v-if="!error && valid">
102
+ {{ successMessage }}
103
+ </div>
104
+ </slot>
105
+ </div>
106
+ </div>
107
+ </template>
108
+ <script>
109
+ import { TheMask } from 'vue-the-mask';
110
+
111
+ export default {
112
+ inheritAttrs: false,
113
+ name: 'base-input',
114
+ props: {
115
+ required: {
116
+ type: Boolean,
117
+ description: 'Whether input is required (adds an asterix *)'
118
+ },
119
+ group: {
120
+ type: Boolean,
121
+ description:
122
+ 'Whether input is an input group (manual override in special cases)'
123
+ },
124
+ valid: {
125
+ type: Boolean,
126
+ description: 'Whether is valid',
127
+ default: undefined
128
+ },
129
+ alternative: {
130
+ type: Boolean,
131
+ description: 'Whether input is of alternative layout'
132
+ },
133
+ label: {
134
+ type: String,
135
+ description: 'Input label (text before input)'
136
+ },
137
+ error: {
138
+ type: String,
139
+ description: 'Input error (below input)'
140
+ },
141
+ successMessage: {
142
+ type: String,
143
+ description: 'Input success message',
144
+ default: 'Looks good!'
145
+ },
146
+ labelClasses: {
147
+ type: String,
148
+ description: 'Input label css classes',
149
+ default: 'form-control-label'
150
+ },
151
+ inputClasses: {
152
+ type: String,
153
+ description: 'Input css classes'
154
+ },
155
+ inputGroupClasses: {
156
+ type: String,
157
+ description: 'Input group css classes'
158
+ },
159
+ value: {
160
+ type: [String, Number],
161
+ description: 'Input value'
162
+ },
163
+ type: {
164
+ type: String,
165
+ description: 'Input type',
166
+ default: 'text'
167
+ },
168
+ appendIcon: {
169
+ type: String,
170
+ description: 'Append icon (right)'
171
+ },
172
+ prependIcon: {
173
+ type: String,
174
+ description: 'Prepend icon (left)'
175
+ },
176
+ mask: {
177
+ type: Array,
178
+ default: () => {
179
+ return [];
180
+ },
181
+ description: 'Masks Array'
182
+ }
183
+ },
184
+ components: {
185
+ TheMask
186
+ },
187
+ data() {
188
+ return {
189
+ focused: false
190
+ };
191
+ },
192
+ computed: {
193
+ listeners() {
194
+ return {
195
+ ...this.$listeners,
196
+ input: this.updateValue,
197
+ focus: this.onFocus,
198
+ blur: this.onBlur
199
+ };
200
+ },
201
+ slotData() {
202
+ return {
203
+ focused: this.focused,
204
+ error: this.error,
205
+ ...this.listeners
206
+ };
207
+ },
208
+ hasIcon() {
209
+ const { append, prepend } = this.$slots;
210
+ return (
211
+ append !== undefined ||
212
+ prepend !== undefined ||
213
+ this.appendIcon !== undefined ||
214
+ this.prependIcon !== undefined ||
215
+ this.group
216
+ );
217
+ }
218
+ },
219
+ methods: {
220
+ updateValue(evt) {
221
+ let value = this.mask.length ? evt : evt.target.value;
222
+
223
+ this.$emit('input', value);
224
+ },
225
+ onFocus(evt) {
226
+ this.focused = true;
227
+ this.$emit('focus', evt);
228
+ },
229
+ onBlur(evt) {
230
+ this.focused = false;
231
+ this.$emit('blur', evt);
232
+ }
233
+ }
234
+ };
235
+ </script>
236
+ <style lang="scss" scoped>
237
+ .form-control-textarea {
238
+ height: 180px;
239
+ resize: none;
240
+ }
241
+ </style>
@@ -45,13 +45,22 @@
45
45
  />
46
46
  </validation-provider>
47
47
 
48
- <label for="description">Descrição</label>
49
- <base-input
50
- type="text"
51
- id="description"
52
- v-model="description"
53
- placeholder="Descrição"
54
- />
48
+ <validation-provider
49
+ tag="div"
50
+ name="Descrição"
51
+ rules="required"
52
+ v-slot="{ errors }"
53
+ >
54
+ <label for="description">Descrição</label>
55
+ <base-input
56
+ type="text"
57
+ id="description"
58
+ v-model="description"
59
+ placeholder="Descrição"
60
+ :error="errors[0]"
61
+ :valid="errors.length ? true : false"
62
+ />
63
+ </validation-provider>
55
64
 
56
65
  <validation-provider
57
66
  tag="div"
@@ -96,20 +105,20 @@
96
105
  rules="required"
97
106
  v-slot="{ errors }"
98
107
  >
99
- <label for="city">Cidade</label>
108
+ <label for="city" class="form-control-label">Cidade</label>
100
109
  <div class="form-group">
101
110
  <el-select
102
- type="text"
103
111
  id="city"
104
112
  v-model="city"
105
113
  placeholder="Cidade"
106
114
  filterable
107
115
  remote
116
+ required
117
+ auto-complete="off"
118
+ :class="{'is-invalid': errors[0]}"
108
119
  :remote-method="getCityListFiltered"
109
- :auto-complete="`new-${city}`"
110
- :error="errors[0]"
111
- :valid="errors.length ? true : false"
112
120
  :loading="isSelectLoading"
121
+
113
122
  >
114
123
  <div class="text-center" slot="empty">
115
124
  <p class="small mb-2 mt-3">Nenhuma cidade encontrada</p>
@@ -122,6 +131,11 @@
122
131
  :label="city.value"
123
132
  />
124
133
  </el-select>
134
+ <div
135
+ class="invalid-feedback"
136
+ style="display: block;">
137
+ {{ errors[0] }}
138
+ </div>
125
139
  </div>
126
140
  </validation-provider>
127
141
 
@@ -381,6 +395,12 @@ body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .s
381
395
  }
382
396
  }
383
397
 
398
+ .is-invalid {
399
+ /deep/ input {
400
+ border-color: #de214b!important;
401
+ }
402
+ }
403
+
384
404
  .tool {
385
405
  position: absolute;
386
406
  top: 1rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.380",
3
+ "version": "1.0.382",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {