uicore-ts 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.idea/misc.xml +6 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/uicore.iml +9 -0
  4. package/.idea/vcs.xml +6 -0
  5. package/LICENSE +21 -0
  6. package/README.md +5 -0
  7. package/compiledScripts/UIActionIndicator.d.ts +12 -0
  8. package/compiledScripts/UIActionIndicator.js +54 -0
  9. package/compiledScripts/UIActionIndicator.js.map +1 -0
  10. package/compiledScripts/UIBaseButton.d.ts +52 -0
  11. package/compiledScripts/UIBaseButton.js +268 -0
  12. package/compiledScripts/UIBaseButton.js.map +1 -0
  13. package/compiledScripts/UIButton.d.ts +54 -0
  14. package/compiledScripts/UIButton.js +247 -0
  15. package/compiledScripts/UIButton.js.map +1 -0
  16. package/compiledScripts/UIColor.d.ts +41 -0
  17. package/compiledScripts/UIColor.js +286 -0
  18. package/compiledScripts/UIColor.js.map +1 -0
  19. package/compiledScripts/UICore.d.ts +27 -0
  20. package/compiledScripts/UICore.js +105 -0
  21. package/compiledScripts/UICore.js.map +1 -0
  22. package/compiledScripts/UICoreExtensions.d.ts +60 -0
  23. package/compiledScripts/UICoreExtensions.js +527 -0
  24. package/compiledScripts/UICoreExtensions.js.map +1 -0
  25. package/compiledScripts/UIDateTimeInput.d.ts +40 -0
  26. package/compiledScripts/UIDateTimeInput.js +38 -0
  27. package/compiledScripts/UIDateTimeInput.js.map +1 -0
  28. package/compiledScripts/UIDialogView.d.ts +23 -0
  29. package/compiledScripts/UIDialogView.js +118 -0
  30. package/compiledScripts/UIDialogView.js.map +1 -0
  31. package/compiledScripts/UIImageView.d.ts +36 -0
  32. package/compiledScripts/UIImageView.js +170 -0
  33. package/compiledScripts/UIImageView.js.map +1 -0
  34. package/compiledScripts/UIKeyValueStringFilter.d.ts +21 -0
  35. package/compiledScripts/UIKeyValueStringFilter.js +98 -0
  36. package/compiledScripts/UIKeyValueStringFilter.js.map +1 -0
  37. package/compiledScripts/UIKeyValueStringSorter.d.ts +38 -0
  38. package/compiledScripts/UIKeyValueStringSorter.js +117 -0
  39. package/compiledScripts/UIKeyValueStringSorter.js.map +1 -0
  40. package/compiledScripts/UILayoutGrid.d.ts +8 -0
  41. package/compiledScripts/UILayoutGrid.js +22 -0
  42. package/compiledScripts/UILayoutGrid.js.map +1 -0
  43. package/compiledScripts/UILink.d.ts +25 -0
  44. package/compiledScripts/UILink.js +81 -0
  45. package/compiledScripts/UILink.js.map +1 -0
  46. package/compiledScripts/UILinkButton.d.ts +18 -0
  47. package/compiledScripts/UILinkButton.js +60 -0
  48. package/compiledScripts/UILinkButton.js.map +1 -0
  49. package/compiledScripts/UINativeScrollView.d.ts +20 -0
  50. package/compiledScripts/UINativeScrollView.js +121 -0
  51. package/compiledScripts/UINativeScrollView.js.map +1 -0
  52. package/compiledScripts/UIObject.d.ts +69 -0
  53. package/compiledScripts/UIObject.js +442 -0
  54. package/compiledScripts/UIObject.js.map +1 -0
  55. package/compiledScripts/UIPoint.d.ts +18 -0
  56. package/compiledScripts/UIPoint.js +68 -0
  57. package/compiledScripts/UIPoint.js.map +1 -0
  58. package/compiledScripts/UIRectangle.d.ts +61 -0
  59. package/compiledScripts/UIRectangle.js +421 -0
  60. package/compiledScripts/UIRectangle.js.map +1 -0
  61. package/compiledScripts/UIRoute.d.ts +39 -0
  62. package/compiledScripts/UIRoute.js +202 -0
  63. package/compiledScripts/UIRoute.js.map +1 -0
  64. package/compiledScripts/UIScrollView.d.ts +19 -0
  65. package/compiledScripts/UIScrollView.js +121 -0
  66. package/compiledScripts/UIScrollView.js.map +1 -0
  67. package/compiledScripts/UISlideScrollerView.d.ts +40 -0
  68. package/compiledScripts/UISlideScrollerView.js +242 -0
  69. package/compiledScripts/UISlideScrollerView.js.map +1 -0
  70. package/compiledScripts/UIStringFilter.d.ts +26 -0
  71. package/compiledScripts/UIStringFilter.js +107 -0
  72. package/compiledScripts/UIStringFilter.js.map +1 -0
  73. package/compiledScripts/UITableView.d.ts +61 -0
  74. package/compiledScripts/UITableView.js +383 -0
  75. package/compiledScripts/UITableView.js.map +1 -0
  76. package/compiledScripts/UITextArea.d.ts +7 -0
  77. package/compiledScripts/UITextArea.js +27 -0
  78. package/compiledScripts/UITextArea.js.map +1 -0
  79. package/compiledScripts/UITextField.d.ts +44 -0
  80. package/compiledScripts/UITextField.js +83 -0
  81. package/compiledScripts/UITextField.js.map +1 -0
  82. package/compiledScripts/UITextView.d.ts +89 -0
  83. package/compiledScripts/UITextView.js +237 -0
  84. package/compiledScripts/UITextView.js.map +1 -0
  85. package/compiledScripts/UITimer.d.ts +13 -0
  86. package/compiledScripts/UITimer.js +45 -0
  87. package/compiledScripts/UITimer.js.map +1 -0
  88. package/compiledScripts/UIView.d.ts +330 -0
  89. package/compiledScripts/UIView.js +1533 -0
  90. package/compiledScripts/UIView.js.map +1 -0
  91. package/compiledScripts/UIViewController.d.ts +38 -0
  92. package/compiledScripts/UIViewController.js +153 -0
  93. package/compiledScripts/UIViewController.js.map +1 -0
  94. package/compiledScripts/index.d.ts +29 -0
  95. package/compiledScripts/index.js +46 -0
  96. package/compiledScripts/index.js.map +1 -0
  97. package/package.json +36 -0
  98. package/scripts/UIActionIndicator.ts +139 -0
  99. package/scripts/UIBaseButton.ts +563 -0
  100. package/scripts/UIButton.ts +552 -0
  101. package/scripts/UIColor.ts +427 -0
  102. package/scripts/UICore.ts +223 -0
  103. package/scripts/UICoreExtensions.ts +949 -0
  104. package/scripts/UIDateTimeInput.ts +109 -0
  105. package/scripts/UIDialogView.ts +297 -0
  106. package/scripts/UIImageView.ts +366 -0
  107. package/scripts/UIKeyValueStringFilter.ts +260 -0
  108. package/scripts/UIKeyValueStringSorter.ts +337 -0
  109. package/scripts/UILayoutGrid.ts +83 -0
  110. package/scripts/UILink.ts +292 -0
  111. package/scripts/UILinkButton.ts +238 -0
  112. package/scripts/UINativeScrollView.ts +254 -0
  113. package/scripts/UIObject.ts +827 -0
  114. package/scripts/UIPoint.ts +123 -0
  115. package/scripts/UIRectangle.ts +730 -0
  116. package/scripts/UIRoute.ts +391 -0
  117. package/scripts/UIScrollView.ts +290 -0
  118. package/scripts/UISlideScrollerView.ts +530 -0
  119. package/scripts/UIStringFilter.ts +293 -0
  120. package/scripts/UITableView.ts +790 -0
  121. package/scripts/UITextArea.ts +91 -0
  122. package/scripts/UITextField.ts +218 -0
  123. package/scripts/UITextView.ts +561 -0
  124. package/scripts/UITimer.ts +107 -0
  125. package/scripts/UIView.ts +2789 -0
  126. package/scripts/UIViewController.ts +304 -0
  127. package/scripts/index.ts +36 -0
  128. package/tsconfig.json +59 -0
