uicore-ts 1.0.237 → 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 +96 -27
- package/compiledScripts/UIView.js.map +3 -3
- package/package.json +1 -1
- package/scripts/UIView.ts +197 -30
|
@@ -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
|
}
|
|
@@ -1167,8 +1220,9 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1167
1220
|
};
|
|
1168
1221
|
const PointerXDragFunction = (centeredOnPosition, sender, event) => {
|
|
1169
1222
|
if (event instanceof MouseEvent) {
|
|
1223
|
+
const scaleX = this.viewHTMLElement.getBoundingClientRect().width / this.viewHTMLElement.offsetWidth;
|
|
1170
1224
|
const signMultiplier = 1 - 2 * centeredOnPosition;
|
|
1171
|
-
let movementX = event.movementX;
|
|
1225
|
+
let movementX = event.movementX / scaleX;
|
|
1172
1226
|
if (xOverflow * signMultiplier > 0 && 0 > movementX) {
|
|
1173
1227
|
xOverflow = (xOverflow + movementX / _UIView.pageScale).integerValue;
|
|
1174
1228
|
if (xOverflow >= 0) {
|
|
@@ -1208,8 +1262,9 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1208
1262
|
};
|
|
1209
1263
|
const PointerYDragFunction = (centeredOnPosition, sender, event) => {
|
|
1210
1264
|
if (event instanceof MouseEvent) {
|
|
1265
|
+
const scaleX = this.viewHTMLElement.getBoundingClientRect().width / this.viewHTMLElement.offsetWidth;
|
|
1211
1266
|
const signMultiplier = 1 - 2 * centeredOnPosition;
|
|
1212
|
-
let movementY = event.movementY;
|
|
1267
|
+
let movementY = event.movementY / scaleX;
|
|
1213
1268
|
if (yOverflow * signMultiplier > 0 && 0 > movementY) {
|
|
1214
1269
|
yOverflow = (yOverflow + movementY / _UIView.pageScale).integerValue;
|
|
1215
1270
|
if (yOverflow >= 0) {
|
|
@@ -1584,37 +1639,37 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1584
1639
|
this._isResizable = import_UIObject.NO;
|
|
1585
1640
|
};
|
|
1586
1641
|
}
|
|
1587
|
-
static shouldCallPointerUpInsideOnView(view) {
|
|
1642
|
+
static shouldCallPointerUpInsideOnView(view, event) {
|
|
1588
1643
|
return __async(this, null, function* () {
|
|
1589
1644
|
return import_UIObject.YES;
|
|
1590
1645
|
});
|
|
1591
1646
|
}
|
|
1592
|
-
static shouldCallPointerHoverOnView(view) {
|
|
1647
|
+
static shouldCallPointerHoverOnView(view, event) {
|
|
1593
1648
|
return __async(this, null, function* () {
|
|
1594
1649
|
return import_UIObject.YES;
|
|
1595
1650
|
});
|
|
1596
1651
|
}
|
|
1597
|
-
static shouldCallPointerLeaveOnView(view) {
|
|
1652
|
+
static shouldCallPointerLeaveOnView(view, event) {
|
|
1598
1653
|
return __async(this, null, function* () {
|
|
1599
1654
|
return import_UIObject.YES;
|
|
1600
1655
|
});
|
|
1601
1656
|
}
|
|
1602
|
-
static shouldCallPointerCancelOnView(view) {
|
|
1657
|
+
static shouldCallPointerCancelOnView(view, event) {
|
|
1603
1658
|
return __async(this, null, function* () {
|
|
1604
1659
|
return import_UIObject.YES;
|
|
1605
1660
|
});
|
|
1606
1661
|
}
|
|
1607
|
-
shouldCallPointerUpInside() {
|
|
1608
|
-
return _UIView.shouldCallPointerUpInsideOnView(this);
|
|
1662
|
+
shouldCallPointerUpInside(event) {
|
|
1663
|
+
return _UIView.shouldCallPointerUpInsideOnView(this, event);
|
|
1609
1664
|
}
|
|
1610
|
-
shouldCallPointerCancel() {
|
|
1611
|
-
return _UIView.shouldCallPointerCancelOnView(this);
|
|
1665
|
+
shouldCallPointerCancel(event) {
|
|
1666
|
+
return _UIView.shouldCallPointerCancelOnView(this, event);
|
|
1612
1667
|
}
|
|
1613
|
-
shouldCallPointerHover() {
|
|
1614
|
-
return _UIView.shouldCallPointerHoverOnView(this);
|
|
1668
|
+
shouldCallPointerHover(event) {
|
|
1669
|
+
return _UIView.shouldCallPointerHoverOnView(this, event);
|
|
1615
1670
|
}
|
|
1616
|
-
shouldCallPointerLeave() {
|
|
1617
|
-
return _UIView.shouldCallPointerLeaveOnView(this);
|
|
1671
|
+
shouldCallPointerLeave(event) {
|
|
1672
|
+
return _UIView.shouldCallPointerLeaveOnView(this, event);
|
|
1618
1673
|
}
|
|
1619
1674
|
_loadUIEvents() {
|
|
1620
1675
|
const isTouchEventClassDefined = import_UIObject.NO || window.TouchEvent;
|
|
@@ -1669,7 +1724,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1669
1724
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1670
1725
|
return;
|
|
1671
1726
|
}
|
|
1672
|
-
if (this._isPointerInside && (yield this.shouldCallPointerUpInside())) {
|
|
1727
|
+
if (this._isPointerInside && (yield this.shouldCallPointerUpInside(event))) {
|
|
1673
1728
|
onPointerUpInside(event);
|
|
1674
1729
|
if (!this._hasPointerDragged) {
|
|
1675
1730
|
this.sendControlEventForKey(_UIView.controlEvent.PointerTap, event);
|
|
@@ -1683,7 +1738,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1683
1738
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1684
1739
|
return;
|
|
1685
1740
|
}
|
|
1686
|
-
if (yield this.shouldCallPointerLeave()) {
|
|
1741
|
+
if (yield this.shouldCallPointerLeave(event)) {
|
|
1687
1742
|
this.sendControlEventForKey(_UIView.controlEvent.PointerLeave, event);
|
|
1688
1743
|
}
|
|
1689
1744
|
this._isPointerInside = import_UIObject.NO;
|
|
@@ -1694,7 +1749,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1694
1749
|
if (this.ignoresTouches && isTouchEventClassDefined && event instanceof TouchEvent || this.ignoresMouse && event instanceof MouseEvent) {
|
|
1695
1750
|
return;
|
|
1696
1751
|
}
|
|
1697
|
-
if (yield this.shouldCallPointerHover()) {
|
|
1752
|
+
if (yield this.shouldCallPointerHover(event)) {
|
|
1698
1753
|
this.sendControlEventForKey(_UIView.controlEvent.PointerHover, event);
|
|
1699
1754
|
}
|
|
1700
1755
|
this._isPointerInside = import_UIObject.YES;
|
|
@@ -1752,7 +1807,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1752
1807
|
}
|
|
1753
1808
|
if (this._isPointerInside && this.viewHTMLElement != document.elementFromPoint(touch.clientX, touch.clientY)) {
|
|
1754
1809
|
this._isPointerInside = import_UIObject.NO;
|
|
1755
|
-
if (yield this.shouldCallPointerLeave()) {
|
|
1810
|
+
if (yield this.shouldCallPointerLeave(event)) {
|
|
1756
1811
|
this.sendControlEventForKey(_UIView.controlEvent.PointerLeave, event);
|
|
1757
1812
|
}
|
|
1758
1813
|
}
|
|
@@ -1783,7 +1838,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1783
1838
|
this._isPointerValid = import_UIObject.NO;
|
|
1784
1839
|
this._isPointerValidForMovement = import_UIObject.NO;
|
|
1785
1840
|
this._isPointerDown = import_UIObject.NO;
|
|
1786
|
-
if (yield this.shouldCallPointerCancel()) {
|
|
1841
|
+
if (yield this.shouldCallPointerCancel(event)) {
|
|
1787
1842
|
this.sendControlEventForKey(_UIView.controlEvent.PointerCancel, event);
|
|
1788
1843
|
}
|
|
1789
1844
|
});
|
|
@@ -2109,6 +2164,20 @@ const windowTouchFunction = () => {
|
|
|
2109
2164
|
};
|
|
2110
2165
|
window.addEventListener("touchmove", UIView._onWindowTouchMove, true);
|
|
2111
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);
|
|
2112
2181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2113
2182
|
0 && (module.exports = {
|
|
2114
2183
|
UIView
|