uicore-ts 1.0.238 → 1.0.251
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/UIView.d.ts +8 -8
- package/compiledScripts/UIView.js +92 -25
- package/compiledScripts/UIView.js.map +3 -3
- package/package.json +1 -1
- package/scripts/UIView.ts +193 -28
|
@@ -299,14 +299,14 @@ export declare class UIView extends UIObject {
|
|
|
299
299
|
maxCornerSize?: string;
|
|
300
300
|
viewDidChangeToSize?: (view: UIView, isMovementCompleted: boolean) => void;
|
|
301
301
|
}): void;
|
|
302
|
-
static shouldCallPointerUpInsideOnView(view: UIView): Promise<boolean>;
|
|
303
|
-
static shouldCallPointerHoverOnView(view: UIView): Promise<boolean>;
|
|
304
|
-
static shouldCallPointerLeaveOnView(view: UIView): Promise<boolean>;
|
|
305
|
-
static shouldCallPointerCancelOnView(view: UIView): Promise<boolean>;
|
|
306
|
-
shouldCallPointerUpInside(): Promise<boolean>;
|
|
307
|
-
shouldCallPointerCancel(): Promise<boolean>;
|
|
308
|
-
shouldCallPointerHover(): Promise<boolean>;
|
|
309
|
-
shouldCallPointerLeave(): Promise<boolean>;
|
|
302
|
+
static shouldCallPointerUpInsideOnView(view: UIView, event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
303
|
+
static shouldCallPointerHoverOnView(view: UIView, event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
304
|
+
static shouldCallPointerLeaveOnView(view: UIView, event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
305
|
+
static shouldCallPointerCancelOnView(view: UIView, event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
306
|
+
shouldCallPointerUpInside(event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
307
|
+
shouldCallPointerCancel(event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
308
|
+
shouldCallPointerHover(event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
309
|
+
shouldCallPointerLeave(event: MouseEvent | TouchEvent): Promise<boolean>;
|
|
310
310
|
protected _loadUIEvents(): void;
|
|
311
311
|
static controlEvent: {
|
|
312
312
|
PointerDown: string;
|
|
@@ -55,6 +55,7 @@ var import_UICoreExtensions = require("./UICoreExtensions");
|
|
|
55
55
|
var import_UIObject = require("./UIObject");
|
|
56
56
|
var import_UIPoint = require("./UIPoint");
|
|
57
57
|
var import_UIRectangle = require("./UIRectangle");
|
|
58
|
+
var import_UIViewController = require("./UIViewController");
|
|
58
59
|
if (!window.AutoLayout) {
|
|
59
60
|
window.AutoLayout = import_UIObject.nil;
|
|
60
61
|
}
|
|
@@ -270,17 +271,69 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
270
271
|
}
|
|
271
272
|
get propertyDescriptors() {
|
|
272
273
|
let result = [];
|
|
274
|
+
function isPlainObject(value) {
|
|
275
|
+
return value instanceof Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
276
|
+
}
|
|
277
|
+
function isAnArray(value) {
|
|
278
|
+
return value instanceof Array && Object.getPrototypeOf(value) === Array.prototype;
|
|
279
|
+
}
|
|
273
280
|
this.withAllSuperviews.forEach((view) => {
|
|
274
|
-
(
|
|
275
|
-
|
|
276
|
-
|
|
281
|
+
const descriptorFromObject = function(object, pathRootObject = object, existingPathComponents = [], lookInArrays = import_UIObject.YES, depthLeft = 5) {
|
|
282
|
+
var _a, _b;
|
|
283
|
+
let resultDescriptor;
|
|
284
|
+
const subObjects = [];
|
|
285
|
+
const subArrays = [];
|
|
286
|
+
(0, import_UIObject.FIRST_OR_NIL)(object).forEach((value, key, stopLooping) => {
|
|
287
|
+
if (this == value) {
|
|
288
|
+
existingPathComponents.push(key);
|
|
289
|
+
resultDescriptor = { object: pathRootObject, name: existingPathComponents.join(".") };
|
|
290
|
+
stopLooping();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (isPlainObject(value) && !_UIViewPropertyKeys.contains(key) && !_UIViewControllerPropertyKeys.contains(key)) {
|
|
294
|
+
subObjects.push({ object: value, key });
|
|
295
|
+
}
|
|
296
|
+
if (lookInArrays && isAnArray(value) && !_UIViewPropertyKeys.contains(key) && !_UIViewControllerPropertyKeys.contains(key)) {
|
|
297
|
+
subArrays.push({ array: value, key });
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
if (!resultDescriptor && lookInArrays) {
|
|
301
|
+
subArrays.copy().forEach((value) => {
|
|
302
|
+
if (value.key.startsWith("_")) {
|
|
303
|
+
subArrays.removeElement(value);
|
|
304
|
+
subArrays.push(value);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
subArrays.find(
|
|
308
|
+
(arrayObject) => arrayObject.array.find((value, index) => {
|
|
309
|
+
if (this == value) {
|
|
310
|
+
existingPathComponents.push(arrayObject.key + "." + index);
|
|
311
|
+
resultDescriptor = { object: pathRootObject, name: existingPathComponents.join(".") };
|
|
312
|
+
return import_UIObject.YES;
|
|
313
|
+
}
|
|
314
|
+
return import_UIObject.NO;
|
|
315
|
+
})
|
|
316
|
+
);
|
|
277
317
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (this == value) {
|
|
281
|
-
result.push({ object: view, name: key });
|
|
318
|
+
if (((_b = (_a = resultDescriptor == null ? void 0 : resultDescriptor.object) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) == "Object") {
|
|
319
|
+
var asd = 1;
|
|
282
320
|
}
|
|
283
|
-
|
|
321
|
+
const result2 = {
|
|
322
|
+
descriptor: resultDescriptor,
|
|
323
|
+
subObjects
|
|
324
|
+
};
|
|
325
|
+
return result2;
|
|
326
|
+
}.bind(this);
|
|
327
|
+
const viewControllerResult = descriptorFromObject(view.viewController);
|
|
328
|
+
if (viewControllerResult == null ? void 0 : viewControllerResult.descriptor) {
|
|
329
|
+
result.push(viewControllerResult.descriptor);
|
|
330
|
+
}
|
|
331
|
+
const viewResult = descriptorFromObject(view);
|
|
332
|
+
if (viewResult == null ? void 0 : viewResult.descriptor) {
|
|
333
|
+
result.push(viewResult.descriptor);
|
|
334
|
+
} else if (this.superview && this.superview == view) {
|
|
335
|
+
result.push({ object: view, key: "subviews." + view.subviews.indexOf(this) });
|
|
336
|
+
}
|
|
284
337
|
});
|
|
285
338
|
return result;
|
|
286
339
|
}
|
|
@@ -1586,37 +1639,37 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1586
1639
|
this._isResizable = import_UIObject.NO;
|
|
1587
1640
|
};
|
|
1588
1641
|
}
|
|
1589
|
-
static shouldCallPointerUpInsideOnView(view) {
|
|
1642
|
+
static shouldCallPointerUpInsideOnView(view, event) {
|
|
1590
1643
|
return __async(this, null, function* () {
|
|
1591
1644
|
return import_UIObject.YES;
|
|
1592
1645
|
});
|
|
1593
1646
|
}
|
|
1594
|
-
static shouldCallPointerHoverOnView(view) {
|
|
1647
|
+
static shouldCallPointerHoverOnView(view, event) {
|
|
1595
1648
|
return __async(this, null, function* () {
|
|
1596
1649
|
return import_UIObject.YES;
|
|
1597
1650
|
});
|
|
1598
1651
|
}
|
|
1599
|
-
static shouldCallPointerLeaveOnView(view) {
|
|
1652
|
+
static shouldCallPointerLeaveOnView(view, event) {
|
|
1600
1653
|
return __async(this, null, function* () {
|
|
1601
1654
|
return import_UIObject.YES;
|
|
1602
1655
|
});
|
|
1603
1656
|
}
|
|
1604
|
-
static shouldCallPointerCancelOnView(view) {
|
|
1657
|
+
static shouldCallPointerCancelOnView(view, event) {
|
|
1605
1658
|
return __async(this, null, function* () {
|
|
1606
1659
|
return import_UIObject.YES;
|
|
1607
1660
|
});
|
|
1608
1661
|
}
|
|
1609
|
-
shouldCallPointerUpInside() {
|
|
1610
|
-
return _UIView.shouldCallPointerUpInsideOnView(this);
|
|
1662
|
+
shouldCallPointerUpInside(event) {
|
|
1663
|
+
return _UIView.shouldCallPointerUpInsideOnView(this, event);
|
|
1611
1664
|
}
|
|
1612
|
-
shouldCallPointerCancel() {
|
|
1613
|
-
return _UIView.shouldCallPointerCancelOnView(this);
|
|
1665
|
+
shouldCallPointerCancel(event) {
|
|
1666
|
+
return _UIView.shouldCallPointerCancelOnView(this, event);
|
|
1614
1667
|
}
|
|
1615
|
-
shouldCallPointerHover() {
|
|
1616
|
-
return _UIView.shouldCallPointerHoverOnView(this);
|
|
1668
|
+
shouldCallPointerHover(event) {
|
|
1669
|
+
return _UIView.shouldCallPointerHoverOnView(this, event);
|
|
1617
1670
|
}
|
|
1618
|
-
shouldCallPointerLeave() {
|
|
1619
|
-
return _UIView.shouldCallPointerLeaveOnView(this);
|
|
1671
|
+
shouldCallPointerLeave(event) {
|
|
1672
|
+
return _UIView.shouldCallPointerLeaveOnView(this, event);
|
|
1620
1673
|
}
|
|
1621
1674
|
_loadUIEvents() {
|
|
1622
1675
|
const isTouchEventClassDefined = import_UIObject.NO || window.TouchEvent;
|
|
@@ -1671,7 +1724,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1671
1724
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1672
1725
|
return;
|
|
1673
1726
|
}
|
|
1674
|
-
if (this._isPointerInside && (yield this.shouldCallPointerUpInside())) {
|
|
1727
|
+
if (this._isPointerInside && (yield this.shouldCallPointerUpInside(event))) {
|
|
1675
1728
|
onPointerUpInside(event);
|
|
1676
1729
|
if (!this._hasPointerDragged) {
|
|
1677
1730
|
this.sendControlEventForKey(_UIView.controlEvent.PointerTap, event);
|
|
@@ -1685,7 +1738,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1685
1738
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1686
1739
|
return;
|
|
1687
1740
|
}
|
|
1688
|
-
if (yield this.shouldCallPointerLeave()) {
|
|
1741
|
+
if (yield this.shouldCallPointerLeave(event)) {
|
|
1689
1742
|
this.sendControlEventForKey(_UIView.controlEvent.PointerLeave, event);
|
|
1690
1743
|
}
|
|
1691
1744
|
this._isPointerInside = import_UIObject.NO;
|
|
@@ -1696,7 +1749,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1696
1749
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1697
1750
|
return;
|
|
1698
1751
|
}
|
|
1699
|
-
if (yield this.shouldCallPointerHover()) {
|
|
1752
|
+
if (yield this.shouldCallPointerHover(event)) {
|
|
1700
1753
|
this.sendControlEventForKey(_UIView.controlEvent.PointerHover, event);
|
|
1701
1754
|
}
|
|
1702
1755
|
this._isPointerInside = import_UIObject.YES;
|
|
@@ -1754,7 +1807,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1754
1807
|
}
|
|
1755
1808
|
if (this._isPointerInside && this.viewHTMLElement != document.elementFromPoint(touch.clientX, touch.clientY)) {
|
|
1756
1809
|
this._isPointerInside = import_UIObject.NO;
|
|
1757
|
-
if (yield this.shouldCallPointerLeave()) {
|
|
1810
|
+
if (yield this.shouldCallPointerLeave(event)) {
|
|
1758
1811
|
this.sendControlEventForKey(_UIView.controlEvent.PointerLeave, event);
|
|
1759
1812
|
}
|
|
1760
1813
|
}
|
|
@@ -1785,7 +1838,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1785
1838
|
this._isPointerValid = import_UIObject.NO;
|
|
1786
1839
|
this._isPointerValidForMovement = import_UIObject.NO;
|
|
1787
1840
|
this._isPointerDown = import_UIObject.NO;
|
|
1788
|
-
if (yield this.shouldCallPointerCancel()) {
|
|
1841
|
+
if (yield this.shouldCallPointerCancel(event)) {
|
|
1789
1842
|
this.sendControlEventForKey(_UIView.controlEvent.PointerCancel, event);
|
|
1790
1843
|
}
|
|
1791
1844
|
});
|
|
@@ -2111,6 +2164,20 @@ const windowTouchFunction = () => {
|
|
|
2111
2164
|
};
|
|
2112
2165
|
window.addEventListener("touchmove", UIView._onWindowTouchMove, true);
|
|
2113
2166
|
window.addEventListener("mouseup", windowTouchFunction, true);
|
|
2167
|
+
function props(obj) {
|
|
2168
|
+
const p = [];
|
|
2169
|
+
for (; obj != null; obj = Object.getPrototypeOf(obj)) {
|
|
2170
|
+
const op = Object.getOwnPropertyNames(obj);
|
|
2171
|
+
for (let i = 0; i < op.length; i++) {
|
|
2172
|
+
if (p.indexOf(op[i]) == -1) {
|
|
2173
|
+
p.push(op[i]);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
return p;
|
|
2178
|
+
}
|
|
2179
|
+
const _UIViewPropertyKeys = props(UIView.prototype).concat(new UIView().allKeys);
|
|
2180
|
+
const _UIViewControllerPropertyKeys = props(import_UIViewController.UIViewController.prototype).concat(new import_UIViewController.UIViewController(import_UIObject.nil).allKeys);
|
|
2114
2181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2115
2182
|
0 && (module.exports = {
|
|
2116
2183
|
UIView
|