@kontur.candy/generator 4.241.0-lazy-loading.2 → 4.241.0-lazy-loading.6

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 +167 -47
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -112701,6 +112701,14 @@ class AbsoluteModelFieldPath {
112701
112701
  return new AbsoluteModelFieldPath(AbsoluteModelPath.createAbsoluteFromMask(pathWithFieldName.replace(".$warningCount", ""), multiplicitySymbol), "$warningCount");
112702
112702
  }
112703
112703
 
112704
+ if (pathWithFieldName.endsWith(".errorsCount")) {
112705
+ return new AbsoluteModelFieldPath(AbsoluteModelPath.createAbsoluteFromMask(pathWithFieldName.replace(".errorsCount", ""), multiplicitySymbol), "errorsCount");
112706
+ }
112707
+
112708
+ if (pathWithFieldName.endsWith(".warningsCount")) {
112709
+ return new AbsoluteModelFieldPath(AbsoluteModelPath.createAbsoluteFromMask(pathWithFieldName.replace(".warningsCount", ""), multiplicitySymbol), "warningsCount");
112710
+ }
112711
+
112704
112712
  return new AbsoluteModelFieldPath(AbsoluteModelPath.createAbsoluteFromMask(pathWithFieldName, multiplicitySymbol), "value");
112705
112713
  }
112706
112714
 
@@ -123384,12 +123392,14 @@ class FormSchemaRngAttribute {
123384
123392
  }
123385
123393
  const RootParent = Symbol.for("__ROOT_ELEMENT_PARENT__");
