@kontur.candy/generator 5.68.0 → 5.68.1-init-value-by-formula-if-absent.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63913,6 +63913,7 @@ class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGenerato
|
|
|
63913
63913
|
const defaultValue = this.dataDeclarationHelper.getDefaultValue(target.toLegacyPath());
|
|
63914
63914
|
const autoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(target.toLegacyPath());
|
|
63915
63915
|
const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
|
|
63916
|
+
const optional = this.dataDeclarationHelper.isNodeOptional(target);
|
|
63916
63917
|
const compiledTarget = this.modelPathInstance(target);
|
|
63917
63918
|
const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(dependencies.map(x => ({
|
|
63918
63919
|
path: x.asDependencyModelPath(),
|
|
@@ -63923,7 +63924,7 @@ class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGenerato
|
|
|
63923
63924
|
const compiledExpressionWithCheck = this.compileAllItemsIsEmptyCheckBlock(compiledExpression, dependencyModelPaths.filter(x => !x.isIgnoreForChecks).map(x => x.path));
|
|
63924
63925
|
const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpressionWithCheck}, "${defaultValue}")`;
|
|
63925
63926
|
return {
|
|
63926
|
-
compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled})`,
|
|
63927
|
+
compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled}, ${optional})`,
|
|
63927
63928
|
dependencies: dependencies
|
|
63928
63929
|
};
|
|
63929
63930
|
}
|
|
@@ -72531,7 +72532,13 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
|
|
|
72531
72532
|
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
|
|
72532
72533
|
}
|
|
72533
72534
|
createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) {
|
|
72534
|
-
|
|
72535
|
+
const valueRef = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value");
|
|
72536
|
+
const valueRefCurrentIteration = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value");
|
|
72537
|
+
const autoFlagRefCurrentIteration = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag");
|
|
72538
|
+
const isRequiredField = !this.dataDeclarationHelper.isNodeOptional(fullTarget);
|
|
72539
|
+
const autoFlagIsTrueCondition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.makeNoDeps)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.makeStringValueReference)(fullTarget.toCurrentIteration(), "autoFlag")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("true"));
|
|
72540
|
+
const combinedCondition = isRequiredField ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(autoFlagIsTrueCondition, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.AndBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.EqExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.makeNoDeps)(valueRefCurrentIteration), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.EqExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.makeNoDeps)(autoFlagRefCurrentIteration), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()))) : autoFlagIsTrueCondition;
|
|
72541
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(valueRef, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(combinedCondition, getFormulaExpression("value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue))));
|
|
72535
72542
|
}
|
|
72536
72543
|
adjustPathMultiplicity(path) {
|
|
72537
72544
|
return (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(path, this.formSchemaRng, this.dataDeclarationHelper);
|