uicore-ts 1.0.6 → 1.0.8
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/compiledScripts/ClientCheckers.js +1 -0
- package/compiledScripts/ClientCheckers.js.map +1 -1
- package/compiledScripts/UIActionIndicator.js +1 -0
- package/compiledScripts/UIActionIndicator.js.map +1 -1
- package/compiledScripts/UIBaseButton.d.ts +14 -6
- package/compiledScripts/UIBaseButton.js +26 -27
- package/compiledScripts/UIBaseButton.js.map +2 -2
- package/compiledScripts/UIButton.d.ts +5 -8
- package/compiledScripts/UIButton.js +20 -21
- package/compiledScripts/UIButton.js.map +2 -2
- package/compiledScripts/UIColor.d.ts +1 -1
- package/compiledScripts/UIColor.js +1 -0
- package/compiledScripts/UIColor.js.map +1 -1
- package/compiledScripts/UICore.d.ts +2 -2
- package/compiledScripts/UICore.js +17 -19
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UICoreExtensionValueObject.js +1 -0
- package/compiledScripts/UICoreExtensionValueObject.js.map +1 -1
- package/compiledScripts/UICoreExtensions.d.ts +7 -14
- package/compiledScripts/UICoreExtensions.js +76 -112
- package/compiledScripts/UICoreExtensions.js.map +3 -3
- package/compiledScripts/UIDateTimeInput.d.ts +2 -1
- package/compiledScripts/UIDateTimeInput.js +3 -2
- package/compiledScripts/UIDateTimeInput.js.map +2 -2
- package/compiledScripts/UIDialogView.d.ts +1 -1
- package/compiledScripts/UIDialogView.js +10 -8
- package/compiledScripts/UIDialogView.js.map +2 -2
- package/compiledScripts/UIImageView.d.ts +4 -4
- package/compiledScripts/UIImageView.js +12 -17
- package/compiledScripts/UIImageView.js.map +2 -2
- package/compiledScripts/UIInterfaces.d.ts +4 -4
- package/compiledScripts/UIInterfaces.js +1 -0
- package/compiledScripts/UIInterfaces.js.map +2 -2
- package/compiledScripts/UIKeyValueStringFilter.d.ts +6 -3
- package/compiledScripts/UIKeyValueStringFilter.js +15 -4
- package/compiledScripts/UIKeyValueStringFilter.js.map +2 -2
- package/compiledScripts/UIKeyValueStringFilterWebWorker.worker.d.ts +1 -1
- package/compiledScripts/UIKeyValueStringFilterWebWorker.worker.js +2 -1
- package/compiledScripts/UIKeyValueStringFilterWebWorker.worker.js.map +2 -2
- package/compiledScripts/UIKeyValueStringSorter.d.ts +4 -1
- package/compiledScripts/UIKeyValueStringSorter.js +14 -3
- package/compiledScripts/UIKeyValueStringSorter.js.map +2 -2
- package/compiledScripts/UIKeyValueStringSorterWebWorker.worker.d.ts +9 -5
- package/compiledScripts/UIKeyValueStringSorterWebWorker.worker.js +20 -23
- package/compiledScripts/UIKeyValueStringSorterWebWorker.worker.js.map +3 -3
- package/compiledScripts/UILayoutGrid.js +1 -0
- package/compiledScripts/UILayoutGrid.js.map +2 -2
- package/compiledScripts/UILink.d.ts +4 -7
- package/compiledScripts/UILink.js +7 -10
- package/compiledScripts/UILink.js.map +2 -2
- package/compiledScripts/UILinkButton.d.ts +1 -5
- package/compiledScripts/UILinkButton.js +5 -13
- package/compiledScripts/UILinkButton.js.map +2 -2
- package/compiledScripts/UINativeScrollView.d.ts +5 -5
- package/compiledScripts/UINativeScrollView.js +7 -6
- package/compiledScripts/UINativeScrollView.js.map +2 -2
- package/compiledScripts/UIObject.d.ts +14 -15
- package/compiledScripts/UIObject.js +20 -30
- package/compiledScripts/UIObject.js.map +2 -2
- package/compiledScripts/UIPoint.d.ts +3 -3
- package/compiledScripts/UIPoint.js +11 -13
- package/compiledScripts/UIPoint.js.map +2 -2
- package/compiledScripts/UIRectangle.d.ts +2 -2
- package/compiledScripts/UIRectangle.js +47 -47
- package/compiledScripts/UIRectangle.js.map +2 -2
- package/compiledScripts/UIRootViewController.d.ts +15 -6
- package/compiledScripts/UIRootViewController.js +40 -31
- package/compiledScripts/UIRootViewController.js.map +2 -2
- package/compiledScripts/UIRoute.js +4 -3
- package/compiledScripts/UIRoute.js.map +3 -3
- package/compiledScripts/UIScrollView.d.ts +2 -2
- package/compiledScripts/UIScrollView.js +11 -10
- package/compiledScripts/UIScrollView.js.map +2 -2
- package/compiledScripts/UISlideScrollerView.d.ts +1 -1
- package/compiledScripts/UISlideScrollerView.js +22 -24
- package/compiledScripts/UISlideScrollerView.js.map +3 -3
- package/compiledScripts/UIStringFilter.d.ts +4 -3
- package/compiledScripts/UIStringFilter.js +16 -9
- package/compiledScripts/UIStringFilter.js.map +2 -2
- package/compiledScripts/UIStringFilterWebWorker.worker.d.ts +2 -2
- package/compiledScripts/UIStringFilterWebWorker.worker.js +11 -12
- package/compiledScripts/UIStringFilterWebWorker.worker.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +13 -10
- package/compiledScripts/UITableView.js +25 -34
- package/compiledScripts/UITableView.js.map +3 -3
- package/compiledScripts/UITextArea.d.ts +1 -3
- package/compiledScripts/UITextArea.js +1 -3
- package/compiledScripts/UITextArea.js.map +2 -2
- package/compiledScripts/UITextField.d.ts +5 -4
- package/compiledScripts/UITextField.js +4 -3
- package/compiledScripts/UITextField.js.map +2 -2
- package/compiledScripts/UITextView.d.ts +3 -3
- package/compiledScripts/UITextView.js +4 -0
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UITimer.js +3 -2
- package/compiledScripts/UITimer.js.map +2 -2
- package/compiledScripts/UIView.d.ts +82 -96
- package/compiledScripts/UIView.js +225 -227
- package/compiledScripts/UIView.js.map +3 -3
- package/compiledScripts/UIViewController.d.ts +2 -1
- package/compiledScripts/UIViewController.js +13 -6
- package/compiledScripts/UIViewController.js.map +2 -2
- package/compiledScripts/index.js +1 -0
- package/compiledScripts/index.js.map +1 -1
- package/package.json +5 -1
- package/scripts/UIBaseButton.ts +53 -109
- package/scripts/UIButton.ts +52 -96
- package/scripts/UICore.ts +46 -61
- package/scripts/UICoreExtensions.ts +176 -239
- package/scripts/UIDateTimeInput.ts +5 -20
- package/scripts/UIDialogView.ts +17 -43
- package/scripts/UIImageView.ts +35 -101
- package/scripts/UIInterfaces.ts +4 -5
- package/scripts/UIKeyValueStringFilter.ts +37 -47
- package/scripts/UIKeyValueStringFilterWebWorker.worker.ts +21 -27
- package/scripts/UIKeyValueStringSorter.ts +77 -98
- package/scripts/UIKeyValueStringSorterWebWorker.worker.ts +28 -67
- package/scripts/UILayoutGrid.ts +0 -9
- package/scripts/UILink.ts +8 -73
- package/scripts/UILinkButton.ts +6 -77
- package/scripts/UINativeScrollView.ts +17 -43
- package/scripts/UIObject.ts +62 -209
- package/scripts/UIPoint.ts +11 -27
- package/scripts/UIRectangle.ts +69 -174
- package/scripts/UIRootViewController.ts +46 -51
- package/scripts/UIRoute.ts +14 -27
- package/scripts/UIScrollView.ts +17 -102
- package/scripts/UISlideScrollerView.ts +50 -102
- package/scripts/UIStringFilter.ts +42 -68
- package/scripts/UIStringFilterWebWorker.worker.ts +11 -34
- package/scripts/UITableView.ts +82 -162
- package/scripts/UITextArea.ts +4 -21
- package/scripts/UITextField.ts +11 -25
- package/scripts/UITextView.ts +7 -56
- package/scripts/UITimer.ts +4 -13
- package/scripts/UIView.ts +494 -862
- package/scripts/UIViewController.ts +18 -30
- package/tsconfig.json +2 -1
- package/compiledScripts/UICoreValues.d.ts +0 -11
- package/compiledScripts/UICoreValues.js +0 -35
- package/compiledScripts/UICoreValues.js.map +0 -7
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/ClientCheckers.ts"],
|
|
4
4
|
"sourcesContent": ["export const IS_FIREFOX = navigator.userAgent.toLowerCase().indexOf(\"firefox\") > -1\nexport const IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,UAAU,UAAU,YAAY,EAAE,QAAQ,SAAS,IAAI;AAC1E,MAAM,YAAY,iCAAiC,KAAK,UAAU,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIActionIndicator.ts"],
|
|
4
4
|
"sourcesContent": ["import { NO, YES } from \"./UIObject\"\nimport { UIView } from \"./UIView\"\n\n\nexport class UIActionIndicator extends UIView {\n \n \n indicatorView: UIView\n \n _size: number = 50\n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this.indicatorView = new UIView(this.elementID + \"IndicatorView\")\n this.indicatorView.viewHTMLElement.classList.add(\"LukeHaasLoader\")\n this.addSubview(this.indicatorView)\n \n this.hidden = YES\n \n }\n \n \n \n \n \n set size(size: number) {\n \n this._size = size\n \n this.setNeedsLayoutUpToRootView()\n \n }\n \n get size() {\n \n return this._size\n \n }\n \n \n \n set hidden(hidden: boolean) {\n \n super.hidden = hidden\n \n if (hidden) {\n \n this.indicatorView.removeFromSuperview()\n \n }\n else {\n \n this.addSubview(this.indicatorView)\n \n }\n \n }\n \n start() {\n \n this.hidden = NO\n \n }\n \n stop() {\n \n this.hidden = YES\n \n }\n \n \n \n layoutSubviews() {\n \n super.layoutSubviews()\n \n const bounds = this.bounds\n \n //this.indicatorView.centerInContainer();\n \n this.indicatorView.style.height = \"\" + this._size.integerValue + \"px\"\n this.indicatorView.style.width = \"\" + this._size.integerValue + \"px\"\n \n const minSize = Math.min(this.bounds.height, this.bounds.width)\n \n this.indicatorView.style.maxHeight = \"\" + minSize.integerValue + \"px\"\n this.indicatorView.style.maxWidth = \"\" + minSize.integerValue + \"px\"\n \n const size = Math.min(this._size, minSize)\n \n this.indicatorView.style.left = \"\" + ((bounds.width - size) * 0.5 - 11).integerValue + \"px\"\n this.indicatorView.style.top = \"\" + ((bounds.height - size) * 0.5 - 11).integerValue + \"px\"\n \n \n \n \n }\n \n \n \n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;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O,OAAO,SAAS,QAAQ,MAAM,IAAI,eAAe;AAAA,EAK3F;AAMJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,10 +4,9 @@ export declare class UIBaseButton extends UIView {
|
|
|
4
4
|
_highlighted: boolean;
|
|
5
5
|
_isPointerInside: boolean;
|
|
6
6
|
_isToggleable: boolean;
|
|
7
|
-
_hovered
|
|
8
|
-
_focused
|
|
9
|
-
constructor(elementID
|
|
10
|
-
initViewStateControl(): void;
|
|
7
|
+
_hovered?: boolean;
|
|
8
|
+
_focused?: boolean;
|
|
9
|
+
constructor(elementID?: string, elementType?: string, initViewData?: any);
|
|
11
10
|
set hovered(hovered: boolean);
|
|
12
11
|
get hovered(): boolean;
|
|
13
12
|
set highlighted(highlighted: boolean);
|
|
@@ -37,11 +36,20 @@ export declare class UIBaseButton extends UIView {
|
|
|
37
36
|
x: number;
|
|
38
37
|
y: number;
|
|
39
38
|
};
|
|
40
|
-
static getElementPositionInDocument(el:
|
|
39
|
+
static getElementPositionInDocument(el: {
|
|
40
|
+
tagName: string;
|
|
41
|
+
offsetLeft: number;
|
|
42
|
+
scrollLeft: number;
|
|
43
|
+
clientLeft: number;
|
|
44
|
+
offsetTop: number;
|
|
45
|
+
scrollTop: number;
|
|
46
|
+
clientTop: number;
|
|
47
|
+
offsetParent: any;
|
|
48
|
+
}): {
|
|
41
49
|
x: number;
|
|
42
50
|
y: number;
|
|
43
51
|
};
|
|
44
|
-
static convertCoordinatesFromDocumentToElement(x:
|
|
52
|
+
static convertCoordinatesFromDocumentToElement(x: number, y: number, element: any): {
|
|
45
53
|
x: number;
|
|
46
54
|
y: number;
|
|
47
55
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -29,67 +30,62 @@ class UIBaseButton extends import_UIView.UIView {
|
|
|
29
30
|
this._selected = import_UIObject.NO;
|
|
30
31
|
this._highlighted = import_UIObject.NO;
|
|
31
32
|
this._isToggleable = import_UIObject.NO;
|
|
32
|
-
this.initViewStateControl();
|
|
33
|
-
}
|
|
34
|
-
initViewStateControl() {
|
|
35
|
-
this.class.superclass = import_UIView.UIView;
|
|
36
33
|
this._isPointerInside = import_UIObject.NO;
|
|
37
|
-
const setHovered =
|
|
34
|
+
const setHovered = () => {
|
|
38
35
|
this.hovered = import_UIObject.YES;
|
|
39
|
-
}
|
|
36
|
+
};
|
|
40
37
|
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.PointerHover, setHovered);
|
|
41
|
-
const setNotHovered =
|
|
38
|
+
const setNotHovered = () => {
|
|
42
39
|
this.hovered = import_UIObject.NO;
|
|
43
|
-
}
|
|
40
|
+
};
|
|
44
41
|
this.addTargetForControlEvents([
|
|
45
42
|
import_UIView.UIView.controlEvent.PointerLeave,
|
|
46
43
|
import_UIView.UIView.controlEvent.PointerCancel,
|
|
47
44
|
import_UIView.UIView.controlEvent.MultipleTouches
|
|
48
45
|
], setNotHovered);
|
|
49
46
|
var highlightingTime;
|
|
50
|
-
const setHighlighted =
|
|
47
|
+
const setHighlighted = () => {
|
|
51
48
|
this.highlighted = import_UIObject.YES;
|
|
52
49
|
highlightingTime = Date.now();
|
|
53
|
-
}
|
|
50
|
+
};
|
|
54
51
|
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.PointerDown, setHighlighted);
|
|
55
52
|
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.PointerEnter, setHighlighted);
|
|
56
|
-
const setNotHighlighted =
|
|
53
|
+
const setNotHighlighted = () => {
|
|
57
54
|
this.highlighted = import_UIObject.NO;
|
|
58
|
-
}
|
|
59
|
-
const setNotHighlightedWithMinimumDuration =
|
|
55
|
+
};
|
|
56
|
+
const setNotHighlightedWithMinimumDuration = () => {
|
|
60
57
|
const minimumDurationInMilliseconds = 50;
|
|
61
58
|
const elapsedTime = Date.now() - highlightingTime;
|
|
62
59
|
if (minimumDurationInMilliseconds < elapsedTime) {
|
|
63
60
|
this.highlighted = import_UIObject.NO;
|
|
64
61
|
} else {
|
|
65
|
-
setTimeout(
|
|
62
|
+
setTimeout(() => {
|
|
66
63
|
this.highlighted = import_UIObject.NO;
|
|
67
|
-
}
|
|
64
|
+
}, minimumDurationInMilliseconds - elapsedTime);
|
|
68
65
|
}
|
|
69
|
-
}
|
|
66
|
+
};
|
|
70
67
|
this.addTargetForControlEvents([
|
|
71
68
|
import_UIView.UIView.controlEvent.PointerLeave,
|
|
72
69
|
import_UIView.UIView.controlEvent.PointerCancel,
|
|
73
70
|
import_UIView.UIView.controlEvent.MultipleTouches
|
|
74
71
|
], setNotHighlighted);
|
|
75
72
|
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.PointerUp, setNotHighlightedWithMinimumDuration);
|
|
76
|
-
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.EnterDown,
|
|
73
|
+
this.addTargetForControlEvent(import_UIView.UIView.controlEvent.EnterDown, () => {
|
|
77
74
|
setHighlighted();
|
|
78
75
|
setNotHighlightedWithMinimumDuration();
|
|
79
76
|
});
|
|
80
77
|
this.addTargetForControlEvent(
|
|
81
78
|
import_UIView.UIView.controlEvent.Focus,
|
|
82
|
-
|
|
79
|
+
(sender, event) => {
|
|
83
80
|
this.focused = import_UIObject.YES;
|
|
84
|
-
}
|
|
81
|
+
}
|
|
85
82
|
);
|
|
86
83
|
this.addTargetForControlEvent(
|
|
87
84
|
import_UIView.UIView.controlEvent.Blur,
|
|
88
|
-
|
|
85
|
+
(sender, event) => {
|
|
89
86
|
this.focused = import_UIObject.NO;
|
|
90
|
-
}
|
|
87
|
+
}
|
|
91
88
|
);
|
|
92
|
-
this.updateContentForCurrentState();
|
|
93
89
|
this.pausesPointerEvents = import_UIObject.YES;
|
|
94
90
|
this.tabIndex = 1;
|
|
95
91
|
this.style.cursor = "pointer";
|
|
@@ -97,18 +93,19 @@ class UIBaseButton extends import_UIView.UIView {
|
|
|
97
93
|
this.addTargetForControlEvents([
|
|
98
94
|
import_UIView.UIView.controlEvent.EnterDown,
|
|
99
95
|
import_UIView.UIView.controlEvent.PointerUpInside
|
|
100
|
-
],
|
|
96
|
+
], () => {
|
|
101
97
|
if (this.isToggleable) {
|
|
102
98
|
this.toggleSelectedState();
|
|
103
99
|
}
|
|
104
|
-
}
|
|
100
|
+
});
|
|
105
101
|
}
|
|
106
102
|
set hovered(hovered) {
|
|
107
103
|
this._hovered = hovered;
|
|
108
104
|
this.updateContentForCurrentState();
|
|
109
105
|
}
|
|
110
106
|
get hovered() {
|
|
111
|
-
|
|
107
|
+
var _a;
|
|
108
|
+
return (_a = this._hovered) != null ? _a : import_UIObject.NO;
|
|
112
109
|
}
|
|
113
110
|
set highlighted(highlighted) {
|
|
114
111
|
this._highlighted = highlighted;
|
|
@@ -127,7 +124,8 @@ class UIBaseButton extends import_UIView.UIView {
|
|
|
127
124
|
this.updateContentForCurrentState();
|
|
128
125
|
}
|
|
129
126
|
get focused() {
|
|
130
|
-
|
|
127
|
+
var _a;
|
|
128
|
+
return (_a = this._focused) != null ? _a : import_UIObject.NO;
|
|
131
129
|
}
|
|
132
130
|
set selected(selected) {
|
|
133
131
|
this._selected = selected;
|
|
@@ -137,7 +135,7 @@ class UIBaseButton extends import_UIView.UIView {
|
|
|
137
135
|
return this._selected;
|
|
138
136
|
}
|
|
139
137
|
updateContentForCurrentState() {
|
|
140
|
-
|
|
138
|
+
let updateFunction = this.updateContentForNormalState;
|
|
141
139
|
if (this.selected && this.highlighted) {
|
|
142
140
|
updateFunction = this.updateContentForSelectedAndHighlightedState;
|
|
143
141
|
} else if (this.selected) {
|
|
@@ -196,6 +194,7 @@ class UIBaseButton extends import_UIView.UIView {
|
|
|
196
194
|
if (event.name == import_UIView.UIView.broadcastEventName.PageDidScroll || event.name == import_UIView.UIView.broadcastEventName.AddedToViewTree) {
|
|
197
195
|
this.hovered = import_UIObject.NO;
|
|
198
196
|
this.highlighted = import_UIObject.NO;
|
|
197
|
+
this.updateContentForCurrentState();
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
200
|
toggleSelectedState() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIBaseButton.ts"],
|
|
4
|
-
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\n\n\n\nexport class UIBaseButton extends UIView {\n \n _selected: boolean = NO\n _highlighted: boolean = NO\n \n _isPointerInside: boolean\n \n \n _isToggleable: boolean = NO\n _hovered: boolean\n _focused: boolean\n \n \n \n \n \n constructor(elementID: string, elementType?: string, initViewData?: any) {\n \n super(elementID, nil, elementType, initViewData)\n \n this.initViewStateControl()\n \n }\n \n \n \n \n \n initViewStateControl() {\n \n this.class.superclass = UIView\n \n // Instance variables\n \n \n this._isPointerInside = NO\n \n \n const setHovered = function () {\n this.hovered = YES\n }.bind(this)\n this.addTargetForControlEvent(UIView.controlEvent.PointerHover, setHovered)\n \n const setNotHovered = function () {\n \n this.hovered = NO\n \n }.bind(this)\n \n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHovered)\n \n \n var highlightingTime\n const setHighlighted = function () {\n this.highlighted = YES\n highlightingTime = Date.now()\n }.bind(this)\n this.addTargetForControlEvent(UIView.controlEvent.PointerDown, setHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerEnter, setHighlighted)\n \n const setNotHighlighted = function () {\n this.highlighted = NO\n }.bind(this)\n const setNotHighlightedWithMinimumDuration = function () {\n const minimumDurationInMilliseconds = 50\n const elapsedTime = Date.now() - highlightingTime\n if (minimumDurationInMilliseconds < elapsedTime) {\n this.highlighted = NO\n }\n else {\n setTimeout(function () {\n this.highlighted = NO\n }.bind(this), minimumDurationInMilliseconds - elapsedTime)\n }\n }.bind(this)\n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerUp, setNotHighlightedWithMinimumDuration)\n \n // Handle enter key press\n this.addTargetForControlEvent(UIView.controlEvent.EnterDown, function () {\n \n setHighlighted()\n setNotHighlightedWithMinimumDuration()\n \n })\n \n \n this.addTargetForControlEvent(\n UIView.controlEvent.Focus,\n function (this: UIBaseButton, sender: UIView, event: Event) {\n \n this.focused = YES\n \n }.bind(this)\n )\n \n this.addTargetForControlEvent(\n UIView.controlEvent.Blur,\n function (this: UIBaseButton, sender: UIView, event: Event) {\n \n this.focused = NO\n \n }.bind(this)\n )\n \n \n this.updateContentForCurrentState()\n \n this.pausesPointerEvents = YES\n this.tabIndex = 1\n \n this.style.cursor = \"pointer\"\n \n //this.style.outline = \"none\";\n \n \n this.nativeSelectionEnabled = NO\n \n \n this.addTargetForControlEvents([\n UIView.controlEvent.EnterDown, UIView.controlEvent.PointerUpInside\n ], function (this: UIBaseButton, sender, event) {\n \n if (this.isToggleable) {\n \n this.toggleSelectedState()\n \n }\n \n }.bind(this))\n \n \n }\n \n \n \n \n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public get focused(): boolean {\n return this._focused\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n \n \n \n updateContentForCurrentState() {\n \n var updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n }\n \n updateContentForNormalState() {\n \n \n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n }\n \n updateContentForHighlightedState() {\n \n \n \n }\n \n updateContentForSelectedState() {\n \n \n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n }\n \n \n set enabled(enabled: boolean) {\n \n super.enabled = enabled\n \n this.updateContentForCurrentEnabledState()\n \n }\n \n get enabled() {\n \n return super.enabled\n \n }\n \n updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n \n addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n \n \n \n didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.PageDidScroll || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this.hovered = NO\n \n this.highlighted = NO\n \n \n }\n \n \n }\n \n \n \n \n \n toggleSelectedState() {\n \n \n this.selected = !this.selected\n \n \n }\n \n set isToggleable(isToggleable: boolean) {\n \n this._isToggleable = isToggleable\n \n }\n \n get isToggleable() {\n \n return this._isToggleable\n \n }\n \n \n \n \n layoutSubviews() {\n \n super.layoutSubviews()\n \n const bounds = this.bounds\n \n \n \n \n }\n \n \n \n \n \n sendControlEventForKey(eventKey: string, nativeEvent: Event) {\n \n if (eventKey == UIView.controlEvent.PointerUpInside && !this.highlighted) {\n \n // Do not send the event in this case\n //super.sendControlEventForKey(eventKey, nativeEvent);\n \n const asd = 1\n \n }\n else {\n \n super.sendControlEventForKey(eventKey, nativeEvent)\n \n }\n \n }\n \n \n \n \n \n static getEventCoordinatesInDocument(touchOrMouseEvent) {\n // http://www.quirksmode.org/js/events_properties.html\n var posx = 0\n var posy = 0\n var e = touchOrMouseEvent\n if (!e) {\n e = window.event\n }\n if (e.pageX || e.pageY) {\n posx = e.pageX\n posy = e.pageY\n }\n else if (e.clientX || e.clientY) {\n posx = e.clientX + document.body.scrollLeft\n + document.documentElement.scrollLeft\n posy = e.clientY + document.body.scrollTop\n + document.documentElement.scrollTop\n }\n // posx and posy contain the mouse position relative to the document\n \n const coordinates = { \"x\": posx, \"y\": posy }\n \n return coordinates\n \n }\n \n \n \n static getElementPositionInDocument(el) {\n //https://www.kirupa.com/html5/getting_mouse_click_position.htm\n var xPosition = 0\n var yPosition = 0\n \n while (el) {\n if (el.tagName == \"BODY\") {\n \n // Coordinates in document are coordinates in body, therefore subtracting the scroll position of the body is not needed\n \n // // deal with browser quirks with body/window/document and page scroll\n // var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft;\n // var yScrollPos = el.scrollTop || document.documentElement.scrollTop;\n //\n // xPosition += (el.offsetLeft - xScrollPos + el.clientLeft);\n // yPosition += (el.offsetTop - yScrollPos + el.clientTop);\n }\n else {\n xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft)\n yPosition += (el.offsetTop - el.scrollTop + el.clientTop)\n }\n \n el = el.offsetParent\n }\n return {\n x: xPosition,\n y: yPosition\n }\n }\n \n static convertCoordinatesFromDocumentToElement(x, y, element) {\n const elementPositionInDocument = this.getElementPositionInDocument(element)\n const coordinatesInElement = { \"x\": x - elementPositionInDocument.x, \"y\": y - elementPositionInDocument.y }\n return coordinatesInElement\n }\n \n static getEventCoordinatesInElement(touchOrMouseEvent, element) {\n const coordinatesInDocument = this.getEventCoordinatesInDocument(touchOrMouseEvent)\n const coordinatesInElement = this.convertCoordinatesFromDocumentToElement(\n coordinatesInDocument.x,\n coordinatesInDocument.y,\n element\n )\n return coordinatesInElement\n }\n \n \n \n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIBaseButton extends UIView {\n \n _selected: boolean = NO\n _highlighted: boolean = NO\n \n _isPointerInside: boolean\n \n \n _isToggleable: boolean = NO\n _hovered?: boolean\n _focused?: boolean\n \n \n constructor(elementID?: string, elementType?: string, initViewData?: any) {\n \n super(elementID, nil, elementType, initViewData)\n \n // Instance variables\n \n \n this._isPointerInside = NO\n \n \n const setHovered = () => {\n this.hovered = YES\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerHover, setHovered)\n \n const setNotHovered = () => {\n \n this.hovered = NO\n \n }\n \n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHovered)\n \n \n var highlightingTime: number\n const setHighlighted = () => {\n this.highlighted = YES\n highlightingTime = Date.now()\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerDown, setHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerEnter, setHighlighted)\n \n const setNotHighlighted = () => {\n this.highlighted = NO\n }\n const setNotHighlightedWithMinimumDuration = () => {\n const minimumDurationInMilliseconds = 50\n const elapsedTime = Date.now() - highlightingTime\n if (minimumDurationInMilliseconds < elapsedTime) {\n this.highlighted = NO\n }\n else {\n setTimeout(() => {\n this.highlighted = NO\n }, minimumDurationInMilliseconds - elapsedTime)\n }\n }\n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerUp, setNotHighlightedWithMinimumDuration)\n \n // Handle enter key press\n this.addTargetForControlEvent(UIView.controlEvent.EnterDown, () => {\n \n setHighlighted()\n setNotHighlightedWithMinimumDuration()\n \n })\n \n \n this.addTargetForControlEvent(\n UIView.controlEvent.Focus,\n (sender: UIView, event: Event) => {\n \n this.focused = YES\n \n }\n )\n \n this.addTargetForControlEvent(\n UIView.controlEvent.Blur,\n (sender: UIView, event: Event) => {\n \n this.focused = NO\n \n }\n )\n \n \n this.pausesPointerEvents = YES\n this.tabIndex = 1\n \n this.style.cursor = \"pointer\"\n \n //this.style.outline = \"none\";\n \n \n this.nativeSelectionEnabled = NO\n \n \n this.addTargetForControlEvents([\n UIView.controlEvent.EnterDown, UIView.controlEvent.PointerUpInside\n ], () => {\n \n if (this.isToggleable) {\n \n this.toggleSelectedState()\n \n }\n \n })\n \n }\n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public get focused(): boolean {\n return this._focused ?? NO\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n updateContentForCurrentState() {\n \n let updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n }\n \n updateContentForNormalState() {\n \n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n }\n \n updateContentForHighlightedState() {\n \n \n }\n \n updateContentForSelectedState() {\n \n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n }\n \n \n set enabled(enabled: boolean) {\n super.enabled = enabled\n this.updateContentForCurrentEnabledState()\n }\n \n get enabled() {\n return super.enabled\n }\n \n updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.PageDidScroll || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this.hovered = NO\n \n this.highlighted = NO\n \n this.updateContentForCurrentState()\n \n }\n \n \n }\n \n \n toggleSelectedState() {\n \n \n this.selected = !this.selected\n \n \n }\n \n set isToggleable(isToggleable: boolean) {\n \n this._isToggleable = isToggleable\n \n }\n \n get isToggleable() {\n \n return this._isToggleable\n \n }\n \n \n layoutSubviews() {\n \n super.layoutSubviews()\n \n const bounds = this.bounds\n \n \n }\n \n \n sendControlEventForKey(eventKey: string, nativeEvent: Event) {\n \n if (eventKey == UIView.controlEvent.PointerUpInside && !this.highlighted) {\n \n // Do not send the event in this case\n //super.sendControlEventForKey(eventKey, nativeEvent);\n \n const asd = 1\n \n }\n else {\n \n super.sendControlEventForKey(eventKey, nativeEvent)\n \n }\n \n }\n \n \n static getEventCoordinatesInDocument(touchOrMouseEvent: any) {\n // http://www.quirksmode.org/js/events_properties.html\n var posx = 0\n var posy = 0\n var e = touchOrMouseEvent\n if (!e) {\n e = window.event\n }\n if (e.pageX || e.pageY) {\n posx = e.pageX\n posy = e.pageY\n }\n else if (e.clientX || e.clientY) {\n posx = e.clientX + document.body.scrollLeft\n + document.documentElement.scrollLeft\n posy = e.clientY + document.body.scrollTop\n + document.documentElement.scrollTop\n }\n // posx and posy contain the mouse position relative to the document\n \n const coordinates = { \"x\": posx, \"y\": posy }\n \n return coordinates\n \n }\n \n \n static getElementPositionInDocument(el: { tagName: string; offsetLeft: number; scrollLeft: number; clientLeft: number; offsetTop: number; scrollTop: number; clientTop: number; offsetParent: any }) {\n //https://www.kirupa.com/html5/getting_mouse_click_position.htm\n var xPosition = 0\n var yPosition = 0\n \n while (el) {\n if (el.tagName == \"BODY\") {\n \n // Coordinates in document are coordinates in body, therefore subtracting the scroll position of the body is not needed\n \n // // deal with browser quirks with body/window/document and page scroll\n // var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft;\n // var yScrollPos = el.scrollTop || document.documentElement.scrollTop;\n //\n // xPosition += (el.offsetLeft - xScrollPos + el.clientLeft);\n // yPosition += (el.offsetTop - yScrollPos + el.clientTop);\n }\n else {\n xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft)\n yPosition += (el.offsetTop - el.scrollTop + el.clientTop)\n }\n \n el = el.offsetParent\n }\n return {\n x: xPosition,\n y: yPosition\n }\n }\n \n static convertCoordinatesFromDocumentToElement(x: number, y: number, element: any) {\n const elementPositionInDocument = this.getElementPositionInDocument(element)\n const coordinatesInElement = { \"x\": x - elementPositionInDocument.x, \"y\": y - elementPositionInDocument.y }\n return coordinatesInElement\n }\n \n static getEventCoordinatesInElement(touchOrMouseEvent: any, element: any) {\n const coordinatesInDocument = this.getEventCoordinatesInDocument(touchOrMouseEvent)\n const coordinatesInElement = this.convertCoordinatesFromDocumentToElement(\n coordinatesInDocument.x,\n coordinatesInDocument.y,\n element\n )\n return coordinatesInElement\n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,sBAAiC;AACjC,oBAA6C;AAGtC,MAAM,qBAAqB,qBAAO;AAAA,EAarC,YAAY,WAAoB,aAAsB,cAAoB;AAEtE,UAAM,WAAW,qBAAK,aAAa,YAAY;AAbnD,qBAAqB;AACrB,wBAAwB;AAKxB,yBAAyB;AAYrB,SAAK,mBAAmB;AAGxB,UAAM,aAAa,MAAM;AACrB,WAAK,UAAU;AAAA,IACnB;AACA,SAAK,yBAAyB,qBAAO,aAAa,cAAc,UAAU;AAE1E,UAAM,gBAAgB,MAAM;AAExB,WAAK,UAAU;AAAA,IAEnB;AAEA,SAAK,0BAA0B;AAAA,MAC3B,qBAAO,aAAa;AAAA,MAAc,qBAAO,aAAa;AAAA,MAAe,qBAAO,aAAa;AAAA,IAC7F,GAAG,aAAa;AAGhB,QAAI;AACJ,UAAM,iBAAiB,MAAM;AACzB,WAAK,cAAc;AACnB,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19 +15,16 @@ export interface UIButtonElementColorSpecifier {
|
|
|
15
15
|
selectedAndHighlighted?: UIColor;
|
|
16
16
|
}
|
|
17
17
|
export declare class UIButton extends UIBaseButton {
|
|
18
|
-
_contentPadding:
|
|
19
|
-
_titleLabel
|
|
18
|
+
_contentPadding: number;
|
|
19
|
+
_titleLabel?: UITextView;
|
|
20
20
|
_imageView: UIImageView;
|
|
21
21
|
usesAutomaticTitleFontSize: boolean;
|
|
22
22
|
minAutomaticFontSize: number;
|
|
23
23
|
maxAutomaticFontSize: number;
|
|
24
24
|
colors: UIButtonColorSpecifier;
|
|
25
|
-
constructor(elementID
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}): void;
|
|
29
|
-
get contentPadding(): any;
|
|
30
|
-
set contentPadding(contentPadding: any);
|
|
25
|
+
constructor(elementID?: string, elementType?: string, titleType?: string);
|
|
26
|
+
get contentPadding(): number;
|
|
27
|
+
set contentPadding(contentPadding: number);
|
|
31
28
|
set hovered(hovered: boolean);
|
|
32
29
|
get hovered(): boolean;
|
|
33
30
|
set highlighted(highlighted: boolean);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -29,12 +30,10 @@ var import_UITextView = require("./UITextView");
|
|
|
29
30
|
class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
30
31
|
constructor(elementID, elementType, titleType = import_UITextView.UITextView.type.span) {
|
|
31
32
|
super(elementID, elementType, { "titleType": titleType });
|
|
33
|
+
this._contentPadding = 0;
|
|
32
34
|
this.usesAutomaticTitleFontSize = import_UIObject.NO;
|
|
33
35
|
this.minAutomaticFontSize = import_UIObject.nil;
|
|
34
36
|
this.maxAutomaticFontSize = 25;
|
|
35
|
-
}
|
|
36
|
-
initView(elementID, viewHTMLElement, initViewData) {
|
|
37
|
-
this.class.superclass = import_UIBaseButton.UIBaseButton;
|
|
38
37
|
this.colors = {
|
|
39
38
|
titleLabel: {
|
|
40
39
|
normal: import_UIColor.UIColor.whiteColor,
|
|
@@ -51,8 +50,8 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
51
50
|
this._imageView.hidden = import_UIObject.YES;
|
|
52
51
|
this.addSubview(this.imageView);
|
|
53
52
|
this.imageView.fillMode = import_UIImageView.UIImageView.fillMode.aspectFitIfLarger;
|
|
54
|
-
if ((0, import_UIObject.IS_NOT_NIL)(
|
|
55
|
-
this._titleLabel = new import_UITextView.UITextView(elementID + "TitleLabel",
|
|
53
|
+
if ((0, import_UIObject.IS_NOT_NIL)(titleType)) {
|
|
54
|
+
this._titleLabel = new import_UITextView.UITextView(elementID + "TitleLabel", titleType);
|
|
56
55
|
this.titleLabel.style.whiteSpace = "nowrap";
|
|
57
56
|
this.addSubview(this.titleLabel);
|
|
58
57
|
this.titleLabel.userInteractionEnabled = import_UIObject.NO;
|
|
@@ -74,7 +73,8 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
74
73
|
this.updateContentForCurrentState();
|
|
75
74
|
}
|
|
76
75
|
get hovered() {
|
|
77
|
-
|
|
76
|
+
var _a;
|
|
77
|
+
return (_a = this._hovered) != null ? _a : import_UIObject.NO;
|
|
78
78
|
}
|
|
79
79
|
set highlighted(highlighted) {
|
|
80
80
|
this._highlighted = highlighted;
|
|
@@ -93,7 +93,8 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
93
93
|
this.updateContentForCurrentState();
|
|
94
94
|
}
|
|
95
95
|
get focused() {
|
|
96
|
-
|
|
96
|
+
var _a;
|
|
97
|
+
return (_a = this._focused) != null ? _a : import_UIObject.NO;
|
|
97
98
|
}
|
|
98
99
|
set selected(selected) {
|
|
99
100
|
this._selected = selected;
|
|
@@ -103,7 +104,7 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
103
104
|
return this._selected;
|
|
104
105
|
}
|
|
105
106
|
updateContentForCurrentState() {
|
|
106
|
-
|
|
107
|
+
let updateFunction = this.updateContentForNormalState;
|
|
107
108
|
if (this.selected && this.highlighted) {
|
|
108
109
|
updateFunction = this.updateContentForSelectedAndHighlightedState;
|
|
109
110
|
} else if (this.selected) {
|
|
@@ -184,27 +185,27 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
get titleLabel() {
|
|
187
|
-
|
|
188
|
+
var _a;
|
|
189
|
+
return (_a = this._titleLabel) != null ? _a : import_UIObject.nil;
|
|
188
190
|
}
|
|
189
191
|
get imageView() {
|
|
190
192
|
return this._imageView;
|
|
191
193
|
}
|
|
192
194
|
layoutSubviews() {
|
|
193
195
|
super.layoutSubviews();
|
|
194
|
-
|
|
196
|
+
let bounds = this.bounds;
|
|
195
197
|
this.hoverText = this.titleLabel.text;
|
|
196
198
|
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && !(0, import_UIObject.IS)(this.titleLabel.text)) {
|
|
197
199
|
this.imageView.frame = bounds;
|
|
198
200
|
}
|
|
199
201
|
if ((0, import_UIObject.IS)(this.imageView.hidden) && (0, import_UIObject.IS)(this.titleLabel.text)) {
|
|
200
|
-
|
|
201
|
-
this.titleLabel.style.
|
|
202
|
-
this.titleLabel.style.right = this.contentPadding;
|
|
202
|
+
this.titleLabel.style.left = this.contentPadding + "px";
|
|
203
|
+
this.titleLabel.style.right = this.contentPadding + "px";
|
|
203
204
|
this.titleLabel.style.top = "50%";
|
|
204
205
|
this.titleLabel.style.transform = "translateY(-50%)";
|
|
205
206
|
this.titleLabel.frame = new import_UIRectangle.UIRectangle(import_UIObject.nil, import_UIObject.nil, import_UIObject.nil, import_UIObject.nil);
|
|
206
207
|
if (this.usesAutomaticTitleFontSize) {
|
|
207
|
-
|
|
208
|
+
const hidden = this.titleLabel.hidden;
|
|
208
209
|
this.titleLabel.hidden = import_UIObject.YES;
|
|
209
210
|
this.titleLabel.fontSize = 15;
|
|
210
211
|
this.titleLabel.fontSize = import_UITextView.UITextView.automaticallyCalculatedFontSize(
|
|
@@ -212,7 +213,7 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
212
213
|
0,
|
|
213
214
|
0,
|
|
214
215
|
this.bounds.height,
|
|
215
|
-
|
|
216
|
+
this.titleLabel.viewHTMLElement.offsetWidth
|
|
216
217
|
),
|
|
217
218
|
this.titleLabel.intrinsicContentSize(),
|
|
218
219
|
this.titleLabel.fontSize,
|
|
@@ -223,18 +224,16 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && (0, import_UIObject.IS)(this.titleLabel.text)) {
|
|
226
|
-
const imageShareOfWidth = 0.25;
|
|
227
227
|
bounds = bounds.rectangleWithInset(this.contentPadding);
|
|
228
228
|
const imageFrame = bounds.copy();
|
|
229
229
|
imageFrame.width = bounds.height - this.contentPadding * 0.5;
|
|
230
230
|
this.imageView.frame = imageFrame;
|
|
231
|
-
|
|
232
|
-
this.titleLabel.style.
|
|
233
|
-
this.titleLabel.style.right = this.contentPadding;
|
|
231
|
+
this.titleLabel.style.left = imageFrame.max.x + this.contentPadding + "px";
|
|
232
|
+
this.titleLabel.style.right = this.contentPadding + "px";
|
|
234
233
|
this.titleLabel.style.top = "50%";
|
|
235
234
|
this.titleLabel.style.transform = "translateY(-50%)";
|
|
236
235
|
if (this.usesAutomaticTitleFontSize) {
|
|
237
|
-
|
|
236
|
+
const hidden = this.titleLabel.hidden;
|
|
238
237
|
this.titleLabel.hidden = import_UIObject.YES;
|
|
239
238
|
this.titleLabel.fontSize = 15;
|
|
240
239
|
this.titleLabel.fontSize = import_UITextView.UITextView.automaticallyCalculatedFontSize(
|
|
@@ -242,7 +241,7 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
242
241
|
0,
|
|
243
242
|
0,
|
|
244
243
|
this.bounds.height,
|
|
245
|
-
|
|
244
|
+
this.titleLabel.viewHTMLElement.offsetWidth
|
|
246
245
|
),
|
|
247
246
|
this.titleLabel.intrinsicContentSize(),
|
|
248
247
|
this.titleLabel.fontSize,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIButton.ts"],
|
|
4
|
-
"sourcesContent": ["\nimport { UIBaseButton } from \"./UIBaseButton\"\nimport { UIColor } from \"./UIColor\"\nimport { UIImageView } from \"./UIImageView\"\nimport { IS, IS_NOT, IS_NOT_NIL, nil, NO, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UITextView } from \"./UITextView\"\n\n\nexport interface UIButtonColorSpecifier {\n \n titleLabel: UIButtonElementColorSpecifier;\n background: UIButtonElementColorSpecifier;\n \n}\n\n\nexport interface UIButtonElementColorSpecifier {\n \n normal: UIColor;\n hovered?: UIColor;\n highlighted: UIColor;\n focused?: UIColor;\n selected: UIColor;\n selectedAndHighlighted?: UIColor;\n \n}\n\n\n\nexport class UIButton extends UIBaseButton {\n \n _contentPadding: any\n _titleLabel: UITextView\n _imageView: UIImageView\n \n usesAutomaticTitleFontSize = NO\n minAutomaticFontSize: number = nil\n maxAutomaticFontSize: number = 25\n \n colors: UIButtonColorSpecifier\n \n \n constructor(elementID: string, elementType?: string, titleType = UITextView.type.span) {\n \n super(elementID, elementType, { \"titleType\": titleType })\n \n }\n \n \n \n \n \n initView(elementID, viewHTMLElement, initViewData: { titleType: string }) {\n \n this.class.superclass = UIBaseButton\n \n // Instance variables\n \n this.colors = {\n \n titleLabel: {\n \n normal: UIColor.whiteColor,\n highlighted: UIColor.whiteColor,\n selected: UIColor.whiteColor\n \n },\n \n background: {\n \n normal: UIColor.blueColor,\n highlighted: UIColor.greenColor,\n selected: UIColor.redColor\n \n }\n \n }\n \n \n this._imageView = new UIImageView(elementID + \"ImageView\")\n this._imageView.hidden = YES\n this.addSubview(this.imageView)\n \n this.imageView.fillMode = UIImageView.fillMode.aspectFitIfLarger\n \n \n if (IS_NOT_NIL(initViewData.titleType)) {\n \n this._titleLabel = new UITextView(elementID + \"TitleLabel\", initViewData.titleType)\n this.titleLabel.style.whiteSpace = \"nowrap\"\n this.addSubview(this.titleLabel)\n \n this.titleLabel.userInteractionEnabled = NO\n \n }\n \n this.contentPadding = 10\n \n this.imageView.userInteractionEnabled = NO\n this.titleLabel.textAlignment = UITextView.textAlignment.center\n this.titleLabel.nativeSelectionEnabled = NO\n \n }\n \n \n \n get contentPadding() {\n \n return this._contentPadding.integerValue\n \n }\n \n set contentPadding(contentPadding) {\n \n this._contentPadding = contentPadding\n \n this.setNeedsLayout()\n \n }\n \n \n \n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public get focused(): boolean {\n return this._focused\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n \n \n \n updateContentForCurrentState() {\n \n var updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n this.titleLabel.textColor = UIColor.nilColor\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n this.updateContentForCurrentEnabledState();\n \n }\n \n updateContentForNormalState() {\n \n this.backgroundColor = this.colors.background.normal\n this.titleLabel.textColor = this.colors.titleLabel.normal\n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n if (this.colors.background.hovered) {\n this.backgroundColor = this.colors.background.hovered\n }\n \n if (this.colors.titleLabel.hovered) {\n this.titleLabel.textColor = this.colors.titleLabel.hovered\n }\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n if (this.colors.background.focused) {\n this.backgroundColor = this.colors.background.focused\n }\n \n if (this.colors.titleLabel.focused) {\n this.titleLabel.textColor = this.colors.titleLabel.focused\n }\n \n }\n \n updateContentForHighlightedState() {\n \n this.backgroundColor = this.colors.background.highlighted\n this.titleLabel.textColor = this.colors.titleLabel.highlighted\n \n }\n \n updateContentForSelectedState() {\n \n this.backgroundColor = this.colors.background.selected\n this.titleLabel.textColor = this.colors.titleLabel.selected\n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n if (this.colors.background.selectedAndHighlighted) {\n this.backgroundColor = this.colors.background.selectedAndHighlighted\n }\n \n if (this.colors.titleLabel.selectedAndHighlighted) {\n this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted\n }\n \n }\n \n \n set enabled(enabled: boolean) {\n \n // @ts-ignore\n super.enabled = enabled\n \n this.updateContentForCurrentState()\n \n }\n \n get enabled() {\n \n // @ts-ignore\n return super.enabled\n \n }\n \n updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n \n addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n get titleLabel() {\n \n return this._titleLabel\n \n }\n \n get imageView() {\n \n return this._imageView\n \n }\n \n \n \n \n \n layoutSubviews() {\n \n super.layoutSubviews()\n \n var bounds = this.bounds\n \n this.hoverText = this.titleLabel.text\n \n // Image only if text is not present\n if (IS_NOT(this.imageView.hidden) && !IS(this.titleLabel.text)) {\n \n \n this.imageView.frame = bounds\n \n \n }\n \n // Text only if image is not present\n if (IS(this.imageView.hidden) && IS(this.titleLabel.text)) {\n \n var titleElement = this.titleLabel.viewHTMLElement\n \n \n this.titleLabel.style.left = this.contentPadding\n this.titleLabel.style.right = this.contentPadding\n // this.titleLabel.style.marginLeft = \"\"\n // this.titleLabel.style.right = this.contentPadding\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n this.titleLabel.frame = new UIRectangle(nil, nil, nil, nil)\n \n if (this.usesAutomaticTitleFontSize) {\n \n var hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n 1 *\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n \n }\n \n // Image and text both present\n if (IS_NOT(this.imageView.hidden) && IS(this.titleLabel.text)) {\n \n const imageShareOfWidth = 0.25\n \n bounds = bounds.rectangleWithInset(this.contentPadding)\n \n const imageFrame = bounds.copy()\n imageFrame.width = bounds.height - this.contentPadding * 0.5\n this.imageView.frame = imageFrame\n \n var titleElement = this.titleLabel.viewHTMLElement\n \n this.titleLabel.style.left = imageFrame.max.x + this.contentPadding\n this.titleLabel.style.right = this.contentPadding\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n \n if (this.usesAutomaticTitleFontSize) {\n \n var hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n 1 *\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n }\n \n this.applyClassesAndStyles()\n \n }\n \n initViewStyleSelectors() {\n \n this.initStyleSelector(\".\" + this.styleClassName, \"background-color: lightblue;\")\n \n // var selectorWithoutImage = \".\" + this.styleClassName + \" .\" + this.imageView.styleClassName + \" + .\" + this.titleLabel.styleClassName;\n \n // this.initStyleSelector(\n // selectorWithoutImage,\n // \"left: \" + this.contentPadding + \";\" +\n // \"right: \" + this.contentPadding + \";\" +\n // \"top: 50%;\" +\n // \"transform: translateY(-50%);\");\n \n }\n \n \n \n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { UIBaseButton } from \"./UIBaseButton\"\nimport { UIColor } from \"./UIColor\"\nimport { UIImageView } from \"./UIImageView\"\nimport { IS, IS_NOT, IS_NOT_NIL, nil, NO, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UITextView } from \"./UITextView\"\n\n\nexport interface UIButtonColorSpecifier {\n \n titleLabel: UIButtonElementColorSpecifier;\n background: UIButtonElementColorSpecifier;\n \n}\n\n\nexport interface UIButtonElementColorSpecifier {\n \n normal: UIColor;\n hovered?: UIColor;\n highlighted: UIColor;\n focused?: UIColor;\n selected: UIColor;\n selectedAndHighlighted?: UIColor;\n \n}\n\n\nexport class UIButton extends UIBaseButton {\n \n _contentPadding = 0\n _titleLabel?: UITextView\n _imageView: UIImageView\n \n usesAutomaticTitleFontSize = NO\n minAutomaticFontSize: number = nil\n maxAutomaticFontSize: number = 25\n \n colors: UIButtonColorSpecifier = {\n \n titleLabel: {\n \n normal: UIColor.whiteColor,\n highlighted: UIColor.whiteColor,\n selected: UIColor.whiteColor\n \n },\n \n background: {\n \n normal: UIColor.blueColor,\n highlighted: UIColor.greenColor,\n selected: UIColor.redColor\n \n }\n \n }\n \n \n constructor(elementID?: string, elementType?: string, titleType = UITextView.type.span) {\n \n super(elementID, elementType, { \"titleType\": titleType })\n \n // Instance variables\n \n this._imageView = new UIImageView(elementID + \"ImageView\")\n this._imageView.hidden = YES\n this.addSubview(this.imageView)\n \n this.imageView.fillMode = UIImageView.fillMode.aspectFitIfLarger\n \n \n if (IS_NOT_NIL(titleType)) {\n \n this._titleLabel = new UITextView(elementID + \"TitleLabel\", titleType)\n this.titleLabel.style.whiteSpace = \"nowrap\"\n this.addSubview(this.titleLabel)\n \n this.titleLabel.userInteractionEnabled = NO\n \n }\n \n this.contentPadding = 10\n \n this.imageView.userInteractionEnabled = NO\n this.titleLabel.textAlignment = UITextView.textAlignment.center\n this.titleLabel.nativeSelectionEnabled = NO\n \n }\n \n \n get contentPadding() {\n return this._contentPadding.integerValue\n }\n \n set contentPadding(contentPadding) {\n this._contentPadding = contentPadding\n this.setNeedsLayout()\n }\n \n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public get focused(): boolean {\n return this._focused ?? NO\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n updateContentForCurrentState() {\n \n let updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n this.titleLabel.textColor = UIColor.nilColor\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n this.updateContentForCurrentEnabledState()\n \n }\n \n updateContentForNormalState() {\n \n this.backgroundColor = this.colors.background.normal\n this.titleLabel.textColor = this.colors.titleLabel.normal\n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n if (this.colors.background.hovered) {\n this.backgroundColor = this.colors.background.hovered\n }\n \n if (this.colors.titleLabel.hovered) {\n this.titleLabel.textColor = this.colors.titleLabel.hovered\n }\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n if (this.colors.background.focused) {\n this.backgroundColor = this.colors.background.focused\n }\n \n if (this.colors.titleLabel.focused) {\n this.titleLabel.textColor = this.colors.titleLabel.focused\n }\n \n }\n \n updateContentForHighlightedState() {\n \n this.backgroundColor = this.colors.background.highlighted\n this.titleLabel.textColor = this.colors.titleLabel.highlighted\n \n }\n \n updateContentForSelectedState() {\n \n this.backgroundColor = this.colors.background.selected\n this.titleLabel.textColor = this.colors.titleLabel.selected\n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n if (this.colors.background.selectedAndHighlighted) {\n this.backgroundColor = this.colors.background.selectedAndHighlighted\n }\n \n if (this.colors.titleLabel.selectedAndHighlighted) {\n this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted\n }\n \n }\n \n \n set enabled(enabled: boolean) {\n \n // @ts-ignore\n super.enabled = enabled\n \n this.updateContentForCurrentState()\n \n }\n \n get enabled() {\n \n // @ts-ignore\n return super.enabled\n \n }\n \n updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n get titleLabel(): UITextView {\n return this._titleLabel ?? nil\n }\n \n get imageView() {\n \n return this._imageView\n \n }\n \n \n layoutSubviews() {\n \n super.layoutSubviews()\n \n let bounds = this.bounds\n \n this.hoverText = this.titleLabel.text\n \n // Image only if text is not present\n if (IS_NOT(this.imageView.hidden) && !IS(this.titleLabel.text)) {\n \n this.imageView.frame = bounds\n \n }\n \n // Text only if image is not present\n if (IS(this.imageView.hidden) && IS(this.titleLabel.text)) {\n \n this.titleLabel.style.left = this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n // this.titleLabel.style.marginLeft = \"\"\n // this.titleLabel.style.right = this.contentPadding\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n this.titleLabel.frame = new UIRectangle(nil, nil, nil, nil)\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n \n }\n \n // Image and text both present\n if (IS_NOT(this.imageView.hidden) && IS(this.titleLabel.text)) {\n \n //const imageShareOfWidth = 0.25\n \n bounds = bounds.rectangleWithInset(this.contentPadding)\n \n const imageFrame = bounds.copy()\n imageFrame.width = bounds.height - this.contentPadding * 0.5\n this.imageView.frame = imageFrame\n \n this.titleLabel.style.left = imageFrame.max.x + this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n }\n \n this.applyClassesAndStyles()\n \n }\n \n initViewStyleSelectors() {\n \n this.initStyleSelector(\".\" + this.styleClassName, \"background-color: lightblue;\")\n \n // var selectorWithoutImage = \".\" + this.styleClassName + \" .\" + this.imageView.styleClassName + \" + .\" + this.titleLabel.styleClassName;\n \n // this.initStyleSelector(\n // selectorWithoutImage,\n // \"left: \" + this.contentPadding + \";\" +\n // \"right: \" + this.contentPadding + \";\" +\n // \"top: 50%;\" +\n // \"transform: translateY(-50%);\");\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;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AM,SAAK,oBAAG,KAAK,WAAW,IAAI,GAAG;AAI3D,eAAS,OAAO,mBAAmB,KAAK,cAAc;AAEtD,YAAM,aAAa,OAAO,KAAK;AAC/B,iBAAW,QAAQ,OAAO,SAAS,KAAK,iBAAiB;AACzD,WAAK,UAAU,QAAQ;AAEvB,WAAK,WAAW,MAAM,OAAO,WAAW,IAAI,IAAI,KAAK,iBAAiB;AACtE,WAAK,WAAW,MAAM,QAAQ,KAAK,iBAAiB;AACpD,WAAK,WAAW,MAAM,MAAM;AAC5B,WAAK,WAAW,MAAM,YAAY;AAElC,UAAI,KAAK,4BAA4B;AAEjC,cAAM,SAAS,KAAK,WAAW;AAE/B,aAAK,WAAW,SAAS;AAEzB,aAAK,WAAW,WAAW;AAE3B,aAAK,WAAW,WAAW,6BAAW;AAAA,UAClC,IAAI;AAAA,YACA;AAAA,YACA;AAAA,YACA,KAAK,OAAO;AAAA,YACZ,KAAK,WAAW,gBAAgB;AAAA,UACpC;AAAA,UACA,KAAK,WAAW,qBAAqB;AAAA,UACrC,KAAK,WAAW;AAAA,UAChB,KAAK;AAAA,UACL,KAAK;AAAA,QACT;AAEA,aAAK,WAAW,SAAS;AAAA,MAE7B;AAAA,IAEJ;AAEA,SAAK,sBAAsB;AAAA,EAE/B;AAAA,EAEA,yBAAyB;AAErB,SAAK,kBAAkB,MAAM,KAAK,gBAAgB,8BAA8B;AAAA,EAWpF;AAGJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,7 +21,7 @@ export declare class UIColor extends UIObject {
|
|
|
21
21
|
static get transparentColor(): UIColor;
|
|
22
22
|
static get undefinedColor(): UIColor;
|
|
23
23
|
static get nilColor(): UIColor;
|
|
24
|
-
static nameToHex(name: string): string;
|
|
24
|
+
static nameToHex(name: string): string | undefined;
|
|
25
25
|
static hexToDescriptor(c: string): UIColorDescriptor;
|
|
26
26
|
static rgbToDescriptor(colorString: string): {
|
|
27
27
|
red: number;
|