@kontur.candy/generator 5.37.0-fix-fs-7820.3 → 5.37.0

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 -110
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59828,11 +59828,6 @@ class ModelPathImpl {
59828
59828
  }
59829
59829
  return _PathMatcher__WEBPACK_IMPORTED_MODULE_4__.PathMatcher.match(this.tokens, modelPath.getPathPartsAsArray());
59830
59830
  }
59831
- startsWith(modelPath) {
59832
- const thisParts = this.getPathPartsAsArray();
59833
- const otherParts = modelPath.getPathPartsAsArray();
59834
- return otherParts.every((value, index) => value === thisParts[index]);
59835
- }
59836
59831
  *splitByMultiplicity() {
59837
59832
  let lastSimpleParts = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(this.isAbsolute());
59838
59833
  for (const token of this.tokens) {
@@ -78621,12 +78616,12 @@ class DataDeclarationGenerationContext {
78621
78616
  [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node)]: declEntry
78622
78617
  };
78623
78618
  }
78624
- addPathSectionDeclarationEntry(sugarNode, requisite, skipRequisitesSection = false, suffix) {
78619
+ addPathSectionDeclarationEntry(sugarNode, requisite, skipRequisitesSection = false) {
78625
78620
  const declEntry = {};
78626
78621
  const requisitesMode = skipRequisitesSection ? RequisiteSectionMode.ForceSkip : RequisiteSectionMode.AsRequisiteAttribute;
78627
78622
  declEntry.section = this.getSections(sugarNode, requisite, requisitesMode);
78628
78623
  return {
78629
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode, suffix)]: declEntry
78624
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
78630
78625
  };
78631
78626
  }
78632
78627
  addChildPathSectionDeclarationEntry(sugarNode, childPath, requisite) {
@@ -84396,56 +84391,28 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
84396
84391
  buildRulesInternal() {
84397
84392
  const allOptionalSections = this.dataDeclarationHelper.getOptionalSections();
84398
84393
  const section2PathsMap = this.dataDeclarationHelper.getAllPathsBySection();
84399
- const childrenSectionsByParent = this.getChildrenSectionsByParent();
84400
84394
  const allRules = allOptionalSections.map(x => {
84401
- const allDependentSectionIds = this.getDependentSingleSections(x.id, childrenSectionsByParent).map(sectionInfo => sectionInfo.sectionId);
84395
+ var _section2PathsMap$get, _section2PathsMap$get2;
84396
+ const sectionId = x.id;
84402
84397
  const targetPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(x.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
84403
- const pathsBySection = [x.id, ...allDependentSectionIds].flatMap(sectionId => {
84404
- var _section2PathsMap$get, _section2PathsMap$get2;
84405
- return [...((_section2PathsMap$get = (_section2PathsMap$get2 = section2PathsMap.get(sectionId)) === null || _section2PathsMap$get2 === void 0 ? void 0 : _section2PathsMap$get2.values()) !== null && _section2PathsMap$get !== void 0 ? _section2PathsMap$get : [])];
84406
- });
84398
+ const pathsBySection = (_section2PathsMap$get = (_section2PathsMap$get2 = section2PathsMap.get(sectionId)) === null || _section2PathsMap$get2 === void 0 ? void 0 : _section2PathsMap$get2.values()) !== null && _section2PathsMap$get !== void 0 ? _section2PathsMap$get : [];
84407
84399
  return this.buildOptionalSectionIsFilledCheckRule(targetPath, pathsBySection);
84408
84400
  }).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined);
84409
84401
  return allRules;
84410
84402
  }
84411
- getDependentSingleSections(sourceSection, childrenSectionsByParent) {
84412
- var _childrenSectionsByPa;
84413
- const childrenSections = ((_childrenSectionsByPa = childrenSectionsByParent.get(sourceSection)) !== null && _childrenSectionsByPa !== void 0 ? _childrenSectionsByPa : []).filter(x => !x.optional && !x.multiple);
84414
- const nestedSections = childrenSections.flatMap(x => this.getDependentSingleSections(x.sectionId, childrenSectionsByParent));
84415
- return childrenSections.concat(...nestedSections);
84416
- }
84417
- getChildrenSectionsByParent() {
84418
- return Iterator.from(this.getAllSections()).reduce((result, current) => {
84419
- var _result$get;
84420
- const data = (_result$get = result.get(current.parentSectionId)) !== null && _result$get !== void 0 ? _result$get : [];
84421
- result.set(current.parentSectionId, data.concat(current));
84422
- return result;
84423
- }, new Map());
84424
- }
84425
84403
  *getAllSections() {
84426
- const pagesToProcess = this.sugarRoot.pages.map(x => ({
84427
- page: x,
84428
- parentId: undefined
84429
- }));
84404
+ const pagesToProcess = [...this.sugarRoot.pages];
84430
84405
  while ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.arrayIsNotEmpty)(pagesToProcess)) {
84431
- const info = pagesToProcess.pop();
84432
- if (info != null && (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined)(info.page.path)) {
84406
+ const page = pagesToProcess.pop();
84407
+ if (page != null && (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined)(page.path)) {
84433
84408
  var _page$optional, _page$multiple;
84434
- const {
84435
- page,
84436
- parentId
84437
- } = info;
84438
84409
  yield {
84439
84410
  sectionId: page.id,
84440
84411
  path: page.getFullPath(),
84441
84412
  optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false,
84442
- multiple: (_page$multiple = page.multiple) !== null && _page$multiple !== void 0 ? _page$multiple : false,
84443
- parentSectionId: parentId
84413
+ multiple: (_page$multiple = page.multiple) !== null && _page$multiple !== void 0 ? _page$multiple : false
84444
84414
  };
84445
- pagesToProcess.push(...page.pages.map(x => ({
84446
- page: x,
84447
- parentId: page.id
84448
- })));
84415
+ pagesToProcess.push(...page.pages);
84449
84416
  }
84450
84417
  }
84451
84418
  }
