uicore-ts 1.0.580 → 1.1.0
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/UIKeyValueStringFilterWebWorker.worker.js.map +2 -2
- package/compiledScripts/UILinkButton.js +3 -1
- package/compiledScripts/UILinkButton.js.map +2 -2
- package/compiledScripts/UITextField.d.ts +1 -2
- package/compiledScripts/UITextField.js +0 -3
- package/compiledScripts/UITextField.js.map +2 -2
- package/compiledScripts/UIView.d.ts +1 -1
- package/compiledScripts/UIView.js +35 -26
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIKeyValueStringFilterWebWorker.worker.ts +2 -2
- package/scripts/UILinkButton.ts +3 -1
- package/scripts/UITextField.ts +0 -4
- package/scripts/UIView.ts +52 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uicore-ts",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
if ("contains" in Array.prototype == false) {
|
|
4
4
|
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
Array.prototype.contains = function (element) {
|
|
6
|
+
Array.prototype.contains = function (this: Array, element) {
|
|
7
7
|
|
|
8
8
|
var result = (this.indexOf(element) != -1)
|
|
9
9
|
return result
|
|
@@ -15,7 +15,7 @@ if ("contains" in Array.prototype == false) {
|
|
|
15
15
|
if ("contains" in String.prototype == false) {
|
|
16
16
|
|
|
17
17
|
// @ts-ignore
|
|
18
|
-
String.prototype.contains = function (string) {
|
|
18
|
+
String.prototype.contains = function (this: string, string) {
|
|
19
19
|
|
|
20
20
|
var result = (this.indexOf(string) != -1)
|
|
21
21
|
return result
|
package/scripts/UILinkButton.ts
CHANGED
|
@@ -15,7 +15,9 @@ export class UILinkButton extends UILink {
|
|
|
15
15
|
this.addSubview(this.button)
|
|
16
16
|
|
|
17
17
|
this.style.position = "absolute"
|
|
18
|
-
this.button.controlEventTargetAccumulator.EnterDown.PointerUpInside
|
|
18
|
+
this.button.controlEventTargetAccumulator.EnterDown.PointerUpInside(
|
|
19
|
+
() => window.location = this.target as any
|
|
20
|
+
)
|
|
19
21
|
|
|
20
22
|
}
|
|
21
23
|
|
package/scripts/UITextField.ts
CHANGED
|
@@ -47,10 +47,6 @@ export class UITextField extends UITextView {
|
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField> {
|
|
51
|
-
return (super.controlEventTargetAccumulator as any)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
public override get viewHTMLElement() {
|
|
55
51
|
return this._viewHTMLElement
|
|
56
52
|
}
|
package/scripts/UIView.ts
CHANGED
|
@@ -111,14 +111,20 @@ type Mutable<T> = {
|
|
|
111
111
|
-readonly [P in keyof T]: T[P]
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
// export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
|
|
115
|
+
//
|
|
116
|
+
// [K in keyof T["controlEvent"]]: ((
|
|
117
|
+
// sender: UIView,
|
|
118
|
+
// event: Event
|
|
119
|
+
// ) => void) & Partial<UIViewAddControlEventTargetObject<T>>
|
|
120
|
+
//
|
|
121
|
+
// }>
|
|
122
|
+
|
|
114
123
|
export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
) => void) & Partial<UIViewAddControlEventTargetObject<T>>
|
|
120
|
-
|
|
121
|
-
}>
|
|
124
|
+
[K in keyof T["controlEvent"]]: UIViewAddControlEventTargetObject<T> & (
|
|
125
|
+
(handler: (sender: T, event: Event) => void) => void
|
|
126
|
+
);
|
|
127
|
+
}>;
|
|
122
128
|
|
|
123
129
|
|
|
124
130
|
interface Constraint {
|
|
@@ -2167,8 +2173,8 @@ export class UIView extends UIObject {
|
|
|
2167
2173
|
|
|
2168
2174
|
}
|
|
2169
2175
|
|
|
2170
|
-
this.controlEventTargetAccumulator.PointerDrag
|
|
2171
|
-
this.controlEventTargetAccumulator.PointerUp.PointerCancel
|
|
2176
|
+
this.controlEventTargetAccumulator.PointerDrag(movementFunction)
|
|
2177
|
+
this.controlEventTargetAccumulator.PointerUp.PointerCancel(movementStopFunction)
|
|
2172
2178
|
|
|
2173
2179
|
//UIObject.configureWithObject(overlayElement, { remove: EXTEND(() => cleanupFunction()) })
|
|
2174
2180
|
|
|
@@ -2383,8 +2389,8 @@ export class UIView extends UIObject {
|
|
|
2383
2389
|
shouldCallPointerHover: async () => YES,
|
|
2384
2390
|
pausesPointerEvents: YES
|
|
2385
2391
|
})
|
|
2386
|
-
leftEdge.controlEventTargetAccumulator.PointerDrag
|
|
2387
|
-
leftEdge.controlEventTargetAccumulator.PointerUp
|
|
2392
|
+
leftEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 1))
|
|
2393
|
+
leftEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2388
2394
|
|
|
2389
2395
|
const rightEdge = new UIView().configuredWithObject({
|
|
2390
2396
|
_viewHTMLElement: {
|
|
@@ -2404,8 +2410,8 @@ export class UIView extends UIObject {
|
|
|
2404
2410
|
shouldCallPointerHover: async () => YES,
|
|
2405
2411
|
pausesPointerEvents: YES
|
|
2406
2412
|
})
|
|
2407
|
-
rightEdge.controlEventTargetAccumulator.PointerDrag
|
|
2408
|
-
rightEdge.controlEventTargetAccumulator.PointerUp
|
|
2413
|
+
rightEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 0))
|
|
2414
|
+
rightEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2409
2415
|
|
|
2410
2416
|
// noinspection JSSuspiciousNameCombination
|
|
2411
2417
|
const bottomEdge = new UIView().configuredWithObject({
|
|
@@ -2426,8 +2432,8 @@ export class UIView extends UIObject {
|
|
|
2426
2432
|
shouldCallPointerHover: async () => YES,
|
|
2427
2433
|
pausesPointerEvents: YES
|
|
2428
2434
|
})
|
|
2429
|
-
bottomEdge.controlEventTargetAccumulator.PointerDrag
|
|
2430
|
-
bottomEdge.controlEventTargetAccumulator.PointerUp
|
|
2435
|
+
bottomEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 0))
|
|
2436
|
+
bottomEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2431
2437
|
|
|
2432
2438
|
// noinspection JSSuspiciousNameCombination
|
|
2433
2439
|
const topEdge = new UIView().configuredWithObject({
|
|
@@ -2448,8 +2454,8 @@ export class UIView extends UIObject {
|
|
|
2448
2454
|
shouldCallPointerHover: async () => YES,
|
|
2449
2455
|
pausesPointerEvents: YES
|
|
2450
2456
|
})
|
|
2451
|
-
topEdge.controlEventTargetAccumulator.PointerDrag
|
|
2452
|
-
topEdge.controlEventTargetAccumulator.PointerUp
|
|
2457
|
+
topEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 1))
|
|
2458
|
+
topEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2453
2459
|
|
|
2454
2460
|
|
|
2455
2461
|
const pointerDragTLFunction = (sender: UIView, event: Event) => {
|
|
@@ -2477,8 +2483,8 @@ export class UIView extends UIObject {
|
|
|
2477
2483
|
shouldCallPointerHover: async () => YES,
|
|
2478
2484
|
pausesPointerEvents: YES
|
|
2479
2485
|
})
|
|
2480
|
-
topLeftCornerTop.controlEventTargetAccumulator.PointerDrag
|
|
2481
|
-
topLeftCornerTop.controlEventTargetAccumulator.PointerUp
|
|
2486
|
+
topLeftCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
|
|
2487
|
+
topLeftCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2482
2488
|
|
|
2483
2489
|
const topLeftCornerLeft = new UIView().configuredWithObject({
|
|
2484
2490
|
_viewHTMLElement: {
|
|
@@ -2499,8 +2505,8 @@ export class UIView extends UIObject {
|
|
|
2499
2505
|
shouldCallPointerHover: async () => YES,
|
|
2500
2506
|
pausesPointerEvents: YES
|
|
2501
2507
|
})
|
|
2502
|
-
topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag
|
|
2503
|
-
topLeftCornerLeft.controlEventTargetAccumulator.PointerUp
|
|
2508
|
+
topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
|
|
2509
|
+
topLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2504
2510
|
|
|
2505
2511
|
|
|
2506
2512
|
const pointerDragBLFunction = (sender: UIView, event: Event) => {
|
|
@@ -2527,8 +2533,8 @@ export class UIView extends UIObject {
|
|
|
2527
2533
|
shouldCallPointerHover: async () => YES,
|
|
2528
2534
|
pausesPointerEvents: YES
|
|
2529
2535
|
})
|
|
2530
|
-
bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag
|
|
2531
|
-
bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp
|
|
2536
|
+
bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
|
|
2537
|
+
bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2532
2538
|
|
|
2533
2539
|
// noinspection JSSuspiciousNameCombination
|
|
2534
2540
|
const bottomLeftCornerBottom = new UIView().configuredWithObject({
|
|
@@ -2550,8 +2556,8 @@ export class UIView extends UIObject {
|
|
|
2550
2556
|
shouldCallPointerHover: async () => YES,
|
|
2551
2557
|
pausesPointerEvents: YES
|
|
2552
2558
|
})
|
|
2553
|
-
bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag
|
|
2554
|
-
bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp
|
|
2559
|
+
bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
|
|
2560
|
+
bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2555
2561
|
|
|
2556
2562
|
|
|
2557
2563
|
const pointerDragBRFunction = (sender: UIView, event: Event) => {
|
|
@@ -2579,8 +2585,8 @@ export class UIView extends UIObject {
|
|
|
2579
2585
|
shouldCallPointerHover: async () => YES,
|
|
2580
2586
|
pausesPointerEvents: YES
|
|
2581
2587
|
})
|
|
2582
|
-
bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag
|
|
2583
|
-
bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp
|
|
2588
|
+
bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
|
|
2589
|
+
bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2584
2590
|
|
|
2585
2591
|
const bottomRightCornerRight = new UIView().configuredWithObject({
|
|
2586
2592
|
_viewHTMLElement: {
|
|
@@ -2601,8 +2607,8 @@ export class UIView extends UIObject {
|
|
|
2601
2607
|
shouldCallPointerHover: async () => YES,
|
|
2602
2608
|
pausesPointerEvents: YES
|
|
2603
2609
|
})
|
|
2604
|
-
bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag
|
|
2605
|
-
bottomRightCornerRight.controlEventTargetAccumulator.PointerUp
|
|
2610
|
+
bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
|
|
2611
|
+
bottomRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2606
2612
|
|
|
2607
2613
|
|
|
2608
2614
|
const pointerDragTRFunction = (sender: UIView, event: Event) => {
|
|
@@ -2629,8 +2635,8 @@ export class UIView extends UIObject {
|
|
|
2629
2635
|
shouldCallPointerHover: async () => YES,
|
|
2630
2636
|
pausesPointerEvents: YES
|
|
2631
2637
|
})
|
|
2632
|
-
topRightCornerRight.controlEventTargetAccumulator.PointerDrag
|
|
2633
|
-
topRightCornerRight.controlEventTargetAccumulator.PointerUp
|
|
2638
|
+
topRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
|
|
2639
|
+
topRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2634
2640
|
|
|
2635
2641
|
// noinspection JSSuspiciousNameCombination
|
|
2636
2642
|
const topRightCornerTop = new UIView().configuredWithObject({
|
|
@@ -2652,8 +2658,8 @@ export class UIView extends UIObject {
|
|
|
2652
2658
|
shouldCallPointerHover: async () => YES,
|
|
2653
2659
|
pausesPointerEvents: YES
|
|
2654
2660
|
})
|
|
2655
|
-
topRightCornerTop.controlEventTargetAccumulator.PointerDrag
|
|
2656
|
-
topRightCornerTop.controlEventTargetAccumulator.PointerUp
|
|
2661
|
+
topRightCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
|
|
2662
|
+
topRightCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
|
|
2657
2663
|
|
|
2658
2664
|
|
|
2659
2665
|
const views = [
|
|
@@ -3197,6 +3203,19 @@ export class UIView extends UIObject {
|
|
|
3197
3203
|
|
|
3198
3204
|
return result
|
|
3199
3205
|
|
|
3206
|
+
},
|
|
3207
|
+
apply: (_target, _thisArg, args) => {
|
|
3208
|
+
|
|
3209
|
+
const handler = args[0];
|
|
3210
|
+
if (typeof handler === 'function') {
|
|
3211
|
+
this.addTargetForControlEvents(eventKeys, handler);
|
|
3212
|
+
}
|
|
3213
|
+
else {
|
|
3214
|
+
throw "Handler must be a function, not " + handler
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
return true
|
|
3218
|
+
|
|
3200
3219
|
},
|
|
3201
3220
|
set: (target, key: string, value, _receiver) => {
|
|
3202
3221
|
|