@kontur.candy/generator 5.12.2-server-side-calculations.10 → 5.12.2-server-side-calculations.11

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 +24 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79648,7 +79648,7 @@ __webpack_require__.r(__webpack_exports__);
79648
79648
 
79649
79649
  function processSugar(formSugarContent, additionalContent, generationOptions) {
79650
79650
  try {
79651
- 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, _sugarRoot$schemaVali5, _additionalContent$fo3, _additionalContent$fo4;
79651
+ var _kxXmlMathContainer$f, _kxXmlMathContainer$f2, _kcLangMathContainer$, _kcLangMathContainer$2, _additionalContent$fo, _additionalContent$fo2, _additionalContent$fo3, _additionalContent$fo4, _Iterator$from$map$fl, _generationOptions$in, _generationOptions$in2, _sugarRoot$schemaVali, _sugarRoot$schemaVali2, _generationOptions$re, _sugarRoot$schemaVali3, _sugarRoot$schemaVali4, _sugarRoot$schemaVali5, _additionalContent$fo5, _additionalContent$fo6;
79652
79652
  const sugarAst = (0,_common_SugarXmlParser_SugarParser__WEBPACK_IMPORTED_MODULE_4__.parseSugar)(formSugarContent, additionalContent.preprocessor || {});
79653
79653
  const serializer = (0,_markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_13__.createDefaultSugarSerializer)();
79654
79654
  const sugarRoot = (0,_markupGenerator_SugarNodes_SugarNodeUtils__WEBPACK_IMPORTED_MODULE_14__.strictCastNode)(serializer.deserializeFromSugarXmlNode(sugarAst), _markupGenerator_ElementProcessors_FormParts_Form_FormNode__WEBPACK_IMPORTED_MODULE_11__.FormNode);
@@ -79657,12 +79657,14 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
79657
79657
  const kxXmlMathContainer = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaReader__WEBPACK_IMPORTED_MODULE_17__.FormulaReader().readFormulas(additionalContent.kcJsXmlContent);
79658
79658
  const formulasFromSugar = extractFormulasFromSugarKCLang(sugarRoot);
79659
79659
  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$ : []).concat([...formulasFromSugar]);
79660
- 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);
79661
- const kcXmlConditions = (_Iterator$from$map$fl = Iterator.from(getImportedKcXmlValidations(sugarRoot, additionalContent)).map(x => {
79660
+ const useServerCalculations = (_additionalContent$fo = (_additionalContent$fo2 = additionalContent.formJsonSettings) === null || _additionalContent$fo2 === void 0 ? void 0 : _additionalContent$fo2.useServerSideCalculations) !== null && _additionalContent$fo !== void 0 ? _additionalContent$fo : false;
79661
+ const useCalculator2 = !useServerCalculations && (((_additionalContent$fo3 = additionalContent.formJsonSettings) === null || _additionalContent$fo3 === void 0 ? void 0 : _additionalContent$fo3.autoCalculationCalculatorImpl) === "calculator2" || ((_additionalContent$fo4 = additionalContent.formJsonSettings) === null || _additionalContent$fo4 === void 0 ? void 0 : _additionalContent$fo4.useServerSideFLangNormalization));
79662
+ const useOldCalculator = !useCalculator2 && !useServerCalculations;
79663
+ const kcXmlConditions = !useServerCalculations ? (_Iterator$from$map$fl = Iterator.from(getImportedKcXmlValidations(sugarRoot, additionalContent)).map(x => {
79662
79664
  var _container$conditions, _container$conditions2;
79663
79665
  const container = formulaReader.readFormulas(x);
79664
79666
  return (_container$conditions = (_container$conditions2 = container.conditions) === null || _container$conditions2 === void 0 ? void 0 : _container$conditions2.items) !== null && _container$conditions !== void 0 ? _container$conditions : [];
79665
- }).flatMap(x => x).toArray()) !== null && _Iterator$from$map$fl !== void 0 ? _Iterator$from$map$fl : [];
79667
+ }).flatMap(x => x).toArray()) !== null && _Iterator$from$map$fl !== void 0 ? _Iterator$from$map$fl : [] : [];
79666
79668
  const schemaRng = (0,_common_XmlParser_XmlParser__WEBPACK_IMPORTED_MODULE_5__.parseXml)(additionalContent.schemaRngContent);
79667
79669
  const formSchemaRng = _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_3__.FormSchemaRng.createFromSchemaRng(additionalContent.schemaRngContent);
79668
79670
  const typeRegistry = (0,_validationGenerator_TypesRegistry__WEBPACK_IMPORTED_MODULE_15__.buildTypesRegistry)(sugarRoot);
