@react-typed-forms/schemas 11.12.0 → 11.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.
- package/lib/hooks.d.ts +1 -1
- package/lib/index.js +16 -7
- package/lib/index.js.map +1 -1
- package/lib/schemaBuilder.d.ts +4 -0
- package/lib/util.d.ts +1 -1
- package/package.json +1 -1
package/lib/hooks.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function useEvalVisibilityHook(useEvalExpressionHook: UseEvalExpr
|
|
|
8
8
|
export declare function useEvalReadonlyHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition): EvalExpressionHook<boolean>;
|
|
9
9
|
export declare function useEvalStyleHook(useEvalExpressionHook: UseEvalExpressionHook, property: DynamicPropertyType, definition: ControlDefinition): EvalExpressionHook<React.CSSProperties>;
|
|
10
10
|
export declare function useEvalAllowedOptionsHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition): EvalExpressionHook<any[]>;
|
|
11
|
-
export declare function useEvalDisabledHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition, fieldPath?: SchemaField[]): EvalExpressionHook<boolean>;
|
|
11
|
+
export declare function useEvalDisabledHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition, fieldPath?: SchemaField[], elementIndex?: number): EvalExpressionHook<boolean>;
|
|
12
12
|
export declare function useEvalDisplayHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition): DynamicHookGenerator<Control<string | undefined> | undefined, ControlDataContext>;
|
|
13
13
|
export declare function useEvalDefaultValueHook(useEvalExpressionHook: UseEvalExpressionHook, definition: ControlDefinition, schemaField: SchemaField | undefined, element: boolean): EvalExpressionHook;
|
|
14
14
|
export declare function defaultEvalHooks(expr: EntityExpression, context: ControlDataContext, coerce: (v: any) => any): Control<any>;
|
package/lib/index.js
CHANGED
|
@@ -502,10 +502,11 @@ function visitControlData(definition, ctx, cb) {
|
|
|
502
502
|
return undefined;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function lookupChildControl(data, path) {
|
|
506
|
-
|
|
505
|
+
function lookupChildControl(data, path, element) {
|
|
506
|
+
var fieldPath = path.map(function (x) {
|
|
507
507
|
return x.field;
|
|
508
|
-
})
|
|
508
|
+
});
|
|
509
|
+
return lookupChildControlPath(data, element == null ? fieldPath : [].concat(fieldPath, [element]));
|
|
509
510
|
}
|
|
510
511
|
function lookupChildControlPath(data, jsonPath) {
|
|
511
512
|
var childPath = [].concat(data.path, jsonPath);
|
|
@@ -712,6 +713,12 @@ function intField(displayName, options) {
|
|
|
712
713
|
displayName: displayName
|
|
713
714
|
}, options));
|
|
714
715
|
}
|
|
716
|
+
function doubleField(displayName, options) {
|
|
717
|
+
return makeScalarField(_extends({
|
|
718
|
+
type: exports.FieldType.Double,
|
|
719
|
+
displayName: displayName
|
|
720
|
+
}, options));
|
|
721
|
+
}
|
|
715
722
|
function dateField(displayName, options) {
|
|
716
723
|
return makeScalarField(_extends({
|
|
717
724
|
type: exports.FieldType.Date,
|
|
@@ -1000,18 +1007,19 @@ function useEvalAllowedOptionsHook(useEvalExpressionHook, definition) {
|
|
|
1000
1007
|
return core.useControl([]);
|
|
1001
1008
|
}, undefined);
|
|
1002
1009
|
}
|
|
1003
|
-
function useEvalDisabledHook(useEvalExpressionHook, definition, fieldPath) {
|
|
1010
|
+
function useEvalDisabledHook(useEvalExpressionHook, definition, fieldPath, elementIndex) {
|
|
1004
1011
|
var dynamicDisabled = useEvalDynamicBoolHook(definition, exports.DynamicPropertyType.Disabled, useEvalExpressionHook);
|
|
1005
1012
|
return makeDynamicPropertyHook(dynamicDisabled, function (ctx, _ref3) {
|
|
1006
1013
|
var fieldPath = _ref3.fieldPath;
|
|
1007
1014
|
return core.useComputed(function () {
|
|
1008
1015
|
var _dataControl$meta$nul;
|
|
1009
|
-
var dataControl = fieldPath && lookupChildControl(ctx, fieldPath);
|
|
1016
|
+
var dataControl = fieldPath && lookupChildControl(ctx, fieldPath, elementIndex);
|
|
1010
1017
|
var setToNull = (dataControl == null || (_dataControl$meta$nul = dataControl.meta["nullControl"]) == null ? void 0 : _dataControl$meta$nul.value) === false;
|
|
1011
1018
|
return setToNull || isControlDisabled(definition);
|
|
1012
1019
|
});
|
|
1013
1020
|
}, {
|
|
1014
|
-
fieldPath: fieldPath
|
|
1021
|
+
fieldPath: fieldPath,
|
|
1022
|
+
elementIndex: elementIndex
|
|
1015
1023
|
});
|
|
1016
1024
|
}
|
|
1017
1025
|
function useEvalDisplayHook(useEvalExpressionHook, definition) {
|
|
@@ -1422,7 +1430,7 @@ function useControlRenderer(definition, fields, renderer, options) {
|
|
|
1422
1430
|
defaultValueControl: useEvalDefaultValueHook(useExpr, definition, schemaField, elementIndex != null),
|
|
1423
1431
|
visibleControl: useEvalVisibilityHook(useExpr, definition, fieldPath),
|
|
1424
1432
|
readonlyControl: useEvalReadonlyHook(useExpr, definition),
|
|
1425
|
-
disabledControl: useEvalDisabledHook(useExpr, definition, fieldPath),
|
|
1433
|
+
disabledControl: useEvalDisabledHook(useExpr, definition, fieldPath, elementIndex),
|
|
1426
1434
|
allowedOptions: useEvalAllowedOptionsHook(useExpr, definition),
|
|
1427
1435
|
labelText: useEvalLabelText(useExpr, definition),
|
|
1428
1436
|
actionData: useEvalActionHook(useExpr, definition),
|
|
@@ -3103,6 +3111,7 @@ exports.defaultTailwindTheme = defaultTailwindTheme;
|
|
|
3103
3111
|
exports.defaultUseEvalExpressionHook = defaultUseEvalExpressionHook;
|
|
3104
3112
|
exports.defaultValueForField = defaultValueForField;
|
|
3105
3113
|
exports.defaultValueForFields = defaultValueForFields;
|
|
3114
|
+
exports.doubleField = doubleField;
|
|
3106
3115
|
exports.dynamicDefaultValue = dynamicDefaultValue;
|
|
3107
3116
|
exports.dynamicDisabled = dynamicDisabled;
|
|
3108
3117
|
exports.dynamicReadonly = dynamicReadonly;
|