@farm-investimentos/front-mfe-components 11.10.2 → 11.10.3
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/dist/front-mfe-components.common.js +128 -113
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +128 -113
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Form/Form.stories.js +0 -4
- package/src/components/Form/Form.vue +1 -1
- package/src/components/Select/Select.vue +23 -8
package/package.json
CHANGED
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
</div>
|
|
42
42
|
</template>
|
|
43
43
|
</farm-contextmenu>
|
|
44
|
-
|
|
45
44
|
<farm-caption v-if="showErrorText" color="error" variation="regular">
|
|
46
45
|
{{ errorBucket[0] }}
|
|
47
46
|
</farm-caption>
|
|
@@ -116,7 +115,7 @@ export default Vue.extend({
|
|
|
116
115
|
},
|
|
117
116
|
},
|
|
118
117
|
setup(props, { emit }) {
|
|
119
|
-
const { rules, items, itemText, itemValue } = toRefs(props);
|
|
118
|
+
const { rules, items, itemText, itemValue, disabled } = toRefs(props);
|
|
120
119
|
const innerValue = ref(props.value);
|
|
121
120
|
const isTouched = ref(false);
|
|
122
121
|
const isBlured = ref(false);
|
|
@@ -126,6 +125,7 @@ export default Vue.extend({
|
|
|
126
125
|
const { errorBucket, valid, validatable } = validateFormStateBuilder();
|
|
127
126
|
|
|
128
127
|
let fieldValidator = validateFormFieldBuilder(rules.value);
|
|
128
|
+
let validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
|
|
129
129
|
|
|
130
130
|
const hasError = computed(() => {
|
|
131
131
|
return errorBucket.value.length > 0;
|
|
@@ -135,8 +135,20 @@ export default Vue.extend({
|
|
|
135
135
|
|
|
136
136
|
watch(
|
|
137
137
|
() => props.value,
|
|
138
|
+
newValue => {
|
|
139
|
+
innerValue.value = newValue;
|
|
140
|
+
errorBucket.value = [];
|
|
141
|
+
validate(newValue);
|
|
142
|
+
updateSelectedTextValue();
|
|
143
|
+
emit('input', newValue);
|
|
144
|
+
emit('change', newValue);
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
watch(
|
|
149
|
+
() => props.items,
|
|
138
150
|
() => {
|
|
139
|
-
|
|
151
|
+
errorBucket.value = [];
|
|
140
152
|
validate(innerValue.value);
|
|
141
153
|
updateSelectedTextValue();
|
|
142
154
|
}
|
|
@@ -157,21 +169,20 @@ export default Vue.extend({
|
|
|
157
169
|
(newVal, oldVal) => {
|
|
158
170
|
if (deepEqual(newVal, oldVal)) return;
|
|
159
171
|
fieldValidator = validateFormFieldBuilder(rules.value);
|
|
160
|
-
validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
|
|
161
172
|
validate(innerValue.value);
|
|
162
173
|
}
|
|
163
174
|
);
|
|
164
175
|
|
|
165
176
|
onBeforeMount(() => {
|
|
166
177
|
validate(innerValue.value);
|
|
167
|
-
|
|
168
178
|
updateSelectedTextValue();
|
|
169
179
|
});
|
|
170
180
|
|
|
171
|
-
let validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
|
|
172
|
-
|
|
173
181
|
const reset = () => {
|
|
174
|
-
|
|
182
|
+
if (disabled.value) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
innerValue.value = null;
|
|
175
186
|
selectedText.value = '';
|
|
176
187
|
isTouched.value = true;
|
|
177
188
|
emit('input', innerValue.value);
|
|
@@ -198,6 +209,10 @@ export default Vue.extend({
|
|
|
198
209
|
};
|
|
199
210
|
|
|
200
211
|
const updateSelectedTextValue = () => {
|
|
212
|
+
if (!items.value || items.value.length === 0) {
|
|
213
|
+
selectedText.value = '';
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
201
216
|
const selectedItem = items.value.find(
|
|
202
217
|
item => item[itemValue.value] === innerValue.value
|
|
203
218
|
);
|