@@ -84468,9 +84435,8 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
84468
84435
  }
84469
84436
  buildOptionalSectionIsFilledCheckRule(targetPath, pathsBySection) {
84470
84437
  const createDecimalCondExpr = checkExpt => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(checkExpt, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DecimalLiteralExpression(1), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DecimalLiteralExpression(0));
84471
- const targetValueRefBase = targetPath.joinWith(OptionalSectionRulesBuilder.optionalSectionFilledFieldName);
84472
- const targetValueRef = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression(targetValueRefBase, "value");
84473
- const pathInfos = Iterator.from(pathsBySection).filter(path => !path.isEquals(targetValueRefBase)).map(path => {
84438
+ const targetValueRef = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression(targetPath.joinWith(OptionalSectionRulesBuilder.optionalSectionFilledFieldName), "value");
84439
+ const pathInfos = Iterator.from(pathsBySection).map(path => {
84474
84440
  const splitInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_2__.getMatchedAndDifferentModelPaths)(targetPath, path);
84475
84441
  const iterationEntries = (0,_Common_ModelPath_BuildIterationSequence__WEBPACK_IMPORTED_MODULE_3__.buildIterationSequence)(splitInfo.differentPath);
84476
84442
  return {
@@ -84493,7 +84459,7 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
84493
84459
  return pathCheckWithReduceIfRequiredExpr;
84494
84460
  });
84495
84461
  const allChecksExpressions = pathTestRules.reduce((acc, current) => acc == undefined ? current : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.OrBinaryExpression(acc, current), undefined);
84496
- return allChecksExpressions != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement(targetValueRef, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(allChecksExpressions, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression("1"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression())) : undefined;
84462
+ return allChecksExpressions != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement(targetValueRef, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(allChecksExpressions, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression("1"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression("0"))) : undefined;
84497
84463
  }
84498
84464
  }
84499
84465
  OptionalSectionRulesBuilder.optionalSectionFilledFieldName = "isFilledOptional";
@@ -89747,21 +89713,17 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89747
89713
  const rootPath = (0,_getRootPath__WEBPACK_IMPORTED_MODULE_3__.getRootPath)(node);
89748
89714
  const entrySections = ["default"];
89749
89715
  const optionalSections = this.findOptionalSections(node);
89750
- const allSections = this.findAllSingleSections(node);
89751
89716
  if (node.requisite) {
89752
89717
  entrySections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_12__.SectionNames.requisitesSection);
89753
89718
  }
89754
- const result = {
89719
+ return {
89755
89720
  [rootPath]: optionalSections.length > 0 ? {
89756
89721
  section: entrySections,
89757
- allSingleSections: allSections,
89758
89722
  optionalSections: optionalSections
89759
89723
  } : {
89760
- section: entrySections,
89761
- allSingleSections: allSections
89724
+ section: entrySections
89762
89725
  }
89763
89726
  };
89764
- return result;
89765
89727
  }
89766
89728
  buildChildrenDataDeclaration(context) {
89767
89729
  const node = this.getCurrentNodeAs(_FormNode__WEBPACK_IMPORTED_MODULE_21__.FormNode);
@@ -89785,41 +89747,18 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89785
89747
  }
89786
89748
  }
89787
89749
  findOptionalSections(node) {
89788
- const pages = this.findAllSingleSections(node).filter(page => page.optional);
89789
- return pages;
89790
- }
89791
- findNearestOptionalSection(sectionId, allSinglePagesWithParent) {
89792
- const pageInfo = allSinglePagesWithParent.get(sectionId);
89793
- if (pageInfo == undefined || pageInfo.page.optional || pageInfo.parentPage == undefined || pageInfo.parentPage.multiple) {
89794
- return undefined;
89795
- }
89796
- if (pageInfo.parentPage.optional) {
89797
- return pageInfo.parentPage.id;
89798
- }
89799
- return this.findNearestOptionalSection(pageInfo.parentPage.id, allSinglePagesWithParent);
89800
- }
89801
- findAllSingleSections(node) {
89802
- const allSinglePagesWithParent = new Map(this.getAllPages(node.pages).filter(x => !x.page.multiple).map(x => [x.page.id, x]));
89803
- const pages = Iterator.from(allSinglePagesWithParent.values()).map(x => x.page).map(page => {
89750
+ const optionalPages = this.getAllPages(node.pages).filter(page => {
89804
89751
  var _page$optional;
89805
- return {
89806
- id: page.id,
89807
- path: page.getFullPath().toLegacyPath(),
89808
- optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false,
89809
- dependsOnSection: this.findNearestOptionalSection(page.id, allSinglePagesWithParent)
89810
- };
89811
- }).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id)).toArray();
89812
- return pages;
89752
+ return ((_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false) && !page.multiple;
89753
+ }).map(page => ({
89754
+ id: page.id,
89755
+ path: page.getFullPath().toLegacyPath()
89756
+ })).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id));
89757
+ return optionalPages;
89813
89758
  }
