@kontur.candy/generator 5.22.2 → 5.23.0-fixzeroes.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 +10 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -80865,7 +80865,8 @@ class FLangValidationBuildContext {
80865
80865
  }
80866
80866
  const valueEqlAutoValueErrorLevel = (_ref5 = (_typeNode$children$fi4 = typeNode === null || typeNode === void 0 ? void 0 : (_typeNode$children11 = typeNode.children) === null || _typeNode$children11 === void 0 ? void 0 : (_typeNode$children11$ = _typeNode$children11.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ofType)(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_12__.ValueEqlAutoValueTypeCheck))) === null || _typeNode$children11$ === void 0 ? void 0 : _typeNode$children11$.level) !== null && _typeNode$children$fi4 !== void 0 ? _typeNode$children$fi4 : typeNode === null || typeNode === void 0 ? void 0 : (_typeNode$children12 = typeNode.children) === null || _typeNode$children12 === void 0 ? void 0 : (_typeNode$children12$ = _typeNode$children12.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ValueEqlAutoValueTypeCheckNode))) === null || _typeNode$children12$ === void 0 ? void 0 : _typeNode$children12$.level) !== null && _ref5 !== void 0 ? _ref5 : schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.valueEqlAutoValue;
80867
80867
  if (valueEqlAutoValueErrorLevel != undefined) {
80868
- const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression(valueReference, autoValueReference));
80868
+ const isDecimal = (schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType) === "decimal";
80869
+ const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_13__.decimalWrapper)(valueReference, isDecimal), (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_13__.decimalWrapper)(autoValueReference, isDecimal)));
80869
80870
  yield {
80870
80871
  condition: condition,
80871
80872
  message: makeMessage({
@@ -82311,6 +82312,7 @@ __webpack_require__.r(__webpack_exports__);
82311
82312
  /* harmony export */ "castOperandToStringIfNeed": () => (/* binding */ castOperandToStringIfNeed),
82312
82313
  /* harmony export */ "castOperandToBoolIfNeed": () => (/* binding */ castOperandToBoolIfNeed),
82313
82314
  /* harmony export */ "castOperandToDecimalIfNeed": () => (/* binding */ castOperandToDecimalIfNeed),
82315
+ /* harmony export */ "decimalWrapper": () => (/* binding */ decimalWrapper),
82314
82316
  /* harmony export */ "castOperandToDateTimeIfNeed": () => (/* binding */ castOperandToDateTimeIfNeed),
82315
82317
  /* harmony export */ "nullCoalesceWithTypeCheck": () => (/* binding */ nullCoalesceWithTypeCheck),
82316
82318
  /* harmony export */ "ensureOperandsOfTypeOrNull": () => (/* binding */ ensureOperandsOfTypeOrNull),
@@ -82356,7 +82358,7 @@ function tryExtractValueReferenceAsStringFromDecimal(expression) {
82356
82358
  }
82357
82359
  return expression;
82358
82360
  }
82359
- function castOperandToStringIfNeed(operandExpression, decimalFormat) {
82361
+ function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82360
82362
  if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82361
82363
  return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82362
82364
  }
@@ -82371,6 +82373,7 @@ function castOperandToBoolIfNeed(operandExpression) {
82371
82373
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82372
82374
  return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
82373
82375
  }
82376
+ const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82374
82377
  function castOperandToDateTimeIfNeed(operandExpression) {
82375
82378
  return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime) : operandExpression;
82376
82379
  }
@@ -83242,6 +83245,7 @@ class FormulaRulesBuilder {
83242
83245
  }
83243
83246
  }
83244
83247
  buildFormulaFlashRule(formula) {
83248
+ var _this$formSchemaRng$g;
83245
83249
  const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.match.replace(/\@/g, ""), true).normalize();
83246
83250
  const target = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.target.replace(/\@/g, ""), false);
83247
83251
  const fullTarget = (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(prefix.joinWith(target).normalize(), this.formSchemaRng, this.dataDeclarationHelper);
@@ -83249,10 +83253,11 @@ class FormulaRulesBuilder {
83249
83253
  const precalculationRules = [];
83250
83254
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83251
83255
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83256
+ const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83252
83257
  const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, targetField), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue));
83253
83258
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83254
83259
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83255
- const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
83260
+ const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;
83256
83261
  const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
83257
83262
  return result;
83258
83263
  }
@@ -83262,8 +83267,8 @@ class FormulaRulesBuilder {
83262
83267
  createRegularValueRule(fullTarget, getFormulaExpression) {
83263
83268
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
83264
83269
  }
83265
- createAutoFlagRule(fullTarget) {
83266
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("false"))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.BuildInTypeExpression.string), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"))));
83270
+ createAutoFlagRule(fullTarget, isDecimal) {
83271
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("false"))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.decimalWrapper)(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), isDecimal), (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.decimalWrapper)(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue"), isDecimal)), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.BuildInTypeExpression.string), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"))));
83267
83272
  }
83268
83273
  createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
83269
83274
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.22.2",
3
+ "version": "5.23.0-fixzeroes.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,