tune active param logic

This commit is contained in:
Val Erastov 2022-07-24 15:26:09 -07:00
parent 75ccd98e18
commit a6aa53fc9d
2 changed files with 12 additions and 8 deletions

View file

@ -52,7 +52,10 @@ export function attachToForm(Control): any {
const fullPath = [...formPath, name]; const fullPath = [...formPath, name];
const fullPathFlatten = flattenPath(fullPath); const fullPathFlatten = flattenPath(fullPath);
const onChange = value => formEdit.onChange(fullPath, value); const onChange = value => {
formEdit.onChange(fullPath, value);
setActive(true);
}
const setActive = (isActive) => formEdit.setActive(fullPathFlatten, isActive); const setActive = (isActive) => formEdit.setActive(fullPathFlatten, isActive);
const value = params[name]; const value = params[name];

View file

@ -91,16 +91,17 @@ export function activate(ctx: ApplicationContext) {
disposerList = createFunctionList(); disposerList = createFunctionList();
} }
if (curr !== null && old?.requestKey !== curr.requestKey) {
const newState: WizardState = {}; const newState: WizardState = {};
if (curr) { if (curr) {
const op = ctx.operationService.get(curr.type); const op = ctx.operationService.get(curr.type);
if (op.defaultActiveField) { if (op.defaultActiveField) {
newState.activeParam = op.defaultActiveField; newState.activeParam = op.defaultActiveField;
} }
} }
state$.next(newState); state$.next(newState);
}
}) })
const updateParams = mutator => workingRequest$.update((req: WorkingRequest) => produce(req, draft => { const updateParams = mutator => workingRequest$.update((req: WorkingRequest) => produce(req, draft => {