MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / isInherentlyEnabled

Function isInherentlyEnabled

packages/core/src/mappers/util.ts:10–45  ·  view source on GitHub ↗
(
  state: JsonFormsState,
  ownProps: any,
  uischema: UISchemaElement,
  schema: (JsonSchema & { readOnly?: boolean }) | undefined,
  rootData: any,
  config: any
)

Source from the content-addressed store, hash-verified

8 * the schema and the enablement indicator of the parent.
9 */
10export 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.

Callers 4

runtime.test.tsFile · 0.90
mapStateToControlPropsFunction · 0.90
mapStateToLayoutPropsFunction · 0.90
mapStateToCellPropsFunction · 0.90

Calls 3

hasEnableRuleFunction · 0.90
isEnabledFunction · 0.90
getAjvFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…