@kontur.candy/generator 5.87.0 → 5.88.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 +113 -93
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -66658,6 +66658,10 @@ __webpack_require__.r(__webpack_exports__);
66658
66658
 
66659
66659
 
66660
66660
  class AttachmentPathsGenerator {
66661
+ constructor(context) {
66662
+ this.context = void 0;
66663
+ this.context = context;
66664
+ }
66661
66665
  generate(sugarNode) {
66662
66666
  var _getConverterByNodeCl;
66663
66667
  (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_1__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_0__.getNodeClass)(sugarNode))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(`Converter for root node must be defined`);
@@ -66674,7 +66678,7 @@ class AttachmentPathsGenerator {
66674
66678
  return;
66675
66679
  }
66676
66680
  const converter = new converterType(sugarNode);
66677
- yield* converter.getAttachmentPaths();
66681
+ yield* converter.getAttachmentPaths(this.context);
66678
66682
  for (const child of converter.traverseChildren()) {
66679
66683
  yield* this.generateInternal(child);
66680
66684
  }
@@ -72005,6 +72009,10 @@ __webpack_require__.r(__webpack_exports__);
72005
72009
  /* harmony import */ var _markupGenerator_KCLangCalculationsBuildContext__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./markupGenerator/KCLangCalculationsBuildContext */ "./Generator/src/generators/markupGenerator/KCLangCalculationsBuildContext.ts");
72006
72010
  /* harmony import */ var _ServerSideFLangNormalization_NodeTypeInfoHelper__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./ServerSideFLangNormalization/NodeTypeInfoHelper */ "./Generator/src/generators/ServerSideFLangNormalization/NodeTypeInfoHelper.ts");
72007
72011
  /* harmony import */ var _BuildExtendedSchemaInfo__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./BuildExtendedSchemaInfo */ "./Generator/src/generators/BuildExtendedSchemaInfo.ts");
72012
+ /* harmony import */ var _markupGenerator_ElementProcessors_Commons_NodePathsContext__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./markupGenerator/ElementProcessors/Commons/NodePathsContext */ "./Generator/src/generators/markupGenerator/ElementProcessors/Commons/NodePathsContext.ts");
72013
+ /* harmony import */ var _markupGenerator_IMarkupBuildingContext__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./markupGenerator/IMarkupBuildingContext */ "./Generator/src/generators/markupGenerator/IMarkupBuildingContext.ts");
72014
+
72015
+
72008
72016
 
72009
72017
 
72010
72018
 
@@ -72092,7 +72100,8 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
72092
72100
  } = dataDeclarationGenerator.generate();
72093
72101
  const dataDeclarationHelper = new _DataDeclarationGenerator_DataDeclarationGenerationTimeHelper__WEBPACK_IMPORTED_MODULE_26__.DataDeclarationGenerationTimeHelper(dataDeclaration, formSchemaRng);
72094
72102
  const extendedSchemaInfo = (0,_BuildExtendedSchemaInfo__WEBPACK_IMPORTED_MODULE_48__.buildExtendedSchemaInfo)(dataDeclarationHelper);
72095
- const validationGenerator = new _validationGenerator_ValidationGenerator__WEBPACK_IMPORTED_MODULE_16__.ValidationGenerator(sugarRoot, typeRegistry, controlCustomizationContext, formSchemaRng, useSchemaValidations, additionalContent.validationsContent, additionalContent.formJsonSettings);
72103
+ const markupBuilderContext = new _markupGenerator_IMarkupBuildingContext__WEBPACK_IMPORTED_MODULE_50__.MarkupBuildingContext(new _markupGenerator_ElementProcessors_Commons_NodePathsContext__WEBPACK_IMPORTED_MODULE_49__.NodePathsContext(), additionalContent.formSourcesPath, additionalContent.helpersContent, additionalContent.tourSteps, controlCustomizationContext, typeRegistry, formSchemaRng, dataDeclarationHelper, useSchemaValidations);
72104
+ const validationGenerator = new _validationGenerator_ValidationGenerator__WEBPACK_IMPORTED_MODULE_16__.ValidationGenerator(sugarRoot, typeRegistry, markupBuilderContext, controlCustomizationContext, formSchemaRng, useSchemaValidations, additionalContent.validationsContent, additionalContent.formJsonSettings);
72096
72105
  const lazyLoadGenerator = new _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__.LazyLoadDeclarationGenerator(sugarRoot, formSchemaRng);
72097
72106
  const lazyLoadGeneratorResult = lazyLoadGenerator.generate();
72098
72107
  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");
@@ -72113,7 +72122,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
72113
72122
  });
72114
72123
  const formulaAndInitOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_Normalizers_FormulaAndInitOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_41__.FormulaAndInitOnlyNormalizationRuleGenerator(sugarRulesBuilder, formulaRulesBuilder, optionalSectionRuleBuilder, formSchemaRng);
72115
72124
  const autoValueForValueByDefaultNormalizationRuleGenerator = new _ServerSideFLangNormalization_Normalizers_AutoValueForValueByDefaultNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_45__.AutoValueForValueByDefaultNormalizationRuleGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng, dataDeclarationHelper);
