@kontur.candy/generator 4.248.0-lazy-loading.26 → 4.248.0-lazy-loading.29

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 +67 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -129114,6 +129114,8 @@ __webpack_require__.r(__webpack_exports__);
129114
129114
  /* harmony import */ var _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./AttachmentPaths/AttachmentPathsGenerator */ "./Generator/src/generators/AttachmentPaths/AttachmentPathsGenerator.ts");
129115
129115
  /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts");
129116
129116
  /* harmony import */ var _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator */ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts");
129117
+ /* harmony import */ var _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts");
129118
+
129117
129119
 
129118
129120
 
129119
129121
 
@@ -129146,7 +129148,7 @@ __webpack_require__.r(__webpack_exports__);
129146
129148
 
129147
129149
  function processSugar(formSugarContent, additionalContent, generationOptions) {
129148
129150
  try {
129149
- var _kxXmlMathContainer$f, _kxXmlMathContainer$f2, _kcLangMathContainer$, _kcLangMathContainer$2, _Iterator$from$map$fl, _generationOptions$in, _generationOptions$in2, _sugarRoot$schemaVali, _sugarRoot$schemaVali2, _generationOptions$re, _sugarRoot$schemaVali3, _additionalContent$fo, _additionalContent$fo2;
129151
+ var _kxXmlMathContainer$f, _kxXmlMathContainer$f2, _kcLangMathContainer$, _kcLangMathContainer$2, _Iterator$from$map$fl, _generationOptions$in, _generationOptions$in2, _sugarRoot$schemaVali, _sugarRoot$schemaVali2, _sugarRoot$schemaVali3, _generationOptions$re, _sugarRoot$schemaVali4, _additionalContent$fo, _additionalContent$fo2;
129150
129152
 
129151
129153
  const sugarAst = (0,_common_SugarXmlParser_SugarParser__WEBPACK_IMPORTED_MODULE_4__.parseSugar)(formSugarContent, additionalContent.preprocessor || {});
129152
129154
  const serializer = (0,_markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_13__.createDefaultSugarSerializer)();
@@ -129180,9 +129182,10 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
129180
129182
  const lazyLoadGenerator = new _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__.LazyLoadDeclarationGenerator(formSchemaRng);
129181
129183
  const lazyLoadGeneratorResult = lazyLoadGenerator.generate();
129182
129184
  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);
129185
+ const formlulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(sugarRoot, dataDeclarationHelper, formSchemaRng, formulas, kcXmlConditions, typeRegistry, (_sugarRoot$schemaVali3 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali3 !== void 0 ? _sugarRoot$schemaVali3 : false, controlCustomizationContext, lazyLoadGeneratorResult.declaration);
129183
129186
  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");
129184
129187
  const builder = new _FormSourcesBuilder_FormSourcesBuilder__WEBPACK_IMPORTED_MODULE_21__.FormSourcesBuilder(additionalContent.formSourcesPath);
129185
- 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);
129188
+ const markupGenerator = new _markupGenerator_MarkupGenerator__WEBPACK_IMPORTED_MODULE_12__.MarkupGenerator(additionalContent.formSourcesPath, additionalContent.helpersContent, additionalContent.tourSteps, controlCustomizationContext, typeRegistry, formSchemaRng, dataDeclarationHelper, (_sugarRoot$schemaVali4 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali4 !== void 0 ? _sugarRoot$schemaVali4 : false);
129186
129189
  markupGenerator.generate(sugarRoot, builder);
129187
129190
  builder.addResource("settings.js", (0,_markupGenerator_getSettings__WEBPACK_IMPORTED_MODULE_9__.getSettings)(sugarRoot, additionalContent.gfv, additionalSettings));
129188
129191
  builder.addResource("requisiteList.js", (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__.getRequisiteList)(sugarRoot, fetchFunctions));
@@ -129193,7 +129196,12 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
129193
129196
 
129194
129197
  if ((_additionalContent$fo = (_additionalContent$fo2 = additionalContent.formJsonSettings) === null || _additionalContent$fo2 === void 0 ? void 0 : _additionalContent$fo2.useServerSideFLangNormalization) !== null && _additionalContent$fo !== void 0 ? _additionalContent$fo : false) {
129195
129198
  const normalizationRules = normalizationRulesGenerator.generateRules(resourcesHash);
129196
- builder.addServerSideResource("ServerSide.normalize", normalizationRules);
129199
+ const formulaNormalizationRules = formlulaOnlyNormalizationRulesGenerator.generateRules(resourcesHash);
129200
+ const resultRules = combineFlangRules(normalizationRules, {
129201
+ content: formulaNormalizationRules,
129202
+ normalizerId: "formulas"
129203
+ });
129204
+ builder.addServerSideResource("ServerSide.normalize", resultRules);
129197
129205
  }
129198
129206
 
129199
129207
  const attachmentPathsGenerator = new _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__.AttachmentPathsGenerator();
@@ -129232,6 +129240,10 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
129232
129240
  }
129233
129241
  }
