@stemy/ngx-utils 11.2.9 → 12.0.1
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/bundles/stemy-ngx-utils.umd.js +114 -118
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js.map +1 -1
- package/esm2015/ngx-utils/plugins/resize-event.plugin.js +16 -19
- package/esm2015/ngx-utils/plugins/scroll-event.plugin.js +1 -17
- package/esm2015/ngx-utils/services/acl.service.js +1 -1
- package/esm2015/ngx-utils/services/base-http.service.js +1 -1
- package/esm2015/ngx-utils/services/config.service.js +1 -1
- package/esm2015/ngx-utils/services/open-api.service.js +1 -1
- package/esm2015/ngx-utils/utils/observable.utils.js +12 -6
- package/fesm2015/stemy-ngx-utils.js +84 -96
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/plugins/resize-event.plugin.d.ts +0 -1
- package/ngx-utils/plugins/scroll-event.plugin.d.ts +0 -1
- package/ngx-utils/utils/observable.utils.d.ts +1 -0
- package/package.json +14 -14
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -1485,6 +1485,57 @@ __decorate([
|
|
|
1485
1485
|
FactoryDependencies(AUTH_SERVICE, StateService)
|
|
1486
1486
|
], AuthGuard, "guardAuthStateField", null);
|
|
1487
1487
|
|
|
1488
|
+
class TimerUtils {
|
|
1489
|
+
static createTimeout(func, time) {
|
|
1490
|
+
// @dynamic
|
|
1491
|
+
const run = (timer) => {
|
|
1492
|
+
timer.clear();
|
|
1493
|
+
timer.id = setTimeout(() => {
|
|
1494
|
+
timer.id = null;
|
|
1495
|
+
timer.func();
|
|
1496
|
+
}, timer.time);
|
|
1497
|
+
};
|
|
1498
|
+
// @dynamic
|
|
1499
|
+
const clear = (timer) => {
|
|
1500
|
+
if (!timer.id)
|
|
1501
|
+
return;
|
|
1502
|
+
clearTimeout(timer.id);
|
|
1503
|
+
timer.id = null;
|
|
1504
|
+
};
|
|
1505
|
+
return TimerUtils.createTimer(run, clear, func, time);
|
|
1506
|
+
}
|
|
1507
|
+
static createInterval(func, time) {
|
|
1508
|
+
// @dynamic
|
|
1509
|
+
const run = (timer) => {
|
|
1510
|
+
timer.clear();
|
|
1511
|
+
timer.id = setInterval(timer.func, timer.time);
|
|
1512
|
+
};
|
|
1513
|
+
// @dynamic
|
|
1514
|
+
const clear = (timer) => {
|
|
1515
|
+
if (!timer.id)
|
|
1516
|
+
return;
|
|
1517
|
+
clearInterval(timer.id);
|
|
1518
|
+
timer.id = null;
|
|
1519
|
+
};
|
|
1520
|
+
return TimerUtils.createTimer(run, clear, func, time);
|
|
1521
|
+
}
|
|
1522
|
+
static createTimer(run, clear, func, time) {
|
|
1523
|
+
const timer = {};
|
|
1524
|
+
const setParams = (func, time) => {
|
|
1525
|
+
timer.func = !ObjectUtils.isFunction(func) ? (() => { }) : func;
|
|
1526
|
+
timer.time = !ObjectUtils.isNumber(time) ? 100 : time;
|
|
1527
|
+
};
|
|
1528
|
+
timer.run = () => run(timer);
|
|
1529
|
+
timer.clear = () => clear(timer);
|
|
1530
|
+
timer.set = (func, time) => {
|
|
1531
|
+
setParams(func, time);
|
|
1532
|
+
timer.run();
|
|
1533
|
+
};
|
|
1534
|
+
setParams(func, time);
|
|
1535
|
+
return timer;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1488
1539
|
class ObservableUtils {
|
|
1489
1540
|
static toSearch(search) {
|
|
1490
1541
|
return mergeMap(
|
|
@@ -1508,18 +1559,23 @@ class ObservableUtils {
|
|
|
1508
1559
|
const subscriptions = [];
|
|
1509
1560
|
subscribers.forEach(info => {
|
|
1510
1561
|
let alreadyCalled = false;
|
|
1562
|
+
const timer = info.timeout > 0 ? TimerUtils.createTimeout() : 0;
|
|
1563
|
+
const cb = timer ? function () {
|
|
1564
|
+
const args = Array.from(arguments);
|
|
1565
|
+
timer.set(() => {
|
|
1566
|
+
info.cb.apply(null, args);
|
|
1567
|
+
}, info.timeout);
|
|
1568
|
+
} : info.cb;
|
|
1511
1569
|
info.subjects.forEach(subject => {
|
|
1512
|
-
const ss = subject.subscribe(
|
|
1513
|
-
const args = Array.from(arguments);
|
|
1514
|
-
args.unshift(subject);
|
|
1570
|
+
const ss = subject.subscribe((value) => {
|
|
1515
1571
|
alreadyCalled = true;
|
|
1516
|
-
|
|
1572
|
+
cb.call(null, subject, value);
|
|
1517
1573
|
});
|
|
1518
1574
|
subscriptions.push(ss);
|
|
1519
1575
|
});
|
|
1520
1576
|
if (alreadyCalled)
|
|
1521
1577
|
return;
|
|
1522
|
-
|
|
1578
|
+
cb();
|
|
1523
1579
|
});
|
|
1524
1580
|
return ObservableUtils.multiSubscription(...subscriptions);
|
|
1525
1581
|
}
|
|
@@ -1686,57 +1742,6 @@ class SetUtils {
|
|
|
1686
1742
|
}
|
|
1687
1743
|
}
|
|
1688
1744
|
|
|
1689
|
-
class TimerUtils {
|
|
1690
|
-
static createTimeout(func, time) {
|
|
1691
|
-
// @dynamic
|
|
1692
|
-
const run = (timer) => {
|
|
1693
|
-
timer.clear();
|
|
1694
|
-
timer.id = setTimeout(() => {
|
|
1695
|
-
timer.id = null;
|
|
1696
|
-
timer.func();
|
|
1697
|
-
}, timer.time);
|
|
1698
|
-
};
|
|
1699
|
-
// @dynamic
|
|
1700
|
-
const clear = (timer) => {
|
|
1701
|
-
if (!timer.id)
|
|
1702
|
-
return;
|
|
1703
|
-
clearTimeout(timer.id);
|
|
1704
|
-
timer.id = null;
|
|
1705
|
-
};
|
|
1706
|
-
return TimerUtils.createTimer(run, clear, func, time);
|
|
1707
|
-
}
|
|
1708
|
-
static createInterval(func, time) {
|
|
1709
|
-
// @dynamic
|
|
1710
|
-
const run = (timer) => {
|
|
1711
|
-
timer.clear();
|
|
1712
|
-
timer.id = setInterval(timer.func, timer.time);
|
|
1713
|
-
};
|
|
1714
|
-
// @dynamic
|
|
1715
|
-
const clear = (timer) => {
|
|
1716
|
-
if (!timer.id)
|
|
1717
|
-
return;
|
|
1718
|
-
clearInterval(timer.id);
|
|
1719
|
-
timer.id = null;
|
|
1720
|
-
};
|
|
1721
|
-
return TimerUtils.createTimer(run, clear, func, time);
|
|
1722
|
-
}
|
|
1723
|
-
static createTimer(run, clear, func, time) {
|
|
1724
|
-
const timer = {};
|
|
1725
|
-
const setParams = (func, time) => {
|
|
1726
|
-
timer.func = !ObjectUtils.isFunction(func) ? (() => { }) : func;
|
|
1727
|
-
timer.time = !ObjectUtils.isNumber(time) ? 100 : time;
|
|
1728
|
-
};
|
|
1729
|
-
timer.run = () => run(timer);
|
|
1730
|
-
timer.clear = () => clear(timer);
|
|
1731
|
-
timer.set = (func, time) => {
|
|
1732
|
-
setParams(func, time);
|
|
1733
|
-
timer.run();
|
|
1734
|
-
};
|
|
1735
|
-
setParams(func, time);
|
|
1736
|
-
return timer;
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
1745
|
class UniqueUtils {
|
|
1741
1746
|
static uuid() {
|
|
1742
1747
|
if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
|
|
@@ -3107,7 +3112,10 @@ PromiseService.ctorParameters = () => [
|
|
|
3107
3112
|
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] }
|
|
3108
3113
|
];
|
|
3109
3114
|
|
|
3110
|
-
function emptyRemove() {
|
|
3115
|
+
function emptyRemove$1() {
|
|
3116
|
+
}
|
|
3117
|
+
function isWindow(el) {
|
|
3118
|
+
return typeof window !== "undefined" && el === window;
|
|
3111
3119
|
}
|
|
3112
3120
|
class ResizeEventPlugin extends ɵangular_packages_platform_browser_platform_browser_g {
|
|
3113
3121
|
constructor(doc, universal) {
|
|
@@ -3121,35 +3129,30 @@ class ResizeEventPlugin extends ɵangular_packages_platform_browser_platform_bro
|
|
|
3121
3129
|
const zone = this.manager.getZone();
|
|
3122
3130
|
return zone.runOutsideAngular(() => {
|
|
3123
3131
|
if (this.universal.isServer)
|
|
3124
|
-
return emptyRemove;
|
|
3132
|
+
return emptyRemove$1;
|
|
3125
3133
|
const cb = el => {
|
|
3126
3134
|
zone.run(() => handler(el));
|
|
3127
3135
|
};
|
|
3128
|
-
|
|
3136
|
+
if (isWindow(element)) {
|
|
3137
|
+
element.addEventListener(eventName, cb);
|
|
3138
|
+
}
|
|
3139
|
+
else {
|
|
3140
|
+
addListener(element, cb);
|
|
3141
|
+
}
|
|
3129
3142
|
return () => {
|
|
3130
3143
|
try {
|
|
3131
|
-
|
|
3144
|
+
if (isWindow(element)) {
|
|
3145
|
+
element.removeEventListener(eventName, cb);
|
|
3146
|
+
}
|
|
3147
|
+
else {
|
|
3148
|
+
removeListener(element, cb);
|
|
3149
|
+
}
|
|
3132
3150
|
}
|
|
3133
3151
|
catch (e) {
|
|
3134
3152
|
}
|
|
3135
3153
|
};
|
|
3136
3154
|
});
|
|
3137
3155
|
}
|
|
3138
|
-
addGlobalEventListener(element, eventName, handler) {
|
|
3139
|
-
const zone = this.manager.getZone();
|
|
3140
|
-
return zone.runOutsideAngular(() => {
|
|
3141
|
-
if (this.universal.isServer)
|
|
3142
|
-
return emptyRemove;
|
|
3143
|
-
if (!StringUtils.has(element, "document", "window")) {
|
|
3144
|
-
console.error("Global resize event other than window or document?", element);
|
|
3145
|
-
return emptyRemove;
|
|
3146
|
-
}
|
|
3147
|
-
const target = "window" == element ? window : document;
|
|
3148
|
-
const listener = handler;
|
|
3149
|
-
target.addEventListener(eventName, listener);
|
|
3150
|
-
return () => target.removeEventListener(eventName, listener);
|
|
3151
|
-
});
|
|
3152
|
-
}
|
|
3153
3156
|
}
|
|
3154
3157
|
ResizeEventPlugin.EVENT_NAME = "resize";
|
|
3155
3158
|
ResizeEventPlugin.decorators = [
|
|
@@ -3160,7 +3163,7 @@ ResizeEventPlugin.ctorParameters = () => [
|
|
|
3160
3163
|
{ type: UniversalService }
|
|
3161
3164
|
];
|
|
3162
3165
|
|
|
3163
|
-
function emptyRemove
|
|
3166
|
+
function emptyRemove() {
|
|
3164
3167
|
}
|
|
3165
3168
|
class ScrollEventPlugin extends ɵangular_packages_platform_browser_platform_browser_g {
|
|
3166
3169
|
constructor(doc, universal) {
|
|
@@ -3174,7 +3177,7 @@ class ScrollEventPlugin extends ɵangular_packages_platform_browser_platform_bro
|
|
|
3174
3177
|
const zone = this.manager.getZone();
|
|
3175
3178
|
return zone.runOutsideAngular(() => {
|
|
3176
3179
|
if (this.universal.isServer)
|
|
3177
|
-
return emptyRemove
|
|
3180
|
+
return emptyRemove;
|
|
3178
3181
|
const callback = (e) => {
|
|
3179
3182
|
zone.run(() => handler(e));
|
|
3180
3183
|
};
|
|
@@ -3182,21 +3185,6 @@ class ScrollEventPlugin extends ɵangular_packages_platform_browser_platform_bro
|
|
|
3182
3185
|
return () => element.removeEventListener(eventName, callback);
|
|
3183
3186
|
});
|
|
3184
3187
|
}
|
|
3185
|
-
addGlobalEventListener(element, eventName, handler) {
|
|
3186
|
-
const zone = this.manager.getZone();
|
|
3187
|
-
return zone.runOutsideAngular(() => {
|
|
3188
|
-
if (this.universal.isServer)
|
|
3189
|
-
return emptyRemove$1;
|
|
3190
|
-
if (!StringUtils.has(element, "document", "window")) {
|
|
3191
|
-
console.error("Global resize event other than window or document?", element);
|
|
3192
|
-
return emptyRemove$1;
|
|
3193
|
-
}
|
|
3194
|
-
const target = "window" == element ? window : document;
|
|
3195
|
-
const listener = handler;
|
|
3196
|
-
target.addEventListener(eventName, listener);
|
|
3197
|
-
return () => target.removeEventListener(eventName, listener);
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
3188
|
}
|
|
3201
3189
|
ScrollEventPlugin.EVENT_NAME = "scroll";
|
|
3202
3190
|
ScrollEventPlugin.decorators = [
|
|
@@ -3274,11 +3262,11 @@ ExtraItemPropertiesPipe.decorators = [
|
|
|
3274
3262
|
},] }
|
|
3275
3263
|
];
|
|
3276
3264
|
|
|
3277
|
-
function defaultFilter() {
|
|
3265
|
+
function defaultFilter$1() {
|
|
3278
3266
|
return true;
|
|
3279
3267
|
}
|
|
3280
3268
|
class FilterPipe {
|
|
3281
|
-
transform(values, filter = defaultFilter, params = {}) {
|
|
3269
|
+
transform(values, filter = defaultFilter$1, params = {}) {
|
|
3282
3270
|
const isObject = ObjectUtils.isObject(values);
|
|
3283
3271
|
if (!isObject && !ObjectUtils.isArray(values))
|
|
3284
3272
|
return [];
|
|
@@ -3310,11 +3298,11 @@ FilterPipe.decorators = [
|
|
|
3310
3298
|
},] }
|
|
3311
3299
|
];
|
|
3312
3300
|
|
|
3313
|
-
function defaultFilter
|
|
3301
|
+
function defaultFilter() {
|
|
3314
3302
|
return true;
|
|
3315
3303
|
}
|
|
3316
3304
|
class FindPipe {
|
|
3317
|
-
transform(values, filter = defaultFilter
|
|
3305
|
+
transform(values, filter = defaultFilter, params = {}) {
|
|
3318
3306
|
if (!ObjectUtils.isArray(values))
|
|
3319
3307
|
return [];
|
|
3320
3308
|
const filterFunc = ObjectUtils.isFunction(filter) ? filter : (value, index, params) => {
|