72116
- const markupGenerator = new _markupGenerator_MarkupGenerator__WEBPACK_IMPORTED_MODULE_12__.MarkupGenerator(additionalContent.formSourcesPath, additionalContent.helpersContent, additionalContent.tourSteps, controlCustomizationContext, typeRegistry, formSchemaRng, dataDeclarationHelper, useSchemaValidations);
72125
+ const markupGenerator = new _markupGenerator_MarkupGenerator__WEBPACK_IMPORTED_MODULE_12__.MarkupGenerator(markupBuilderContext);
72117
72126
  markupGenerator.generate(sugarRoot, builder);
72118
72127
  builder.addResource("settings.js", (0,_markupGenerator_getSettings__WEBPACK_IMPORTED_MODULE_9__.getSettings)(sugarRoot, additionalContent.gfv, additionalSettings, additionalContent.formJsonSettings));
72119
72128
  builder.addResource("requisiteList.js", (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__.getRequisiteList)(sugarRoot, fetchFunctions));
@@ -72162,7 +72171,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
72162
72171
  builder.addServerSideResource("ServerSide.normalize", resultRules);
72163
72172
  }
72164
72173
  builder.addResource("lazyLoadDeclaration.js", _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__.LazyLoadDeclarationGenerator.convertDeclarationToContent(finalLazyLoadDeclaration));
72165
- const attachmentPathsGenerator = new _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__.AttachmentPathsGenerator();
72174
+ const attachmentPathsGenerator = new _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__.AttachmentPathsGenerator(markupBuilderContext);
72166
72175
  const attachmentPaths = attachmentPathsGenerator.generate(sugarRoot);
72167
72176
  builder.addServerSideResource(`AttachmentPaths.json`, JSON.stringify(attachmentPaths));
72168
72177
  const attachmentPathsWithGfvs = attachmentPathsGenerator.generateWithGfvs(sugarRoot);
@@ -79605,11 +79614,11 @@ class IfConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.Sugar
79605
79614
  const deps = (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_6__.getPathsFromEvaluablePropValue)(condition !== null && condition !== void 0 ? condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)());
79606
79615
  return deps.filter(p => !p.toLegacyPath().startsWith("@")).map(x => evaluatorsContextPathExpression.toCurrentIteration().joinWith(x));
79607
79616
  }
79608
- buildChildrenValidations(validationGenerator) {
79617
+ buildChildrenValidations(validationGenerator, context) {
79609
79618
  var _node$doNotIncludeInV2;
79610
79619
  const node = this.getCurrentNodeAs(_IfNode__WEBPACK_IMPORTED_MODULE_13__.IfNode);
79611
79620
  if ((_node$doNotIncludeInV2 = node.doNotIncludeInValidations) !== null && _node$doNotIncludeInV2 !== void 0 ? _node$doNotIncludeInV2 : false) {
79612
- super.buildChildrenValidations(validationGenerator);
79621
+ super.buildChildrenValidations(validationGenerator, context);
79613
79622
  return;
79614
79623
  }
79615
79624
  if (node.then != undefined) {
@@ -79619,14 +79628,14 @@ class IfConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.Sugar
79619
79628
  const deps = this.getDepsWithResolvedPath(condition, evaluatorsContextPathExpression);
79620
79629
  validationGenerator.pushVisibilityCondition([condition !== null && condition !== void 0 ? condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)(), evaluatorsContextPathExpression, deps]);
79621
79630
  try {
79622
- super.buildChildrenValidations(validationGenerator, Iterator.from(node.then.children));
79631
+ super.buildChildrenValidations(validationGenerator, context, Iterator.from(node.then.children));
79623
79632
  } finally {
79624
79633
  validationGenerator.popVisibilityCondition();
79625
79634
  }
79626
79635
  if (node.else != undefined) {
79627
79636
  validationGenerator.pushVisibilityCondition(["!(" + (condition !== null && condition !== void 0 ? condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)()) + ")", evaluatorsContextPathExpression, this.getDepsWithResolvedPath(condition, evaluatorsContextPathExpression)]);
79628
79637
  try {
79629
- super.buildChildrenValidations(validationGenerator, Iterator.from(node.else.children));
79638
+ super.buildChildrenValidations(validationGenerator, context, Iterator.from(node.else.children));
79630
79639
  } finally {
79631
79640
  validationGenerator.popVisibilityCondition();
79632
79641
  }
@@ -79637,7 +79646,7 @@ class IfConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.Sugar
79637
79646
  const condition = conditionWithDependencies.condition;
79638
79647
  validationGenerator.pushVisibilityCondition([condition !== null && condition !== void 0 ? condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)(), evaluatorsContextPathExpression, this.getDepsWithResolvedPath(condition, evaluatorsContextPathExpression)]);
79639
79648
  try {
79640
- super.buildChildrenValidations(validationGenerator);
79649
+ super.buildChildrenValidations(validationGenerator, context);
79641
79650
  } finally {
79642
79651
  validationGenerator.popVisibilityCondition();
79643
79652
  }
@@ -80155,7 +80164,7 @@ class SwitchConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.S
80155
80164
  const deps = (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_6__.getPathsFromEvaluablePropValue)(condition !== null && condition !== void 0 ? condition : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)());
