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,552 @@
|
|
|
1
|
+
|
|
2
|
+
import { UIBaseButton } from "./UIBaseButton"
|
|
3
|
+
import { UIColor } from "./UIColor"
|
|
4
|
+
import { UIImageView } from "./UIImageView"
|
|
5
|
+
import { IS, IS_NOT, IS_NOT_NIL, nil, NO, YES } from "./UIObject"
|
|
6
|
+
import { UIRectangle } from "./UIRectangle"
|
|
7
|
+
import { UITextView } from "./UITextView"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface UIButtonColorSpecifier {
|
|
11
|
+
|
|
12
|
+
titleLabel: UIButtonElementColorSpecifier;
|
|
13
|
+
background: UIButtonElementColorSpecifier;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export interface UIButtonElementColorSpecifier {
|
|
19
|
+
|
|
20
|
+
normal: UIColor;
|
|
21
|
+
hovered?: UIColor;
|
|
22
|
+
highlighted: UIColor;
|
|
23
|
+
focused?: UIColor;
|
|
24
|
+
selected: UIColor;
|
|
25
|
+
selectedAndHighlighted?: UIColor;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export class UIButton extends UIBaseButton {
|
|
32
|
+
|
|
33
|
+
_contentPadding: any
|
|
34
|
+
_titleLabel: UITextView
|
|
35
|
+
_imageView: UIImageView
|
|
36
|
+
|
|
37
|
+
usesAutomaticTitleFontSize = NO
|
|
38
|
+
minAutomaticFontSize: number = nil
|
|
39
|
+
maxAutomaticFontSize: number = 25
|
|
40
|
+
|
|
41
|
+
colors: UIButtonColorSpecifier
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
constructor(elementID: string, elementType?: string, titleType = UITextView.type.span) {
|
|
45
|
+
|
|
46
|
+
super(elementID, elementType, { "titleType": titleType })
|
|
47
|
+
|
|
48
|
+
this._class = UIButton
|
|
49
|
+
this.superclass = UIBaseButton
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
initView(elementID, viewHTMLElement, initViewData: { titleType: string }) {
|
|
59
|
+
|
|
60
|
+
this.class.superclass = UIBaseButton
|
|
61
|
+
|
|
62
|
+
// Instance variables
|
|
63
|
+
|
|
64
|
+
this.colors = {
|
|
65
|
+
|
|
66
|
+
titleLabel: {
|
|
67
|
+
|
|
68
|
+
normal: UIColor.whiteColor,
|
|
69
|
+
highlighted: UIColor.whiteColor,
|
|
70
|
+
selected: UIColor.whiteColor
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
background: {
|
|
75
|
+
|
|
76
|
+
normal: UIColor.blueColor,
|
|
77
|
+
highlighted: UIColor.greenColor,
|
|
78
|
+
selected: UIColor.redColor
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
this._imageView = new UIImageView(elementID + "ImageView")
|
|
86
|
+
this._imageView.hidden = YES
|
|
87
|
+
this.addSubview(this.imageView)
|
|
88
|
+
|
|
89
|
+
this.imageView.fillMode = UIImageView.fillMode.aspectFitIfLarger
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if (IS_NOT_NIL(initViewData.titleType)) {
|
|
93
|
+
|
|
94
|
+
this._titleLabel = new UITextView(elementID + "TitleLabel", initViewData.titleType)
|
|
95
|
+
this.titleLabel.style.whiteSpace = "nowrap"
|
|
96
|
+
this.addSubview(this.titleLabel)
|
|
97
|
+
|
|
98
|
+
this.titleLabel.userInteractionEnabled = NO
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.contentPadding = 10
|
|
103
|
+
|
|
104
|
+
this.imageView.userInteractionEnabled = NO
|
|
105
|
+
this.titleLabel.textAlignment = UITextView.textAlignment.center
|
|
106
|
+
this.titleLabel.nativeSelectionEnabled = NO
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
get contentPadding() {
|
|
113
|
+
|
|
114
|
+
return this._contentPadding.integerValue
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
set contentPadding(contentPadding) {
|
|
119
|
+
|
|
120
|
+
this._contentPadding = contentPadding
|
|
121
|
+
|
|
122
|
+
this.setNeedsLayout()
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
public set hovered(hovered: boolean) {
|
|
130
|
+
this._hovered = hovered
|
|
131
|
+
this.updateContentForCurrentState()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public get hovered(): boolean {
|
|
135
|
+
return this._hovered
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public set highlighted(highlighted: boolean) {
|
|
139
|
+
this._highlighted = highlighted
|
|
140
|
+
this.updateContentForCurrentState()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public get highlighted(): boolean {
|
|
144
|
+
return this._highlighted
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public set focused(focused: boolean) {
|
|
148
|
+
this._focused = focused
|
|
149
|
+
if (focused) {
|
|
150
|
+
this.focus()
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
this.blur()
|
|
154
|
+
}
|
|
155
|
+
this.updateContentForCurrentState()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public get focused(): boolean {
|
|
159
|
+
return this._focused
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public set selected(selected: boolean) {
|
|
163
|
+
this._selected = selected
|
|
164
|
+
this.updateContentForCurrentState()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public get selected(): boolean {
|
|
168
|
+
return this._selected
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
updateContentForCurrentState() {
|
|
176
|
+
|
|
177
|
+
var updateFunction: Function = this.updateContentForNormalState
|
|
178
|
+
if (this.selected && this.highlighted) {
|
|
179
|
+
updateFunction = this.updateContentForSelectedAndHighlightedState
|
|
180
|
+
}
|
|
181
|
+
else if (this.selected) {
|
|
182
|
+
updateFunction = this.updateContentForSelectedState
|
|
183
|
+
}
|
|
184
|
+
else if (this.focused) {
|
|
185
|
+
updateFunction = this.updateContentForFocusedState
|
|
186
|
+
}
|
|
187
|
+
else if (this.highlighted) {
|
|
188
|
+
updateFunction = this.updateContentForHighlightedState
|
|
189
|
+
}
|
|
190
|
+
else if (this.hovered) {
|
|
191
|
+
updateFunction = this.updateContentForHoveredState
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (!IS(updateFunction)) {
|
|
195
|
+
this.titleLabel.textColor = UIColor.nilColor
|
|
196
|
+
this.backgroundColor = UIColor.nilColor
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
updateFunction.call(this)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.updateContentForCurrentEnabledState();
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
updateContentForNormalState() {
|
|
207
|
+
|
|
208
|
+
this.backgroundColor = this.colors.background.normal
|
|
209
|
+
this.titleLabel.textColor = this.colors.titleLabel.normal
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
updateContentForHoveredState() {
|
|
214
|
+
|
|
215
|
+
this.updateContentForNormalState()
|
|
216
|
+
|
|
217
|
+
if (this.colors.background.hovered) {
|
|
218
|
+
this.backgroundColor = this.colors.background.hovered
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (this.colors.titleLabel.hovered) {
|
|
222
|
+
this.titleLabel.textColor = this.colors.titleLabel.hovered
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
updateContentForFocusedState() {
|
|
228
|
+
|
|
229
|
+
this.updateContentForHoveredState()
|
|
230
|
+
|
|
231
|
+
if (this.colors.background.focused) {
|
|
232
|
+
this.backgroundColor = this.colors.background.focused
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (this.colors.titleLabel.focused) {
|
|
236
|
+
this.titleLabel.textColor = this.colors.titleLabel.focused
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
updateContentForHighlightedState() {
|
|
242
|
+
|
|
243
|
+
this.backgroundColor = this.colors.background.highlighted
|
|
244
|
+
this.titleLabel.textColor = this.colors.titleLabel.highlighted
|
|
245
|
+
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
updateContentForSelectedState() {
|
|
249
|
+
|
|
250
|
+
this.backgroundColor = this.colors.background.selected
|
|
251
|
+
this.titleLabel.textColor = this.colors.titleLabel.selected
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
updateContentForSelectedAndHighlightedState() {
|
|
256
|
+
|
|
257
|
+
this.updateContentForSelectedState()
|
|
258
|
+
|
|
259
|
+
if (this.colors.background.selectedAndHighlighted) {
|
|
260
|
+
this.backgroundColor = this.colors.background.selectedAndHighlighted
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (this.colors.titleLabel.selectedAndHighlighted) {
|
|
264
|
+
this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
set enabled(enabled: boolean) {
|
|
271
|
+
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
super.enabled = enabled
|
|
274
|
+
|
|
275
|
+
this.updateContentForCurrentState()
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
get enabled() {
|
|
280
|
+
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
return super.enabled
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
updateContentForCurrentEnabledState() {
|
|
287
|
+
|
|
288
|
+
if (this.enabled) {
|
|
289
|
+
this.alpha = 1
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
this.alpha = 0.5
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
this.userInteractionEnabled = this.enabled
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
addStyleClass(styleClassName: string) {
|
|
302
|
+
|
|
303
|
+
super.addStyleClass(styleClassName)
|
|
304
|
+
|
|
305
|
+
if (this.styleClassName != styleClassName) {
|
|
306
|
+
|
|
307
|
+
this.updateContentForCurrentState.call(this)
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
get titleLabel() {
|
|
315
|
+
|
|
316
|
+
return this._titleLabel
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
get imageView() {
|
|
321
|
+
|
|
322
|
+
return this._imageView
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
layoutSubviews() {
|
|
331
|
+
|
|
332
|
+
super.layoutSubviews()
|
|
333
|
+
|
|
334
|
+
var bounds = this.bounds
|
|
335
|
+
|
|
336
|
+
this.hoverText = this.titleLabel.text
|
|
337
|
+
|
|
338
|
+
// Image only if text is not present
|
|
339
|
+
if (IS_NOT(this.imageView.hidden) && !IS(this.titleLabel.text)) {
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
this.imageView.frame = bounds
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Text only if image is not present
|
|
348
|
+
if (IS(this.imageView.hidden) && IS(this.titleLabel.text)) {
|
|
349
|
+
|
|
350
|
+
var titleElement = this.titleLabel.viewHTMLElement
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
this.titleLabel.style.left = this.contentPadding
|
|
354
|
+
this.titleLabel.style.right = this.contentPadding
|
|
355
|
+
// this.titleLabel.style.marginLeft = ""
|
|
356
|
+
// this.titleLabel.style.right = this.contentPadding
|
|
357
|
+
this.titleLabel.style.top = "50%"
|
|
358
|
+
this.titleLabel.style.transform = "translateY(-50%)"
|
|
359
|
+
this.titleLabel.frame = new UIRectangle(nil, nil, nil, nil)
|
|
360
|
+
|
|
361
|
+
if (this.usesAutomaticTitleFontSize) {
|
|
362
|
+
|
|
363
|
+
var hidden = this.titleLabel.hidden
|
|
364
|
+
|
|
365
|
+
this.titleLabel.hidden = YES
|
|
366
|
+
|
|
367
|
+
this.titleLabel.fontSize = 15
|
|
368
|
+
|
|
369
|
+
this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(
|
|
370
|
+
new UIRectangle(
|
|
371
|
+
0,
|
|
372
|
+
0,
|
|
373
|
+
this.bounds.height,
|
|
374
|
+
1 *
|
|
375
|
+
this.titleLabel.viewHTMLElement.offsetWidth
|
|
376
|
+
),
|
|
377
|
+
this.titleLabel.intrinsicContentSize(),
|
|
378
|
+
this.titleLabel.fontSize,
|
|
379
|
+
this.minAutomaticFontSize,
|
|
380
|
+
this.maxAutomaticFontSize
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
this.titleLabel.hidden = hidden
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Image and text both present
|
|
391
|
+
if (IS_NOT(this.imageView.hidden) && IS(this.titleLabel.text)) {
|
|
392
|
+
|
|
393
|
+
const imageShareOfWidth = 0.25
|
|
394
|
+
|
|
395
|
+
bounds = bounds.rectangleWithInset(this.contentPadding)
|
|
396
|
+
|
|
397
|
+
const imageFrame = bounds.copy()
|
|
398
|
+
imageFrame.width = bounds.height - this.contentPadding * 0.5
|
|
399
|
+
this.imageView.frame = imageFrame
|
|
400
|
+
|
|
401
|
+
var titleElement = this.titleLabel.viewHTMLElement
|
|
402
|
+
|
|
403
|
+
this.titleLabel.style.left = imageFrame.max.x + this.contentPadding
|
|
404
|
+
this.titleLabel.style.right = this.contentPadding
|
|
405
|
+
this.titleLabel.style.top = "50%"
|
|
406
|
+
this.titleLabel.style.transform = "translateY(-50%)"
|
|
407
|
+
|
|
408
|
+
if (this.usesAutomaticTitleFontSize) {
|
|
409
|
+
|
|
410
|
+
var hidden = this.titleLabel.hidden
|
|
411
|
+
|
|
412
|
+
this.titleLabel.hidden = YES
|
|
413
|
+
|
|
414
|
+
this.titleLabel.fontSize = 15
|
|
415
|
+
|
|
416
|
+
this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(
|
|
417
|
+
new UIRectangle(
|
|
418
|
+
0,
|
|
419
|
+
0,
|
|
420
|
+
this.bounds.height,
|
|
421
|
+
1 *
|
|
422
|
+
this.titleLabel.viewHTMLElement.offsetWidth
|
|
423
|
+
),
|
|
424
|
+
this.titleLabel.intrinsicContentSize(),
|
|
425
|
+
this.titleLabel.fontSize,
|
|
426
|
+
this.minAutomaticFontSize,
|
|
427
|
+
this.maxAutomaticFontSize
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
this.titleLabel.hidden = hidden
|
|
431
|
+
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
this.applyClassesAndStyles()
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
initViewStyleSelectors() {
|
|
441
|
+
|
|
442
|
+
this.initStyleSelector("." + this.styleClassName, "background-color: lightblue;")
|
|
443
|
+
|
|
444
|
+
// var selectorWithoutImage = "." + this.styleClassName + " ." + this.imageView.styleClassName + " + ." + this.titleLabel.styleClassName;
|
|
445
|
+
|
|
446
|
+
// this.initStyleSelector(
|
|
447
|
+
// selectorWithoutImage,
|
|
448
|
+
// "left: " + this.contentPadding + ";" +
|
|
449
|
+
// "right: " + this.contentPadding + ";" +
|
|
450
|
+
// "top: 50%;" +
|
|
451
|
+
// "transform: translateY(-50%);");
|
|
452
|
+
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|