@aurigma/design-atoms-model 7.0.34 → 7.0.37

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 (330) hide show
  1. package/Collection.js +271 -514
  2. package/Collection.js.map +1 -1
  3. package/Colors/CmykColor.js +35 -69
  4. package/Colors/CmykColor.js.map +1 -1
  5. package/Colors/Color.js +11 -19
  6. package/Colors/Color.js.map +1 -1
  7. package/Colors/GrayscaleColor.js +23 -45
  8. package/Colors/GrayscaleColor.js.map +1 -1
  9. package/Colors/HsbColor.js +67 -85
  10. package/Colors/HsbColor.js.map +1 -1
  11. package/Colors/Ink.js +20 -35
  12. package/Colors/Ink.js.map +1 -1
  13. package/Colors/LabColor.js +29 -59
  14. package/Colors/LabColor.js.map +1 -1
  15. package/Colors/Palette.js +2 -21
  16. package/Colors/Palette.js.map +1 -1
  17. package/Colors/ProcessColor.js +24 -54
  18. package/Colors/ProcessColor.js.map +1 -1
  19. package/Colors/RgbColor.js +31 -61
  20. package/Colors/RgbColor.js.map +1 -1
  21. package/Colors/RgbColors.js +22 -54
  22. package/Colors/RgbColors.js.map +1 -1
  23. package/Colors/SpotColor.js +34 -68
  24. package/Colors/SpotColor.js.map +1 -1
  25. package/Colors/Swatch.js +16 -40
  26. package/Colors/Swatch.js.map +1 -1
  27. package/Colors/ValidationUtils.js +3 -5
  28. package/Colors/ValidationUtils.js.map +1 -1
  29. package/ColorsOld/CmykColor.js +54 -80
  30. package/ColorsOld/CmykColor.js.map +1 -1
  31. package/ColorsOld/Color.d.ts +1 -1
  32. package/ColorsOld/Color.js +25 -34
  33. package/ColorsOld/Color.js.map +1 -1
  34. package/ColorsOld/ColorFactory.js +30 -40
  35. package/ColorsOld/ColorFactory.js.map +1 -1
  36. package/ColorsOld/GrayscaleColor.js +29 -54
  37. package/ColorsOld/GrayscaleColor.js.map +1 -1
  38. package/ColorsOld/HsbColor.js +29 -35
  39. package/ColorsOld/HsbColor.js.map +1 -1
  40. package/ColorsOld/LabColor.js +35 -56
  41. package/ColorsOld/LabColor.js.map +1 -1
  42. package/ColorsOld/RgbColor.js +73 -114
  43. package/ColorsOld/RgbColor.js.map +1 -1
  44. package/ColorsOld/SpotColor.js +32 -53
  45. package/ColorsOld/SpotColor.js.map +1 -1
  46. package/ColorsOld/Utils.js +9 -13
  47. package/ColorsOld/Utils.js.map +1 -1
  48. package/Configuration/IRenderingConfig.js +1 -0
  49. package/Configuration/WatermarkConfig.js +17 -33
  50. package/Configuration/WatermarkConfig.js.map +1 -1
  51. package/Configuration/index.js +1 -0
  52. package/Configuration/index.js.map +1 -1
  53. package/Configuration.js +7 -11
  54. package/Configuration.js.map +1 -1
  55. package/EquatableKeyDictionary.js +43 -127
  56. package/EquatableKeyDictionary.js.map +1 -1
  57. package/EventObject.js +59 -136
  58. package/EventObject.js.map +1 -1
  59. package/Exception.d.ts +1 -1
  60. package/Exception.js +47 -88
  61. package/Exception.js.map +1 -1
  62. package/INotifyPropertyChanged.d.ts +1 -1
  63. package/INotifyPropertyChanged.js +1 -0
  64. package/Math/Array.js +3 -3
  65. package/Math/Array.js.map +1 -1
  66. package/Math/Common.js +13 -15
  67. package/Math/Common.js.map +1 -1
  68. package/Math/ILtrb.js +1 -0
  69. package/Math/IPoint.js +1 -0
  70. package/Math/ISize.js +1 -0
  71. package/Math/Margin.js +62 -99
  72. package/Math/Margin.js.map +1 -1
  73. package/Math/Matrix.js +63 -94
  74. package/Math/Matrix.js.map +1 -1
  75. package/Math/Path.d.ts +1 -1
  76. package/Math/Path.js +149 -234
  77. package/Math/Path.js.map +1 -1
  78. package/Math/PointF.js +31 -34
  79. package/Math/PointF.js.map +1 -1
  80. package/Math/RectangleF.js +119 -159
  81. package/Math/RectangleF.js.map +1 -1
  82. package/Math/RotatedRectangleF.js +132 -147
  83. package/Math/RotatedRectangleF.js.map +1 -1
  84. package/Math/SizeF.js +10 -12
  85. package/Math/SizeF.js.map +1 -1
  86. package/Math/Transform.js +50 -80
  87. package/Math/Transform.js.map +1 -1
  88. package/Math/index.js +3 -0
  89. package/Math/index.js.map +1 -1
  90. package/Product/Constraints/ContainerConstraints.js +11 -13
  91. package/Product/Constraints/ContainerConstraints.js.map +1 -1
  92. package/Product/Constraints/MaxArtworkSizeConstraints.d.ts +1 -1
  93. package/Product/Constraints/MaxArtworkSizeConstraints.js +10 -12
  94. package/Product/Constraints/MaxArtworkSizeConstraints.js.map +1 -1
  95. package/Product/Constraints/PrintingTechniqueConstraints.js +10 -13
  96. package/Product/Constraints/PrintingTechniqueConstraints.js.map +1 -1
  97. package/Product/Container.d.ts +10 -10
  98. package/Product/Container.js +253 -375
  99. package/Product/Container.js.map +1 -1
  100. package/Product/ContainerVisualization.d.ts +1 -0
  101. package/Product/ContainerVisualization.js +31 -56
  102. package/Product/ContainerVisualization.js.map +1 -1
  103. package/Product/Convert/CornerRadiusConverter.js +32 -34
  104. package/Product/Convert/CornerRadiusConverter.js.map +1 -1
  105. package/Product/CropMark.js +28 -40
  106. package/Product/CropMark.js.map +1 -1
  107. package/Product/Decorators/Factory/AbstractFactory.js +13 -23
  108. package/Product/Decorators/Factory/AbstractFactory.js.map +1 -1
  109. package/Product/Decorators/Factory/CollectionFactory.js +10 -45
  110. package/Product/Decorators/Factory/CollectionFactory.js.map +1 -1
  111. package/Product/Decorators/Factory/ColorFactory.js +13 -35
  112. package/Product/Decorators/Factory/ColorFactory.js.map +1 -1
  113. package/Product/Decorators/Factory/ObjectFactory.js +10 -45
  114. package/Product/Decorators/Factory/ObjectFactory.js.map +1 -1
  115. package/Product/Decorators/Factory/SimpleFactory.js +11 -21
  116. package/Product/Decorators/Factory/SimpleFactory.js.map +1 -1
  117. package/Product/Decorators/Interfaces/IInputPropertyMetadata.d.ts +1 -1
  118. package/Product/Decorators/Interfaces/IInputPropertyMetadata.js +1 -0
  119. package/Product/Decorators/Interfaces/IObjectMetadata.js +1 -0
  120. package/Product/Decorators/Interfaces/IPropertyMetadata.js +1 -0
  121. package/Product/Decorators/ItemsMetadata.js +11 -13
  122. package/Product/Decorators/ItemsMetadata.js.map +1 -1
  123. package/Product/Decorators/Property.js +4 -4
  124. package/Product/Decorators/Property.js.map +1 -1
  125. package/Product/Decorators/PropertyChanged.js +1 -1
  126. package/Product/Decorators/PropertyChanged.js.map +1 -1
  127. package/Product/Decorators/index.js +1 -0
  128. package/Product/Decorators/index.js.map +1 -1
  129. package/Product/Effects/ColorDictionaryEntry.js +3 -5
  130. package/Product/Effects/ColorDictionaryEntry.js.map +1 -1
  131. package/Product/Effects/NDEffectParameters.js +2 -6
  132. package/Product/Effects/NDEffectParameters.js.map +1 -1
  133. package/Product/Effects/NDEffects.d.ts +1 -0
  134. package/Product/Effects/NDEffects.js +20 -27
  135. package/Product/Effects/NDEffects.js.map +1 -1
  136. package/Product/Effects/RecolorEffectParameters.d.ts +1 -0
  137. package/Product/Effects/RecolorEffectParameters.js +44 -89
  138. package/Product/Effects/RecolorEffectParameters.js.map +1 -1
  139. package/Product/IGetAllItemsOptions.js +1 -0
  140. package/Product/InteractiveZone.js +34 -66
  141. package/Product/InteractiveZone.js.map +1 -1
  142. package/Product/Interfaces/IColorWithTitle.js +1 -0
  143. package/Product/Interfaces/IDataSet.js +1 -0
  144. package/Product/Interfaces/IFontSettings.js +1 -0
  145. package/Product/Interfaces/IItemData.js +1 -0
  146. package/Product/Interfaces/IPdfMetadata.js +1 -0
  147. package/Product/Interfaces/IProductThemeConfig.js +1 -0
  148. package/Product/Interfaces/IShadowSettings.js +1 -0
  149. package/Product/Interfaces/IStrokeSettings.js +1 -0
  150. package/Product/Interfaces/index.js +3 -0
  151. package/Product/Interfaces/index.js.map +1 -1
  152. package/Product/ItemMask.js +20 -26
  153. package/Product/ItemMask.js.map +1 -1
  154. package/Product/Items/ArchedTextItem.js +65 -100
  155. package/Product/Items/ArchedTextItem.js.map +1 -1
  156. package/Product/Items/AutoScaledTextItem.js +35 -62
  157. package/Product/Items/AutoScaledTextItem.js.map +1 -1
  158. package/Product/Items/BarcodeData.d.ts +1 -1
  159. package/Product/Items/BarcodeData.js +62 -91
  160. package/Product/Items/BarcodeData.js.map +1 -1
  161. package/Product/Items/BarcodeItem.js +249 -298
  162. package/Product/Items/BarcodeItem.js.map +1 -1
  163. package/Product/Items/BarcodePermissions.js +38 -52
  164. package/Product/Items/BarcodePermissions.js.map +1 -1
  165. package/Product/Items/BaseItem.js +30 -53
  166. package/Product/Items/BaseItem.js.map +1 -1
  167. package/Product/Items/BaseTextItem.d.ts +2 -2
  168. package/Product/Items/BaseTextItem.js +451 -625
  169. package/Product/Items/BaseTextItem.js.map +1 -1
  170. package/Product/Items/BoundedTextItem.js +184 -255
  171. package/Product/Items/BoundedTextItem.js.map +1 -1
  172. package/Product/Items/ClipartItem.js +82 -175
  173. package/Product/Items/ClipartItem.js.map +1 -1
  174. package/Product/Items/ContentItem.js +52 -80
  175. package/Product/Items/ContentItem.js.map +1 -1
  176. package/Product/Items/ContentPermissions.js +36 -47
  177. package/Product/Items/ContentPermissions.js.map +1 -1
  178. package/Product/Items/CurvedTextItem.js +106 -158
  179. package/Product/Items/CurvedTextItem.js.map +1 -1
  180. package/Product/Items/DashedLineItem.js +45 -76
  181. package/Product/Items/DashedLineItem.js.map +1 -1
  182. package/Product/Items/EllipseItem.js +11 -31
  183. package/Product/Items/EllipseItem.js.map +1 -1
  184. package/Product/Items/FrontEndPermissions.js +20 -26
  185. package/Product/Items/FrontEndPermissions.js.map +1 -1
  186. package/Product/Items/GridItem.js +107 -162
  187. package/Product/Items/GridItem.js.map +1 -1
  188. package/Product/Items/GroupItem.js +95 -172
  189. package/Product/Items/GroupItem.js.map +1 -1
  190. package/Product/Items/GroupItemPermissions.js +42 -56
  191. package/Product/Items/GroupItemPermissions.js.map +1 -1
  192. package/Product/Items/ImageItem.d.ts +9 -4
  193. package/Product/Items/ImageItem.js +319 -430
  194. package/Product/Items/ImageItem.js.map +1 -1
  195. package/Product/Items/ImageMetaData.js +14 -15
  196. package/Product/Items/ImageMetaData.js.map +1 -1
  197. package/Product/Items/ImagePermissions.js +42 -56
  198. package/Product/Items/ImagePermissions.js.map +1 -1
  199. package/Product/Items/ImageViolationSettings.js +18 -35
  200. package/Product/Items/ImageViolationSettings.js.map +1 -1
  201. package/Product/Items/InStringPlaceholder.d.ts +2 -1
  202. package/Product/Items/InStringPlaceholder.js +52 -101
  203. package/Product/Items/InStringPlaceholder.js.map +1 -1
  204. package/Product/Items/Item.d.ts +1 -1
  205. package/Product/Items/Item.js +278 -370
  206. package/Product/Items/Item.js.map +1 -1
  207. package/Product/Items/ItemPermissions.js +54 -73
  208. package/Product/Items/ItemPermissions.js.map +1 -1
  209. package/Product/Items/ItemToolbarPermissions.js +61 -80
  210. package/Product/Items/ItemToolbarPermissions.js.map +1 -1
  211. package/Product/Items/LayoutItem.js +241 -326
  212. package/Product/Items/LayoutItem.js.map +1 -1
  213. package/Product/Items/LineItem.js +109 -156
  214. package/Product/Items/LineItem.js.map +1 -1
  215. package/Product/Items/LinePermissions.js +29 -39
  216. package/Product/Items/LinePermissions.js.map +1 -1
  217. package/Product/Items/ManipulationPermissions.d.ts +1 -1
  218. package/Product/Items/ManipulationPermissions.js +94 -135
  219. package/Product/Items/ManipulationPermissions.js.map +1 -1
  220. package/Product/Items/OpenTypeFeature.d.ts +1 -1
  221. package/Product/Items/OpenTypeFeature.js +3 -5
  222. package/Product/Items/OpenTypeFeature.js.map +1 -1
  223. package/Product/Items/OverlayEffect.js +56 -70
  224. package/Product/Items/OverlayEffect.js.map +1 -1
  225. package/Product/Items/ParagraphSettings.js +9 -11
  226. package/Product/Items/ParagraphSettings.js.map +1 -1
  227. package/Product/Items/PathBoundedTextItem.js +116 -166
  228. package/Product/Items/PathBoundedTextItem.js.map +1 -1
  229. package/Product/Items/PathBoundedTextPermissions.js +20 -26
  230. package/Product/Items/PathBoundedTextPermissions.js.map +1 -1
  231. package/Product/Items/PlaceholderItem.d.ts +1 -1
  232. package/Product/Items/PlaceholderItem.js +310 -419
  233. package/Product/Items/PlaceholderItem.js.map +1 -1
  234. package/Product/Items/PlaceholderPermissions.js +38 -47
  235. package/Product/Items/PlaceholderPermissions.js.map +1 -1
  236. package/Product/Items/PlainTextItem.js +45 -74
  237. package/Product/Items/PlainTextItem.js.map +1 -1
  238. package/Product/Items/PolylineItem.js +51 -81
  239. package/Product/Items/PolylineItem.js.map +1 -1
  240. package/Product/Items/RectangleItem.js +10 -30
  241. package/Product/Items/RectangleItem.js.map +1 -1
  242. package/Product/Items/ResizeGripsPermissions.d.ts +5 -4
  243. package/Product/Items/ResizeGripsPermissions.js +75 -94
  244. package/Product/Items/ResizeGripsPermissions.js.map +1 -1
  245. package/Product/Items/ShadowSettings.js +51 -69
  246. package/Product/Items/ShadowSettings.js.map +1 -1
  247. package/Product/Items/ShapeItem.js +182 -250
  248. package/Product/Items/ShapeItem.js.map +1 -1
  249. package/Product/Items/ShapePermissions.js +38 -52
  250. package/Product/Items/ShapePermissions.js.map +1 -1
  251. package/Product/Items/ShapeViolationSettings.js +18 -36
  252. package/Product/Items/ShapeViolationSettings.js.map +1 -1
  253. package/Product/Items/Size.js +7 -11
  254. package/Product/Items/Size.js.map +1 -1
  255. package/Product/Items/SmartItem.js +21 -41
  256. package/Product/Items/SmartItem.js.map +1 -1
  257. package/Product/Items/StrokeSettings.js +48 -62
  258. package/Product/Items/StrokeSettings.js.map +1 -1
  259. package/Product/Items/TextEnums.d.ts +2 -1
  260. package/Product/Items/TextEnums.js +1 -0
  261. package/Product/Items/TextEnums.js.map +1 -1
  262. package/Product/Items/TextPermissions.js +56 -58
  263. package/Product/Items/TextPermissions.js.map +1 -1
  264. package/Product/Items/TextViolationSettings.js +23 -40
  265. package/Product/Items/TextViolationSettings.js.map +1 -1
  266. package/Product/Items/ThemeBinding.d.ts +2 -1
  267. package/Product/Items/ThemeBinding.js +13 -15
  268. package/Product/Items/ThemeBinding.js.map +1 -1
  269. package/Product/Items/ViolationSettings.js +26 -44
  270. package/Product/Items/ViolationSettings.js.map +1 -1
  271. package/Product/Items/VisualizationPermissions.js +29 -39
  272. package/Product/Items/VisualizationPermissions.js.map +1 -1
  273. package/Product/ItemsData/ItemData.js +8 -24
  274. package/Product/ItemsData/ItemData.js.map +1 -1
  275. package/Product/ModelComponent.js +41 -63
  276. package/Product/ModelComponent.js.map +1 -1
  277. package/Product/PrintArea.d.ts +1 -0
  278. package/Product/PrintArea.js +132 -178
  279. package/Product/PrintArea.js.map +1 -1
  280. package/Product/Product.js +67 -105
  281. package/Product/Product.js.map +1 -1
  282. package/Product/SafetyLine.d.ts +1 -1
  283. package/Product/SafetyLine.js +90 -124
  284. package/Product/SafetyLine.js.map +1 -1
  285. package/Product/Surface.d.ts +2 -1
  286. package/Product/Surface.js +193 -287
  287. package/Product/Surface.js.map +1 -1
  288. package/Product/SurfaceMockup.js +40 -73
  289. package/Product/SurfaceMockup.js.map +1 -1
  290. package/Product/Uuid.js +19 -25
  291. package/Product/Uuid.js.map +1 -1
  292. package/Product/Watermark.js +5 -9
  293. package/Product/Watermark.js.map +1 -1
  294. package/Product/index.js +1 -0
  295. package/Product/index.js.map +1 -1
  296. package/Serialization/IProductSerializer.js +1 -0
  297. package/Utils/Environment.d.ts +1 -1
  298. package/Utils/Environment.js +24 -44
  299. package/Utils/Environment.js.map +1 -1
  300. package/Utils/Exceptions.js +5 -5
  301. package/Utils/Exceptions.js.map +1 -1
  302. package/Utils/Items.js +19 -19
  303. package/Utils/Items.js.map +1 -1
  304. package/Utils/Types/Action.d.ts +5 -1
  305. package/Utils/Types/Action.js +1 -0
  306. package/Utils/Types/AnyFunction.d.ts +1 -1
  307. package/Utils/Types/AnyFunction.js +1 -0
  308. package/Utils/Types/Func.d.ts +1 -1
  309. package/Utils/Types/Func.js +1 -0
  310. package/Utils/Types/index.js +3 -0
  311. package/Utils/Types/index.js.map +1 -1
  312. package/Utils/Utils.d.ts +14 -5
  313. package/Utils/Utils.js +185 -298
  314. package/Utils/Utils.js.map +1 -1
  315. package/Utils/debounce.d.ts +29 -0
  316. package/Utils/debounce.js +106 -0
  317. package/Utils/debounce.js.map +1 -0
  318. package/Utils/index.d.ts +2 -0
  319. package/Utils/index.js +3 -0
  320. package/Utils/index.js.map +1 -1
  321. package/Utils/throttle.d.ts +16 -0
  322. package/Utils/throttle.js +25 -0
  323. package/Utils/throttle.js.map +1 -0
  324. package/Validators/CmykComponentValidator.js +13 -15
  325. package/Validators/CmykComponentValidator.js.map +1 -1
  326. package/Version.d.ts +1 -1
  327. package/Version.js +1 -1
  328. package/Version.js.map +1 -1
  329. package/package.json +3 -8
  330. package/typings/structured-clone.d.ts +5 -0
