uicore-ts 1.1.141 → 1.1.145
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/UITableView.d.ts +1 -0
- package/compiledScripts/UITableView.js +28 -6
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UITextField.js +10 -10
- package/compiledScripts/UITextField.js.map +2 -2
- package/compiledScripts/UITextView.d.ts +25 -5
- package/compiledScripts/UITextView.js +157 -57
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +4 -4
- package/compiledScripts/UIView.js +2 -1
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIObject.ts +1 -1
- package/scripts/UITableView.ts +31 -6
- package/scripts/UITextField.ts +16 -72
- package/scripts/UITextView.ts +253 -81
- package/scripts/UIView.ts +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uicore-ts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.145",
|
|
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/UITableView.ts
CHANGED
|
@@ -196,7 +196,7 @@ 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
200
|
this._rowPositions.slice(index, -1).everyElement.isValid = NO
|
|
201
201
|
}
|
|
202
202
|
this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)
|
|
@@ -205,12 +205,36 @@ export class UITableView extends UINativeScrollView {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
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
|
+
|
|
208
222
|
_calculateAllPositions() {
|
|
209
223
|
this._calculatePositionsUntilIndex(this.numberOfRows() - 1)
|
|
210
224
|
}
|
|
211
225
|
|
|
212
226
|
_calculatePositionsUntilIndex(maxIndex: number) {
|
|
213
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
|
+
|
|
214
238
|
let validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]
|
|
215
239
|
if (!IS(validPositionObject)) {
|
|
216
240
|
validPositionObject = {
|
|
@@ -321,12 +345,11 @@ export class UITableView extends UINativeScrollView {
|
|
|
321
345
|
|
|
322
346
|
// Variable Heights
|
|
323
347
|
this._calculateAllPositions()
|
|
324
|
-
const rowPositions = this._rowPositions
|
|
325
348
|
const result = []
|
|
326
349
|
|
|
327
350
|
for (let i = 0; i < numberOfRows; i++) {
|
|
328
351
|
|
|
329
|
-
const position =
|
|
352
|
+
const position = this._rowPositionWithIndex(i)
|
|
330
353
|
if (!position) {
|
|
331
354
|
break
|
|
332
355
|
}
|
|
@@ -639,7 +662,7 @@ export class UITableView extends UINativeScrollView {
|
|
|
639
662
|
|
|
640
663
|
const frame = bounds.copy()
|
|
641
664
|
|
|
642
|
-
const positionObject =
|
|
665
|
+
const positionObject = this._rowPositionWithIndex(row._UITableViewRowIndex!, positions)
|
|
643
666
|
frame.min.y = positionObject.topY
|
|
644
667
|
frame.max.y = positionObject.bottomY
|
|
645
668
|
row.frame = frame
|
|
@@ -751,8 +774,10 @@ export class UITableView extends UINativeScrollView {
|
|
|
751
774
|
|
|
752
775
|
let result = 0
|
|
753
776
|
this._calculateAllPositions()
|
|
754
|
-
|
|
755
|
-
|
|
777
|
+
|
|
778
|
+
const numberOfRows = this.numberOfRows()
|
|
779
|
+
if (numberOfRows) {
|
|
780
|
+
result = this._rowPositionWithIndex(numberOfRows - 1).bottomY
|
|
756
781
|
}
|
|
757
782
|
|
|
758
783
|
return result
|
package/scripts/UITextField.ts
CHANGED
|
@@ -12,24 +12,28 @@ export class UITextField extends UITextView {
|
|
|
12
12
|
|
|
13
13
|
override _viewHTMLElement!: HTMLInputElement
|
|
14
14
|
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
elementID?: string,
|
|
17
|
+
viewHTMLElement = null,
|
|
18
|
+
type: string | ValueOf<typeof UITextView.type> = UITextView.type.textField
|
|
19
|
+
) {
|
|
16
20
|
|
|
17
21
|
super(elementID, type, viewHTMLElement)
|
|
18
22
|
|
|
19
|
-
this.viewHTMLElement.setAttribute("type", "text")
|
|
23
|
+
this.textElementView.viewHTMLElement.setAttribute("type", "text")
|
|
20
24
|
this.backgroundColor = UIColor.whiteColor
|
|
21
25
|
this.addTargetForControlEvent(
|
|
22
26
|
UIView.controlEvent.PointerUpInside,
|
|
23
27
|
(sender, event) => sender.focus()
|
|
24
28
|
)
|
|
25
|
-
this.viewHTMLElement.oninput = (event) => {
|
|
29
|
+
this.textElementView.viewHTMLElement.oninput = (event) => {
|
|
26
30
|
this.sendControlEventForKey(UITextField.controlEvent.TextChange, event)
|
|
27
31
|
}
|
|
28
|
-
this.style.webkitUserSelect = "text"
|
|
32
|
+
this.textElementView.style.webkitUserSelect = "text"
|
|
29
33
|
this.nativeSelectionEnabled = YES
|
|
30
34
|
this.pausesPointerEvents = NO
|
|
31
35
|
this.changesOften = YES
|
|
32
|
-
|
|
36
|
+
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
|
|
@@ -50,30 +54,20 @@ export class UITextField extends UITextView {
|
|
|
50
54
|
|
|
51
55
|
|
|
52
56
|
public override set text(text: string) {
|
|
53
|
-
|
|
54
|
-
this.viewHTMLElement.value = text
|
|
55
|
-
|
|
57
|
+
this.textElementView.viewHTMLElement.value = text
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
|
|
59
60
|
public override get text(): string {
|
|
60
|
-
|
|
61
|
-
return this.viewHTMLElement.value
|
|
62
|
-
|
|
61
|
+
return this.textElementView.viewHTMLElement.value
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
|
|
66
65
|
public set placeholderText(text: string) {
|
|
67
|
-
|
|
68
|
-
this.viewHTMLElement.placeholder = text
|
|
69
|
-
|
|
66
|
+
this.textElementView.viewHTMLElement.placeholder = text
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
|
|
73
69
|
public get placeholderText(): string {
|
|
74
|
-
|
|
75
|
-
return this.viewHTMLElement.placeholder
|
|
76
|
-
|
|
70
|
+
return this.textElementView.viewHTMLElement.placeholder
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
|
|
@@ -122,67 +116,17 @@ export class UITextField extends UITextView {
|
|
|
122
116
|
|
|
123
117
|
|
|
124
118
|
public get isSecure(): boolean {
|
|
125
|
-
|
|
126
|
-
const result = (this.viewHTMLElement.type == "password")
|
|
127
|
-
|
|
119
|
+
const result = (this.textElementView.viewHTMLElement.type == "password")
|
|
128
120
|
return result
|
|
129
|
-
|
|
130
121
|
}
|
|
131
122
|
|
|
132
|
-
|
|
133
|
-
|
|
134
123
|
public set isSecure(secure: boolean) {
|
|
135
|
-
|
|
136
|
-
var type = "text"
|
|
137
|
-
|
|
124
|
+
let type = "text"
|
|
138
125
|
if (secure) {
|
|
139
|
-
|
|
140
126
|
type = "password"
|
|
141
|
-
|
|
142
127
|
}
|
|
143
|
-
|
|
144
|
-
this.viewHTMLElement.type = type
|
|
145
|
-
|
|
128
|
+
this.textElementView.viewHTMLElement.type = type
|
|
146
129
|
}
|
|
147
130
|
|
|
148
131
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
132
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|