@kontur.candy/generator 5.27.0-ss-doc-import.7 → 5.27.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 +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -77750,6 +77750,13 @@ class DataDeclarationGenerationContext {
77750
77750
  }
77751
77751
  return undefined;
77752
77752
  }
77753
+ addTypeNode(node) {
77754
+ var _this$formSchemaRng$g;
77755
+ const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
77756
+ return baseType ? {
77757
+ type: baseType
77758
+ } : {};
77759
+ }
77753
77760
  processChildrenDataDeclaration(children, nodeProcessor) {
77754
77761
  const childrenDataDeclaration = [];
77755
77762
  for (const child of children) {
@@ -77788,7 +77795,7 @@ class DataDeclarationGenerationContext {
77788
77795
  declEntry[fieldName] = option;
77789
77796
  }
77790
77797
  return {
77791
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
77798
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()(declEntry, this.addTypeNode(sugarNode))
77792
77799
  };
77793
77800
  }
77794
77801
  addSpecialFieldsEntry(node, {
@@ -80937,7 +80944,8 @@ class FLangValidationBuildContext {
80937
80944
  }
80938
80945
  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;
80939
80946
  if (valueEqlAutoValueErrorLevel != undefined) {
80940
- const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression(valueReference, autoValueReference));
80947
+ const isDecimal = (schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType) === "decimal";
80948
+ 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)));
80941
80949
  yield {
80942
80950
  condition: condition,
80943
80951
  message: makeMessage({
@@ -82383,6 +82391,7 @@ __webpack_require__.r(__webpack_exports__);
82383
82391
  /* harmony export */ combineByAndFlangExpr: () => (/* binding */ combineByAndFlangExpr),
82384
82392
  /* harmony export */ combineByOrFlangExpr: () => (/* binding */ combineByOrFlangExpr),
82385
82393
  /* harmony export */ combineRulesWithOptionalSectionChecking: () => (/* binding */ combineRulesWithOptionalSectionChecking),
82394
+ /* harmony export */ decimalWrapper: () => (/* binding */ decimalWrapper),
82386
82395
  /* harmony export */ ensureOperandsOfTypeOrNull: () => (/* binding */ ensureOperandsOfTypeOrNull),
82387
82396
  /* harmony export */ getAllExpressionChildren: () => (/* binding */ getAllExpressionChildren),
82388
82397
  /* harmony export */ nullCoalesceWithTypeCheck: () => (/* binding */ nullCoalesceWithTypeCheck),
@@ -82428,7 +82437,7 @@ function tryExtractValueReferenceAsStringFromDecimal(expression) {
82428
82437
  }
82429
82438
  return expression;
82430
82439
  }
82431
- function castOperandToStringIfNeed(operandExpression, decimalFormat) {
82440
+ function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82432
82441
  if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82433
82442
  return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82434
82443
  }
@@ -82443,6 +82452,7 @@ function castOperandToBoolIfNeed(operandExpression) {
82443
82452
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82444
82453
  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;
82445
82454
  }
82455
+ const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82446
82456
  function castOperandToDateTimeIfNeed(operandExpression) {
82447
82457
  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;
82448
82458
  }
@@ -83348,6 +83358,7 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83348
83358
  }
83349
83359
  }
83350
83360
  buildFormulaFlashRule(formula) {
83361
+ var _this$formSchemaRng$g;
83351
83362
  const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.match.replace(/\@/g, ""), true).normalize();
83352
83363
  const target = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.target.replace(/\@/g, ""), false);
83353
83364
  const fullTarget = (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(prefix.joinWith(target).normalize(), this.formSchemaRng, this.dataDeclarationHelper);
@@ -83355,10 +83366,11 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83355
83366
  const precalculationRules = [];
83356
83367
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83357
83368
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83369
+ const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83358
83370
  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));
83359
83371
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83360
83372
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83361
- const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
83373
+ const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;
83362
83374
  const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
83363
83375
  return result;
83364
83376
  }
@@ -83368,8 +83380,8 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83368
83380
  createRegularValueRule(fullTarget, getFormulaExpression) {
83369
83381
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
83370
83382
  }
83371
- createAutoFlagRule(fullTarget) {
83372
- 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"))));
83383
+ createAutoFlagRule(fullTarget, isDecimal) {
83384
+ 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"))));
83373
83385
  }
83374
83386
  createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
83375
83387
  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.27.0-ss-doc-import.7",
3
+ "version": "5.27.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,