uicore-ts 1.1.128 → 1.1.142
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/UIObject.d.ts +1 -1
- package/compiledScripts/UIObject.js.map +1 -1
- package/compiledScripts/UIRectangle.d.ts +1 -1
- package/compiledScripts/UIRectangle.js +2 -1
- package/compiledScripts/UIRectangle.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +2 -1
- package/compiledScripts/UITableView.js +31 -8
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +7 -0
- package/compiledScripts/UIView.js +10 -1
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIObject.ts +1 -1
- package/scripts/UIRectangle.ts +2 -1
- package/scripts/UITableView.ts +34 -8
- package/scripts/UIView.ts +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uicore-ts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.142",
|
|
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/UIObject.ts
CHANGED
|
@@ -332,7 +332,7 @@ type NativeGlobal = Date | RegExp | Map<any, any> | Set<any> | WeakMap<any, any>
|
|
|
332
332
|
// 2. The value type
|
|
333
333
|
export type UIInitializerValue<T> =
|
|
334
334
|
// Handle Functions
|
|
335
|
-
T extends Function
|
|
335
|
+
T extends (Function | ((...args: any) => any))
|
|
336
336
|
//@ts-ignore
|
|
337
337
|
? UIFunctionCall<T> | UIFunctionCall<T>[] | UIFunctionExtender<T> | T
|
|
338
338
|
// Handle Arrays (do not recurse)
|
package/scripts/UIRectangle.ts
CHANGED
|
@@ -917,8 +917,9 @@ export class UIRectangle extends UIObject {
|
|
|
917
917
|
}
|
|
918
918
|
|
|
919
919
|
|
|
920
|
-
assignedAsFrameOfView(view: UIView) {
|
|
920
|
+
assignedAsFrameOfView(view: UIView, isWeakFrame = view.hasWeakFrame) {
|
|
921
921
|
view.frame = this
|
|
922
|
+
view.hasWeakFrame = isWeakFrame
|
|
922
923
|
return this
|
|
923
924
|
}
|
|
924
925
|
|
package/scripts/UITableView.ts
CHANGED
|
@@ -196,7 +196,8 @@ export class UITableView extends UINativeScrollView {
|
|
|
196
196
|
|
|
197
197
|
invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {
|
|
198
198
|
if (this._rowPositions?.[index]) {
|
|
199
|
-
this._rowPositions[index].isValid = NO
|
|
199
|
+
FIRST_OR_NIL(this._rowPositions[index]).isValid = NO
|
|
200
|
+
this._rowPositions.slice(index, -1).everyElement.isValid = NO
|
|
200
201
|
}
|
|
201
202
|
this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)
|
|
202
203
|
this._needsDrawingOfVisibleRowsBeforeLayout = YES
|
|
@@ -204,12 +205,36 @@ export class UITableView extends UINativeScrollView {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
|
|
208
|
+
_rowPositionWithIndex(index: number, positions = this._rowPositions) {
|
|
209
|
+
if (this.allRowsHaveEqualHeight && index > 0) {
|
|
210
|
+
const firstPositionObject = positions[0]
|
|
211
|
+
const rowHeight = firstPositionObject.bottomY - firstPositionObject.topY
|
|
212
|
+
const result = {
|
|
213
|
+
bottomY: rowHeight * (index + 1),
|
|
214
|
+
topY: rowHeight * index,
|
|
215
|
+
isValid: firstPositionObject.isValid
|
|
216
|
+
}
|
|
217
|
+
return result
|
|
218
|
+
}
|
|
219
|
+
return positions[index]
|
|
220
|
+
}
|
|
221
|
+
|
|
207
222
|
_calculateAllPositions() {
|
|
208
223
|
this._calculatePositionsUntilIndex(this.numberOfRows() - 1)
|
|
209
224
|
}
|
|
210
225
|
|
|
211
226
|
_calculatePositionsUntilIndex(maxIndex: number) {
|
|
212
227
|
|
|
228
|
+
if (this.allRowsHaveEqualHeight) {
|
|
229
|
+
const positionObject: UITableViewReusableViewPositionObject = {
|
|
230
|
+
bottomY: this.heightForRowWithIndex(0),
|
|
231
|
+
topY: 0,
|
|
232
|
+
isValid: YES
|
|
233
|
+
}
|
|
234
|
+
this._rowPositions = [positionObject]
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
|
|
213
238
|
let validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]
|
|
214
239
|
if (!IS(validPositionObject)) {
|
|
215
240
|
validPositionObject = {
|
|
@@ -320,12 +345,11 @@ export class UITableView extends UINativeScrollView {
|
|
|
320
345
|
|
|
321
346
|
// Variable Heights
|
|
322
347
|
this._calculateAllPositions()
|
|
323
|
-
const rowPositions = this._rowPositions
|
|
324
348
|
const result = []
|
|
325
349
|
|
|
326
350
|
for (let i = 0; i < numberOfRows; i++) {
|
|
327
351
|
|
|
328
|
-
const position =
|
|
352
|
+
const position = this._rowPositionWithIndex(i)
|
|
329
353
|
if (!position) {
|
|
330
354
|
break
|
|
331
355
|
}
|
|
@@ -624,8 +648,8 @@ export class UITableView extends UINativeScrollView {
|
|
|
624
648
|
}
|
|
625
649
|
|
|
626
650
|
|
|
627
|
-
override
|
|
628
|
-
super.
|
|
651
|
+
override clearIntrinsicSizeCache() {
|
|
652
|
+
super.clearIntrinsicSizeCache()
|
|
629
653
|
this.invalidateSizeOfRowWithIndex(0)
|
|
630
654
|
}
|
|
631
655
|
|
|
@@ -638,7 +662,7 @@ export class UITableView extends UINativeScrollView {
|
|
|
638
662
|
|
|
639
663
|
const frame = bounds.copy()
|
|
640
664
|
|
|
641
|
-
const positionObject =
|
|
665
|
+
const positionObject = this._rowPositionWithIndex(row._UITableViewRowIndex!, positions)
|
|
642
666
|
frame.min.y = positionObject.topY
|
|
643
667
|
frame.max.y = positionObject.bottomY
|
|
644
668
|
row.frame = frame
|
|
@@ -750,8 +774,10 @@ export class UITableView extends UINativeScrollView {
|
|
|
750
774
|
|
|
751
775
|
let result = 0
|
|
752
776
|
this._calculateAllPositions()
|
|
753
|
-
|
|
754
|
-
|
|
777
|
+
|
|
778
|
+
const numberOfRows = this.numberOfRows()
|
|
779
|
+
if (numberOfRows) {
|
|
780
|
+
result = this._rowPositionWithIndex(numberOfRows - 1).bottomY
|
|
755
781
|
}
|
|
756
782
|
|
|
757
783
|
return result
|
package/scripts/UIView.ts
CHANGED
|
@@ -1130,6 +1130,20 @@ export class UIView extends UIObject {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
|
+
// If YES, then the view is not counted in intrinsic content size calculation.
|
|
1134
|
+
// This should be used for things like background views that just take the shape of the parent view.
|
|
1135
|
+
hasWeakFrame = NO
|
|
1136
|
+
// Set view as having a weak frame and set the frame.
|
|
1137
|
+
public set weakFrame(rectangle: UIRectangle & { zIndex?: number }) {
|
|
1138
|
+
this.hasWeakFrame = YES
|
|
1139
|
+
this.frame = rectangle
|
|
1140
|
+
}
|
|
1141
|
+
// Set view as having a strong frame and set the frame.
|
|
1142
|
+
public set strongFrame(rectangle: UIRectangle & { zIndex?: number }) {
|
|
1143
|
+
this.hasWeakFrame = NO
|
|
1144
|
+
this.frame = rectangle
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1133
1147
|
|
|
1134
1148
|
setFrame(rectangle: UIRectangle & { zIndex?: number }, zIndex = 0, performUncheckedLayout = NO) {
|
|
1135
1149
|
|
|
@@ -3763,7 +3777,7 @@ export class UIView extends UIObject {
|
|
|
3763
3777
|
|
|
3764
3778
|
const framePoints: UIPoint[] = []
|
|
3765
3779
|
this.subviews.forEach(subview => {
|
|
3766
|
-
if (subview == this._loadingView) {
|
|
3780
|
+
if (subview == this._loadingView || subview.hasWeakFrame) {
|
|
3767
3781
|
return
|
|
3768
3782
|
}
|
|
3769
3783
|
subview.layoutIfNeeded()
|