@astroapps/forms-core 1.2.0 → 1.2.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.
- package/lib/index.cjs +3 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/validators.d.ts +1 -1
- package/package.json +1 -1
- package/src/formState.ts +1 -0
- package/src/validators.ts +7 -2
package/lib/validators.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export declare const lengthValidator: ValidatorEval<LengthValidator>;
|
|
|
21
21
|
export declare const dateValidator: ValidatorEval<DateValidator>;
|
|
22
22
|
export declare const defaultValidators: Record<string, ValidatorEval<any>>;
|
|
23
23
|
export declare function createValidators(def: ControlDefinition, context: ValidationEvalContext): void;
|
|
24
|
-
export declare function setupValidation(controlImpl: Control<FormContextOptions>, definition: ControlDefinition, dataNode: Control<SchemaDataNode | undefined>, schemaInterface: SchemaInterface, parent: SchemaDataNode, formNode: FormNode, runAsync: (af: () => void) => void): void;
|
|
24
|
+
export declare function setupValidation(controlImpl: Control<FormContextOptions>, definition: ControlDefinition, dataNode: Control<SchemaDataNode | undefined>, schemaInterface: SchemaInterface, parent: SchemaDataNode, formNode: FormNode, hidden: Control<boolean>, runAsync: (af: () => void) => void): void;
|
package/package.json
CHANGED
package/src/formState.ts
CHANGED
package/src/validators.ts
CHANGED
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
SchemaValidator,
|
|
7
7
|
ValidatorType,
|
|
8
8
|
} from "./schemaValidator";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
ControlDefinition,
|
|
11
|
+
DataControlDefinition,
|
|
12
|
+
isDataControl,
|
|
13
|
+
} from "./controlDefinition";
|
|
10
14
|
import { SchemaDataNode } from "./schemaDataNode";
|
|
11
15
|
import {
|
|
12
16
|
Control,
|
|
@@ -171,11 +175,12 @@ export function setupValidation(
|
|
|
171
175
|
schemaInterface: SchemaInterface,
|
|
172
176
|
parent: SchemaDataNode,
|
|
173
177
|
formNode: FormNode,
|
|
178
|
+
hidden: Control<boolean>,
|
|
174
179
|
runAsync: (af: () => void) => void,
|
|
175
180
|
) {
|
|
176
181
|
const validationEnabled = createScopedComputed(
|
|
177
182
|
controlImpl,
|
|
178
|
-
() => !
|
|
183
|
+
() => !hidden.value,
|
|
179
184
|
);
|
|
180
185
|
const validatorsScope = createCleanupScope();
|
|
181
186
|
createEffect(
|