@@ -1,16 +1,3 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -20,383 +7,273 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
20
7
  var __metadata = (this && this.__metadata) || function (k, v) {
21
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
9
  };
23
- var __values = (this && this.__values) || function(o) {
24
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
25
- if (m) return m.call(o);
26
- if (o && typeof o.length === "number") return {
27
- next: function () {
28
- if (o && i >= o.length) o = void 0;
29
- return { value: o && o[i++], done: !o };
30
- }
31
- };
32
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
33
- };
34
10
  import { RectangleItem } from "./RectangleItem";
35
11
  import { Color, RgbColors } from "../../Colors";
36
12
  import { StrokeSettings } from "./StrokeSettings";
37
13
  import { ShadowSettings } from "./ShadowSettings";
38
14
  import { TextPermissions } from "./TextPermissions";
39
15
  import { ArgumentException } from "../../Exception";
40
- import * as Utils from "../../Utils/Utils";
41
- import * as _ from "underscore";
42
- import * as Math from "../../Math/index";
16
+ import { EqualsOfFloatNumbers } from "../../Math/index";
43
17
  import { TextAlignment } from "./TextEnums";
44
18
  import { EventWithSenderArg } from "../../EventObject";
45
19
  import { Collection } from "../../Collection";
46
- import { equals, arrayEquals } from "../../Utils/Utils";
20
+ import { equals, isValidXml, isEqual } from "../../Utils/Utils";
47
21
  import { Property } from "../Decorators/Property";
