@kontur.candy/generator 4.278.0-efs-partial-load.7 → 4.278.0-efs-partial-load.9

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.
Files changed (2) hide show
  1. package/dist/index.js +68 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -115473,6 +115473,7 @@ class KCLangAntlrParser {
115473
115473
  const tokens = new antlr4ts__WEBPACK_IMPORTED_MODULE_0__.CommonTokenStream(lexer);
115474
115474
  const parser = new _KCLangGenerated_KCLangParser__WEBPACK_IMPORTED_MODULE_4__.KCLangParser(tokens);
115475
115475
  const errorListener = new ErrorListener();
115476
+ parser.removeErrorListeners();
115476
115477
  parser.addErrorListener(errorListener);
115477
115478
  const tree = parser.kclang();
115478
115479
 
@@ -131316,7 +131317,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
131316
131317
  const lazyLoadingRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_LazyLoadingRulesBuilder__WEBPACK_IMPORTED_MODULE_37__.LazyLoadingRulesBuilder(sugarRoot, lazyLoadGeneratorResult.declaration);
131317
131318
  const sugarRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_SugarRulesBuilder__WEBPACK_IMPORTED_MODULE_38__.SugarRulesBuilder(sugarRoot, formSchemaRng, controlCustomizationContext, fetchFunctions);
131318
131319
  const validationRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_ValidationRulesBuilder__WEBPACK_IMPORTED_MODULE_39__.ValidationRulesBuilder(sugarRoot, dataDeclarationHelper, formSchemaRng, formulaExprConverter, kcXmlConditions, typeRegistry, (_sugarRoot$schemaVali3 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali3 !== void 0 ? _sugarRoot$schemaVali3 : false);
131319
- const optionalSectionRuleBuilder = new _ServerSideFLangNormalization_RuleBuilders_OptionalSectionRulesBuilder__WEBPACK_IMPORTED_MODULE_32__.OptionalSectionRulesBuilder(dataDeclarationHelper);
131320
+ const optionalSectionRuleBuilder = new _ServerSideFLangNormalization_RuleBuilders_OptionalSectionRulesBuilder__WEBPACK_IMPORTED_MODULE_32__.OptionalSectionRulesBuilder(sugarRoot, dataDeclarationHelper);
131320
131321
  const normalizationRulesGenerator = new _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder);
131321
131322
  const formulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter);
131322
131323
  const formulaAndInitOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaAndInitOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_40__.FormulaAndInitOnlyNormalizationRuleGenerator(sugarRulesBuilder, formulaRulesBuilder, optionalSectionRuleBuilder);
@@ -131925,9 +131926,7 @@ class FLangValidationBuildContext {
131925
131926
  getFlangExpressionFromKclangCondition(prefix, target, condition, invertRequired) {
131926
131927
  const fullKcLangExpr = `
131927
131928
  in ${prefix.toLegacyPath()} {
131928
- check ${condition}
131929
- with description \`\`\`Condition must match\`\`\`
131930
- with errorLevel \`\`\`Error\`\`\`;
131929
+ check Test === (${condition}) ? 1 : 0;
131931
131930
  }
131932
131931
  `;
131933
131932
 
@@ -131936,14 +131935,15 @@ class FLangValidationBuildContext {
131936
131935
 
131937
131936
  const formulaReader = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaReader__WEBPACK_IMPORTED_MODULE_8__.FormulaReader();
131938
131937
  const kcLangMathContainer = formulaReader.readFormulas(_common_KCLang_KCLangToXmlTranspiler__WEBPACK_IMPORTED_MODULE_7__.KCLangToXmlTranspiler.transpile(fullKcLangExpr));
131939
- const conditionNode = (_kcLangMathContainer$ = kcLangMathContainer === null || kcLangMathContainer === void 0 ? void 0 : (_kcLangMathContainer$2 = kcLangMathContainer.conditions) === null || _kcLangMathContainer$2 === void 0 ? void 0 : (_kcLangMathContainer$3 = _kcLangMathContainer$2.items) === null || _kcLangMathContainer$3 === void 0 ? void 0 : _kcLangMathContainer$3[0]) !== null && _kcLangMathContainer$ !== void 0 ? _kcLangMathContainer$ : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
131940
- const flangExpr = this.formulaExprConverter.compileExpressionToFlangExpression(conditionNode.expression, prefix, target, value => {
131938
+ const formulaNode = (_kcLangMathContainer$ = kcLangMathContainer === null || kcLangMathContainer === void 0 ? void 0 : (_kcLangMathContainer$2 = kcLangMathContainer.formulas) === null || _kcLangMathContainer$2 === void 0 ? void 0 : (_kcLangMathContainer$3 = _kcLangMathContainer$2.items) === null || _kcLangMathContainer$3 === void 0 ? void 0 : _kcLangMathContainer$3[0]) !== null && _kcLangMathContainer$ !== void 0 ? _kcLangMathContainer$ : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
131939
+ const formulaExpr = this.formulaExprConverter.compileExpressionToFlangExpression(formulaNode.expression, prefix, target, value => {
131941
131940
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_9__.NotSupportedError("In contextual KcLang conditions should not be summation.");
131942
131941
  });
131942
+ const flangExpr = formulaExpr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ConditionalExpression ? formulaExpr.condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
131943
131943
 
131944
131944
  const getTypeCorrectedExpression = () => {
131945
131945
  const argExpr = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_11__.castOperandToStringIfNeed)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_11__.tryExtractValueReferenceAsStringFromDecimal)(flangExpr));
131946
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.AndBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.EqExpression(argExpr, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.EqExpression(argExpr, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.StringLiteralExpression("")));
131946
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.AndBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NotEqExpression(argExpr, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NotEqExpression(argExpr, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.StringLiteralExpression("")));
131947
131947
  };
131948
131948
 
131949
131949
  const correctedFLangExpr = flangExpr.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BuildInTypeExpression.bool ? flangExpr : getTypeCorrectedExpression();
@@ -134182,8 +134182,10 @@ __webpack_require__.r(__webpack_exports__);
134182
134182
 
134183
134183
 
134184
134184
  class OptionalSectionRulesBuilder {
134185
- constructor(dataDeclarationHelper) {
134185
+ constructor(sugarRoot, dataDeclarationHelper) {
134186
+ this.sugarRoot = void 0;
134186
134187
  this.dataDeclarationHelper = void 0;
134188
+ this.sugarRoot = sugarRoot;
134187
134189
  this.dataDeclarationHelper = dataDeclarationHelper;
134188
134190
  }
134189
134191
 
@@ -134201,20 +134203,36 @@ class OptionalSectionRulesBuilder {
134201
134203
  return allRules;
134202
134204
  }
134203
134205
 
134206
+ *getAllSections() {
134207
+ const pagesToProcess = [...this.sugarRoot.pages];
134208
+
134209
+ while ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.arrayIsNotEmpty)(pagesToProcess)) {
134210
+ const page = pagesToProcess.pop();
134211
+
134212
+ if (page != null && (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined)(page.path)) {
134213
+ var _page$optional;
134214
+
134215
+ yield {
134216
+ sectionId: page.id,
134217
+ path: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(page.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each),
134218
+ optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false
134219
+ };
134220
+ pagesToProcess.push(...page.pages);
134221
+ }
134222
+ }
134223
+ }
134224
+
134204
134225
  wrapRulesWithOptionalPageCheck(rules) {
134205
- const allOptionalSections = (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.reverseArray)(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.IterUtils.sortBy(this.dataDeclarationHelper.getOptionalSections().map(x => ({
134206
- path: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(x.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each),
134207
- sectionId: x.id
134208
- })), x => x.path.toLegacyPath())).toArray();
134226
+ const allOptionalSections = (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.reverseArray)(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.IterUtils.sortBy(this.getAllSections(), x => x.path.toLegacyPath())).toArray();
134209
134227
  const wrappedRules = Iterator.from(rules).map(rule => rule instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement && rule.left.valueName != "children" ? this.wrapSetStatementWithOptionalPageCheckIfNeeded(rule, allOptionalSections) : rule);
134210
134228
  return wrappedRules;
134211
134229
  }
134212
134230
 
134213
- wrapSetStatementWithOptionalPageCheckIfNeeded(rule, orderedOptionalSections) {
134231
+ wrapSetStatementWithOptionalPageCheckIfNeeded(rule, orderedSections) {
134214
134232
  const targetPath = rule.left.modePath;
134215
- const targetOptionalSection = orderedOptionalSections.find(x => _Engine_src_Engine_Core_PathUtils_PathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.isPrefix(x.path.toLegacyPath(), targetPath.toLegacyPath()));
134233
+ const targetOptionalSection = orderedSections.find(x => _Engine_src_Engine_Core_PathUtils_PathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.isPrefix(x.path.toLegacyPath(), targetPath.toLegacyPath()));
134216
134234
 
134217
- if (targetOptionalSection != undefined) {
134235
+ if (targetOptionalSection != undefined && targetOptionalSection.optional) {
134218
134236
  const targetIsFilledPath = targetOptionalSection.path.joinWith(OptionalSectionRulesBuilder.optionalSectionFilledFieldName);
134219
134237
 
134220
134238
  if (!targetIsFilledPath.isEquals(targetPath)) {
@@ -157406,8 +157424,10 @@ __webpack_require__.r(__webpack_exports__);
157406
157424
  /* harmony import */ var _ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../ComponentMarkupBuilder/ComponentMarkupBuilder */ "./Generator/src/generators/markupGenerator/ComponentMarkupBuilder/ComponentMarkupBuilder.ts");
157407
157425
  /* harmony import */ var _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../SugarNodeConverter */ "./Generator/src/generators/markupGenerator/SugarNodeConverter.ts");
157408
157426
  /* harmony import */ var _CommonNodeProperties_TooltipProperties_SetTooltipSettingsProps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../CommonNodeProperties/TooltipProperties/SetTooltipSettingsProps */ "./Generator/src/generators/markupGenerator/ElementProcessors/CommonNodeProperties/TooltipProperties/SetTooltipSettingsProps.ts");
157409
- /* harmony import */ var _PicklistReference__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PicklistReference */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/Select/PicklistReference.ts");
157427
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
157410
157428
  /* harmony import */ var _SelectNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SelectNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/Select/SelectNode.ts");
157429
+ /* harmony import */ var _PicklistReference__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./PicklistReference */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/Select/PicklistReference.ts");
157430
+
157411
157431
 
157412
157432
 
157413
157433
 
@@ -157433,6 +157453,27 @@ class SelectConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_3__.S
157433
157453
  }), context.addPathSectionDeclarationEntry(node, node.dataBinding.requisite), context.addVisibilityPathDeclEntryNew(node, node.dataBinding.requisite));
157434
157454
  }
157435
157455
 
157456
+ doBuildFLangValidations(buildContext, formSchemaRng) {
157457
+ const node = this.getCurrentNodeAs(_SelectNode__WEBPACK_IMPORTED_MODULE_6__.SelectNode);
157458
+ const element = formSchemaRng.getElementByPath(node.getFullPath());
157459
+ const targetPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_5__.createAbsoluteFromMask)(this.getResolvedBindingPath(node), _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_5__.PathTokens.each);
157460
+ const typeNode = buildContext.getTypeNode(node.validationInfo);
157461
+ const schemaTypeNode = buildContext.getSchemaTypeInfo(targetPath);
157462
+
157463
+ if (typeNode == undefined && schemaTypeNode == undefined) {
157464
+ return [];
157465
+ }
157466
+
157467
+ return buildContext.buildBasicValidations(targetPath, typeNode, schemaTypeNode, node.validationInfo.optional == undefined ? element === null || element === void 0 ? void 0 : element.isOptional() : node.validationInfo.optional);
157468
+ }
157469
+
157470
+ doBuildNormalizeRules(builder) {
157471
+ const node = this.getCurrentNodeAs(_SelectNode__WEBPACK_IMPORTED_MODULE_6__.SelectNode);
157472
+ return [builder.valueInitializer(node, node.dataBinding, node.disabled), ...builder.specialFieldsInitializer(node, {
157473
+ disabled: node.disabled
157474
+ })];
157475
+ }
157476
+
157436
157477
  buildChildrenDataDeclaration(context) {
157437
157478
  const node = this.getCurrentNodeAs(_SelectNode__WEBPACK_IMPORTED_MODULE_6__.SelectNode);
157438
157479
  return context.processChildrenDataDeclaration(node.helpNodes);
@@ -157469,13 +157510,13 @@ class SelectConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_3__.S
157469
157510
  markupBuilder.prop(x => x.reference).set(referenceData);
157470
157511
  }
157471
157512
 
157472
- const reference = (0,_PicklistReference__WEBPACK_IMPORTED_MODULE_5__.extractPicklistReference)(node);
157513
+ const reference = (0,_PicklistReference__WEBPACK_IMPORTED_MODULE_7__.extractPicklistReference)(node);
157473
157514
 
157474
- if ((reference === null || reference === void 0 ? void 0 : reference.type) === _PicklistReference__WEBPACK_IMPORTED_MODULE_5__.PicklistReferenceType.GlobalPicklist) {
157515
+ if ((reference === null || reference === void 0 ? void 0 : reference.type) === _PicklistReference__WEBPACK_IMPORTED_MODULE_7__.PicklistReferenceType.GlobalPicklist) {
157475
157516
  markupBuilder.prop(x => x.gId).set(reference.id);
157476
157517
  }
157477
157518
 
157478
- if ((reference === null || reference === void 0 ? void 0 : reference.type) === _PicklistReference__WEBPACK_IMPORTED_MODULE_5__.PicklistReferenceType.LocalPaths) {
157519
+ if ((reference === null || reference === void 0 ? void 0 : reference.type) === _PicklistReference__WEBPACK_IMPORTED_MODULE_7__.PicklistReferenceType.LocalPaths) {
157479
157520
  markupBuilder.prop(x => x.gPaths).set(reference.paths);
157480
157521
  }
157481
157522
 
@@ -160005,7 +160046,7 @@ class FLangNormalizationRulesBuilder {
160005
160046
  const currentValueReference = new _ServerSideFLangNormalization_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _ServerSideFLangNormalization_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(targetPathReference.toCurrentIteration(), "value"));
160006
160047
  const defaultValue = (_dataBinding$defaultV = dataBinding.defaultValue) !== null && _dataBinding$defaultV !== void 0 ? _dataBinding$defaultV : "";
160007
160048
 
160008
- if (dataBinding.fetchfn !== undefined) {
160049
+ if ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrEmpty)(dataBinding.fetchfn)) {
160009
160050
  try {
160010
160051
  var _this$fetchFunctions$, _this$fetchFunctions$2;
160011
160052
 
@@ -161792,6 +161833,13 @@ class SugarNodeBase {
161792
161833
  return this.sourceXmlNode.getChildren();
161793
161834
  }
161794
161835
 
161836
+ *getParentsRecursive() {
161837
+ if (this.parent != undefined) {
161838
+ yield this.parent;
161839
+ yield* this.parent.getParentsRecursive();
161840
+ }
161841
+ }
161842
+
161795
161843
  }
161796
161844
  class UnknownSugarNode extends SugarNodeBase {
161797
161845
  constructor(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.278.0-efs-partial-load.7",
3
+ "version": "4.278.0-efs-partial-load.9",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,