@kontur.candy/generator 5.121.0-fixes-for-flang-generator.6 → 5.121.0-fixes-for-flang-generator.9

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 +87 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -47766,6 +47766,52 @@ function getMatchedAndDifferentModelPaths(baseModelPath, splittingModelPath) {
47766
47766
 
47767
47767
  /***/ }),
47768
47768
 
47769
+ /***/ "./Common/ModelPath/Set/AbsoluteModelPathSet.ts":
47770
+ /*!******************************************************!*\
47771
+ !*** ./Common/ModelPath/Set/AbsoluteModelPathSet.ts ***!
47772
+ \******************************************************/
47773
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
47774
+
47775
+ "use strict";
47776
+ __webpack_require__.r(__webpack_exports__);
47777
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
47778
+ /* harmony export */ AbsoluteModelPathSet: () => (/* binding */ AbsoluteModelPathSet)
47779
+ /* harmony export */ });
47780
+ /* harmony import */ var _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EachCurrentCollision */ "./Common/ModelPath/EachCurrentCollision.ts");
47781
+ /* harmony import */ var _Set2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Set2 */ "./Common/ModelPath/Set/Set2.ts");
47782
+
47783
+
47784
+ class AbsoluteModelPathSet extends _Set2__WEBPACK_IMPORTED_MODULE_1__.Set2 {
47785
+ constructor(eachCurrentCollision = _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_0__.EachCurrentCollision.AreSame) {
47786
+ super();
47787
+ this.eachCurrentCollision = void 0;
47788
+ this.eachCurrentCollision = eachCurrentCollision;
47789
+ }
47790
+ static *unique(paths) {
47791
+ const set = new AbsoluteModelPathSet();
47792
+ for (const path of paths) {
47793
+ if (set.add(path)) {
47794
+ yield path;
47795
+ }
47796
+ }
47797
+ }
47798
+ areItemsEqual(left, right) {
47799
+ return left.isEquals(right, this.eachCurrentCollision);
47800
+ }
47801
+ getItemHash(key) {
47802
+ return key.getHash(this.eachCurrentCollision);
47803
+ }
47804
+ static from(source) {
47805
+ const set = new AbsoluteModelPathSet();
47806
+ for (const sourceElement of source) {
47807
+ set.add(sourceElement);
47808
+ }
47809
+ return set;
47810
+ }
47811
+ }
47812
+
47813
+ /***/ }),
47814
+
47769
47815
  /***/ "./Common/ModelPath/Set/Set2.ts":
47770
47816
  /*!**************************************!*\
47771
47817
  !*** ./Common/ModelPath/Set/Set2.ts ***!
@@ -70404,6 +70450,11 @@ class DataDeclarationGenerationTimeHelper {
70404
70450
  const rootPath = this.getDataDeclarationRootPath();
70405
70451
  return (_this$dataDeclaration = (_this$dataDeclaration2 = this.dataDeclaration[rootPath]) === null || _this$dataDeclaration2 === void 0 ? void 0 : _this$dataDeclaration2.optionalSections) !== null && _this$dataDeclaration !== void 0 ? _this$dataDeclaration : [];
70406
70452
  }
70453
+ getAllSingleSections() {
70454
+ var _this$dataDeclaration3, _this$dataDeclaration4;
70455
+ const rootPath = this.getDataDeclarationRootPath();
70456
+ return (_this$dataDeclaration3 = (_this$dataDeclaration4 = this.dataDeclaration[rootPath]) === null || _this$dataDeclaration4 === void 0 ? void 0 : _this$dataDeclaration4.allSingleSections) !== null && _this$dataDeclaration3 !== void 0 ? _this$dataDeclaration3 : [];
70457
+ }
70407
70458
  getOptionalBlocksPaths() {
70408
70459
  const visibilityFieldsPaths = Object.keys(this.dataDeclaration).filter(path => path.endsWith(_Common_PathConstants__WEBPACK_IMPORTED_MODULE_5__.OptionalBlockVisibilityFieldName));
70409
70460
  const optionalBlocksPaths = visibilityFieldsPaths.map(fieldPath => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromMask)(fieldPath, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each).getParentPath());
@@ -71291,6 +71342,8 @@ __webpack_require__.r(__webpack_exports__);
71291
71342
  /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
71292
71343
  /* harmony import */ var _DataDeclarationGenerator_DataDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DataDeclarationGenerator/DataDeclaration */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclaration.ts");