48
22
  import { SimplePropertyFactory, ObjectPropertyFactory } from "../Decorators/Factory";
49
23
  import { ModelComponent } from "../ModelComponent";
50
24
  import { TextViolationSettings } from "./TextViolationSettings";
51
- var BaseTextItem = /** @class */ (function (_super) {
52
- __extends(BaseTextItem, _super);
53
- function BaseTextItem(text, fontPostScriptName, fontSize) {
54
- var _this = _super.call(this) || this;
55
- _this._text = "";
56
- _this._originalText = "";
57
- _this._underline = false;
58
- _this._color = RgbColors.black;
59
- _this._alignment = TextAlignment.Left;
60
- _this._tracking = 0;
61
- _this._leading = 0;
62
- _this._checkTextCrop = true;
63
- _this._overlapLinesEnabled = false;
64
- _this._verticalScale = 1;
65
- _this._horizontalScale = 1;
66
- _this._stroke = null;
67
- _this._shadow = null;
68
- _this._previewScale = 1;
69
- _this._placeholders = new Collection();
70
- _this._displayText = null;
71
- _this._colorPalette = new Collection();
72
- _this._baselineShift = 0;
73
- _this._overprintText = false;
74
- _this.values = [];
75
- _this._characterLimit = null;
76
- _this._maxLineLength = null;
77
- _this._maxLineCount = null;
78
- _this.isTextPlaceholder = false;
79
- _this.textColorForAbnormalRendering = RgbColors.black;
80
- _this.type = BaseTextItem.type;
81
- _this._onFontPropertyChanged = function (s, p) {
82
- _this._propertyChanged.notify(_this, "font");
83
- };
84
- _this._onShadowPropertyChanged = function (s, p) {
85
- _this._propertyChanged.notify(_this, "shadow");
86
- };
87
- _this._onStrokePropertyChanged = function (s, p) {
88
- _this._propertyChanged.notify(_this, "stroke");
25
+ import { arraysIsEqual } from "@aurigma/utils-js/algorithms/array";
26
+ export class BaseTextItem extends RectangleItem {
27
+ constructor(text, fontPostScriptName, fontSize) {
28
+ super();
29
+ this._text = "";
30
+ this._originalText = "";
31
+ this._underline = false;
32
+ this._color = RgbColors.black;
33
+ this._alignment = TextAlignment.Left;
34
+ this._tracking = 0;
35
+ this._leading = 0;
36
+ this._checkTextCrop = true;
37
+ this._overlapLinesEnabled = false;
38
+ this._verticalScale = 1;
39
+ this._horizontalScale = 1;
40
+ this._stroke = null;
41
+ this._shadow = null;
42
+ this._previewScale = 1;
43
+ this._placeholders = new Collection();
44
+ this._displayText = null;
45
+ this._colorPalette = new Collection();
46
+ this._baselineShift = 0;
47
+ this._overprintText = false;
48
+ this.values = [];
49
+ this._characterLimit = null;
50
+ this._maxLineLength = null;
51
+ this._maxLineCount = null;
52
+ this.isTextPlaceholder = false;
53
+ this.textColorForAbnormalRendering = RgbColors.black;
54
+ this.type = BaseTextItem.type;
55
+ this._onFontPropertyChanged = (s, p) => {
56
+ this._propertyChanged.notify(this, "font");
89
57
  };
90
- _this.borderWidth = 0;
91
- _this.fillColor = RgbColors.transparent;
92
- _this.text = (text != null) ? text : "";
93
- _this._font = new BaseTextItem.FontSettings(fontPostScriptName, (fontSize != null) ? fontSize : 10);
94
- _this._subscribeFontPropertyChanged();
95
- _this.textPermissions = new TextPermissions();
96
- _this._setViolationSettings(new TextViolationSettings(), true);
97
- var textUpdatedFunc = function () {
98
- _this._displayText = null;
99
- _this._propertyChanged.notify(_this, "text");
58
+ this._onShadowPropertyChanged = (s, p) => {
59
+ this._propertyChanged.notify(this, "shadow");
100
60
  };
101
- _this._placeholders.add_itemAdded(function (data) { return data.item.addPropertyChanged(textUpdatedFunc); });
102
- _this._placeholders.add_itemRemoved(function (data) { return data.item.removePropertyChanged(textUpdatedFunc); });
103
- _this._ignorePermissionsChange = true;
104
- _this.itemPermissions.allowRemoveOnLayoutChange = true;
105
- _this.itemPermissions.itemToolbarPermissions.showEditButton = true;
106
- _this._ignorePermissionsChange = false;
107
- return _this;
108
- }
109
- Object.defineProperty(BaseTextItem.prototype, "characterLimit", {
110
- get: function () {
111
- return this._characterLimit;
112
- },
113
- set: function (value) {
114
- if (Math.EqualsOfFloatNumbers(this._characterLimit, value))
115
- return;
116
- this._characterLimit = value;
117
- if (value != null)
118
- this._propertyChanged.notify(this, "characterLimit");
119
- },
120
- enumerable: true,
121
- configurable: true
122
- });
123
- Object.defineProperty(BaseTextItem.prototype, "maxLineCount", {
124
- get: function () {
125
- return this._maxLineCount;
126
- },
127
- set: function (value) {
128
- if (this._maxLineCount === value)
129
- return;
130
- this._maxLineCount = value;
131
- this._displayText = null;
132
- this._propertyChanged.notify(this, "maxLineCount");
133
- },
134
- enumerable: true,
135
- configurable: true
136
- });
137
- Object.defineProperty(BaseTextItem.prototype, "maxLineLength", {
138
- get: function () {
139
- return this._maxLineLength;
140
- },
141
- set: function (value) {
142
- if (this._maxLineLength === value)
143
- return;
144
- this._maxLineLength = value;
145
- this._displayText = null;
146
- this._propertyChanged.notify(this, "maxLineLength");
147
- },
148
- enumerable: true,
149
- configurable: true
150
- });
151
- Object.defineProperty(BaseTextItem.prototype, "previewScale", {
152
- get: function () { return this._previewScale; },
153
- set: function (value) {
154
- if (Math.EqualsOfFloatNumbers(this._previewScale, value))
155
- return;
156
- this._previewScale = value;
157
- this._propertyChanged.notify(this, "previewScale");
158
- },
159
- enumerable: true,
160
- configurable: true
161
- });
162
- Object.defineProperty(BaseTextItem.prototype, "stroke", {
163
- get: function () {
164
- return this._stroke;
165
- },
166
- set: function (value) {
167
- if (StrokeSettings.equals(this._stroke, value))
168
- return;
169
- this._unsubscribeStrokePropertyChanged();
170
- this._stroke = value;
171
- this._subscribeStrokePropertyChanged();
61
+ this._onStrokePropertyChanged = (s, p) => {
172
62
  this._propertyChanged.notify(this, "stroke");
173
- },
174
- enumerable: true,
175
- configurable: true
176
- });
177
- Object.defineProperty(BaseTextItem.prototype, "shadow", {
178
- get: function () {
179
- return this._shadow;
180
- },
181
- set: function (value) {
182
- if (this._shadow == null && value == null || (value != null && value.equals(this._shadow)))
183
- return;
184
- this._unsubscribeShadowPropertyChanged();
185
- this._shadow = value;
186
- this._subscribeShadowPropertyChanged();
187
- this._propertyChanged.notify(this, "shadow");
188
- },
189
- enumerable: true,
190
- configurable: true
191
- });
192
- Object.defineProperty(BaseTextItem.prototype, "horizontalScale", {
193
- get: function () { return this._horizontalScale; },
194
- set: function (value) {
195
- if (Math.EqualsOfFloatNumbers(this._horizontalScale, value))
196
- return;
197
- this._horizontalScale = value;
198
- this._propertyChanged.notify(this, "horizontalScale");
199
- },
200
- enumerable: true,
201
- configurable: true
202
- });
203
- Object.defineProperty(BaseTextItem.prototype, "verticalScale", {
204
- get: function () { return this._verticalScale; },
205
- set: function (value) {
206
- if (Math.EqualsOfFloatNumbers(this._verticalScale, value))
207
- return;
208
- this._verticalScale = value;
209
- this._propertyChanged.notify(this, "verticalScale");
210
- },
211
- enumerable: true,
212
- configurable: true
213
- });
214
- Object.defineProperty(BaseTextItem.prototype, "checkTextCrop", {
215
- get: function () { return this._checkTextCrop; },
216
- set: function (value) {
217
- if (this._checkTextCrop === value)
218
- return;
219
- this._checkTextCrop = value;
220
- this._propertyChanged.notify(this, "checkTextCrop");
221
- },
222
- enumerable: true,
223
- configurable: true
224
- });
225
- Object.defineProperty(BaseTextItem.prototype, "overlapLinesEnabled", {
226
- get: function () { return this._overlapLinesEnabled; },
227
- set: function (value) {
228
- if (this._overlapLinesEnabled === value)
229
- return;
230
- this._overlapLinesEnabled = value;
231
- this._propertyChanged.notify(this, "overlapLinesEnabled");
232
- },
233
- enumerable: true,
234
- configurable: true
235
- });
236
- Object.defineProperty(BaseTextItem.prototype, "alignment", {
237
- get: function () { return this._alignment; },
238
- set: function (value) {
239
- if (this._alignment === value)
240
- return;
241
- this._alignment = value;
242
- this._propertyChanged.notify(this, "alignment");
243
- },
244
- enumerable: true,
245
- configurable: true
246
- });
247
- Object.defineProperty(BaseTextItem.prototype, "tracking", {
248
- get: function () { return this._tracking; },
249
- set: function (value) {
250
- if (Math.EqualsOfFloatNumbers(this._tracking, value))
251
- return;
252
- this._tracking = value;
253
- this._propertyChanged.notify(this, "tracking");
254
- },
255
- enumerable: true,
256
- configurable: true
257
- });
258
- Object.defineProperty(BaseTextItem.prototype, "leading", {
259
- get: function () { return this._leading; },
260
- set: function (value) {
261
- if (Math.EqualsOfFloatNumbers(this._leading, value))
262
- return;
263
- this._leading = value;
264
- this._propertyChanged.notify(this, "leading");
265
- },
266
- enumerable: true,
267
- configurable: true
268
- });
269
- Object.defineProperty(BaseTextItem.prototype, "originalText", {
270
- get: function () {
271
- return this._originalText != null ? this._originalText : "";
272
- },
273
- set: function (value) {
274
- this._originalText = value;
275
- },
276
- enumerable: true,
277
- configurable: true
278
- });
279
- Object.defineProperty(BaseTextItem.prototype, "underline", {
280
- get: function () { return this._underline; },
281
- set: function (value) {
282
- if (this._underline === value)
283
- return;
284
- this._underline = value;
285
- this._propertyChanged.notify(this, "underline");
286
- },
287
- enumerable: true,
288
- configurable: true
289
- });
290
- Object.defineProperty(BaseTextItem.prototype, "font", {
291
- get: function () {
292
- return this._font;
293
- },
294
- set: function (value) {
295
- if (BaseTextItem.FontSettings.equals(this._font, value))
296
- return;
297
- this._unsubscribeFontPropertyChanged();
298
- this._font = value;
299
- this._subscribeFontPropertyChanged();
300
- this._propertyChanged.notify(this, "font");
301
- },
302
- enumerable: true,
303
- configurable: true
304
- });
305
- Object.defineProperty(BaseTextItem.prototype, "text", {
306
- get: function () {
307
- if (this._displayText == null)
308
- this._displayText = this.getUpdatedText(this._text);
309
- this._text = this._displayText;
310
- return this._text;
311
- },
312
- set: function (value) {
313
- if (this._text === value)
314
- return;
315
- this._text = value;
63
+ };
64
+ this.borderWidth = 0;
65
+ this.fillColor = RgbColors.transparent;
66
+ this.text = (text != null) ? text : "";
67
+ this._font = new BaseTextItem.FontSettings(fontPostScriptName, (fontSize != null) ? fontSize : 10);
68
+ this._subscribeFontPropertyChanged();
69
+ this.textPermissions = new TextPermissions();
70
+ this._setViolationSettings(new TextViolationSettings(), true);
71
+ var textUpdatedFunc = () => {
316
72
  this._displayText = null;
317
73
  this._propertyChanged.notify(this, "text");
318
- },
319
- enumerable: true,
320
- configurable: true
321
- });
322
- Object.defineProperty(BaseTextItem.prototype, "color", {
323
- get: function () { return this._color; },
324
- set: function (value) {
325
- if (Color.equals(this._color, value))
326
- return;
327
- this._color = value;
328
- this._propertyChanged.notify(this, "color");
329
- },
330
- enumerable: true,
331
- configurable: true
332
- });
333
- Object.defineProperty(BaseTextItem.prototype, "baselineShift", {
334
- get: function () { return this._baselineShift; },
335
- set: function (value) {
336
- if (Math.EqualsOfFloatNumbers(this._baselineShift, value))
337
- return;
338
- this._baselineShift = value;
339
- this._propertyChanged.notify(this, "baselineShift");
340
- },
341
- enumerable: true,
342
- configurable: true
343
- });
344
- Object.defineProperty(BaseTextItem.prototype, "overprintText", {
345
- get: function () { return this._overprintText; },
346
- set: function (value) {
347
- if (value == this._overprintText)
348
- return;
349
- this._overprintText = value;
350
- this._propertyChanged.notify(this, "overprintText");
351
- },
352
- enumerable: true,
353
- configurable: true
354
- });
355
- BaseTextItem.prototype.getUpdatedText = function (text) {
356
- var updatedText = text;
74
+ };
75
+ this._placeholders.add_itemAdded(data => data.item.addPropertyChanged(textUpdatedFunc));
76
+ this._placeholders.add_itemRemoved(data => data.item.removePropertyChanged(textUpdatedFunc));
77
+ this._ignorePermissionsChange = true;
78
+ this.itemPermissions.allowRemoveOnLayoutChange = true;
79
+ this.itemPermissions.itemToolbarPermissions.showEditButton = true;
80
+ this._ignorePermissionsChange = false;
81
+ }
82
+ get characterLimit() {
83
+ return this._characterLimit;
84
+ }
85
+ set characterLimit(value) {
86
+ if (EqualsOfFloatNumbers(this._characterLimit, value))
87
+ return;
88
+ this._characterLimit = value;
89
+ if (value != null)
90
+ this._propertyChanged.notify(this, "characterLimit");
91
+ }
92
+ get maxLineCount() {
93
+ return this._maxLineCount;
94
+ }
95
+ set maxLineCount(value) {
96
+ if (this._maxLineCount === value)
97
+ return;
98
+ this._maxLineCount = value;
99
+ this._displayText = null;
100
+ this._propertyChanged.notify(this, "maxLineCount");
101
+ }
102
+ get maxLineLength() {
103
+ return this._maxLineLength;
104
+ }
105
+ set maxLineLength(value) {
106
+ if (this._maxLineLength === value)
107
+ return;
108
+ this._maxLineLength = value;
109
+ this._displayText = null;
110
+ this._propertyChanged.notify(this, "maxLineLength");
111
+ }
112
+ get previewScale() { return this._previewScale; }
113
+ set previewScale(value) {
114
+ if (EqualsOfFloatNumbers(this._previewScale, value))
115
+ return;
116
+ this._previewScale = value;
117
+ this._propertyChanged.notify(this, "previewScale");
118
+ }
119
+ get stroke() {
120
+ return this._stroke;
121
+ }
122
+ set stroke(value) {
123
+ if (StrokeSettings.equals(this._stroke, value))
124
+ return;
125
+ this._unsubscribeStrokePropertyChanged();
126
+ this._stroke = value;
127
+ this._subscribeStrokePropertyChanged();
128
+ this._propertyChanged.notify(this, "stroke");
129
+ }
130
+ get shadow() {
131
+ return this._shadow;
132
+ }
133
+ set shadow(value) {
134
+ if (this._shadow == null && value == null || (value != null && value.equals(this._shadow)))
135
+ return;
136
+ this._unsubscribeShadowPropertyChanged();
137
+ this._shadow = value;
138
+ this._subscribeShadowPropertyChanged();
139
+ this._propertyChanged.notify(this, "shadow");
140
+ }
141
+ get horizontalScale() { return this._horizontalScale; }
142
+ set horizontalScale(value) {
143
+ if (EqualsOfFloatNumbers(this._horizontalScale, value))
144
+ return;
145
+ this._horizontalScale = value;
146
+ this._propertyChanged.notify(this, "horizontalScale");
147
+ }
148
+ get verticalScale() { return this._verticalScale; }
149
+ set verticalScale(value) {
150
+ if (EqualsOfFloatNumbers(this._verticalScale, value))
151
+ return;
152
+ this._verticalScale = value;
153
+ this._propertyChanged.notify(this, "verticalScale");
154
+ }
155
+ get checkTextCrop() { return this._checkTextCrop; }
156
+ set checkTextCrop(value) {
157
+ if (this._checkTextCrop === value)
158
+ return;
159
+ this._checkTextCrop = value;
160
+ this._propertyChanged.notify(this, "checkTextCrop");
161
+ }
162
+ get overlapLinesEnabled() { return this._overlapLinesEnabled; }
163
+ set overlapLinesEnabled(value) {
164
+ if (this._overlapLinesEnabled === value)
165
+ return;
166
+ this._overlapLinesEnabled = value;
167
+ this._propertyChanged.notify(this, "overlapLinesEnabled");
168
+ }
169
+ get alignment() { return this._alignment; }
170
+ set alignment(value) {
171
+ if (this._alignment === value)
172
+ return;
173
+ this._alignment = value;
174
+ this._propertyChanged.notify(this, "alignment");
175
+ }
176
+ get tracking() { return this._tracking; }
177
+ set tracking(value) {
178
+ if (EqualsOfFloatNumbers(this._tracking, value))
179
+ return;
180
+ this._tracking = value;
181
+ this._propertyChanged.notify(this, "tracking");
182
+ }
183
+ get leading() { return this._leading; }
184
+ set leading(value) {
185
+ if (EqualsOfFloatNumbers(this._leading, value))
186
+ return;
187
+ this._leading = value;
188
+ this._propertyChanged.notify(this, "leading");
189
+ }
190
+ get originalText() {
191
+ return this._originalText != null ? this._originalText : "";
192
+ }
193
+ set originalText(value) {
194
+ this._originalText = value;
195
+ }
196
+ get underline() { return this._underline; }
197
+ set underline(value) {
198
+ if (this._underline === value)
199
+ return;
200
+ this._underline = value;
201
+ this._propertyChanged.notify(this, "underline");
202
+ }
203
+ get font() {
204
+ return this._font;
205
+ }
206
+ set font(value) {
207
+ if (BaseTextItem.FontSettings.equals(this._font, value))
208
+ return;
209
+ this._unsubscribeFontPropertyChanged();
210
+ this._font = value;
211
+ this._subscribeFontPropertyChanged();
212
+ this._propertyChanged.notify(this, "font");
213
+ }
214
+ get text() {
215
+ if (this._displayText == null)
216
+ this._displayText = this.getUpdatedText(this._text);
217
+ this._text = this._displayText;
218
+ return this._text;
219
+ }
220
+ set text(value) {
221
+ if (this._text === value)
222
+ return;
223
+ this._text = value;
224
+ this._displayText = null;
225
+ this._propertyChanged.notify(this, "text");
226
+ }
227
+ get color() { return this._color; }
228
+ set color(value) {
229
+ if (Color.equals(this._color, value))
230
+ return;
231
+ this._color = value;
232
+ this._propertyChanged.notify(this, "color");
233
+ }
234
+ get baselineShift() { return this._baselineShift; }
235
+ set baselineShift(value) {
236
+ if (EqualsOfFloatNumbers(this._baselineShift, value))
237
+ return;
238
+ this._baselineShift = value;
239
+ this._propertyChanged.notify(this, "baselineShift");
240
+ }
241
+ get overprintText() { return this._overprintText; }
242
+ set overprintText(value) {
243
+ if (value == this._overprintText)
244
+ return;
245
+ this._overprintText = value;
246
+ this._propertyChanged.notify(this, "overprintText");
247
+ }
248
+ getUpdatedText(text) {
249
+ let updatedText = text;
357
250
  if (this.placeholders.length > 0)
358
251
  updatedText = this._replaceInStringPlaceholders();
359
252
  return updatedText;
360
- };
361
- Object.defineProperty(BaseTextItem.prototype, "placeholders", {
362
- get: function () {
363
- return this._placeholders;
364
- },
365
- enumerable: true,
366
- configurable: true
367
- });
368
- Object.defineProperty(BaseTextItem.prototype, "colorPalette", {
369
- get: function () {
370
- return this._colorPalette;
371
- },
372
- enumerable: true,
373
- configurable: true
374
- });
375
- BaseTextItem.prototype._canSetIsVariable = function () {
253
+ }
254
+ get placeholders() {
255
+ return this._placeholders;
256
+ }
257
+ get colorPalette() {
258
+ return this._colorPalette;
259
+ }
260
+ _canSetIsVariable() {
376
261
  return true;
377
- };
378
- Object.defineProperty(BaseTextItem.prototype, "previewFontSize", {
379
- get: function () {
380
- return this.font.size * this.previewScale;
381
- },
382
- set: function (value) {
383
- this.font.size = value / this.previewScale;
384
- },
385
- enumerable: true,
386
- configurable: true
387
- });
388
- Object.defineProperty(BaseTextItem.prototype, "previewLeading", {
389
- get: function () {
390
- return this.leading * this.previewScale;
391
- },
392
- set: function (value) {
393
- this.leading = value / this.previewScale;
394
- },
395
- enumerable: true,
396
- configurable: true
397
- });
398
- BaseTextItem.prototype.applyPermissionsConstrain = function () {
399
- _super.prototype.applyPermissionsConstrain.call(this);
262
+ }
263
+ get previewFontSize() {
264
+ return this.font.size * this.previewScale;
265
+ }
266
+ set previewFontSize(value) {
267
+ this.font.size = value / this.previewScale;
268
+ }
269
+ get previewLeading() {
270
+ return this.leading * this.previewScale;
271
+ }
272
+ set previewLeading(value) {
273
+ this.leading = value / this.previewScale;
274
+ }
275
+ applyPermissionsConstrain() {
276
+ super.applyPermissionsConstrain();
400
277
  this.itemPermissions.itemToolbarPermissions.showSelectButton = false;
401
278
  if (this.textPermissions != null && !this.textPermissions.allowChangeText)
402
279
  this.itemPermissions.itemToolbarPermissions.showEditButtonConstraint = false;
@@ -407,109 +284,99 @@ var BaseTextItem = /** @class */ (function (_super) {
407
284
  this.textPermissions.allowChangeFontColor = false;
408
285
  this.textPermissions.allowChangeShadow = false;
409
286
  this.textPermissions.allowChangeStroke = false;
410
- };
411
- Object.defineProperty(BaseTextItem.prototype, "textPermissions", {
412
- get: function () { return this._textPermissions; },
413
- set: function (value) {
414
- if (value == null)
415
- throw new ArgumentException("textPermissions cannot be null");
416
- if (equals(this._textPermissions, value))
417
- return;
418
- if (this._textPermissions != null)
419
- this._textPermissions.propertyChanged.remove(this._onPermissionsChanged);
420
- this._textPermissions = value;
421
- this.applyPermissionsConstrain();
422
- this._textPermissions.propertyChanged.add(this._onPermissionsChanged);
423
- this._propertyChanged.notify(this, "textPermissions");
424
- },
425
- enumerable: true,
426
- configurable: true
427
- });
428
- Object.defineProperty(BaseTextItem.prototype, "violationSettings", {
429
- get: function () { return this._violationSettings; },
430
- set: function (value) {
431
- this._setViolationSettings(value);
432
- },
433
- enumerable: true,
434
- configurable: true
435
- });
436
- BaseTextItem.prototype._setViolationSettings = function (value, skipTypeCheck) {
437
- if (skipTypeCheck === void 0) { skipTypeCheck = false; }
287
+ }
288
+ get textPermissions() { return this._textPermissions; }
289
+ set textPermissions(value) {
290
+ if (value == null)
291
+ throw new ArgumentException("textPermissions cannot be null");
292
+ if (equals(this._textPermissions, value))
293
+ return;
294
+ if (this._textPermissions != null)
295
+ this._textPermissions.propertyChanged.remove(this._onPermissionsChanged);
296
+ this._textPermissions = value;
297
+ this.applyPermissionsConstrain();
298
+ this._textPermissions.propertyChanged.add(this._onPermissionsChanged);
299
+ this._propertyChanged.notify(this, "textPermissions");
300
+ }
301
+ get violationSettings() { return this._violationSettings; }
302
+ set violationSettings(value) {
303
+ this._setViolationSettings(value);
304
+ }
305
+ _setViolationSettings(value, skipTypeCheck = false) {
438
306
  if (!skipTypeCheck && !(value instanceof TextViolationSettings))
439
307
  throw new ArgumentException("Shape ViolationSettings property must has TextViolationSettings type!");
440
- _super.prototype._setViolationSettings.call(this, value, skipTypeCheck);
441
- };
442
- BaseTextItem.prototype._subscribeFontPropertyChanged = function () {
308
+ super._setViolationSettings(value, skipTypeCheck);
309
+ }
310
+ _subscribeFontPropertyChanged() {
443
311
  if (this._font != null)
444
312
  this._font.addPropertyChanged(this._onFontPropertyChanged);
445
- };
446
- BaseTextItem.prototype._unsubscribeFontPropertyChanged = function () {
313
+ }
314
+ _unsubscribeFontPropertyChanged() {
447
315
  if (this._font != null)
448
316
  this._font.removePropertyChanged(this._onFontPropertyChanged);
449
- };
450
- BaseTextItem.prototype._subscribeShadowPropertyChanged = function () {
317
+ }
318
+ _subscribeShadowPropertyChanged() {
451
319
  if (this._shadow != null)
452
320
  this._shadow.addPropertyChanged(this._onShadowPropertyChanged);
453
- };
454
- BaseTextItem.prototype._unsubscribeShadowPropertyChanged = function () {
321
+ }
322
+ _unsubscribeShadowPropertyChanged() {
455
323
  if (this._shadow != null)
456
324
  this._shadow.removePropertyChanged(this._onShadowPropertyChanged);
457
- };
458
- BaseTextItem.prototype._subscribeStrokePropertyChanged = function () {
325
+ }
326
+ _subscribeStrokePropertyChanged() {
459
327
  if (this._stroke != null)
460
328
  this._stroke.addPropertyChanged(this._onStrokePropertyChanged);
461
- };
462
- BaseTextItem.prototype._unsubscribeStrokePropertyChanged = function () {
329
+ }
330
+ _unsubscribeStrokePropertyChanged() {
463
331
  if (this._stroke != null)
464
332
  this._stroke.removePropertyChanged(this._onStrokePropertyChanged);
465
- };
466
- BaseTextItem.prototype.getSimplifiedObject = function (omitProperties) {
467
- var simplified = _super.prototype.getSimplifiedObject.call(this, ["_placeholders", "currentTextImage", "textPermissions", "textForTextWhizz", "shadow", "stroke"].concat(omitProperties));
333
+ }
334
+ getSimplifiedObject(omitProperties) {
335
+ var simplified = super.getSimplifiedObject(["_placeholders", "currentTextImage", "textPermissions", "textForTextWhizz", "shadow", "stroke"].concat(omitProperties));
468
336
  simplified["placeholders"] = this.placeholders.toArray();
469
337
  simplified["textPermissions"] = this.textPermissions.getSimplifiedObject();
470
338
  simplified["font"] = this.font.getSimplifiedObject();
471
339
  simplified["shadow"] = this.shadow != null ? this.shadow.getSimplifiedObject() : null;
472
340
  simplified["stroke"] = this.stroke != null ? this.stroke.getSimplifiedObject() : null;
473
341
  return simplified;
474
- };
475
- BaseTextItem.prototype._replaceInStringPlaceholders = function () {
476
- return Utils.isValidXml(this.originalText)
342
+ }
343
+ _replaceInStringPlaceholders() {
344
+ return isValidXml(this.originalText)
477
345
  ? this._replaceInStringPlaceholdersValueInRichText()
478
346
  : this._replaceInStringPlaceholdersValueInPlainText();
479
- };
480
- BaseTextItem.prototype._replaceInStringPlaceholdersValueInPlainText = function () {
347
+ }
348
+ _replaceInStringPlaceholdersValueInPlainText() {
481
349
  var value = this.originalText;
482
- this.placeholders.forEach(function (p) {
350
+ this.placeholders.forEach((p) => {
483
351
  value = value.replace(p.id, p.value === "" ? p.name : p.value);
484
352
  });
485
353
  return value;
486
- };
487
- BaseTextItem.prototype._replaceInStringPlaceholdersValueInRichText = function () {
354
+ }
355
+ _replaceInStringPlaceholdersValueInRichText() {
488
356
  if (this._originalTextDom == null) {
489
- var domParser = new DOMParser();
490
- this._originalTextDom = domParser.parseFromString("<xml>" + this.originalText + "</xml>", "text/xml");
357
+ const domParser = new DOMParser();
358
+ this._originalTextDom = domParser.parseFromString(`<xml>${this.originalText}</xml>`, "text/xml");
491
359
  }
492
- var xmlDom = this._originalTextDom.cloneNode(true);
360
+ const xmlDom = this._originalTextDom.cloneNode(true);
493
361
  var spans = xmlDom.getElementsByTagName("span");
494
- this.placeholders.forEach(function (p) {
362
+ this.placeholders.forEach((p) => {
495
363
  if (spans != null && spans.length) {
496
- for (var i = 0; i < spans.length; i++) {
497
- var span = spans[i];
364
+ for (let i = 0; i < spans.length; i++) {
365
+ const span = spans[i];
498
366
  if (span.textContent != null) {
499
367
  span.textContent = span.textContent.replace(p.id, p.value === "" ? p.name : p.value);
500
368
  }
501
369
  }
502
370
  }
503
371
  });
504
- var serializer = new XMLSerializer();
505
- var str = serializer.serializeToString(xmlDom);
372
+ const serializer = new XMLSerializer();
373
+ const str = serializer.serializeToString(xmlDom);
506
374
  return str.substr(0, str.length - 6).substr(5); // without <xml> and </xml>
507
- };
508
- BaseTextItem.prototype._copy = function (source, destination, generateNewIds, appropriateParentContainer) {
509
- var e_1, _a;
510
- _super.prototype._copy.call(this, source, destination, generateNewIds, appropriateParentContainer);
375
+ }
376
+ _copy(source, destination, generateNewIds, appropriateParentContainer) {
377
+ super._copy(source, destination, generateNewIds, appropriateParentContainer);
511
378
  destination.textPermissions = source._textPermissions.clone();
512
- destination.placeholders.setRange(source.placeholders.toArray().map(function (p) { return p.clone(); }));
379
+ destination.placeholders.setRange(source.placeholders.toArray().map(p => p.clone()));
513
380
  destination.color = source._color.clone();
514
381
  destination.text = source._text;
515
382
  destination.font = source._font.clone();
@@ -528,217 +395,178 @@ var BaseTextItem = /** @class */ (function (_super) {
528
395
  destination.isTextPlaceholder = source.isTextPlaceholder;
529
396
  destination.maxLineLength = source.maxLineLength;
530
397
  destination.overlapLinesEnabled = source.overlapLinesEnabled;
531
- destination.colorPalette.setRange(source.colorPalette.toArray().map(function (c) { return c.clone(); }));
398
+ destination.colorPalette.setRange(source.colorPalette.toArray().map(c => c.clone()));
532
399
  destination.baselineShift = source.baselineShift;
533
400
  destination.overprintText = source.overprintText;
534
401
  destination.listStyles = source.listStyles;
535
402
  destination.characterLimit = source.characterLimit;
536
403
  if (source.values != null) {
537
404
  destination.values = [];
538
- try {
539
- for (var _b = __values(source.values), _c = _b.next(); !_c.done; _c = _b.next()) {
540
- var i = _c.value;
541
- destination.values.push(i.clone());
542
- }
543
- }
544
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
545
- finally {
546
- try {
547
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
548
- }
549
- finally { if (e_1) throw e_1.error; }
405
+ for (var i of source.values) {
406
+ destination.values.push(i.clone());
550
407
  }
551
408
  }
552
- };
553
- BaseTextItem.prototype.equals = function (other) {
554
- var superEq = _super.prototype.equals.call(this, other);
555
- var textPermissionsEq = equals(this._textPermissions, other._textPermissions);
556
- var placeholdersEq = arrayEquals(this._placeholders.toArray(), other._placeholders.toArray());
557
- var colorEq = equals(this._color, other._color);
558
- var textEq = equals(this._text, other._text);
559
- var fontEq = equals(this._font, other._font);
560
- var underlineEq = equals(this._underline, other._underline);
561
- var originalTextEq = equals(this._originalText, other._originalText);
562
- var leadingEq = equals(this._leading, other._leading);
563
- var trackingEq = equals(this._tracking, other._tracking);
564
- var alignmentEq = equals(this._alignment, other._alignment);
565
- var checkTextCropEq = equals(this._checkTextCrop, other._checkTextCrop);
566
- var verticalScaleEq = equals(this._verticalScale, other._verticalScale);
567
- var previewScaleEq = equals(this._previewScale, other._previewScale);
568
- var maxLineCountEq = equals(this._maxLineCount, other._maxLineCount);
569
- var isTextPlaceholderEq = equals(this.isTextPlaceholder, other.isTextPlaceholder);
570
- var maxLineLengthEq = equals(this._maxLineLength, other._maxLineLength);
571
- var overlapLinesEnabledEq = equals(this._overlapLinesEnabled, other._overlapLinesEnabled);
572
- var strokeEq = equals(this._stroke, other._stroke);
573
- var valuesEq = arrayEquals(this.values, other.values);
574
- var colorPaletteEq = arrayEquals(this._colorPalette.toArray(), other._colorPalette.toArray());
575
- var baselineShiftEq = equals(this._baselineShift, other._baselineShift);
576
- var overprintTextEq = equals(this._overprintText, other._overprintText);
577
- var listStylesEq = equals(this.listStyles, other.listStyles);
578
- var characterLimitEq = equals(this.characterLimit, other.characterLimit);
409
+ }
410
+ equals(other) {
411
+ const superEq = super.equals(other);
412
+ const textPermissionsEq = equals(this._textPermissions, other._textPermissions);
413
+ const placeholdersEq = arraysIsEqual(this._placeholders.toArray(), other._placeholders.toArray(), equals);
414
+ const colorEq = equals(this._color, other._color);
415
+ const textEq = equals(this._text, other._text);
416
+ const fontEq = equals(this._font, other._font);
417
+ const underlineEq = equals(this._underline, other._underline);
418
+ const originalTextEq = equals(this._originalText, other._originalText);
419
+ const leadingEq = equals(this._leading, other._leading);
420
+ const trackingEq = equals(this._tracking, other._tracking);
421
+ const alignmentEq = equals(this._alignment, other._alignment);
422
+ const checkTextCropEq = equals(this._checkTextCrop, other._checkTextCrop);
423
+ const verticalScaleEq = equals(this._verticalScale, other._verticalScale);
424
+ const previewScaleEq = equals(this._previewScale, other._previewScale);
425
+ const maxLineCountEq = equals(this._maxLineCount, other._maxLineCount);
426
+ const isTextPlaceholderEq = equals(this.isTextPlaceholder, other.isTextPlaceholder);
427
+ const maxLineLengthEq = equals(this._maxLineLength, other._maxLineLength);
428
+ const overlapLinesEnabledEq = equals(this._overlapLinesEnabled, other._overlapLinesEnabled);
429
+ const strokeEq = equals(this._stroke, other._stroke);
430
+ const valuesEq = arraysIsEqual(this.values, other.values, equals);
431
+ const colorPaletteEq = arraysIsEqual(this._colorPalette.toArray(), other._colorPalette.toArray(), equals);
432
+ const baselineShiftEq = equals(this._baselineShift, other._baselineShift);
433
+ const overprintTextEq = equals(this._overprintText, other._overprintText);
434
+ const listStylesEq = equals(this.listStyles, other.listStyles);
435
+ const characterLimitEq = equals(this.characterLimit, other.characterLimit);
579
436
  return superEq && textPermissionsEq && placeholdersEq && colorEq && textEq && fontEq && underlineEq && originalTextEq && leadingEq
580
437
  && trackingEq && alignmentEq && checkTextCropEq && verticalScaleEq && previewScaleEq && maxLineCountEq && isTextPlaceholderEq
581
438
  && maxLineLengthEq && overlapLinesEnabledEq && strokeEq && valuesEq && colorPaletteEq && baselineShiftEq && overprintTextEq
582
439
  && listStylesEq && characterLimitEq;
583
- };
584
- BaseTextItem.prototype.isEmptyText = function () {
440
+ }
441
+ isEmptyText() {
585
442
  return this.text === "";
586
- };
587
- BaseTextItem.prototype.isEmptyXmlText = function () {
443
+ }
444
+ isEmptyXmlText() {
588
445
  return this.text === "<p></p>" || this.text === "<p><span></span></p>";
589
- };
590
- BaseTextItem.prototype.isEmpty = function () {
446
+ }
447
+ isEmpty() {
591
448
  return !this.isTextPlaceholder && (this.isEmptyText() || this.isEmptyXmlText());
592
- };
593
- BaseTextItem.type = "baseText";
594
- __decorate([
595
- Property({ factory: new SimplePropertyFactory(50), displayName: "Character Limit" }),
596
- __metadata("design:type", Number),
597
- __metadata("design:paramtypes", [Number])
598
- ], BaseTextItem.prototype, "characterLimit", null);
599
- __decorate([
600
- Property({ factory: new SimplePropertyFactory(1), displayName: "Max line count" }),
601
- __metadata("design:type", Number),
602
- __metadata("design:paramtypes", [Number])
603
- ], BaseTextItem.prototype, "maxLineCount", null);
604
- __decorate([
605
- Property({ factory: new SimplePropertyFactory(50), displayName: "Max line length" }),
606
- __metadata("design:type", Number),
607
- __metadata("design:paramtypes", [Number])
608
- ], BaseTextItem.prototype, "maxLineLength", null);
609
- __decorate([
610
- Property({ factory: new ObjectPropertyFactory(StrokeSettings), displayName: "Stroke" }),
611
- __metadata("design:type", StrokeSettings),
612
- __metadata("design:paramtypes", [StrokeSettings])
613
- ], BaseTextItem.prototype, "stroke", null);
614
- __decorate([
615
- Property({ factory: new ObjectPropertyFactory(ShadowSettings), displayName: "Shadow" }),
616
- __metadata("design:type", ShadowSettings),
617
- __metadata("design:paramtypes", [ShadowSettings])
618
- ], BaseTextItem.prototype, "shadow", null);
619
- __decorate([
620
- Property({ enumObject: TextAlignment }),
621
- __metadata("design:type", Number),
622
- __metadata("design:paramtypes", [Number])
623
- ], BaseTextItem.prototype, "alignment", null);
624
- __decorate([
625
- Property({ type: "string" }),
626
- __metadata("design:type", String)
627
- ], BaseTextItem.prototype, "listStyles", void 0);
628
- return BaseTextItem;
629
- }(RectangleItem));
630
- export { BaseTextItem };
449
+ }
450
+ }
451
+ BaseTextItem.type = "baseText";
452
+ __decorate([
453
+ Property({ factory: new SimplePropertyFactory(50), displayName: "Character Limit" }),
454
+ __metadata("design:type", Number),
455
+ __metadata("design:paramtypes", [Number])
456
+ ], BaseTextItem.prototype, "characterLimit", null);
457
+ __decorate([
458
+ Property({ factory: new SimplePropertyFactory(1), displayName: "Max line count" }),
459
+ __metadata("design:type", Number),
460
+ __metadata("design:paramtypes", [Number])
461
+ ], BaseTextItem.prototype, "maxLineCount", null);
462
+ __decorate([
463
+ Property({ factory: new SimplePropertyFactory(50), displayName: "Max line length" }),
464
+ __metadata("design:type", Number),
465
+ __metadata("design:paramtypes", [Number])
466
+ ], BaseTextItem.prototype, "maxLineLength", null);
467
+ __decorate([
468
+ Property({ factory: new ObjectPropertyFactory(StrokeSettings), displayName: "Stroke" }),
469
+ __metadata("design:type", StrokeSettings),
470
+ __metadata("design:paramtypes", [StrokeSettings])
471
+ ], BaseTextItem.prototype, "stroke", null);
472
+ __decorate([
473
+ Property({ factory: new ObjectPropertyFactory(ShadowSettings), displayName: "Shadow" }),
474
+ __metadata("design:type", ShadowSettings),
475
+ __metadata("design:paramtypes", [ShadowSettings])
476
+ ], BaseTextItem.prototype, "shadow", null);
477
+ __decorate([
478
+ Property({ enumObject: TextAlignment }),
479
+ __metadata("design:type", Number),
480
+ __metadata("design:paramtypes", [Number])
481
+ ], BaseTextItem.prototype, "alignment", null);
482
+ __decorate([
483
+ Property({ type: "string" }),
484
+ __metadata("design:type", String)
485
+ ], BaseTextItem.prototype, "listStyles", void 0);
631
486
  (function (BaseTextItem) {
632
- var FontSettings = /** @class */ (function (_super) {
633
- __extends(FontSettings, _super);
634
- function FontSettings(postScriptName, size) {
635
- if (size === void 0) { size = 10; }
636
- var _this = _super.call(this) || this;
637
- _this._fauxBold = false;
638
- _this._fauxItalic = false;
639
- _this._allCaps = false;
640
- _this._openTypeFeatures = [];
641
- _this.$_propertyChanged = new EventWithSenderArg();
642
- _this._postScriptName = postScriptName;
643
- _this._size = size;
644
- return _this;
487
+ class FontSettings extends ModelComponent {
488
+ constructor(postScriptName, size = 10) {
489
+ super();
490
+ this._fauxBold = false;
491
+ this._fauxItalic = false;
492
+ this._allCaps = false;
493
+ this._openTypeFeatures = [];
494
+ this.$_propertyChanged = new EventWithSenderArg();
495
+ this._postScriptName = postScriptName;
496
+ this._size = size;
645
497
  }
646
- FontSettings.prototype.clone = function () {
647
- var clone = new FontSettings(this._postScriptName, this._size);
648
- clone._openTypeFeatures = _.clone(this._openTypeFeatures);
649
- clone.allCaps = this._allCaps;
650
- clone.fauxItalic = this._fauxItalic;
651
- clone.fauxBold = this._fauxBold;
652
- return clone;
653
- };
654
- Object.defineProperty(FontSettings.prototype, "fauxBold", {
655
- get: function () { return this._fauxBold; },
656
- set: function (value) {
657
- if (this._fauxBold === value)
658
- return;
659
- this._fauxBold = value;
660
- this.$_propertyChanged.notify(this, "fauxBold");
661
- },
662
- enumerable: true,
663
- configurable: true
664
- });
665
- Object.defineProperty(FontSettings.prototype, "fauxItalic", {
666
- get: function () { return this._fauxItalic; },
667
- set: function (value) {
668
- if (this._fauxItalic === value)
669
- return;
670
- this._fauxItalic = value;
671
- this.$_propertyChanged.notify(this, "fauxItalic");
672
- },
673
- enumerable: true,
674
- configurable: true
675
- });
676
- Object.defineProperty(FontSettings.prototype, "allCaps", {
677
- get: function () { return this._allCaps; },
678
- set: function (value) {
679
- if (this._allCaps === value)
680
- return;
681
- this._allCaps = value;
682
- this.$_propertyChanged.notify(this, "allCaps");
683
- },
684
- enumerable: true,
685
- configurable: true
686
- });
687
- Object.defineProperty(FontSettings.prototype, "openTypeFeatures", {
688
- get: function () { return this._openTypeFeatures; },
689
- set: function (value) {
690
- if (this._openTypeFeatures === value)
691
- return;
692
- this._openTypeFeatures = value;
693
- this.$_propertyChanged.notify(this, "openTypeFeatures");
694
- },
695
- enumerable: true,
696
- configurable: true
697
- });
698
- Object.defineProperty(FontSettings.prototype, "postScriptName", {
699
- get: function () { return this._postScriptName; },
700
- set: function (value) {
701
- if (this._postScriptName === value)
702
- return;
703
- this._postScriptName = value;
704
- this.$_propertyChanged.notify(this, "postScriptName");
705
- },
706
- enumerable: true,
707
- configurable: true
708
- });
709
- Object.defineProperty(FontSettings.prototype, "size", {
710
- get: function () { return this._size; },
711
- set: function (value) {
712
- if (Math.EqualsOfFloatNumbers(this._size, value))
713
- return;
714
- this._size = value;
715
- this.$_propertyChanged.notify(this, "size");
716
- },
717
- enumerable: true,
718
- configurable: true
719
- });
720
- FontSettings.prototype.addPropertyChanged = function (listener) {
498
+ clone() {
499
+ const cloneSettings = new FontSettings(this._postScriptName, this._size);
500
+ cloneSettings._openTypeFeatures = structuredClone(this._openTypeFeatures);
501
+ cloneSettings.allCaps = this._allCaps;
502
+ cloneSettings.fauxItalic = this._fauxItalic;
503
+ cloneSettings.fauxBold = this._fauxBold;
504
+ return cloneSettings;
505
+ }
506
+ get fauxBold() { return this._fauxBold; }
507
+ set fauxBold(value) {
508
+ if (this._fauxBold === value)
509
+ return;
510
+ this._fauxBold = value;
511
+ this.$_propertyChanged.notify(this, "fauxBold");
512
+ }
513
+ get fauxItalic() { return this._fauxItalic; }
514
+ set fauxItalic(value) {
515
+ if (this._fauxItalic === value)
516
+ return;
517
+ this._fauxItalic = value;
518
+ this.$_propertyChanged.notify(this, "fauxItalic");
519
+ }
520
+ get allCaps() { return this._allCaps; }
521
+ set allCaps(value) {
522
+ if (this._allCaps === value)
523
+ return;
524
+ this._allCaps = value;
525
+ this.$_propertyChanged.notify(this, "allCaps");
526
+ }
527
+ get openTypeFeatures() { return this._openTypeFeatures; }
528
+ set openTypeFeatures(value) {
529
+ if (this._openTypeFeatures === value)
530
+ return;
531
+ this._openTypeFeatures = value;
532
+ this.$_propertyChanged.notify(this, "openTypeFeatures");
533
+ }
534
+ get postScriptName() { return this._postScriptName; }
535
+ set postScriptName(value) {
536
+ if (this._postScriptName === value)
537
+ return;
538
+ this._postScriptName = value;
539
+ this.$_propertyChanged.notify(this, "postScriptName");
540
+ }
541
+ get size() { return this._size; }
542
+ set size(value) {
543
+ if (EqualsOfFloatNumbers(this._size, value))
544
+ return;
545
+ this._size = value;
546
+ this.$_propertyChanged.notify(this, "size");
547
+ }
548
+ addPropertyChanged(listener) {
721
549
  this.$_propertyChanged.add(listener);
722
- };
723
- FontSettings.prototype.removePropertyChanged = function (listener) {
550
+ }
551
+ removePropertyChanged(listener) {
724
552
  this.$_propertyChanged.remove(listener);
725
- };
726
- FontSettings.equals = function (a, b) {
553
+ }
554
+ static equals(a, b) {
727
555
  if (a == null && b == null)
728
556
  return true;
729
557
  if (a == null || b == null)
730
558
  return false;
731
559
  return a.equals(b);
732
- };
733
- FontSettings.prototype.equals = function (other) {
560
+ }
561
+ equals(other) {
734
562
  return this.postScriptName === other.postScriptName &&
735
563
  this.size === other.size &&
736
564
  this.fauxBold === other.fauxBold &&
737
565
  this.fauxItalic === other.fauxItalic &&
738
566
  this.allCaps === other.allCaps &&
739
- _.isEqual(this.openTypeFeatures, other.openTypeFeatures);
740
- };
741
- FontSettings.prototype.getSimplifiedObject = function () {
567
+ isEqual(this.openTypeFeatures, other.openTypeFeatures);
568
+ }
569
+ getSimplifiedObject() {
742
570
  return {
743
571
  "allCaps": this.allCaps,
744
572
  "fauxBold": this.fauxBold,
@@ -747,23 +575,21 @@ export { BaseTextItem };
747
575
  "postScriptName": this.postScriptName,
748
576
  "size": this.size
749
577
  };
750
- };
751
- return FontSettings;
752
- }(ModelComponent));
578
+ }
579
+ }
753
580
  BaseTextItem.FontSettings = FontSettings;
754
- var BaseTextValue = /** @class */ (function () {
755
- function BaseTextValue(name, text) {
581
+ class BaseTextValue {
582
+ constructor(name, text) {
756
583
  this.name = name;
757
584
  this.text = text;
758
585
  }
759
- BaseTextValue.prototype.equals = function (other) {
586
+ equals(other) {
760
587
  return other != null &&
761
588
  equals(this.name, other.name) &&
762
589
  equals(this.text, other.text);
763
- };
764
- BaseTextValue.prototype.clone = function () { return new BaseTextValue(this.name, this.text); };
765
- return BaseTextValue;
766
- }());
590
+ }
591
+ clone() { return new BaseTextValue(this.name, this.text); }
592
+ }
767
593
  BaseTextItem.BaseTextValue = BaseTextValue;
768
594
  })(BaseTextItem || (BaseTextItem = {}));
769
595
  //# sourceMappingURL=BaseTextItem.js.map