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,238 @@
1
+ import { UIButton, UIButtonColorSpecifier } from "./UIButton"
2
+ import { UILink } from "./UILink"
3
+
4
+
5
+
6
+
7
+ export class UILinkButton extends UILink {
8
+
9
+
10
+ button: UIButton
11
+
12
+ //link = new UILink(this.elementID + "Link");
13
+
14
+
15
+
16
+
17
+
18
+ constructor(elementID: string, elementType?: string, titleType?: string) {
19
+
20
+ super(elementID, { "elementType": elementType, "titleType": titleType })
21
+
22
+ this._class = UILinkButton
23
+ this.superclass = UILink
24
+
25
+
26
+ this.button.addTargetForControlEvents([
27
+ UIButton.controlEvent.EnterDown, UIButton.controlEvent.PointerUpInside
28
+ ], function (this: UILinkButton, sender: UIButton, event: Event) {
29
+
30
+ const asd = 1
31
+
32
+ window.location = this.target as any
33
+
34
+
35
+ }.bind(this))
36
+
37
+ // this.link.hidden = YES;
38
+
39
+ // this.addSubview(this.link);
40
+
41
+
42
+ }
43
+
44
+
45
+
46
+
47
+
48
+ initView(elementID, viewHTMLElement, initViewData: { titleType: string, elementType: string }) {
49
+
50
+ super.initView(elementID, viewHTMLElement, initViewData)
51
+
52
+ this.class.superclass = UILink
53
+
54
+ // Instance variables
55
+
56
+ this.button = new UIButton(this.elementID + "Button", initViewData.elementType, initViewData.titleType)
57
+
58
+ this.addSubview(this.button)
59
+
60
+ this.style.position = "absolute"
61
+
62
+
63
+
64
+
65
+
66
+ }
67
+
68
+
69
+
70
+
71
+
72
+ get titleLabel() {
73
+
74
+ return this.button.titleLabel
75
+
76
+ }
77
+
78
+ get imageView() {
79
+
80
+ return this.button.imageView
81
+
82
+ }
83
+
84
+
85
+ set colors(colors: UIButtonColorSpecifier) {
86
+
87
+ this.button.colors = colors
88
+
89
+ }
90
+
91
+
92
+ get colors() {
93
+
94
+ return this.button.colors
95
+
96
+ }
97
+
98
+
99
+
100
+
101
+
102
+ get viewHTMLElement() {
103
+
104
+ // @ts-ignore
105
+ return super.viewHTMLElement as HTMLLinkElement
106
+
107
+ }
108
+
109
+
110
+ set target(target: string) {
111
+
112
+ this.viewHTMLElement.setAttribute("href", target)
113
+
114
+ }
115
+
116
+ get target() {
117
+
118
+ const result = this.viewHTMLElement.getAttribute("href")
119
+
120
+ return result
121
+
122
+ }
123
+
124
+
125
+
126
+
127
+
128
+ layoutSubviews() {
129
+
130
+ super.layoutSubviews()
131
+
132
+ const bounds = this.bounds
133
+
134
+ this.button.frame = bounds
135
+
136
+ this.button.layoutSubviews()
137
+
138
+
139
+ }
140
+
141
+
142
+
143
+
144
+
145
+ }
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
@@ -0,0 +1,254 @@
1
+ import { nil } from "./UIObject"
2
+ import { UIPoint } from "./UIPoint"
3
+ import { UIView } from "./UIView"
4
+
5
+
6
+
7
+
8
+
9
+ export class UINativeScrollView extends UIView {
10
+
11
+
12
+ animationDuration = 0
13
+
14
+ constructor(elementID, viewHTMLElement?) {
15
+
16
+ super(elementID, viewHTMLElement)
17
+
18
+ this._class = UINativeScrollView
19
+ this.superclass = UIView
20
+
21
+
22
+ this.style.cssText = this.style.cssText + "-webkit-overflow-scrolling: touch;"
23
+
24
+ this.style.overflow = "auto"
25
+
26
+ // this.scrollsX = YES;
27
+ // this.scrollsY = YES;
28
+
29
+ this.viewHTMLElement.addEventListener("scroll", function (this: UINativeScrollView, event: UIEvent) {
30
+
31
+
32
+ this.didScrollToPosition(new UIPoint(this.viewHTMLElement.scrollLeft, this.viewHTMLElement.scrollTop))
33
+
34
+ this.broadcastEventInSubtree({
35
+
36
+ name: UIView.broadcastEventName.PageDidScroll,
37
+ parameters: nil
38
+
39
+ })
40
+
41
+
42
+ }.bind(this))
43
+
44
+
45
+ }
46
+
47
+
48
+
49
+
50
+
51
+ didScrollToPosition(offsetPosition: UIPoint) {
52
+
53
+
54
+
55
+ }
56
+
57
+
58
+
59
+ get scrollsX() {
60
+ const result = (this.style.overflowX == "scroll")
61
+ return result
62
+ }
63
+
64
+ set scrollsX(scrolls: boolean) {
65
+ if (scrolls) {
66
+ this.style.overflowX = "scroll"
67
+ }
68
+ else {
69
+ this.style.overflowX = "hidden"
70
+ }
71
+ }
72
+
73
+
74
+
75
+ get scrollsY() {
76
+ const result = (this.style.overflowY == "scroll")
77
+ return result
78
+ }
79
+
80
+ set scrollsY(scrolls: boolean) {
81
+ if (scrolls) {
82
+ this.style.overflowY = "scroll"
83
+ }
84
+ else {
85
+ this.style.overflowY = "hidden"
86
+ }
87
+ }
88
+
89
+
90
+
91
+ get contentOffset() {
92
+ const result = new UIPoint(this.viewHTMLElement.scrollLeft, this.viewHTMLElement.scrollTop)
93
+ return result
94
+ }
95
+
96
+
97
+ set contentOffset(offsetPoint: UIPoint) {
98
+
99
+ if (this.animationDuration) {
100
+
101
+ this.scrollXTo(this.viewHTMLElement, offsetPoint.x, this.animationDuration)
102
+ this.scrollYTo(this.viewHTMLElement, offsetPoint.y, this.animationDuration)
103
+
104
+ return
105
+
106
+ }
107
+
108
+
109
+ this.viewHTMLElement.scrollLeft = offsetPoint.x
110
+ this.viewHTMLElement.scrollTop = offsetPoint.y
111
+
112
+ }
113
+
114
+
115
+ scrollToBottom() {
116
+
117
+ this.contentOffset = new UIPoint(this.contentOffset.x, this.scrollSize.height - this.frame.height)
118
+
119
+ }
120
+
121
+ scrollToTop() {
122
+
123
+ this.contentOffset = new UIPoint(this.contentOffset.x, 0)
124
+
125
+ }
126
+
127
+ get isScrolledToBottom() {
128
+
129
+ return this.contentOffset.isEqualTo(new UIPoint(this.contentOffset.x, this.scrollSize.height -
130
+ this.frame.height))
131
+
132
+ }
133
+
134
+ get isScrolledToTop() {
135
+
136
+ return this.contentOffset.isEqualTo(new UIPoint(this.contentOffset.x, 0))
137
+
138
+ }
139
+
140
+
141
+
142
+
143
+
144
+ scrollYTo(element, to, duration) {
145
+
146
+ duration = duration * 1000
147
+
148
+ const start = element.scrollTop
149
+ const change = to - start
150
+ const increment = 10
151
+
152
+ const animateScroll = function (elapsedTime) {
153
+ elapsedTime += increment
154
+ const position = this.easeInOut(elapsedTime, start, change, duration)
155
+ element.scrollTop = position
156
+ if (elapsedTime < duration) {
157
+ setTimeout(function () {
158
+ animateScroll(elapsedTime)
159
+ }, increment)
160
+ }
161
+ }.bind(this)
162
+
163
+ animateScroll(0)
164
+ }
165
+
166
+ scrollXTo(element, to, duration) {
167
+
168
+ duration = duration * 1000
169
+
170
+ const start = element.scrollTop
171
+ const change = to - start
172
+ const increment = 10
173
+
174
+ const animateScroll = function (elapsedTime) {
175
+ elapsedTime += increment
176
+ const position = this.easeInOut(elapsedTime, start, change, duration)
177
+ element.scrollLeft = position
178
+ if (elapsedTime < duration) {
179
+ setTimeout(function () {
180
+ animateScroll(elapsedTime)
181
+ }, increment)
182
+ }
183
+ }.bind(this)
184
+
185
+ animateScroll(0)
186
+ }
187
+
188
+ easeInOut(currentTime, start, change, duration) {
189
+ currentTime /= duration / 2
190
+ if (currentTime < 1) {
191
+ return change / 2 * currentTime * currentTime + start
192
+ }
193
+ currentTime -= 1
194
+ return -change / 2 * (currentTime * (currentTime - 2) - 1) + start
195
+ }
196
+
197
+
198
+
199
+
200
+
201
+ }
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+