comand-component-library 4.2.62 → 4.2.64
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.
|
@@ -4638,7 +4638,8 @@ const Re = /* @__PURE__ */ P(Pr, [["render", Er]]), Hr = {
|
|
|
4638
4638
|
show: !1,
|
|
4639
4639
|
validationStatus: "",
|
|
4640
4640
|
message: ""
|
|
4641
|
-
}
|
|
4641
|
+
},
|
|
4642
|
+
formElementsWithError: []
|
|
4642
4643
|
};
|
|
4643
4644
|
},
|
|
4644
4645
|
props: {
|
|
@@ -4765,6 +4766,9 @@ const Re = /* @__PURE__ */ P(Pr, [["render", Er]]), Hr = {
|
|
|
4765
4766
|
}
|
|
4766
4767
|
},
|
|
4767
4768
|
methods: {
|
|
4769
|
+
formElementHasError(e, t) {
|
|
4770
|
+
e === "error" && !this.formElementsWithError.includes(t) ? this.formElementsWithError.push(t) : e === "success" && this.formElementsWithError.includes(t) && (this.formElementsWithError = this.formElementsWithError.filter((n) => n !== t)), this.$emit("validation-status-change", this.formElementsWithError.length ? "error" : "success");
|
|
4771
|
+
},
|
|
4768
4772
|
createHtmlId: Vi,
|
|
4769
4773
|
showMessage(e, t) {
|
|
4770
4774
|
this.systemMessage.show = !0, this.systemMessage.validationStatus = e, this.systemMessage.message = t;
|
|
@@ -4783,6 +4787,15 @@ const Re = /* @__PURE__ */ P(Pr, [["render", Er]]), Hr = {
|
|
|
4783
4787
|
}
|
|
4784
4788
|
},
|
|
4785
4789
|
watch: {
|
|
4790
|
+
formValues: {
|
|
4791
|
+
handler() {
|
|
4792
|
+
if (!this.formElements)
|
|
4793
|
+
return;
|
|
4794
|
+
const e = this.formElements.filter((i) => i.required).length, t = this.formElements.filter((i) => i.required && !this.formValues[i.name]).length, n = e > 0 && e === t, s = e > 0 && t > 0;
|
|
4795
|
+
this.$emit("empty-required-form-elements", { allRequiredFormElementsEmpty: n, emptyRequiredFormElementExists: s });
|
|
4796
|
+
},
|
|
4797
|
+
immediate: !0
|
|
4798
|
+
},
|
|
4786
4799
|
formElements: {
|
|
4787
4800
|
handler() {
|
|
4788
4801
|
var e;
|
|
@@ -4847,8 +4860,9 @@ function Qr(e, t, n, s, i, l) {
|
|
|
4847
4860
|
autocomplete: f.autocomplete,
|
|
4848
4861
|
minlength: f.minlength,
|
|
4849
4862
|
maxlength: f.maxlength,
|
|
4850
|
-
nativeButton: f.nativeButton
|
|
4851
|
-
|
|
4863
|
+
nativeButton: f.nativeButton,
|
|
4864
|
+
onValidationStatusChange: (g) => l.formElementHasError(g, f.name)
|
|
4865
|
+
}, null, 8, ["element", "type", "name", "class", "id", "modelValue", "onUpdate:modelValue", "inputValue", "fieldIconClass", "selectOptions", "labelText", "placeholder", "required", "disabled", "autocomplete", "minlength", "maxlength", "nativeButton", "onValidationStatusChange"])) : f.component === "CmdInputGroup" ? (a(), v(c, {
|
|
4852
4866
|
key: 1,
|
|
4853
4867
|
modelValue: i.formValues[f.name],
|
|
4854
4868
|
"onUpdate:modelValue": (g) => i.formValues[f.name] = g,
|
|
@@ -21417,7 +21431,7 @@ const qx = /* @__PURE__ */ P(Ex, [["render", Hx]]), Rx = [
|
|
|
21417
21431
|
text: "Zimbabwe",
|
|
21418
21432
|
value: "zw"
|
|
21419
21433
|
}
|
|
21420
|
-
], n1 = "comand-component-library", i1 = "4.2.
|
|
21434
|
+
], n1 = "comand-component-library", i1 = "4.2.64", l1 = "GPL-3.0-only", o1 = "CoManD-UI", a1 = "module", s1 = {
|
|
21421
21435
|
prepublishOnly: "npm run build-lib",
|
|
21422
21436
|
dev: "vite",
|
|
21423
21437
|
build: "vite build",
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
:minlength="item.minlength"
|
|
36
36
|
:maxlength="item.maxlength"
|
|
37
37
|
:nativeButton="item.nativeButton"
|
|
38
|
+
@validation-status-change="formElementHasError($event, item.name)"
|
|
38
39
|
/>
|
|
39
40
|
<CmdInputGroup
|
|
40
41
|
v-else-if="item.component === 'CmdInputGroup'"
|
|
@@ -124,7 +125,8 @@ export default {
|
|
|
124
125
|
show: false,
|
|
125
126
|
validationStatus: "",
|
|
126
127
|
message: ""
|
|
127
|
-
}
|
|
128
|
+
},
|
|
129
|
+
formElementsWithError: []
|
|
128
130
|
}
|
|
129
131
|
},
|
|
130
132
|
props: {
|
|
@@ -251,6 +253,14 @@ export default {
|
|
|
251
253
|
}
|
|
252
254
|
},
|
|
253
255
|
methods: {
|
|
256
|
+
formElementHasError(event, itemName) {
|
|
257
|
+
if (event === "error" && !this.formElementsWithError.includes(itemName)) {
|
|
258
|
+
this.formElementsWithError.push(itemName)
|
|
259
|
+
} else if (event === "success" && this.formElementsWithError.includes(itemName)) {
|
|
260
|
+
this.formElementsWithError = this.formElementsWithError.filter((element) => element !== itemName)
|
|
261
|
+
}
|
|
262
|
+
this.$emit("validation-status-change", this.formElementsWithError.length ? "error" : "success")
|
|
263
|
+
},
|
|
254
264
|
createHtmlId,
|
|
255
265
|
showMessage(validationStatus, message) {
|
|
256
266
|
this.systemMessage.show = true
|
|
@@ -289,6 +299,27 @@ export default {
|
|
|
289
299
|
}
|
|
290
300
|
},
|
|
291
301
|
watch: {
|
|
302
|
+
formValues: {
|
|
303
|
+
handler() {
|
|
304
|
+
if(!this.formElements) {
|
|
305
|
+
return
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const numberRequiredFormElements = this.formElements.filter((element) => {
|
|
309
|
+
return element.required
|
|
310
|
+
}).length
|
|
311
|
+
|
|
312
|
+
const numberEmptyRequiredFormElements = this.formElements.filter((element) => {
|
|
313
|
+
return element.required && !this.formValues[element.name]
|
|
314
|
+
}).length
|
|
315
|
+
|
|
316
|
+
const allRequiredFormElementsEmpty = numberRequiredFormElements > 0 && numberRequiredFormElements === numberEmptyRequiredFormElements
|
|
317
|
+
const emptyRequiredFormElementExists = numberRequiredFormElements > 0 && numberEmptyRequiredFormElements > 0
|
|
318
|
+
|
|
319
|
+
this.$emit("empty-required-form-elements", { allRequiredFormElementsEmpty, emptyRequiredFormElementExists })
|
|
320
|
+
},
|
|
321
|
+
immediate: true
|
|
322
|
+
},
|
|
292
323
|
formElements: {
|
|
293
324
|
handler() {
|
|
294
325
|
this.formValues = {}
|