80156
80165
  return deps.filter(p => !p.toLegacyPath().startsWith("@")).map(x => evaluatorsContextPathExpression.toCurrentIteration().joinWith(x));
80157
80166
  }
80158
- buildChildrenValidations(validationGenerator) {
80167
+ buildChildrenValidations(validationGenerator, context) {
80159
80168
  const node = this.getCurrentNodeAs(_SwitchNode__WEBPACK_IMPORTED_MODULE_14__.SwitchNode);
80160
80169
  const evaluatorsContextPathExpression = this.getEvaluatorsContextPathExpression();
80161
80170
  const prevConditions = [];
@@ -80167,7 +80176,7 @@ class SwitchConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.S
80167
80176
  const deps = this.getDepsWithResolvedPath(currentCaseCondition, evaluatorsContextPathExpression);
80168
80177
  validationGenerator.pushVisibilityCondition([currentCaseCondition, evaluatorsContextPathExpression, deps]);
80169
80178
  try {
80170
- super.buildChildrenValidations(validationGenerator, Iterator.from(caseNode.children));
80179
+ super.buildChildrenValidations(validationGenerator, context, Iterator.from(caseNode.children));
80171
80180
  } finally {
80172
80181
  validationGenerator.popVisibilityCondition();
80173
80182
  }
@@ -80177,7 +80186,7 @@ class SwitchConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.S
80177
80186
  const deps = this.getDepsWithResolvedPath(defaultCondition, evaluatorsContextPathExpression);
80178
80187
  validationGenerator.pushVisibilityCondition([defaultCondition, evaluatorsContextPathExpression, deps]);
80179
80188
  try {
80180
- super.buildChildrenValidations(validationGenerator, Iterator.from(node.default.children));
80189
+ super.buildChildrenValidations(validationGenerator, context, Iterator.from(node.default.children));
80181
80190
  } finally {
80182
80191
  validationGenerator.popVisibilityCondition();
80183
80192
  }
@@ -83802,7 +83811,7 @@ class UserPicklistConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE
83802
83811
  const kcXmlValidationConfiguratorFunction = kcXmlValidationGenerator.generateConfigurationFunction((_mathContainerFromSug = (_mathContainerFromSug2 = mathContainerFromSugar.conditions) === null || _mathContainerFromSug2 === void 0 ? void 0 : _mathContainerFromSug2.items) !== null && _mathContainerFromSug !== void 0 ? _mathContainerFromSug : [], {
83803
83812
  skipNotSupportedFunction: true
83804
83813
  });
83805
- const validationGenerator = new _validationGenerator_ValidationGenerator__WEBPACK_IMPORTED_MODULE_6__.ValidationGenerator(sugarRoot, typeRegistry, context.controlCustomizationContext, formSchemaRng, false);
83814
+ const validationGenerator = new _validationGenerator_ValidationGenerator__WEBPACK_IMPORTED_MODULE_6__.ValidationGenerator(sugarRoot, typeRegistry, context, context.controlCustomizationContext, formSchemaRng, false);
83806
83815
  userPicklistDeclarationBuilder.prop(x => x.editorValidations).set({
83807
83816
  type: "Expression",
83808
83817
  expression: validationGenerator.generateValidationsFactory()
@@ -96294,44 +96303,42 @@ class FileLoaderConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4
96294
96303
  static getAcceptNodeClass() {
96295
96304
  return _FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode;
96296
96305
  }
96297
- *getAttachmentPaths() {
96306
+ *getAttachmentPaths(context) {
96298
96307
  const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96299
- const multiple = !node.single;
96300
- if (multiple) {
96308
+ const multipleNode = !node.single;
96309
+ if (multipleNode) {
96301
96310
  yield node.getFullPath().joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.PathTokens.each).joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath);
96302
96311
  } else {
96303
96312
  yield node.getFullPath().joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath);
96304
96313
  }
96305
96314
  }
96306
- doBuildNodeValidations(validationGenerator) {
96315
+ doBuildNodeValidations(validationGenerator, context) {
96307
96316
  const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96317
+ const multipleNode = !node.single;
96308
96318
  validationGenerator.processValidations(this.getResolvedBindingPath(node), node.validationInfo.optional, validationGenerator.getTypeNode(node.validationInfo), undefined, node.validationInfo.emptydescription, {
96309
- multiple: !node.single
96319
+ multiple: multipleNode
96310
96320
  });
96311
96321
  }
96312
96322
  doBuildDataDeclaration(context) {
96313
96323
  const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96314
96324
  return context.mergeDataDeclaration(context.addPathSectionDeclarationEntry(node), context.addVisibilityPathDeclEntryNew(node), this.addAttachmentPathDeclEntry(context, node));
96315
96325
  }
96316
- buildChildrenDataDeclaration(context) {
96326
+ buildChildrenDataDeclaration() {
96317
96327
  return _DataDeclarationGenerator_DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_2__.emptyDataDeclarationCollection;
96318
96328
  }
96319
96329
  *doTraverseChildren() {
96320
96330
  // no children
96321
96331
  }
96322
96332
  doConvert(context) {
96323
- var _context$getTypeNode;
96324
96333
  const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96325
- if (node.multiple) {
96334
+ const multipleNode = !node.single;
96335
+ if (multipleNode) {
96326
96336
  this.ensurePathExists(node, node.path);
96327
96337
  }
96328
- const attachmentType = (_context$getTypeNode = context.getTypeNode(node)) === null || _context$getTypeNode === void 0 ? void 0 : _context$getTypeNode.children.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.AttachmentsTypeCheckNode));
96329
- if (attachmentType == undefined) {
96330
- throw new _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_0__.SugarAttributeReadError(`Failed generate fileloader without 'attachments' type node`, node, "type");
96331
- }
96338
+ const attachmentType = this.selectAttachmentTypeNode(context);
96332
96339
  const mb = (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_3__.componentMarkupBuilder)("FileLoader");
96333
96340
  mb.prop(x => x.bindingPath).set((0,_getBindingPath__WEBPACK_IMPORTED_MODULE_5__.getNewBindingPathExpression)(node));
96334
- mb.prop(x => x.multiple).set(!node.single);
96341
+ mb.prop(x => x.multiple).set(multipleNode);
96335
96342
  mb.prop(x => x.count).set(attachmentType.count);
96336
96343
  mb.prop(x => x.countExceededDescription).set(attachmentType.countExceededDescription);
96337
96344
  // @ts-ignore
@@ -96368,16 +96375,16 @@ class FileLoaderConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4
96368
96375
  }
96369
96376
  return mb.buildConverterResult();
96370
96377
  }
96371
- addAttachmentPathDeclEntry(context, fileLoader) {
96372
- var _context$getTypeNode2;
96373
- const attachmentType = (_context$getTypeNode2 = context.getTypeNode(fileLoader)) === null || _context$getTypeNode2 === void 0 ? void 0 : _context$getTypeNode2.children.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.AttachmentsTypeCheckNode));
96374
- const fileLoaderPath = (0,_getBindingPath__WEBPACK_IMPORTED_MODULE_5__.getNewBindingPathExpression)(fileLoader);
96375
- const additionalPath = fileLoader.single ? (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.emptyModelPath)().joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath) : (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.emptyModelPath)().joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.PathTokens.each).joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath);
96378
+ addAttachmentPathDeclEntry(context, node) {
96379
+ var _context$getTypeNode;
96380
+ const attachmentType = (_context$getTypeNode = context.getTypeNode(node)) === null || _context$getTypeNode === void 0 ? void 0 : _context$getTypeNode.children.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.AttachmentsTypeCheckNode));
96381
+ const fileLoaderPath = (0,_getBindingPath__WEBPACK_IMPORTED_MODULE_5__.getNewBindingPathExpression)(node);
96382
+ const additionalPath = node.single ? (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.emptyModelPath)().joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath) : (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.emptyModelPath)().joinWith(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.PathTokens.each).joinWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_7__.AttachmentInfoPath);
96376
96383
  return context.mergeDataDeclaration({
96377
96384
  [fileLoaderPath.toLegacyPath()]: {
96378
96385
  fnsConvertFileExtentions: attachmentType === null || attachmentType === void 0 ? void 0 : attachmentType.fnsConvertFileExtentions
96379
96386
  }
96380
- }, context.addChildPathSectionDeclarationEntry(fileLoader, additionalPath, false));
96387
+ }, context.addChildPathSectionDeclarationEntry(node, additionalPath, false));
96381
96388
  }
