@kontur.candy/generator 4.292.0 → 4.293.0-data-declaration-paths.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 +195 -61
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -127025,13 +127025,19 @@ class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGenerato
127025
127025
  var _ref;
127026
127026
 
127027
127027
  const compiledFormulas = (_ref = formulas !== null && formulas !== void 0 ? formulas : []) === null || _ref === void 0 ? void 0 : _ref.map(x => this.compileFormula(x));
127028
- const compiledAggregationFunctions = this.compileAggregationDependencies(compiledFormulas.map(x => x.dependencies).flat());
127028
+ const {
127029
+ compiledAggregationFunctions,
127030
+ aggregationPaths
127031
+ } = this.compileAggregationDependencies(compiledFormulas.map(x => x.dependencies).flat());
127029
127032
  const indent = " ";
127030
127033
  const allItemsText = compiledFormulas.map(x => x.compiledFunction).concat(compiledAggregationFunctions).map(x => `${indent}form.calculator2.addCalculationFunction(${x});`).join("\n");
127031
127034
  const finalText = allItemsText.length > 0 ? `\n${allItemsText}\n` : "";
127032
127035
  const result = `export default function kcXmlAutoCalculationConfigurator (
127033
127036
  { form, ap, CalculationFunction , KCCalculation, KCSumCalculation, KCCountCalculation, PathTokens }) {${finalText}}`;
127034
- return result;
127037
+ return {
127038
+ result: result,
127039
+ aggregationPaths: aggregationPaths
127040
+ };
127035
127041
  }
127036
127042
 
127037
127043
  compileAllItemsIsEmptyCheckBlock(innerExpression, deps) {
@@ -129757,28 +129763,7 @@ class DataDeclarationGenerator {
129757
129763
  const dataDeclaration = converter.buildDataDeclaration(context);
129758
129764
  this.enrichWithSchemaRng(dataDeclaration);
129759
129765
  const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
129760
- const result = this.replaceHolder(`
129761
- export default function dataDeclaration({
129762
- Helpers: {
129763
- autocalcCommonFunctions: {
129764
- getAsyncResultHandler,
129765
- getAsyncTextResultHandler,
129766
- wrapDecimalOperand,
129767
- getSum,
129768
- checkValuesArguments,
129769
- getAsyncBoolResultHandler,
129770
- getAsyncErrorResultHandler,
129771
- getOperands,
129772
- Deferred,
129773
- },
129774
- },
129775
- }) {
129776
- return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
129777
- space: " "
129778
- })};
129779
- };`);
129780
129766
  return {
129781
- dataDeclarationContent: unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2")),
129782
129767
  dataDeclaration: orderedDataDeclaration
129783
129768
  };
129784
129769
  }
@@ -129863,6 +129848,21 @@ class DataDeclarationGenerator {
129863
129848
  return replacedDecl;
129864
129849
  }
129865
129850
 
129851
+ convertPathsToDataDeclaration(paths) {
129852
+ return paths.reduce((acc, path) => {
129853
+ const sequence = [{
129854
+ model: true,
129855
+ calcPath: true
129856
+ }];
129857
+ const modelPath = path.startsWith("/") ? path.substring(1) : path;
129858
+ const pathDataDeclaration = {
129859
+ value: sequence
129860
+ };
129861
+ acc[modelPath] = pathDataDeclaration;
129862
+ return acc;
129863
+ }, {});
129864
+ }
129865
+
129866
129866
  }
129867
129867
 
129868
129868
  /***/ }),
@@ -129959,6 +129959,111 @@ class DataDeclarationInitSourceSequenceFactory {
129959
129959
 
129960
129960
  /***/ }),
129961
129961
 