89814
- getAllPages(pages, parentPage) {
89815
- const allPages = pages.flatMap(page => this.getAllPages(page.pages, page)).map(x => ({
89816
- page: x.page,
89817
- parentPage: x.parentPage
89818
- }));
89819
- return pages.map(page => ({
89820
- page: page,
89821
- parentPage: parentPage
89822
- })).concat(...allPages);
89759
+ getAllPages(pages) {
89760
+ const allPages = pages.flatMap(page => this.getAllPages(page.pages));
89761
+ return pages.concat(allPages);
89823
89762
  }
89824
89763
  buildBaseFormWithContent(context, formContent, formNode) {
89825
89764
  const pageNodes = this.getFormPages(formNode);
@@ -90770,9 +90709,7 @@ __webpack_require__.r(__webpack_exports__);
90770
90709
  /* harmony import */ var _Helpers_Normativehelp_NormativeHelpNode__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Helpers/Normativehelp/NormativeHelpNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/Helpers/Normativehelp/NormativeHelpNode.ts");
90771
90710
  /* harmony import */ var _Banner_BannerNode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Banner/BannerNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Banner/BannerNode.ts");
90772
90711
  /* harmony import */ var _ControlFlow_If_IfNode__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../ControlFlow/If/IfNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ControlFlow/If/IfNode.ts");
90773
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
90774
- /* harmony import */ var _PageNode__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
90775
-
90712
+ /* harmony import */ var _PageNode__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
90776
90713
 
90777
90714
 
90778
90715
 
@@ -90790,13 +90727,13 @@ __webpack_require__.r(__webpack_exports__);
90790
90727
 
90791
90728
  class PageConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4__.SugarNodeConverterBase {
90792
90729
  static getAcceptNodeClass() {
90793
- return _PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode;
90730
+ return _PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode;
90794
90731
  }
90795
90732
  applyVisibilityPathProcessing() {
90796
90733
  return false;
90797
90734
  }
90798
90735
  *doBuildNormalizeRules(builder, formSchemaRng) {
90799
- const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode);
90736
+ const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
90800
90737
  const element = formSchemaRng.getElementByPath(node.getFullPath());
90801
90738
  if (node.path == undefined) {
90802
90739
  return;
@@ -90810,8 +90747,7 @@ class PageConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4__.Sug
90810
90747
  }
90811
90748
  }
90812
90749
  doBuildDataDeclaration(context) {
90813
- var _node$optional, _node$multiple;
90814
- const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode);
90750
+ const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
90815
90751
  if (node.path == undefined) {
90816
90752
  return {};
90817
90753
  }
@@ -90824,30 +90760,20 @@ class PageConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4__.Sug
90824
90760
  result.optional = [true];
90825
90761
  }
90826
90762
  }