96382
96389
  convertChildren(context, nodes = []) {
96383
96390
  return nodes.map(node => {
@@ -96394,6 +96401,26 @@ class FileLoaderConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_4
96394
96401
  return context.convertChildNodes([node]);
96395
96402
  });
96396
96403
  }
96404
+
96405
+ // @ts-expect-error NOTE: метoд оставлен т.к. понадобится при рефакторнге FileLoader
96406
+ isMultipleFilesLoadingAllowed(context) {
96407
+ const attachmentType = this.selectAttachmentTypeNode(context);
96408
+ const singleFileLoadingRequired = attachmentType.count === 1;
96409
+ return !singleFileLoadingRequired;
96410
+ }
96411
+ selectAttachmentTypeNode(context) {
96412
+ var _context$getTypeNode2;
96413
+ const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96414
+ const attachmentTypeNode = (_context$getTypeNode2 = context.getTypeNode(node)) === null || _context$getTypeNode2 === void 0 ? void 0 : _context$getTypeNode2.children.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_1__.AttachmentsTypeCheckNode));
96415
+ this.ensureAttachmentTypeDefined(attachmentTypeNode);
96416
+ return attachmentTypeNode;
96417
+ }
96418
+ ensureAttachmentTypeDefined(attachmentTypeNode) {
96419
+ const node = this.getCurrentNodeAs(_FileLoaderNode__WEBPACK_IMPORTED_MODULE_10__.FileLoaderNode);
96420
+ if (attachmentTypeNode == undefined) {
96421
+ throw new _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_0__.SugarAttributeReadError(`Failed generate fileloader without 'attachments' type node`, node, "type");
96422
+ }
96423
+ }
96397
96424
  }