@@ -79699,18 +79701,18 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
79699
79701
  builder.addResource("requisiteList.js", (0,_RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__.getRequisiteList)(sugarRoot, fetchFunctions));
79700
79702
  builder.addResource("lazyLoadDeclaration.js", lazyLoadGeneratorResult.content);
79701
79703
  const autocalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsGenerator__WEBPACK_IMPORTED_MODULE_18__.AutoCalculationsGenerator(dataDeclarationHelper, schemaRng);
79702
- const formulasForCalculator = !useCalculator2 ? formulas : [];
79704
+ const formulasForCalculator = useOldCalculator ? formulas : [];
79703
79705
  builder.addResource("calculationFunctions.js", autocalcGenerator.generate(sugarRoot, additionalContent.autocalcsContent, formulasForCalculator));
79704
79706
  builder.addResource("dataDeclaration.js", dataDeclarationContent);
79705
- 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) {
79706
- var _additionalContent$fo5, _additionalContent$fo6;
79707
+ if ((_additionalContent$fo5 = (_additionalContent$fo6 = additionalContent.formJsonSettings) === null || _additionalContent$fo6 === void 0 ? void 0 : _additionalContent$fo6.useServerSideFLangNormalization) !== null && _additionalContent$fo5 !== void 0 ? _additionalContent$fo5 : false) {
79708
+ var _additionalContent$fo7, _additionalContent$fo8;
79707
79709
  const defaultNormalizationRules = normalizationRulesGenerator.generateRules();
79708
79710
  const customNormalizers = [{
79709
79711
  normalizerId: "formulas",
79710
- content: (_additionalContent$fo5 = additionalContent.formJsonSettings) !== null && _additionalContent$fo5 !== void 0 && _additionalContent$fo5.disableFlangRulesForEnableAutoFieldFeature ? "" : formulaOnlyNormalizationRulesGenerator.generateRules()
79712
+ content: (_additionalContent$fo7 = additionalContent.formJsonSettings) !== null && _additionalContent$fo7 !== void 0 && _additionalContent$fo7.disableFlangRulesForEnableAutoFieldFeature ? "" : formulaOnlyNormalizationRulesGenerator.generateRules()
79711
79713
  }, {
79712
79714
  normalizerId: "formulasWithInitializers",
79713
- content: (_additionalContent$fo6 = additionalContent.formJsonSettings) !== null && _additionalContent$fo6 !== void 0 && _additionalContent$fo6.disableFlangRulesForFormulaAndInitNormalizer ? "" : formulaAndInitOnlyNormalizationRulesGenerator.generateRules()
79715
+ content: (_additionalContent$fo8 = additionalContent.formJsonSettings) !== null && _additionalContent$fo8 !== void 0 && _additionalContent$fo8.disableFlangRulesForFormulaAndInitNormalizer ? "" : formulaAndInitOnlyNormalizationRulesGenerator.generateRules()
79714
79716
  }].filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrEmpty)(x.content));
