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,44 @@
|
|
|
1
|
+
import { UITextView } from "./UITextView";
|
|
2
|
+
import { UIView, UIViewAddControlEventTargetObject, UIViewBroadcastEvent } from "./UIView";
|
|
3
|
+
export declare class UITextField extends UITextView {
|
|
4
|
+
_placeholderTextKey: string;
|
|
5
|
+
_defaultPlaceholderText: string;
|
|
6
|
+
_viewHTMLElement: HTMLInputElement;
|
|
7
|
+
constructor(elementID?: string, viewHTMLElement?: any, type?: string);
|
|
8
|
+
static controlEvent: {
|
|
9
|
+
PointerDown: string;
|
|
10
|
+
PointerMove: string;
|
|
11
|
+
PointerLeave: string;
|
|
12
|
+
PointerEnter: string;
|
|
13
|
+
PointerUpInside: string;
|
|
14
|
+
PointerTap: string;
|
|
15
|
+
PointerUp: string;
|
|
16
|
+
MultipleTouches: string;
|
|
17
|
+
PointerCancel: string;
|
|
18
|
+
PointerHover: string;
|
|
19
|
+
EnterDown: string;
|
|
20
|
+
EnterUp: string;
|
|
21
|
+
EscDown: string;
|
|
22
|
+
TabDown: string;
|
|
23
|
+
LeftArrowDown: string;
|
|
24
|
+
RightArrowDown: string;
|
|
25
|
+
DownArrowDown: string;
|
|
26
|
+
UpArrowDown: string;
|
|
27
|
+
Focus: string;
|
|
28
|
+
Blur: string;
|
|
29
|
+
} & {
|
|
30
|
+
TextChange: string;
|
|
31
|
+
};
|
|
32
|
+
get addControlEventTarget(): UIViewAddControlEventTargetObject<typeof UITextField.controlEvent>;
|
|
33
|
+
get viewHTMLElement(): HTMLInputElement;
|
|
34
|
+
set text(text: string);
|
|
35
|
+
get text(): string;
|
|
36
|
+
set placeholderText(text: string);
|
|
37
|
+
get placeholderText(): string;
|
|
38
|
+
setPlaceholderText(key: string, defaultString: string): void;
|
|
39
|
+
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
|
|
40
|
+
willMoveToSuperview(superview: UIView): void;
|
|
41
|
+
_setPlaceholderFromKeyIfPossible(): void;
|
|
42
|
+
get isSecure(): boolean;
|
|
43
|
+
set isSecure(secure: boolean);
|
|
44
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UITextField = void 0;
|
|
4
|
+
const UIColor_1 = require("./UIColor");
|
|
5
|
+
const UICore_1 = require("./UICore");
|
|
6
|
+
const UIObject_1 = require("./UIObject");
|
|
7
|
+
const UITextView_1 = require("./UITextView");
|
|
8
|
+
const UIView_1 = require("./UIView");
|
|
9
|
+
class UITextField extends UITextView_1.UITextView {
|
|
10
|
+
constructor(elementID, viewHTMLElement = null, type = UITextView_1.UITextView.type.textField) {
|
|
11
|
+
super(elementID, type, viewHTMLElement);
|
|
12
|
+
this._class = UITextField;
|
|
13
|
+
this.superclass = UITextView_1.UITextView;
|
|
14
|
+
this.viewHTMLElement.setAttribute("type", "text");
|
|
15
|
+
this.backgroundColor = UIColor_1.UIColor.whiteColor;
|
|
16
|
+
this.addTargetForControlEvent(UIView_1.UIView.controlEvent.PointerUpInside, function (sender, event) {
|
|
17
|
+
sender.focus();
|
|
18
|
+
});
|
|
19
|
+
this.viewHTMLElement.oninput = (event) => {
|
|
20
|
+
this.sendControlEventForKey(UITextField.controlEvent.TextChange, event);
|
|
21
|
+
};
|
|
22
|
+
this.style.webkitUserSelect = "text";
|
|
23
|
+
this.nativeSelectionEnabled = UIObject_1.YES;
|
|
24
|
+
this.pausesPointerEvents = UIObject_1.NO;
|
|
25
|
+
}
|
|
26
|
+
get addControlEventTarget() {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
return super.addControlEventTarget;
|
|
29
|
+
}
|
|
30
|
+
get viewHTMLElement() {
|
|
31
|
+
return this._viewHTMLElement;
|
|
32
|
+
}
|
|
33
|
+
set text(text) {
|
|
34
|
+
this.viewHTMLElement.value = text;
|
|
35
|
+
}
|
|
36
|
+
get text() {
|
|
37
|
+
return this.viewHTMLElement.value;
|
|
38
|
+
}
|
|
39
|
+
set placeholderText(text) {
|
|
40
|
+
this.viewHTMLElement.placeholder = text;
|
|
41
|
+
}
|
|
42
|
+
get placeholderText() {
|
|
43
|
+
return this.viewHTMLElement.placeholder;
|
|
44
|
+
}
|
|
45
|
+
setPlaceholderText(key, defaultString) {
|
|
46
|
+
this._placeholderTextKey = key;
|
|
47
|
+
this._defaultPlaceholderText = defaultString;
|
|
48
|
+
const languageName = UICore_1.UICore.languageService.currentLanguageKey;
|
|
49
|
+
this.placeholderText = UICore_1.UICore.languageService.stringForKey(key, languageName, defaultString, UIObject_1.nil);
|
|
50
|
+
}
|
|
51
|
+
didReceiveBroadcastEvent(event) {
|
|
52
|
+
super.didReceiveBroadcastEvent(event);
|
|
53
|
+
if (event.name == UIView_1.UIView.broadcastEventName.LanguageChanged || event.name ==
|
|
54
|
+
UIView_1.UIView.broadcastEventName.AddedToViewTree) {
|
|
55
|
+
this._setPlaceholderFromKeyIfPossible();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
willMoveToSuperview(superview) {
|
|
59
|
+
super.willMoveToSuperview(superview);
|
|
60
|
+
this._setPlaceholderFromKeyIfPossible();
|
|
61
|
+
}
|
|
62
|
+
_setPlaceholderFromKeyIfPossible() {
|
|
63
|
+
if (this._placeholderTextKey && this._defaultPlaceholderText) {
|
|
64
|
+
this.setPlaceholderText(this._placeholderTextKey, this._defaultPlaceholderText);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
get isSecure() {
|
|
68
|
+
const result = (this.viewHTMLElement.type == "password");
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
set isSecure(secure) {
|
|
72
|
+
var type = "text";
|
|
73
|
+
if (secure) {
|
|
74
|
+
type = "password";
|
|
75
|
+
}
|
|
76
|
+
this.viewHTMLElement.type = type;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.UITextField = UITextField;
|
|
80
|
+
UITextField.controlEvent = Object.assign({}, UIView_1.UIView.controlEvent, {
|
|
81
|
+
"TextChange": "TextChange"
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=UITextField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UITextField.js","sourceRoot":"","sources":["../scripts/UITextField.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,qCAAiC;AACjC,yCAAyC;AACzC,6CAAyC;AACzC,qCAA0F;AAM1F,MAAa,WAAY,SAAQ,uBAAU;IAQvC,YAAY,SAAkB,EAAE,eAAe,GAAG,IAAI,EAAE,IAAI,GAAG,uBAAU,CAAC,IAAI,CAAC,SAAS;QAEpF,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAEvC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAA;QACzB,IAAI,CAAC,UAAU,GAAG,uBAAU,CAAA;QAE5B,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAEjD,IAAI,CAAC,eAAe,GAAG,iBAAO,CAAC,UAAU,CAAA;QAIzC,IAAI,CAAC,wBAAwB,CAAC,eAAM,CAAC,YAAY,CAAC,eAAe,EAAE,UAAU,MAAM,EAAE,KAAK;YAEtF,MAAM,CAAC,KAAK,EAAE,CAAA;QAElB,CAAC,CAAC,CAAA;QAGF,IAAI,CAAC,eAAe,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;YACrC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QAC3E,CAAC,CAAA;QAGD,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAAA;QAEpC,IAAI,CAAC,sBAAsB,GAAG,cAAG,CAAA;QAEjC,IAAI,CAAC,mBAAmB,GAAG,aAAE,CAAA;IAGjC,CAAC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C,CAAC;IAED,gCAAgC;QAE5B,IAAI,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAE1D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAA;SAElF;IAEL,CAAC;IAGD,IAAW,QAAQ;QAEf,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,IAAI,UAAU,CAAC,CAAA;QAExD,OAAO,MAAM,CAAA;IAEjB,CAAC;IAID,IAAW,QAAQ,CAAC,MAAe;QAE/B,IAAI,IAAI,GAAG,MAAM,CAAA;QAEjB,IAAI,MAAM,EAAE;YAER,IAAI,GAAG,UAAU,CAAA;SAEpB;QAED,IAAI,CAAC,eAAe,CAAC,IAAI,GAAG,IAAI,CAAA;IAEpC,CAAC;;AArKL,kCA2KC;AA9HU,wBAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAM,CAAC,YAAY,EAAE;IAGzD,YAAY,EAAE,YAAY;CAG7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { UIColor } from "./UIColor";
|
|
2
|
+
import { UILocalizedTextObject } from "./UICore";
|
|
3
|
+
import { UIObject } from "./UIObject";
|
|
4
|
+
import { UIRectangle } from "./UIRectangle";
|
|
5
|
+
import { UIView, UIViewBroadcastEvent } from "./UIView";
|
|
6
|
+
export declare class UITextView extends UIView {
|
|
7
|
+
_textColor: UIColor;
|
|
8
|
+
_textAlignment: string;
|
|
9
|
+
_isSingleLine: boolean;
|
|
10
|
+
textPrefix: string;
|
|
11
|
+
textSuffix: string;
|
|
12
|
+
_notificationAmount: number;
|
|
13
|
+
_minFontSize: number;
|
|
14
|
+
_maxFontSize: number;
|
|
15
|
+
_automaticFontSizeSelection: boolean;
|
|
16
|
+
changesOften: boolean;
|
|
17
|
+
static defaultTextColor: UIColor;
|
|
18
|
+
static notificationTextColor: UIColor;
|
|
19
|
+
static _intrinsicHeightCache: {
|
|
20
|
+
[x: string]: {
|
|
21
|
+
[x: string]: number;
|
|
22
|
+
};
|
|
23
|
+
} & UIObject;
|
|
24
|
+
static _intrinsicWidthCache: {
|
|
25
|
+
[x: string]: {
|
|
26
|
+
[x: string]: number;
|
|
27
|
+
};
|
|
28
|
+
} & UIObject;
|
|
29
|
+
_intrinsicHeightCache: {
|
|
30
|
+
[x: string]: {
|
|
31
|
+
[x: string]: number;
|
|
32
|
+
};
|
|
33
|
+
} & UIObject;
|
|
34
|
+
_intrinsicWidthCache: {
|
|
35
|
+
[x: string]: {
|
|
36
|
+
[x: string]: number;
|
|
37
|
+
};
|
|
38
|
+
} & UIObject;
|
|
39
|
+
static _ptToPx: number;
|
|
40
|
+
static _pxToPt: number;
|
|
41
|
+
_text: string;
|
|
42
|
+
constructor(elementID?: string, textViewType?: string, viewHTMLElement?: any);
|
|
43
|
+
static _determinePXAndPTRatios(): void;
|
|
44
|
+
static type: {
|
|
45
|
+
paragraph: string;
|
|
46
|
+
header1: string;
|
|
47
|
+
header2: string;
|
|
48
|
+
header3: string;
|
|
49
|
+
header4: string;
|
|
50
|
+
header5: string;
|
|
51
|
+
header6: string;
|
|
52
|
+
textArea: string;
|
|
53
|
+
textField: string;
|
|
54
|
+
span: string;
|
|
55
|
+
label: string;
|
|
56
|
+
};
|
|
57
|
+
static textAlignment: {
|
|
58
|
+
left: string;
|
|
59
|
+
center: string;
|
|
60
|
+
right: string;
|
|
61
|
+
justify: string;
|
|
62
|
+
};
|
|
63
|
+
get textAlignment(): string;
|
|
64
|
+
set textAlignment(textAlignment: string);
|
|
65
|
+
get textColor(): UIColor;
|
|
66
|
+
set textColor(color: UIColor);
|
|
67
|
+
get isSingleLine(): boolean;
|
|
68
|
+
set isSingleLine(isSingleLine: boolean);
|
|
69
|
+
get notificationAmount(): number;
|
|
70
|
+
set notificationAmount(notificationAmount: number);
|
|
71
|
+
notificationAmountDidChange(notificationAmount: number): void;
|
|
72
|
+
get text(): string;
|
|
73
|
+
set text(text: string);
|
|
74
|
+
set innerHTML(innerHTML: string);
|
|
75
|
+
get innerHTML(): string;
|
|
76
|
+
setText(key: string, defaultString: string, parameters?: {
|
|
77
|
+
[x: string]: string | UILocalizedTextObject;
|
|
78
|
+
}): void;
|
|
79
|
+
get fontSize(): number;
|
|
80
|
+
set fontSize(fontSize: number);
|
|
81
|
+
useAutomaticFontSize(minFontSize?: number, maxFontSize?: number): void;
|
|
82
|
+
static automaticallyCalculatedFontSize(bounds: UIRectangle, currentSize: UIRectangle, currentFontSize: number, minFontSize?: number, maxFontSize?: number): number;
|
|
83
|
+
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
|
|
84
|
+
willMoveToSuperview(superview: UIView): void;
|
|
85
|
+
layoutSubviews(): void;
|
|
86
|
+
intrinsicContentHeight(constrainingWidth?: number): any;
|
|
87
|
+
intrinsicContentWidth(constrainingHeight?: number): any;
|
|
88
|
+
intrinsicContentSize(): UIRectangle;
|
|
89
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UITextView = void 0;
|
|
4
|
+
const UIColor_1 = require("./UIColor");
|
|
5
|
+
const UIObject_1 = require("./UIObject");
|
|
6
|
+
const UIRectangle_1 = require("./UIRectangle");
|
|
7
|
+
const UIView_1 = require("./UIView");
|
|
8
|
+
class UITextView extends UIView_1.UIView {
|
|
9
|
+
constructor(elementID, textViewType = UITextView.type.paragraph, viewHTMLElement = null) {
|
|
10
|
+
super(elementID, viewHTMLElement, textViewType);
|
|
11
|
+
this._textColor = UITextView.defaultTextColor;
|
|
12
|
+
this._isSingleLine = UIObject_1.YES;
|
|
13
|
+
this.textPrefix = "";
|
|
14
|
+
this.textSuffix = "";
|
|
15
|
+
this._notificationAmount = 0;
|
|
16
|
+
this._minFontSize = UIObject_1.nil;
|
|
17
|
+
this._maxFontSize = UIObject_1.nil;
|
|
18
|
+
this._automaticFontSizeSelection = UIObject_1.NO;
|
|
19
|
+
this.changesOften = UIObject_1.NO;
|
|
20
|
+
this._intrinsicHeightCache = new UIObject_1.UIObject();
|
|
21
|
+
this._intrinsicWidthCache = new UIObject_1.UIObject();
|
|
22
|
+
this._class = UITextView;
|
|
23
|
+
this.superclass = UIView_1.UIView;
|
|
24
|
+
this.text = "";
|
|
25
|
+
this.style.overflow = "hidden";
|
|
26
|
+
this.style.textOverflow = "ellipsis";
|
|
27
|
+
this.isSingleLine = UIObject_1.YES;
|
|
28
|
+
this.textColor = this.textColor;
|
|
29
|
+
this.userInteractionEnabled = UIObject_1.YES;
|
|
30
|
+
if (textViewType == UITextView.type.textArea) {
|
|
31
|
+
this.pausesPointerEvents = UIObject_1.YES;
|
|
32
|
+
this.addTargetForControlEvent(UIView_1.UIView.controlEvent.PointerUpInside, function (sender, event) {
|
|
33
|
+
sender.focus();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static _determinePXAndPTRatios() {
|
|
38
|
+
const o = document.createElement("div");
|
|
39
|
+
o.style.width = "1000pt";
|
|
40
|
+
document.body.appendChild(o);
|
|
41
|
+
UITextView._ptToPx = o.clientWidth / 1000;
|
|
42
|
+
document.body.removeChild(o);
|
|
43
|
+
UITextView._pxToPt = 1 / UITextView._ptToPx;
|
|
44
|
+
}
|
|
45
|
+
get textAlignment() {
|
|
46
|
+
const result = this.style.textAlign;
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
set textAlignment(textAlignment) {
|
|
50
|
+
this._textAlignment = textAlignment;
|
|
51
|
+
this.style.textAlign = textAlignment;
|
|
52
|
+
}
|
|
53
|
+
get textColor() {
|
|
54
|
+
const result = this._textColor;
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
set textColor(color) {
|
|
58
|
+
this._textColor = color || UITextView.defaultTextColor;
|
|
59
|
+
this.style.color = this._textColor.stringValue;
|
|
60
|
+
}
|
|
61
|
+
get isSingleLine() {
|
|
62
|
+
return this._isSingleLine;
|
|
63
|
+
}
|
|
64
|
+
set isSingleLine(isSingleLine) {
|
|
65
|
+
this._isSingleLine = isSingleLine;
|
|
66
|
+
this._intrinsicHeightCache = new UIObject_1.UIObject();
|
|
67
|
+
this._intrinsicWidthCache = new UIObject_1.UIObject();
|
|
68
|
+
if (isSingleLine) {
|
|
69
|
+
this.style.whiteSpace = "pre";
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.style.whiteSpace = "pre-wrap";
|
|
73
|
+
}
|
|
74
|
+
get notificationAmount() {
|
|
75
|
+
return this._notificationAmount;
|
|
76
|
+
}
|
|
77
|
+
set notificationAmount(notificationAmount) {
|
|
78
|
+
if (this._notificationAmount == notificationAmount) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this._notificationAmount = notificationAmount;
|
|
82
|
+
this.text = this.text;
|
|
83
|
+
this.setNeedsLayoutUpToRootView();
|
|
84
|
+
this.notificationAmountDidChange(notificationAmount);
|
|
85
|
+
}
|
|
86
|
+
notificationAmountDidChange(notificationAmount) {
|
|
87
|
+
}
|
|
88
|
+
get text() {
|
|
89
|
+
return (this._text || this.viewHTMLElement.innerHTML);
|
|
90
|
+
}
|
|
91
|
+
set text(text) {
|
|
92
|
+
this._text = text;
|
|
93
|
+
var notificationText = "";
|
|
94
|
+
if (this.notificationAmount) {
|
|
95
|
+
notificationText = "<span style=\"color: " + UITextView.notificationTextColor.stringValue + ";\">" +
|
|
96
|
+
(" (" + this.notificationAmount + ")").bold() + "</span>";
|
|
97
|
+
}
|
|
98
|
+
if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {
|
|
99
|
+
this.viewHTMLElement.innerHTML = this.textPrefix + (0, UIObject_1.FIRST)(text, "") + this.textSuffix + notificationText;
|
|
100
|
+
}
|
|
101
|
+
this._intrinsicHeightCache = new UIObject_1.UIObject();
|
|
102
|
+
this._intrinsicWidthCache = new UIObject_1.UIObject();
|
|
103
|
+
this.setNeedsLayout();
|
|
104
|
+
}
|
|
105
|
+
set innerHTML(innerHTML) {
|
|
106
|
+
this.text = innerHTML;
|
|
107
|
+
}
|
|
108
|
+
get innerHTML() {
|
|
109
|
+
return this.viewHTMLElement.innerHTML;
|
|
110
|
+
}
|
|
111
|
+
setText(key, defaultString, parameters) {
|
|
112
|
+
this.setInnerHTML(key, defaultString, parameters);
|
|
113
|
+
}
|
|
114
|
+
get fontSize() {
|
|
115
|
+
const style = window.getComputedStyle(this.viewHTMLElement, null).fontSize;
|
|
116
|
+
const result = (parseFloat(style) * UITextView._pxToPt);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
set fontSize(fontSize) {
|
|
120
|
+
this.style.fontSize = "" + fontSize + "pt";
|
|
121
|
+
this._intrinsicHeightCache = new UIObject_1.UIObject();
|
|
122
|
+
this._intrinsicWidthCache = new UIObject_1.UIObject(); // MEETOD LUUA!!!!
|
|
123
|
+
}
|
|
124
|
+
useAutomaticFontSize(minFontSize = UIObject_1.nil, maxFontSize = UIObject_1.nil) {
|
|
125
|
+
this._automaticFontSizeSelection = UIObject_1.YES;
|
|
126
|
+
this._minFontSize = minFontSize;
|
|
127
|
+
this._maxFontSize = maxFontSize;
|
|
128
|
+
this.setNeedsLayout();
|
|
129
|
+
}
|
|
130
|
+
static automaticallyCalculatedFontSize(bounds, currentSize, currentFontSize, minFontSize, maxFontSize) {
|
|
131
|
+
minFontSize = (0, UIObject_1.FIRST)(minFontSize, 1);
|
|
132
|
+
maxFontSize = (0, UIObject_1.FIRST)(maxFontSize, 100000000000);
|
|
133
|
+
const heightMultiplier = bounds.height / (currentSize.height + 1);
|
|
134
|
+
const widthMultiplier = bounds.width / (currentSize.width + 1);
|
|
135
|
+
var multiplier = heightMultiplier;
|
|
136
|
+
if (heightMultiplier > widthMultiplier) {
|
|
137
|
+
multiplier = widthMultiplier;
|
|
138
|
+
}
|
|
139
|
+
const maxFittingFontSize = currentFontSize * multiplier;
|
|
140
|
+
if (maxFittingFontSize > maxFontSize) {
|
|
141
|
+
return maxFontSize;
|
|
142
|
+
}
|
|
143
|
+
if (minFontSize > maxFittingFontSize) {
|
|
144
|
+
return minFontSize;
|
|
145
|
+
}
|
|
146
|
+
return maxFittingFontSize;
|
|
147
|
+
}
|
|
148
|
+
didReceiveBroadcastEvent(event) {
|
|
149
|
+
super.didReceiveBroadcastEvent(event);
|
|
150
|
+
}
|
|
151
|
+
willMoveToSuperview(superview) {
|
|
152
|
+
super.willMoveToSuperview(superview);
|
|
153
|
+
}
|
|
154
|
+
layoutSubviews() {
|
|
155
|
+
super.layoutSubviews();
|
|
156
|
+
if (this._automaticFontSizeSelection) {
|
|
157
|
+
this.fontSize = UITextView.automaticallyCalculatedFontSize(new UIRectangle_1.UIRectangle(0, 0, 1 *
|
|
158
|
+
this.viewHTMLElement.offsetHeight, 1 *
|
|
159
|
+
this.viewHTMLElement.offsetWidth), this.intrinsicContentSize(), this.fontSize, this._minFontSize, this._maxFontSize);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
intrinsicContentHeight(constrainingWidth = 0) {
|
|
163
|
+
const keyPath = (this.viewHTMLElement.innerHTML + "_csf_" + this.computedStyle.font).replace(new RegExp("\\.", "g"), "_") + "." +
|
|
164
|
+
("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
|
|
165
|
+
let cacheObject = UITextView._intrinsicHeightCache;
|
|
166
|
+
if (this.changesOften) {
|
|
167
|
+
cacheObject = this._intrinsicHeightCache;
|
|
168
|
+
}
|
|
169
|
+
var result = cacheObject.valueForKeyPath(keyPath);
|
|
170
|
+
if ((0, UIObject_1.IS_LIKE_NULL)(result)) {
|
|
171
|
+
result = super.intrinsicContentHeight(constrainingWidth);
|
|
172
|
+
cacheObject.setValueForKeyPath(keyPath, result);
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
intrinsicContentWidth(constrainingHeight = 0) {
|
|
177
|
+
const keyPath = (this.viewHTMLElement.innerHTML + "_csf_" + this.computedStyle.font).replace(new RegExp("\\.", "g"), "_") + "." +
|
|
178
|
+
("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
|
|
179
|
+
let cacheObject = UITextView._intrinsicWidthCache;
|
|
180
|
+
if (this.changesOften) {
|
|
181
|
+
cacheObject = this._intrinsicWidthCache;
|
|
182
|
+
}
|
|
183
|
+
var result = cacheObject.valueForKeyPath(keyPath);
|
|
184
|
+
if ((0, UIObject_1.IS_LIKE_NULL)(result)) {
|
|
185
|
+
result = super.intrinsicContentWidth(constrainingHeight);
|
|
186
|
+
cacheObject.setValueForKeyPath(keyPath, result);
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
intrinsicContentSize() {
|
|
191
|
+
// This works but is slow
|
|
192
|
+
const result = this.intrinsicContentSizeWithConstraints(UIObject_1.nil, UIObject_1.nil);
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.UITextView = UITextView;
|
|
197
|
+
UITextView.defaultTextColor = UIColor_1.UIColor.blackColor;
|
|
198
|
+
UITextView.notificationTextColor = UIColor_1.UIColor.redColor;
|
|
199
|
+
UITextView._intrinsicHeightCache = new UIObject_1.UIObject();
|
|
200
|
+
UITextView._intrinsicWidthCache = new UIObject_1.UIObject();
|
|
201
|
+
UITextView.type = {
|
|
202
|
+
"paragraph": "p",
|
|
203
|
+
"header1": "h1",
|
|
204
|
+
"header2": "h2",
|
|
205
|
+
"header3": "h3",
|
|
206
|
+
"header4": "h4",
|
|
207
|
+
"header5": "h5",
|
|
208
|
+
"header6": "h6",
|
|
209
|
+
"textArea": "textarea",
|
|
210
|
+
"textField": "input",
|
|
211
|
+
"span": "span",
|
|
212
|
+
"label": "label"
|
|
213
|
+
};
|
|
214
|
+
UITextView.textAlignment = {
|
|
215
|
+
"left": "left",
|
|
216
|
+
"center": "center",
|
|
217
|
+
"right": "right",
|
|
218
|
+
"justify": "justify"
|
|
219
|
+
};
|
|
220
|
+
UITextView._determinePXAndPTRatios();
|
|
221
|
+
// /**
|
|
222
|
+
// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.
|
|
223
|
+
// *
|
|
224
|
+
// * @param {String} text The text to be rendered.
|
|
225
|
+
// * @param {String} font The css font descriptor that text is to be rendered with (e.g. "bold 14px verdana").
|
|
226
|
+
// *
|
|
227
|
+
// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393
|
|
228
|
+
// */
|
|
229
|
+
// function getTextMetrics(text, font) {
|
|
230
|
+
// // re-use canvas object for better performance
|
|
231
|
+
// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement("canvas"));
|
|
232
|
+
// var context = canvas.getContext("2d");
|
|
233
|
+
// context.font = font;
|
|
234
|
+
// var metrics = context.measureText(text);
|
|
235
|
+
// return metrics;
|
|
236
|
+
// }
|
|
237
|
+
//# sourceMappingURL=UITextView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UITextView.js","sourceRoot":"","sources":["../scripts/UITextView.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEnC,yCAAwE;AACxE,+CAA2C;AAC3C,qCAAuD;AAMvD,MAAa,UAAW,SAAQ,eAAM;IAmClC,YAAY,SAAkB,EAAE,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;QAE5F,KAAK,CAAC,SAAS,EAAE,eAAe,EAAE,YAAY,CAAC,CAAA;QAlCnD,eAAU,GAAY,UAAU,CAAC,gBAAgB,CAAA;QAGjD,kBAAa,GAAG,cAAG,CAAA;QAEnB,eAAU,GAAG,EAAE,CAAA;QACf,eAAU,GAAG,EAAE,CAAA;QAEf,wBAAmB,GAAG,CAAC,CAAA;QAEvB,iBAAY,GAAW,cAAG,CAAA;QAC1B,iBAAY,GAAW,cAAG,CAAA;QAE1B,gCAA2B,GAAG,aAAE,CAAA;QAEhC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|
2
|
+
export declare class UITimer extends UIObject {
|
|
3
|
+
interval: number;
|
|
4
|
+
repeats: boolean;
|
|
5
|
+
target: Function;
|
|
6
|
+
_intervalID: number;
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
constructor(interval: number, repeats: boolean, target: Function);
|
|
9
|
+
schedule(): void;
|
|
10
|
+
reschedule(): void;
|
|
11
|
+
fire(): void;
|
|
12
|
+
invalidate(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UITimer = void 0;
|
|
4
|
+
const UIObject_1 = require("./UIObject");
|
|
5
|
+
class UITimer extends UIObject_1.UIObject {
|
|
6
|
+
constructor(interval, repeats, target) {
|
|
7
|
+
super();
|
|
8
|
+
this.interval = interval;
|
|
9
|
+
this.repeats = repeats;
|
|
10
|
+
this.target = target;
|
|
11
|
+
this.isValid = UIObject_1.YES;
|
|
12
|
+
this.superclass = UIObject_1.UIObject;
|
|
13
|
+
this.schedule();
|
|
14
|
+
}
|
|
15
|
+
schedule() {
|
|
16
|
+
const callback = function () {
|
|
17
|
+
if (this.repeats == UIObject_1.NO) {
|
|
18
|
+
this.invalidate();
|
|
19
|
+
}
|
|
20
|
+
this.target();
|
|
21
|
+
}.bind(this);
|
|
22
|
+
this._intervalID = window.setInterval(callback, this.interval * 1000);
|
|
23
|
+
}
|
|
24
|
+
reschedule() {
|
|
25
|
+
this.invalidate();
|
|
26
|
+
this.schedule();
|
|
27
|
+
}
|
|
28
|
+
fire() {
|
|
29
|
+
if (this.repeats == UIObject_1.NO) {
|
|
30
|
+
this.invalidate();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.reschedule();
|
|
34
|
+
}
|
|
35
|
+
this.target();
|
|
36
|
+
}
|
|
37
|
+
invalidate() {
|
|
38
|
+
if (this.isValid) {
|
|
39
|
+
clearInterval(this._intervalID);
|
|
40
|
+
this.isVal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