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.
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/uicore.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/compiledScripts/UIActionIndicator.d.ts +12 -0
- package/compiledScripts/UIActionIndicator.js +54 -0
- package/compiledScripts/UIActionIndicator.js.map +1 -0
- package/compiledScripts/UIBaseButton.d.ts +52 -0
- package/compiledScripts/UIBaseButton.js +268 -0
- package/compiledScripts/UIBaseButton.js.map +1 -0
- package/compiledScripts/UIButton.d.ts +54 -0
- package/compiledScripts/UIButton.js +247 -0
- package/compiledScripts/UIButton.js.map +1 -0
- package/compiledScripts/UIColor.d.ts +41 -0
- package/compiledScripts/UIColor.js +286 -0
- package/compiledScripts/UIColor.js.map +1 -0
- package/compiledScripts/UICore.d.ts +27 -0
- package/compiledScripts/UICore.js +105 -0
- package/compiledScripts/UICore.js.map +1 -0
- package/compiledScripts/UICoreExtensions.d.ts +60 -0
- package/compiledScripts/UICoreExtensions.js +527 -0
- package/compiledScripts/UICoreExtensions.js.map +1 -0
- package/compiledScripts/UIDateTimeInput.d.ts +40 -0
- package/compiledScripts/UIDateTimeInput.js +38 -0
- package/compiledScripts/UIDateTimeInput.js.map +1 -0
- package/compiledScripts/UIDialogView.d.ts +23 -0
- package/compiledScripts/UIDialogView.js +118 -0
- package/compiledScripts/UIDialogView.js.map +1 -0
- package/compiledScripts/UIImageView.d.ts +36 -0
- package/compiledScripts/UIImageView.js +170 -0
- package/compiledScripts/UIImageView.js.map +1 -0
- package/compiledScripts/UIKeyValueStringFilter.d.ts +21 -0
- package/compiledScripts/UIKeyValueStringFilter.js +98 -0
- package/compiledScripts/UIKeyValueStringFilter.js.map +1 -0
- package/compiledScripts/UIKeyValueStringSorter.d.ts +38 -0
- package/compiledScripts/UIKeyValueStringSorter.js +117 -0
- package/compiledScripts/UIKeyValueStringSorter.js.map +1 -0
- package/compiledScripts/UILayoutGrid.d.ts +8 -0
- package/compiledScripts/UILayoutGrid.js +22 -0
- package/compiledScripts/UILayoutGrid.js.map +1 -0
- package/compiledScripts/UILink.d.ts +25 -0
- package/compiledScripts/UILink.js +81 -0
- package/compiledScripts/UILink.js.map +1 -0
- package/compiledScripts/UILinkButton.d.ts +18 -0
- package/compiledScripts/UILinkButton.js +60 -0
- package/compiledScripts/UILinkButton.js.map +1 -0
- package/compiledScripts/UINativeScrollView.d.ts +20 -0
- package/compiledScripts/UINativeScrollView.js +121 -0
- package/compiledScripts/UINativeScrollView.js.map +1 -0
- package/compiledScripts/UIObject.d.ts +69 -0
- package/compiledScripts/UIObject.js +442 -0
- package/compiledScripts/UIObject.js.map +1 -0
- package/compiledScripts/UIPoint.d.ts +18 -0
- package/compiledScripts/UIPoint.js +68 -0
- package/compiledScripts/UIPoint.js.map +1 -0
- package/compiledScripts/UIRectangle.d.ts +61 -0
- package/compiledScripts/UIRectangle.js +421 -0
- package/compiledScripts/UIRectangle.js.map +1 -0
- package/compiledScripts/UIRoute.d.ts +39 -0
- package/compiledScripts/UIRoute.js +202 -0
- package/compiledScripts/UIRoute.js.map +1 -0
- package/compiledScripts/UIScrollView.d.ts +19 -0
- package/compiledScripts/UIScrollView.js +121 -0
- package/compiledScripts/UIScrollView.js.map +1 -0
- package/compiledScripts/UISlideScrollerView.d.ts +40 -0
- package/compiledScripts/UISlideScrollerView.js +242 -0
- package/compiledScripts/UISlideScrollerView.js.map +1 -0
- package/compiledScripts/UIStringFilter.d.ts +26 -0
- package/compiledScripts/UIStringFilter.js +107 -0
- package/compiledScripts/UIStringFilter.js.map +1 -0
- package/compiledScripts/UITableView.d.ts +61 -0
- package/compiledScripts/UITableView.js +383 -0
- package/compiledScripts/UITableView.js.map +1 -0
- package/compiledScripts/UITextArea.d.ts +7 -0
- package/compiledScripts/UITextArea.js +27 -0
- package/compiledScripts/UITextArea.js.map +1 -0
- package/compiledScripts/UITextField.d.ts +44 -0
- package/compiledScripts/UITextField.js +83 -0
- package/compiledScripts/UITextField.js.map +1 -0
- package/compiledScripts/UITextView.d.ts +89 -0
- package/compiledScripts/UITextView.js +237 -0
- package/compiledScripts/UITextView.js.map +1 -0
- package/compiledScripts/UITimer.d.ts +13 -0
- package/compiledScripts/UITimer.js +45 -0
- package/compiledScripts/UITimer.js.map +1 -0
- package/compiledScripts/UIView.d.ts +330 -0
- package/compiledScripts/UIView.js +1533 -0
- package/compiledScripts/UIView.js.map +1 -0
- package/compiledScripts/UIViewController.d.ts +38 -0
- package/compiledScripts/UIViewController.js +153 -0
- package/compiledScripts/UIViewController.js.map +1 -0
- package/compiledScripts/index.d.ts +29 -0
- package/compiledScripts/index.js +46 -0
- package/compiledScripts/index.js.map +1 -0
- package/package.json +36 -0
- package/scripts/UIActionIndicator.ts +139 -0
- package/scripts/UIBaseButton.ts +563 -0
- package/scripts/UIButton.ts +552 -0
- package/scripts/UIColor.ts +427 -0
- package/scripts/UICore.ts +223 -0
- package/scripts/UICoreExtensions.ts +949 -0
- package/scripts/UIDateTimeInput.ts +109 -0
- package/scripts/UIDialogView.ts +297 -0
- package/scripts/UIImageView.ts +366 -0
- package/scripts/UIKeyValueStringFilter.ts +260 -0
- package/scripts/UIKeyValueStringSorter.ts +337 -0
- package/scripts/UILayoutGrid.ts +83 -0
- package/scripts/UILink.ts +292 -0
- package/scripts/UILinkButton.ts +238 -0
- package/scripts/UINativeScrollView.ts +254 -0
- package/scripts/UIObject.ts +827 -0
- package/scripts/UIPoint.ts +123 -0
- package/scripts/UIRectangle.ts +730 -0
- package/scripts/UIRoute.ts +391 -0
- package/scripts/UIScrollView.ts +290 -0
- package/scripts/UISlideScrollerView.ts +530 -0
- package/scripts/UIStringFilter.ts +293 -0
- package/scripts/UITableView.ts +790 -0
- package/scripts/UITextArea.ts +91 -0
- package/scripts/UITextField.ts +218 -0
- package/scripts/UITextView.ts +561 -0
- package/scripts/UITimer.ts +107 -0
- package/scripts/UIView.ts +2789 -0
- package/scripts/UIViewController.ts +304 -0
- package/scripts/index.ts +36 -0
- package/tsconfig.json +59 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { nil } from "./UIObject"
|
|
2
|
+
import { UIView, UIViewAddControlEventTargetObject } from "./UIView"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class UIDateTimeInput extends UIView {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
constructor(elementID: string, type: string = UIDateTimeInput.type.DateTime) {
|
|
12
|
+
|
|
13
|
+
super(elementID, nil, "input")
|
|
14
|
+
|
|
15
|
+
this._class = UIDateTimeInput
|
|
16
|
+
this.superclass = UIView
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
this.viewHTMLElement.setAttribute("type", type)
|
|
20
|
+
|
|
21
|
+
this.viewHTMLElement.onchange = (event) => {
|
|
22
|
+
this.sendControlEventForKey(UIDateTimeInput.controlEvent.ValueChange, event)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
static controlEvent = Object.assign({}, UIView.controlEvent, {
|
|
36
|
+
|
|
37
|
+
"ValueChange": "ValueChange"
|
|
38
|
+
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
get addControlEventTarget(): UIViewAddControlEventTargetObject<typeof UIDateTimeInput.controlEvent> {
|
|
42
|
+
|
|
43
|
+
return super.addControlEventTarget as any
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
static type = {
|
|
52
|
+
|
|
53
|
+
"Date": "date",
|
|
54
|
+
"Time": "time",
|
|
55
|
+
"DateTime": "datetime"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
static format = {
|
|
62
|
+
|
|
63
|
+
"European": "DD-MM-YYYY",
|
|
64
|
+
"ISOComputer": "YYYY-MM-DD",
|
|
65
|
+
"American": "MM/DD/YYYY"
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
get date() {
|
|
74
|
+
|
|
75
|
+
const result = new Date((this.viewHTMLElement as HTMLInputElement).value)
|
|
76
|
+
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { UIColor } from "./UIColor"
|
|
2
|
+
import { IS_FIREFOX, UICore } from "./UICore"
|
|
3
|
+
import { IS, nil, NO, YES } from "./UIObject"
|
|
4
|
+
import { UIView, UIViewBroadcastEvent } from "./UIView"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
_view: ViewType = nil
|
|
12
|
+
|
|
13
|
+
_appearedAnimated: boolean
|
|
14
|
+
|
|
15
|
+
animationDuration: number = 0.25
|
|
16
|
+
|
|
17
|
+
_zIndex: number = 100
|
|
18
|
+
|
|
19
|
+
isVisible: boolean = NO
|
|
20
|
+
|
|
21
|
+
dismissesOnTapOutside = YES
|
|
22
|
+
|
|
23
|
+
constructor(elementID?: string, viewHTMLElement?: HTMLElement) {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
super(elementID, viewHTMLElement)
|
|
27
|
+
|
|
28
|
+
this.addTargetForControlEvent(
|
|
29
|
+
UIView.controlEvent.PointerTap,
|
|
30
|
+
function (this: UIDialogView, sender: UIView, event: Event) {
|
|
31
|
+
|
|
32
|
+
this.didDetectTapOutside(sender, event)
|
|
33
|
+
|
|
34
|
+
}.bind(this)
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)
|
|
38
|
+
|
|
39
|
+
this.zIndex = this._zIndex
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
didDetectTapOutside(sender: UIView, event: Event) {
|
|
46
|
+
|
|
47
|
+
if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {
|
|
48
|
+
this.dismiss(this._appearedAnimated)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
set zIndex(zIndex: number) {
|
|
55
|
+
|
|
56
|
+
this._zIndex = zIndex
|
|
57
|
+
this.style.zIndex = "" + zIndex
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get zIndex() {
|
|
62
|
+
|
|
63
|
+
return this._zIndex
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
set view(view: ViewType) {
|
|
70
|
+
|
|
71
|
+
this._view.removeFromSuperview()
|
|
72
|
+
|
|
73
|
+
this._view = view
|
|
74
|
+
|
|
75
|
+
this.addSubview(view)
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
get view() {
|
|
81
|
+
|
|
82
|
+
return this._view
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
willAppear(animated: boolean = NO) {
|
|
89
|
+
|
|
90
|
+
if (animated) {
|
|
91
|
+
|
|
92
|
+
this.style.opacity = "0"
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.style.height = ""
|
|
97
|
+
|
|
98
|
+
this._frame = null
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
animateAppearing() {
|
|
104
|
+
|
|
105
|
+
this.style.opacity = "1"
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
animateDisappearing() {
|
|
110
|
+
|
|
111
|
+
this.style.opacity = "0"
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
showInView(containerView: UIView, animated: boolean) {
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
animated = (animated && !IS_FIREFOX)
|
|
121
|
+
|
|
122
|
+
this._appearedAnimated = animated
|
|
123
|
+
|
|
124
|
+
this.willAppear(animated)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
containerView.addSubview(this)
|
|
128
|
+
|
|
129
|
+
if (animated) {
|
|
130
|
+
|
|
131
|
+
this.layoutSubviews()
|
|
132
|
+
|
|
133
|
+
UIView.animateViewOrViewsWithDurationDelayAndFunction(
|
|
134
|
+
this,
|
|
135
|
+
this.animationDuration,
|
|
136
|
+
0,
|
|
137
|
+
undefined,
|
|
138
|
+
function () {
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
this.animateAppearing()
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
}.bind(this),
|
|
145
|
+
nil
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
|
|
152
|
+
this.setNeedsLayout()
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.isVisible = YES
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
showInRootView(animated: boolean) {
|
|
163
|
+
|
|
164
|
+
this.showInView(UICore.main.rootViewController.view, animated)
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
dismiss(animated?: boolean) {
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
animated = (animated && !IS_FIREFOX)
|
|
174
|
+
|
|
175
|
+
if (animated == undefined) {
|
|
176
|
+
|
|
177
|
+
animated = this._appearedAnimated
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (animated) {
|
|
182
|
+
|
|
183
|
+
UIView.animateViewOrViewsWithDurationDelayAndFunction(
|
|
184
|
+
this,
|
|
185
|
+
this.animationDuration,
|
|
186
|
+
0,
|
|
187
|
+
undefined,
|
|
188
|
+
function () {
|
|
189
|
+
|
|
190
|
+
this.animateDisappearing()
|
|
191
|
+
|
|
192
|
+
}.bind(this),
|
|
193
|
+
function () {
|
|
194
|
+
|
|
195
|
+
if (this.isVisible == NO) {
|
|
196
|
+
|
|
197
|
+
this.removeFromSuperview()
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
}.bind(this)
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
|
|
207
|
+
this.removeFromSuperview()
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.isVisible = NO
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {
|
|
220
|
+
|
|
221
|
+
super.didReceiveBroadcastEvent(event)
|
|
222
|
+
|
|
223
|
+
if (event.name == UICore.broadcastEventName.WindowDidResize) {
|
|
224
|
+
|
|
225
|
+
this.setNeedsLayout()
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
layoutSubviews() {
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
if (!IS(this.view)) {
|
|
239
|
+
|
|
240
|
+
return
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//this.frame = this.superview.bounds;
|
|
245
|
+
|
|
246
|
+
this.setPosition(0, 0, 0, 0, 0, "100%")
|
|
247
|
+
this.setPosition(0, 0, 0, 0, UIView.pageHeight, "100%")
|
|
248
|
+
|
|
249
|
+
const bounds = this.bounds
|
|
250
|
+
|
|
251
|
+
const margin = 20
|
|
252
|
+
|
|
253
|
+
//this.view.centerInContainer();
|
|
254
|
+
|
|
255
|
+
this.view.style.position = "relative"
|
|
256
|
+
|
|
257
|
+
// this.view.style.maxHeight = "" + (bounds.height - margin * 2).integerValue + "px";
|
|
258
|
+
// this.view.style.maxWidth = "" + (bounds.width - margin * 2).integerValue + "px";
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
// var viewIntrinsicRectangle = this.view.intrinsicContentSize();
|
|
264
|
+
// this.view.frame = new UIRectangle((bounds.width - viewIntrinsicRectangle.width)*0.5, )
|
|
265
|
+
|
|
266
|
+
super.layoutSubviews()
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|