uicore-ts 1.1.101 → 1.1.105
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/UICore.js +3 -0
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +8 -0
- package/compiledScripts/UITableView.js +122 -39
- package/compiledScripts/UITableView.js.map +3 -3
- package/compiledScripts/UITextView.d.ts +49 -39
- package/compiledScripts/UITextView.js +131 -132
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +21 -1
- package/compiledScripts/UIView.js +66 -8
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UICore.ts +5 -0
- package/scripts/UITableView.ts +188 -129
- package/scripts/UITextView.ts +266 -376
- package/scripts/UIView.ts +131 -7
|
@@ -58,6 +58,9 @@ const _UICore = class extends import_UIObject.UIObject {
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
const windowDidResize = () => {
|
|
61
|
+
this.rootViewController.view.forEachViewInSubtree((view) => {
|
|
62
|
+
view._frameCache = void 0;
|
|
63
|
+
});
|
|
61
64
|
this.rootViewController.view.setNeedsLayout();
|
|
62
65
|
this.rootViewController._triggerLayoutViewSubviews();
|
|
63
66
|
import_UIView.UIView.layoutViewsIfNeeded();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UICore.ts"],
|
|
4
|
-
"sourcesContent": ["import \"./UICoreExtensions\"\nimport { UILanguageService } from \"./UIInterfaces\"\nimport { nil, NO, UIObject } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport class UICore extends UIObject {\n \n rootViewController: UIViewController\n \n paddingLength = 20\n \n static RootViewControllerClass: typeof UIViewController\n static main: UICore\n \n static languageService: UILanguageService = nil\n \n static readonly broadcastEventName = {\n \n \"RouteDidChange\": \"RouteDidChange\",\n \"WindowDidResize\": \"WindowDidResize\"\n \n }\n \n constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController) {\n \n super()\n \n UICore.RootViewControllerClass = rootViewControllerClass\n UICore.main = UICore.main || this\n \n const rootViewElement = document.getElementById(rootDivElementID)\n const rootView = new UIView(rootDivElementID, rootViewElement)\n rootView.pausesPointerEvents = NO //YES;\n rootView.core = this\n \n if (UICore.RootViewControllerClass) {\n \n if (!(UICore.RootViewControllerClass.prototype instanceof UIViewController) ||\n (UICore.RootViewControllerClass as any) === UIViewController) {\n \n console.log(\n \"Error, UICore.RootViewControllerClass must be UIViewController or a subclass of UIViewController, \" +\n \"falling back to UIViewController.\"\n )\n \n UICore.RootViewControllerClass = UIViewController\n \n }\n \n this.rootViewController = new UICore.RootViewControllerClass(rootView)\n \n }\n else {\n \n this.rootViewController = new UIViewController(rootView)\n \n }\n \n this.rootViewController.viewWillAppear().then(() =>\n this.rootViewController.viewDidAppear()\n )\n \n \n this.rootViewController.view.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n () => {\n \n (document.activeElement as HTMLElement)?.blur?.()\n \n }\n )\n \n \n const windowDidResize = () => {\n \n // Doing layout two times to prevent page scrollbars from confusing the layout\n this.rootViewController.view.setNeedsLayout()\n this.rootViewController._triggerLayoutViewSubviews()\n UIView.layoutViewsIfNeeded()\n \n this.rootViewController._triggerLayoutViewSubviews()\n //UIView.layoutViewsIfNeeded()\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.WindowDidResize,\n parameters: nil\n \n })\n \n }\n \n window.addEventListener(\"resize\", windowDidResize)\n \n const didScroll = () => {\n \n //code\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UIView.broadcastEventName.PageDidScroll,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"scroll\", didScroll, false)\n \n const hashDidChange = () => {\n \n //code\n \n this.rootViewController.handleRouteRecursively(UIRoute.currentRoute)\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.RouteDidChange,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"hashchange\", hashDidChange, false)\n \n hashDidChange()\n \n \n }\n \n \n}\n\n\nArray.prototype.indexOf || (Array.prototype.indexOf = function (d, e) {\n let a\n if (null == this) {\n throw new TypeError(\"\\\"this\\\" is null or not defined\")\n }\n const c = Object(this),\n b = c.length >>> 0\n if (0 === b) {\n return -1\n }\n // @ts-ignore\n a = +e || 0\n Infinity === Math.abs(a) && (a = 0)\n if (a >= b) {\n return -1\n }\n for (a = Math.max(0 <= a ? a : b - Math.abs(a), 0); a < b;) {\n if (a in c && c[a] === d) {\n return a\n }\n a++\n }\n return -1\n})\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AAEP,sBAAkC;AAClC,qBAAwB;AACxB,oBAAuB;AACvB,8BAAiC;AAG1B,MAAM,UAAN,cAAqB,yBAAS;AAAA,EAkBjC,YAAY,kBAA0B,yBAAkD;AAEpF,UAAM;AAhBV,yBAAgB;AAkBZ,YAAO,0BAA0B;AACjC,YAAO,OAAO,QAAO,QAAQ;AAE7B,UAAM,kBAAkB,SAAS,eAAe,gBAAgB;AAChE,UAAM,WAAW,IAAI,qBAAO,kBAAkB,eAAe;AAC7D,aAAS,sBAAsB;AAC/B,aAAS,OAAO;AAEhB,QAAI,QAAO,yBAAyB;AAEhC,UAAI,EAAE,QAAO,wBAAwB,qBAAqB,6CACrD,QAAO,4BAAoC,0CAAkB;AAE9D,gBAAQ;AAAA,UACJ;AAAA,QAEJ;AAEA,gBAAO,0BAA0B;AAAA,MAErC;AAEA,WAAK,qBAAqB,IAAI,QAAO,wBAAwB,QAAQ;AAAA,IAEzE,OACK;AAED,WAAK,qBAAqB,IAAI,yCAAiB,QAAQ;AAAA,IAE3D;AAEA,SAAK,mBAAmB,eAAe,EAAE;AAAA,MAAK,MAC1C,KAAK,mBAAmB,cAAc;AAAA,IAC1C;AAGA,SAAK,mBAAmB,KAAK;AAAA,MACzB,qBAAO,aAAa;AAAA,MACpB,MAAM;AApElB;AAsEgB,SAAC,oBAAS,kBAAT,mBAAwC,SAAxC;AAAA,MAEL;AAAA,IACJ;AAGA,UAAM,kBAAkB,MAAM;
|
|
4
|
+
"sourcesContent": ["import \"./UICoreExtensions\"\nimport { UILanguageService } from \"./UIInterfaces\"\nimport { nil, NO, UIObject } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport class UICore extends UIObject {\n \n rootViewController: UIViewController\n \n paddingLength = 20\n \n static RootViewControllerClass: typeof UIViewController\n static main: UICore\n \n static languageService: UILanguageService = nil\n \n static readonly broadcastEventName = {\n \n \"RouteDidChange\": \"RouteDidChange\",\n \"WindowDidResize\": \"WindowDidResize\"\n \n }\n \n constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController) {\n \n super()\n \n UICore.RootViewControllerClass = rootViewControllerClass\n UICore.main = UICore.main || this\n \n const rootViewElement = document.getElementById(rootDivElementID)\n const rootView = new UIView(rootDivElementID, rootViewElement)\n rootView.pausesPointerEvents = NO //YES;\n rootView.core = this\n \n if (UICore.RootViewControllerClass) {\n \n if (!(UICore.RootViewControllerClass.prototype instanceof UIViewController) ||\n (UICore.RootViewControllerClass as any) === UIViewController) {\n \n console.log(\n \"Error, UICore.RootViewControllerClass must be UIViewController or a subclass of UIViewController, \" +\n \"falling back to UIViewController.\"\n )\n \n UICore.RootViewControllerClass = UIViewController\n \n }\n \n this.rootViewController = new UICore.RootViewControllerClass(rootView)\n \n }\n else {\n \n this.rootViewController = new UIViewController(rootView)\n \n }\n \n this.rootViewController.viewWillAppear().then(() =>\n this.rootViewController.viewDidAppear()\n )\n \n \n this.rootViewController.view.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n () => {\n \n (document.activeElement as HTMLElement)?.blur?.()\n \n }\n )\n \n \n const windowDidResize = () => {\n \n this.rootViewController.view.forEachViewInSubtree((view) => {\n \n view._frameCache = undefined\n \n })\n // Doing layout two times to prevent page scrollbars from confusing the layout\n this.rootViewController.view.setNeedsLayout()\n this.rootViewController._triggerLayoutViewSubviews()\n UIView.layoutViewsIfNeeded()\n \n this.rootViewController._triggerLayoutViewSubviews()\n //UIView.layoutViewsIfNeeded()\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.WindowDidResize,\n parameters: nil\n \n })\n \n }\n \n window.addEventListener(\"resize\", windowDidResize)\n \n const didScroll = () => {\n \n //code\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UIView.broadcastEventName.PageDidScroll,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"scroll\", didScroll, false)\n \n const hashDidChange = () => {\n \n //code\n \n this.rootViewController.handleRouteRecursively(UIRoute.currentRoute)\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.RouteDidChange,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"hashchange\", hashDidChange, false)\n \n hashDidChange()\n \n \n }\n \n \n}\n\n\nArray.prototype.indexOf || (Array.prototype.indexOf = function (d, e) {\n let a\n if (null == this) {\n throw new TypeError(\"\\\"this\\\" is null or not defined\")\n }\n const c = Object(this),\n b = c.length >>> 0\n if (0 === b) {\n return -1\n }\n // @ts-ignore\n a = +e || 0\n Infinity === Math.abs(a) && (a = 0)\n if (a >= b) {\n return -1\n }\n for (a = Math.max(0 <= a ? a : b - Math.abs(a), 0); a < b;) {\n if (a in c && c[a] === d) {\n return a\n }\n a++\n }\n return -1\n})\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AAEP,sBAAkC;AAClC,qBAAw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ayoutingForIntrinsicSizing: boolean;
|
|
34
34
|
animationDuration: number;
|
|
35
|
+
_intersectionObserver?: IntersectionObserver;
|
|
35
36
|
constructor(elementID?: string);
|
|
37
|
+
_windowScrollHandler: () => void;
|
|
38
|
+
_resizeHandler: () => void;
|
|
39
|
+
_setupViewportScrollAndResizeHandlersIfNeeded(): void;
|
|
40
|
+
_cleanupViewportScrollListeners(): void;
|
|
36
41
|
loadData(): void;
|
|
37
42
|
reloadData(): void;
|
|
38
43
|
highlightChanges(previousData: any[], newData: any[]): void;
|
|
@@ -44,6 +49,7 @@ export declare class UITableView extends UINativeScrollView {
|
|
|
44
49
|
_removeVisibleRows(): void;
|
|
45
50
|
_removeAllReusableRows(): void;
|
|
46
51
|
_markReusableViewAsUnused(row: UIView): void;
|
|
52
|
+
_scheduleDrawVisibleRows(): void;
|
|
47
53
|
_drawVisibleRows(): void;
|
|
48
54
|
visibleRowWithIndex(rowIndex: number | undefined): UIView;
|
|
49
55
|
isRowWithIndexVisible(rowIndex: number): boolean;
|
|
@@ -55,7 +61,9 @@ export declare class UITableView extends UINativeScrollView {
|
|
|
55
61
|
persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any;
|
|
56
62
|
viewForRowWithIndex(rowIndex: number): UITableViewRowView;
|
|
57
63
|
didScrollToPosition(offsetPosition: UIPoint): void;
|
|
64
|
+
willMoveToSuperview(superview: UIView): void;
|
|
58
65
|
wasAddedToViewTree(): void;
|
|
66
|
+
wasRemovedFromViewTree(): void;
|
|
59
67
|
setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean): void;
|
|
60
68
|
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
|
|
61
69
|
private _layoutAllRows;
|
|
@@ -43,11 +43,56 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
43
43
|
this._isDrawVisibleRowsScheduled = import_UIObject.NO;
|
|
44
44
|
this.usesVirtualLayoutingForIntrinsicSizing = import_UIObject.NO;
|
|
45
45
|
this.animationDuration = 0.25;
|
|
46
|
+
this._windowScrollHandler = () => {
|
|
47
|
+
if (!this.isMemberOfViewTree) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this._scheduleDrawVisibleRows();
|
|
51
|
+
};
|
|
52
|
+
this._resizeHandler = () => {
|
|
53
|
+
if (!this.isMemberOfViewTree) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this._rowPositions.everyElement.isValid = import_UIObject.NO;
|
|
57
|
+
this._highestValidRowPositionIndex = -1;
|
|
58
|
+
this._scheduleDrawVisibleRows();
|
|
59
|
+
};
|
|
46
60
|
this._fullHeightView = new import_UIView.UIView();
|
|
47
61
|
this._fullHeightView.hidden = import_UIObject.YES;
|
|
48
62
|
this._fullHeightView.userInteractionEnabled = import_UIObject.NO;
|
|
49
63
|
this.addSubview(this._fullHeightView);
|
|
50
64
|
this.scrollsX = import_UIObject.NO;
|
|
65
|
+
this._setupViewportScrollAndResizeHandlersIfNeeded();
|
|
66
|
+
}
|
|
67
|
+
_setupViewportScrollAndResizeHandlersIfNeeded() {
|
|
68
|
+
if (this._intersectionObserver) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
window.addEventListener("scroll", this._windowScrollHandler, { passive: true });
|
|
72
|
+
window.addEventListener("resize", this._resizeHandler, { passive: true });
|
|
73
|
+
this._intersectionObserver = new IntersectionObserver(
|
|
74
|
+
(entries) => {
|
|
75
|
+
entries.forEach((entry) => {
|
|
76
|
+
if (entry.isIntersecting && this.isMemberOfViewTree) {
|
|
77
|
+
this._scheduleDrawVisibleRows();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
root: null,
|
|
83
|
+
rootMargin: "100% 0px",
|
|
84
|
+
threshold: 0
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
this._intersectionObserver.observe(this.viewHTMLElement);
|
|
88
|
+
}
|
|
89
|
+
_cleanupViewportScrollListeners() {
|
|
90
|
+
window.removeEventListener("scroll", this._windowScrollHandler);
|
|
91
|
+
window.removeEventListener("resize", this._resizeHandler);
|
|
92
|
+
if (this._intersectionObserver) {
|
|
93
|
+
this._intersectionObserver.disconnect();
|
|
94
|
+
this._intersectionObserver = void 0;
|
|
95
|
+
}
|
|
51
96
|
}
|
|
52
97
|
loadData() {
|
|
53
98
|
this._persistedData = [];
|
|
@@ -91,7 +136,7 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
91
136
|
this._calculatePositionsUntilIndex(this.numberOfRows() - 1);
|
|
92
137
|
}
|
|
93
138
|
_calculatePositionsUntilIndex(maxIndex) {
|
|
94
|
-
|
|
139
|
+
let validPositionObject = this._rowPositions[this._highestValidRowPositionIndex];
|
|
95
140
|
if (!(0, import_UIObject.IS)(validPositionObject)) {
|
|
96
141
|
validPositionObject = {
|
|
97
142
|
bottomY: 0,
|
|
@@ -99,12 +144,12 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
99
144
|
isValid: import_UIObject.YES
|
|
100
145
|
};
|
|
101
146
|
}
|
|
102
|
-
|
|
147
|
+
let previousBottomY = validPositionObject.bottomY;
|
|
103
148
|
if (!this._rowPositions.length) {
|
|
104
149
|
this._highestValidRowPositionIndex = -1;
|
|
105
150
|
}
|
|
106
|
-
for (
|
|
107
|
-
|
|
151
|
+
for (let i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {
|
|
152
|
+
let height;
|
|
108
153
|
const rowPositionObject = this._rowPositions[i];
|
|
109
154
|
if ((0, import_UIObject.IS)((rowPositionObject || import_UIObject.nil).isValid)) {
|
|
110
155
|
height = rowPositionObject.bottomY - rowPositionObject.topY;
|
|
@@ -126,34 +171,49 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
126
171
|
}
|
|
127
172
|
}
|
|
128
173
|
indexesForVisibleRows(paddingRatio = 0.5) {
|
|
129
|
-
const
|
|
130
|
-
const
|
|
174
|
+
const tableRect = this.viewHTMLElement.getBoundingClientRect();
|
|
175
|
+
const viewportHeight = window.innerHeight;
|
|
176
|
+
const pageScale = import_UIView.UIView.pageScale;
|
|
177
|
+
const visibleFrameTop = Math.max(0, -tableRect.top / pageScale);
|
|
178
|
+
const visibleFrameBottom = Math.min(
|
|
179
|
+
this.bounds.height,
|
|
180
|
+
(viewportHeight - tableRect.top) / pageScale
|
|
181
|
+
);
|
|
182
|
+
if (visibleFrameBottom <= visibleFrameTop) {
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
let firstVisibleY = this.contentOffset.y + visibleFrameTop;
|
|
186
|
+
let lastVisibleY = this.contentOffset.y + visibleFrameBottom;
|
|
187
|
+
const paddingPx = viewportHeight / pageScale * paddingRatio;
|
|
188
|
+
firstVisibleY = Math.max(0, firstVisibleY - paddingPx);
|
|
189
|
+
lastVisibleY = lastVisibleY + paddingPx;
|
|
131
190
|
const numberOfRows = this.numberOfRows();
|
|
132
191
|
if (this.allRowsHaveEqualHeight) {
|
|
133
192
|
const rowHeight = this.heightForRowWithIndex(0);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
firstIndex = Math.trunc(firstIndex);
|
|
137
|
-
lastIndex = Math.trunc(lastIndex) + 1;
|
|
193
|
+
let firstIndex = Math.floor(firstVisibleY / rowHeight);
|
|
194
|
+
let lastIndex = Math.floor(lastVisibleY / rowHeight);
|
|
138
195
|
firstIndex = Math.max(firstIndex, 0);
|
|
139
196
|
lastIndex = Math.min(lastIndex, numberOfRows - 1);
|
|
140
|
-
|
|
141
|
-
for (
|
|
142
|
-
|
|
197
|
+
const result2 = [];
|
|
198
|
+
for (let i = firstIndex; i <= lastIndex; i++) {
|
|
199
|
+
result2.push(i);
|
|
143
200
|
}
|
|
144
|
-
return
|
|
201
|
+
return result2;
|
|
145
202
|
}
|
|
146
|
-
var accumulatedHeight = 0;
|
|
147
|
-
var result = [];
|
|
148
203
|
this._calculateAllPositions();
|
|
149
204
|
const rowPositions = this._rowPositions;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (
|
|
205
|
+
const result = [];
|
|
206
|
+
for (let i = 0; i < numberOfRows; i++) {
|
|
207
|
+
const position = rowPositions[i];
|
|
208
|
+
if (!position) {
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
const rowTop = position.topY;
|
|
212
|
+
const rowBottom = position.bottomY;
|
|
213
|
+
if (rowBottom >= firstVisibleY && rowTop <= lastVisibleY) {
|
|
154
214
|
result.push(i);
|
|
155
215
|
}
|
|
156
|
-
if (
|
|
216
|
+
if (rowTop > lastVisibleY) {
|
|
157
217
|
break;
|
|
158
218
|
}
|
|
159
219
|
}
|
|
@@ -189,11 +249,26 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
189
249
|
this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row);
|
|
190
250
|
}
|
|
191
251
|
}
|
|
252
|
+
_scheduleDrawVisibleRows() {
|
|
253
|
+
if (!this._isDrawVisibleRowsScheduled) {
|
|
254
|
+
this._isDrawVisibleRowsScheduled = import_UIObject.YES;
|
|
255
|
+
import_UIView.UIView.runFunctionBeforeNextFrame(() => {
|
|
256
|
+
this._calculateAllPositions();
|
|
257
|
+
this._drawVisibleRows();
|
|
258
|
+
this.setNeedsLayout();
|
|
259
|
+
this._isDrawVisibleRowsScheduled = import_UIObject.NO;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
192
263
|
_drawVisibleRows() {
|
|
193
264
|
if (!this.isMemberOfViewTree) {
|
|
194
265
|
return;
|
|
195
266
|
}
|
|
196
267
|
const visibleIndexes = this.indexesForVisibleRows();
|
|
268
|
+
if (visibleIndexes.length === 0) {
|
|
269
|
+
this._removeVisibleRows();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
197
272
|
const minIndex = visibleIndexes[0];
|
|
198
273
|
const maxIndex = visibleIndexes[visibleIndexes.length - 1];
|
|
199
274
|
const removedViews = [];
|
|
@@ -228,7 +303,7 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
228
303
|
}
|
|
229
304
|
}
|
|
230
305
|
visibleRowWithIndex(rowIndex) {
|
|
231
|
-
for (
|
|
306
|
+
for (let i = 0; i < this._visibleRows.length; i++) {
|
|
232
307
|
const row = this._visibleRows[i];
|
|
233
308
|
if (row._UITableViewRowIndex == rowIndex) {
|
|
234
309
|
return row;
|
|
@@ -284,21 +359,27 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
284
359
|
}
|
|
285
360
|
didScrollToPosition(offsetPosition) {
|
|
286
361
|
super.didScrollToPosition(offsetPosition);
|
|
287
|
-
this.forEachViewInSubtree(
|
|
362
|
+
this.forEachViewInSubtree((view) => {
|
|
288
363
|
view._isPointerValid = import_UIObject.NO;
|
|
289
364
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
365
|
+
this._scheduleDrawVisibleRows();
|
|
366
|
+
}
|
|
367
|
+
willMoveToSuperview(superview) {
|
|
368
|
+
super.willMoveToSuperview(superview);
|
|
369
|
+
if ((0, import_UIObject.IS)(superview)) {
|
|
370
|
+
this._setupViewportScrollAndResizeHandlersIfNeeded();
|
|
371
|
+
} else {
|
|
372
|
+
this._cleanupViewportScrollListeners();
|
|
298
373
|
}
|
|
299
374
|
}
|
|
300
375
|
wasAddedToViewTree() {
|
|
376
|
+
super.wasAddedToViewTree();
|
|
301
377
|
this.loadData();
|
|
378
|
+
this._setupViewportScrollAndResizeHandlersIfNeeded();
|
|
379
|
+
}
|
|
380
|
+
wasRemovedFromViewTree() {
|
|
381
|
+
super.wasRemovedFromViewTree();
|
|
382
|
+
this._cleanupViewportScrollListeners();
|
|
302
383
|
}
|
|
303
384
|
setFrame(rectangle, zIndex, performUncheckedLayout) {
|
|
304
385
|
const frame = this.frame;
|
|
@@ -335,15 +416,17 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
335
416
|
this.animationDuration,
|
|
336
417
|
0,
|
|
337
418
|
void 0,
|
|
338
|
-
|
|
419
|
+
() => {
|
|
339
420
|
this._layoutAllRows();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
}
|
|
421
|
+
},
|
|
422
|
+
() => {
|
|
423
|
+
}
|
|
343
424
|
);
|
|
344
425
|
}
|
|
345
426
|
layoutSubviews() {
|
|
346
|
-
const previousPositions = JSON.parse(
|
|
427
|
+
const previousPositions = JSON.parse(
|
|
428
|
+
JSON.stringify(this._rowPositions)
|
|
429
|
+
);
|
|
347
430
|
const previousVisibleRowsLength = this._visibleRows.length;
|
|
348
431
|
if (this._needsDrawingOfVisibleRowsBeforeLayout) {
|
|
349
432
|
this._drawVisibleRows();
|
|
@@ -356,9 +439,9 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
356
439
|
if (this._shouldAnimateNextLayout) {
|
|
357
440
|
this._layoutAllRows(previousPositions);
|
|
358
441
|
if (previousVisibleRowsLength < this._visibleRows.length) {
|
|
359
|
-
import_UIView.UIView.runFunctionBeforeNextFrame(
|
|
442
|
+
import_UIView.UIView.runFunctionBeforeNextFrame(() => {
|
|
360
443
|
this._animateLayoutAllRows();
|
|
361
|
-
}
|
|
444
|
+
});
|
|
362
445
|
} else {
|
|
363
446
|
this._animateLayoutAllRows();
|
|
364
447
|
}
|
|
@@ -369,7 +452,7 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
369
452
|
}
|
|
370
453
|
}
|
|
371
454
|
intrinsicContentHeight(constrainingWidth = 0) {
|
|
372
|
-
|
|
455
|
+
let result = 0;
|
|
373
456
|
this._calculateAllPositions();
|
|
374
457
|
if (this._rowPositions.length) {
|
|
375
458
|
result = this._rowPositions[this._rowPositions.length - 1].bottomY;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UITableView.ts"],
|
|
4
|
-
"sourcesContent": ["import { UIButton } from \"./UIButton\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST_OR_NIL, IS, IS_DEFINED, nil, NO, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex?: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n _rowIDIndex: number = 0\n reloadsOnLanguageChange = YES\n sidePadding = 0\n \n cellWeights?: number[]\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n override animationDuration = 0.25\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.visibleRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n // if (index == 0) {\n \n // this._highestValidRowPositionIndex = 0;\n \n // this._rowPositions = [];\n \n // }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n var validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n var previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (var i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n var height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n const firstVisibleY = this.contentOffset.y - this.bounds.height * paddingRatio\n const lastVisibleY = firstVisibleY + this.bounds.height * (1 + paddingRatio)\n \n const numberOfRows = this.numberOfRows()\n \n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n var firstIndex = firstVisibleY / rowHeight\n var lastIndex = lastVisibleY / rowHeight\n \n firstIndex = Math.trunc(firstIndex)\n lastIndex = Math.trunc(lastIndex) + 1\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n var result = []\n for (var i = firstIndex; i < lastIndex + 1; i++) {\n result.push(i)\n }\n return result\n }\n \n var accumulatedHeight = 0\n var result = []\n \n this._calculateAllPositions()\n \n const rowPositions = this._rowPositions\n \n for (var i = 0; i < numberOfRows; i++) {\n \n const height = rowPositions[i].bottomY - rowPositions[i].topY // this.heightForRowWithIndex(i)\n \n accumulatedHeight = accumulatedHeight + height\n if (accumulatedHeight >= firstVisibleY) {\n result.push(i)\n }\n if (accumulatedHeight >= lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row?._UITableViewReusabilityIdentifier]?.push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n const visibleIndexes = this.indexesForVisibleRows()\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row) => {\n if (IS_DEFINED(row._UITableViewRowIndex) && (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex)) {\n \n //row.removeFromSuperview();\n \n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n removedViews.push(row)\n \n }\n else {\n visibleRows.push(row)\n }\n })\n this._visibleRows = visibleRows\n \n visibleIndexes.forEach((rowIndex: number) => {\n \n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n //view._UITableViewRowIndex = rowIndex;\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n \n })\n \n for (let i = 0; i < removedViews.length; i++) {\n \n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n \n //this._persistedData[view._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(view._UITableViewRowIndex, view);\n view.removeFromSuperview()\n \n //this._removedReusableViews[view._UITableViewReusabilityIdentifier].push(view);\n \n }\n \n }\n \n //this.setNeedsLayout();\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (var i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex)\n row._UITableViewRowIndex = rowIndex\n FIRST_OR_NIL((row as unknown as UIButton).titleLabel).text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree(function (view: UIView) {\n \n view._isPointerValid = NO\n \n })\n \n if (!this._isDrawVisibleRowsScheduled) {\n \n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this.setNeedsLayout()\n \n this._isDrawVisibleRowsScheduled = NO\n \n }.bind(this))\n \n }\n \n }\n \n override wasAddedToViewTree() {\n this.loadData()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.sort((rowA, rowB) => rowA._UITableViewRowIndex! - rowB._UITableViewRowIndex!)\n .forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex!]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n // This is to reorder the elements in the DOM\n this.viewHTMLElement.appendChild(row.viewHTMLElement)\n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n function (this: UITableView) {\n \n this._layoutAllRows()\n \n }.bind(this),\n function (this: UITableView) {\n \n // this._calculateAllPositions()\n // this._layoutAllRows()\n \n }.bind(this)\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n //this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._animateLayoutAllRows()\n \n }.bind(this))\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n // if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n // this._drawVisibleRows();\n \n // this._needsDrawingOfVisibleRowsBeforeLayout = NO;\n \n // }\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n var result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\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,sBAAyB;AACzB,gCAAmC;AACnC,sBAA2D;AAG3D,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { UIButton } from \"./UIButton\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST_OR_NIL, IS, IS_DEFINED, nil, NO, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex?: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n _rowIDIndex: number = 0\n reloadsOnLanguageChange = YES\n sidePadding = 0\n \n cellWeights?: number[]\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n override animationDuration = 0.25\n \n // Viewport scrolling properties\n _intersectionObserver?: IntersectionObserver\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n this._setupViewportScrollAndResizeHandlersIfNeeded()\n \n }\n \n \n _windowScrollHandler = () => {\n if (!this.isMemberOfViewTree) {\n return\n }\n this._scheduleDrawVisibleRows()\n }\n \n _resizeHandler = () => {\n if (!this.isMemberOfViewTree) {\n return\n }\n // Invalidate all row positions on resize as widths may have changed\n this._rowPositions.everyElement.isValid = NO\n this._highestValidRowPositionIndex = -1\n this._scheduleDrawVisibleRows()\n }\n \n _setupViewportScrollAndResizeHandlersIfNeeded() {\n if (this._intersectionObserver) {\n return\n }\n \n window.addEventListener(\"scroll\", this._windowScrollHandler, { passive: true })\n window.addEventListener(\"resize\", this._resizeHandler, { passive: true })\n \n // Use IntersectionObserver to detect when table enters/exits viewport\n this._intersectionObserver = new IntersectionObserver(\n (entries) => {\n entries.forEach(entry => {\n if (entry.isIntersecting && this.isMemberOfViewTree) {\n this._scheduleDrawVisibleRows()\n }\n })\n },\n {\n root: null,\n rootMargin: \"100% 0px\", // Load rows 100% viewport height before/after\n threshold: 0\n }\n )\n this._intersectionObserver.observe(this.viewHTMLElement)\n }\n \n \n _cleanupViewportScrollListeners() {\n window.removeEventListener(\"scroll\", this._windowScrollHandler)\n window.removeEventListener(\"resize\", this._resizeHandler)\n if (this._intersectionObserver) {\n this._intersectionObserver.disconnect()\n this._intersectionObserver = undefined\n }\n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.visibleRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n let validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n let previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (let i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n let height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n // 1. Calculate the visible frame relative to the Table's bounds (0,0 is top-left of the table view)\n // This accounts for the Window viewport clipping the table if it is partially off-screen.\n const tableRect = this.viewHTMLElement.getBoundingClientRect()\n const viewportHeight = window.innerHeight\n const pageScale = UIView.pageScale\n \n // The top of the visible window relative to the view's top edge.\n // If tableRect.top is negative, the table is scrolled up and clipped by the window top.\n const visibleFrameTop = Math.max(0, -tableRect.top / pageScale)\n \n // The bottom of the visible window relative to the view's top edge.\n // We clip it to the table's actual bounds height so we don't look past the table content.\n const visibleFrameBottom = Math.min(\n this.bounds.height,\n (viewportHeight - tableRect.top) / pageScale\n )\n \n // If the table is completely off-screen, return empty\n if (visibleFrameBottom <= visibleFrameTop) {\n return []\n }\n \n // 2. Convert to Content Coordinates (Scroll Offset)\n // contentOffset.y is the internal scroll position.\n // If using viewport scrolling (full height), contentOffset.y is typically 0.\n // If using internal scrolling, this shifts the visible frame to the correct content rows.\n let firstVisibleY = this.contentOffset.y + visibleFrameTop\n let lastVisibleY = this.contentOffset.y + visibleFrameBottom\n \n // 3. Apply Padding\n // We calculate padding based on the viewport height to ensure smooth scrolling\n const paddingPx = (viewportHeight / pageScale) * paddingRatio\n firstVisibleY = Math.max(0, firstVisibleY - paddingPx)\n lastVisibleY = lastVisibleY + paddingPx\n \n const numberOfRows = this.numberOfRows()\n \n // 4. Find Indexes\n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n let firstIndex = Math.floor(firstVisibleY / rowHeight)\n let lastIndex = Math.floor(lastVisibleY / rowHeight)\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n const result = []\n for (let i = firstIndex; i <= lastIndex; i++) {\n result.push(i)\n }\n return result\n }\n \n // Variable Heights\n this._calculateAllPositions()\n const rowPositions = this._rowPositions\n const result = []\n \n for (let i = 0; i < numberOfRows; i++) {\n \n const position = rowPositions[i]\n if (!position) {\n break\n }\n \n const rowTop = position.topY\n const rowBottom = position.bottomY\n \n // Check intersection\n if (rowBottom >= firstVisibleY && rowTop <= lastVisibleY) {\n result.push(i)\n }\n \n if (rowTop > lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row?._UITableViewReusabilityIdentifier]?.push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _scheduleDrawVisibleRows() {\n if (!this._isDrawVisibleRowsScheduled) {\n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(() => {\n this._calculateAllPositions()\n this._drawVisibleRows()\n this.setNeedsLayout()\n this._isDrawVisibleRowsScheduled = NO\n })\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n // Uses the unified method above\n const visibleIndexes = this.indexesForVisibleRows()\n \n // If no rows are visible, remove all current rows\n if (visibleIndexes.length === 0) {\n this._removeVisibleRows()\n return\n }\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n const visibleRows: UITableViewRowView[] = []\n \n // 1. Identify rows that have moved off-screen\n this._visibleRows.forEach((row) => {\n if (IS_DEFINED(row._UITableViewRowIndex) &&\n (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex)) {\n \n // Persist state before removal\n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n removedViews.push(row)\n }\n else {\n visibleRows.push(row)\n }\n })\n \n this._visibleRows = visibleRows\n \n // 2. Add new rows that have moved on-screen\n visibleIndexes.forEach((rowIndex: number) => {\n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n \n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n })\n \n // 3. Clean up DOM\n for (let i = 0; i < removedViews.length; i++) {\n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n view.removeFromSuperview()\n }\n }\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (let i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex)\n row._UITableViewRowIndex = rowIndex\n FIRST_OR_NIL((row as unknown as UIButton).titleLabel).text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree((view: UIView) => {\n view._isPointerValid = NO\n })\n \n this._scheduleDrawVisibleRows()\n \n }\n \n override willMoveToSuperview(superview: UIView) {\n super.willMoveToSuperview(superview)\n \n if (IS(superview)) {\n // Set up viewport listeners when added to a superview\n this._setupViewportScrollAndResizeHandlersIfNeeded()\n }\n else {\n // Clean up when removed from superview\n this._cleanupViewportScrollListeners()\n }\n }\n \n override wasAddedToViewTree() {\n super.wasAddedToViewTree()\n this.loadData()\n \n // Ensure listeners are set up\n this._setupViewportScrollAndResizeHandlersIfNeeded()\n \n }\n \n override wasRemovedFromViewTree() {\n super.wasRemovedFromViewTree()\n this._cleanupViewportScrollListeners()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.sort((rowA, rowB) => rowA._UITableViewRowIndex! - rowB._UITableViewRowIndex!)\n .forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex!]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n // This is to reorder the elements in the DOM\n this.viewHTMLElement.appendChild(row.viewHTMLElement)\n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n () => {\n \n this._layoutAllRows()\n \n },\n () => {\n \n \n }\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(\n JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(() => {\n \n this._animateLayoutAllRows()\n \n })\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n let result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAmC;AACnC,sBAA2D;AAG3D,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,EAkChD,YAAY,WAAoB;AAE5B,UAAM,SAAS;AAjCnB,kCAAkC;AAClC,wBAAqC,CAAC;AACtC,mCAAgD,CAAC;AAEjD,yBAAyD,CAAC;AAE1D,yCAAwC;AAExC,0BAA0D,CAAC;AAC3D,iCAAiE,CAAC;AAGlE,uBAAsB;AACtB,mCAA0B;AAC1B,uBAAc;AAId,0BAAwB,CAAC;AACzB,kDAAyC;AACzC,uCAA8B;AAG9B,SAAS,yCAAyC;AAElD,SAAS,oBAAoB;AAsB7B,gCAAuB,MAAM;AACzB,UAAI,CAAC,KAAK,oBAAoB;AAC1B;AAAA,MACJ;AACA,WAAK,yBAAyB;AAAA,IAClC;AAEA,0BAAiB,MAAM;AACnB,UAAI,CAAC,KAAK,oBAAoB;AAC1B;AAAA,MACJ;AAEA,WAAK,cAAc,aAAa,UAAU;AAC1C,WAAK,gCAAgC;AACrC,WAAK,yBAAyB;AAAA,IAClC;AA3BI,SAAK,kBAAkB,IAAI,qBAAO;AAClC,SAAK,gBAAgB,SAAS;AAC9B,SAAK,gBAAgB,yBAAyB;AAC9C,SAAK,WAAW,KAAK,eAAe;AAEpC,SAAK,WAAW;AAEhB,SAAK,8CAA8C;AAAA,EAEvD;AAAA,EAoBA,gDAAgD;AAC5C,QAAI,KAAK,uBAAuB;AAC5B;AAAA,I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;AAEA,WAAO;AAAA,EAEX;AAGJ;",
|
|
6
|
+
"names": ["result"]
|
|
7
7
|
}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { UIColor } from "./UIColor";
|
|
2
2
|
import { UILocalizedTextObject } from "./UIInterfaces";
|
|
3
|
-
import { UIObject } from "./UIObject";
|
|
3
|
+
import { UIObject, ValueOf } from "./UIObject";
|
|
4
4
|
import { UIRectangle } from "./UIRectangle";
|
|
5
|
-
import type { ValueOf } from "./UIObject";
|
|
6
5
|
import { UIView, UIViewBroadcastEvent } from "./UIView";
|
|
7
6
|
export declare class UITextView extends UIView {
|
|
8
|
-
_textColor: UIColor;
|
|
9
|
-
_textAlignment?: ValueOf<typeof UITextView.textAlignment>;
|
|
10
|
-
_isSingleLine: boolean;
|
|
11
|
-
textPrefix: string;
|
|
12
|
-
textSuffix: string;
|
|
13
|
-
_notificationAmount: number;
|
|
14
|
-
_minFontSize?: number;
|
|
15
|
-
_maxFontSize?: number;
|
|
16
|
-
_automaticFontSizeSelection: boolean;
|
|
17
|
-
changesOften: boolean;
|
|
18
7
|
static defaultTextColor: UIColor;
|
|
19
8
|
static notificationTextColor: UIColor;
|
|
20
9
|
static _intrinsicHeightCache: {
|
|
@@ -27,24 +16,8 @@ export declare class UITextView extends UIView {
|
|
|
27
16
|
[x: string]: number;
|
|
28
17
|
};
|
|
29
18
|
} & UIObject;
|
|
30
|
-
_intrinsicHeightCache: {
|
|
31
|
-
[x: string]: {
|
|
32
|
-
[x: string]: number;
|
|
33
|
-
};
|
|
34
|
-
} & UIObject;
|
|
35
|
-
_intrinsicWidthCache: {
|
|
36
|
-
[x: string]: {
|
|
37
|
-
[x: string]: number;
|
|
38
|
-
};
|
|
39
|
-
} & UIObject;
|
|
40
19
|
static _ptToPx: number;
|
|
41
20
|
static _pxToPt: number;
|
|
42
|
-
_text?: string;
|
|
43
|
-
private _useFastMeasurement;
|
|
44
|
-
private _cachedMeasurementStyles;
|
|
45
|
-
usesVirtualLayoutingForIntrinsicSizing: boolean;
|
|
46
|
-
constructor(elementID?: string, textViewType?: string | ValueOf<typeof UITextView.type>, viewHTMLElement?: null);
|
|
47
|
-
static _determinePXAndPTRatios(): void;
|
|
48
21
|
static type: {
|
|
49
22
|
readonly paragraph: "p";
|
|
50
23
|
readonly header1: "h1";
|
|
@@ -64,6 +37,16 @@ export declare class UITextView extends UIView {
|
|
|
64
37
|
readonly right: "right";
|
|
65
38
|
readonly justify: "justify";
|
|
66
39
|
};
|
|
40
|
+
constructor(elementID?: string, textViewType?: string | ValueOf<typeof UITextView.type>, viewHTMLElement?: null);
|
|
41
|
+
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
|
|
42
|
+
willMoveToSuperview(superview: UIView): void;
|
|
43
|
+
layoutSubviews(): void;
|
|
44
|
+
private _invalidateMeasurementStyles;
|
|
45
|
+
private _getMeasurementStyles;
|
|
46
|
+
private _parseLineHeight;
|
|
47
|
+
private _shouldUseFastMeasurement;
|
|
48
|
+
setUseFastMeasurement(useFast: boolean): void;
|
|
49
|
+
invalidateMeasurementStrategy(): void;
|
|
67
50
|
get textAlignment(): ValueOf<typeof UITextView.textAlignment>;
|
|
68
51
|
set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>);
|
|
69
52
|
get textColor(): UIColor;
|
|
@@ -83,18 +66,45 @@ export declare class UITextView extends UIView {
|
|
|
83
66
|
get fontSize(): number;
|
|
84
67
|
set fontSize(fontSize: number);
|
|
85
68
|
useAutomaticFontSize(minFontSize?: number, maxFontSize?: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get a stable cache key for the font without triggering reflow.
|
|
71
|
+
* Only computes font on first access or when font properties change.
|
|
72
|
+
*/
|
|
73
|
+
private _getFontCacheKey;
|
|
74
|
+
/**
|
|
75
|
+
* Invalidate font cache when font properties change
|
|
76
|
+
*/
|
|
77
|
+
private _invalidateFontCache;
|
|
78
|
+
static _determinePXAndPTRatios(): void;
|
|
86
79
|
static automaticallyCalculatedFontSize(bounds: UIRectangle, currentSize: UIRectangle, currentFontSize: number, minFontSize?: number, maxFontSize?: number): number;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
_text?: string;
|
|
81
|
+
textPrefix: string;
|
|
82
|
+
textSuffix: string;
|
|
83
|
+
_notificationAmount: number;
|
|
84
|
+
_textColor: UIColor;
|
|
85
|
+
_textAlignment?: ValueOf<typeof UITextView.textAlignment>;
|
|
86
|
+
_isSingleLine: boolean;
|
|
87
|
+
_minFontSize?: number;
|
|
88
|
+
_maxFontSize?: number;
|
|
89
|
+
_automaticFontSizeSelection: boolean;
|
|
90
|
+
private _cachedFontKey?;
|
|
91
|
+
private _fontInvalidationTriggers;
|
|
92
|
+
changesOften: boolean;
|
|
93
|
+
_intrinsicHeightCache: {
|
|
94
|
+
[x: string]: {
|
|
95
|
+
[x: string]: number;
|
|
96
|
+
};
|
|
97
|
+
} & UIObject;
|
|
98
|
+
_intrinsicWidthCache: {
|
|
99
|
+
[x: string]: {
|
|
100
|
+
[x: string]: number;
|
|
101
|
+
};
|
|
102
|
+
} & UIObject;
|
|
103
|
+
private _useFastMeasurement;
|
|
104
|
+
private _cachedMeasurementStyles;
|
|
105
|
+
usesVirtualLayoutingForIntrinsicSizing: boolean;
|
|
90
106
|
intrinsicContentHeight(constrainingWidth?: number): any;
|
|
91
107
|
intrinsicContentWidth(constrainingHeight?: number): any;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
private _parseLineHeight;
|
|
95
|
-
intrinsicContentSizeWithConstraints(constrainingHeight?: number, constrainingWidth?: number): UIRectangle;
|
|
96
|
-
private _shouldUseFastMeasurement;
|
|
97
|
-
setUseFastMeasurement(useFast: boolean): void;
|
|
98
|
-
invalidateMeasurementStrategy(): void;
|
|
99
|
-
intrinsicContentSize(): UIRectangle;
|
|
108
|
+
addStyleClass(styleClass: string): void;
|
|
109
|
+
removeStyleClass(styleClass: string): void;
|
|
100
110
|
}
|