129962
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationResourcesGenerator.ts":
129963
+ /*!************************************************************************************************!*\
129964
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationResourcesGenerator.ts ***!
129965
+ \************************************************************************************************/
129966
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
129967
+
129968
+ "use strict";
129969
+ __webpack_require__.r(__webpack_exports__);
129970
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
129971
+ /* harmony export */ "DataDeclarationResourcesGenerator": () => (/* binding */ DataDeclarationResourcesGenerator)
129972
+ /* harmony export */ });
129973
+ /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serialize-javascript */ "./node_modules/serialize-javascript/index.js");
129974
+ /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(serialize_javascript__WEBPACK_IMPORTED_MODULE_0__);
129975
+ /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
129976
+ /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
129977
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
129978
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
129979
+ /* harmony import */ var _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DataDeclarationGenerationContext */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts");
129980
+ /* harmony import */ var _DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./DataDeclarationGenerator */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerator.ts");
129981
+
129982
+
129983
+
129984
+
129985
+
129986
+
129987
+
129988
+ class DataDeclarationResourcesGenerator extends _DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_6__.DataDeclarationGenerator {
129989
+ constructor(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations, formulas, aggregationPaths) {
129990
+ super(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations);
129991
+ this.formulas = void 0;
129992
+ this.aggregationPaths = void 0;
129993
+ this.formulas = formulas;
129994
+ this.aggregationPaths = aggregationPaths;
129995
+ }
129996
+
129997
+ generate() {
129998
+ var _getConverterByNodeCl;
129999
+
130000
+ const converterClass = (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_1__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.reject)();
130001
+ const converter = new converterClass(this.sugarRoot);
130002
+ const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_5__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry, this.formSchemaRng, this.schemeValidations);
130003
+ let additionalPaths = {};
130004
+ const dataDeclaration = converter.buildDataDeclaration(context);
130005
+
130006
+ if (this.formulas.length > 0) {
130007
+ const formulasPaths = this.extractFormulasPaths();
130008
+ additionalPaths = Object.assign(additionalPaths, formulasPaths);
130009
+ }
130010
+
130011
+ if (this.aggregationPaths.length > 0) {
130012
+ const aggregationPaths = this.extractAggregationPaths();
130013
+ additionalPaths = Object.assign(additionalPaths, aggregationPaths);
130014
+ }
130015
+
130016
+ const allDataDeclarationPaths = Object.assign(additionalPaths, dataDeclaration);
130017
+ this.enrichWithSchemaRng(allDataDeclarationPaths);
130018
+ const orderedDataDeclaration = this.sortDataDeclarationKeys(allDataDeclarationPaths);
130019
+ const result = this.replaceHolder(`
130020
+ export default function dataDeclaration({
130021
+ Helpers: {
130022
+ autocalcCommonFunctions: {
130023
+ getAsyncResultHandler,
130024
+ getAsyncTextResultHandler,
130025
+ wrapDecimalOperand,
130026
+ getSum,
130027
+ checkValuesArguments,
130028
+ getAsyncBoolResultHandler,
130029
+ getAsyncErrorResultHandler,
130030
+ getOperands,
130031
+ Deferred,
130032
+ },
130033
+ },
130034
+ }) {
130035
+ return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
130036
+ space: " "
130037
+ })};
130038
+ };`);
130039
+ return {
130040
+ dataDeclarationContent: unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2")),
130041
+ dataDeclaration: orderedDataDeclaration
130042
+ };
130043
+ }
130044
+
130045
+ extractAggregationPaths() {
130046
+ const paths = this.aggregationPaths.map(path => path.toLegacyPath());
130047
+ return this.convertPathsToDataDeclaration(paths);
130048
+ }
130049
+
130050
+ extractFormulasPaths() {
130051
+ const paths = this.formulas.map(formula => {
130052
+ const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__.createFromMask)(this.removeAttributePrefix(formula.match), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__.PathTokens.each).toAbsolute();
130053
+ const target = this.formSchemaRng.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__.createFromMask)(this.removeAttributePrefix(formula.target), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__.PathTokens.each)).normalize()).toString();
130054
+ return target;
130055
+ }).flat();
130056
+ return this.convertPathsToDataDeclaration(paths);
130057
+ }
130058
+
130059
+ removeAttributePrefix(pathPart) {
130060
+ return pathPart.replace(/\@/g, "");
130061
+ }
130062
+
130063
+ }
130064
+
130065
+ /***/ }),
130066
+
129962
130067
  /***/ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts":
