diff --git a/src/process/conditions/index.ts b/src/process/conditions/index.ts index 211a702e..b89a4b72 100644 --- a/src/process/conditions/index.ts +++ b/src/process/conditions/index.ts @@ -93,9 +93,6 @@ export const conditionalProcess = (context: ConditionsContext, isHidden: Conditi } conditionalComp.conditionallyHidden = conditionalComp.conditionallyHidden || isHidden(context); - if (conditionalComp.conditionallyHidden) { - set(component, 'hidden', true); - } }; export const customConditionProcess: ProcessorFn = async (context: ConditionsContext) => { diff --git a/src/process/hideChildren.ts b/src/process/hideChildren.ts index 2d2c81de..d79b1a95 100644 --- a/src/process/hideChildren.ts +++ b/src/process/hideChildren.ts @@ -19,7 +19,12 @@ export const hideChildrenProcessor: ProcessorFnSync = (context) const isConditionallyHidden = scope.conditionals?.find((cond) => { return path.includes(cond.path) && cond.conditionallyHidden; }); - if (component.hidden && isConditionallyHidden) { + + if (!scope.conditionals) { + scope.conditionals = []; + } + + if (isConditionallyHidden || component.hidden) { const info = componentInfo(component); if (info.hasColumns || info.hasComps || info.hasRows) { // If this is a container component, we need to make the mutation to all the child components as well. @@ -27,17 +32,6 @@ export const hideChildrenProcessor: ProcessorFnSync = (context) if (comp !== component) { // the path set here is not the absolute path, but the path relative to the parent component (scope as ConditionsScope).conditionals?.push({ path: getComponentPath(comp, compPath), conditionallyHidden: true }); - set(comp, 'hidden', true); - } - }); - } - } else if (component.hidden) { - const info = componentInfo(component); - if (info.hasColumns || info.hasComps || info.hasRows) { - // If this is a container component, we need to make the mutation to all the child components as well. - eachComponentData([component], row, (comp: Component, data: any, compRow: any, compPath: string) => { - if (comp !== component) { - set(comp, 'hidden', true); } }); } diff --git a/src/utils/logic.ts b/src/utils/logic.ts index c88f4977..06bad6cd 100644 --- a/src/utils/logic.ts +++ b/src/utils/logic.ts @@ -3,7 +3,6 @@ import { checkCustomConditional, checkJsonConditional, checkLegacyConditional, c import { LogicActionCustomAction, LogicActionMergeComponentSchema, LogicActionProperty, LogicActionPropertyBoolean, LogicActionPropertyString, LogicActionValue } from "types/AdvancedLogic"; import { get, set, clone, isEqual, assign } from 'lodash'; import { evaluate, interpolate } from 'modules/jsonlogic'; -import { componentInfo, eachComponentData, getComponentPath } from "./formUtil"; export const hasLogic = (context: LogicContext): boolean => { const { component } = context; @@ -70,7 +69,6 @@ export function setActionBooleanProperty(context: LogicContext, action: LogicAct conditionallyHidden: !!component.hidden, }); } - set(component, 'hidden', !!component.hidden); } return true; }