129234
129242
 
129243
+ function combineFlangRules(baseRules, ...rules) {
129244
+ return baseRules + rules.map(x => `\n--${x.normalizerId}--\n${x.content}`).join("");
129245
+ }
129246
+
129235
129247
  function getReferencedFetchFunctions(fetchFunctionSources) {
129236
129248
  const registries = fetchFunctionSources.map(evalFetchFunctionModule);
129237
129249
  return mergeFetchFunctionRegistries(registries);
@@ -130385,6 +130397,58 @@ class SetStatement extends FLangStatement {
130385
130397
 
130386
130398
  /***/ }),
130387
130399
 
130400
+ /***/ "./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts":
130401
+ /*!********************************************************************************************************!*\
130402
+ !*** ./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts ***!
130403
+ \********************************************************************************************************/
130404
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
130405
+
130406
+ "use strict";
130407
+ __webpack_require__.r(__webpack_exports__);
130408
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
130409
+ /* harmony export */ "FormulaOnlyNormalizationRuleGenerator": () => (/* binding */ FormulaOnlyNormalizationRuleGenerator)
130410
+ /* harmony export */ });
130411
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
130412
+ /* harmony import */ var _DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DataSchema/DataSchemaUtils */ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts");
130413
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
130414
+ /* harmony import */ var _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FLang/FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
130415
+ /* harmony import */ var _NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NormalizationRulesGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/NormalizationRulesGenerator.ts");
130416
+
130417
+
130418
+
130419
+
130420
+
130421
+ class FormulaOnlyNormalizationRuleGenerator extends _NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_4__.NormalizationRulesGenerator {
130422
+ generateRules(resourcesHash) {
130423
+ const formulaFLangRules = this.buildFormulaFLangRules();
130424
+ return Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(formulaFLangRules, x => x instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement ? x.left.convertToString() : x.convertToString())).map(x => x.convertToString()).reduce((x, y) => x + (x ? "\n" : "") + y, "");
130425
+ }
130426
+
130427
+ buildFormulaFlashRule(formula) {
130428
+ const prefix = _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_2__.ModelPath.createFromString(formula.match.replace(/\@/g, ""), true).normalize();
130429
+ const target = _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_2__.ModelPath.createFromString(formula.target.replace(/\@/g, ""), false);
130430
+ const fullTarget = (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_1__.adjustPathMultiplicityComplex)(prefix.joinWith(target).normalize(), this.formSchemaRng, this.dataDeclarationHelper);
130431
+ const precalculationRules = [];
130432
+ const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
130433
+ const result = [];
130434
+ result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget, "value"), this.compileExpressionToFlashExpression(formula.expression, prefix, fullTarget, x => precalculationRules.push(x))));
130435
+ result.push(...precalculationRules);
130436
+
130437
+ if (isTargetAutoField) {
130438
+ result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget, "autoValue"), this.compileExpressionToFlashExpression(formula.expression, prefix, fullTarget, x => precalculationRules.push(x))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), "string")));
130439
+ result.push(...precalculationRules);
130440
+ } else {
130441
+ result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(fullTarget, "value"), this.compileExpressionToFlashExpression(formula.expression, prefix, fullTarget, x => precalculationRules.push(x))));
130442
+ result.push(...precalculationRules);
130443
+ }
130444
+
130445
+ return result;
130446
+ }
130447
+
130448
+ }
130449
+
130450
+ /***/ }),
130451
+
130388
130452
  /***/ "./Generator/src/generators/ServerSideFLangNormalization/NormalizationRulesGenerator.ts":
130389
130453
  /*!**********************************************************************************************!*\
130390
130454
  !*** ./Generator/src/generators/ServerSideFLangNormalization/NormalizationRulesGenerator.ts ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.248.0-lazy-loading.26",
3
+ "version": "4.248.0-lazy-loading.29",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,