@wcardinal/wcardinal-ui 0.207.0 → 0.208.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.
@@ -1,17 +1,11 @@
1
1
  import { EShapeDataMapper } from "./e-shape-data-mapper";
2
2
  import { EShapeDataValue } from "./e-shape-data-value";
3
3
  export declare class EShapeDataMapperImpl implements EShapeDataMapper {
4
- protected static SEPARATOR: string;
5
4
  protected static WILDCARD: string;
5
+ protected static SPANS: number[];
6
6
  protected _sources: string[] | null;
7
- protected _sourceIndices: number[];
8
- protected _targetIndices: number[];
9
- protected _targetIndicesLength: number;
10
7
  constructor(source?: string | null);
11
8
  map(value: EShapeDataValue, destinations: string[] | null, initial: string): void;
12
9
  protected newSources(source?: string | null): string[] | null;
13
- protected newValueId(destinations: string[], target: string, targetIndices: number[]): string | null;
14
- protected calcTargetIndices(target: string): void;
15
- protected newSourceIndices(sources: string[] | null): number[];
16
10
  static split(target?: string | null): string[] | null;
17
11
  }
@@ -4,11 +4,7 @@
4
4
  */
5
5
  var EShapeDataMapperImpl = /** @class */ (function () {
6
6
  function EShapeDataMapperImpl(source) {
7
- var sources = this.newSources(source);
8
- this._sources = sources;
9
- this._sourceIndices = this.newSourceIndices(sources);
10
- this._targetIndices = [];
11
- this._targetIndicesLength = 0;
7
+ this._sources = this.newSources(source);
12
8
  }
13
9
  EShapeDataMapperImpl.prototype.map = function (value, destinations, initial) {
14
10
  var sources = this._sources;
@@ -17,105 +13,74 @@ var EShapeDataMapperImpl = /** @class */ (function () {
17
13
  }
18
14
  var valueId = value.id;
19
15
  var target = valueId.toLowerCase();
20
- this.calcTargetIndices(target);
21
- var targetIndices = this._targetIndices;
22
- var targetIndicesLength = this._targetIndicesLength;
23
- var sourcesLength = sources.length;
24
- if (sourcesLength + 1 !== targetIndicesLength) {
16
+ var first = sources[0];
17
+ var firstLength = first.length;
18
+ if (firstLength !== 0 && target.indexOf(first) !== 0) {
25
19
  return;
26
20
  }
27
- for (var i = 0; i < sourcesLength; ++i) {
21
+ var spans = EShapeDataMapperImpl.SPANS;
22
+ spans[0] = 0;
23
+ spans[1] = firstLength;
24
+ var sourcesLength = sources.length;
25
+ var targetLength = target.length;
26
+ for (var i = 1; i < sourcesLength; ++i) {
27
+ var ispan = i << 1;
28
28
  var source = sources[i];
29
- var targetIndex0 = targetIndices[i];
30
- var targetIndex1 = targetIndices[i + 1];
31
- if (source !== EShapeDataMapperImpl.WILDCARD &&
32
- source !== target.substring(targetIndex0 + 1, targetIndex1)) {
33
- return;
29
+ var sourceLength = source.length;
30
+ if (sourceLength === 0) {
31
+ spans[ispan] = targetLength;
32
+ spans[ispan + 1] = targetLength;
33
+ }
34
+ else {
35
+ var index = target.indexOf(source, spans[ispan - 1]);
36
+ if (index < 0) {
37
+ return;
38
+ }
39
+ spans[ispan] = index;
40
+ spans[ispan + 1] = index + sourceLength;
34
41
  }
35
42
  }
36
- // Destination
43
+ // Update the ID
37
44
  if (destinations != null) {
38
- var id = this.newValueId(destinations, valueId, targetIndices);
39
- if (id != null) {
40
- value.id = id;
45
+ var destinationsLength = destinations.length;
46
+ var id = "";
47
+ for (var i = 0, imax = sourcesLength; i < imax; ++i) {
48
+ var id0 = i < destinationsLength ? destinations[i] : sources[i];
49
+ var ispan = i << 1;
50
+ var s0 = spans[ispan + 1];
51
+ var s1 = spans[ispan + 2];
52
+ var id1 = target.substring(s0, i + 1 < imax ? s1 : targetLength);
53
+ id += id0 + id1;
41
54
  }
55
+ value.id = id;
42
56
  }
43
- // Initial
57
+ // Update the initial value
44
58
  if (0 < initial.length) {
45
59
  value.initial = initial;
46
60
  }
47
61
  };
48
62
  EShapeDataMapperImpl.prototype.newSources = function (source) {
49
- if (source == null || source.length <= 0) {
63
+ if (source == null) {
50
64
  return null;
51
65
  }
52
- return source.toLowerCase().split(EShapeDataMapperImpl.SEPARATOR);
53
- };
54
- EShapeDataMapperImpl.prototype.newValueId = function (destinations, target, targetIndices) {
55
- var result = "";
56
- var delimiter = "";
57
- var wildcard = EShapeDataMapperImpl.WILDCARD;
58
- var separator = EShapeDataMapperImpl.SEPARATOR;
59
- var sourceIndices = this._sourceIndices;
60
- var sourceIndicesLength = sourceIndices.length;
61
- var index = sourceIndicesLength;
62
- for (var i = 0, imax = destinations.length; i < imax; ++i) {
63
- var d = destinations[imax - 1 - i];
64
- if (d === wildcard) {
65
- index -= 1;
66
- if (0 <= index) {
67
- var sourceIndex = sourceIndices[index];
68
- var targetIndex0 = targetIndices[sourceIndex];
69
- var targetIndex1 = targetIndices[sourceIndex + 1];
70
- result = target.substring(targetIndex0 + 1, targetIndex1) + delimiter + result;
71
- }
72
- else {
73
- return null;
74
- }
75
- }
76
- else {
77
- result = d + delimiter + result;
78
- }
79
- delimiter = separator;
80
- }
81
- return result;
82
- };
83
- EShapeDataMapperImpl.prototype.calcTargetIndices = function (target) {
84
- var targetIndices = this._targetIndices;
85
- var size = 1;
86
- targetIndices[0] = -1;
87
- var index0 = -1;
88
- var index1 = -1;
89
- while (0 <= (index1 = target.indexOf(EShapeDataMapperImpl.SEPARATOR, index0 + 1))) {
90
- targetIndices[size] = index1;
91
- index0 = index1;
92
- size += 1;
93
- }
94
- targetIndices[size] = target.length;
95
- size += 1;
96
- this._targetIndicesLength = size;
97
- };
98
- EShapeDataMapperImpl.prototype.newSourceIndices = function (sources) {
99
- var result = [];
100
- if (sources != null) {
101
- var wildcard = EShapeDataMapperImpl.WILDCARD;
102
- for (var i = 0, imax = sources.length; i < imax; ++i) {
103
- var s = sources[i];
104
- if (s === wildcard) {
105
- result.push(i);
106
- }
107
- }
66
+ var trimmed = source.trim();
67
+ if (trimmed.length <= 0) {
68
+ return null;
108
69
  }
109
- return result;
70
+ return trimmed.toLowerCase().split(EShapeDataMapperImpl.WILDCARD);
110
71
  };
111
72
  EShapeDataMapperImpl.split = function (target) {
112
- if (target == null || target.length <= 0) {
73
+ if (target == null) {
74
+ return null;
75
+ }
76
+ var trimmed = target.trim();
77
+ if (trimmed.length <= 0) {
113
78
  return null;
114
79
  }
115
- return target.split(this.SEPARATOR);
80
+ return trimmed.split(this.WILDCARD);
116
81
  };
117
- EShapeDataMapperImpl.SEPARATOR = ".";
118
82
  EShapeDataMapperImpl.WILDCARD = "*";
83
+ EShapeDataMapperImpl.SPANS = [];
119
84
  return EShapeDataMapperImpl;
120
85
  }());
121
86
  export { EShapeDataMapperImpl };
@@ -1 +1 @@
1
- {"version":3,"file":"e-shape-data-mapper-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-data-mapper-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;IASC,8BAAY,MAAsB;QACjC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,kCAAG,GAAH,UAAI,KAAsB,EAAE,YAA6B,EAAE,OAAe;QACzE,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,OAAO,IAAI,IAAI,EAAE;YACpB,OAAO;SACP;QACD,IAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;QACzB,IAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAM,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACtD,IAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACrC,IAAI,aAAa,GAAG,CAAC,KAAK,mBAAmB,EAAE;YAC9C,OAAO;SACP;QAED,K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C,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE;YAClF,aAAa,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YAC7B,MAAM,GAAG,MAAM,CAAC;YAChB,IAAI,IAAI,CAAC,CAAC;SACV;QACD,aAAa,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;QACpC,IAAI,IAAI,CAAC,CAAC;QACV,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAClC,CAAC;IAES,+CAAgB,GAA1B,UAA2B,OAAwB;QAClD,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,OAAO,IAAI,IAAI,EAAE;YACpB,IAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC;YAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;gBACrD,IAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,KAAK,QAAQ,EAAE;oBACnB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACf;aACD;SACD;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAEa,0BAAK,GAAnB,UAAoB,MAAsB;QACzC,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACzC,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAnIgB,8BAAS,GAAG,GAAG,CAAC;IAChB,6BAAQ,GAAG,GAAG,CAAC;IAmIjC,2BAAC;CAAA,AArID,IAqIC;SArIY,oBAAoB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeDataMapper } from \"./e-shape-data-mapper\";\nimport { EShapeDataValue } from \"./e-shape-data-value\";\n\nexport class EShapeDataMapperImpl implements EShapeDataMapper {\n\tprotected static SEPARATOR = \".\";\n\tprotected static WILDCARD = \"*\";\n\n\tprotected _sources: string[] | null;\n\tprotected _sourceIndices: number[];\n\tprotected _targetIndices: number[];\n\tprotected _targetIndicesLength: number;\n\n\tconstructor(source?: string | null) {\n\t\tconst sources = this.newSources(source);\n\t\tthis._sources = sources;\n\t\tthis._sourceIndices = this.newSourceIndices(sources);\n\t\tthis._targetIndices = [];\n\t\tthis._targetIndicesLength = 0;\n\t}\n\n\tmap(value: EShapeDataValue, destinations: string[] | null, initial: string): void {\n\t\tconst sources = this._sources;\n\t\tif (sources == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst valueId = value.id;\n\t\tconst target = valueId.toLowerCase();\n\t\tthis.calcTargetIndices(target);\n\t\tconst targetIndices = this._targetIndices;\n\t\tconst targetIndicesLength = this._targetIndicesLength;\n\t\tconst sourcesLength = sources.length;\n\t\tif (sourcesLength + 1 !== targetIndicesLength) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = 0; i < sourcesLength; ++i) {\n\t\t\tconst source = sources[i];\n\t\t\tconst targetIndex0 = targetIndices[i];\n\t\t\tconst targetIndex1 = targetIndices[i + 1];\n\t\t\tif (\n\t\t\t\tsource !== EShapeDataMapperImpl.WILDCARD &&\n\t\t\t\tsource !== target.substring(targetIndex0 + 1, targetIndex1)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Destination\n\t\tif (destinations != null) {\n\t\t\tconst id = this.newValueId(destinations, valueId, targetIndices);\n\t\t\tif (id != null) {\n\t\t\t\tvalue.id = id;\n\t\t\t}\n\t\t}\n\n\t\t// Initial\n\t\tif (0 < initial.length) {\n\t\t\tvalue.initial = initial;\n\t\t}\n\t}\n\n\tprotected newSources(source?: string | null): string[] | null {\n\t\tif (source == null || source.length <= 0) {\n\t\t\treturn null;\n\t\t}\n\t\treturn source.toLowerCase().split(EShapeDataMapperImpl.SEPARATOR);\n\t}\n\n\tprotected newValueId(\n\t\tdestinations: string[],\n\t\ttarget: string,\n\t\ttargetIndices: number[]\n\t): string | null {\n\t\tlet result: string = \"\";\n\t\tlet delimiter = \"\";\n\t\tconst wildcard = EShapeDataMapperImpl.WILDCARD;\n\t\tconst separator = EShapeDataMapperImpl.SEPARATOR;\n\t\tconst sourceIndices = this._sourceIndices;\n\t\tconst sourceIndicesLength = sourceIndices.length;\n\t\tlet index = sourceIndicesLength;\n\t\tfor (let i = 0, imax = destinations.length; i < imax; ++i) {\n\t\t\tconst d = destinations[imax - 1 - i];\n\t\t\tif (d === wildcard) {\n\t\t\t\tindex -= 1;\n\t\t\t\tif (0 <= index) {\n\t\t\t\t\tconst sourceIndex = sourceIndices[index];\n\t\t\t\t\tconst targetIndex0 = targetIndices[sourceIndex];\n\t\t\t\t\tconst targetIndex1 = targetIndices[sourceIndex + 1];\n\t\t\t\t\tresult = target.substring(targetIndex0 + 1, targetIndex1) + delimiter + result;\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult = d + delimiter + result;\n\t\t\t}\n\t\t\tdelimiter = separator;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected calcTargetIndices(target: string): void {\n\t\tconst targetIndices = this._targetIndices;\n\t\tlet size = 1;\n\t\ttargetIndices[0] = -1;\n\t\tlet index0 = -1;\n\t\tlet index1 = -1;\n\t\twhile (0 <= (index1 = target.indexOf(EShapeDataMapperImpl.SEPARATOR, index0 + 1))) {\n\t\t\ttargetIndices[size] = index1;\n\t\t\tindex0 = index1;\n\t\t\tsize += 1;\n\t\t}\n\t\ttargetIndices[size] = target.length;\n\t\tsize += 1;\n\t\tthis._targetIndicesLength = size;\n\t}\n\n\tprotected newSourceIndices(sources: string[] | null): number[] {\n\t\tconst result: number[] = [];\n\t\tif (sources != null) {\n\t\t\tconst wildcard = EShapeDataMapperImpl.WILDCARD;\n\t\t\tfor (let i = 0, imax = sources.length; i < imax; ++i) {\n\t\t\t\tconst s = sources[i];\n\t\t\t\tif (s === wildcard) {\n\t\t\t\t\tresult.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static split(target?: string | null): string[] | null {\n\t\tif (target == null || target.length <= 0) {\n\t\t\treturn null;\n\t\t}\n\t\treturn target.split(this.SEPARATOR);\n\t}\n}\n"]}
1
+ {"version":3,"file":"e-shape-data-mapper-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-data-mapper-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;IAKC,8BAAY,MAAsB;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,kCAAG,GAAH,UAAI,KAAsB,EAAE,YAA6B,EAAE,OAAe;QACzE,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,OAAO,IAAI,IAAI,EAAE;YACpB,OAAO;SACP;QAED,IAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;QACzB,IAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACrC,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;QACjC,IAAI,WAAW,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACrD,OAAO;SACP;QAED,IAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC;QACzC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,KAAK,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;QACvB,IAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACrC,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QAC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ShapeDataMapper } from \"./e-shape-data-mapper\";\nimport { EShapeDataValue } from \"./e-shape-data-value\";\n\nexport class EShapeDataMapperImpl implements EShapeDataMapper {\n\tprotected static WILDCARD = \"*\";\n\tprotected static SPANS: number[] = [];\n\tprotected _sources: string[] | null;\n\n\tconstructor(source?: string | null) {\n\t\tthis._sources = this.newSources(source);\n\t}\n\n\tmap(value: EShapeDataValue, destinations: string[] | null, initial: string): void {\n\t\tconst sources = this._sources;\n\t\tif (sources == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst valueId = value.id;\n\t\tconst target = valueId.toLowerCase();\n\t\tconst first = sources[0];\n\t\tconst firstLength = first.length;\n\t\tif (firstLength !== 0 && target.indexOf(first) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst spans = EShapeDataMapperImpl.SPANS;\n\t\tspans[0] = 0;\n\t\tspans[1] = firstLength;\n\t\tconst sourcesLength = sources.length;\n\t\tconst targetLength = target.length;\n\t\tfor (let i = 1; i < sourcesLength; ++i) {\n\t\t\tconst ispan = i << 1;\n\t\t\tconst source = sources[i];\n\t\t\tconst sourceLength = source.length;\n\t\t\tif (sourceLength === 0) {\n\t\t\t\tspans[ispan] = targetLength;\n\t\t\t\tspans[ispan + 1] = targetLength;\n\t\t\t} else {\n\t\t\t\tconst index = target.indexOf(source, spans[ispan - 1]);\n\t\t\t\tif (index < 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tspans[ispan] = index;\n\t\t\t\tspans[ispan + 1] = index + sourceLength;\n\t\t\t}\n\t\t}\n\n\t\t// Update the ID\n\t\tif (destinations != null) {\n\t\t\tconst destinationsLength = destinations.length;\n\t\t\tlet id = \"\";\n\t\t\tfor (let i = 0, imax = sourcesLength; i < imax; ++i) {\n\t\t\t\tconst id0 = i < destinationsLength ? destinations[i] : sources[i];\n\t\t\t\tconst ispan = i << 1;\n\t\t\t\tconst s0 = spans[ispan + 1];\n\t\t\t\tconst s1 = spans[ispan + 2];\n\t\t\t\tconst id1 = target.substring(s0, i + 1 < imax ? s1 : targetLength);\n\t\t\t\tid += id0 + id1;\n\t\t\t}\n\t\t\tvalue.id = id;\n\t\t}\n\n\t\t// Update the initial value\n\t\tif (0 < initial.length) {\n\t\t\tvalue.initial = initial;\n\t\t}\n\t}\n\n\tprotected newSources(source?: string | null): string[] | null {\n\t\tif (source == null) {\n\t\t\treturn null;\n\t\t}\n\t\tconst trimmed = source.trim();\n\t\tif (trimmed.length <= 0) {\n\t\t\treturn null;\n\t\t}\n\t\treturn trimmed.toLowerCase().split(EShapeDataMapperImpl.WILDCARD);\n\t}\n\n\tpublic static split(target?: string | null): string[] | null {\n\t\tif (target == null) {\n\t\t\treturn null;\n\t\t}\n\t\tconst trimmed = target.trim();\n\t\tif (trimmed.length <= 0) {\n\t\t\treturn null;\n\t\t}\n\t\treturn trimmed.split(this.WILDCARD);\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15523,11 +15523,7 @@ var DDiagramBaseControllerOpenType = {
15523
15523
  */
15524
15524
  var EShapeDataMapperImpl = /** @class */ (function () {
15525
15525
  function EShapeDataMapperImpl(source) {
15526
- var sources = this.newSources(source);
15527
- this._sources = sources;
15528
- this._sourceIndices = this.newSourceIndices(sources);
15529
- this._targetIndices = [];
15530
- this._targetIndicesLength = 0;
15526
+ this._sources = this.newSources(source);
15531
15527
  }
15532
15528
  EShapeDataMapperImpl.prototype.map = function (value, destinations, initial) {
15533
15529
  var sources = this._sources;
@@ -15536,105 +15532,74 @@ var EShapeDataMapperImpl = /** @class */ (function () {
15536
15532
  }
15537
15533
  var valueId = value.id;
15538
15534
  var target = valueId.toLowerCase();
15539
- this.calcTargetIndices(target);
15540
- var targetIndices = this._targetIndices;
15541
- var targetIndicesLength = this._targetIndicesLength;
15542
- var sourcesLength = sources.length;
15543
- if (sourcesLength + 1 !== targetIndicesLength) {
15535
+ var first = sources[0];
15536
+ var firstLength = first.length;
15537
+ if (firstLength !== 0 && target.indexOf(first) !== 0) {
15544
15538
  return;
15545
15539
  }
15546
- for (var i = 0; i < sourcesLength; ++i) {
15540
+ var spans = EShapeDataMapperImpl.SPANS;
15541
+ spans[0] = 0;
15542
+ spans[1] = firstLength;
15543
+ var sourcesLength = sources.length;
15544
+ var targetLength = target.length;
15545
+ for (var i = 1; i < sourcesLength; ++i) {
15546
+ var ispan = i << 1;
15547
15547
  var source = sources[i];
15548
- var targetIndex0 = targetIndices[i];
15549
- var targetIndex1 = targetIndices[i + 1];
15550
- if (source !== EShapeDataMapperImpl.WILDCARD &&
15551
- source !== target.substring(targetIndex0 + 1, targetIndex1)) {
15552
- return;
15548
+ var sourceLength = source.length;
15549
+ if (sourceLength === 0) {
15550
+ spans[ispan] = targetLength;
15551
+ spans[ispan + 1] = targetLength;
15553
15552
  }
15554
- }
15555
- // Destination
15556
- if (destinations != null) {
15557
- var id = this.newValueId(destinations, valueId, targetIndices);
15558
- if (id != null) {
15559
- value.id = id;
15553
+ else {
15554
+ var index = target.indexOf(source, spans[ispan - 1]);
15555
+ if (index < 0) {
15556
+ return;
15557
+ }
15558
+ spans[ispan] = index;
15559
+ spans[ispan + 1] = index + sourceLength;
15560
15560
  }
15561
15561
  }
15562
- // Initial
15562
+ // Update the ID
15563
+ if (destinations != null) {
15564
+ var destinationsLength = destinations.length;
15565
+ var id = "";
15566
+ for (var i = 0, imax = sourcesLength; i < imax; ++i) {
15567
+ var id0 = i < destinationsLength ? destinations[i] : sources[i];
15568
+ var ispan = i << 1;
15569
+ var s0 = spans[ispan + 1];
15570
+ var s1 = spans[ispan + 2];
15571
+ var id1 = target.substring(s0, i + 1 < imax ? s1 : targetLength);
15572
+ id += id0 + id1;
15573
+ }
15574
+ value.id = id;
15575
+ }
15576
+ // Update the initial value
15563
15577
  if (0 < initial.length) {
15564
15578
  value.initial = initial;
15565
15579
  }
15566
15580
  };
15567
15581
  EShapeDataMapperImpl.prototype.newSources = function (source) {
15568
- if (source == null || source.length <= 0) {
15582
+ if (source == null) {
15569
15583
  return null;
15570
15584
  }
15571
- return source.toLowerCase().split(EShapeDataMapperImpl.SEPARATOR);
15572
- };
15573
- EShapeDataMapperImpl.prototype.newValueId = function (destinations, target, targetIndices) {
15574
- var result = "";
15575
- var delimiter = "";
15576
- var wildcard = EShapeDataMapperImpl.WILDCARD;
15577
- var separator = EShapeDataMapperImpl.SEPARATOR;
15578
- var sourceIndices = this._sourceIndices;
15579
- var sourceIndicesLength = sourceIndices.length;
15580
- var index = sourceIndicesLength;
15581
- for (var i = 0, imax = destinations.length; i < imax; ++i) {
15582
- var d = destinations[imax - 1 - i];
15583
- if (d === wildcard) {
15584
- index -= 1;
15585
- if (0 <= index) {
15586
- var sourceIndex = sourceIndices[index];
15587
- var targetIndex0 = targetIndices[sourceIndex];
15588
- var targetIndex1 = targetIndices[sourceIndex + 1];
15589
- result = target.substring(targetIndex0 + 1, targetIndex1) + delimiter + result;
15590
- }
15591
- else {
15592
- return null;
15593
- }
15594
- }
15595
- else {
15596
- result = d + delimiter + result;
15597
- }
15598
- delimiter = separator;
15599
- }
15600
- return result;
15601
- };
15602
- EShapeDataMapperImpl.prototype.calcTargetIndices = function (target) {
15603
- var targetIndices = this._targetIndices;
15604
- var size = 1;
15605
- targetIndices[0] = -1;
15606
- var index0 = -1;
15607
- var index1 = -1;
15608
- while (0 <= (index1 = target.indexOf(EShapeDataMapperImpl.SEPARATOR, index0 + 1))) {
15609
- targetIndices[size] = index1;
15610
- index0 = index1;
15611
- size += 1;
15612
- }
15613
- targetIndices[size] = target.length;
15614
- size += 1;
15615
- this._targetIndicesLength = size;
15616
- };
15617
- EShapeDataMapperImpl.prototype.newSourceIndices = function (sources) {
15618
- var result = [];
15619
- if (sources != null) {
15620
- var wildcard = EShapeDataMapperImpl.WILDCARD;
15621
- for (var i = 0, imax = sources.length; i < imax; ++i) {
15622
- var s = sources[i];
15623
- if (s === wildcard) {
15624
- result.push(i);
15625
- }
15626
- }
15585
+ var trimmed = source.trim();
15586
+ if (trimmed.length <= 0) {
15587
+ return null;
15627
15588
  }
15628
- return result;
15589
+ return trimmed.toLowerCase().split(EShapeDataMapperImpl.WILDCARD);
15629
15590
  };
15630
15591
  EShapeDataMapperImpl.split = function (target) {
15631
- if (target == null || target.length <= 0) {
15592
+ if (target == null) {
15593
+ return null;
15594
+ }
15595
+ var trimmed = target.trim();
15596
+ if (trimmed.length <= 0) {
15632
15597
  return null;
15633
15598
  }
15634
- return target.split(this.SEPARATOR);
15599
+ return trimmed.split(this.WILDCARD);
15635
15600
  };
15636
- EShapeDataMapperImpl.SEPARATOR = ".";
15637
15601
  EShapeDataMapperImpl.WILDCARD = "*";
15602
+ EShapeDataMapperImpl.SPANS = [];
15638
15603
  return EShapeDataMapperImpl;
15639
15604
  }());
15640
15605
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.207.0
2
+ Winter Cardinal UI v0.208.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15520,11 +15520,7 @@
15520
15520
  */
15521
15521
  var EShapeDataMapperImpl = /** @class */ (function () {
15522
15522
  function EShapeDataMapperImpl(source) {
15523
- var sources = this.newSources(source);
15524
- this._sources = sources;
15525
- this._sourceIndices = this.newSourceIndices(sources);
15526
- this._targetIndices = [];
15527
- this._targetIndicesLength = 0;
15523
+ this._sources = this.newSources(source);
15528
15524
  }
15529
15525
  EShapeDataMapperImpl.prototype.map = function (value, destinations, initial) {
15530
15526
  var sources = this._sources;
@@ -15533,105 +15529,74 @@
15533
15529
  }
15534
15530
  var valueId = value.id;
15535
15531
  var target = valueId.toLowerCase();
15536
- this.calcTargetIndices(target);
15537
- var targetIndices = this._targetIndices;
15538
- var targetIndicesLength = this._targetIndicesLength;
15539
- var sourcesLength = sources.length;
15540
- if (sourcesLength + 1 !== targetIndicesLength) {
15532
+ var first = sources[0];
15533
+ var firstLength = first.length;
15534
+ if (firstLength !== 0 && target.indexOf(first) !== 0) {
15541
15535
  return;
15542
15536
  }
15543
- for (var i = 0; i < sourcesLength; ++i) {
15537
+ var spans = EShapeDataMapperImpl.SPANS;
15538
+ spans[0] = 0;
15539
+ spans[1] = firstLength;
15540
+ var sourcesLength = sources.length;
15541
+ var targetLength = target.length;
15542
+ for (var i = 1; i < sourcesLength; ++i) {
15543
+ var ispan = i << 1;
15544
15544
  var source = sources[i];
15545
- var targetIndex0 = targetIndices[i];
15546
- var targetIndex1 = targetIndices[i + 1];
15547
- if (source !== EShapeDataMapperImpl.WILDCARD &&
15548
- source !== target.substring(targetIndex0 + 1, targetIndex1)) {
15549
- return;
15545
+ var sourceLength = source.length;
15546
+ if (sourceLength === 0) {
15547
+ spans[ispan] = targetLength;
15548
+ spans[ispan + 1] = targetLength;
15550
15549
  }
15551
- }
15552
- // Destination
15553
- if (destinations != null) {
15554
- var id = this.newValueId(destinations, valueId, targetIndices);
15555
- if (id != null) {
15556
- value.id = id;
15550
+ else {
15551
+ var index = target.indexOf(source, spans[ispan - 1]);
15552
+ if (index < 0) {
15553
+ return;
15554
+ }
15555
+ spans[ispan] = index;
15556
+ spans[ispan + 1] = index + sourceLength;
15557
15557
  }
15558
15558
  }
15559
- // Initial
15559
+ // Update the ID
15560
+ if (destinations != null) {
15561
+ var destinationsLength = destinations.length;
15562
+ var id = "";
15563
+ for (var i = 0, imax = sourcesLength; i < imax; ++i) {
15564
+ var id0 = i < destinationsLength ? destinations[i] : sources[i];
15565
+ var ispan = i << 1;
15566
+ var s0 = spans[ispan + 1];
15567
+ var s1 = spans[ispan + 2];
15568
+ var id1 = target.substring(s0, i + 1 < imax ? s1 : targetLength);
15569
+ id += id0 + id1;
15570
+ }
15571
+ value.id = id;
15572
+ }
15573
+ // Update the initial value
15560
15574
  if (0 < initial.length) {
15561
15575
  value.initial = initial;
15562
15576
  }
15563
15577
  };
15564
15578
  EShapeDataMapperImpl.prototype.newSources = function (source) {
15565
- if (source == null || source.length <= 0) {
15579
+ if (source == null) {
15566
15580
  return null;
15567
15581
  }
15568
- return source.toLowerCase().split(EShapeDataMapperImpl.SEPARATOR);
15569
- };
15570
- EShapeDataMapperImpl.prototype.newValueId = function (destinations, target, targetIndices) {
15571
- var result = "";
15572
- var delimiter = "";
15573
- var wildcard = EShapeDataMapperImpl.WILDCARD;
15574
- var separator = EShapeDataMapperImpl.SEPARATOR;
15575
- var sourceIndices = this._sourceIndices;
15576
- var sourceIndicesLength = sourceIndices.length;
15577
- var index = sourceIndicesLength;
15578
- for (var i = 0, imax = destinations.length; i < imax; ++i) {
15579
- var d = destinations[imax - 1 - i];
15580
- if (d === wildcard) {
15581
- index -= 1;
15582
- if (0 <= index) {
15583
- var sourceIndex = sourceIndices[index];
15584
- var targetIndex0 = targetIndices[sourceIndex];
15585
- var targetIndex1 = targetIndices[sourceIndex + 1];
15586
- result = target.substring(targetIndex0 + 1, targetIndex1) + delimiter + result;
15587
- }
15588
- else {
15589
- return null;
15590
- }
15591
- }
15592
- else {
15593
- result = d + delimiter + result;
15594
- }
15595
- delimiter = separator;
15596
- }
15597
- return result;
15598
- };
15599
- EShapeDataMapperImpl.prototype.calcTargetIndices = function (target) {
15600
- var targetIndices = this._targetIndices;
15601
- var size = 1;
15602
- targetIndices[0] = -1;
15603
- var index0 = -1;
15604
- var index1 = -1;
15605
- while (0 <= (index1 = target.indexOf(EShapeDataMapperImpl.SEPARATOR, index0 + 1))) {
15606
- targetIndices[size] = index1;
15607
- index0 = index1;
15608
- size += 1;
15609
- }
15610
- targetIndices[size] = target.length;
15611
- size += 1;
15612
- this._targetIndicesLength = size;
15613
- };
15614
- EShapeDataMapperImpl.prototype.newSourceIndices = function (sources) {
15615
- var result = [];
15616
- if (sources != null) {
15617
- var wildcard = EShapeDataMapperImpl.WILDCARD;
15618
- for (var i = 0, imax = sources.length; i < imax; ++i) {
15619
- var s = sources[i];
15620
- if (s === wildcard) {
15621
- result.push(i);
15622
- }
15623
- }
15582
+ var trimmed = source.trim();
15583
+ if (trimmed.length <= 0) {
15584
+ return null;
15624
15585
  }
15625
- return result;
15586
+ return trimmed.toLowerCase().split(EShapeDataMapperImpl.WILDCARD);
15626
15587
  };
15627
15588
  EShapeDataMapperImpl.split = function (target) {
15628
- if (target == null || target.length <= 0) {
15589
+ if (target == null) {
15590
+ return null;
15591
+ }
15592
+ var trimmed = target.trim();
15593
+ if (trimmed.length <= 0) {
15629
15594
  return null;
15630
15595
  }
15631
- return target.split(this.SEPARATOR);
15596
+ return trimmed.split(this.WILDCARD);
15632
15597
  };
15633
- EShapeDataMapperImpl.SEPARATOR = ".";
15634
15598
  EShapeDataMapperImpl.WILDCARD = "*";
15599
+ EShapeDataMapperImpl.SPANS = [];
15635
15600
  return EShapeDataMapperImpl;
15636
15601
  }());
15637
15602