vira 28.12.0 → 28.12.1
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.
|
@@ -97,4 +97,4 @@ export declare function applyRequiredLabel(label: string | undefined, isRequired
|
|
|
97
97
|
*
|
|
98
98
|
* @category Internal
|
|
99
99
|
*/
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function areFormFieldsValid(formFields: Readonly<ViraFormFields>): boolean;
|
|
@@ -45,7 +45,7 @@ export function applyRequiredLabel(label, isRequired) {
|
|
|
45
45
|
*
|
|
46
46
|
* @category Internal
|
|
47
47
|
*/
|
|
48
|
-
export function
|
|
48
|
+
export function areFormFieldsValid(formFields) {
|
|
49
49
|
return getObjectTypedValues(formFields).every((formField) => {
|
|
50
50
|
if (formField.isHidden || !formField.isRequired) {
|
|
51
51
|
return true;
|
|
@@ -4,7 +4,7 @@ import { defineViraElement } from '../define-vira-element.js';
|
|
|
4
4
|
import { ViraCheckbox } from '../vira-checkbox.element.js';
|
|
5
5
|
import { ViraInput, ViraInputType } from '../vira-input.element.js';
|
|
6
6
|
import { ViraSelect } from '../vira-select.element.js';
|
|
7
|
-
import { applyRequiredLabel,
|
|
7
|
+
import { applyRequiredLabel, areFormFieldsValid, ViraFormFieldType, } from './vira-form-fields.js';
|
|
8
8
|
/**
|
|
9
9
|
* A form element.
|
|
10
10
|
*
|
|
@@ -40,7 +40,7 @@ export const ViraForm = defineViraElement()({
|
|
|
40
40
|
};
|
|
41
41
|
},
|
|
42
42
|
render({ inputs, dispatch, events, state, updateState }) {
|
|
43
|
-
const currentIsValid =
|
|
43
|
+
const currentIsValid = areFormFieldsValid(inputs.fields);
|
|
44
44
|
if (currentIsValid !== state.lastIsValid) {
|
|
45
45
|
updateState({
|
|
46
46
|
lastIsValid: currentIsValid,
|