mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
tune active param logic
This commit is contained in:
parent
75ccd98e18
commit
a6aa53fc9d
2 changed files with 12 additions and 8 deletions
|
|
@ -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];
|
||||||
|
|
|
||||||
|
|
@ -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 => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue