@kontur.candy/generator 4.278.0-efs-partial-load.8 → 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 +35 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -131317,7 +131317,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
131317
131317
  const lazyLoadingRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_LazyLoadingRulesBuilder__WEBPACK_IMPORTED_MODULE_37__.LazyLoadingRulesBuilder(sugarRoot, lazyLoadGeneratorResult.declaration);
131318
131318
  const sugarRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_SugarRulesBuilder__WEBPACK_IMPORTED_MODULE_38__.SugarRulesBuilder(sugarRoot, formSchemaRng, controlCustomizationContext, fetchFunctions);
131319
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);
131320
- 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);
131321
131321
  const normalizationRulesGenerator = new _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder);
131322
131322
  const formulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter);
131323
131323
  const formulaAndInitOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaAndInitOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_40__.FormulaAndInitOnlyNormalizationRuleGenerator(sugarRulesBuilder, formulaRulesBuilder, optionalSectionRuleBuilder);
@@ -131943,7 +131943,7 @@ class FLangValidationBuildContext {
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();
@@ -131994,12 +131994,6 @@ class FLangValidationBuildContext {
131994
131994
 
131995
131995
 
131996
131996
  console.warn(`Could not process kclang to flang: [${condition}]`);
131997
-
131998
- if (e instanceof Error) {
131999
- // eslint-disable-next-line no-console
132000
- console.warn(e === null || e === void 0 ? void 0 : e.toString());
132001
- }
132002
-
132003
131997
  return undefined;
132004
131998
  }
132005
131999
  }
@@ -134188,8 +134182,10 @@ __webpack_require__.r(__webpack_exports__);
134188
134182
 
134189
134183
 
134190
134184
  class OptionalSectionRulesBuilder {
134191
- constructor(dataDeclarationHelper) {
134185
+ constructor(sugarRoot, dataDeclarationHelper) {
134186
+ this.sugarRoot = void 0;
134192
134187
  this.dataDeclarationHelper = void 0;
134188
+ this.sugarRoot = sugarRoot;
134193
134189
  this.dataDeclarationHelper = dataDeclarationHelper;
134194
134190
  }
134195
134191
 
@@ -134207,20 +134203,36 @@ class OptionalSectionRulesBuilder {
134207
134203
  return allRules;
134208
134204
  }
134209
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
+
134210
134225
  wrapRulesWithOptionalPageCheck(rules) {
134211
- const allOptionalSections = (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.reverseArray)(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_5__.IterUtils.sortBy(this.dataDeclarationHelper.getOptionalSections().map(x => ({
134212
- path: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(x.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each),
134213
- sectionId: x.id
134214
- })), 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();
134215
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);
134216
134228
  return wrappedRules;
134217
134229
  }
134218
134230
 
134219
- wrapSetStatementWithOptionalPageCheckIfNeeded(rule, orderedOptionalSections) {
134231
+ wrapSetStatementWithOptionalPageCheckIfNeeded(rule, orderedSections) {
134220
134232
  const targetPath = rule.left.modePath;
134221
- 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()));
134222
134234
 
134223
- if (targetOptionalSection != undefined) {
134235
+ if (targetOptionalSection != undefined && targetOptionalSection.optional) {
134224
134236
  const targetIsFilledPath = targetOptionalSection.path.joinWith(OptionalSectionRulesBuilder.optionalSectionFilledFieldName);
134225
134237
 
134226
134238
  if (!targetIsFilledPath.isEquals(targetPath)) {
@@ -161821,6 +161833,13 @@ class SugarNodeBase {
161821
161833
  return this.sourceXmlNode.getChildren();
161822
161834
  }
161823
161835
 
161836
+ *getParentsRecursive() {
161837
+ if (this.parent != undefined) {
161838
+ yield this.parent;
161839
+ yield* this.parent.getParentsRecursive();
161840
+ }
161841
+ }
161842
+
161824
161843
  }
161825
161844
  class UnknownSugarNode extends SugarNodeBase {
161826
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.8",
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,