71293
71344
  /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
71345
+ /* harmony import */ var _Common_ModelPath_Set_AbsoluteModelPathSet__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/ModelPath/Set/AbsoluteModelPathSet */ "./Common/ModelPath/Set/AbsoluteModelPathSet.ts");
71346
+
71294
71347
 
71295
71348
 
71296
71349
 
@@ -71343,9 +71396,9 @@ function buildFieldsConfiguration(path, dataDeclaration) {
71343
71396
  return resultFields;
71344
71397
  }
71345
71398
  function buildExtendedSchemaInfo(dataDeclaration) {
71399
+ const singleSectionsSet = _Common_ModelPath_Set_AbsoluteModelPathSet__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelPathSet.from(dataDeclaration.getAllSingleSections().map(x => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(x.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)));
71346
71400
  const nodes = new Map();
71347
71401
  for (const path of dataDeclaration.getAllPaths()) {
71348
- var _node$properties2;
71349
71402
  if (path.isEmpty() || path.endsWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each]))) {
71350
71403
  continue;
71351
71404
  }
@@ -71354,7 +71407,7 @@ function buildExtendedSchemaInfo(dataDeclaration) {
71354
71407
  const isPage = dataDeclaration.getPageId(path) != undefined;
71355
71408
  const optional = isPage ? dataDeclaration.isNodeOptional(path) : dataDeclaration.isNodeOptionalBySchemaOrSugar(path);
71356
71409
  const node = getOrCreateNode(nodes, path);
71357
- (_node$properties2 = node.properties) !== null && _node$properties2 !== void 0 ? _node$properties2 : node.properties = {};
71410
+ node.properties ??= {};
71358
71411
  const props = node.properties;
71359
71412
  if (isMultiple) {
71360
71413
  props.multiple = true;
@@ -71369,9 +71422,8 @@ function buildExtendedSchemaInfo(dataDeclaration) {
71369
71422
  props.optional = optional;
71370
71423
  props.type = dataDeclaration.getType(path);
71371
71424
  props.disabled = dataDeclaration.isNodeHasDisabledEntry(path);
71372
- if (isPage) {
71373
- props.isPage = isPage;
71374
- }
71425
+ props.isPage = isPage || undefined;
71426
+ props.isForceFilledOptional = isPage && isMultiple && singleSectionsSet.has(path) || undefined;
71375
71427
  props.fields = buildFieldsConfiguration(path, dataDeclaration);
71376
71428
  }
71377
71429
  return {
@@ -77180,7 +77232,7 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
77180
77232
  const allOptionalSections = this.dataDeclarationHelper.getOptionalSections();
77181
77233
  const section2PathsMap = this.dataDeclarationHelper.getAllPathsBySection();
77182
77234
  const childrenSectionsByParent = this.getChildrenSectionsByParent();
77183
- const allRules = allOptionalSections.filter(x => !this.dataDeclarationHelper.isNodeHasChildrenEntry(x.path)).map(x => {
77235
+ const allRules = allOptionalSections.map(x => {
77184
77236
  const allDependentSectionIds = this.getDependentSingleSections(x.id, childrenSectionsByParent).map(sectionInfo => sectionInfo.sectionId);
77185
77237
  const targetPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(x.path, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
77186
77238
  const pathsBySection = [x.id, ...allDependentSectionIds].flatMap(sectionId => {
@@ -77213,7 +77265,7 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
77213
77265
  while ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.arrayIsNotEmpty)(pagesToProcess)) {
77214
77266
  const info = pagesToProcess.pop();
77215
77267
  if (info != null && (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined)(info.page.path)) {
77216
- var _page$optional;
77268
+ var _page$optional, _page$multiple;
77217
77269
  const {
77218
77270
  page,
77219
77271
  parentId
@@ -77222,7 +77274,7 @@ class OptionalSectionRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MOD
77222
77274
  sectionId: page.id,
77223
77275
  path: page.getFullPath(),
77224
77276
  optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false,
77225
- multiple: this.dataDeclarationHelper.isNodeHasChildrenEntry(page.getFullPath()),
77277
+ multiple: (_page$multiple = page.multiple) !== null && _page$multiple !== void 0 ? _page$multiple : false,
77226
77278
  parentSectionId: parentId
77227
77279
  };
77228
77280
  pagesToProcess.push(...page.pages.map(x => ({
@@ -81372,13 +81424,13 @@ const predefinedJsConditions = {
81372
81424
  "Show5 == 'true'": "Show5 as string == 'true'",
81373
81425
  "checked1 == 'true'": "checked1 as string == 'true'",
81374
81426
  "checked2 == 'true'": "checked2 as string == 'true'",
81375
- "path('kind') === '1'": "kind == '1'",
81376
- "path('kind') === '2'": "kind == '2'",
81427
+ "path('kind') === '1'": "kind as string == '1'",
81428
+ "path('kind') === '2'": "kind as string == '2'",
81377
81429
  "path('ПризнакПродавец') === '1'": "ПризнакПродавец == 1",
81378
81430
  "path`('ПризнакПродавец') === '2'": "ПризнакПродавец == 2",
81379
81431
  "(path('checked1') === 'true' && path('checked2') === 'true') or (path('checked1') === 'true')": "(checked1 and checked2) or checked1",
81380
- "path('СНИЛС') != ''": "СНИЛС != ''",
81381
- "path('/Файл/LazyLoadingEnabled') !== 'true'": "not (/Файл/LazyLoadingEnabled == 'true')",
81432
+ "path('СНИЛС') != ''": "СНИЛС as string != ''",
81433
+ "path('/Файл/LazyLoadingEnabled') !== 'true'": "not (/Файл/LazyLoadingEnabled as string == 'true')",
81382
81434
  "path('НомКорр') !== '99'": "НомКорр != 99",
81383
81435
  "tableIsEmpty != 'true'": "tableIsEmpty as string != 'true'",
81384
81436
  "tableIsEmpty == 'true'": "tableIsEmpty as string == 'true'",
@@ -81414,27 +81466,27 @@ const predefinedJsConditions = {
81414
81466
  "path('/Root/D') === 'true'": "(/Root/D as string) == 'true'",
81415
81467
  "path('D') === 'true'": "(D as string) == 'true'",
81416
81468
  "path('../../../../ОтчетныйПериод/Месяц') != ''": "(../../../../ОтчетныйПериод/Месяц as string) != ''",
81417
- "path('ПолучДох/ФИО/Фамилия') != '' || path('ПолучДох/ФИО/Имя') != '' || path('ПолучДох/ФИО/Отчество') != ''": "ПолучДох/ФИО/Фамилия != '' or ПолучДох/ФИО/Имя != '' or ПолучДох/ФИО/Отчество != ''",
81418
- "(path('../../../ПолучДох/Статус') == '1' || path('../../../ПолучДох/Статус') == '7') && (path('../Ставка') == '13' || path('../Ставка') == '15')": "(../../../ПолучДох/Статус == '1' or ../../../ПолучДох/Статус == '7') and (../Ставка == '13' or ../Ставка == '15')",
81469
+ "path('ПолучДох/ФИО/Фамилия') != '' || path('ПолучДох/ФИО/Имя') != '' || path('ПолучДох/ФИО/Отчество') != ''": "ПолучДох/ФИО/Фамилия as string != '' or ПолучДох/ФИО/Имя as string != '' or ПолучДох/ФИО/Отчество as string != ''",
81470
+ "(path('../../../ПолучДох/Статус') == '1' || path('../../../ПолучДох/Статус') == '7') && (path('../Ставка') == '13' || path('../Ставка') == '15')": "(../../../ПолучДох/Статус as string == '1' or ../../../ПолучДох/Статус as string == '7') and (../Ставкаv as string == '13' or ../Ставка as string == '15')",
81419
81471
  "path('@formsClientInfo/sender/type') != '2'": "1 == 1",
81420
81472
  "path('@formsClientInfo/currentAccount/fns/representativeDocument/warrantId') != ''": "1 == 1",
81421
81473
  "path('КорНБЛиш') === 'true' || path('КорНБЛиш/КорНБЛишВс') != '' || path('КорНБЛиш/КорНБЛишГод/0/Год') != '' || path('КорНБЛишГод/0/КорНБЛишВс') != '' || path('КорНБЛиш/КорНБЛишГод/1/Год') != '' || path('КорНБЛишГод/1/КорНБЛишВс') != '' || path('КорНБЛиш/КорНБЛишГод/2/Год') != '' || path('КорНБЛишГод/2/КорНБЛишВс') != ''": "1 == 0",
81422
- "path('СвСчБанк/НаимБанк')": "СвСчБанк/НаимБанк != ''",
81423
- "path('../..//kpp') == ''": "../../kpp == ''",
81424
- "path('БанкРекв/СведБанк/НаимБанк')": "БанкРекв/СведБанк/НаимБанк != ''",
81425
- "path('БанкРекв/НаимБанк')": "БанкРекв/СведБанк/НаимБанк != ''",
81474
+ "path('СвСчБанк/НаимБанк')": "СвСчБанк/НаимБанк as string != ''",
81475
+ "path('../..//kpp') == ''": "../../kpp as string == ''",
81476
+ "path('БанкРекв/СведБанк/НаимБанк')": "БанкРекв/СведБанк/НаимБанк as string != ''",
81477
+ "path('БанкРекв/НаимБанк')": "БанкРекв/СведБанк/НаимБанк as string != ''",
81426
81478
  "path('T7R39C1_autovalue', 'visible') == 'true' || path('T7R39C1_autovalue', 'visible') == true": "1 == 1",
81427
81479
  'path("/Файл/Документ/РасчетСВ/ModalReplaceCategoryCode/КодКатЛиц_хешсет_строкой") == "[\\"\\"]" \n|| path("/Файл/Документ/РасчетСВ/ModalReplaceCategoryCode/КодКатЛиц_хешсет_строкой") == ""': "1 == 0",
81428
- ДекретДети: "exists(ДекретДети) and ДекретДети != ''",
81429
- "ТерриториальныеУсловия/ОснованиеТУ": "exists(ТерриториальныеУсловия/ОснованиеТУ) and ТерриториальныеУсловия/ОснованиеТУ != ''",
81430
- "ОсобыеУсловияТруда/ОснованиеОУТ": "exists(ОсобыеУсловияТруда/ОснованиеОУТ) and ОсобыеУсловияТруда/ОснованиеОУТ != ''",
81431
- "ИсчисляемыйСтаж/ОснованиеИС": "exists(ИсчисляемыйСтаж/ОснованиеИС) and ИсчисляемыйСтаж/ОснованиеИС != ''",
81432
- "ВыслугаЛет/ОснованиеВЛ": "exists(ВыслугаЛет/ОснованиеВЛ) and ВыслугаЛет/ОснованиеВЛ != ''",
81433
- ДопСведенияИС: "exists(ДопСведенияИС) and ДопСведенияИС != ''",
81434
- "ТУ/Основание": "exists(ТУ/Основание) and ТУ/Основание != ''",
81435
- "ОУТ/Код": "exists(ОУТ/Код) and ОУТ/Код != ''",
81436
- "ИС/Основание": "exists(ИС/Основание) and ИС/Основание != ''",
81437
- "ВЛ/Основание": "exists(ВЛ/Основание) and ВЛ/Основание != ''"
81480
+ ДекретДети: "exists(ДекретДети) and ДекретДети as string != ''",
81481
+ "ТерриториальныеУсловия/ОснованиеТУ": "exists(ТерриториальныеУсловия/ОснованиеТУ) and ТерриториальныеУсловия/ОснованиеТУ as string != ''",
81482
+ "ОсобыеУсловияТруда/ОснованиеОУТ": "exists(ОсобыеУсловияТруда/ОснованиеОУТ) and ОсобыеУсловияТруда/ОснованиеОУТ as string != ''",
81483
+ "ИсчисляемыйСтаж/ОснованиеИС": "exists(ИсчисляемыйСтаж/ОснованиеИС) and ИсчисляемыйСтаж/ОснованиеИС as string != ''",
81484
+ "ВыслугаЛет/ОснованиеВЛ": "exists(ВыслугаЛет/ОснованиеВЛ) and ВыслугаЛет/ОснованиеВЛ as string != ''",
81485
+ ДопСведенияИС: "exists(ДопСведенияИС) and ДопСведенияИС as string != ''",
81486
+ "ТУ/Основание": "exists(ТУ/Основание) and ТУ/Основание as string != ''",
81487
+ "ОУТ/Код": "exists(ОУТ/Код) and ОУТ/Код as string != ''",
81488
+ "ИС/Основание": "exists(ИС/Основание) and ИС/Основание as string != ''",
81489
+ "ВЛ/Основание": "exists(ВЛ/Основание) and ВЛ/Основание as string != ''"
81438
81490
  };
81439
81491
  function convertToKCLangCondition(node, condition) {
81440
81492
  var _tryConvertToKCLangCo;
@@ -83266,6 +83318,11 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
83266
83318
  section: [attachmentSection.id],
83267
83319
  pageId: attachmentSection.id
83268
83320
  };
83321
+ if (attachmentSection.optional) {
83322
+ result[attachmentSection.path] = {
83323
+ optional: [true]
83324
+ };
83325
+ }
83269
83326
  });
83270
83327
  return result;
83271
83328
  }
@@ -95491,10 +95548,10 @@ function getColumnWidths(node, guessContentWidthCallback) {
95491
95548
  let maxWidth = 0;
95492
95549
  let firstCondition = undefined;
95493
95550
  for (let r = 0; r < rows.length; r++) {
95494
- var _resultRows$r$numberC, _resultRows$r$numberC2, _firstCondition, _resultRows$r;
95551
+ var _resultRows$r$numberC, _resultRows$r$numberC2, _resultRows$r;
95495
95552
  // @ts-ignore RowsWorker.rows - какая-то не понятная шняга, я не могу её победить
95496
95553
  maxWidth = Math.max(maxWidth, (_resultRows$r$numberC = (_resultRows$r$numberC2 = resultRows[r][numberCol]) === null || _resultRows$r$numberC2 === void 0 ? void 0 : _resultRows$r$numberC2.width) !== null && _resultRows$r$numberC !== void 0 ? _resultRows$r$numberC : -Infinity);
95497
- (_firstCondition = firstCondition) !== null && _firstCondition !== void 0 ? _firstCondition : firstCondition = (_resultRows$r = resultRows[r]) === null || _resultRows$r === void 0 || (_resultRows$r = _resultRows$r[numberCol]) === null || _resultRows$r === void 0 ? void 0 : _resultRows$r.visibilityConditionExpression;
95554
+ firstCondition ??= (_resultRows$r = resultRows[r]) === null || _resultRows$r === void 0 || (_resultRows$r = _resultRows$r[numberCol]) === null || _resultRows$r === void 0 ? void 0 : _resultRows$r.visibilityConditionExpression;
95498
95555
  }
95499
95556
  return {
95500
95557
  width: maxWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.121.0-fixes-for-flang-generator.6",
3
+ "version": "5.121.0-fixes-for-flang-generator.9",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,