diff --git a/src/process/processOne.ts b/src/process/processOne.ts index 941e8ac2..50d2ad83 100644 --- a/src/process/processOne.ts +++ b/src/process/processOne.ts @@ -9,7 +9,7 @@ export function dataValue(component: Component, row: any) { } export async function processOne(context: ProcessorsContext) { - const { processors, component } = context; + const { processors, component, path } = context; // Create a getter for `value` that is always derived from the current data object if (typeof context.value === 'undefined') { Object.defineProperty(context, 'value', { @@ -22,8 +22,18 @@ export async function processOne(context: ProcessorsContext(context: ProcessorsContext(context: ProcessorsContext) { - const { processors, component } = context; + const { processors, component, path } = context; // Create a getter for `value` that is always derived from the current data object if (typeof context.value === 'undefined') { Object.defineProperty(context, 'value', { @@ -49,8 +59,17 @@ export function processOneSync(context: ProcessorsContext { @@ -33,7 +30,7 @@ export function eachComponent( const info = componentInfo(component); let noRecurse = false; // Keep track of parent references. - if (parent && !noComponentChange) { + if (parent) { // Ensure we don't create infinite JSON structures. Object.defineProperty(component, 'parent', { enumerable: false, @@ -58,14 +55,6 @@ export function eachComponent( const compPath = componentPath(component, path); - if (!noComponentChange) { - Object.defineProperty(component, 'path', { - enumerable: false, - writable: true, - value: compPath, - }); - } - if (includeAll || component.tree || !info.layout) { noRecurse = !!fn(component, compPath, components, parent); } @@ -73,27 +62,13 @@ export function eachComponent( if (!noRecurse) { if (info.hasColumns) { component.columns.forEach((column: any) => - eachComponent( - column.components, - fn, - includeAll, - path, - parent ? component : null, - noComponentChange, - ), + eachComponent(column.components, fn, includeAll, path, parent ? component : null), ); } else if (info.hasRows) { component.rows.forEach((row: any) => { if (Array.isArray(row)) { row.forEach((column) => - eachComponent( - column.components, - fn, - includeAll, - path, - parent ? component : null, - noComponentChange, - ), + eachComponent(column.components, fn, includeAll, path, parent ? component : null), ); } }); @@ -104,7 +79,6 @@ export function eachComponent( includeAll, componentFormPath(component, path, compPath), parent ? component : null, - noComponentChange, ); } } diff --git a/src/utils/formUtil/eachComponentAsync.ts b/src/utils/formUtil/eachComponentAsync.ts index deee2143..36985a32 100644 --- a/src/utils/formUtil/eachComponentAsync.ts +++ b/src/utils/formUtil/eachComponentAsync.ts @@ -7,7 +7,6 @@ export async function eachComponentAsync( includeAll = false, path = '', parent?: any, - noComponentChange?: boolean, ) { if (!components) return; for (let i = 0; i < components.length; i++) { @@ -17,7 +16,7 @@ export async function eachComponentAsync( const component = components[i]; const info = componentInfo(component); // Keep track of parent references. - if (parent && !noComponentChange) { + if (parent) { // Ensure we don't create infinite JSON structures. Object.defineProperty(component, 'parent', { enumerable: false, @@ -41,13 +40,6 @@ export async function eachComponentAsync( } const compPath = componentPath(component, path); - if (!noComponentChange) { - Object.defineProperty(component, 'path', { - enumerable: false, - writable: true, - value: compPath, - }); - } if (includeAll || component.tree || !info.layout) { if (await fn(component, compPath, components, parent)) { continue; @@ -61,7 +53,6 @@ export async function eachComponentAsync( includeAll, path, parent ? component : null, - noComponentChange, ); } } else if (info.hasRows) { @@ -75,7 +66,6 @@ export async function eachComponentAsync( includeAll, path, parent ? component : null, - noComponentChange, ); } } @@ -87,7 +77,6 @@ export async function eachComponentAsync( includeAll, componentFormPath(component, path, compPath), parent ? component : null, - noComponentChange, ); } } diff --git a/src/utils/formUtil/index.ts b/src/utils/formUtil/index.ts index 318759d7..0350a54f 100644 --- a/src/utils/formUtil/index.ts +++ b/src/utils/formUtil/index.ts @@ -431,9 +431,6 @@ export function getComponent( } }, includeAll, - undefined, - undefined, - true, ); return result; }