@kontur.candy/generator 5.35.0 → 5.35.1-fs-7820-fix-nested-optional-page-normalization.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.
Files changed (2) hide show
  1. package/dist/index.js +21 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59828,6 +59828,11 @@ 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
+ }
59831
59836
  *splitByMultiplicity() {
59832
59837
  let lastSimpleParts = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(this.isAbsolute());
59833
59838
  for (const token of this.tokens) {
@@ -89155,15 +89160,18 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89155
89160
  const rootPath = (0,_getRootPath__WEBPACK_IMPORTED_MODULE_3__.getRootPath)(node);
89156
89161
  const entrySections = ["default"];
89157
89162
  const optionalSections = this.findOptionalSections(node);
89163
+ const allSections = this.findAllSections(node);
89158
89164
  if (node.requisite) {
89159
89165
  entrySections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_12__.SectionNames.requisitesSection);
89160
89166
  }
89161
89167
  return {
89162
89168
  [rootPath]: optionalSections.length > 0 ? {
89163
89169
  section: entrySections,
89170
+ allSections: allSections,
89164
89171
  optionalSections: optionalSections
89165
89172
  } : {
89166
- section: entrySections
89173
+ section: entrySections,
89174
+ allSections: allSections
89167
89175
  }
89168
89176
  };
89169
89177
  }
@@ -89189,14 +89197,19 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89189
89197
  }
89190
89198
  }
89191
89199
  findOptionalSections(node) {
89192
- const optionalPages = this.getAllPages(node.pages).filter(page => {
89200
+ const pages = this.findAllSections(node).filter(page => page.optional);
89201
+ return pages;
89202
+ }
89203
+ findAllSections(node) {
89204
+ const pages = this.getAllPages(node.pages).filter(page => !page.multiple).map(page => {
89193
89205
  var _page$optional;
89194
- return ((_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false) && !page.multiple;
89195
- }).map(page => ({
89196
- id: page.id,
89197
- path: page.getFullPath().toLegacyPath()
89198
- })).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id));
89199
- return optionalPages;
89206
+ return {
89207
+ id: page.id,
89208
+ path: page.getFullPath().toLegacyPath(),
89209
+ optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false
89210
+ };
89211
+ }).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id));
89212
+ return pages;
89200
89213
  }
89201
89214
  getAllPages(pages) {
89202
89215
  const allPages = pages.flatMap(page => this.getAllPages(page.pages));
@@ -96025,7 +96038,6 @@ class CrossfitTableConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODUL
96025
96038
  }
96026
96039
  rowMenuBuilder.prop(x => x.doNotCopyPaths).set(doNotCopyPaths);
96027
96040
  rowMenuBuilder.prop(x => x.bindingPath).set(multilinePath);
96028
- rowMenuBuilder.prop(x => x.optional).set(optional);
96029
96041
  sideControlsBuilder.appendChild(rowMenuBuilder);
96030
96042
  } else if (removeButton) {
96031
96043
  const removeButtonBuilder = (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_2__.componentMarkupBuilder)("RemoveRowButton");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.35.0",
3
+ "version": "5.35.1-fs-7820-fix-nested-optional-page-normalization.1",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,