90827
- const optionalFieldPath = node.getFullPath().joinWith(PageConverter.optionalSectionFilledFieldName).toLegacyPath();
90828
- const optionalFieldRequired = ((_node$optional = node.optional) !== null && _node$optional !== void 0 ? _node$optional : false) && !((_node$multiple = node.multiple) !== null && _node$multiple !== void 0 ? _node$multiple : false);
90829
90763
  return context.mergeDataDeclaration({
90830
90764
  [this.getResolvedBindingPath(node)]: result
90831
- }, context.addPathSectionDeclarationEntry(node), optionalFieldRequired ? {
90832
- [optionalFieldPath]: {
90833
- value: context.initSequenceFactory.dataValue({
90834
- defaultValue: "1",
90835
- fetchfn: undefined,
90836
- settings: undefined
90837
- }, false, "1")
90838
- }
90839
- } : undefined, optionalFieldRequired ? context.addPathSectionDeclarationEntry(node, false, false, (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_14__.createRelativeFromTokens)([PageConverter.optionalSectionFilledFieldName])) : undefined);
90765
+ }, context.addPathSectionDeclarationEntry(node));
90840
90766
  }
90841
90767
  buildChildrenDataDeclaration(context) {
90842
- const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode);
90768
+ const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
90843
90769
  return context.processChildrenDataDeclaration(node.children);
90844
90770
  }
90845
90771
  *doTraverseChildren() {
90846
- const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode);
90772
+ const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
90847
90773
  yield* node.children;
90848
90774
  }
90849
90775
  doConvert(context) {
90850
- const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_15__.PageNode);
90776
+ const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
90851
90777
  if (node.multiple) {
90852
90778
  this.ensurePathExists(node, node.path);
90853
90779
  }
@@ -90911,7 +90837,6 @@ class PageConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4__.Sug
90911
90837
  return pageBuilder.buildConverterResult();
90912
90838
  }
90913
90839
  }
90914
- PageConverter.optionalSectionFilledFieldName = "isFilledOptional";
90915
90840
 
90916
90841
  /***/ }),
90917
90842
 
@@ -111727,8 +111652,8 @@ function getBindingPathExpression(node, customPath) {
111727
111652
  }
111728
111653
  return node.getFullPath().toLegacyPath();
111729
111654
  }
111730
- function getResolvedBindingPath(node, suffix) {
111731
- return node.getFullPath().joinWith(suffix != undefined ? suffix : (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.emptyModelPath)()).toLegacyPath();
111655
+ function getResolvedBindingPath(node) {
111656
+ return node.getFullPath().toLegacyPath();
111732
111657
  }
111733
111658
  function getBindingPathWithSuffix(node, customPath) {
111734
111659
  return node.getFullPath().joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createFromMask)(customPath, "auto", _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each)).normalize().toLegacyPath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.37.0-fix-fs-7820.3",
3
+ "version": "5.37.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,