@astroapps/forms-core 1.2.0 → 1.2.2
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 +4 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/validators.d.ts +1 -1
- package/package.json +1 -1
- package/src/formState.ts +2 -1
- 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
|
@@ -360,7 +360,7 @@ export function createFormState(
|
|
|
360
360
|
);
|
|
361
361
|
updateComputedValue(
|
|
362
362
|
disabled,
|
|
363
|
-
() => !!cf.disabled.value ||
|
|
363
|
+
() => !!cf.disabled.value || of.disabled.value,
|
|
364
364
|
);
|
|
365
365
|
|
|
366
366
|
updateComputedValue(variables, () => {
|
|
@@ -397,6 +397,7 @@ export function createFormState(
|
|
|
397
397
|
schemaInterface,
|
|
398
398
|
parent,
|
|
399
399
|
formNode,
|
|
400
|
+
hidden,
|
|
400
401
|
runAsync,
|
|
401
402
|
);
|
|
402
403
|
|
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(
|