79715
79717
  const additionalNormalizationRules = additionalContent.additionalNormalizers ? additionalContent.additionalNormalizers.map(additionalNormalizer => {
79716
79718
  switch (additionalNormalizer.extension) {
@@ -100376,6 +100378,9 @@ class CheckboxConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_1__
100376
100378
  markupBuilder.prop(x => x.checkedValue).set(node.checkedValue);
100377
100379
  markupBuilder.prop("data-tid").set(node.tid);
100378
100380
  markupBuilder.prop(x => x.uncheckedValue).set(node.uncheckedValue);
100381
+ if (node.callHelperOnChange) {
100382
+ markupBuilder.prop(x => x.callHelperOnChange).set(context.generateHelperFunctionExpression(node, "callHelperOnChange", node.callHelperOnChange));
100383
+ }
100379
100384
  if (node.disabled2 != undefined) {
100380
100385
  markupBuilder.prop(x => x.disabled2).set((0,_SugarNodes_SugarNodeUtils__WEBPACK_IMPORTED_MODULE_4__.buildExpressionPropValue)(node.disabled2));
100381
100386
  if (this.getLegacyNode().getParent() != undefined) {
@@ -100418,7 +100423,7 @@ __webpack_require__.r(__webpack_exports__);
100418
100423
 
100419
100424
 
100420
100425
 
100421
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10;
100426
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11;
100422
100427
 
100423
100428
 
100424
100429
 
@@ -100427,7 +100432,7 @@ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11
100427
100432
 
100428
100433
 
100429
100434
 
100430
- let CheckboxNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.sugarNode)("checkbox", ``, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/Checkbox sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_DataBindingMixinNode__WEBPACK_IMPORTED_MODULE_3__.DataBindingMixinNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_FocusManagementNode__WEBPACK_IMPORTED_MODULE_10__.FocusManagementNode), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("disabled2", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.javascriptExpression, `${(0,_Commons_DocumentationLinks__WEBPACK_IMPORTED_MODULE_9__.docLink)(_Commons_DocumentationLinks__WEBPACK_IMPORTED_MODULE_9__.javaScriptExpressionLink)} для условного задизейбливания контрола`), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.deprecatedAttr)("width", _Serializer_DeprecationReason__WEBPACK_IMPORTED_MODULE_5__.DeprecationReason.InvalidUsage), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("tid", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, "Возможность установки произвольных data-tid атрибутов, может пригодиться другим командам, или для идентификации элемента в тестах"), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_ValidationInfoNode__WEBPACK_IMPORTED_MODULE_4__.ValidationInfoNode), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_TooltipProperties_TooltipSettingsNode__WEBPACK_IMPORTED_MODULE_8__.TooltipSettingsNode), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("checkedValue", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, ``), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("uncheckedValue", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, ``), _dec11 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.children)(undefined, undefined, ["type"]), _dec(_class = (_class2 = class CheckboxNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_6__.SugarNodeWithLegacyVisibility {
100435
+ let CheckboxNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.sugarNode)("checkbox", ``, __webpack_require__("./Generator/src/generators/markupGenerator/ElementProcessors/ValueEditors/Checkbox sync recursive .md$")), _dec2 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_DataBindingMixinNode__WEBPACK_IMPORTED_MODULE_3__.DataBindingMixinNode), _dec3 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_FocusManagementNode__WEBPACK_IMPORTED_MODULE_10__.FocusManagementNode), _dec4 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("disabled2", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.javascriptExpression, `${(0,_Commons_DocumentationLinks__WEBPACK_IMPORTED_MODULE_9__.docLink)(_Commons_DocumentationLinks__WEBPACK_IMPORTED_MODULE_9__.javaScriptExpressionLink)} для условного задизейбливания контрола`), _dec5 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.deprecatedAttr)("width", _Serializer_DeprecationReason__WEBPACK_IMPORTED_MODULE_5__.DeprecationReason.InvalidUsage), _dec6 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("tid", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, "Возможность установки произвольных data-tid атрибутов, может пригодиться другим командам, или для идентификации элемента в тестах"), _dec7 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_ValidationInfoNode__WEBPACK_IMPORTED_MODULE_4__.ValidationInfoNode), _dec8 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrMixin)(_CommonNodeProperties_TooltipProperties_TooltipSettingsNode__WEBPACK_IMPORTED_MODULE_8__.TooltipSettingsNode), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("checkedValue", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, ``), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("uncheckedValue", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.string, ``), _dec11 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attr)("callHelperOnChange", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.attrType.helperFunctionName, "Вызов helper функции на onChange контролла"), _dec12 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_7__.children)(undefined, undefined, ["type"]), _dec(_class = (_class2 = class CheckboxNode extends _Serializer_SugarNodeWithLegacyVisibility__WEBPACK_IMPORTED_MODULE_6__.SugarNodeWithLegacyVisibility {
100431
100436
  constructor(...args) {
100432
100437
  super(...args);
100433
100438
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "dataBinding", _descriptor, this);
@@ -100439,7 +100444,8 @@ let CheckboxNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODU
100439
100444
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "tooltipSettings", _descriptor7, this);
100440
100445
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "checkedValue", _descriptor8, this);
100441
100446
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "uncheckedValue", _descriptor9, this);
100442
- _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "children", _descriptor10, this);
100447
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "callHelperOnChange", _descriptor10, this);
100448
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "children", _descriptor11, this);
100443
100449
  }
100444
100450
  getOwnPath() {
100445
100451
  return this.dataBinding.getOwnPath();
@@ -100489,7 +100495,12 @@ let CheckboxNode = (_dec = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODU
100489
100495
  enumerable: true,
100490
100496
  writable: true,
100491
100497
  initializer: null
100492
- }), _descriptor10 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "children", [_dec11], {
100498
+ }), _descriptor10 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "callHelperOnChange", [_dec11], {
100499
+ configurable: true,
100500
+ enumerable: true,
100501
+ writable: true,
100502
+ initializer: null
100503
+ }), _descriptor11 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "children", [_dec12], {
100493
100504
  configurable: true,
100494
100505
  enumerable: true,
100495
100506
  writable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.12.2-server-side-calculations.10",
3
+ "version": "5.12.2-server-side-calculations.11",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,