@kontur.candy/generator 5.34.0 → 5.35.1-fs-7820-fix-nested-optional-page-normalization.1

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 +70 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59828,6 +59828,11 @@ class ModelPathImpl {
59828
59828
  }
59829
59829
  return _PathMatcher__WEBPACK_IMPORTED_MODULE_4__.PathMatcher.match(this.tokens, modelPath.getPathPartsAsArray());
59830
59830
  }
59831
+ startsWith(modelPath) {
59832
+ const thisParts = this.getPathPartsAsArray();
59833
+ const otherParts = modelPath.getPathPartsAsArray();
59834
+ return otherParts.every((value, index) => value === thisParts[index]);
59835
+ }
59831
59836
  *splitByMultiplicity() {
59832
59837
  let lastSimpleParts = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(this.isAbsolute());
59833
59838
  for (const token of this.tokens) {
@@ -85889,7 +85894,9 @@ __webpack_require__.r(__webpack_exports__);
85889
85894
  /* harmony import */ var _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../SugarNodeConverter */ "./Generator/src/generators/markupGenerator/SugarNodeConverter.ts");
85890
85895
  /* harmony import */ var _getBindingPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
85891
85896
  /* harmony import */ var _Common_CandyApiClient_Types_DraftActions_CombineFufResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../../../../Common/CandyApiClient/Types/DraftActions/CombineFufResult */ "./Common/CandyApiClient/Types/DraftActions/CombineFufResult.ts");
85892
- /* harmony import */ var _DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DropDownButtonLoadExcelNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/Action/DropDownButtonLoadExcel/DropDownButtonLoadExcelNode.ts");
85897
+ /* harmony import */ var _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../../common/XmlParser/XmlNode */ "./Generator/src/common/XmlParser/XmlNode.ts");
85898
+ /* harmony import */ var _DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./DropDownButtonLoadExcelNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/Action/DropDownButtonLoadExcel/DropDownButtonLoadExcelNode.ts");
85899
+
85893
85900
 
85894
85901
 
85895
85902
 
@@ -85898,10 +85905,10 @@ __webpack_require__.r(__webpack_exports__);
85898
85905
 
85899
85906
  class DropDownButtonLoadExcelConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_2__.SugarNodeConverterBase {
85900
85907
  static getAcceptNodeClass() {
85901
- return _DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_5__.DropDownButtonLoadExcelNode;
85908
+ return _DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_6__.DropDownButtonLoadExcelNode;
85902
85909
  }
85903
85910
  get nodePaths() {
85904
- const node = this.getCurrentNodeAs(_DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_5__.DropDownButtonLoadExcelNode);
85911
+ const node = this.getCurrentNodeAs(_DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_6__.DropDownButtonLoadExcelNode);
85905
85912
  return [(0,_getBindingPath__WEBPACK_IMPORTED_MODULE_3__.getNewBindingPathExpression)(node)];
85906
85913
  }
85907
85914
  doBuildDataDeclaration(context) {
@@ -85914,8 +85921,8 @@ class DropDownButtonLoadExcelConverter extends _SugarNodeConverter__WEBPACK_IMPO
85914
85921
  // no children
85915
85922
  }
85916
85923
  doConvert(context) {
85917
- var _node$text, _node$textInLoading, _node$combinatorType, _node$combineType, _node$acceptGFVs;
85918
- const node = this.getCurrentNodeAs(_DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_5__.DropDownButtonLoadExcelNode);
85924
+ var _node$text, _node$textInLoading, _node$combinatorType, _node$combineType, _node$acceptGFVs, _node$needTypeId;
85925
+ const node = this.getCurrentNodeAs(_DropDownButtonLoadExcelNode__WEBPACK_IMPORTED_MODULE_6__.DropDownButtonLoadExcelNode);
85919
85926
  const markupBuilder = (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_1__.componentMarkupBuilder)("DropDownButtonLoadExcel");
85920
85927
  markupBuilder.prop(x => x.pathToTable).set(node.pathToTable);
85921
85928
  markupBuilder.prop("data-tid").set(node.tid);
@@ -85926,6 +85933,16 @@ class DropDownButtonLoadExcelConverter extends _SugarNodeConverter__WEBPACK_IMPO
85926
85933
  markupBuilder.prop(x => x.combinatorType).set((_node$combinatorType = node.combinatorType) !== null && _node$combinatorType !== void 0 ? _node$combinatorType : _Common_CandyApiClient_Types_DraftActions_CombineFufResult__WEBPACK_IMPORTED_MODULE_4__.CombinatorType.Default);
85927
85934
  markupBuilder.prop(x => x.combineType).set((_node$combineType = node.combineType) !== null && _node$combineType !== void 0 ? _node$combineType : _Common_CandyApiClient_Types_DraftActions_CombineFufResult__WEBPACK_IMPORTED_MODULE_4__.FufCombineMethod.AddToEnd);
85928
85935
  markupBuilder.prop(x => x.acceptGFVs).set((_node$acceptGFVs = node.acceptGFVs) !== null && _node$acceptGFVs !== void 0 ? _node$acceptGFVs : []);
85936
+ markupBuilder.prop(x => x.needTypeId).set((_node$needTypeId = node.needTypeId) !== null && _node$needTypeId !== void 0 ? _node$needTypeId : false);
85937
+ markupBuilder.prop(x => x.navigationPath).set(node.navigationPath);
85938
+ markupBuilder.prop(x => x.lastPathTokenPageExist).set(node.lastPathTokenPageExist);
85939
+ if (node.isOnlyAddToEnd && node.isOnlyReplace) {
85940
+ throw new _common_XmlParser_XmlNode__WEBPACK_IMPORTED_MODULE_5__.SugarAttributeReadError("В контроле должен быть только один атрибут: или isOnlyAddToEnd, или isOnlyReplace.", node, "isOnlyAddToEnd");
85941
+ } else {
85942
+ var _node$isOnlyAddToEnd, _node$isOnlyReplace;
85943
+ markupBuilder.prop(x => x.isOnlyAddToEnd).set((_node$isOnlyAddToEnd = node.isOnlyAddToEnd) !== null && _node$isOnlyAddToEnd !== void 0 ? _node$isOnlyAddToEnd : false);
85944
+ markupBuilder.prop(x => x.isOnlyReplace).set((_node$isOnlyReplace = node.isOnlyReplace) !== null && _node$isOnlyReplace !== void 0 ? _node$isOnlyReplace : false);
85945
+ }
85929
85946
  return markupBuilder.buildConverterResult();
85930
85947
  }
85931
85948
  }
