uicore-ts 1.1.126 → 1.1.127
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.
|
@@ -51,7 +51,7 @@ export declare class UITableView extends UINativeScrollView {
|
|
|
51
51
|
_markReusableViewAsUnused(row: UIView): void;
|
|
52
52
|
_scheduleDrawVisibleRows(): void;
|
|
53
53
|
_drawVisibleRows(): void;
|
|
54
|
-
visibleRowWithIndex(rowIndex: number | undefined): UIView;
|
|
54
|
+
visibleRowWithIndex(rowIndex: number | undefined): UIView | undefined;
|
|
55
55
|
isRowWithIndexVisible(rowIndex: number): boolean;
|
|
56
56
|
reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView;
|
|
57
57
|
newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView;
|
|
@@ -66,6 +66,7 @@ export declare class UITableView extends UINativeScrollView {
|
|
|
66
66
|
wasRemovedFromViewTree(): void;
|
|
67
67
|
setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean): void;
|
|
68
68
|
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
|
|
69
|
+
setNeedsLayout(): void;
|
|
69
70
|
private _layoutAllRows;
|
|
70
71
|
private _animateLayoutAllRows;
|
|
71
72
|
layoutSubviews(): void;
|
|
@@ -117,15 +117,19 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
newIndexes.forEach((index) => {
|
|
120
|
+
var _a;
|
|
120
121
|
if (this.isRowWithIndexVisible(index)) {
|
|
121
|
-
this.highlightRowAsNew(
|
|
122
|
+
this.highlightRowAsNew(
|
|
123
|
+
(_a = this.visibleRowWithIndex(index)) != null ? _a : this.viewForRowWithIndex(index)
|
|
124
|
+
);
|
|
122
125
|
}
|
|
123
126
|
});
|
|
124
127
|
}
|
|
125
128
|
highlightRowAsNew(row) {
|
|
126
129
|
}
|
|
127
130
|
invalidateSizeOfRowWithIndex(index, animateChange = import_UIObject.NO) {
|
|
128
|
-
|
|
131
|
+
var _a;
|
|
132
|
+
if ((_a = this._rowPositions) == null ? void 0 : _a[index]) {
|
|
129
133
|
this._rowPositions[index].isValid = import_UIObject.NO;
|
|
130
134
|
}
|
|
131
135
|
this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1);
|
|
@@ -153,6 +157,8 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
153
157
|
const rowPositionObject = this._rowPositions[i];
|
|
154
158
|
if ((0, import_UIObject.IS)((rowPositionObject || import_UIObject.nil).isValid)) {
|
|
155
159
|
height = rowPositionObject.bottomY - rowPositionObject.topY;
|
|
160
|
+
} else if (this.allRowsHaveEqualHeight && i > 0) {
|
|
161
|
+
height = this._rowPositions[0].bottomY - this._rowPositions[0].topY;
|
|
156
162
|
} else {
|
|
157
163
|
height = this.heightForRowWithIndex(i);
|
|
158
164
|
}
|
|
@@ -309,7 +315,6 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
309
315
|
return row;
|
|
310
316
|
}
|
|
311
317
|
}
|
|
312
|
-
return import_UIObject.nil;
|
|
313
318
|
}
|
|
314
319
|
isRowWithIndexVisible(rowIndex) {
|
|
315
320
|
return (0, import_UIObject.IS)(this.visibleRowWithIndex(rowIndex));
|
|
@@ -395,6 +400,10 @@ class UITableView extends import_UINativeScrollView.UINativeScrollView {
|
|
|
395
400
|
this.reloadData();
|
|
396
401
|
}
|
|
397
402
|
}
|
|
403
|
+
setNeedsLayout() {
|
|
404
|
+
super.setNeedsLayout();
|
|
405
|
+
this.invalidateSizeOfRowWithIndex(0);
|
|
406
|
+
}
|
|
398
407
|
_layoutAllRows(positions = this._rowPositions) {
|
|
399
408
|
const bounds = this.bounds;
|
|
400
409
|
this._visibleRows.sort((rowA, rowB) => rowA._UITableViewRowIndex - rowB._UITableViewRowIndex).forEach((row) => {
|
|
@@ -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 // 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,IACJ;AAEA,WAAO,iBAAiB,UAAU,KAAK,sBAAsB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
|
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(\n this.visibleRowWithIndex(index) as UIView ?? this.viewForRowWithIndex(index) as UIView\n )\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n if (this._rowPositions?.[index]) {\n this._rowPositions[index].isValid = NO\n }\n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n this._shouldAnimateNextLayout = animateChange\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 if (!this._rowPositions.length) {\n this._highestValidRowPositionIndex = -1\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 height = rowPositionObject.bottomY - rowPositionObject.topY\n }\n // Do not calculate heights if all rows have equal heights, and we already have a height\n else if (this.allRowsHaveEqualHeight && i > 0) {\n height = this._rowPositions[0].bottomY - this._rowPositions[0].topY\n }\n else {\n height = this.heightForRowWithIndex(i)\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 | undefined {\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 }\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 override setNeedsLayout() {\n super.setNeedsLayout()\n this.invalidateSizeOfRowWithIndex(0)\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 let result = 0\n this._calculateAllPositions()\n if (this._rowPositions.length) {\n result = this._rowPositions[this._rowPositions.length - 1].bottomY\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;AAA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,sBAAsB;AAAA,MAE/B;AAGA,WAAK,2BAA2B;AAAA,IAEpC,OACK;AAED,WAAK,uBAAuB;AAE5B,WAAK,eAAe;AAAA,IAGxB;AAAA,EAGJ;AAAA,EAGS,uBAAuB,oBAAoB,GAAG;AAEnD,QAAI,SAAS;AACb,SAAK,uBAAuB;AAC5B,QAAI,KAAK,cAAc,QAAQ;AAC3B,eAAS,KAAK,cAAc,KAAK,cAAc,SAAS,GAAG;AAAA,IAC/D;AAEA,WAAO;AAAA,EAEX;AAGJ;",
|
|
6
6
|
"names": ["result"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uicore-ts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.127",
|
|
4
4
|
"description": "UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework that is used in IOS. In addition, UICore has tools to handle URL based routing, array sorting and filtering and adds a number of other utilities for convenience.",
|
|
5
5
|
"main": "compiledScripts/index.js",
|
|
6
6
|
"types": "compiledScripts/index.d.ts",
|
package/scripts/UITableView.ts
CHANGED
|
@@ -178,7 +178,9 @@ export class UITableView extends UINativeScrollView {
|
|
|
178
178
|
newIndexes.forEach(index => {
|
|
179
179
|
|
|
180
180
|
if (this.isRowWithIndexVisible(index)) {
|
|
181
|
-
this.highlightRowAsNew(
|
|
181
|
+
this.highlightRowAsNew(
|
|
182
|
+
this.visibleRowWithIndex(index) as UIView ?? this.viewForRowWithIndex(index) as UIView
|
|
183
|
+
)
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
})
|
|
@@ -193,17 +195,12 @@ export class UITableView extends UINativeScrollView {
|
|
|
193
195
|
|
|
194
196
|
|
|
195
197
|
invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {
|
|
196
|
-
|
|
197
|
-
if (this._rowPositions[index]) {
|
|
198
|
+
if (this._rowPositions?.[index]) {
|
|
198
199
|
this._rowPositions[index].isValid = NO
|
|
199
200
|
}
|
|
200
|
-
|
|
201
201
|
this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)
|
|
202
|
-
|
|
203
202
|
this._needsDrawingOfVisibleRowsBeforeLayout = YES
|
|
204
|
-
|
|
205
203
|
this._shouldAnimateNextLayout = animateChange
|
|
206
|
-
|
|
207
204
|
}
|
|
208
205
|
|
|
209
206
|
|
|
@@ -223,11 +220,8 @@ export class UITableView extends UINativeScrollView {
|
|
|
223
220
|
}
|
|
224
221
|
|
|
225
222
|
let previousBottomY = validPositionObject.bottomY
|
|
226
|
-
|
|
227
223
|
if (!this._rowPositions.length) {
|
|
228
|
-
|
|
229
224
|
this._highestValidRowPositionIndex = -1
|
|
230
|
-
|
|
231
225
|
}
|
|
232
226
|
|
|
233
227
|
for (let i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {
|
|
@@ -237,17 +231,16 @@ export class UITableView extends UINativeScrollView {
|
|
|
237
231
|
const rowPositionObject = this._rowPositions[i]
|
|
238
232
|
|
|
239
233
|
if (IS((rowPositionObject || nil).isValid)) {
|
|
240
|
-
|
|
241
234
|
height = rowPositionObject.bottomY - rowPositionObject.topY
|
|
242
|
-
|
|
235
|
+
}
|
|
236
|
+
// Do not calculate heights if all rows have equal heights, and we already have a height
|
|
237
|
+
else if (this.allRowsHaveEqualHeight && i > 0) {
|
|
238
|
+
height = this._rowPositions[0].bottomY - this._rowPositions[0].topY
|
|
243
239
|
}
|
|
244
240
|
else {
|
|
245
|
-
|
|
246
241
|
height = this.heightForRowWithIndex(i)
|
|
247
|
-
|
|
248
242
|
}
|
|
249
243
|
|
|
250
|
-
|
|
251
244
|
const positionObject: UITableViewReusableViewPositionObject = {
|
|
252
245
|
bottomY: previousBottomY + height,
|
|
253
246
|
topY: previousBottomY,
|
|
@@ -476,14 +469,13 @@ export class UITableView extends UINativeScrollView {
|
|
|
476
469
|
}
|
|
477
470
|
|
|
478
471
|
|
|
479
|
-
visibleRowWithIndex(rowIndex: number | undefined): UIView {
|
|
472
|
+
visibleRowWithIndex(rowIndex: number | undefined): UIView | undefined {
|
|
480
473
|
for (let i = 0; i < this._visibleRows.length; i++) {
|
|
481
474
|
const row = this._visibleRows[i]
|
|
482
475
|
if (row._UITableViewRowIndex == rowIndex) {
|
|
483
476
|
return row
|
|
484
477
|
}
|
|
485
478
|
}
|
|
486
|
-
return nil
|
|
487
479
|
}
|
|
488
480
|
|
|
489
481
|
|
|
@@ -632,6 +624,11 @@ export class UITableView extends UINativeScrollView {
|
|
|
632
624
|
}
|
|
633
625
|
|
|
634
626
|
|
|
627
|
+
override setNeedsLayout() {
|
|
628
|
+
super.setNeedsLayout()
|
|
629
|
+
this.invalidateSizeOfRowWithIndex(0)
|
|
630
|
+
}
|
|
631
|
+
|
|
635
632
|
private _layoutAllRows(positions = this._rowPositions) {
|
|
636
633
|
|
|
637
634
|
const bounds = this.bounds
|
|
@@ -751,15 +748,10 @@ export class UITableView extends UINativeScrollView {
|
|
|
751
748
|
|
|
752
749
|
override intrinsicContentHeight(constrainingWidth = 0) {
|
|
753
750
|
|
|
754
|
-
|
|
755
751
|
let result = 0
|
|
756
|
-
|
|
757
752
|
this._calculateAllPositions()
|
|
758
|
-
|
|
759
753
|
if (this._rowPositions.length) {
|
|
760
|
-
|
|
761
754
|
result = this._rowPositions[this._rowPositions.length - 1].bottomY
|
|
762
|
-
|
|
763
755
|
}
|
|
764
756
|
|
|
765
757
|
return result
|