129963
130068
  /*!****************************************************************!*\
129964
130069
  !*** ./Generator/src/generators/DataSchema/DataSchemaUtils.ts ***!
@@ -131022,7 +131127,7 @@ class KCXmlGeneratorBase {
131022
131127
  }
131023
131128
 
131024
131129
  compileAggregationDependencies(dependencies) {
131025
- const resultItems = dependencies.filter(isAggregationDependencyModelPath).map(dep => this.getAggregationPaths(dep.restModelPath).map(x => {
131130
+ const resultItems = Iterator.from(dependencies).filter(isAggregationDependencyModelPath).map(dep => this.getAggregationPaths(dep.restModelPath).map(x => {
131026
131131
  switch (dep.type) {
131027
131132
  case "Sum":
131028
131133
  return [this.createDependency(dep.prefixModelPath, x, "Sum"), this.createDependency(dep.prefixModelPath, x, "Count")];
@@ -131036,17 +131141,30 @@ class KCXmlGeneratorBase {
131036
131141
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Not supported aggregation dependency: ${dep.type}`);
131037
131142
  }
131038
131143
  }
131039
- })).flat(2);
131144
+ })).toArray().flat(2);
131040
131145
  const distinctiveItems = Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__.IterUtils.distinctBy(resultItems, x => x.aggPath.toLegacyPath()));
131041
- const sumCompiledFunctions = distinctiveItems.map(x => {
131146
+ const {
131147
+ compiledAggregationFunctions,
131148
+ aggregationPaths
131149
+ } = distinctiveItems.reduce((acc, x) => {
131150
+ const aggrPath = x.aggPath;
131042
131151
  const compiledDep = this.modelPathInstance(x.dependencyPath.toCurrentIteration());
131043
- const compiledAggPath = this.modelPathInstance(x.aggPath);
131044
- const compiledCountPath = this.modelPathInstance(x.aggPath.getParentPath().joinWith("Count").toCurrentIteration());
131152
+ const compiledAggPath = this.modelPathInstance(aggrPath);
131153
+ const compiledCountPath = this.modelPathInstance(aggrPath.getParentPath().joinWith("Count").toCurrentIteration());
131045
131154
  const compiledDelegate = x.type === "Sum" ? `context => KCSumCalculation.execute(context, ${compiledAggPath},${compiledDep}, ${compiledCountPath}, "")` : x.type === "Count" ? `context => KCCountCalculation.execute(context, ${compiledAggPath}, ${compiledDep}, ${x.isDependencyAggregation}, "")` : "";
131046
131155
  const compiledDeps = [compiledDep, ...(x.type === "Sum" ? [compiledCountPath] : [])].join(", ");
131047
- return `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
131156
+ const compiledCalculationFunction = `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
131157
+ acc.aggregationPaths.push(aggrPath);
131158
+ acc.compiledAggregationFunctions.push(compiledCalculationFunction);
131159
+ return acc;
131160
+ }, {
131161
+ compiledAggregationFunctions: [],
131162
+ aggregationPaths: []
131048
131163
  });
131049
- return [...sumCompiledFunctions];
131164
+ return {
131165
+ compiledAggregationFunctions: [...compiledAggregationFunctions],
131166
+ aggregationPaths: aggregationPaths
131167
+ };
131050
131168
  }
131051
131169
  /* eslint-disable @typescript-eslint/unbound-method */
131052
131170
 
@@ -131525,6 +131643,8 @@ __webpack_require__.r(__webpack_exports__);
131525
131643
  /* harmony import */ var _ServerSideFLangNormalization_RuleBuilders_ValidationRulesBuilder__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./ServerSideFLangNormalization/RuleBuilders/ValidationRulesBuilder */ "./Generator/src/generators/ServerSideFLangNormalization/RuleBuilders/ValidationRulesBuilder.ts");