96398
96425
 
96399
96426
  /***/ }),
@@ -96420,8 +96447,9 @@ __webpack_require__.r(__webpack_exports__);
96420
96447
  /* harmony import */ var _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Serializer/SugarNodeWithLegacyVisibility */ "./Generator/src/generators/markupGenerator/Serializer/SugarNodeWithLegacyVisibility.ts");
96421
96448
  /* harmony import */ var _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
96422
96449
  /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
96423
- /* harmony import */ var _FileLoader_MenuNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./FileLoader/MenuNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader/FileLoader/MenuNode.ts");
96424
- /* harmony import */ var _FileLoader_ViewFileNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FileLoader/ViewFileNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader/FileLoader/ViewFileNode.ts");
96450
+ /* harmony import */ var _Serializer_DeprecationReason__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../Serializer/DeprecationReason */ "./Generator/src/generators/markupGenerator/Serializer/DeprecationReason.ts");
96451
+ /* harmony import */ var _FileLoader_MenuNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FileLoader/MenuNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader/FileLoader/MenuNode.ts");
96452
+ /* harmony import */ var _FileLoader_ViewFileNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./FileLoader/ViewFileNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader/FileLoader/ViewFileNode.ts");
96425
96453
 
96426
96454
 
96427
96455
 
@@ -96433,7 +96461,8 @@ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class
96433
96461
 
96434
96462
 
96435
96463
 
96436
- let FileLoaderNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.sugarNode)("fileloader", `Загрузка файлов в форму`, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrMixin)(_CommonNodeProperties_ValidationInfoNode__WEBPACK_IMPORTED_MODULE_4__.ValidationInfoNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("type", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.typeName, "Тип для валидации значений"), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("path", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.string, `Относительный путь по которому будут храниться аттачменты. Указывается относительно каталога sugar`), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("width", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.number, `Ширина контрола`), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("single", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.boolean, `Подразумевает возможность загрузить только 1 файл`), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("multiple", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.boolean, `Подразумевает возможность загрузить только 1 файл`), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("viewfile", [_FileLoader_ViewFileNode__WEBPACK_IMPORTED_MODULE_9__.ViewFileNode]), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("menu", [_FileLoader_MenuNode__WEBPACK_IMPORTED_MODULE_8__.MenuNode]), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("type", [_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_3__.TypeNode]), _dec(_class = (_class2 = class FileLoaderNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_5__.SugarNodeWithLegacyVisibility {
96464
+
96465
+ let FileLoaderNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.sugarNode)("fileloader", `Загрузка файлов в форму`, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/FileLoader sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrMixin)(_CommonNodeProperties_ValidationInfoNode__WEBPACK_IMPORTED_MODULE_4__.ValidationInfoNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("type", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.typeName, "Тип для валидации значений"), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("path", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.string, `Относительный путь по которому будут храниться аттачменты. Указывается относительно каталога sugar`), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("width", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.number, `Ширина контрола`), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attr)("single", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.attrType.boolean.default(false), `Подразумевает возможность загрузить только 1 файл`), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.deprecatedAttr)("multiple", _Serializer_DeprecationReason__WEBPACK_IMPORTED_MODULE_8__.DeprecationReason.Removed), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("viewfile", [_FileLoader_ViewFileNode__WEBPACK_IMPORTED_MODULE_10__.ViewFileNode]), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("menu", [_FileLoader_MenuNode__WEBPACK_IMPORTED_MODULE_9__.MenuNode]), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_6__.singleChild)("type", [_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_3__.TypeNode]), _dec(_class = (_class2 = class FileLoaderNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_5__.SugarNodeWithLegacyVisibility {
96437
96466
  constructor(...args) {
96438
96467
  super(...args);
96439
96468
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "validationInfo", _descriptor, this);
@@ -102327,6 +102356,14 @@ __webpack_require__.r(__webpack_exports__);
102327
102356
  /* harmony import */ var _Common_FormActionHandlers_ContextualActionNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/FormActionHandlers/ContextualActionNames */ "./Common/FormActionHandlers/ContextualActionNames.ts");
102328
102357
  /* harmony import */ var _ConverterResults_ConverterResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ConverterResults/ConverterResult */ "./Generator/src/generators/markupGenerator/ConverterResults/ConverterResult.ts");
102329
102358
  /* harmony import */ var _ConverterResults_ModuleDescriptor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ConverterResults/ModuleDescriptor */ "./Generator/src/generators/markupGenerator/ConverterResults/ModuleDescriptor.ts");
102359
+ /* harmony import */ var _getBindingPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
102360
+ /* harmony import */ var _AllConverters__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
102361
+ /* harmony import */ var _ElementProcessors_Commons_CustomControlConverter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ElementProcessors/Commons/CustomControlConverter */ "./Generator/src/generators/markupGenerator/ElementProcessors/Commons/CustomControlConverter.ts");
102362
+ /* harmony import */ var _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
102363
+
102364
+
102365
+
102366
+
102330
102367
 