123386
123394
  class FormSchemaRngElement {
123387
- constructor(name, parent, optional, multiple, lazyLoadMode, lazyLoadAggregations) {
123395
+ constructor(name, parent, optional, multiple, lazyLoadMode, lazyLoadAggregations, errorAndWarningCountRequired, lazyLoadingThreshold) {
123388
123396
  this.name = void 0;
123389
123397
  this.optional = void 0;
123390
123398
  this.multiple = void 0;
123391
123399
  this.lazyLoadMode = void 0;
123392
123400
  this.lazyLoadAggregations = void 0;
123401
+ this.errorAndWarningCountRequired = void 0;
123402
+ this.lazyLoadingThreshold = void 0;
123393
123403
  this.innerTextType = void 0;
123394
123404
  this.children = new Map();
123395
123405
  this.attributes = new Map();
@@ -123400,6 +123410,8 @@ class FormSchemaRngElement {
123400
123410
  this.optional = optional;
123401
123411
  this.lazyLoadMode = lazyLoadMode;
123402
123412
  this.lazyLoadAggregations = lazyLoadAggregations;
123413
+ this.errorAndWarningCountRequired = errorAndWarningCountRequired;
123414
+ this.lazyLoadingThreshold = lazyLoadingThreshold;
123403
123415
  }
123404
123416
 
123405
123417
  addElement(element) {
@@ -123452,7 +123464,7 @@ class FormSchemaRng {
123452
123464
  }
123453
123465
 
123454
123466
  static convertSchemaRngElement(schemaRngElement, parent) {
123455
- const result = new FormSchemaRngElement(schemaRngElement.name, parent, schemaRngElement.optional, schemaRngElement.multiple, schemaRngElement.lazyLoadMode, schemaRngElement.lazyLoadAggregations);
123467
+ const result = new FormSchemaRngElement(schemaRngElement.name, parent, schemaRngElement.optional, schemaRngElement.multiple, schemaRngElement.lazyLoadMode, schemaRngElement.lazyLoadAggregations, schemaRngElement.errorAndWarningCountRequired, schemaRngElement.lazyLoadingThreshold);
123456
123468
 
123457
123469
  if (schemaRngElement.innerText != undefined) {
123458
123470
  if (schemaRngElement.innerText.type != undefined) {
@@ -123923,7 +123935,7 @@ __webpack_require__.r(__webpack_exports__);
123923
123935
  /* harmony export */ });
123924
123936
  /* harmony import */ var _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../generators/markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
123925
123937
  /* module decorator */ module = __webpack_require__.hmd(module);
123926
- var _dec, _dec2, _class, _class2, _descriptor, _dec3, _dec4, _class4, _class5, _descriptor2, _dec5, _dec6, _class7, _class8, _descriptor3, _dec7, _dec8, _class10, _class11, _descriptor4, _dec9, _dec10, _class13, _class14, _descriptor5, _dec11, _dec12, _class16, _class17, _descriptor6, _dec13, _dec14, _class19, _class20, _descriptor7, _dec15, _dec16, _class22, _class23, _descriptor8, _dec17, _dec18, _class25, _class26, _descriptor9, _dec19, _dec20, _class28, _class29, _descriptor10, _dec21, _dec22, _dec23, _dec24, _dec25, _class31, _class32, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _class34, _class35, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _dec33, _dec34, _class37, _class38, _descriptor21, _dec35, _dec36, _class40, _class41, _descriptor22, _dec37, _dec38, _dec39, _dec40, _dec41, _dec42, _dec43, _dec44, _dec45, _dec46, _dec47, _class43, _class44, _descriptor23, _descriptor24, _descriptor25, _descriptor26, _descriptor27, _descriptor28, _descriptor29, _descriptor30, _descriptor31, _descriptor32;
123938
+ var _dec, _dec2, _class, _class2, _descriptor, _dec3, _dec4, _class4, _class5, _descriptor2, _dec5, _dec6, _class7, _class8, _descriptor3, _dec7, _dec8, _class10, _class11, _descriptor4, _dec9, _dec10, _class13, _class14, _descriptor5, _dec11, _dec12, _class16, _class17, _descriptor6, _dec13, _dec14, _class19, _class20, _descriptor7, _dec15, _dec16, _class22, _class23, _descriptor8, _dec17, _dec18, _class25, _class26, _descriptor9, _dec19, _dec20, _class28, _class29, _descriptor10, _dec21, _dec22, _dec23, _dec24, _dec25, _class31, _class32, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _class34, _class35, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _dec33, _dec34, _class37, _class38, _descriptor21, _dec35, _dec36, _class40, _class41, _descriptor22, _dec37, _dec38, _dec39, _dec40, _dec41, _dec42, _dec43, _dec44, _dec45, _dec46, _dec47, _dec48, _dec49, _class43, _class44, _descriptor23, _descriptor24, _descriptor25, _descriptor26, _descriptor27, _descriptor28, _descriptor29, _descriptor30, _descriptor31, _descriptor32, _descriptor33, _descriptor34;
123927
123939
 
123928
123940
  (function () {
123929
123941
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
@@ -124264,7 +124276,7 @@ let SchemaRngElementChoiceElement = (_dec35 = (0,_generators_markupGenerator_Ser
124264
124276
  writable: true,
124265
124277
  initializer: null
124266
124278
  })), _class41)) || _class40);
124267
- let SchemaRngElement = (_dec37 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.sugarNode)("element", ``), _dec38 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("name", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.string.required, ``), _dec39 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("description", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.string, ``), _dec40 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("optional", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec41 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("multiple", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec42 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("attribute", [SchemaRngAttribute]), _dec43 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("element"), _dec44 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("choice"), _dec45 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.singleChild)("innertext", [SchemaRngInnerText]), _dec46 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("lazyLoadAggregations", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec47 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("lazyLoadMode", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType["enum"]("deferred", "initial", "request"), ``), _dec37(_class43 = (_class44 = class SchemaRngElement extends _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.SugarNodeBase {
124279
+ let SchemaRngElement = (_dec37 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.sugarNode)("element", ``), _dec38 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("name", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.string.required, ``), _dec39 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("description", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.string, ``), _dec40 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("optional", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec41 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("multiple", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec42 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("attribute", [SchemaRngAttribute]), _dec43 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("element"), _dec44 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.children)("choice"), _dec45 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.singleChild)("innertext", [SchemaRngInnerText]), _dec46 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("lazyLoadAggregations", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec47 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("lazyLoadMode", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType["enum"]("deferred", "initial", "request"), ``), _dec48 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("errorAndWarningCountRequired", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.boolean, ``), _dec49 = (0,_generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attr)("lazyLoadingThreshold", _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.attrType.number, ``), _dec37(_class43 = (_class44 = class SchemaRngElement extends _generators_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.SugarNodeBase {
124268
124280
  constructor(...args) {
124269
124281
  super(...args);
124270
124282
 
@@ -124287,6 +124299,10 @@ let SchemaRngElement = (_dec37 = (0,_generators_markupGenerator_Serializer_Sugar
124287
124299
  _initializerDefineProperty(this, "lazyLoadAggregations", _descriptor31, this);
124288
124300
 
124289
124301
  _initializerDefineProperty(this, "lazyLoadMode", _descriptor32, this);
124302
+
124303
+ _initializerDefineProperty(this, "errorAndWarningCountRequired", _descriptor33, this);
124304
+
124305
+ _initializerDefineProperty(this, "lazyLoadingThreshold", _descriptor34, this);
124290
124306
  }
124291
124307
 
124292
124308
  // @ts-ignore
@@ -124345,6 +124361,16 @@ let SchemaRngElement = (_dec37 = (0,_generators_markupGenerator_Serializer_Sugar
124345
124361
  enumerable: true,
124346
124362
  writable: true,
124347
124363
  initializer: null
124364
+ }), _descriptor33 = _applyDecoratedDescriptor(_class44.prototype, "errorAndWarningCountRequired", [_dec48], {
124365
+ configurable: true,
124366
+ enumerable: true,
124367
+ writable: true,
124368
+ initializer: null
124369
+ }), _descriptor34 = _applyDecoratedDescriptor(_class44.prototype, "lazyLoadingThreshold", [_dec49], {
124370
+ configurable: true,
124371
+ enumerable: true,
124372
+ writable: true,
124373
+ initializer: null
124348
124374
  })), _class44)) || _class43);
124349
124375
  ;
124350
124376
 
@@ -131261,14 +131287,20 @@ class DataDeclarationGenerationTimeHelper {
131261
131287
  this.dataDeclaration = dataDeclaration;
131262
131288
  }
131263
131289
 
131290
+ isErrorsAndWarningsCountRequired(targetPath) {
131291
+ var _this$getDataDeclarat, _this$getDataDeclarat2, _this$getDataDeclarat3;
131292
+
131293
+ return (_this$getDataDeclarat = (_this$getDataDeclarat2 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat2 === void 0 ? void 0 : (_this$getDataDeclarat3 = _this$getDataDeclarat2.errorAndWarningCountRequired) === null || _this$getDataDeclarat3 === void 0 ? void 0 : _this$getDataDeclarat3[0]) !== null && _this$getDataDeclarat !== void 0 ? _this$getDataDeclarat : false;
131294
+ }
131295
+
131264
131296
  hasMask(targetPath) {
131265
131297
  return this.getDataDeclarationEntry(targetPath) != undefined;
131266
131298
  }
131267
131299
 
131268
131300
  isNodeHasChildrenEntry(targetPath) {
131269
- var _this$getDataDeclarat;
131301
+ var _this$getDataDeclarat4;
131270
131302
 
131271
- return ((_this$getDataDeclarat = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat === void 0 ? void 0 : _this$getDataDeclarat.children) != undefined;
131303
+ return ((_this$getDataDeclarat4 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat4 === void 0 ? void 0 : _this$getDataDeclarat4.children) != undefined;
131272
131304
  }
131273
131305
 
131274
131306
  isNodeHasAutoFlagEntry(targetPath) {
@@ -131289,9 +131321,9 @@ class DataDeclarationGenerationTimeHelper {
131289
131321
  }
131290
131322
 
131291
131323
  isNodeOptional(targetPath) {
131292
- var _this$getDataDeclarat2, _optionalValue$;
131324
+ var _this$getDataDeclarat5, _optionalValue$;
131293
131325
 
131294
- const optionalValue = (_this$getDataDeclarat2 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat2 === void 0 ? void 0 : _this$getDataDeclarat2.optional;
131326
+ const optionalValue = (_this$getDataDeclarat5 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat5 === void 0 ? void 0 : _this$getDataDeclarat5.optional;
131295
131327
  return (_optionalValue$ = optionalValue === null || optionalValue === void 0 ? void 0 : optionalValue[0]) !== null && _optionalValue$ !== void 0 ? _optionalValue$ : false;
131296
131328
  }
131297
131329
 
@@ -131345,8 +131377,9 @@ __webpack_require__.r(__webpack_exports__);
131345
131377
  /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
131346
131378
  /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
131347
131379
  /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
131348
- /* harmony import */ var _placeholders__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./placeholders */ "./Generator/src/generators/DataDeclarationGenerator/placeholders.js");
131349
- /* harmony import */ var _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DataDeclarationGenerationContext */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts");
131380
+ /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
131381
+ /* harmony import */ var _placeholders__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./placeholders */ "./Generator/src/generators/DataDeclarationGenerator/placeholders.js");
131382
+ /* harmony import */ var _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DataDeclarationGenerationContext */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts");
131350
131383
  /* module decorator */ module = __webpack_require__.hmd(module);
131351
131384
  (function () {
131352
131385
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
@@ -131365,12 +131398,15 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
131365
131398
 
131366
131399
 
131367
131400
 
131401
+
131368
131402
  class DataDeclarationGenerator {
131369
- constructor(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry) {
131403
+ constructor(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng) {
131370
131404
  this.sugarRoot = void 0;
131371
131405
  this.initSequenceFactory = void 0;
131406
+ this.formSchemaRng = void 0;
131372
131407
  this.controlCustomizationContext = void 0;
131373
131408
  this.typesRegistry = void 0;
131409
+ this.formSchemaRng = formSchemaRng;
131374
131410
  this.sugarRoot = sugarRoot;
131375
131411
  this.initSequenceFactory = initSequenceFactory;
131376
131412
  this.controlCustomizationContext = controlCustomizationContext;
@@ -131382,8 +131418,9 @@ class DataDeclarationGenerator {
131382
131418
 
131383
131419
  const converterClass = (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
131384
131420
  const converter = new converterClass(this.sugarRoot);
131385
- const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_7__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry);
131421
+ const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry);
131386
131422
  const dataDeclaration = converter.buildDataDeclaration(context);
131423
+ this.enrichWithSchemaRng(dataDeclaration);
131387
131424
  const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
131388
131425
  const result = this.replaceHolder(`
131389
131426
  export default function dataDeclaration({
@@ -131411,12 +131448,27 @@ class DataDeclarationGenerator {
131411
131448
  };
131412
131449
  }
131413
131450
 
131451
+ enrichWithSchemaRng(dataDeclaration) {
131452
+ const elementEntries = this.formSchemaRng.getAllChildren(this.formSchemaRng.getRootElement()).filter(x => x instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__.FormSchemaRngElement && x.errorAndWarningCountRequired).map(x => ({
131453
+ element: x,
131454
+ path: this.formSchemaRng.getPath(x)
131455
+ }));
131456
+
131457
+ for (const elementEntry of elementEntries) {
131458
+ var _dataDeclaration$lega, _elementEntry$element;
131459
+
131460
+ const legacyPath = elementEntry.path.trimLastStarIfLastToken().toLegacyPath();
131461
+ const declarationEntry = (_dataDeclaration$lega = dataDeclaration[legacyPath]) !== null && _dataDeclaration$lega !== void 0 ? _dataDeclaration$lega : {};
131462
+ declarationEntry.errorAndWarningCountRequired = [(_elementEntry$element = elementEntry.element.errorAndWarningCountRequired) !== null && _elementEntry$element !== void 0 ? _elementEntry$element : false];
131463
+ }
131464
+ }
131465
+
131414
131466
  generateDataDeclarationFactory() {
131415
131467
  var _getConverterByNodeCl2;
131416
131468
 
131417
131469
  const converterClass = (_getConverterByNodeCl2 = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl2 !== void 0 ? _getConverterByNodeCl2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
131418
131470
  const converter = new converterClass(this.sugarRoot);
131419
- const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_7__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry);
131471
+ const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry);
131420
131472
  const dataDeclaration = converter.buildDataDeclaration(context);
131421
131473
  const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
131422
131474
  return `
@@ -131455,7 +131507,7 @@ class DataDeclarationGenerator {
131455
131507
  replaceHolder(decl) {
131456
131508
  let replacedDecl = decl;
131457
131509
 
131458
- for (const [placeholderName, placeHoldersFunction] of (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.iterateEntries)(_placeholders__WEBPACK_IMPORTED_MODULE_6__.placeHolders)) {
131510
+ for (const [placeholderName, placeHoldersFunction] of (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.iterateEntries)(_placeholders__WEBPACK_IMPORTED_MODULE_7__.placeHolders)) {
131459
131511
  const checkName = `"#(${placeholderName})(\\('[\\w]*'\\))?#"`;
131460
131512
  const include = new RegExp(checkName, "i");
131461
131513
 
@@ -132769,7 +132821,7 @@ class KCXmlGeneratorBase {
132769
132821
  const gcf = (selector, ...args) => this.getCompiledFuncWithArgs(selector, args);
132770
132822
 
132771
132823
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArgumentExpression || expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultySumExpression) {
132772
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeAttributePrefix(expression.select), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132824
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeMultiplicity(this.removeAttributePrefix(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132773
132825
  const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Sum");
132774
132826
  deps.push(argumentDependency);
132775
132827
  const finalPath = argumentDependency instanceof _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath ? argumentDependency : argumentDependency.modelPath;
@@ -132777,13 +132829,13 @@ class KCXmlGeneratorBase {
132777
132829
  }
132778
132830
 
132779
132831
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
132780
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeAttributePrefix(expression.select), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132832
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132781
132833
  deps.push(modelPath);
132782
132834
  return gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`);
132783
132835
  }
132784
132836
 
132785
132837
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaCountExpression) {
132786
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeAttributePrefix(expression.select), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132838
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath.createFromMask(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
132787
132839
  const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Count");
132788
132840
  deps.push(argumentDependency);
132789
132841
  const finalPath = argumentDependency instanceof _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.ModelPath ? argumentDependency : argumentDependency.modelPath;
@@ -133080,15 +133132,36 @@ class LazyLoadDeclarationGenerator {
133080
133132
  *processElement(path, element) {
133081
133133
  if (element.lazyLoadMode != undefined) {
133082
133134
  const currentPath = element.multiple ? path.joinWith(element.name) : path.joinWith(element.name + ".value");
133083
- yield {
133135
+ const item = {
133084
133136
  path: this.formSchemaRng.adjustPathMultiplicity(currentPath),
133085
133137
  lazyLoadMode: element.lazyLoadMode
133086
133138
  };
133139
+ yield element.lazyLoadingThreshold != undefined ? { ...item,
133140
+ thresholdValue: element.lazyLoadingThreshold
133141
+ } : item;
133087
133142
 
133088
133143
  if (element.multiple) {
133089
- const childrenPath = path.joinWith(element.name + ".children");
133144
+ const additionalFields = ["children", "errorsCount", "warningsCount"];
133145
+ const additionalItems = additionalFields.map(field => ({
133146
+ path: this.formSchemaRng.adjustPathMultiplicity(path.joinWith(`${element.name}.${field}`)),
133147
+ lazyLoadMode: "initial"
133148
+ }));
133149
+ yield* additionalItems;
133090
133150
  yield {
133091
- path: this.formSchemaRng.adjustPathMultiplicity(childrenPath),
133151
+ path: this.formSchemaRng.adjustPathMultiplicity(path.joinWith(element.name).joinWith(".errorsCount")),
133152
+ lazyLoadMode: "initial"
133153
+ };
133154
+ yield {
133155
+ path: this.formSchemaRng.adjustPathMultiplicity(path.joinWith(element.name).joinWith(".warningsCount")),
133156
+ lazyLoadMode: "initial"
133157
+ };
133158
+ } else {
133159
+ yield {
133160
+ path: this.formSchemaRng.adjustPathMultiplicity(path.joinWith(element.name + ".errorsCount")),
133161
+ lazyLoadMode: "initial"
133162
+ };
133163
+ yield {
133164
+ path: this.formSchemaRng.adjustPathMultiplicity(path.joinWith(element.name + ".warningsCount")),
133092
133165
  lazyLoadMode: "initial"
133093
133166
  };
133094
133167
  }
@@ -133126,22 +133199,27 @@ class LazyLoadDeclarationGenerator {
133126
133199
  }
133127
133200
 
133128
133201
  generate() {
133129
- const desclaration = {};
133202
+ const declaration = {};
133130
133203
  const resultItems = this.processElement(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_3__.ModelPath.empty(), this.formSchemaRng.getRootElement());
133131
133204
 
133132
133205
  for (const lazyLoadingNodeDeclaration of resultItems) {
133133
- desclaration[lazyLoadingNodeDeclaration.path.toLegacyPath()] = {
133134
- lazyLoadMode: lazyLoadingNodeDeclaration.lazyLoadMode
133206
+ declaration[lazyLoadingNodeDeclaration.path.toLegacyPath()] = {
133207
+ lazyLoadMode: lazyLoadingNodeDeclaration.lazyLoadMode,
133208
+ thresholdValue: lazyLoadingNodeDeclaration.thresholdValue
133135
133209
  };
133136
133210
  }
133137
133211
 
133138
133212
  const result = this.replaceHolder(`
133139
133213
  export default function lazyLoadDeclaration() {
133140
- return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(desclaration, {
133214
+ return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(declaration, {
133141
133215
  space: " "
133142
133216
  })};
133143
133217
  };`);
133144
- return unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
133218
+ const content = unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
133219
+ return {
133220
+ content: content,
133221
+ declaration: declaration
133222
+ };
133145
133223
  }
133146
133224
 
133147
133225
  replaceHolder(decl) {
@@ -133296,22 +133374,23 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
133296
133374
  const fetchFunctions = new _common_FetchFunctions__WEBPACK_IMPORTED_MODULE_2__.FetchFunctions(referencedFetchFunctions); // tslint:disable-next-line no-unsafe-any
133297
133375
 
133298
133376
  const additionalSettings = JSON.parse(additionalContent.additionalSettings || "{}");
133299
- const dataDeclarationGenerator = new _DataDeclarationGenerator_DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_19__.DataDeclarationGenerator(sugarRoot, new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__.DataDeclarationInitSourceSequenceFactory(fetchFunctions), controlCustomizationContext, typeRegistry);
133377
+ const dataDeclarationGenerator = new _DataDeclarationGenerator_DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_19__.DataDeclarationGenerator(sugarRoot, new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__.DataDeclarationInitSourceSequenceFactory(fetchFunctions), controlCustomizationContext, typeRegistry, formSchemaRng);
133300
133378
  const {
133301
133379
  dataDeclarationContent,
133302
133380
  dataDeclaration
133303
133381
  } = dataDeclarationGenerator.generate();
133304
133382
  const dataDeclarationHelper = new _DataDeclarationGenerator_DataDeclarationGenerationTimeHelper__WEBPACK_IMPORTED_MODULE_26__.DataDeclarationGenerationTimeHelper(dataDeclaration);
133305
133383
  const validationGenerator = new _validationGenerator_ValidationGenerator__WEBPACK_IMPORTED_MODULE_16__.ValidationGenerator(sugarRoot, typeRegistry, controlCustomizationContext, formSchemaRng, (_sugarRoot$schemaVali = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali !== void 0 ? _sugarRoot$schemaVali : false, (_sugarRoot$deepOption = sugarRoot.deepOptionalSchemaValidations) !== null && _sugarRoot$deepOption !== void 0 ? _sugarRoot$deepOption : false, additionalContent.validationsContent);
133306
- const normalizationRulesGenerator = new _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(sugarRoot, dataDeclarationHelper, formSchemaRng, formulas, kcXmlConditions, typeRegistry, (_sugarRoot$schemaVali2 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali2 !== void 0 ? _sugarRoot$schemaVali2 : false, controlCustomizationContext);
133384
+ const lazyLoadGenerator = new _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__.LazyLoadDeclarationGenerator(formSchemaRng);
133385
+ const lazyLoadGeneratorResult = lazyLoadGenerator.generate();
133386
+ const normalizationRulesGenerator = new _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(sugarRoot, dataDeclarationHelper, formSchemaRng, formulas, kcXmlConditions, typeRegistry, (_sugarRoot$schemaVali2 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali2 !== void 0 ? _sugarRoot$schemaVali2 : false, controlCustomizationContext, lazyLoadGeneratorResult.declaration);
133307
133387
  const resourcesHash = (_generationOptions$re = generationOptions === null || generationOptions === void 0 ? void 0 : generationOptions.resourcesHash) !== null && _generationOptions$re !== void 0 ? _generationOptions$re : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.reject)("Current generator version requires resources hash");
133308
133388
  const builder = new _FormSourcesBuilder_FormSourcesBuilder__WEBPACK_IMPORTED_MODULE_21__.FormSourcesBuilder(additionalContent.formSourcesPath);
133309
133389
  const markupGenerator = new _markupGenerator_MarkupGenerator__WEBPACK_IMPORTED_MODULE_12__.MarkupGenerator(additionalContent.formSourcesPath, additionalContent.helpersContent, additionalContent.tourSteps, controlCustomizationContext, typeRegistry, formSchemaRng, dataDeclarationHelper, (_sugarRoot$schemaVali3 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali3 !== void 0 ? _sugarRoot$schemaVali3 : false);
133310
133390
  markupGenerator.generate(sugarRoot, builder);
133311
133391
  builder.addResource("settings.js", (0,_markupGenerator_getSettings__WEBPACK_IMPORTED_MODULE_9__.getSettings)(sugarRoot, additionalContent.gfv, additionalSettings));
133312
133392
  builder.addResource("requisiteList.js", (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__.getRequisiteList)(sugarRoot, fetchFunctions));
133313
- const lazyLoadGenerator = new _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__.LazyLoadDeclarationGenerator(formSchemaRng);
133314
- builder.addResource("lazyLoadDeclaration.js", lazyLoadGenerator.generate());
133393
+ builder.addResource("lazyLoadDeclaration.js", lazyLoadGeneratorResult.content);
133315
133394
  const autocalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsGenerator__WEBPACK_IMPORTED_MODULE_18__.AutoCalculationsGenerator(dataDeclarationHelper, schemaRng);
133316
133395
  builder.addResource("calculationFunctions.js", autocalcGenerator.generate(sugarRoot, formulas, additionalContent.autocalcsContent));
133317
133396
  builder.addResource("dataDeclaration.js", dataDeclarationContent);
@@ -134979,7 +135058,7 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
134979
135058
 
134980
135059
 
134981
135060
  class NormalizationRulesGenerator {
134982
- constructor(sugarRoot, dataDeclarationHelper, formSchemaRng, formulas, conditions, typesRegistry, useSchemaValidations, controlCustomizationContext) {
135061
+ constructor(sugarRoot, dataDeclarationHelper, formSchemaRng, formulas, conditions, typesRegistry, useSchemaValidations, controlCustomizationContext, lazyLoadingDeclaration) {
134983
135062
  this.sugarRoot = void 0;
134984
135063
  this.dataDeclarationHelper = void 0;
134985
135064
  this.formSchemaRng = void 0;
@@ -134988,6 +135067,8 @@ class NormalizationRulesGenerator {
134988
135067
  this.typesRegistry = void 0;
134989
135068
  this.controlCustomizationContext = void 0;
134990
135069
  this.useSchemaValidations = void 0;
135070
+ this.lazyLoadingDeclaration = void 0;
135071
+ this.lazyLoadingDeclaration = lazyLoadingDeclaration;
134991
135072
  this.sugarRoot = sugarRoot;
134992
135073
  this.dataDeclarationHelper = dataDeclarationHelper;
134993
135074
  this.formSchemaRng = formSchemaRng;
@@ -135044,7 +135125,20 @@ class NormalizationRulesGenerator {
135044
135125
  }
135045
135126
 
135046
135127
  buildInitializeRules(formRoot, resourcesHash) {
135047
- return [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute(formRoot), "resourcesHash"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression(resourcesHash)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute(formRoot), "normalizationSource"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("server"))];
135128
+ const mandatoryRules = [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute(formRoot), "resourcesHash"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression(resourcesHash)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute(formRoot), "normalizationSource"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("server"))];
135129
+ const thresholdEntry = Object.entries(this.lazyLoadingDeclaration).find(x => x[1].thresholdValue != undefined);
135130
+
135131
+ if (thresholdEntry != undefined) {
135132
+ var _thresholdEntry$1$thr, _thresholdEntry$;
135133
+
135134
+ const thresholdEntryPath = _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.ModelPath.createFromMask(`/${thresholdEntry[0]}`, true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
135135
+ const thresholdValue = (_thresholdEntry$1$thr = (_thresholdEntry$ = thresholdEntry[1]) === null || _thresholdEntry$ === void 0 ? void 0 : _thresholdEntry$.thresholdValue) !== null && _thresholdEntry$1$thr !== void 0 ? _thresholdEntry$1$thr : 0;
135136
+ const lazyLoadingEnabledRef = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute(formRoot).joinWith("LazyLoadingEnabled"), "value");
135137
+ const statement = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(lazyLoadingEnabledRef, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.GeExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ReduceCallExpression(thresholdEntryPath.trimLastStarIfLastToken().toCurrentIteration(), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentReferenceExpression("result"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(1))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(thresholdValue)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("true"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("false")));
135138
+ return mandatoryRules.concat([statement]);
135139
+ }
135140
+
135141
+ return mandatoryRules;
135048
135142
  }
135049
135143
 
135050
135144
  buildSugarFLangRules() {
@@ -135325,43 +135419,69 @@ class NormalizationRulesGenerator {
135325
135419
  yield rule;
135326
135420
  }
135327
135421
 
135328
- yield* this.buildErrorCountRule(context.getAllPathsWithValidations());
135422
+ const targetPaths = [..._Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(context.getAllPathsWithValidations(), x => x.toLegacyPath())];
135423
+ yield* this.buildErrorWarningCountRules(targetPaths, "error");
135424
+ yield* this.buildErrorWarningCountRules(targetPaths, "warning");
135425
+ }
135426
+
135427
+ *splitModelPathIfErrorCountRequired(modelPath) {
135428
+ const tokens = modelPath.getPathPartsAsArray();
135429
+
135430
+ for (let i = 0; i < tokens.length; i++) {
135431
+ const currentModelPath = new _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.ModelPath(tokens.slice(0, i), modelPath.isAbsolute());
135432
+
135433
+ if (tokens[i] === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each || this.dataDeclarationHelper.isErrorsAndWarningsCountRequired(currentModelPath)) {
135434
+ yield currentModelPath;
135435
+ }
135436
+ }
135329
135437
  }
135330
135438
 
135331
- *buildErrorCountRule(allPathsWithValidations) {
135439
+ *buildErrorWarningCountRules(allPathsWithValidations, fieldName) {
135440
+ const countFieldName = `${fieldName}sCount`;
135332
135441
  const zeroExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0);
135333
135442
  const totalErrorCountExpressions = new _Common_ModelPath_ModelPathMap__WEBPACK_IMPORTED_MODULE_10__.ModelPathMap(_Common_ModelPath_EachCurrentCollision__WEBPACK_IMPORTED_MODULE_5__.EachCurrentCollision.AreDifferent);
135334
135443
  const errorCountByTarget = new _Common_ModelPath_ModelPathMap__WEBPACK_IMPORTED_MODULE_10__.ModelPathMap(_Common_ModelPath_EachCurrentCollision__WEBPACK_IMPORTED_MODULE_5__.EachCurrentCollision.AreDifferent);
135335
135444
 
135336
135445
  for (const path of allPathsWithValidations) {
135337
- var _IterUtils$last$itera, _IterUtils$last;
135446
+ var _IterUtils$last;
135338
135447
 
135339
- const iterationSequence = [...(0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.reverseArray)((0,_Common_ModelPath_BuildIterationSequence__WEBPACK_IMPORTED_MODULE_11__.buildIterationSequence)(path))];
135340
- let resultCountExpression = this.getErrorCountExpression(path.toCurrentIteration());
135448
+ const iterationSequence = [...(0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.reverseArray)([...this.splitModelPathIfErrorCountRequired(path)])];
135449
+ let resultCountExpression = this.getErrorWarningCountExpression(path.toCurrentIteration(), fieldName);
135450
+
135451
+ for (const iterationPath of iterationSequence) {
135452
+ if (this.dataDeclarationHelper.isErrorsAndWarningsCountRequired(iterationPath) && this.dataDeclarationHelper.isNodeHasChildrenEntry(iterationPath)) {
135453
+ const multipleTarget = iterationPath.joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
135454
+ errorCountByTarget.getOrSet(multipleTarget, []).push(resultCountExpression);
135455
+ resultCountExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(multipleTarget.toCurrentIteration(), countFieldName), "decimal", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0));
135456
+ }
135341
135457
 
135342
- for (const iterationEntry of iterationSequence) {
135343
- errorCountByTarget.getOrSet(iterationEntry.iterable, []).push(resultCountExpression);
135344
- resultCountExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(iterationEntry.iterable.toCurrentIteration(), "errorsCount"), "decimal", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0));
135458
+ errorCountByTarget.getOrSet(iterationPath, []).push(resultCountExpression);
135459
+ resultCountExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(iterationPath.toCurrentIteration(), countFieldName), "decimal", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0));
135345
135460
  }
135346
135461
 
135347
- totalErrorCountExpressions.set((_IterUtils$last$itera = (_IterUtils$last = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.last(iterationSequence)) === null || _IterUtils$last === void 0 ? void 0 : _IterUtils$last.iterable) !== null && _IterUtils$last$itera !== void 0 ? _IterUtils$last$itera : path, resultCountExpression);
135462
+ totalErrorCountExpressions.set((_IterUtils$last = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.last(iterationSequence)) !== null && _IterUtils$last !== void 0 ? _IterUtils$last : path, resultCountExpression);
135348
135463
  }
135349
135464
 
135350
135465
  for (const entry of errorCountByTarget.entries()) {
135351
135466
  const iterable = entry[0];
135352
- const items = entry[1];
135467
+ const items = [..._Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(entry[1], x => x.convertToString())];
135353
135468
  const firstEmptyExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NullLiteralExpression();
135354
135469
  const allItemsSumExpression = items.reduce((x, y) => x == firstEmptyExpression ? y : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(x, y), firstEmptyExpression);
135355
- const nextErrorCountPrecalculation = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(iterable, "errorsCount");
135356
- yield new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(nextErrorCountPrecalculation, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ReduceCallExpression(iterable.toCurrentIteration(), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentReferenceExpression("result"), allItemsSumExpression)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0)), "string", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("G29")));
135470
+ const nextErrorCountPrecalculation = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(iterable, countFieldName);
135471
+
135472
+ if (_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.last(iterable.getPathParts()) === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each || !this.dataDeclarationHelper.isNodeHasChildrenEntry(iterable)) {
135473
+ yield new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(nextErrorCountPrecalculation, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(allItemsSumExpression, "string", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("G29")));
135474
+ } else {
135475
+ yield new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(nextErrorCountPrecalculation, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ReduceCallExpression(iterable.toCurrentIteration(), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.BuildInTypeExpression.decimal)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ArgumentReferenceExpression("result"), allItemsSumExpression)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0)), "string", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("G29")));
135476
+ }
135357
135477
  }
135358
135478
 
135359
135479
  const allRules = Iterator.from(totalErrorCountExpressions.values()).reduce((result, expression) => result === zeroExpression ? expression : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SumBinaryExpression(result, expression), zeroExpression);
135360
- yield new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute((0,_markupGenerator_getRootPath__WEBPACK_IMPORTED_MODULE_4__.getRootPath)(this.sugarRoot)), "errorsCount"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(allRules, "string", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("G29")));
135480
+ yield new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.AbsoluteModelPath.createAbsolute((0,_markupGenerator_getRootPath__WEBPACK_IMPORTED_MODULE_4__.getRootPath)(this.sugarRoot)), countFieldName), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.CastExpression(allRules, "string", new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression("G29")));
135361
135481
  }
135362
135482
 
135363
- getErrorCountExpression(path) {
135364
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(path, "error"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression(`[]`)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(path, "error"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NullLiteralExpression())), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(1));
135483
+ getErrorWarningCountExpression(path, fieldName) {
135484
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(path, fieldName), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.StringLiteralExpression(`[]`)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.ValueReferenceExpression(path, fieldName), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.NullLiteralExpression())), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(0), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_13__.DecimalLiteralExpression(1));
135365
135485
  }
135366
135486
 
135367
135487
  // @ts-ignore
@@ -143726,7 +143846,7 @@ class UserPicklistConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE
143726
143846
  type: "Expression",
143727
143847
  expression: validationGenerator.generateValidationsFactory()
143728
143848
  });
143729
- const dataDeclarationGenerator = new _DataDeclarationGenerator_DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_10__.DataDeclarationGenerator((_findSugarNodeBases$2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_1__.findSugarNodeBases)(node.editor)[0]) !== null && _findSugarNodeBases$2 !== void 0 ? _findSugarNodeBases$2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_8__.reject)(), new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_11__.DataDeclarationInitSourceSequenceFactory(_common_FetchFunctions__WEBPACK_IMPORTED_MODULE_12__.FetchFunctions.empty()), context.controlCustomizationContext, context.typesRegistry);
143849
+ const dataDeclarationGenerator = new _DataDeclarationGenerator_DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_10__.DataDeclarationGenerator((_findSugarNodeBases$2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_1__.findSugarNodeBases)(node.editor)[0]) !== null && _findSugarNodeBases$2 !== void 0 ? _findSugarNodeBases$2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_8__.reject)(), new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_11__.DataDeclarationInitSourceSequenceFactory(_common_FetchFunctions__WEBPACK_IMPORTED_MODULE_12__.FetchFunctions.empty()), context.controlCustomizationContext, context.typesRegistry, _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_7__.FormSchemaRng.createEmpty());
143730
143850
  userPicklistDeclarationBuilder.prop(x => x.editorDataDeclaration).set({
143731
143851
  type: "Expression",
143732
143852
  expression: dataDeclarationGenerator.generateDataDeclarationFactory()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.241.0-lazy-loading.2",
3
+ "version": "4.241.0-lazy-loading.6",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,