131526
131644
  /* harmony import */ var _ServerSideFLangNormalization_FormulaAndInitOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./ServerSideFLangNormalization/FormulaAndInitOnlyNormalizationRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/FormulaAndInitOnlyNormalizationRuleGenerator.ts");
131527
131645
  /* harmony import */ var _ServerSideFLangNormalization_CustomKCLangToFlangRuleGenerator__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./ServerSideFLangNormalization/CustomKCLangToFlangRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/CustomKCLangToFlangRuleGenerator.ts");
131646
+ /* harmony import */ var _DataDeclarationGenerator_DataDeclarationResourcesGenerator__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./DataDeclarationGenerator/DataDeclarationResourcesGenerator */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationResourcesGenerator.ts");
131647
+
131528
131648
 
131529
131649
 
131530
131650
 
@@ -131570,15 +131690,15 @@ __webpack_require__.r(__webpack_exports__);
131570
131690
 
131571
131691
  function processSugar(formSugarContent, additionalContent, generationOptions) {
131572
131692
  try {
131573
- var _kxXmlMathContainer$f, _kxXmlMathContainer$f2, _kcLangMathContainer$, _kcLangMathContainer$2, _additionalContent$fo, _additionalContent$fo2, _Iterator$from$map$fl, _generationOptions$in, _generationOptions$in2, _sugarRoot$schemaVali, _sugarRoot$schemaVali2, _generationOptions$re, _sugarRoot$schemaVali3, _sugarRoot$schemaVali4, _additionalContent$fo3, _additionalContent$fo4;
131693
+ var _kcXmlMathContainer$f, _kcXmlMathContainer$f2, _kcLangMathContainer$, _kcLangMathContainer$2, _additionalContent$fo, _additionalContent$fo2, _Iterator$from$map$fl, _generationOptions$in, _generationOptions$in2, _sugarRoot$schemaVali, _sugarRoot$schemaVali2, _generationOptions$re, _sugarRoot$schemaVali3, _sugarRoot$schemaVali4, _additionalContent$fo3, _additionalContent$fo4, _sugarRoot$schemaVali5;
131574
131694
 
131575
131695
  const sugarAst = (0,_common_SugarXmlParser_SugarParser__WEBPACK_IMPORTED_MODULE_4__.parseSugar)(formSugarContent, additionalContent.preprocessor || {});
131576
131696
  const serializer = (0,_markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_13__.createDefaultSugarSerializer)();
131577
131697
  const sugarRoot = (0,_markupGenerator_SugarNodes_SugarNodeUtils__WEBPACK_IMPORTED_MODULE_14__.strictCastNode)(serializer.deserializeFromSugarXmlNode(sugarAst), _markupGenerator_ElementProcessors_FormParts_Form_FormNode__WEBPACK_IMPORTED_MODULE_11__.FormNode);
131578
131698
  const formulaReader = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaReader__WEBPACK_IMPORTED_MODULE_17__.FormulaReader();
131579
131699
  const kcLangMathContainer = formulaReader.readFormulas(_common_KCLang_KCLangToXmlTranspiler__WEBPACK_IMPORTED_MODULE_6__.KCLangToXmlTranspiler.transpile(additionalContent.kcLangContent));
131580
- const kxXmlMathContainer = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaReader__WEBPACK_IMPORTED_MODULE_17__.FormulaReader().readFormulas(additionalContent.kcJsXmlContent);
131581
- const formulas = ((_kxXmlMathContainer$f = kxXmlMathContainer === null || kxXmlMathContainer === void 0 ? void 0 : (_kxXmlMathContainer$f2 = kxXmlMathContainer.formulas) === null || _kxXmlMathContainer$f2 === void 0 ? void 0 : _kxXmlMathContainer$f2.items) !== null && _kxXmlMathContainer$f !== void 0 ? _kxXmlMathContainer$f : []).concat((_kcLangMathContainer$ = kcLangMathContainer === null || kcLangMathContainer === void 0 ? void 0 : (_kcLangMathContainer$2 = kcLangMathContainer.formulas) === null || _kcLangMathContainer$2 === void 0 ? void 0 : _kcLangMathContainer$2.items) !== null && _kcLangMathContainer$ !== void 0 ? _kcLangMathContainer$ : []);
131700
+ const kcXmlMathContainer = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaReader__WEBPACK_IMPORTED_MODULE_17__.FormulaReader().readFormulas(additionalContent.kcJsXmlContent);
131701
+ const formulas = ((_kcXmlMathContainer$f = kcXmlMathContainer === null || kcXmlMathContainer === void 0 ? void 0 : (_kcXmlMathContainer$f2 = kcXmlMathContainer.formulas) === null || _kcXmlMathContainer$f2 === void 0 ? void 0 : _kcXmlMathContainer$f2.items) !== null && _kcXmlMathContainer$f !== void 0 ? _kcXmlMathContainer$f : []).concat((_kcLangMathContainer$ = kcLangMathContainer === null || kcLangMathContainer === void 0 ? void 0 : (_kcLangMathContainer$2 = kcLangMathContainer.formulas) === null || _kcLangMathContainer$2 === void 0 ? void 0 : _kcLangMathContainer$2.items) !== null && _kcLangMathContainer$ !== void 0 ? _kcLangMathContainer$ : []);
131582
131702
  const useCalculator2 = ((_additionalContent$fo = additionalContent.formJsonSettings) === null || _additionalContent$fo === void 0 ? void 0 : _additionalContent$fo.autoCalculationCalculatorImpl) === "calculator2" || ((_additionalContent$fo2 = additionalContent.formJsonSettings) === null || _additionalContent$fo2 === void 0 ? void 0 : _additionalContent$fo2.useServerSideFLangNormalization);
131583
131703
  const kcXmlConditions = (_Iterator$from$map$fl = Iterator.from(getImportedKcXmlValidations(sugarRoot, additionalContent)).map(x => {
131584
131704
  var _container$conditions, _container$conditions2;
@@ -131597,7 +131717,6 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
131597
131717
  const additionalSettings = typeof additionalContent.additionalSettings === "string" ? JSON.parse(additionalContent.additionalSettings || "{}") : additionalContent.additionalSettings;
131598
131718
  const dataDeclarationGenerator = new _DataDeclarationGenerator_DataDeclarationGenerator__WEBPACK_IMPORTED_MODULE_19__.DataDeclarationGenerator(sugarRoot, new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__.DataDeclarationInitSourceSequenceFactory(fetchFunctions), controlCustomizationContext, typeRegistry, formSchemaRng, (_sugarRoot$schemaVali = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali !== void 0 ? _sugarRoot$schemaVali : false);
131599
131719
  const {
131600
- dataDeclarationContent,
131601
131720
  dataDeclaration
131602
131721
  } = dataDeclarationGenerator.generate();
131603
131722
  const dataDeclarationHelper = new _DataDeclarationGenerator_DataDeclarationGenerationTimeHelper__WEBPACK_IMPORTED_MODULE_26__.DataDeclarationGenerationTimeHelper(dataDeclaration);
@@ -131624,7 +131743,6 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
131624
131743
  const autocalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsGenerator__WEBPACK_IMPORTED_MODULE_18__.AutoCalculationsGenerator(dataDeclarationHelper, schemaRng);
131625
131744
  const formulasForCalculator = !useCalculator2 ? formulas : [];
131626
131745
  builder.addResource("calculationFunctions.js", autocalcGenerator.generate(sugarRoot, additionalContent.autocalcsContent, formulasForCalculator));
131627
- builder.addResource("dataDeclaration.js", dataDeclarationContent);
131628
131746
 
131629
131747
  if ((_additionalContent$fo3 = (_additionalContent$fo4 = additionalContent.formJsonSettings) === null || _additionalContent$fo4 === void 0 ? void 0 : _additionalContent$fo4.useServerSideFLangNormalization) !== null && _additionalContent$fo3 !== void 0 ? _additionalContent$fo3 : false) {
131630
131748
  var _additionalContent$fo5, _additionalContent$fo6;
@@ -131674,12 +131792,21 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
131674
131792
  builder.addResource("rngSchemaValidationConfigurator.js", rngSchemaValidationConfigurator);
131675
131793
  const formulasForCalculator2 = useCalculator2 ? formulas : [];
131676
131794
  const kcXmlAutoCalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__.AutoCalculationsCalculator2Generator(formSchemaRng, dataDeclarationHelper);
131677
- builder.addResource("kcXmlAutoCalculationConfigurator.js", kcXmlAutoCalcGenerator.generate(formulasForCalculator2));
131795
+ const {
131796
+ aggregationPaths,
131797
+ result
131798
+ } = kcXmlAutoCalcGenerator.generate(formulasForCalculator2);
131799
+ builder.addResource("kcXmlAutoCalculationConfigurator.js", result);
131678
131800
  const kcXmlValidationGenerator = new _KCXmlValidationGenerator_KCXmlValidationGenerator__WEBPACK_IMPORTED_MODULE_23__.KCXmlValidationGenerator(formSchemaRng);
131679
131801
  builder.addResource("kcXmlValidationConfigurator.js", kcXmlValidationGenerator.generate(kcXmlConditions)); // const importedAutoCalculations = getImportedAutoCalculations(sugarRoot);
131680
131802
 
131681
131803
  builder.addResource("autocalculationConfigurators.js", `export default []`);
131682
131804
  builder.addResource("FakeStyles.less", `// empty styles to enforce style files`);
131805
+ const dataDeclarationResourcesGenerator = new _DataDeclarationGenerator_DataDeclarationResourcesGenerator__WEBPACK_IMPORTED_MODULE_43__.DataDeclarationResourcesGenerator(sugarRoot, new _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__.DataDeclarationInitSourceSequenceFactory(fetchFunctions), controlCustomizationContext, typeRegistry, formSchemaRng, (_sugarRoot$schemaVali5 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali5 !== void 0 ? _sugarRoot$schemaVali5 : false, formulas, aggregationPaths);
131806
+ const {
131807
+ dataDeclarationContent
131808
+ } = dataDeclarationResourcesGenerator.generate();
131809
+ builder.addResource("dataDeclaration.js", dataDeclarationContent);
131683
131810
  const localizationResources = (0,_localization_localization__WEBPACK_IMPORTED_MODULE_7__.generateLocalizationResources)(additionalContent.localization);
131684
131811
 
131685
131812
  if (localizationResources) {
@@ -136550,7 +136677,7 @@ class ButtonConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_1__.S
136550
136677
 
136551
136678
  doBuildDataDeclaration(context) {
136552
136679
  const node = this.getCurrentNodeAs(_ButtonNode__WEBPACK_IMPORTED_MODULE_3__.ButtonNode);
136553
- return context.mergeDataDeclaration(context.addVisibilityPathDeclEntryNew(node));
136680
+ return context.mergeDataDeclaration(context.addVisibilityPathDeclEntryNew(node), context.addPathDeclEntry(node, [["value", context.initSequenceFactory.dataValue(node.dataBinding, node.disabled)]]));
136554
136681
  }
136555
136682
 
136556
136683
  buildChildrenDataDeclaration(context) {
@@ -136609,40 +136736,42 @@ __webpack_require__.r(__webpack_exports__);
136609
136736
 
136610
136737
 
136611
136738
 
136612
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12;
136739
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13;
136613
136740
 
136614
136741
 
136615
136742
 
136616
136743
 
136617
136744
  let ButtonNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.sugarNode)("button", `Кнопка
136618
136745
 
136619
- В приоритете в качестве текста будет взят value из модели по path. Даже если в сахаре указать текст вручную.`, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/Action/Button sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrMixin)(_CommonNodeProperties_DataBindingMixinNode__WEBPACK_IMPORTED_MODULE_3__.DataReferenceMixinNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("tid", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Возможность установки произвольных data-tid атрибутов, может пригодиться другим командам, или для идентификации элемента в тестах"), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("align", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("center", "end", "justify", "left", "match-parent", "right", "start"), "Выравнивание"), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("arrow", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Кнопка со стрелкой"), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.markupAttr)("hint", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Всплывающая подсказка при наведении"), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("disabled", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.boolean, "Disabled"), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("size", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("small", "medium", "large"), "Размер кнопки. По умолчанинию small"), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("type", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("button", "submit", "reset"), "Тип, влияет на цвет. см. в retail-ui"), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("use", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("default", "primary", "success", "danger", "pay", "link"), "Вариант использования, влияет на цвет. см. в retail-ui"), _dec11 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("width", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.lengthUnit, "Ширина"), _dec12 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("onClick", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.helperFunctionName, "Имя кастомной helpers функции, которая вызовется при клике"), _dec13 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.children)(), _dec(_class = (_class2 = class ButtonNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_4__.SugarNodeWithLegacyVisibility {
136746
+ В приоритете в качестве текста будет взят value из модели по path. Даже если в сахаре указать текст вручную.`, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/Action/Button sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrMixin)(_CommonNodeProperties_DataBindingMixinNode__WEBPACK_IMPORTED_MODULE_3__.DataReferenceMixinNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrMixin)(_CommonNodeProperties_DataBindingMixinNode__WEBPACK_IMPORTED_MODULE_3__.DataBindingMixinNode), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("tid", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Возможность установки произвольных data-tid атрибутов, может пригодиться другим командам, или для идентификации элемента в тестах"), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("align", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("center", "end", "justify", "left", "match-parent", "right", "start"), "Выравнивание"), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("arrow", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Кнопка со стрелкой"), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.markupAttr)("hint", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string, "Всплывающая подсказка при наведении"), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("disabled", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.boolean, "Disabled"), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("size", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("small", "medium", "large"), "Размер кнопки. По умолчанинию small"), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("type", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("button", "submit", "reset"), "Тип, влияет на цвет. см. в retail-ui"), _dec11 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("use", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType["enum"]("default", "primary", "success", "danger", "pay", "link"), "Вариант использования, влияет на цвет. см. в retail-ui"), _dec12 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("width", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.lengthUnit, "Ширина"), _dec13 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("onClick", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.helperFunctionName, "Имя кастомной helpers функции, которая вызовется при клике"), _dec14 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.children)(), _dec(_class = (_class2 = class ButtonNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_4__.SugarNodeWithLegacyVisibility {
136620
136747
  constructor(...args) {
136621
136748
  super(...args);
136622
136749
 
136623
136750
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "dataReference", _descriptor, this);
136624
136751
 
136625
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "tid", _descriptor2, this);
136752
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "dataBinding", _descriptor2, this);
136626
136753
 
136627
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "align", _descriptor3, this);
136754
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "tid", _descriptor3, this);
136628
136755
 
136629
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "arrow", _descriptor4, this);
136756
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "align", _descriptor4, this);
136630
136757
 
136631
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "hint", _descriptor5, this);
136758
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "arrow", _descriptor5, this);
136632
136759
 
136633
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "disabled", _descriptor6, this);
136760
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "hint", _descriptor6, this);
136634
136761
 
136635
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "size", _descriptor7, this);
136762
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "disabled", _descriptor7, this);
136636
136763
 
136637
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "type", _descriptor8, this);
136764
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "size", _descriptor8, this);
136638
136765
 
136639
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "use", _descriptor9, this);
136766
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "type", _descriptor9, this);
136640
136767
 
136641
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "width", _descriptor10, this);
136768
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "use", _descriptor10, this);
136769
+
136770
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "width", _descriptor11, this);
136642
136771
 
136643
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "onClick", _descriptor11, this);
136772
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "onClick", _descriptor12, this);
136644
136773
 
136645
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "children", _descriptor12, this);
136774
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "children", _descriptor13, this);
136646
136775
  }
136647
136776
 
136648
136777
  getOwnPath() {
@@ -136654,57 +136783,62 @@ let ButtonNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE
136654
136783
  enumerable: true,
136655
136784
  writable: true,
136656
136785
  initializer: null
136657
- }), _descriptor2 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "tid", [_dec3], {
136786
+ }), _descriptor2 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "dataBinding", [_dec3], {
136658
136787
  configurable: true,
136659
136788
  enumerable: true,
136660
136789
  writable: true,
136661
136790
  initializer: null
136662
- }), _descriptor3 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "align", [_dec4], {
136791
+ }), _descriptor3 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "tid", [_dec4], {
136663
136792
  configurable: true,
136664
136793
  enumerable: true,
136665
136794
  writable: true,
136666
136795
  initializer: null
136667
- }), _descriptor4 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "arrow", [_dec5], {
136796
+ }), _descriptor4 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "align", [_dec5], {
136668
136797
  configurable: true,
136669
136798
  enumerable: true,
136670
136799
  writable: true,
136671
136800
  initializer: null
136672
- }), _descriptor5 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "hint", [_dec6], {
136801
+ }), _descriptor5 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "arrow", [_dec6], {
136673
136802
  configurable: true,
136674
136803
  enumerable: true,
136675
136804
  writable: true,
136676
136805
  initializer: null
136677
- }), _descriptor6 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "disabled", [_dec7], {
136806
+ }), _descriptor6 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "hint", [_dec7], {
136678
136807
  configurable: true,
136679
136808
  enumerable: true,
136680
136809
  writable: true,
136681
136810
  initializer: null
136682
- }), _descriptor7 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "size", [_dec8], {
136811
+ }), _descriptor7 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "disabled", [_dec8], {
136683
136812
  configurable: true,
136684
136813
  enumerable: true,
136685
136814
  writable: true,
136686
136815
  initializer: null
136687
- }), _descriptor8 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "type", [_dec9], {
136816
+ }), _descriptor8 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "size", [_dec9], {
136688
136817
  configurable: true,
136689
136818
  enumerable: true,
136690
136819
  writable: true,
136691
136820
  initializer: null
136692
- }), _descriptor9 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "use", [_dec10], {
136821
+ }), _descriptor9 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "type", [_dec10], {
136693
136822
  configurable: true,
136694
136823
  enumerable: true,
136695
136824
  writable: true,
136696
136825
  initializer: null
136697
- }), _descriptor10 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "width", [_dec11], {
136826
+ }), _descriptor10 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "use", [_dec11], {
136698
136827
  configurable: true,
136699
136828
  enumerable: true,
136700
136829
  writable: true,
136701
136830
  initializer: null
136702
- }), _descriptor11 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "onClick", [_dec12], {
136831
+ }), _descriptor11 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "width", [_dec12], {
136703
136832
  configurable: true,
136704
136833
  enumerable: true,
136705
136834
  writable: true,
136706
136835
  initializer: null
136707
- }), _descriptor12 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "children", [_dec13], {
136836
+ }), _descriptor12 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "onClick", [_dec13], {
136837
+ configurable: true,
136838
+ enumerable: true,
136839
+ writable: true,
136840
+ initializer: null
136841
+ }), _descriptor13 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "children", [_dec14], {
136708
136842
  configurable: true,
136709
136843
  enumerable: true,
136710
136844
  writable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.292.0",
3
+ "version": "4.293.0-data-declaration-paths.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,