(
state: JsonFormsState,
ownProps: any,
uischema: UISchemaElement,
schema: (JsonSchema & { readOnly?: boolean }) | undefined,
rootData: any,
config: any
)
| 8 | * the schema and the enablement indicator of the parent. |
| 9 | */ |
| 10 | export const isInherentlyEnabled = ( |
| 11 | state: JsonFormsState, |
| 12 | ownProps: any, |
| 13 | uischema: UISchemaElement, |
| 14 | schema: (JsonSchema & { readOnly?: boolean }) | undefined, |
| 15 | rootData: any, |
| 16 | config: any |
| 17 | ) => { |
| 18 | if (!config?.separateReadonlyFromDisabled && state?.jsonforms?.readonly) { |
| 19 | return false; |
| 20 | } |
| 21 | if (uischema && hasEnableRule(uischema)) { |
| 22 | return isEnabled(uischema, rootData, ownProps?.path, getAjv(state), config); |
| 23 | } |
| 24 | if (!config?.separateReadonlyFromDisabled) { |
| 25 | if (typeof uischema?.options?.readonly === 'boolean') { |
| 26 | return !uischema.options.readonly; |
| 27 | } |
| 28 | if (typeof uischema?.options?.readOnly === 'boolean') { |
| 29 | return !uischema.options.readOnly; |
| 30 | } |
| 31 | if (typeof config?.readonly === 'boolean') { |
| 32 | return !config.readonly; |
| 33 | } |
| 34 | if (typeof config?.readOnly === 'boolean') { |
| 35 | return !config.readOnly; |
| 36 | } |
| 37 | if (schema?.readOnly === true) { |
| 38 | return false; |
| 39 | } |
| 40 | } |
| 41 | if (typeof ownProps?.enabled === 'boolean') { |
| 42 | return ownProps.enabled; |
| 43 | } |
| 44 | return true; |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * Indicates whether the given `uischema` element shall be readonly or writable. |
no test coverage detected
searching dependent graphs…