This commit is contained in:
IDONTSUDO 2024-04-18 20:44:26 +03:00
parent 38ffde1d77
commit 94b40bf24c
8 changed files with 33 additions and 16 deletions

View file

@ -87,6 +87,7 @@ export class FormBuilderStore {
el.totalValue.push(el.values);
return el;
});
this.changerForm.emit(this.formViewModel?.fromFormBuilderValidationModel());
};
init(context: string, result: string) {

View file

@ -120,7 +120,6 @@ export class FormViewModel {
let subResult = subElement.totalValue ?? subElement.defaultValue;
console.log(subResult);
if (subElement.type.isEqualMany([InputType.STRING, InputType.ENUM])) {
console.log(201)
subResult = `"${String(subResult)}"`;
}
if (subElement.type.isEqual(InputType.NUMBER)) {
@ -133,17 +132,22 @@ export class FormViewModel {
if (Object.keys(objectUnion).length !== 0) {
if (element.subType) {
objectMapperResult = this.getTypeBody(element.subType);
Object.entries(objectUnion).forEach(([key, value]) => {
objectMapperResult = objectMapperResult.replace(new RegExp("\\${" + key + ".*?}"), value as any);
});
if (objectMapperResult !== undefined) {
Object.entries(objectUnion).forEach(([key, value]) => {
objectMapperResult = objectMapperResult.replace(new RegExp("\\${" + key + ".*?}"), value as any);
});
}
}
inputResult.push(objectMapperResult.replaceAll("\n", "").replaceAll("\\", "").replaceAll("/", "").replaceAll(';',''))
if (objectMapperResult)
inputResult.push(
objectMapperResult.replaceAll("\n", "").replaceAll("\\", "").replaceAll("/", "").replaceAll(";", "")
);
}
});
}
}
}
console.log(inputResult);
if (inputResult instanceof Array) inputResult = JSON.stringify(inputResult.map((el) => JSON.parse(el)));
operations.push({ regExp: new RegExp("\\${" + element.name + ".*?}"), result: inputResult });
});
@ -153,7 +157,7 @@ export class FormViewModel {
operations.forEach((el) => {
result = result.replace(el.regExp, el.result);
});
return result;
}
getTypeBody(subType: string): string {