102331
102368
 
102332
102369
 
@@ -102335,8 +102372,7 @@ __webpack_require__.r(__webpack_exports__);
102335
102372
 
102336
102373
 
102337
102374
  class MarkupBuildingContext {
102338
- constructor(convertNode, nodeContext, formSourcesPath, helpers, tourSteps, controlCustomizationContext, typesRegistry, schemaRng, dataDeclarationHelper, useSchemaValidations) {
102339
- this.convertNode = void 0;
102375
+ constructor(nodeContext, formSourcesPath, helpers, tourSteps, controlCustomizationContext, typesRegistry, schemaRng, dataDeclarationHelper, useSchemaValidations) {
102340
102376
  this.formSourcesPath = void 0;
102341
102377
  this.helpers = void 0;
102342
102378
  this.pathsContext = void 0;
@@ -102351,7 +102387,6 @@ class MarkupBuildingContext {
102351
102387
  this.schemaRng = schemaRng;
102352
102388
  this.useSchemaValidations = useSchemaValidations;
102353
102389
  this.typesRegistry = typesRegistry;
102354
- this.convertNode = convertNode;
102355
102390
  this.formSourcesPath = formSourcesPath;
102356
102391
  this.pathsContext = nodeContext;
102357
102392
  this.controlCustomizationContext = controlCustomizationContext;
@@ -102446,6 +102481,28 @@ class MarkupBuildingContext {
102446
102481
  getTypeNodeLegacy(childNode) {
102447
102482
  return this.typesRegistry.getTypeNodeLegacy(childNode);
102448
102483
  }
102484
+ convertNode(sugarNode) {
102485
+ if (!sugarNode) {
102486
+ return new _ConverterResults_ConverterResult__WEBPACK_IMPORTED_MODULE_5__.ConverterResult();
102487
+ }
102488
+ const controlConverterClass = (0,_AllConverters__WEBPACK_IMPORTED_MODULE_8__.getConverterByNodeClass)((0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_10__.getNodeClass)(sugarNode));
102489
+ if (controlConverterClass == undefined) {
102490
+ if (sugarNode instanceof _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_10__.UnknownSugarNode) {
102491
+ const customizationInfo = this.controlCustomizationContext.tryGetCustomRegularControl(sugarNode.name);
102492
+ if (customizationInfo != undefined) {
102493
+ const sourceXmlNode = sugarNode.sourceXmlNode;
102494
+ if (sourceXmlNode.hasAttribute("path")) {
102495
+ this.addPathsToContext([(0,_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getNewBindingPathExpression)(sugarNode)]);
102496
+ }
102497
+ const converterResult = (0,_ElementProcessors_Commons_CustomControlConverter__WEBPACK_IMPORTED_MODULE_9__.customControlConverter)(sugarNode, customizationInfo);
102498
+ return converterResult;
102499
+ }
102500
+ }
102501
+ throw new _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_3__.SugarAttributeReadError("Cannot find converter for node " + sugarNode.sourceXmlNode.name, sugarNode.sourceXmlNode, "");
102502
+ }
102503
+ const converter = new controlConverterClass(sugarNode);
102504
+ return converter.convert(this);
102505
+ }
102449
102506
  }
102450
102507
 
102451
102508
  /***/ }),
@@ -102773,60 +102830,20 @@ __webpack_require__.r(__webpack_exports__);
102773
102830
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
102774
102831
  /* harmony export */ MarkupGenerator: () => (/* binding */ MarkupGenerator)
102775
102832
  /* harmony export */ });
102776
- /* harmony import */ var _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../common/XmlParser/XmlNode */ "./Generator/src/common/XmlParser/XmlNode.ts");
102777
- /* harmony import */ var _getBindingPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
102778
- /* harmony import */ var _AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
102779
- /* harmony import */ var _ConverterResults_ConverterResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ConverterResults/ConverterResult */ "./Generator/src/generators/markupGenerator/ConverterResults/ConverterResult.ts");
102780
- /* harmony import */ var _ConverterResults_ConverterResultJsxGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ConverterResults/ConverterResultJsxGenerator */ "./Generator/src/generators/markupGenerator/ConverterResults/ConverterResultJsxGenerator.ts");
102781
- /* harmony import */ var _IMarkupBuildingContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./IMarkupBuildingContext */ "./Generator/src/generators/markupGenerator/IMarkupBuildingContext.ts");
102782
- /* harmony import */ var _ElementProcessors_Commons_CustomControlConverter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ElementProcessors/Commons/CustomControlConverter */ "./Generator/src/generators/markupGenerator/ElementProcessors/Commons/CustomControlConverter.ts");
102783
- /* harmony import */ var _ElementProcessors_Commons_NodePathsContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ElementProcessors/Commons/NodePathsContext */ "./Generator/src/generators/markupGenerator/ElementProcessors/Commons/NodePathsContext.ts");
102784
- /* harmony import */ var _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
102785
-
102786
-
102787
-
102788
-
102789
-
102790
-
102791
-
102792
-
102833
+ /* harmony import */ var _ConverterResults_ConverterResultJsxGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ConverterResults/ConverterResultJsxGenerator */ "./Generator/src/generators/markupGenerator/ConverterResults/ConverterResultJsxGenerator.ts");
102793
102834
 
