@kontur.candy/generator 4.250.0-sauron.8 → 4.251.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 +81 -65
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -112518,8 +112518,7 @@ __webpack_require__.r(__webpack_exports__);
112518
112518
  /* harmony export */ "createRelativeFromTokens": () => (/* binding */ createRelativeFromTokens),
112519
112519
  /* harmony export */ "joinModelPaths": () => (/* binding */ joinModelPaths),
112520
112520
  /* harmony export */ "AbsoluteModelFieldPath": () => (/* binding */ AbsoluteModelFieldPath),
112521
- /* harmony export */ "ModelPath": () => (/* binding */ ModelPath),
112522
- /* harmony export */ "AbsoluteModelPath": () => (/* binding */ AbsoluteModelPath)
112521
+ /* harmony export */ "ModelPathImpl": () => (/* binding */ ModelPathImpl)
112523
112522
  /* harmony export */ });
112524
112523
  /* harmony import */ var _IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../IterableUtils */ "./Common/IterableUtils.ts");
112525
112524
  /* harmony import */ var _TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TypingUtils */ "./Common/TypingUtils.ts");
@@ -112550,7 +112549,7 @@ class PathTokens {
112550
112549
  PathTokens.each = EachSymbol;
112551
112550
  PathTokens.current = CurrentSymbol;
112552
112551
  function isModelPath(path) {
112553
- return typeof path !== "string" && path instanceof ModelPath;
112552
+ return typeof path !== "string" && path instanceof ModelPathImpl;
112554
112553
  }
112555
112554
  function convertToLegacyPath(path) {
112556
112555
  return isModelPath(path) ? path.toLegacyPath() : path;
@@ -112559,10 +112558,10 @@ function convertToAbsolutModelPath(path) {
112559
112558
  return isModelPath(path) ? path : createAbsoluteFromMask(path, PathTokens.each);
112560
112559
  }
112561
112560
  function emptyModelPath() {
112562
- return new ModelPath([], false);
112561
+ return new ModelPathImpl([], false);
112563
112562
  }
112564
112563
  function emptyAbsoluteModelPath() {
112565
- return new AbsoluteModelPath([]);
112564
+ return new ModelPathImpl([], true);
112566
112565
  }
112567
112566
  function createModelPath(path, absolute) {
112568
112567
  const partPartStrings = path.split("/");
@@ -112570,43 +112569,43 @@ function createModelPath(path, absolute) {
112570
112569
 
112571
112570
  if (absolute === "auto") {
112572
112571
  if (path.startsWith("/")) {
112573
- return new ModelPath(partPartStrings.slice(1), true);
112572
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112574
112573
  } else {
112575
- return new ModelPath(partPartStrings, false);
112574
+ return new ModelPathImpl(partPartStrings, false);
112576
112575
  }
112577
112576
  }
112578
112577
 
112579
112578
  if (absolute && path.startsWith("/")) {
112580
- return new ModelPath(partPartStrings.slice(1), true);
112579
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112581
112580
  }
112582
112581
 
112583
- return new ModelPath(partPartStrings, absolute);
112582
+ return new ModelPathImpl(partPartStrings, absolute);
112584
112583
  }
112585
112584
  function createFromMask(path, absolute, multiplicitySymbol) {
112586
112585
  const partPartStrings = path.split("/").map(x => x === "*" ? multiplicitySymbol : x);
112587
112586
 
112588
112587
  if (absolute === "auto") {
112589
112588
  if (path.startsWith("/")) {
112590
- return new ModelPath(partPartStrings.slice(1), true);
112589
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112591
112590
  } else {
112592
- return new ModelPath(partPartStrings, false);
112591
+ return new ModelPathImpl(partPartStrings, false);
112593
112592
  }
112594
112593
  }
112595
112594
 
112596
112595
  if (absolute && path.startsWith("/")) {
112597
- return new ModelPath(partPartStrings.slice(1), true);
112596
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112598
112597
  }
112599
112598
 
112600
- return new ModelPath(partPartStrings, absolute);
112599
+ return new ModelPathImpl(partPartStrings, absolute);
112601
112600
  }
112602
112601
  function createAbsoluteFromMask(path, multiplicitySymbol) {
112603
112602
  const partPartStrings = path.split("/").map(x => x === "*" ? multiplicitySymbol : x);
112604
112603
 
112605
112604
  if (path.startsWith("/")) {
112606
- return new AbsoluteModelPath(partPartStrings.slice(1));
112605
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112607
112606
  }
112608
112607
 
112609
- return new AbsoluteModelPath(partPartStrings);
112608
+ return new ModelPathImpl(partPartStrings, true);
112610
112609
  }
112611
112610
 
112612
112611
  function ensurePlainPathPartsDoesNotContainMultiplicity(parts) {
@@ -112620,21 +112619,21 @@ function createAbsolute(path) {
112620
112619
  ensurePlainPathPartsDoesNotContainMultiplicity(partPartStrings);
112621
112620
 
112622
112621
  if (path.startsWith("/")) {
112623
- return new AbsoluteModelPath(partPartStrings.slice(1));
112622
+ return new ModelPathImpl(partPartStrings.slice(1), true);
112624
112623
  }
112625
112624
 
112626
- return new AbsoluteModelPath(partPartStrings);
112625
+ return new ModelPathImpl(partPartStrings, true);
112627
112626
  }
112628
112627
  function createRelativeResolvedModelPath(path) {
112629
112628
  const partPartStrings = path.split("/");
112630
112629
  ensurePlainPathPartsDoesNotContainMultiplicity(partPartStrings);
112631
- return new ModelPath(partPartStrings, false);
112630
+ return new ModelPathImpl(partPartStrings, false);
112632
112631
  }
112633
112632
  function createAbsoluteFromTokens(tokens) {
112634
- return new ModelPath(tokens, true);
112633
+ return new ModelPathImpl(tokens, true);
112635
112634
  }
112636
112635
  function createRelativeFromTokens(tokens) {
112637
- return new ModelPath(tokens, false);
112636
+ return new ModelPathImpl(tokens, false);
112638
112637
  }
112639
112638
  function joinModelPaths(...parts) {
112640
112639
  let absolute = false;
@@ -112643,7 +112642,7 @@ function joinModelPaths(...parts) {
112643
112642
  for (const joinItem of parts) {
112644
112643
  if (typeof joinItem === "string") {
112645
112644
  resultParts.push(joinItem);
112646
- } else if (joinItem instanceof ModelPath) {
112645
+ } else if (isModelPath(joinItem)) {
112647
112646
  if (joinItem.isAbsolute()) {
112648
112647
  absolute = true;
112649
112648
  resultParts = [...joinItem.getPathPartsAsArray()];
@@ -112657,7 +112656,7 @@ function joinModelPaths(...parts) {
112657
112656
  }
112658
112657
  }
112659
112658
 
112660
- return new ModelPath(resultParts, absolute);
112659
+ return new ModelPathImpl(resultParts, absolute);
112661
112660
  }
112662
112661
  class AbsoluteModelFieldPath {
112663
112662
  constructor(path, fieldName) {
@@ -112696,7 +112695,14 @@ class AbsoluteModelFieldPath {
112696
112695
  }
112697
112696
 
112698
112697
  }
112699
- class ModelPath {
112698
+
112699
+ function isAllTokensResolved(tokens) {
112700
+ // Я что-то немогу сообразить как тут всё строго написать...
112701
+ // @ts-expect-error
112702
+ return tokens.every(PathTokens.isSimpleToken);
112703
+ }
112704
+
112705
+ class ModelPathImpl {
112700
112706
  constructor(pathParts, absolute) {
112701
112707
  this.tokens = void 0;
112702
112708
  this.absolute = void 0;
@@ -112705,6 +112711,10 @@ class ModelPath {
112705
112711
  this.absolute = absolute;
112706
112712
  }
112707
112713
 
112714
+ get resolved() {
112715
+ return isAllTokensResolved(this.tokens);
112716
+ }
112717
+
112708
112718
  getPathParts() {
112709
112719
  return this.tokens;
112710
112720
  }
@@ -112741,6 +112751,7 @@ class ModelPath {
112741
112751
  }
112742
112752
 
112743
112753
  isResolved() {
112754
+ return isAllTokensResolved(this.tokens);
112744
112755
  return this.tokens.every(PathTokens.isSimpleToken);
112745
112756
  }
112746
112757
 
@@ -112752,7 +112763,7 @@ class ModelPath {
112752
112763
  return instance;
112753
112764
  }
112754
112765
  });
112755
- return new ModelPath(tokens, this.absolute);
112766
+ return new ModelPathImpl(tokens, this.absolute);
112756
112767
  }
112757
112768
 
112758
112769
  isContainIteration() {
@@ -112828,13 +112839,15 @@ class ModelPath {
112828
112839
  }
112829
112840
 
112830
112841
  isIncludes(modelPath) {
112831
- if (this.tokens.length !== modelPath.tokens.length) {
112842
+ const targetTokens = modelPath.getPathPartsAsArray();
112843
+
112844
+ if (this.tokens.length !== targetTokens.length) {
112832
112845
  return false;
112833
112846
  }
112834
112847
 
112835
112848
  for (let i = 0; i < this.tokens.length; i++) {
112836
112849
  const leftPart = this.tokens[i];
112837
- const rightPart = modelPath.tokens[i];
112850
+ const rightPart = targetTokens[i];
112838
112851
 
112839
112852
  if (typeof leftPart === "string") {
112840
112853
  if (typeof rightPart === "string") {
@@ -112883,7 +112896,7 @@ class ModelPath {
112883
112896
  throw new Error(`Cannot match non absolute path '${modelPath.toString()}'`);
112884
112897
  }
112885
112898
 
112886
- return _PathMatcher__WEBPACK_IMPORTED_MODULE_4__.PathMatcher.match(this.tokens, modelPath.tokens);
112899
+ return _PathMatcher__WEBPACK_IMPORTED_MODULE_4__.PathMatcher.match(this.tokens, modelPath.getPathPartsAsArray());
112887
112900
  }
112888
112901
 
112889
112902
  *splitByMultiplicity() {
@@ -112894,7 +112907,7 @@ class ModelPath {
112894
112907
  lastSimpleParts.append(token);
112895
112908
  } else {
112896
112909
  if (!lastSimpleParts.empty) {
112897
- yield lastSimpleParts.toPath();
112910
+ yield lastSimpleParts.toResolvedPath();
112898
112911
  lastSimpleParts = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(false);
112899
112912
  }
112900
112913
 
@@ -112903,7 +112916,7 @@ class ModelPath {
112903
112916
  }
112904
112917
 
112905
112918
  if (!lastSimpleParts.empty) {
112906
- yield lastSimpleParts.toPath();
112919
+ yield lastSimpleParts.toResolvedPath();
112907
112920
  }
112908
112921
  }
112909
112922
 
@@ -112930,7 +112943,7 @@ class ModelPath {
112930
112943
  resultTokens.push(pathPart);
112931
112944
  }
112932
112945
 
112933
- return new ModelPath(resultTokens, this.isAbsolute());
112946
+ return new ModelPathImpl(resultTokens, this.absolute);
112934
112947
  }
112935
112948
  /**
112936
112949
  * @summary Спецификаторы множественности Each заменяет на Current
@@ -112938,11 +112951,25 @@ class ModelPath {
112938
112951
 
112939
112952
 
112940
112953
  toCurrentIteration() {
112941
- return new ModelPath(this.tokens.map(x => x === PathTokens.each ? PathTokens.current : x), this.isAbsolute());
112954
+ if (this.isResolved()) {
112955
+ return this;
112956
+ } else {
112957
+ // NOTE Тут не получается наложить дискриминатор
112958
+ // @ts-expect-error
112959
+ const pathParts = this.tokens.map(x => x === PathTokens.each ? PathTokens.current : x);
112960
+ return new ModelPathImpl(pathParts, this.absolute);
112961
+ }
112942
112962
  }
112943
112963
 
112944
112964
  toEachIteration() {
112945
- return new ModelPath(this.tokens.map(x => x === PathTokens.current ? PathTokens.each : x), this.isAbsolute());
112965
+ if (this.isResolved()) {
112966
+ return this;
112967
+ } else {
112968
+ // NOTE Тут не получается наложить дискриминатор
112969
+ // @ts-expect-error
112970
+ const pathParts = this.tokens.map(x => x === PathTokens.current ? PathTokens.each : x);
112971
+ return new ModelPathImpl(pathParts, this.absolute);
112972
+ }
112946
112973
  }
112947
112974
 
112948
112975
  toAbsolute() {
@@ -112950,7 +112977,7 @@ class ModelPath {
112950
112977
  throw new Error(`Path '${this.toLegacyPath()} is not absolute'`);
112951
112978
  }
112952
112979
 
112953
- return new AbsoluteModelPath(this.tokens);
112980
+ return new ModelPathImpl(this.tokens, true);
112954
112981
  }
112955
112982
 
112956
112983
  *getAllParentPaths() {
@@ -112966,20 +112993,22 @@ class ModelPath {
112966
112993
  const lastItem = _IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.last(this.tokens);
112967
112994
 
112968
112995
  if (lastItem != undefined && PathTokens.isMultiToken(lastItem)) {
112969
- return new ModelPath(this.tokens.slice(0, -1), this.absolute);
112996
+ return new ModelPathImpl(this.tokens.slice(0, -1), this.absolute);
112970
112997
  }
112971
112998
 
112972
112999
  return this;
112973
113000
  }
112974
113001
 
112975
113002
  getParentPath() {
112976
- const result = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(this.isAbsolute());
113003
+ const result = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(this.absolute);
112977
113004
 
112978
113005
  for (const token of _IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.skipLast(this.getPathParts(), 1)) {
112979
113006
  result.append(token);
112980
- }
113007
+ } // Тут получается так, что по другому никак
113008
+ // @ts-expect-error
112981
113009
 
112982
- return result.toAbsolutePath();
113010
+
113011
+ return result.toPath();
112983
113012
  }
112984
113013
 
112985
113014
  applyInstancesDirty(instances) {
@@ -112988,7 +113017,7 @@ class ModelPath {
112988
113017
  }
112989
113018
 
112990
113019
  let instanceCounter = 0;
112991
- const result = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(false);
113020
+ const result = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(true);
112992
113021
 
112993
113022
  for (const token of this.getPathParts()) {
112994
113023
  if (PathTokens.isMultiToken(token) && instanceCounter < instances.length) {
@@ -112999,9 +113028,11 @@ class ModelPath {
112999
113028
  } else {
113000
113029
  result.append(token);
113001
113030
  }
113002
- }
113031
+ } // Тут получается так, что по другому никак
113032
+ // @ts-expect-error
113033
+
113003
113034
 
113004
- return result.toAbsolutePath();
113035
+ return result.toPath();
113005
113036
  }
113006
113037
 
113007
113038
  pathPartToString(pathPart) {
@@ -113020,30 +113051,6 @@ class ModelPath {
113020
113051
  throw new Error(`Unknown path part specified: ${(0,_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.ensureAndGetString)(pathPart)}`);
113021
113052
  }
113022
113053
 
113023
- }
113024
- class AbsoluteModelPath extends ModelPath {
113025
- constructor(pathParts) {
113026
- super(pathParts, true);
113027
- }
113028
-
113029
- joinWith(...path) {
113030
- return super.joinWith(...path).toAbsolute();
113031
- }
113032
-
113033
- getParentPath() {
113034
- const result = new _ModelPathBuilder__WEBPACK_IMPORTED_MODULE_3__.ModelPathBuilder(true);
113035
-
113036
- for (const token of _IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.skipLast(this.getPathParts(), 1)) {
113037
- result.append(token);
113038
- }
113039
-
113040
- return result.toAbsolutePath();
113041
- }
113042
-
113043
- applyInstancesDirty(instances) {
113044
- return super.applyInstancesDirty(instances).toAbsolute();
113045
- }
113046
-
113047
113054
  }
113048
113055
 
113049
113056
  /***/ }),
@@ -113085,6 +113092,16 @@ class ModelPathBuilder {
113085
113092
  return (0,_ModelPath__WEBPACK_IMPORTED_MODULE_0__.joinModelPaths)(...this.parts);
113086
113093
  }
113087
113094
 
113095
+ toResolvedPath() {
113096
+ const result = this.toPath();
113097
+
113098
+ if (!result.isResolved()) {
113099
+ throw new Error("Path cannot be casted to resolved");
113100
+ }
113101
+
113102
+ return result;
113103
+ }
113104
+
113088
113105
  toAbsolutePath() {
113089
113106
  return this.toPath().toAbsolute();
113090
113107
  }
@@ -146853,7 +146870,6 @@ class HeaderPanelConverter extends _SugarNodeConverter__WEBPACK_IMPORTED_MODULE_
146853
146870
  const markupBuilder = (0,_ComponentMarkupBuilder_ComponentMarkupBuilder__WEBPACK_IMPORTED_MODULE_1__.componentMarkupBuilder)("HeaderPanel");
146854
146871
  markupBuilder.appendChild(context.convertChildNodes(node.children));
146855
146872
  markupBuilder.prop(x => x.onBackButtonClick).set(context.generateHelperFunctionExpression(node, "onBackButtonClick", node.onBackButtonClick));
146856
- markupBuilder.prop(x => x.bindingPath).set(node.getFullPath());
146857
146873
  markupBuilder.prop(x => x.backButtonHint).set(node.backButtonHint);
146858
146874
  return markupBuilder.buildConverterResult();
146859
146875
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.250.0-sauron.8",
3
+ "version": "4.251.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,