@kontur.candy/generator 4.268.0 → 4.269.0-normalization-sum-fix.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 +98 -55
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -121911,6 +121911,10 @@ class FormSchemaRngAttribute {
121911
121911
  return this.optional || this.nillable || false;
121912
121912
  }
121913
121913
 
121914
+ isOptional() {
121915
+ return this.optional;
121916
+ }
121917
+
121914
121918
  }
121915
121919
  const RootParent = Symbol.for("__ROOT_ELEMENT_PARENT__");
121916
121920
  class FormSchemaRngElement {
@@ -121967,6 +121971,10 @@ class FormSchemaRngElement {
121967
121971
  return this.optional || this.nillable || this.innerTextOptional || false;
121968
121972
  }
121969
121973
 
121974
+ isOptional() {
121975
+ return this.optional;
121976
+ }
121977
+
121970
121978
  getChildren() {
121971
121979
  return this.children;
121972
121980
  }
@@ -132083,7 +132091,7 @@ class NormalizationRulesGenerator {
132083
132091
  buildSugarFLangRules() {
132084
132092
  const converter = new _markupGenerator_ElementProcessors_FormParts_Form_FormConverter__WEBPACK_IMPORTED_MODULE_2__.FormConverter(this.sugarRoot);
132085
132093
  const builder = new _markupGenerator_FLangNormalizationRulesBuilder__WEBPACK_IMPORTED_MODULE_8__.FLangNormalizationRulesBuilder(this.controlCustomizationContext);
132086
- return converter.buildNormalizeRules(builder);
132094
+ return converter.buildNormalizeRules(builder, this.formSchemaRng);
132087
132095
  }
132088
132096
 
132089
132097
  *buildFormulaFLangRules() {
@@ -132271,15 +132279,35 @@ class NormalizationRulesGenerator {
132271
132279
  }
132272
132280
 
132273
132281
  compileSumExpression(expression, prefix, target, addPrecalculationRule) {
132274
- const result = expression.arguments.reduce((acc, curr) => {
132275
- const currExpr = this.castOperandToDecimalIfNeed(this.compileExpressionToFlashExpression(curr, prefix, target, addPrecalculationRule));
132282
+ const args = this.getFlatArgumentExpressions(expression.arguments);
132283
+ const conditionExpression = args.reduce((acc, curr) => {
132284
+ const currExpr = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NotEqExpression(this.compileExpressionToFlashExpression(curr, prefix, target, addPrecalculationRule), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NullLiteralExpression());
132285
+ return acc != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.OrBinaryExpression(acc, currExpr) : currExpr;
132286
+ }, undefined);
132287
+
132288
+ if (conditionExpression == undefined) {
132289
+ const result = expression.arguments.reduce((acc, curr) => {
132290
+ const currExpr = this.castOperandToDecimalIfNeed(this.compileExpressionToFlashExpression(curr, prefix, target, addPrecalculationRule));
132291
+ return acc != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(acc, currExpr) : currExpr;
132292
+ }, undefined);
132293
+
132294
+ if (result == undefined) {
132295
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_7__.InvalidProgramStateError();
132296
+ }
132297
+
132298
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(result, "string");
132299
+ }
132300
+
132301
+ const trueResultExpression = expression.arguments.reduce((acc, curr) => {
132302
+ const currExpr = this.castOperandToDecimalIfNeed(this.compileExpressionToFlashExpression(curr, prefix, target, addPrecalculationRule), 0);
132276
132303
  return acc != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(acc, currExpr) : currExpr;
132277
132304
  }, undefined);
132278
132305
 
132279
- if (result == undefined) {
132306
+ if (trueResultExpression == undefined) {
132280
132307
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_7__.InvalidProgramStateError();
132281
132308
  }
132282
132309
 
132310
+ const result = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ConditionalExpression(conditionExpression, trueResultExpression, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NullLiteralExpression());
132283
132311
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(result, "string");
132284
132312
  }
132285
132313
 
@@ -132349,12 +132377,26 @@ class NormalizationRulesGenerator {
132349
132377
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(result, "string");
132350
132378
  }
132351
132379
 
132380
+ getFlatArgumentExpressions(expressions) {
132381
+ return expressions.reduce((acc, curr) => {
132382
+ if (curr instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_3__.FormulaArgumentExpression) {
132383
+ return acc.concat(curr);
132384
+ }
132385
+
132386
+ if (curr instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_3__.FormulaSumExpression || curr instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_3__.FormulaDivisionExpression || curr instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_3__.FormulaMultiplyExpression) {
132387
+ return acc.concat(this.getFlatArgumentExpressions(curr.arguments));
132388
+ }
132389
+
132390
+ return acc;
132391
+ }, []);
132392
+ }
132393
+
132352
132394
  castOperandToStringIfNeed(operandExpression) {
132353
132395
  return operandExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression || operandExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression && operandExpression.getTargetType() == "string" ? operandExpression : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(operandExpression, "string");
132354
132396
  }
132355
132397
 
132356
- castOperandToDecimalIfNeed(operandExpression) {
132357
- return operandExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression ? operandExpression : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(operandExpression, "decimal");
132398
+ castOperandToDecimalIfNeed(operandExpression, defaultValue) {
132399
+ return operandExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression ? operandExpression : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(operandExpression, "decimal", defaultValue != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(defaultValue) : undefined);
132358
132400
  }
132359
132401
 
132360
132402
  *buildSugarValidationRules() {
@@ -137741,19 +137783,18 @@ class PageConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4__.Sug
137741
137783
  return false;
137742
137784
  }
137743
137785
 
137744
- *doBuildNormalizeRules(builder) {
137786
+ *doBuildNormalizeRules(builder, formSchemaRng) {
137745
137787
  const node = this.getCurrentNodeAs(_PageNode__WEBPACK_IMPORTED_MODULE_14__.PageNode);
137788
+ const element = formSchemaRng.getElementByPath(node.getFullPath());
137746
137789
 
137747
137790
  if (node.path == undefined) {
137748
137791
  return;
137749
137792
  }
137750
137793
 
137751
137794
  if (node.multiple) {
137752
- var _node$optional;
137753
-
137754
- yield* builder.childrenInitializer(node, (_node$optional = node.optional) !== null && _node$optional !== void 0 ? _node$optional : false);
137795
+ const isOptional = node.optional || (element === null || element === void 0 ? void 0 : element.isOptional());
137796
+ yield* builder.childrenInitializer(node, isOptional !== null && isOptional !== void 0 ? isOptional : false);
137755
137797
  yield* builder.specialFieldsInitializer(node, {
137756
- optional: node.optional,
137757
137798
  disabled: undefined
137758
137799
  });
137759
137800
  }
@@ -143728,7 +143769,6 @@ class CrossfitTableConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODUL
143728
143769
 
143729
143770
  yield* builder.childrenInitializer(rowNode, (_rowNode$optional = rowNode.optional) !== null && _rowNode$optional !== void 0 ? _rowNode$optional : false, rowNode.defaultChildren);
143730
143771
  yield* builder.specialFieldsInitializer(rowNode, {
143731
- optional: rowNode.optional,
143732
143772
  disabled: undefined
143733
143773
  });
143734
143774
  }
@@ -147045,6 +147085,20 @@ class StickyTableWithMultilineConverter extends _SugarNodeConverter__WEBPACK_IMP
147045
147085
  return _StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.StickyTableNode;
147046
147086
  }
147047
147087
 
147088
+ *doBuildNormalizeRules(builder, formSchemaRng) {
147089
+ const node = this.getCurrentNodeAs(_StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.StickyTableNode);
147090
+
147091
+ for (const row of node.rows) {
147092
+ if (row instanceof _StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.StickyTableMultilineNode) {
147093
+ var _ref;
147094
+
147095
+ const element = formSchemaRng.getElementByPath(row.getFullPath());
147096
+ const isOptional = (_ref = row.optional || (element === null || element === void 0 ? void 0 : element.isOptional())) !== null && _ref !== void 0 ? _ref : false;
147097
+ yield* builder.childrenInitializer(row, isOptional);
147098
+ }
147099
+ }
147100
+ }
147101
+
147048
147102
  *doTraverseChildren() {
147049
147103
  const node = this.getCurrentNodeAs(_StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.StickyTableNode);
147050
147104
 
@@ -147152,9 +147206,9 @@ class StickyTableWithMultilineConverter extends _SugarNodeConverter__WEBPACK_IMP
147152
147206
 
147153
147207
  processMultilineNode(context, rowNode) {
147154
147208
  if (rowNode instanceof _StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.StickyTableMultilineNode) {
147155
- var _ref, _rowNode$optional;
147209
+ var _ref2, _rowNode$optional;
147156
147210
 
147157
- return context.mergeDataDeclaration(context.addPathDeclEntry(rowNode, [["children", context.initSequenceFactory.children((_ref = (_rowNode$optional = rowNode.optional) !== null && _rowNode$optional !== void 0 ? _rowNode$optional : context.isMultipleNodeOptionalFromScheme(rowNode.getFullPath())) !== null && _ref !== void 0 ? _ref : false, rowNode.defaultChildren)]]), rowNode.maxOccurs != undefined && /^\d+$/.test(rowNode.maxOccurs) && context.maxOccurs(rowNode.getFullPath(), rowNode.maxOccurs), context.addSpecialFieldsEntry(rowNode, {
147211
+ return context.mergeDataDeclaration(context.addPathDeclEntry(rowNode, [["children", context.initSequenceFactory.children((_ref2 = (_rowNode$optional = rowNode.optional) !== null && _rowNode$optional !== void 0 ? _rowNode$optional : context.isMultipleNodeOptionalFromScheme(rowNode.getFullPath())) !== null && _ref2 !== void 0 ? _ref2 : false, rowNode.defaultChildren)]]), rowNode.maxOccurs != undefined && /^\d+$/.test(rowNode.maxOccurs) && context.maxOccurs(rowNode.getFullPath(), rowNode.maxOccurs), context.addSpecialFieldsEntry(rowNode, {
147158
147212
  optional: rowNode.optional
147159
147213
  }), context.addPathSectionDeclarationEntry(rowNode), context.addVisibilityPathDeclEntryNew(rowNode), context.processChildrenDataDeclaration(rowNode.rows, rowNode2 => this.processMultilineRowNode(context, rowNode2)));
147160
147214
  }
@@ -147227,11 +147281,11 @@ class StickyTableWithMultilineConverter extends _SugarNodeConverter__WEBPACK_IMP
147227
147281
  const sideSize = (_node$side2 = node.side) !== null && _node$side2 !== void 0 ? _node$side2 : 0;
147228
147282
 
147229
147283
  if (this.isSimpleForm()) {
147230
- var _ref2, _node$deprecatedDiado;
147284
+ var _ref3, _node$deprecatedDiado;
147231
147285
 
147232
147286
  mb.prop(x => x.maxWidth).set(orientation === "landscape" ? maxWidth : undefined);
147233
147287
  mb.prop(x => x.sideSize).set(this.hasActionButton(node) && sideSize !== 0 ? sideSize + 1 : sideSize);
147234
- const width = (_ref2 = (_node$deprecatedDiado = node.deprecatedDiadocWidth) !== null && _node$deprecatedDiado !== void 0 ? _node$deprecatedDiado : node.width) !== null && _ref2 !== void 0 ? _ref2 : maxWidthSimpleForm;
147288
+ const width = (_ref3 = (_node$deprecatedDiado = node.deprecatedDiadocWidth) !== null && _node$deprecatedDiado !== void 0 ? _node$deprecatedDiado : node.width) !== null && _ref3 !== void 0 ? _ref3 : maxWidthSimpleForm;
147235
147289
  mb.prop(x => x.width).set(width);
147236
147290
  mb.prop(x => x.footerHeight).set(160);
147237
147291
  } else {
@@ -147520,10 +147574,10 @@ BindingPath: ${errorPath}`));
147520
147574
  if (this.isSimpleForm()) {
147521
147575
  mb.prop(x => x.buttonType).set(undefined);
147522
147576
  } else {
147523
- var _multiline$rowmenu, _ref3, _tableNode$removeButt;
147577
+ var _multiline$rowmenu, _ref4, _tableNode$removeButt;
147524
147578
 
147525
147579
  const rowMenu = (_multiline$rowmenu = multiline.rowmenu) !== null && _multiline$rowmenu !== void 0 ? _multiline$rowmenu : false;
147526
- const removebutton = (_ref3 = (_tableNode$removeButt = tableNode.removeButton) !== null && _tableNode$removeButt !== void 0 ? _tableNode$removeButt : multiline.removebutton) !== null && _ref3 !== void 0 ? _ref3 : true;
147580
+ const removebutton = (_ref4 = (_tableNode$removeButt = tableNode.removeButton) !== null && _tableNode$removeButt !== void 0 ? _tableNode$removeButt : multiline.removebutton) !== null && _ref4 !== void 0 ? _ref4 : true;
147527
147581
  mb.prop(x => x.buttonType).set(rowMenu ? "RowMenu" : removebutton ? "RemoveRowButton" : undefined);
147528
147582
  }
147529
147583
 
@@ -147546,7 +147600,7 @@ BindingPath: ${errorPath}`));
147546
147600
  }
147547
147601
 
147548
147602
  getMultiline(context, node, multiline, start, end = Infinity) {
147549
- var _ref4, _node$removeButton, _multiline$rowmenu2, _ref5, _node$removeButton2, _context$popPathsCont2;
147603
+ var _ref5, _node$removeButton, _multiline$rowmenu2, _ref6, _node$removeButton2, _context$popPathsCont2;
147550
147604
 
147551
147605
  const overrideInfo = multiline.override ? context.controlCustomizationContext.getControlCustomizationInfo("multiline", multiline.override) : undefined;
147552
147606
  const mb = overrideInfo == undefined ? (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_5__.componentMarkupBuilder)("MultiLine") : (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_5__.componentMarkupBuilder)(overrideInfo.dependencies, overrideInfo.controlName);
@@ -147560,7 +147614,7 @@ BindingPath: ${errorPath}`));
147560
147614
  mb.prop(x => x.bindingPath).set((0,_getBindingPath__WEBPACK_IMPORTED_MODULE_13__.getNewBindingPathExpression)(multiline));
147561
147615
  mb.prop(x => x.showRowBorder).set(multiline.showRowBorder);
147562
147616
  mb.prop(x => x.onRowCLick).set(context.generateHelperFunctionExpression(multiline, "onRowClick", multiline.onRowClick));
147563
- const hasRemoveButton = ((_ref4 = (_node$removeButton = node.removeButton) !== null && _node$removeButton !== void 0 ? _node$removeButton : multiline.removebutton) !== null && _ref4 !== void 0 ? _ref4 : true) || ((_multiline$rowmenu2 = multiline.rowmenu) !== null && _multiline$rowmenu2 !== void 0 ? _multiline$rowmenu2 : false);
147617
+ const hasRemoveButton = ((_ref5 = (_node$removeButton = node.removeButton) !== null && _node$removeButton !== void 0 ? _node$removeButton : multiline.removebutton) !== null && _ref5 !== void 0 ? _ref5 : true) || ((_multiline$rowmenu2 = multiline.rowmenu) !== null && _multiline$rowmenu2 !== void 0 ? _multiline$rowmenu2 : false);
147564
147618
  const needAddButton = multiline.addbutton !== "false";
147565
147619
 
147566
147620
  if (this.isSimpleForm()) {
@@ -147573,7 +147627,7 @@ BindingPath: ${errorPath}`));
147573
147627
  mb.prop(x => x.removeButtonPosition).set(undefined);
147574
147628
  }
147575
147629
 
147576
- mb.prop(x => x.disableScroll).set(needAddButton || ((_ref5 = (_node$removeButton2 = node.removeButton) !== null && _node$removeButton2 !== void 0 ? _node$removeButton2 : multiline.removebutton) !== null && _ref5 !== void 0 ? _ref5 : true) ? undefined : true);
147630
+ mb.prop(x => x.disableScroll).set(needAddButton || ((_ref6 = (_node$removeButton2 = node.removeButton) !== null && _node$removeButton2 !== void 0 ? _node$removeButton2 : multiline.removebutton) !== null && _ref6 !== void 0 ? _ref6 : true) ? undefined : true);
147577
147631
  context.pushPathsContext();
147578
147632
 
147579
147633
  if ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.arrayHasLength)(multiline.rows, 1)) {
@@ -147599,9 +147653,9 @@ BindingPath: ${errorPath}`));
147599
147653
  hasActionButton(node) {
147600
147654
  const multilines = node.rows.map(child => (0,_StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.isMultilineNode)(child) ? child : child.columns.find(_StickyTableNode__WEBPACK_IMPORTED_MODULE_17__.isMultilineNode)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrUndefined);
147601
147655
  return multilines.some(multiline => {
147602
- var _ref6, _node$removeButton3;
147656
+ var _ref7, _node$removeButton3;
147603
147657
 
147604
- return ((_ref6 = (_node$removeButton3 = node.removeButton) !== null && _node$removeButton3 !== void 0 ? _node$removeButton3 : multiline.removebutton) !== null && _ref6 !== void 0 ? _ref6 : true) || multiline.rowmenu;
147658
+ return ((_ref7 = (_node$removeButton3 = node.removeButton) !== null && _node$removeButton3 !== void 0 ? _node$removeButton3 : multiline.removebutton) !== null && _ref7 !== void 0 ? _ref7 : true) || multiline.rowmenu;
147605
147659
  });
147606
147660
  }
147607
147661
 
@@ -147852,13 +147906,13 @@ class Table2MultirowConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODU
147852
147906
  return markupBuilder.buildConverterResult();
147853
147907
  }
147854
147908
 
147855
- *doBuildNormalizeRules(builder) {
147856
- var _node$optional2;
147909
+ *doBuildNormalizeRules(builder, formSchemaRng) {
147910
+ var _ref2;
147857
147911
 
147858
147912
  const node = this.getCurrentNodeAs(_Table2Node__WEBPACK_IMPORTED_MODULE_3__.Table2MultirowNode);
147859
- yield* builder.childrenInitializer(node, (_node$optional2 = node.optional) !== null && _node$optional2 !== void 0 ? _node$optional2 : false);
147913
+ const element = formSchemaRng.getElementByPath(node.getFullPath());
147914
+ yield* builder.childrenInitializer(node, (_ref2 = node.optional || (element === null || element === void 0 ? void 0 : element.isOptional())) !== null && _ref2 !== void 0 ? _ref2 : false);
147860
147915
  yield* builder.specialFieldsInitializer(node, {
147861
- optional: node.optional,
147862
147916
  disabled: undefined
147863
147917
  });
147864
147918
  }
@@ -148673,13 +148727,12 @@ class TabsConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.Sug
148673
148727
  return context.mergeDataDeclaration(context.addPathDeclEntry(node, [["children", context.initSequenceFactory.children((_ref = (_node$optional = node.optional) !== null && _node$optional !== void 0 ? _node$optional : context.isMultipleNodeOptionalFromScheme(node.getFullPath())) !== null && _ref !== void 0 ? _ref : false)]]), context.maxOccurs(node.getFullPath(), node.maxOccurs), context.addPathSectionDeclarationEntry(node));
148674
148728
  }
148675
148729
 
148676
- *doBuildNormalizeRules(builder) {
148677
- var _node$optional2;
148678
-
148730
+ *doBuildNormalizeRules(builder, formSchemaRng) {
148679
148731
  const node = this.getCurrentNodeAs(_TabsNode__WEBPACK_IMPORTED_MODULE_4__.TabsNode);
148680
- yield* builder.childrenInitializer(node, (_node$optional2 = node.optional) !== null && _node$optional2 !== void 0 ? _node$optional2 : false);
148732
+ const element = formSchemaRng.getElementByPath(node.getFullPath());
148733
+ const isOptional = node.optional || (element === null || element === void 0 ? void 0 : element.isOptional());
148734
+ yield* builder.childrenInitializer(node, isOptional !== null && isOptional !== void 0 ? isOptional : false);
148681
148735
  yield* builder.specialFieldsInitializer(node, {
148682
- optional: node.optional,
148683
148736
  disabled: undefined
148684
148737
  });
148685
148738
  }
@@ -150008,7 +150061,6 @@ class CheckboxConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_1__
150008
150061
  doBuildNormalizeRules(builder) {
150009
150062
  const node = this.getCurrentNodeAs(_CheckboxNode__WEBPACK_IMPORTED_MODULE_5__.CheckboxNode);
150010
150063
  return [builder.valueInitializer(node, node.dataBinding, false), ...builder.specialFieldsInitializer(node, {
150011
- optional: node.dataBinding.optional,
150012
150064
  disabled: false
150013
150065
  })];
150014
150066
  }
@@ -150240,7 +150292,6 @@ class ComboBoxConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__
150240
150292
  doBuildNormalizeRules(builder) {
150241
150293
  const node = this.getCurrentNodeAs(_ComboBoxNode__WEBPACK_IMPORTED_MODULE_7__.ComboBoxNode);
150242
150294
  return [builder.valueInitializer(node, node.dataBinding, node.disabled), ...builder.specialFieldsInitializer(node, {
150243
- optional: node.dataBinding.optional,
150244
150295
  disabled: node.disabled
150245
150296
  })];
150246
150297
  }
@@ -150752,7 +150803,6 @@ class DateConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_1__.Sug
150752
150803
  doBuildNormalizeRules(builder) {
150753
150804
  const node = this.getCurrentNodeAs(_DateNode__WEBPACK_IMPORTED_MODULE_6__.DateNode);
150754
150805
  return [builder.valueInitializer(node, node.dataBinding, node.disabled), ...builder.specialFieldsInitializer(node, {
150755
- optional: node.dataBinding.optional,
150756
150806
  disabled: node.disabled
150757
150807
  })];
150758
150808
  }
@@ -152636,7 +152686,6 @@ class InputConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.Su
152636
152686
  doBuildNormalizeRules(builder) {
152637
152687
  const node = this.getCurrentNodeAs(_InputNode__WEBPACK_IMPORTED_MODULE_7__.InputNode);
152638
152688
  return [builder.valueInitializer(node, node.dataBinding, node.disabled), ...builder.specialFieldsInitializer(node, {
152639
- optional: node.dataBinding.optional,
152640
152689
  disabled: node.disabled
152641
152690
  })];
152642
152691
  }
@@ -153715,27 +153764,25 @@ class PicklistConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_3__
153715
153764
  validationGenerator.processValidations(this.getResolvedBindingPath(node), node.validationInfo.optional, validationGenerator.getTypeNode(node.validationInfo), node.gId, node.validationInfo.emptydescription, undefined);
153716
153765
  }
153717
153766
 
153718
- *doBuildNormalizeRules(builder) {
153767
+ *doBuildNormalizeRules(builder, formSchemaRng) {
153719
153768
  const node = this.getCurrentNodeAs(_PicklistNode__WEBPACK_IMPORTED_MODULE_6__.PicklistNode);
153769
+ const element = formSchemaRng.getElementByPath(node.getFullPath());
153720
153770
  yield builder.valueInitializer(node, node.dataBinding, false);
153721
- yield* builder.specialFieldsInitializer(node, {
153722
- optional: node.dataBinding.optional
153723
- });
153771
+ const isOptional = node.dataBinding.optional || (element === null || element === void 0 ? void 0 : element.isOptional());
153772
+ yield* builder.specialFieldsInitializer(node, {});
153724
153773
 
153725
153774
  if (node.multiple) {
153726
- var _node$dataBinding$opt;
153727
-
153728
- yield* builder.childrenInitializerForPicklist(node, (_node$dataBinding$opt = node.dataBinding.optional) !== null && _node$dataBinding$opt !== void 0 ? _node$dataBinding$opt : false);
153775
+ yield* builder.childrenInitializerForPicklist(node, isOptional !== null && isOptional !== void 0 ? isOptional : false);
153729
153776
  }
153730
153777
  }
153731
153778
 
153732
153779
  doBuildDataDeclaration(context) {
153733
- var _node$dataBinding$opt2;
153780
+ var _node$dataBinding$opt;
153734
153781
 
153735
153782
  const node = this.getCurrentNodeAs(_PicklistNode__WEBPACK_IMPORTED_MODULE_6__.PicklistNode);
153736
153783
  return context.mergeDataDeclaration(context.addPathDeclEntry(node, [["value", context.initSequenceFactory.dataValue(node.dataBinding, false)]]), context.addSpecialFieldsEntry(node, {
153737
153784
  optional: node.dataBinding.optional
153738
- }), context.addPathSectionDeclarationEntry(node, node.dataBinding.requisite), context.addVisibilityPathDeclEntryNew(node, node.dataBinding.requisite), context.addChildrenPathDeclEntry(node, node.dataBinding.path, (_node$dataBinding$opt2 = node.dataBinding.optional) !== null && _node$dataBinding$opt2 !== void 0 ? _node$dataBinding$opt2 : false, node.dataBinding.requisite));
153785
+ }), context.addPathSectionDeclarationEntry(node, node.dataBinding.requisite), context.addVisibilityPathDeclEntryNew(node, node.dataBinding.requisite), context.addChildrenPathDeclEntry(node, node.dataBinding.path, (_node$dataBinding$opt = node.dataBinding.optional) !== null && _node$dataBinding$opt !== void 0 ? _node$dataBinding$opt : false, node.dataBinding.requisite));
153739
153786
  }
153740
153787
 
153741
153788
  get nodePaths() {
@@ -154175,9 +154222,7 @@ class RadioGroupConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_1
154175
154222
 
154176
154223
  doBuildNormalizeRules(builder) {
154177
154224
  const node = this.getCurrentNodeAs(_RadioGroupNode__WEBPACK_IMPORTED_MODULE_5__.RadioGroupNode);
154178
- return [builder.valueInitializer(node, node.dataBinding, false), ...builder.specialFieldsInitializer(node, {
154179
- optional: node.dataBinding.optional
154180
- })];
154225
+ return [builder.valueInitializer(node, node.dataBinding, false), ...builder.specialFieldsInitializer(node, {})];
154181
154226
  }
154182
154227
 
154183
154228
  doBuildDataDeclaration(context) {
@@ -154963,9 +155008,7 @@ class TaxRebateConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_3_
154963
155008
 
154964
155009
  doBuildNormalizeRules(builder) {
154965
155010
  const node = this.getCurrentNodeAs(_TaxRebateNode__WEBPACK_IMPORTED_MODULE_7__.TaxRebateNode);
154966
- return [builder.valueInitializer(node, node.dataBinding, undefined), ...builder.specialFieldsInitializer(node, {
154967
- optional: node.dataBinding.optional
154968
- })];
155011
+ return [builder.valueInitializer(node, node.dataBinding, undefined), ...builder.specialFieldsInitializer(node, {})];
154969
155012
  }
154970
155013
 
154971
155014
  buildChildrenDataDeclaration(context) {
@@ -159015,8 +159058,8 @@ class SugarNodeConverterBase {
159015
159058
  return this.node.sourceXmlNode;
159016
159059
  }
159017
159060
 
159018
- *buildNormalizeRules(builder) {
159019
- yield* this.doBuildNormalizeRules(builder);
159061
+ *buildNormalizeRules(builder, formSchemaRng) {
159062
+ yield* this.doBuildNormalizeRules(builder, formSchemaRng);
159020
159063
 
159021
159064
  for (const child of this.traverseChildren()) {
159022
159065
  const controlConverterClass = (0,_AllConverters__WEBPACK_IMPORTED_MODULE_3__.getConverterByNodeClass)((0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.getNodeClass)(child));
@@ -159033,12 +159076,12 @@ class SugarNodeConverterBase {
159033
159076
  }
159034
159077
  } else {
159035
159078
  const converter = new controlConverterClass(child);
159036
- yield* converter.buildNormalizeRules(builder);
159079
+ yield* converter.buildNormalizeRules(builder, formSchemaRng);
159037
159080
  }
159038
159081
  }
159039
159082
  }
159040
159083
 
159041
- doBuildNormalizeRules(builder) {
159084
+ doBuildNormalizeRules(builder, formSchemaRng) {
159042
159085
  return [];
159043
159086
  }
159044
159087
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.268.0",
3
+ "version": "4.269.0-normalization-sum-fix.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,