@@ -85955,7 +85972,7 @@ __webpack_require__.r(__webpack_exports__);
85955
85972
 
85956
85973
 
85957
85974
 
85958
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
85975
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14;
85959
85976
 
85960
85977
 
85961
85978
 
@@ -85970,7 +85987,7 @@ let DropDownButtonLoadExcelNode = (_dec = (0,_Serializer_SugarSerializer__WEBPAC
85970
85987
  `), _dec9 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("combinatorType", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.enum(_Common_CandyApiClient_Types_DraftActions_CombineFufResult__WEBPACK_IMPORTED_MODULE_4__.CombinatorType.Default, _Common_CandyApiClient_Types_DraftActions_CombineFufResult__WEBPACK_IMPORTED_MODULE_4__.CombinatorType.XmlCombinatorByPath), `Default: использует умный комбинатор, который пишется флешами.
85971
85988
  XmlCombinatorByPath: новый вид комбинатора по пути. Перекладывает из фуфа в черновик 1 к 1.
85972
85989
  В связке с XmlCombinatorByPath - в combineType писать AddToEnd.
85973
- `), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("acceptGFVs", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.array(_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.string), `Разрешенные гфв, например старых форматов`), _dec(_class = (_class2 = class DropDownButtonLoadExcelNode extends _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.SugarNodeBase {
85990
+ `), _dec10 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("acceptGFVs", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.array(_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.string), `Разрешенные гфв, например старых форматов.`), _dec11 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("needTypeId", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.boolean, `Атрибут для вычисления typeId в загрузке excel, например в ЕФС. По умолчанию false.`), _dec12 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("navigationPath", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.string, `Путь для навигации, если он отличается от пути до таблицы (pathToTable). Если этот путь задан, то навигируется в него, иначе в pathToTable.`), _dec13 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("lastPathTokenPageExist", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.string, `Токен пути для определения заполненности раздела. Нужен в ЕФС-1.`), _dec14 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("isOnlyAddToEnd", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.boolean, `Если для формы реализована функция только добавления в конец, без замены. Например в ЕФС-1. По умолчанию false.`), _dec15 = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attr)("isOnlyReplace", _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.attrType.boolean, `Если для формы реализована функция только замены данных. Например в ЕФС-1 ДСВ-3. По умолчанию false.`), _dec(_class = (_class2 = class DropDownButtonLoadExcelNode extends _Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.SugarNodeBase {
85974
85991
  constructor(...args) {
85975
85992
  super(...args);
85976
85993
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "pathToTable", _descriptor, this);
@@ -85982,6 +85999,11 @@ let DropDownButtonLoadExcelNode = (_dec = (0,_Serializer_SugarSerializer__WEBPAC
85982
85999
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "combineType", _descriptor7, this);
85983
86000
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "combinatorType", _descriptor8, this);
85984
86001
  _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "acceptGFVs", _descriptor9, this);
86002
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "needTypeId", _descriptor10, this);
86003
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "navigationPath", _descriptor11, this);
86004
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "lastPathTokenPageExist", _descriptor12, this);
86005
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "isOnlyAddToEnd", _descriptor13, this);
86006
+ _babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "isOnlyReplace", _descriptor14, this);
85985
86007
  }