102794
102835
  class MarkupGenerator {
102795
- constructor(formSourcesPath, helpers, tourSteps, controlCustomizationContext, typesRegistry, schemaRng, dataDeclarationHelper, useSchemaValidations) {
102796
- this.controlCustomizationContext = void 0;
102836
+ constructor(markupBuilderContext) {
102797
102837
  this.markupBuilderContext = void 0;
102798
- this.convertNode = sugarNode => {
102799
- if (!sugarNode) {
102800
- return new _ConverterResults_ConverterResult__WEBPACK_IMPORTED_MODULE_3__.ConverterResult();
102801
- }
102802
- const controlConverterClass = (0,_AllConverters__WEBPACK_IMPORTED_MODULE_2__.getConverterByNodeClass)((0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_8__.getNodeClass)(sugarNode));
102803
- if (controlConverterClass == undefined) {
102804
- if (sugarNode instanceof _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_8__.UnknownSugarNode) {
102805
- const customizationInfo = this.controlCustomizationContext.tryGetCustomRegularControl(sugarNode.name);
102806
- if (customizationInfo != undefined) {
102807
- const sourceXmlNode = sugarNode.sourceXmlNode;
102808
- if (sourceXmlNode.hasAttribute("path")) {
102809
- this.markupBuilderContext.addPathsToContext([(0,_getBindingPath__WEBPACK_IMPORTED_MODULE_1__.getNewBindingPathExpression)(sugarNode)]);
102810
- }
102811
- const converterResult = (0,_ElementProcessors_Commons_CustomControlConverter__WEBPACK_IMPORTED_MODULE_6__.customControlConverter)(sugarNode, customizationInfo);
102812
- return converterResult;
102813
- }
102814
- }
102815
- throw new _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_0__.SugarAttributeReadError("Cannot find converter for node " + sugarNode.sourceXmlNode.name, sugarNode.sourceXmlNode, "");
102816
- }
102817
- const converter = new controlConverterClass(sugarNode);
102818
- return converter.convert(this.markupBuilderContext);
102819
- };
102820
- this.controlCustomizationContext = controlCustomizationContext;
102821
- this.markupBuilderContext = new _IMarkupBuildingContext__WEBPACK_IMPORTED_MODULE_5__.MarkupBuildingContext(this.convertNode, new _ElementProcessors_Commons_NodePathsContext__WEBPACK_IMPORTED_MODULE_7__.NodePathsContext(), formSourcesPath, helpers, tourSteps, this.controlCustomizationContext, typesRegistry, schemaRng, dataDeclarationHelper, useSchemaValidations);
102838
+ this.markupBuilderContext = markupBuilderContext;
102822
102839
  }
102823
102840
  generate(sugarRoot, builder) {
102824
102841
  const formNode = sugarRoot;
102825
- const converterResult = this.convertNode(formNode);
102842
+ const converterResult = this.markupBuilderContext.convertNode(formNode);
102826
102843
  for (const context of converterResult.getContexts()) {
102827
102844
  const contextName = context.name;
102828
102845
  converterResult.getDependenciesContent(contextName, builder);
102829
- const converterResultJsx = _ConverterResults_ConverterResultJsxGenerator__WEBPACK_IMPORTED_MODULE_4__.ConverterResultJsxGenerator.generateJsx(contextName, converterResult, builder);
102846
+ const converterResultJsx = _ConverterResults_ConverterResultJsxGenerator__WEBPACK_IMPORTED_MODULE_0__.ConverterResultJsxGenerator.generateJsx(contextName, converterResult, builder);
102830
102847
  builder.addComponent(`${context.dirName}/${contextName}.jsx`, unescape(converterResultJsx.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2")), false);
102831
102848
  }
102832
102849
  }
@@ -104399,11 +104416,11 @@ class SugarNodeConverterBase {
104399
104416
  var _this$node$parent;
104400
104417
  return (0,_getBindingPath__WEBPACK_IMPORTED_MODULE_6__.getNewBindingPathExpression)((_this$node$parent = this.node.parent) !== null && _this$node$parent !== void 0 ? _this$node$parent : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)());
104401
104418
  }
104402
- buildValidations(validationGenerator) {
104403
- this.doBuildNodeValidations(validationGenerator);
104404
- this.buildChildrenValidations(validationGenerator);
104419
+ buildValidations(validationGenerator, context) {
104420
+ this.doBuildNodeValidations(validationGenerator, context);
104421
+ this.buildChildrenValidations(validationGenerator, context);
104405
104422
  }
104406
- *getAttachmentPaths() {
104423
+ *getAttachmentPaths(context) {
104407
104424
  // no paths by default
104408
104425
  }
104409
104426
  *getAttachmentPathsWithGfvs() {
@@ -104424,7 +104441,7 @@ class SugarNodeConverterBase {
104424
104441
  }
104425
104442
  return result;
104426
104443
  }
104427
- doBuildNodeValidations(validationGenerator) {
104444
+ doBuildNodeValidations(validationGenerator, context) {
104428
104445
  // noop
104429
104446
  }
104430
104447
  getResolvedBindingPath(node) {
@@ -104493,7 +104510,7 @@ class SugarNodeConverterBase {
104493
104510
  }
104494
104511
  return SugarNodeConverterBase.deserializeNodeAs(nodeClass, sourceXmlNode !== null && sourceXmlNode !== void 0 ? sourceXmlNode : this.node);
104495
104512
  }
104496
- buildChildrenValidations(validationGenerator, children) {
104513
+ buildChildrenValidations(validationGenerator, context, children) {
104497
104514
  for (const child of children !== null && children !== void 0 ? children : this.doTraverseChildren()) {
104498
104515
  const controlConverterClass = (0,_AllConverters__WEBPACK_IMPORTED_MODULE_7__.getConverterByNodeClass)((0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_11__.getNodeClass)(child));
104499
104516
  if (controlConverterClass == undefined) {
@@ -104517,7 +104534,7 @@ class SugarNodeConverterBase {
104517
104534
  // );
104518
104535
  }
104519
104536
  const converter = new controlConverterClass(child);
104520
- converter.buildValidations(validationGenerator);
104537
+ converter.buildValidations(validationGenerator, context);
104521
104538
  }
104522
104539
  }
104523
104540
  buildChildrenKCLangValidations(buildContext, formSchemaRng, children) {
@@ -105906,7 +105923,8 @@ class AttachmentsValueValidatorGenerator extends _TypeBasedValidatorGenerator__W
105906
105923
  const result = (0,_common_CodeGeneration_ClassInstanceBuilder__WEBPACK_IMPORTED_MODULE_0__.instanceBuilder)("Validators.AttachmentsValueValidator");
105907
105924
  result.set(0, {
105908
105925
  extentions: attachmentNode.extentions || [],
105909
- maxSize: attachmentNode.maxSize || 0
105926
+ maxSize: attachmentNode.maxSize || 0,
105927
+ multiple: attachmentNode.count !== 1
105910
105928
  });
105911
105929
  result.set(1, (_attachmentNode$check = attachmentNode.checkType) !== null && _attachmentNode$check !== void 0 ? _attachmentNode$check : "error");
105912
105930
  result.set(2, attachmentNode.description);
@@ -106095,7 +106113,7 @@ __webpack_require__.r(__webpack_exports__);
106095
106113
 
106096
106114
 
106097
106115
  class ValidationGenerator {
106098
- constructor(sugarRoot, typesRegistry, controlCustomizationContext, schemaRng, useSchemaValidations, validationsContent = [], settings = undefined) {
106116
+ constructor(sugarRoot, typesRegistry, markupBuilderContext, controlCustomizationContext, schemaRng, useSchemaValidations, validationsContent = [], settings = undefined) {
106099
106117
  this.typeBasedValidatorGenerators = [_TypeBasedValidatorGenerators_AttachmentsValueValidatorGenerator__WEBPACK_IMPORTED_MODULE_9__.AttachmentsValueValidatorGenerator, _TypeBasedValidatorGenerators_CustomValidationValueValidatorGenerator__WEBPACK_IMPORTED_MODULE_10__.CustomValidationValueValidatorGenerator];
106100
106118
  this.sugarRoot = void 0;
106101
106119
  this.validationsContent = void 0;
@@ -106103,6 +106121,7 @@ class ValidationGenerator {
106103
106121
  this.typesRegistry = void 0;
106104
106122
  this.validations = void 0;
106105
106123
  this.schemaRng = void 0;
106124
+ this.markupBuilderContext = void 0;
106106
106125
  this.controlCustomizationContext = void 0;
106107
106126
  this.useSchemaValidations = void 0;
106108
106127
  this.criterionOfExistenceFromSchemaRng = [];
@@ -106111,6 +106130,7 @@ class ValidationGenerator {
106111
106130
  this.sugarRoot = sugarRoot;
106112
106131
  this.typesRegistry = typesRegistry;
106113
106132
  this.validationsContent = validationsContent;
106133
+ this.markupBuilderContext = markupBuilderContext;
106114
106134
  this.controlCustomizationContext = controlCustomizationContext;
106115
106135
  this.useSchemaValidations = useSchemaValidations;
106116
106136
  this.customValidations = {};
@@ -106161,7 +106181,7 @@ class ValidationGenerator {
106161
106181
  const sugarNode = this.sugarRoot;
106162
106182
  const converterType = (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_6__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_4__.getNodeClass)(sugarNode))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(`Converter for root node must be defined`);
106163
106183
  const converter = new converterType(sugarNode);
106164
- converter.buildValidations(this);
106184
+ converter.buildValidations(this, this.markupBuilderContext);
106165
106185
  let result = `
106166
106186
  function validationFunctions({ Engine: { ValidationHelper, Validators }, ap, PathTokens, current, each, kcLangUtils }) {
106167
106187
  const t = str => x => x.translate(str);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.87.0",
3
+ "version": "5.88.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,