@kontur.candy/generator 5.27.0-fix-error-count.0 → 5.27.0-fixnavigation.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 +33 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -60364,6 +60364,7 @@ __webpack_require__.r(__webpack_exports__);
60364
60364
  /* harmony export */ getAllUnitIdInstances: () => (/* binding */ getAllUnitIdInstances),
60365
60365
  /* harmony export */ isUnitIdEquals: () => (/* binding */ isUnitIdEquals),
60366
60366
  /* harmony export */ sectionNameToUnitId: () => (/* binding */ sectionNameToUnitId),
60367
+ /* harmony export */ sectionNameToUnitIdForNavigation: () => (/* binding */ sectionNameToUnitIdForNavigation),
60367
60368
  /* harmony export */ unitIdToLegacyUnitId: () => (/* binding */ unitIdToLegacyUnitId),
60368
60369
  /* harmony export */ unitIdWithInstance: () => (/* binding */ unitIdWithInstance),
60369
60370
  /* harmony export */ unitWithoutInstance: () => (/* binding */ unitWithoutInstance)
@@ -60415,6 +60416,20 @@ function sectionNameToUnitId(sectionName) {
60415
60416
  };
60416
60417
  }
60417
60418
  }
60419
+ function sectionNameToUnitIdForNavigation(sectionName) {
60420
+ const [id, ...instances] = sectionName.split("-");
60421
+ if (instances.length === 0) {
60422
+ return {
60423
+ pageId: id !== null && id !== void 0 ? id : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)()
60424
+ };
60425
+ } else {
60426
+ var _instances$2;
60427
+ return {
60428
+ pageId: id !== null && id !== void 0 ? id : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(),
60429
+ instance: (_instances$2 = instances[0]) !== null && _instances$2 !== void 0 ? _instances$2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)()
60430
+ };
60431
+ }
60432
+ }
60418
60433
  function getAllUnitIdInstances(unitId) {
60419
60434
  var _unitId$parentInstanc, _unitId$instance;
60420
60435
  return ((_unitId$parentInstanc = unitId.parentInstances) !== null && _unitId$parentInstanc !== void 0 ? _unitId$parentInstanc : []).concat((_unitId$instance = unitId.instance) !== null && _unitId$instance !== void 0 ? _unitId$instance : []);
@@ -77750,6 +77765,13 @@ class DataDeclarationGenerationContext {
77750
77765
  }
77751
77766
  return undefined;
77752
77767
  }
77768
+ addTypeNode(node) {
77769
+ var _this$formSchemaRng$g;
77770
+ const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
77771
+ return baseType ? {
77772
+ type: baseType
77773
+ } : {};
77774
+ }
77753
77775
  processChildrenDataDeclaration(children, nodeProcessor) {
77754
77776
  const childrenDataDeclaration = [];
77755
77777
  for (const child of children) {
@@ -77788,7 +77810,7 @@ class DataDeclarationGenerationContext {
77788
77810
  declEntry[fieldName] = option;
77789
77811
  }
77790
77812
  return {
77791
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
77813
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()(declEntry, this.addTypeNode(sugarNode))
77792
77814
  };
77793
77815
  }
77794
77816
  addSpecialFieldsEntry(node, {
@@ -80937,7 +80959,8 @@ class FLangValidationBuildContext {
80937
80959
  }
80938
80960
  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
80961
  if (valueEqlAutoValueErrorLevel != undefined) {
80940
- const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression(valueReference, autoValueReference));
80962
+ const isDecimal = (schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType) === "decimal";
80963
+ 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
80964
  yield {
80942
80965
  condition: condition,
80943
80966
  message: makeMessage({
@@ -82383,6 +82406,7 @@ __webpack_require__.r(__webpack_exports__);
82383
82406
  /* harmony export */ combineByAndFlangExpr: () => (/* binding */ combineByAndFlangExpr),
82384
82407
  /* harmony export */ combineByOrFlangExpr: () => (/* binding */ combineByOrFlangExpr),
82385
82408
  /* harmony export */ combineRulesWithOptionalSectionChecking: () => (/* binding */ combineRulesWithOptionalSectionChecking),
82409
+ /* harmony export */ decimalWrapper: () => (/* binding */ decimalWrapper),
82386
82410
  /* harmony export */ ensureOperandsOfTypeOrNull: () => (/* binding */ ensureOperandsOfTypeOrNull),
82387
82411
  /* harmony export */ getAllExpressionChildren: () => (/* binding */ getAllExpressionChildren),
82388
82412
  /* harmony export */ nullCoalesceWithTypeCheck: () => (/* binding */ nullCoalesceWithTypeCheck),
@@ -82428,7 +82452,7 @@ function tryExtractValueReferenceAsStringFromDecimal(expression) {
82428
82452
  }
82429
82453
  return expression;
82430
82454
  }
82431
- function castOperandToStringIfNeed(operandExpression, decimalFormat) {
82455
+ function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82432
82456
  if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82433
82457
  return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82434
82458
  }
@@ -82443,6 +82467,7 @@ function castOperandToBoolIfNeed(operandExpression) {
82443
82467
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82444
82468
  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
82469
  }
82470
+ const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82446
82471
  function castOperandToDateTimeIfNeed(operandExpression) {
82447
82472
  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
82473
  }
@@ -83348,6 +83373,7 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83348
83373
  }
83349
83374
  }
83350
83375
  buildFormulaFlashRule(formula) {
83376
+ var _this$formSchemaRng$g;
83351
83377
  const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.match.replace(/\@/g, ""), true).normalize();
83352
83378
  const target = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.target.replace(/\@/g, ""), false);
83353
83379
  const fullTarget = (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(prefix.joinWith(target).normalize(), this.formSchemaRng, this.dataDeclarationHelper);
@@ -83355,10 +83381,11 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83355
83381
  const precalculationRules = [];
83356
83382
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83357
83383
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83384
+ const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83358
83385
  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
83386
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83360
83387
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83361
- const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
83388
+ const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;
83362
83389
  const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
83363
83390
  return result;
83364
83391
  }
@@ -83368,8 +83395,8 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83368
83395
  createRegularValueRule(fullTarget, getFormulaExpression) {
83369
83396
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
83370
83397
  }
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"))));
83398
+ createAutoFlagRule(fullTarget, isDecimal) {
83399
+ 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
83400
  }
83374
83401
  createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
83375
83402
  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-fix-error-count.0",
3
+ "version": "5.27.0-fixnavigation.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,