85986
86008
  }, (_descriptor = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "pathToTable", [_dec2], {
85987
86009
  configurable: true,
@@ -86028,6 +86050,31 @@ let DropDownButtonLoadExcelNode = (_dec = (0,_Serializer_SugarSerializer__WEBPAC
86028
86050
  enumerable: true,
86029
86051
  writable: true,
86030
86052
  initializer: null
86053
+ }), _descriptor10 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "needTypeId", [_dec11], {
86054
+ configurable: true,
86055
+ enumerable: true,
86056
+ writable: true,
86057
+ initializer: null
86058
+ }), _descriptor11 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "navigationPath", [_dec12], {
86059
+ configurable: true,
86060
+ enumerable: true,
86061
+ writable: true,
86062
+ initializer: null
86063
+ }), _descriptor12 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "lastPathTokenPageExist", [_dec13], {
86064
+ configurable: true,
86065
+ enumerable: true,
86066
+ writable: true,
86067
+ initializer: null
86068
+ }), _descriptor13 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "isOnlyAddToEnd", [_dec14], {
86069
+ configurable: true,
86070
+ enumerable: true,
86071
+ writable: true,
86072
+ initializer: null
86073
+ }), _descriptor14 = _babel_runtime_helpers_applyDecoratedDescriptor__WEBPACK_IMPORTED_MODULE_1___default()(_class2.prototype, "isOnlyReplace", [_dec15], {
86074
+ configurable: true,
86075
+ enumerable: true,
86076
+ writable: true,
86077
+ initializer: null
86031
86078
  })), _class2)) || _class);
86032
86079
 
86033
86080
  /***/ }),
@@ -89113,15 +89160,18 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89113
89160
  const rootPath = (0,_getRootPath__WEBPACK_IMPORTED_MODULE_3__.getRootPath)(node);
89114
89161
  const entrySections = ["default"];
89115
89162
  const optionalSections = this.findOptionalSections(node);
89163
+ const allSections = this.findAllSections(node);
89116
89164
  if (node.requisite) {
89117
89165
  entrySections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_12__.SectionNames.requisitesSection);
89118
89166
  }
89119
89167
  return {
89120
89168
  [rootPath]: optionalSections.length > 0 ? {
89121
89169
  section: entrySections,
89170
+ allSections: allSections,
89122
89171
  optionalSections: optionalSections
89123
89172
  } : {
89124
- section: entrySections
89173
+ section: entrySections,
89174
+ allSections: allSections
89125
89175
  }
89126
89176
  };
89127
89177
  }
@@ -89147,14 +89197,19 @@ class FormConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_7__.Sug
89147
89197
  }
89148
89198
  }
89149
89199
  findOptionalSections(node) {
89150
- const optionalPages = this.getAllPages(node.pages).filter(page => {
89200
+ const pages = this.findAllSections(node).filter(page => page.optional);
89201
+ return pages;
89202
+ }
89203
+ findAllSections(node) {
89204
+ const pages = this.getAllPages(node.pages).filter(page => !page.multiple).map(page => {
89151
89205
  var _page$optional;
89152
- return ((_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false) && !page.multiple;
89153
- }).map(page => ({
89154
- id: page.id,
89155
- path: page.getFullPath().toLegacyPath()
89156
- })).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id));
89157
- return optionalPages;
89206
+ return {
89207
+ id: page.id,
89208
+ path: page.getFullPath().toLegacyPath(),
89209
+ optional: (_page$optional = page.optional) !== null && _page$optional !== void 0 ? _page$optional : false
89210
+ };
89211
+ }).filter(x => (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.isNotNullOrUndefined)(x.id));
89212
+ return pages;
89158
89213
  }
89159
89214
  getAllPages(pages) {
89160
89215
  const allPages = pages.flatMap(page => this.getAllPages(page.pages));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.34.0",
3
+ "version": "5.35.1-fs-7820-fix-nested-optional-page-normalization.1",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,