@@ -0,0 +1,1533 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UIView = void 0;
4
+ const UIColor_1 = require("./UIColor");
5
+ const UICore_1 = require("./UICore");
6
+ const UIDialogView_1 = require("./UIDialogView");
7
+ const UIObject_1 = require("./UIObject");
8
+ const UIPoint_1 = require("./UIPoint");
9
+ const UIRectangle_1 = require("./UIRectangle");
10
+ require("./UICoreExtensions");
11
+ class UIView extends UIObject_1.UIObject {
12
+ constructor(elementID = ("UIView" +
13
+ UIView.nextIndex), viewHTMLElement = null, elementType = null, initViewData) {
14
+ super();
15
+ this._nativeSelectionEnabled = UIObject_1.YES;
16
+ this._enabled = UIObject_1.YES;
17
+ this._backgroundColor = UIColor_1.UIColor.transparentColor;
18
+ this._localizedTextObject = UIObject_1.nil;
19
+ this._controlEventTargets = {}; //{ "PointerDown": Function[]; "PointerMove": Function[]; "PointerLeave": Function[]; "PointerEnter": Function[]; "PointerUpInside": Function[]; "PointerUp": Function[]; "PointerHover": Function[]; };
20
+ this._viewControllerLayoutFunction = UIObject_1.nil;
21
+ this._isHidden = UIObject_1.NO;
22
+ this.pausesPointerEvents = UIObject_1.NO;
23
+ this.stopsPointerEventPropagation = UIObject_1.YES;
24
+ this._pointerDragThreshold = 2;
25
+ this.ignoresTouches = UIObject_1.NO;
26
+ this.ignoresMouse = UIObject_1.NO;
27
+ this.forceIntrinsicSizeZero = UIObject_1.NO;
28
+ this.controlEvent = UIView.controlEvent;
29
+ this._class = UIView;
30
+ this.superclass = UIObject_1.UIObject;
31
+ // Instance variables
32
+ UIView._UIViewIndex = UIView.nextIndex;
33
+ this._UIViewIndex = UIView._UIViewIndex;
34
+ this._styleClasses = [];
35
+ // Object.defineProperty(this, "styleClasses", { get: this.styleClasses, set: this.setStyleClasses });
36
+ // Object.defineProperty(this, "styleClassName", { get: this.styleClassName });
37
+ this._initViewHTMLElement(elementID, viewHTMLElement, elementType);
38
+ this.subviews = [];
39
+ this.superview = UIObject_1.nil;
40
+ // Object.defineProperty(this, "elementID", { get: this.elementID });
41
+ // Object.defineProperty(this, "constraints", { get: this.constraints, set: this.setConstraints });
42
+ this._constraints = [];
43
+ this._updateLayoutFunction = UIObject_1.nil;
44
+ //Object.defineProperty(this, "backgroundColor", { get: this.backgroundColor, set: this.setBackgroundColor });
45
+ //this.backgroundColor = "transparent";
46
+ // Object.defineProperty(this, "alpha", { get: this.alpha, set: this.setAlpha });
47
+ // Object.defineProperty(this, "frame", { get: this.frame, set: this.setFrame });
48
+ // Object.defineProperty(this, "bounds", { get: this.bounds, set: this.setBounds });
49
+ // Object.defineProperty(this, "userInteractionEnabled", { get: this.userInteractionEnabled, set: this.setUserInteractionEnabled });
50
+ // this._controlEventTargets = {
51
+ // "PointerDown": [],
52
+ // "PointerMove": [],
53
+ // "PointerLeave": [],
54
+ // "PointerEnter": [],
55
+ // "PointerUpInside": [],
56
+ // "PointerUp": [],
57
+ // "PointerHover": []
58
+ // }
59
+ this._didLayoutSubviewsDelegateFunction = function () {
60
+ };
61
+ this._frameTransform = "";
62
+ this.initView(this.viewHTMLElement.id, this.viewHTMLElement, initViewData);
63
+ this._initViewCSSSelectorsIfNeeded();
64
+ this._loadUIEvents();
65
+ this.setNeedsLayout();
66
+ }
67
+ static get nextIndex() {
68
+ return UIView._UIViewIndex + 1;
69
+ }
70
+ static get pageHeight() {
71
+ const body = document.body;
72
+ const html = document.documentElement;
73
+ const height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
74
+ return height;
75
+ }
76
+ static get pageWidth() {
77
+ const body = document.body;
78
+ const html = document.documentElement;
79
+ const width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
80
+ return width;
81
+ }
82
+ initView(elementID, viewHTMLElement, initViewData) {
83
+ }
84
+ centerInContainer() {
85
+ this.style.left = "50%";
86
+ this.style.top = "50%";
87
+ this.style.transform = "translateX(-50%) translateY(-50%)";
88
+ }
89
+ centerXInContainer() {
90
+ this.style.left = "50%";
91
+ this.style.transform = "translateX(-50%)";
92
+ }
93
+ centerYInContainer() {
94
+ this.style.top = "50%";
95
+ this.style.transform = "translateY(-50%)";
96
+ }
97
+ _initViewHTMLElement(elementID, viewHTMLElement, elementType = "div") {
98
+ if (!(0, UIObject_1.IS)(elementType)) {
99
+ elementType = "div";
100
+ }
101
+ if (!(0, UIObject_1.IS)(viewHTMLElement)) {
102
+ this._viewHTMLElement = this.createElement(elementID, elementType);
103
+ this.style.position = "absolute";
104
+ this.style.margin = "0";
105
+ }
106
+ else {
107
+ this._viewHTMLElement = viewHTMLElement;
108
+ }
109
+ if ((0, UIObject_1.IS)(elementID)) {
110
+ this.viewHTMLElement.id = elementID;
111
+ }
112
+ this.viewHTMLElement.obeyAutolayout = UIObject_1.YES;
113
+ this.viewHTMLElement.UIView = this;
114
+ this.addStyleClass(this.styleClassName);
115
+ }
116
+ set nativeSelectionEnabled(selectable) {
117
+ this._nativeSelectionEnabled = selectable;
118
+ if (!selectable) {
119
+ this.style.cssText = this.style.cssText +
120
+ " -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;";
121
+ }
122
+ else {
123
+ this.style.cssText = this.style.cssText +
124
+ " -webkit-touch-callout: text; -webkit-user-select: text; -khtml-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text;";
125
+ }
126
+ }
127
+ get nativeSelectionEnabled() {
128
+ return this._nativeSelectionEnabled;
129
+ }
130
+ get styleClassName() {
131
+ const result = "UICore_UIView_" + this.class.name;
132
+ return result;
133
+ }
134
+ _initViewCSSSelectorsIfNeeded() {
135
+ if (!this.class._areViewCSSSelectorsInitialized) {
136
+ this.initViewStyleSelectors();
137
+ this.class._areViewCSSSelectorsInitialized = UIObject_1.YES;
138
+ }
139
+ }
140
+ initViewStyleSelectors() {
141
+ // Override this in a subclass
142
+ }
143
+ initStyleSelector(selector, style) {
144
+ const styleRules = UIView.getStyleRules(selector);
145
+ if (!styleRules) {
146
+ UIView.createStyleSelector(selector, style);
147
+ }
148
+ }
149
+ createElement(elementID, elementType) {
150
+ var result = document.getElementById(elementID);
151
+ if (!result) {
152
+ result = document.createElement(elementType);
153
+ }
154
+ return result;
155
+ }
156
+ get viewHTMLElement() {
157
+ return this._viewHTMLElement;
158
+ }
159
+ get elementID() {
160
+ return this.viewHTMLElement.id;
161
+ }
162
+ setInnerHTML(key, defaultString, parameters) {
163
+ this._innerHTMLKey = key;
164
+ this._defaultInnerHTML = defaultString;
165
+ this._parameters = parameters;
166
+ const languageName = UICore_1.UICore.languageService.currentLanguageKey;
167
+ const result = UICore_1.UICore.languageService.stringForKey(key, languageName, defaultString, parameters);
168
+ this.innerHTML = result;
169
+ }
170
+ _setInnerHTMLFromKeyIfPossible() {
171
+ if (this._innerHTMLKey && this._defaultInnerHTML) {
172
+ this.setInnerHTML(this._innerHTMLKey, this._defaultInnerHTML, this._parameters);
173
+ }
174
+ }
175
+ _setInnerHTMLFromLocalizedTextObjectIfPossible() {
176
+ if ((0, UIObject_1.IS)(this._localizedTextObject)) {
177
+ this.innerHTML = UICore_1.UICore.languageService.stringForCurrentLanguage(this._localizedTextObject);
178
+ }
179
+ }
180
+ get localizedTextObject() {
181
+ return this._localizedTextObject;
182
+ }
183
+ set localizedTextObject(localizedTextObject) {
184
+ this._localizedTextObject = localizedTextObject;
185
+ this._setInnerHTMLFromLocalizedTextObjectIfPossible();
186
+ }
187
+ get innerHTML() {
188
+ return this.viewHTMLElement.innerHTML;
189
+ }
190
+ set innerHTML(innerHTML) {
191
+ if (this.innerHTML != innerHTML) {
192
+ this.viewHTMLElement.innerHTML = (0, UIObject_1.FIRST)(innerHTML, "");
193
+ }
194
+ }
195
+ set hoverText(hoverText) {
196
+ this.viewHTMLElement.setAttribute("title", hoverText);
197
+ }
198
+ get hoverText() {
199
+ return this.viewHTMLElement.getAttribute("title");
200
+ }
201
+ get scrollSize() {
202
+ const result = new UIRectangle_1.UIRectangle(0, 0, this.viewHTMLElement.scrollHeight, this.viewHTMLElement.scrollWidth);
203
+ return result;
204
+ }
205
+ get dialogView() {
206
+ if (!(0, UIObject_1.IS)(this.superview)) {
207
+ return UIObject_1.nil;
208
+ }
209
+ if (!(this instanceof UIDialogView_1.UIDialogView)) {
210
+ return this.superview.dialogView;
211
+ }
212
+ return this;
213
+ }
214
+ get rootView() {
215
+ if ((0, UIObject_1.IS)(this.superview)) {
216
+ return this.superview.rootView;
217
+ }
218
+ return this;
219
+ }
220
+ set enabled(enabled) {
221
+ this._enabled = enabled;
222
+ this.updateContentForCurrentEnabledState();
223
+ }
224
+ get enabled() {
225
+ return this._enabled;
226
+ }
227
+ updateContentForCurrentEnabledState() {
228
+ this.hidden = !this.enabled;
229
+ this.userInteractionEnabled = this.enabled;
230
+ }
231
+ get tabIndex() {
232
+ return Number(this.viewHTMLElement.getAttribute("tabindex"));
233
+ }
234
+ set tabIndex(index) {
235
+ this.viewHTMLElement.setAttribute("tabindex", "" + index);
236
+ }
237
+ get styleClasses() {
238
+ return this._styleClasses;
239
+ }
240
+ set styleClasses(styleClasses) {
241
+ this._styleClasses = styleClasses;
242
+ }
243
+ hasStyleClass(styleClass) {
244
+ // This is for performance reasons
245
+ if (!(0, UIObject_1.IS)(styleClass)) {
246
+ return UIObject_1.NO;
247
+ }
248
+ const index = this.styleClasses.indexOf(styleClass);
249
+ if (index > -1) {
250
+ return UIObject_1.YES;
251
+ }
252
+ return UIObject_1.NO;
253
+ }
254
+ addStyleClass(styleClass) {
255
+ if (!(0, UIObject_1.IS)(styleClass)) {
256
+ return;
257
+ }
258
+ if (!this.hasStyleClass(styleClass)) {
259
+ this._styleClasses.push(styleClass);
260
+ }
261
+ }
262
+ removeStyleClass(styleClass) {
263
+ // This is for performance reasons
264
+ if (!(0, UIObject_1.IS)(styleClass)) {
265
+ return;
266
+ }
267
+ const index = this.styleClasses.indexOf(styleClass);
268
+ if (index > -1) {
269
+ this.styleClasses.splice(index, 1);
270
+ }
271
+ }
272
+ static findViewWithElementID(elementID) {
273
+ const viewHTMLElement = document.getElementById(elementID);
274
+ if ((0, UIObject_1.IS_NOT)(viewHTMLElement)) {
275
+ return UIObject_1.nil;
276
+ }
277
+ // @ts-ignore
278
+ const result = viewHTMLElement.UIView;
279
+ return result;
280
+ }
281
+ static createStyleSelector(selector, style) {
282
+ return;
283
+ // @ts-ignore
284
+ if (!document.styleSheets) {
285
+ return;
286
+ }
287
+ if (document.getElementsByTagName("head").length == 0) {
288
+ return;
289
+ }
290
+ var styleSheet;
291
+ var mediaType;
292
+ if (document.styleSheets.length > 0) {
293
+ for (var i = 0, l = document.styleSheets.length; i < l; i++) {
294
+ if (document.styleSheets[i].disabled) {
295
+ continue;
296
+ }
297
+ const media = document.styleSheets[i].media;
298
+ mediaType = typeof media;
299
+ if (mediaType === "string") {
300
+ if (media === "" || (media.indexOf("screen") !== -1)) {
301
+ styleSheet = document.styleSheets[i];
302
+ }
303
+ }
304
+ else if (mediaType == "object") {
305
+ if (media.mediaText === "" || (media.mediaText.indexOf("screen") !== -1)) {
306
+ styleSheet = document.styleSheets[i];
307
+ }
308
+ }
309
+ if (typeof styleSheet !== "undefined") {
310
+ break;
311
+ }
312
+ }
313
+ }
314
+ if (typeof styleSheet === "undefined") {
315
+ const styleSheetElement = document.createElement("style");
316
+ styleSheetElement.type = "text/css";
317
+ document.getElementsByTagName("head")[0].appendChild(styleSheetElement);
318
+ for (i = 0; i < document.styleSheets.length; i++) {
319
+ if (document.styleSheets[i].disabled) {
320
+ continue;
321
+ }
322
+ styleSheet = document.styleSheets[i];
323
+ }
324
+ mediaType = typeof styleSheet.media;
325
+ }
326
+ if (mediaType === "string") {
327
+ for (var i = 0, l = styleSheet.rules.length; i < l; i++) {
328
+ if (styleSheet.rules[i].selectorText && styleSheet.rules[i].selectorText.toLowerCase() ==
329
+ selector.toLowerCase()) {
330
+ styleSheet.rules[i].style.cssText = style;
331
+ return;
332
+ }
333
+ }
334
+ styleSheet.addRule(selector, style);
335
+ }
336
+ else if (mediaType === "object") {
337
+ var styleSheetLength = 0;
338
+ try {
339
+ styleSheetLength = (styleSheet.cssRules) ? styleSheet.cssRules.length : 0;
340
+ }
341
+ catch (error) {
342
+ }
343
+ for (var i = 0; i < styleSheetLength; i++) {
344
+ if (styleSheet.cssRules[i].selectorText && styleSheet.cssRules[i].selectorText.toLowerCase() ==
345
+ selector.toLowerCase()) {
346
+ styleSheet.cssRules[i].style.cssText = style;
347
+ return;
348
+ }
349
+ }
350
+ styleSheet.insertRule(selector + "{" + style + "}", styleSheetLength);
351
+ }
352
+ }
353
+ static getStyleRules(selector) {
354
+ var selector = selector.toLowerCase();
355
+ for (var i = 0; i < document.styleSheets.length; i++) {
356
+ const styleSheet = document.styleSheets[i];
357
+ var styleRules;
358
+ try {
359
+ styleRules = styleSheet.cssRules ? styleSheet.cssRules : styleSheet.rules;
360
+ }
361
+ catch (error) {
362
+ }
363
+ return styleRules;
364
+ }
365
+ }
366
+ get style() {
367
+ return this.viewHTMLElement.style;
368
+ }
369
+ get computedStyle() {
370
+ return getComputedStyle(this.viewHTMLElement);
371
+ }
372
+ get hidden() {
373
+ return this._isHidden;
374
+ }
375
+ set hidden(v) {
376
+ this._isHidden = v;
377
+ if (this._isHidden) {
378
+ this.style.visibility = "hidden";
379
+ }
380
+ else {
381
+ this.style.visibility = "visible";
382
+ }
383
+ }
384
+ static set pageScale(scale) {
385
+ UIView._pageScale = scale;
386
+ const zoom = scale;
387
+ const width = 100 / zoom;
388
+ const viewHTMLElement = UICore_1.UICore.main.rootViewController.view.viewHTMLElement;
389
+ viewHTMLElement.style.transformOrigin = "left top";
390
+ viewHTMLElement.style.transform = "scale(" + zoom + ")";
391
+ viewHTMLElement.style.width = width + "%";
392
+ }
393
+ static get pageScale() {
394
+ return UIView._pageScale;
395
+ }
396
+ calculateAndSetViewFrame() {
397
+ // Use this method to calculate the frame for the view itself
398
+ // This can be used when adding subviews to existing views like buttons
399
+ }
400
+ get frame() {
401
+ // var result = new UIRectangle(1 * this.viewHTMLElement.offsetLeft, 1 * this.viewHTMLElement.offsetTop, 1 * this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth);
402
+ // result.zIndex = 1 * this.style.zIndex;
403
+ var result = this._frame;
404
+ if (!result) {
405
+ result = new UIRectangle_1.UIRectangle(1 * this.viewHTMLElement.offsetLeft, 1 * this.viewHTMLElement.offsetTop, 1 *
406
+ this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth);
407
+ result.zIndex = 0;
408
+ }
409
+ return result.copy();
410
+ }
411
+ set frame(rectangle) {
412
+ if ((0, UIObject_1.IS)(rectangle)) {
413
+ this.setFrame(rectangle);
414
+ }
415
+ }
416
+ setFrame(rectangle, zIndex = 0, performUncheckedLayout = UIObject_1.NO) {
417
+ const frame = this._frame || new UIRectangle_1.UIRectangle(UIObject_1.nil, UIObject_1.nil, UIObject_1.nil, UIObject_1.nil);
418
+ if (zIndex != undefined) {
419
+ rectangle.zIndex = zIndex;
420
+ }
421
+ this._frame = rectangle;
422
+ // This is useless because frames are copied
423
+ // frame.didChange = function () {
424
+ // // Do nothing
425
+ // }
426
+ // rectangle.didChange = function () {
427
+ // this.frame = rectangle;
428
+ // }.bind(this);
429
+ if (frame && frame.isEqualTo(rectangle) && !performUncheckedLayout) {
430
+ return;
431
+ }
432
+ UIView._setAbsoluteSizeAndPosition(this.viewHTMLElement, rectangle.topLeft.x, rectangle.topLeft.y, rectangle.width, rectangle.height, rectangle.zIndex);
433
+ if (frame.height != rectangle.height || frame.width != rectangle.width || performUncheckedLayout) {
434
+ this.setNeedsLayout();
435
+ this.boundsDidChange();
436
+ //this.layoutSubviews();
437
+ }
438
+ }
439
+ get bounds() {
440
+ var result;
441
+ // if (IS_NOT(this._frame) && this.style.height == "" && this.style.width == "" && this.style.left == "" && this.style.right == "" && this.style.bottom == "" && this.style.top == "") {
442
+ // result = new UIRectangle(0, 0, 0, 0)
443
+ // }
444
+ // else
445
+ if ((0, UIObject_1.IS_NOT)(this._frame)) {
446
+ result = new UIRectangle_1.UIRectangle(0, 0, 1 * this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth);
447
+ }
448
+ else {
449
+ result = this.frame.copy();
450
+ result.x = 0;
451
+ result.y = 0;
452
+ }
453
+ return result;
454
+ }
455
+ set bounds(rectangle) {
456
+ const frame = this.frame;
457
+ this.frame = new UIRectangle_1.UIRectangle(frame.topLeft.x, frame.topLeft.y, rectangle.height, rectangle.width);
458
+ }
459
+ boundsDidChange() {
460
+ }
461
+ setPosition(left = UIObject_1.nil, right = UIObject_1.nil, bottom = UIObject_1.nil, top = UIObject_1.nil, height = UIObject_1.nil, width = UIObject_1.nil) {
462
+ const previousBounds = this.bounds;
463
+ this.setStyleProperty("left", left);
464
+ this.setStyleProperty("right", right);
465
+ this.setStyleProperty("bottom", bottom);
466
+ this.setStyleProperty("top", top);
467
+ this.setStyleProperty("height", height);
468
+ this.setStyleProperty("width", width);
469
+ const bounds = this.bounds;
470
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
471
+ this.setNeedsLayout();
472
+ this.boundsDidChange();
473
+ }
474
+ }
475
+ setSizes(height, width) {
476
+ const previousBounds = this.bounds;
477
+ this.setStyleProperty("height", height);
478
+ this.setStyleProperty("width", width);
479
+ const bounds = this.bounds;
480
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
481
+ this.setNeedsLayout();
482
+ this.boundsDidChange();
483
+ }
484
+ }
485
+ setMinSizes(height, width) {
486
+ const previousBounds = this.bounds;
487
+ this.setStyleProperty("minHeight", height);
488
+ this.setStyleProperty("minWidth", width);
489
+ const bounds = this.bounds;
490
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
491
+ this.setNeedsLayout();
492
+ this.boundsDidChange();
493
+ }
494
+ }
495
+ setMaxSizes(height, width) {
496
+ const previousBounds = this.bounds;
497
+ this.setStyleProperty("maxHeight", height);
498
+ this.setStyleProperty("maxWidth", width);
499
+ const bounds = this.bounds;
500
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
501
+ this.setNeedsLayout();
502
+ this.boundsDidChange();
503
+ }
504
+ }
505
+ setMargin(margin) {
506
+ const previousBounds = this.bounds;
507
+ this.setStyleProperty("margin", margin);
508
+ const bounds = this.bounds;
509
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
510
+ this.setNeedsLayout();
511
+ this.boundsDidChange();
512
+ }
513
+ }
514
+ setMargins(left, right, bottom, top) {
515
+ const previousBounds = this.bounds;
516
+ this.setStyleProperty("marginLeft", left);
517
+ this.setStyleProperty("marginRight", right);
518
+ this.setStyleProperty("marginBottom", bottom);
519
+ this.setStyleProperty("marginTop", top);
520
+ const bounds = this.bounds;
521
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
522
+ this.setNeedsLayout();
523
+ this.boundsDidChange();
524
+ }
525
+ }
526
+ setPadding(padding) {
527
+ const previousBounds = this.bounds;
528
+ this.setStyleProperty("padding", padding);
529
+ const bounds = this.bounds;
530
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
531
+ this.setNeedsLayout();
532
+ this.boundsDidChange();
533
+ }
534
+ }
535
+ setPaddings(left, right, bottom, top) {
536
+ const previousBounds = this.bounds;
537
+ this.setStyleProperty("paddingLeft", left);
538
+ this.setStyleProperty("paddingRight", right);
539
+ this.setStyleProperty("paddingBottom", bottom);
540
+ this.setStyleProperty("paddingTop", top);
541
+ const bounds = this.bounds;
542
+ if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
543
+ this.setNeedsLayout();
544
+ this.boundsDidChange();
545
+ }
546
+ }
547
+ setBorder(radius = UIObject_1.nil, width = 1, color = UIColor_1.UIColor.blackColor, style = "solid") {
548
+ this.setStyleProperty("borderStyle", style);
549
+ this.setStyleProperty("borderRadius", radius);
550
+ this.setStyleProperty("borderColor", color.stringValue);
551
+ this.setStyleProperty("borderWidth", width);
552
+ }
553
+ setStyleProperty(propertyName, value) {
554
+ try {
555
+ if ((0, UIObject_1.IS_NIL)(value)) {
556
+ return;
557
+ }
558
+ if ((0, UIObject_1.IS_DEFINED)(value) && value.isANumber) {
559
+ value = "" + value.integerValue + "px";
560
+ }
561
+ this.style[propertyName] = value;
562
+ }
563
+ catch (exception) {
564
+ console.log(exception);
565
+ }
566
+ }
567
+ get userInteractionEnabled() {
568
+ const result = (this.style.pointerEvents != "none");
569
+ return result;
570
+ }
571
+ set userInteractionEnabled(userInteractionEnabled) {
572
+ if (userInteractionEnabled) {
573
+ this.style.pointerEvents = "";
574
+ }
575
+ else {
576
+ this.style.pointerEvents = "none";
577
+ }
578
+ }
579
+ get backgroundColor() {
580
+ return this._backgroundColor;
581
+ }
582
+ set backgroundColor(backgroundColor) {
583
+ this._backgroundColor = backgroundColor;
584
+ this.style.backgroundColor = backgroundColor.stringValue;
585
+ }
586
+ get alpha() {
587
+ return 1 * this.style.opacity;
588
+ }
589
+ set alpha(alpha) {
590
+ this.style.opacity = "" + alpha;
591
+ }
592
+ static animateViewOrViewsWithDurationDelayAndFunction(viewOrViews, duration, delay, timingStyle = "cubic-bezier(0.25,0.1,0.25,1)", transformFunction, transitioncompletionFunction) {
593
+ function callTransitioncompletionFunction() {
594
+ (transitioncompletionFunction || UIObject_1.nil)();
595
+ viewOrViews.forEach(function (view, index, array) {
596
+ view.animationDidFinish();
597
+ });
598
+ }
599
+ if (UICore_1.IS_FIREFOX) {
600
+ // Firefox does not fire the transition completion event properly
601
+ new UIObject_1.UIObject().performFunctionWithDelay(delay + duration, callTransitioncompletionFunction);
602
+ }
603
+ if (!(viewOrViews instanceof Array)) {
604
+ viewOrViews = [viewOrViews];
605
+ }
606
+ const transitionStyles = [];
607
+ const transitionDurations = [];
608
+ const transitionDelays = [];
609
+ const transitionTimings = [];
610
+ for (var i = 0; i < viewOrViews.length; i++) {
611
+ var view = viewOrViews[i];
612
+ if (view.viewHTMLElement) {
613
+ view = view.viewHTMLElement;
614
+ }
615
+ view.addEventListener("transitionend", transitionDidFinish, true);
616
+ transitionStyles.push(view.style.transition);
617
+ transitionDurations.push(view.style.transitionDuration);
618
+ transitionDelays.push(view.style.transitionDelay);
619
+ transitionTimings.push(view.style.transitionTimingFunction);
620
+ view.style.transition = "all";
621
+ view.style.transitionDuration = "" + duration + "s";
622
+ view.style.transitionDelay = "" + delay + "s";
623
+ view.style.transitionTimingFunction = timingStyle;
624
+ }
625
+ transformFunction();
626
+ const transitionObject = {
627
+ "finishImmediately": finishTransitionImmediately,
628
+ "didFinish": transitionDidFinishManually,
629
+ "views": viewOrViews,
630
+ "registrationTime": Date.now()
631
+ };
632
+ function finishTransitionImmediately() {
633
+ for (var i = 0; i < viewOrViews.length; i++) {
634
+ var view = viewOrViews[i];
635
+ if (view.viewHTMLElement) {
636
+ view = view.viewHTMLElement;
637
+ }
638
+ view.style.transition = "all";
639
+ view.style.transitionDuration = "" + duration + "s";
640
+ view.style.transitionDelay = "" + delay + "s";
641
+ view.style.transition = transitionStyles[i];
642
+ view.style.transitionDuration = transitionDurations[i];
643
+ view.style.transitionDelay = transitionDelays[i];
644
+ view.style.transitionTimingFunction = transitionTimings[i];
645
+ }
646
+ }
647
+ function transitionDidFinish(event) {
648
+ var view = event.srcElement;
649
+ if (!view) {
650
+ return;
651
+ }
652
+ if (view.viewHTMLElement) {
653
+ view = view.viewHTMLElement;
654
+ }
655
+ view.style.transition = transitionStyles[i];
656
+ view.style.transitionDuration = transitionDurations[i];
657
+ view.style.transitionDelay = transitionDelays[i];
658
+ view.style.transitionTimingFunction = transitionTimings[i];
659
+ callTransitioncompletionFunction();
660
+ view.removeEventListener("transitionend", transitionDidFinish, true);
661
+ }
662
+ function transitionDidFinishManually() {
663
+ for (var i = 0; i < viewOrViews.length; i++) {
664
+ var view = viewOrViews[i];
665
+ if (view.viewHTMLElement) {
666
+ view = view.viewHTMLElement;
667
+ }
668
+ view.style.transition = transitionStyles[i];
669
+ view.style.transitionDuration = transitionDurations[i];
670
+ view.style.transitionDelay = transitionDelays[i];
671
+ view.style.transitionTimingFunction = transitionTimings[i];
672
+ view.removeEventListener("transitionend", transitionDidFinish, true);
673
+ }
674
+ }
675
+ return transitionObject;
676
+ }
677
+ animationDidFinish() {
678
+ }
679
+ static _setAbsoluteSizeAndPosition(element, left, top, width, height, zIndex = 0) {
680
+ // if (!UIView._transformAttribute) {
681
+ // UIView._transformAttribute = (('transform' in document.documentElement.style) ? 'transform' : undefined);
682
+ // UIView._transformAttribute = UIView._transformAttribute || (('-webkit-transform' in document.documentElement.style) ? '-webkit-transform' : 'undefined');
683
+ // UIView._transformAttribute = UIView._transformAttribute || (('-moz-transform' in document.documentElement.style) ? '-moz-transform' : 'undefined');
684
+ // UIView._transformAttribute = UIView._transformAttribute || (('-ms-transform' in document.documentElement.style) ? '-ms-transform' : 'undefined');
685
+ // UIView._transformAttribute = UIView._transformAttribute || (('-o-transform' in document.documentElement.style) ? '-o-transform' : 'undefined');
686
+ // }
687
+ if (!(0, UIObject_1.IS)(element) || !element.obeyAutolayout && !element.getAttribute("obeyAutolayout")) {
688
+ return;
689
+ }
690
+ if (element.id == "mainView") {
691
+ var asd = 1;
692
+ }
693
+ if ((0, UIObject_1.IS)(height)) {
694
+ height = height.integerValue + "px";
695
+ }
696
+ if ((0, UIObject_1.IS)(width)) {
697
+ width = width.integerValue + "px";
698
+ }
699
+ var str = element.style.cssText;
700
+ const frameTransform = UIView._transformAttribute + ": translate3d(" + (1 * left).integerValue + "px, " +
701
+ (1 * top).integerValue + "px, " + zIndex.integerValue + "px)";
702
+ if (element.UIView) {
703
+ str = str + frameTransform + ";";
704
+ }
705
+ else {
706
+ element.UIView._frameTransform = frameTransform;
707
+ }
708
+ if (height == UIObject_1.nil) {
709
+ str = str + " height: unset;";
710
+ }
711
+ else {
712
+ str = str + " height:" + height + ";";
713
+ }
714
+ if (width == UIObject_1.nil) {
715
+ str = str + " width: unset;";
716
+ }
717
+ else {
718
+ str = str + " width:" + width + ";";
719
+ }
720
+ if (element.id == "mainView") {
721
+ var asd = 1;
722
+ }
723
+ element.style.cssText = element.style.cssText + str;
724
+ }
725
+ static performAutoLayout(parentElement, visualFormatArray, constraintsArray) {
726
+ const view = new AutoLayout.View();
727
+ if ((0, UIObject_1.IS)(visualFormatArray) && (0, UIObject_1.IS)(visualFormatArray.length)) {
728
+ view.addConstraints(AutoLayout.VisualFormat.parse(visualFormatArray, { extended: true }));
729
+ }
730
+ if ((0, UIObject_1.IS)(constraintsArray) && (0, UIObject_1.IS)(constraintsArray.length)) {
731
+ view.addConstraints(constraintsArray);
732
+ }
733
+ const elements = {};
734
+ for (var key in view.subViews) {
735
+ if (!view.subViews.hasOwnProperty(key)) {
736
+ continue;
737
+ }
738
+ var element = UIObject_1.nil;
739
+ try {
740
+ element = parentElement.querySelector("#" + key);
741
+ }
742
+ catch (error) {
743
+ //console.log("Error occurred " + error);
744
+ }
745
+ if (element && !element.obeyAutolayout && !element.getAttribute("obeyAutolayout")) {
746
+ }
747
+ else if (element) {
748
+ element.className += element.className ? " abs" : "abs";
749
+ elements[key] = element;
750
+ }
751
+ }
752
+ var parentUIView = UIObject_1.nil;
753
+ if (parentElement.UIView) {
754
+ parentUIView = parentElement.UIView;
755
+ }
756
+ const updateLayout = function () {
757
+ view.setSize(parentElement ? parentElement.clientWidth : window.innerWidth, parentElement ? parentElement.clientHeight : window.innerHeight);
758
+ for (key in view.subViews) {
759
+ if (!view.subViews.hasOwnProperty(key)) {
760
+ continue;
761
+ }
762
+ const subView = view.subViews[key];
763
+ if (elements[key]) {
764
+ UIView._setAbsoluteSizeAndPosition(elements[key], subView.left, subView.top, subView.width, subView.height);
765
+ }
766
+ }
767
+ parentUIView.didLayoutSubviews();
768
+ };
769
+ updateLayout();
770
+ return updateLayout;
771
+ }
772
+ static runFunctionBeforeNextFrame(step) {
773
+ if (UICore_1.IS_SAFARI) {
774
+ // This creates a microtask
775
+ Promise.resolve().then(step);
776
+ }
777
+ else {
778
+ window.requestAnimationFrame(step);
779
+ }
780
+ }
781
+ static scheduleLayoutViewsIfNeeded() {
782
+ UIView.runFunctionBeforeNextFrame(UIView.layoutViewsIfNeeded);
783
+ }
784
+ static layoutViewsIfNeeded() {
785
+ for (var i = 0; i < UIView._viewsToLayout.length; i++) {
786
+ const view = UIView._viewsToLayout[i];
787
+ view.layoutIfNeeded();
788
+ }
789
+ UIView._viewsToLayout = [];
790
+ }
791
+ setNeedsLayout() {
792
+ if (this._shouldLayout) {
793
+ return;
794
+ }
795
+ this._shouldLayout = UIObject_1.YES;
796
+ // Register view for layout before next frame
797
+ UIView._viewsToLayout.push(this);
798
+ if (UIView._viewsToLayout.length == 1) {
799
+ UIView.scheduleLayoutViewsIfNeeded();
800
+ }
801
+ }
802
+ get needsLayout() {
803
+ return this._shouldLayout;
804
+ }
805
+ layoutIfNeeded() {
806
+ if (!this._shouldLayout) {
807
+ return;
808
+ }
809
+ this._shouldLayout = UIObject_1.NO;
810
+ try {
811
+ this.layoutSubviews();
812
+ }
813
+ catch (exception) {
814
+ console.log(exception);
815
+ }
816
+ }
817
+ layoutSubviews() {
818
+ this._shouldLayout = UIObject_1.NO;
819
+ // Autolayout
820
+ //window.removeEventListener('resize', this._updateLayoutFunction);
821
+ if (this.constraints.length) {
822
+ this._updateLayoutFunction = UIView.performAutoLayout(this.viewHTMLElement, null, this.constraints);
823
+ }
824
+ //this._updateLayoutFunction = this.layoutSubviews.bind(this);
825
+ //window.addEventListener('resize', this._updateLayoutFunction);
826
+ this._viewControllerLayoutFunction();
827
+ this.applyClassesAndStyles();
828
+ for (var i = 0; i < this.subviews.length; i++) {
829
+ const subview = this.subviews[i];
830
+ subview.calculateAndSetViewFrame();
831
+ //subview.layoutSubviews();
832
+ }
833
+ this.didLayoutSubviews();
834
+ }
835
+ applyClassesAndStyles() {
836
+ //var classesString = "";
837
+ for (var i = 0; i < this.styleClasses.length; i++) {
838
+ const styleClass = this.styleClasses[i];
839
+ if (styleClass) {
840
+ this.viewHTMLElement.classList.add(styleClass);
841
+ }
842
+ //classesString = classesString + " " + styleClass;
843
+ }
844
+ //this.viewHTMLElement.className = classesString;
845
+ }
846
+ didLayoutSubviews() {
847
+ this._didLayoutSubviewsDelegateFunction();
848
+ }
849
+ get constraints() {
850
+ return this._constraints;
851
+ }
852
+ set constraints(constraints) {
853
+ this._constraints = constraints;
854
+ }
855
+ addConstraint(constraint) {
856
+ this.constraints.push(constraint);
857
+ }
858
+ addConstraintsWithVisualFormat(visualFormatArray) {
859
+ this.constraints = this.constraints.concat(AutoLayout.VisualFormat.parse(visualFormatArray, { extended: true }));
860
+ }
861
+ static constraintWithView(view, attribute, relation, toView, toAttribute, multiplier, constant, priority) {
862
+ var UIViewObject = UIObject_1.nil;
863
+ var viewID = null;
864
+ if (view) {
865
+ if (view.isKindOfClass && view.isKindOfClass(UIView)) {
866
+ UIViewObject = view;
867
+ view = view.viewHTMLElement;
868
+ }
869
+ viewID = view.id;
870
+ }
871
+ var toUIViewObject = UIObject_1.nil;
872
+ var toViewID = null;
873
+ if (toView) {
874
+ if (toView.isKindOfClass && view.isKindOfClass(UIView)) {
875
+ toUIViewObject = toView;
876
+ toView = toView.viewHTMLElement;
877
+ }
878
+ toViewID = toView.id;
879
+ }
880
+ const constraint = {
881
+ view1: viewID,
882
+ attr1: attribute,
883
+ relation: relation,
884
+ view2: toViewID,
885
+ attr2: toAttribute,
886
+ multiplier: multiplier,
887
+ constant: constant,
888
+ priority: priority
889
+ };
890
+ return constraint;
891
+ }
892
+ subviewWithID(viewID) {
893
+ var resultHTMLElement = UIObject_1.nil;
894
+ try {
895
+ resultHTMLElement = this.viewHTMLElement.querySelector("#" + viewID);
896
+ }
897
+ catch (error) {
898
+ }
899
+ if (resultHTMLElement && resultHTMLElement.UIView) {
900
+ return resultHTMLElement.UIView;
901
+ }
902
+ return UIObject_1.nil;
903
+ }
904
+ rectangleContainingSubviews() {
905
+ const center = this.bounds.center;
906
+ var result = new UIRectangle_1.UIRectangle(center.x, center.y, 0, 0);
907
+ for (var i = 0; i < this.subviews.length; i++) {
908
+ const subview = this.subviews[i];
909
+ var frame = subview.frame;
910
+ const rectangleContainingSubviews = subview.rectangleContainingSubviews();
911
+ frame = frame.concatenateWithRectangle(rectangleContainingSubviews);
912
+ result = result.concatenateWithRectangle(frame);
913
+ }
914
+ return result;
915
+ }
916
+ hasSubview(view) {
917
+ // This is for performance reasons
918
+ if (!(0, UIObject_1.IS)(view)) {
919
+ return UIObject_1.NO;
920
+ }
921
+ for (var i = 0; i < this.subviews.length; i++) {
922
+ const subview = this.subviews[i];
923
+ if (subview == view) {
924
+ return UIObject_1.YES;
925
+ }
926
+ }
927
+ return UIObject_1.NO;
928
+ }
929
+ get viewBelowThisView() {
930
+ const result = (this.viewHTMLElement.previousElementSibling || {}).UIView;
931
+ return result;
932
+ }
933
+ get viewAboveThisView() {
934
+ const result = (this.viewHTMLElement.nextElementSibling || {}).UIView;
935
+ return result;
936
+ }
937
+ addSubview(view, aboveView) {
938
+ if (!this.hasSubview(view) && (0, UIObject_1.IS)(view)) {
939
+ view.willMoveToSuperview(this);
940
+ if ((0, UIObject_1.IS)(aboveView)) {
941
+ this.viewHTMLElement.insertBefore(view.viewHTMLElement, aboveView.viewHTMLElement.nextSibling);
942
+ this.subviews.insertElementAtIndex(this.subviews.indexOf(aboveView), view);
943
+ }
944
+ else {
945
+ this.viewHTMLElement.appendChild(view.viewHTMLElement);
946
+ this.subviews.push(view);
947
+ }
948
+ view.didMoveToSuperview(this);
949
+ if (this.superview && this.isMemberOfViewTree) {
950
+ view.broadcastEventInSubtree({
951
+ name: UIView.broadcastEventName.AddedToViewTree,
952
+ parameters: UIObject_1.nil
953
+ });
954
+ }
955
+ this.setNeedsLayout();
956
+ }
957
+ }
958
+ addSubviews(views) {
959
+ views.forEach(function (view, index, array) {
960
+ this.addSubview(view);
961
+ }, this);
962
+ }
963
+ moveToBottomOfSuperview() {
964
+ if ((0, UIObject_1.IS)(this.superview)) {
965
+ const bottomView = this.superview.subviews.firstElement;
966
+ if (bottomView == this) {
967
+ return;
968
+ }
969
+ this.superview.subviews.removeElement(this);
970
+ this.superview.subviews.insertElementAtIndex(0, this);
971
+ this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, bottomView.viewHTMLElement);
972
+ }
973
+ }
974
+ moveToTopOfSuperview() {
975
+ if ((0, UIObject_1.IS)(this.superview)) {
976
+ const topView = this.superview.subviews.lastElement;
977
+ if (topView == this) {
978
+ return;
979
+ }
980
+ this.superview.subviews.removeElement(this);
981
+ this.superview.subviews.push(this);
982
+ this.superview.viewHTMLElement.appendChild(this.viewHTMLElement);
983
+ }
984
+ }
985
+ removeFromSuperview() {
986
+ if ((0, UIObject_1.IS)(this.superview)) {
987
+ this.forEachViewInSubtree(function (view) {
988
+ view.blur();
989
+ });
990
+ const index = this.superview.subviews.indexOf(this);
991
+ if (index > -1) {
992
+ this.superview.subviews.splice(index, 1);
993
+ this.superview.viewHTMLElement.removeChild(this.viewHTMLElement);
994
+ this.superview = UIObject_1.nil;
995
+ this.broadcastEventInSubtree({
996
+ name: UIView.broadcastEventName.RemovedFromViewTree,
997
+ parameters: UIObject_1.nil
998
+ });
999
+ }
1000
+ }
1001
+ }
1002
+ willAppear() {
1003
+ }
1004
+ willMoveToSuperview(superview) {
1005
+ this._setInnerHTMLFromKeyIfPossible();
1006
+ this._setInnerHTMLFromLocalizedTextObjectIfPossible();
1007
+ }
1008
+ didMoveToSuperview(superview) {
1009
+ this.superview = superview;
1010
+ }
1011
+ wasAddedToViewTree() {
1012
+ }
1013
+ wasRemovedFromViewTree() {
1014
+ }
1015
+ get isMemberOfViewTree() {
1016
+ var element = this.viewHTMLElement;
1017
+ for (var i = 0; element; i = i) {
1018
+ if (element.parentElement && element.parentElement == document.body) {
1019
+ return UIObject_1.YES;
1020
+ }
1021
+ element = element.parentElement;
1022
+ }
1023
+ return UIObject_1.NO;
1024
+ }
1025
+ get allSuperviews() {
1026
+ const result = [];
1027
+ var view = this;
1028
+ for (var i = 0; (0, UIObject_1.IS)(view); i = i) {
1029
+ result.push(view);
1030
+ view = view.superview;
1031
+ }
1032
+ return result;
1033
+ }
1034
+ setNeedsLayoutOnAllSuperviews() {
1035
+ this.allSuperviews.reverse().forEach(function (view, index, array) {
1036
+ view.setNeedsLayout();
1037
+ });
1038
+ }
1039
+ setNeedsLayoutUpToRootView() {
1040
+ this.setNeedsLayoutOnAllSuperviews();
1041
+ this.setNeedsLayout();
1042
+ }
1043
+ focus() {
1044
+ this.viewHTMLElement.focus();
1045
+ }
1046
+ blur() {
1047
+ this.viewHTMLElement.blur();
1048
+ }
1049
+ _loadUIEvents() {
1050
+ //this.viewHTMLElement = nil;
1051
+ const isTouchEventClassDefined = UIObject_1.NO || window.TouchEvent;
1052
+ const pauseEvent = (event, forced = UIObject_1.NO) => {
1053
+ if (this.pausesPointerEvents || forced) {
1054
+ if (event.stopPropagation) {
1055
+ event.stopPropagation();
1056
+ }
1057
+ if (event.preventDefault) {
1058
+ event.preventDefault();
1059
+ }
1060
+ event.cancelBubble = true;
1061
+ event.returnValue = false;
1062
+ return false;
1063
+ }
1064
+ if (event.stopPropagation && this.stopsPointerEventPropagation) {
1065
+ event.stopPropagation();
1066
+ }
1067
+ };
1068
+ const onMouseDown = (event) => {
1069
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1070
+ ((this.ignoresMouse || ((0, UIObject_1.IS)(this._touchEventTime) && (Date.now() - this._touchEventTime) > 500)) &&
1071
+ event instanceof MouseEvent)) {
1072
+ return;
1073
+ }
1074
+ this.sendControlEventForKey(UIView.controlEvent.PointerDown, event);
1075
+ this._isPointerInside = UIObject_1.YES;
1076
+ this._isPointerValid = UIObject_1.YES;
1077
+ this._initialPointerPosition = new UIPoint_1.UIPoint(event.clientX, event.clientY);
1078
+ if (isTouchEventClassDefined && event instanceof TouchEvent) {
1079
+ this._touchEventTime = Date.now();
1080
+ this._initialPointerPosition = new UIPoint_1.UIPoint(event.touches[0].clientX, event.touches[0].clientY);
1081
+ if (event.touches.length > 1) {
1082
+ onTouchCancel(event);
1083
+ return;
1084
+ }
1085
+ }
1086
+ else {
1087
+ this._touchEventTime = UIObject_1.nil;
1088
+ pauseEvent(event);
1089
+ }
1090
+ this._hasPointerDragged = UIObject_1.NO;
1091
+ };
1092
+ const onTouchStart = onMouseDown;
1093
+ const onmouseup = (event) => {
1094
+ if (!this._isPointerValid) {
1095
+ return;
1096
+ }
1097
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1098
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1099
+ return;
1100
+ }
1101
+ if (this._isPointerInside) {
1102
+ onPointerUpInside(event);
1103
+ if (!this._hasPointerDragged) {
1104
+ this.sendControlEventForKey(UIView.controlEvent.PointerTap, event);
1105
+ }
1106
+ }
1107
+ // This has to be sent after the more specific event so that UIButton can ignore it when not highlighted
1108
+ this.sendControlEventForKey(UIView.controlEvent.PointerUp, event);
1109
+ pauseEvent(event);
1110
+ };
1111
+ const onTouchEnd = onmouseup;
1112
+ // function onMouseEnter(event) {
1113
+ // this.sendControlEventForKey(UIView.controlEvent.PointerEnter, event);
1114
+ // this._isPointerInside = YES;
1115
+ // pauseEvent(event);
1116
+ // }
1117
+ const onmouseout = (event) => {
1118
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1119
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1120
+ return;
1121
+ }
1122
+ this.sendControlEventForKey(UIView.controlEvent.PointerLeave, event);
1123
+ this._isPointerInside = UIObject_1.NO;
1124
+ pauseEvent(event);
1125
+ };
1126
+ const onTouchLeave = onmouseout;
1127
+ var onTouchCancel = function (event) {
1128
+ if (!this._isPointerValid) {
1129
+ return;
1130
+ }
1131
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1132
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1133
+ return;
1134
+ }
1135
+ this._isPointerValid = UIObject_1.NO;
1136
+ this.sendControlEventForKey(UIView.controlEvent.PointerCancel, event);
1137
+ }.bind(this);
1138
+ const onmouseover = (event) => {
1139
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1140
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1141
+ return;
1142
+ }
1143
+ this.sendControlEventForKey(UIView.controlEvent.PointerHover, event);
1144
+ this._isPointerInside = UIObject_1.YES;
1145
+ this._isPointerValid = UIObject_1.YES;
1146
+ pauseEvent(event);
1147
+ };
1148
+ const onMouseMove = (event) => {
1149
+ if (!this._isPointerValid) {
1150
+ return;
1151
+ }
1152
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1153
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1154
+ return;
1155
+ }
1156
+ if ((0, UIObject_1.IS_NOT)(this._initialPointerPosition)) {
1157
+ this._initialPointerPosition = new UIPoint_1.UIPoint(event.clientX, event.clientY);
1158
+ }
1159
+ if (new UIPoint_1.UIPoint(event.clientX, event.clientY).to(this._initialPointerPosition).length >
1160
+ this._pointerDragThreshold) {
1161
+ this._hasPointerDragged = UIObject_1.YES;
1162
+ }
1163
+ this.sendControlEventForKey(UIView.controlEvent.PointerMove, event);
1164
+ pauseEvent(event);
1165
+ };
1166
+ const onTouchMove = function (event) {
1167
+ if (!this._isPointerValid) {
1168
+ return;
1169
+ }
1170
+ if ((this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent) ||
1171
+ (this.ignoresMouse && event instanceof MouseEvent)) {
1172
+ return;
1173
+ }
1174
+ if (event.touches.length > 1) {
1175
+ onTouchZoom(event);
1176
+ return;
1177
+ }
1178
+ const touch = event.touches[0];
1179
+ if (new UIPoint_1.UIPoint(touch.clientX, touch.clientY).to(this._initialPointerPosition).length >
1180
+ this._pointerDragThreshold) {
1181
+ this._hasPointerDragged = UIObject_1.YES;
1182
+ }
1183
+ if (this._isPointerInside && this.viewHTMLElement !=
1184
+ document.elementFromPoint(touch.clientX, touch.clientY)) {
1185
+ this._isPointerInside = UIObject_1.NO;
1186
+ this.sendControlEventForKey(UIView.controlEvent.PointerLeave, event);
1187
+ }
1188
+ this.sendControlEventForKey(UIView.controlEvent.PointerMove, event);
1189
+ //pauseEvent(event);
1190
+ };
1191
+ var onTouchZoom = function onTouchZoom(event) {
1192
+ this.sendControlEventForKey(UIView.controlEvent.MultipleTouches, event);
1193
+ }.bind(this);
1194
+ var onPointerUpInside = (event) => {
1195
+ pauseEvent(event);
1196
+ this.sendControlEventForKey(UIView.controlEvent.PointerUpInside, event);
1197
+ };
1198
+ function eventKeyIsEnter(event) {
1199
+ if (event.keyCode !== 13) {
1200
+ return UIObject_1.NO;
1201
+ }
1202
+ return UIObject_1.YES;
1203
+ }
1204
+ function eventKeyIsTab(event) {
1205
+ if (event.keyCode !== 9) {
1206
+ return UIObject_1.NO;
1207
+ }
1208
+ return UIObject_1.YES;
1209
+ }
1210
+ function eventKeyIsEsc(event) {
1211
+ var result = false;
1212
+ if ("key" in event) {
1213
+ result = (event.key == "Escape" || event.key == "Esc");
1214
+ }
1215
+ else {
1216
+ result = (event.keyCode == 27);
1217
+ }
1218
+ return result;
1219
+ }
1220
+ function eventKeyIsLeft(event) {
1221
+ if (event.keyCode != "37") {
1222
+ return UIObject_1.NO;
1223
+ }
1224
+ return UIObject_1.YES;
1225
+ }
1226
+ function eventKeyIsRight(event) {
1227
+ if (event.keyCode != "39") {
1228
+ return UIObject_1.NO;
1229
+ }
1230
+ return UIObject_1.YES;
1231
+ }
1232
+ function eventKeyIsDown(event) {
1233
+ if (event.keyCode != "40") {
1234
+ return UIObject_1.NO;
1235
+ }
1236
+ return UIObject_1.YES;
1237
+ }
1238
+ function eventKeyIsUp(event) {
1239
+ if (event.keyCode != "38") {
1240
+ return UIObject_1.NO;
1241
+ }
1242
+ return UIObject_1.YES;
1243
+ }
1244
+ const onKeyDown = function (event) {
1245
+ if (eventKeyIsEnter(event)) {
1246
+ this.sendControlEventForKey(UIView.controlEvent.EnterDown, event);
1247
+ }
1248
+ if (eventKeyIsEsc(event)) {
1249
+ this.sendControlEventForKey(UIView.controlEvent.EscDown, event);
1250
+ }
1251
+ if (eventKeyIsTab(event) && this._controlEventTargets.TabDown && this._controlEventTargets.TabDown.length) {
1252
+ this.sendControlEventForKey(UIView.controlEvent.TabDown, event);
1253
+ pauseEvent(event, UIObject_1.YES);
1254
+ }
1255
+ if (eventKeyIsLeft(event)) {
1256
+ this.sendControlEventForKey(UIView.controlEvent.LeftArrowDown, event);
1257
+ }
1258
+ if (eventKeyIsRight(event)) {
1259
+ this.sendControlEventForKey(UIView.controlEvent.RightArrowDown, event);
1260
+ }
1261
+ if (eventKeyIsDown(event)) {
1262
+ this.sendControlEventForKey(UIView.controlEvent.DownArrowDown, event);
1263
+ }
1264
+ if (eventKeyIsUp(event)) {
1265
+ this.sendControlEventForKey(UIView.controlEvent.UpArrowDown, event);
1266
+ }
1267
+ }.bind(this);
1268
+ const onKeyUp = function (event) {
1269
+ if (eventKeyIsEnter(event)) {
1270
+ this.sendControlEventForKey(UIView.controlEvent.EnterUp, event);
1271
+ }
1272
+ }.bind(this);
1273
+ const onfocus = function (event) {
1274
+ this.sendControlEventForKey(UIView.controlEvent.Focus, event);
1275
+ }.bind(this);
1276
+ const onblur = function (event) {
1277
+ this.sendControlEventForKey(UIView.controlEvent.Blur, event);
1278
+ }.bind(this);
1279
+ // Mouse and touch start events
1280
+ this._viewHTMLElement.onmousedown = onMouseDown.bind(this);
1281
+ this._viewHTMLElement.ontouchstart = onTouchStart.bind(this);
1282
+ // this.viewHTMLElement.addEventListener("mousedown", onMouseDown.bind(this), false)
1283
+ // this.viewHTMLElement.addEventListener('touchstart', onTouchStart.bind(this), false)
1284
+ // //this.viewHTMLElement.addEventListener("mouseenter", onMouseEnter.bind(this), false);
1285
+ // Mouse and touch move events
1286
+ this._viewHTMLElement.onmousemove = onMouseMove.bind(this);
1287
+ this._viewHTMLElement.ontouchmove = onTouchMove.bind(this);
1288
+ // this.viewHTMLElement.addEventListener("mousemove", onMouseMove.bind(this), false)
1289
+ // this.viewHTMLElement.addEventListener('touchmove', onTouchMove.bind(this), false)
1290
+ //this.viewHTMLElement.addEventListener("mousewheel", onmousewheel.bind(this), false)
1291
+ this._viewHTMLElement.onmouseover = onmouseover.bind(this);
1292
+ // this.viewHTMLElement.addEventListener("mouseover", onmouseover.bind(this), false)
1293
+ // Mouse and touch end events
1294
+ this._viewHTMLElement.onmouseup = onmouseup.bind(this);
1295
+ this._viewHTMLElement.ontouchend = onTouchEnd.bind(this);
1296
+ this._viewHTMLElement.ontouchcancel = onTouchCancel.bind(this);
1297
+ // this.viewHTMLElement.addEventListener("mouseup", onmouseup.bind(this), false)
1298
+ // this.viewHTMLElement.addEventListener('touchend', onTouchEnd.bind(this), false)
1299
+ // this.viewHTMLElement.addEventListener('touchcancel', onTouchCancel.bind(this), false)
1300
+ this._viewHTMLElement.onmouseout = onmouseout.bind(this);
1301
+ // this.viewHTMLElement.addEventListener("mouseout", onmouseout.bind(this), false)
1302
+ this._viewHTMLElement.addEventListener("touchleave", onTouchLeave.bind(this), false);
1303
+ // this.viewHTMLElement.onkeydown = onkeydown
1304
+ // this.viewHTMLElement.onkeyup = onkeyup
1305
+ this._viewHTMLElement.addEventListener("keydown", onKeyDown, false);
1306
+ this._viewHTMLElement.addEventListener("keyup", onKeyUp, false);
1307
+ // Focus events
1308
+ this._viewHTMLElement.onfocus = onfocus;
1309
+ this._viewHTMLElement.onblur = onblur;
1310
+ // this.viewHTMLElement.addEventListener("focus", onfocus, true)
1311
+ // this.viewHTMLElement.addEventListener("blur", onblur, true)
1312
+ }
1313
+ get addControlEventTarget() {
1314
+ const eventKeys = [];
1315
+ const result = new Proxy(this.constructor.controlEvent, {
1316
+ get: (target, key, receiver) => {
1317
+ eventKeys.push(key);
1318
+ return result;
1319
+ },
1320
+ set: (target, key, value, receiver) => {
1321
+ eventKeys.push(key);
1322
+ this.addTargetForControlEvents(eventKeys, value);
1323
+ return true;
1324
+ }
1325
+ });
1326
+ return result;
1327
+ }
1328
+ addTargetForControlEvents(eventKeys, targetFunction) {
1329
+ eventKeys.forEach(function (key, index, array) {
1330
+ this.addTargetForControlEvent(key, targetFunction);
1331
+ }, this);
1332
+ }
1333
+ addTargetForControlEvent(eventKey, targetFunction) {
1334
+ var targets = this._controlEventTargets[eventKey];
1335
+ if (!targets) {
1336
+ // @ts-ignore
1337
+ targets = [];
1338
+ this._controlEventTargets[eventKey] = targets;
1339
+ }
1340
+ if (targets.indexOf(targetFunction) == -1) {
1341
+ targets.push(targetFunction);
1342
+ }
1343
+ }
1344
+ removeTargetForControlEvent(eventKey, targetFunction) {
1345
+ const targets = this._controlEventTargets[eventKey];
1346
+ if (!targets) {
1347
+ return;
1348
+ }
1349
+ const index = targets.indexOf(targetFunction);
1350
+ if (index != -1) {
1351
+ targets.splice(index, 1);
1352
+ }
1353
+ }
1354
+ removeTargetForControlEvents(eventKeys, targetFunction) {
1355
+ eventKeys.forEach(function (key, index, array) {
1356
+ this.removeTargetForControlEvent(key, targetFunction);
1357
+ }, this);
1358
+ }
1359
+ sendControlEventForKey(eventKey, nativeEvent) {
1360
+ var targets = this._controlEventTargets[eventKey];
1361
+ if (!targets) {
1362
+ return;
1363
+ }
1364
+ targets = targets.copy();
1365
+ for (var i = 0; i < targets.length; i++) {
1366
+ const target = targets[i];
1367
+ target(this, nativeEvent);
1368
+ }
1369
+ }
1370
+ broadcastEventInSubtree(event) {
1371
+ this.forEachViewInSubtree(function (view) {
1372
+ view.didReceiveBroadcastEvent(event);
1373
+ if (view._didReceiveBroadcastEventDelegateFunction) {
1374
+ view._didReceiveBroadcastEventDelegateFunction(event);
1375
+ }
1376
+ });
1377
+ }
1378
+ didReceiveBroadcastEvent(event) {
1379
+ if (event.name == UIView.broadcastEventName.PageDidScroll) {
1380
+ this._isPointerValid = UIObject_1.NO;
1381
+ }
1382
+ if (event.name == UIView.broadcastEventName.AddedToViewTree) {
1383
+ this.wasAddedToViewTree();
1384
+ }
1385
+ if (event.name == UIView.broadcastEventName.RemovedFromViewTree) {
1386
+ this.wasRemovedFromViewTree();
1387
+ }
1388
+ if (event.name == UIView.broadcastEventName.LanguageChanged || event.name ==
1389
+ UIView.broadcastEventName.AddedToViewTree) {
1390
+ this._setInnerHTMLFromKeyIfPossible();
1391
+ this._setInnerHTMLFromLocalizedTextObjectIfPossible();
1392
+ }
1393
+ }
1394
+ forEachViewInSubtree(functionToCall) {
1395
+ functionToCall(this);
1396
+ this.subviews.forEach(function (subview, index, array) {
1397
+ subview.forEachViewInSubtree(functionToCall);
1398
+ });
1399
+ }
1400
+ rectangleInView(rectangle, view) {
1401
+ if (!view.isMemberOfViewTree || !this.isMemberOfViewTree) {
1402
+ return UIObject_1.nil;
1403
+ }
1404
+ const viewClientRectangle = view.viewHTMLElement.getBoundingClientRect();
1405
+ const viewLocation = new UIPoint_1.UIPoint(viewClientRectangle.left, viewClientRectangle.top);
1406
+ const selfClientRectangle = this.viewHTMLElement.getBoundingClientRect();
1407
+ const selfLocation = new UIPoint_1.UIPoint(selfClientRectangle.left, selfClientRectangle.top);
1408
+ const offsetPoint = selfLocation.subtract(viewLocation);
1409
+ return rectangle.copy().offsetByPoint(offsetPoint);
1410
+ }
1411
+ rectangleFromView(rectangle, view) {
1412
+ return view.rectangleInView(rectangle, this);
1413
+ }
1414
+ intrinsicContentSizeWithConstraints(constrainingHeight = 0, constrainingWidth = 0) {
1415
+ // This works but is slow
1416
+ const result = new UIRectangle_1.UIRectangle(0, 0, 0, 0);
1417
+ if (this.rootView.forceIntrinsicSizeZero) {
1418
+ return result;
1419
+ }
1420
+ var temporarilyInViewTree = UIObject_1.NO;
1421
+ var nodeAboveThisView;
1422
+ if (!this.isMemberOfViewTree) {
1423
+ document.body.appendChild(this.viewHTMLElement);
1424
+ temporarilyInViewTree = UIObject_1.YES;
1425
+ nodeAboveThisView = this.viewHTMLElement.nextSibling;
1426
+ }
1427
+ const height = this.style.height;
1428
+ const width = this.style.width;
1429
+ this.style.height = "" + constrainingHeight;
1430
+ this.style.width = "" + constrainingWidth;
1431
+ const left = this.style.left;
1432
+ const right = this.style.right;
1433
+ const bottom = this.style.bottom;
1434
+ const top = this.style.top;
1435
+ this.style.left = "";
1436
+ this.style.right = "";
1437
+ this.style.bottom = "";
1438
+ this.style.top = "";
1439
+ const resultHeight = this.viewHTMLElement.scrollHeight;
1440
+ const whiteSpace = this.style.whiteSpace;
1441
+ this.style.whiteSpace = "nowrap";
1442
+ const resultWidth = this.viewHTMLElement.scrollWidth;
1443
+ this.style.whiteSpace = whiteSpace;
1444
+ this.style.height = height;
1445
+ this.style.width = width;
1446
+ this.style.left = left;
1447
+ this.style.right = right;
1448
+ this.style.bottom = bottom;
1449
+ this.style.top = top;
1450
+ if (temporarilyInViewTree) {
1451
+ document.body.removeChild(this.viewHTMLElement);
1452
+ if (this.superview) {
1453
+ if (nodeAboveThisView) {
1454
+ this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, nodeAboveThisView);
1455
+ }
1456
+ else {
1457
+ this.superview.viewHTMLElement.appendChild(this.viewHTMLElement);
1458
+ }
1459
+ }
1460
+ }
1461
+ result.height = resultHeight;
1462
+ result.width = resultWidth;
1463
+ return result;
1464
+ }
1465
+ intrinsicContentWidth(constrainingHeight = 0) {
1466
+ const result = this.intrinsicContentSizeWithConstraints(constrainingHeight).width;
1467
+ return result;
1468
+ }
1469
+ intrinsicContentHeight(constrainingWidth = 0) {
1470
+ const result = this.intrinsicContentSizeWithConstraints(undefined, constrainingWidth).height;
1471
+ return result;
1472
+ }
1473
+ intrinsicContentSize() {
1474
+ return UIObject_1.nil;
1475
+ }
1476
+ }
1477
+ exports.UIView = UIView;
1478
+ UIView._UIViewIndex = -1;
1479
+ UIView._viewsToLayout = [];
1480
+ UIView._pageScale = 1;
1481
+ UIView._transformAttribute = (("transform" in document.documentElement.style) ? "transform" : undefined) ||
1482
+ (("-webkit-transform" in document.documentElement.style) ? "-webkit-transform" : "undefined") ||
1483
+ (("-moz-transform" in document.documentElement.style) ? "-moz-transform" : "undefined") ||
1484
+ (("-ms-transform" in document.documentElement.style) ? "-ms-transform" : "undefined") ||
1485
+ (("-o-transform" in document.documentElement.style) ? "-o-transform" : "undefined");
1486
+ UIView.constraintAttribute = {
1487
+ "left": AutoLayout.Attribute.LEFT,
1488
+ "right": AutoLayout.Attribute.RIGHT,
1489
+ "bottom": AutoLayout.Attribute.BOTTOM,
1490
+ "top": AutoLayout.Attribute.TOP,
1491
+ "centerX": AutoLayout.Attribute.CENTERX,
1492
+ "centerY": AutoLayout.Attribute.CENTERY,
1493
+ "height": AutoLayout.Attribute.HEIGHT,
1494
+ "width": AutoLayout.Attribute.WIDTH,
1495
+ "zIndex": AutoLayout.Attribute.ZINDEX,
1496
+ // Not sure what these are for
1497
+ "constant": AutoLayout.Attribute.NOTANATTRIBUTE,
1498
+ "variable": AutoLayout.Attribute.VARIABLE
1499
+ };
1500
+ UIView.constraintRelation = {
1501
+ "equal": AutoLayout.Relation.EQU,
1502
+ "lessThanOrEqual": AutoLayout.Relation.LEQ,
1503
+ "greaterThanOrEqual": AutoLayout.Relation.GEQ
1504
+ };
1505
+ UIView.controlEvent = {
1506
+ "PointerDown": "PointerDown",
1507
+ "PointerMove": "PointerMove",
1508
+ "PointerLeave": "PointerLeave",
1509
+ "PointerEnter": "PointerEnter",
1510
+ "PointerUpInside": "PointerUpInside",
1511
+ "PointerTap": "PointerTap",
1512
+ "PointerUp": "PointerUp",
1513
+ "MultipleTouches": "PointerZoom",
1514
+ "PointerCancel": "PointerCancel",
1515
+ "PointerHover": "PointerHover",
1516
+ "EnterDown": "EnterDown",
1517
+ "EnterUp": "EnterUp",
1518
+ "EscDown": "EscDown",
1519
+ "TabDown": "TabDown",
1520
+ "LeftArrowDown": "LeftArrowDown",
1521
+ "RightArrowDown": "RightArrowDown",
1522
+ "DownArrowDown": "DownArrowDown",
1523
+ "UpArrowDown": "UpArrowDown",
1524
+ "Focus": "Focus",
1525
+ "Blur": "Blur"
1526
+ };
1527
+ UIView.broadcastEventName = {
1528
+ "LanguageChanged": "LanguageChanged",
1529
+ "RemovedFromViewTree": "RemovedFromViewTree",
1530
+ "AddedToViewTree": "AddedToViewTree",
1531
+ "PageDidScroll": "PageDidScroll"
1532
+ };
1533
+ //# sourceMappingURL=UIView.js.map