@stemy/ngx-utils 12.0.0 → 12.0.3
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 +259 -220
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/common-types.js +2 -1
- package/esm2015/ngx-utils/directives/global-template.directive.js +8 -8
- package/esm2015/ngx-utils/ngx-utils.module.js +6 -2
- package/esm2015/ngx-utils/pipes/global-template.pipe.js +7 -5
- 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/global-template.service.js +2 -2
- package/esm2015/ngx-utils/services/state.service.js +53 -15
- package/esm2015/public_api.js +2 -3
- package/esm2015/stemy-ngx-utils.js +2 -1
- package/fesm2015/stemy-ngx-utils.js +187 -160
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +12 -1
- package/ngx-utils/directives/global-template.directive.d.ts +3 -3
- package/ngx-utils/ngx-utils.module.d.ts +1 -1
- package/ngx-utils/pipes/global-template.pipe.d.ts +3 -3
- 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/services/global-template.service.d.ts +2 -2
- package/ngx-utils/services/state.service.d.ts +11 -6
- package/package.json +1 -1
- package/public_api.d.ts +1 -2
- package/stemy-ngx-utils.d.ts +1 -0
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -792,6 +792,7 @@
|
|
|
792
792
|
var SCRIPT_PARAMS = new core.InjectionToken("script-params");
|
|
793
793
|
var ROOT_ELEMENT = new core.InjectionToken("app-root-element");
|
|
794
794
|
var ERROR_HANDLER = new core.InjectionToken("error-handler-callback");
|
|
795
|
+
var GLOBAL_TEMPLATES = new core.InjectionToken("global-templates");
|
|
795
796
|
// --- Valued promise ---
|
|
796
797
|
var ValuedPromise = /** @class */ (function (_super) {
|
|
797
798
|
__extends(ValuedPromise, _super);
|
|
@@ -1683,6 +1684,135 @@
|
|
|
1683
1684
|
return MathUtils;
|
|
1684
1685
|
}());
|
|
1685
1686
|
|
|
1687
|
+
/**
|
|
1688
|
+
* Use this service to determine which is the current environment
|
|
1689
|
+
*/
|
|
1690
|
+
var UniversalService = /** @class */ (function () {
|
|
1691
|
+
function UniversalService(platformId, dds) {
|
|
1692
|
+
this.platformId = platformId;
|
|
1693
|
+
this.dds = dds;
|
|
1694
|
+
var info = this.dds.getDeviceInfo();
|
|
1695
|
+
this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST)/gi.test(info.userAgent);
|
|
1696
|
+
}
|
|
1697
|
+
Object.defineProperty(UniversalService.prototype, "isBrowser", {
|
|
1698
|
+
get: function () {
|
|
1699
|
+
return common.isPlatformBrowser(this.platformId);
|
|
1700
|
+
},
|
|
1701
|
+
enumerable: false,
|
|
1702
|
+
configurable: true
|
|
1703
|
+
});
|
|
1704
|
+
Object.defineProperty(UniversalService.prototype, "isServer", {
|
|
1705
|
+
get: function () {
|
|
1706
|
+
return common.isPlatformServer(this.platformId);
|
|
1707
|
+
},
|
|
1708
|
+
enumerable: false,
|
|
1709
|
+
configurable: true
|
|
1710
|
+
});
|
|
1711
|
+
Object.defineProperty(UniversalService.prototype, "deviceInfo", {
|
|
1712
|
+
get: function () {
|
|
1713
|
+
return this.isServer
|
|
1714
|
+
? {
|
|
1715
|
+
userAgent: "angular-universal",
|
|
1716
|
+
os: "unknown",
|
|
1717
|
+
browser: "node",
|
|
1718
|
+
device: "node",
|
|
1719
|
+
os_version: "unknown",
|
|
1720
|
+
browser_version: "unknown",
|
|
1721
|
+
deviceType: "unknown",
|
|
1722
|
+
orientation: "landscape"
|
|
1723
|
+
}
|
|
1724
|
+
: this.dds.getDeviceInfo();
|
|
1725
|
+
},
|
|
1726
|
+
enumerable: false,
|
|
1727
|
+
configurable: true
|
|
1728
|
+
});
|
|
1729
|
+
Object.defineProperty(UniversalService.prototype, "browserName", {
|
|
1730
|
+
get: function () {
|
|
1731
|
+
return this.dds.browser;
|
|
1732
|
+
},
|
|
1733
|
+
enumerable: false,
|
|
1734
|
+
configurable: true
|
|
1735
|
+
});
|
|
1736
|
+
Object.defineProperty(UniversalService.prototype, "browserVersion", {
|
|
1737
|
+
get: function () {
|
|
1738
|
+
return this.dds.browser_version;
|
|
1739
|
+
},
|
|
1740
|
+
enumerable: false,
|
|
1741
|
+
configurable: true
|
|
1742
|
+
});
|
|
1743
|
+
Object.defineProperty(UniversalService.prototype, "isExplorer", {
|
|
1744
|
+
get: function () {
|
|
1745
|
+
return this.dds.browser == "ie";
|
|
1746
|
+
},
|
|
1747
|
+
enumerable: false,
|
|
1748
|
+
configurable: true
|
|
1749
|
+
});
|
|
1750
|
+
Object.defineProperty(UniversalService.prototype, "isEdge", {
|
|
1751
|
+
get: function () {
|
|
1752
|
+
return this.dds.browser == "ms-edge";
|
|
1753
|
+
},
|
|
1754
|
+
enumerable: false,
|
|
1755
|
+
configurable: true
|
|
1756
|
+
});
|
|
1757
|
+
Object.defineProperty(UniversalService.prototype, "isChrome", {
|
|
1758
|
+
get: function () {
|
|
1759
|
+
return this.dds.browser == "chrome";
|
|
1760
|
+
},
|
|
1761
|
+
enumerable: false,
|
|
1762
|
+
configurable: true
|
|
1763
|
+
});
|
|
1764
|
+
Object.defineProperty(UniversalService.prototype, "isFirefox", {
|
|
1765
|
+
get: function () {
|
|
1766
|
+
return this.dds.browser == "firefox";
|
|
1767
|
+
},
|
|
1768
|
+
enumerable: false,
|
|
1769
|
+
configurable: true
|
|
1770
|
+
});
|
|
1771
|
+
Object.defineProperty(UniversalService.prototype, "isSafari", {
|
|
1772
|
+
get: function () {
|
|
1773
|
+
return this.dds.browser == "safari";
|
|
1774
|
+
},
|
|
1775
|
+
enumerable: false,
|
|
1776
|
+
configurable: true
|
|
1777
|
+
});
|
|
1778
|
+
Object.defineProperty(UniversalService.prototype, "isTablet", {
|
|
1779
|
+
get: function () {
|
|
1780
|
+
return this.dds.isTablet();
|
|
1781
|
+
},
|
|
1782
|
+
enumerable: false,
|
|
1783
|
+
configurable: true
|
|
1784
|
+
});
|
|
1785
|
+
Object.defineProperty(UniversalService.prototype, "isMobile", {
|
|
1786
|
+
get: function () {
|
|
1787
|
+
return this.dds.isMobile();
|
|
1788
|
+
},
|
|
1789
|
+
enumerable: false,
|
|
1790
|
+
configurable: true
|
|
1791
|
+
});
|
|
1792
|
+
Object.defineProperty(UniversalService.prototype, "isDesktop", {
|
|
1793
|
+
get: function () {
|
|
1794
|
+
return this.dds.isDesktop();
|
|
1795
|
+
},
|
|
1796
|
+
enumerable: false,
|
|
1797
|
+
configurable: true
|
|
1798
|
+
});
|
|
1799
|
+
Object.defineProperty(UniversalService.prototype, "isCrawler", {
|
|
1800
|
+
get: function () {
|
|
1801
|
+
return this.crawler;
|
|
1802
|
+
},
|
|
1803
|
+
enumerable: false,
|
|
1804
|
+
configurable: true
|
|
1805
|
+
});
|
|
1806
|
+
return UniversalService;
|
|
1807
|
+
}());
|
|
1808
|
+
UniversalService.decorators = [
|
|
1809
|
+
{ type: core.Injectable }
|
|
1810
|
+
];
|
|
1811
|
+
UniversalService.ctorParameters = function () { return [
|
|
1812
|
+
{ type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
|
|
1813
|
+
{ type: ngxDeviceDetector.DeviceDetectorService }
|
|
1814
|
+
]; };
|
|
1815
|
+
|
|
1686
1816
|
var emptySnapshot = new router.ActivatedRouteSnapshot();
|
|
1687
1817
|
var emptyData = { id: "" };
|
|
1688
1818
|
var emptyParams = {};
|
|
@@ -1690,11 +1820,12 @@
|
|
|
1690
1820
|
var emptyComponents = [];
|
|
1691
1821
|
var StateService = /** @class */ (function (_super) {
|
|
1692
1822
|
__extends(StateService, _super);
|
|
1693
|
-
function StateService(injector, zone, router$1) {
|
|
1823
|
+
function StateService(injector, zone, universal, router$1) {
|
|
1694
1824
|
if (router$1 === void 0) { router$1 = null; }
|
|
1695
1825
|
var _this = _super.call(this, null) || this;
|
|
1696
1826
|
_this.injector = injector;
|
|
1697
1827
|
_this.zone = zone;
|
|
1828
|
+
_this.universal = universal;
|
|
1698
1829
|
_this.router = router$1;
|
|
1699
1830
|
_this.handleRouterEvent = function (event) {
|
|
1700
1831
|
if (!(event instanceof router.NavigationEnd))
|
|
@@ -1865,27 +1996,75 @@
|
|
|
1865
1996
|
});
|
|
1866
1997
|
});
|
|
1867
1998
|
};
|
|
1868
|
-
StateService.prototype.
|
|
1869
|
-
if (
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1999
|
+
StateService.prototype.navigateByUrl = function (url, navigationExtras) {
|
|
2000
|
+
if (navigationExtras === void 0) { navigationExtras = {}; }
|
|
2001
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2002
|
+
return __generator(this, function (_a) {
|
|
2003
|
+
return [2 /*return*/, this.navigate(url, navigationExtras)];
|
|
2004
|
+
});
|
|
2005
|
+
});
|
|
1874
2006
|
};
|
|
1875
|
-
StateService.prototype.
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2007
|
+
StateService.prototype.navigate = function (url, navigationExtras) {
|
|
2008
|
+
if (navigationExtras === void 0) { navigationExtras = {}; }
|
|
2009
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2010
|
+
var _a, tree, extras;
|
|
2011
|
+
var _this = this;
|
|
2012
|
+
return __generator(this, function (_b) {
|
|
2013
|
+
if (!this.router)
|
|
2014
|
+
return [2 /*return*/, false];
|
|
2015
|
+
_a = __read(this.createUrlTree(url, navigationExtras), 2), tree = _a[0], extras = _a[1];
|
|
2016
|
+
return [2 /*return*/, this.zone.run(function () {
|
|
2017
|
+
return _this.router.navigateByUrl(tree, extras);
|
|
2018
|
+
})];
|
|
2019
|
+
});
|
|
2020
|
+
});
|
|
2021
|
+
};
|
|
2022
|
+
StateService.prototype.open = function (url, target, navigationExtras) {
|
|
2023
|
+
if (target === void 0) { target = "_blank"; }
|
|
2024
|
+
if (navigationExtras === void 0) { navigationExtras = {}; }
|
|
2025
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2026
|
+
var _a, tree, extras;
|
|
2027
|
+
var _this = this;
|
|
2028
|
+
return __generator(this, function (_b) {
|
|
2029
|
+
if (!this.router)
|
|
2030
|
+
return [2 /*return*/, false];
|
|
2031
|
+
_a = __read(this.createUrlTree(url, navigationExtras), 2), tree = _a[0], extras = _a[1];
|
|
2032
|
+
return [2 /*return*/, this.zone.run(function () {
|
|
2033
|
+
return _this.openInNewWindow(tree, target) || _this.router.navigateByUrl(tree, extras);
|
|
2034
|
+
})];
|
|
1883
2035
|
});
|
|
1884
2036
|
});
|
|
1885
2037
|
};
|
|
1886
2038
|
StateService.prototype.subscribeImmediately = function (next, error, complete) {
|
|
1887
2039
|
return this.pipe(operators.skipWhile(function (v) { return v == null; })).subscribe(next, error, complete);
|
|
1888
2040
|
};
|
|
2041
|
+
StateService.prototype.openInNewWindow = function (tree, target) {
|
|
2042
|
+
if (!this.universal.isBrowser)
|
|
2043
|
+
return false;
|
|
2044
|
+
var baseUrl = window.location.href.replace(this.router.url, "");
|
|
2045
|
+
try {
|
|
2046
|
+
var serialized = this.router.serializeUrl(tree);
|
|
2047
|
+
var separator = serialized.startsWith("/") ? "" : "/";
|
|
2048
|
+
window.open(baseUrl + separator + serialized, target);
|
|
2049
|
+
return true;
|
|
2050
|
+
}
|
|
2051
|
+
catch (e) {
|
|
2052
|
+
console.log("Can't open new window: " + e);
|
|
2053
|
+
return false;
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
StateService.prototype.createUrlTree = function (url, extras) {
|
|
2057
|
+
if (!this.router)
|
|
2058
|
+
return null;
|
|
2059
|
+
extras = Object.assign(extras, this.globalExtras, extras || {});
|
|
2060
|
+
if (ObjectUtils.isArray(url)) {
|
|
2061
|
+
return [this.router.createUrlTree(url, extras), extras];
|
|
2062
|
+
}
|
|
2063
|
+
if (ObjectUtils.isString(url)) {
|
|
2064
|
+
return [this.router.parseUrl(url), extras];
|
|
2065
|
+
}
|
|
2066
|
+
return [url, extras];
|
|
2067
|
+
};
|
|
1889
2068
|
return StateService;
|
|
1890
2069
|
}(rxjs.BehaviorSubject));
|
|
1891
2070
|
StateService.decorators = [
|
|
@@ -1894,6 +2073,7 @@
|
|
|
1894
2073
|
StateService.ctorParameters = function () { return [
|
|
1895
2074
|
{ type: core.Injector },
|
|
1896
2075
|
{ type: core.NgZone },
|
|
2076
|
+
{ type: UniversalService },
|
|
1897
2077
|
{ type: router.Router, decorators: [{ type: core.Optional }] }
|
|
1898
2078
|
]; };
|
|
1899
2079
|
|
|
@@ -2492,135 +2672,6 @@
|
|
|
2492
2672
|
return Vector;
|
|
2493
2673
|
}());
|
|
2494
2674
|
|
|
2495
|
-
/**
|
|
2496
|
-
* Use this service to determine which is the current environment
|
|
2497
|
-
*/
|
|
2498
|
-
var UniversalService = /** @class */ (function () {
|
|
2499
|
-
function UniversalService(platformId, dds) {
|
|
2500
|
-
this.platformId = platformId;
|
|
2501
|
-
this.dds = dds;
|
|
2502
|
-
var info = this.dds.getDeviceInfo();
|
|
2503
|
-
this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST)/gi.test(info.userAgent);
|
|
2504
|
-
}
|
|
2505
|
-
Object.defineProperty(UniversalService.prototype, "isBrowser", {
|
|
2506
|
-
get: function () {
|
|
2507
|
-
return common.isPlatformBrowser(this.platformId);
|
|
2508
|
-
},
|
|
2509
|
-
enumerable: false,
|
|
2510
|
-
configurable: true
|
|
2511
|
-
});
|
|
2512
|
-
Object.defineProperty(UniversalService.prototype, "isServer", {
|
|
2513
|
-
get: function () {
|
|
2514
|
-
return common.isPlatformServer(this.platformId);
|
|
2515
|
-
},
|
|
2516
|
-
enumerable: false,
|
|
2517
|
-
configurable: true
|
|
2518
|
-
});
|
|
2519
|
-
Object.defineProperty(UniversalService.prototype, "deviceInfo", {
|
|
2520
|
-
get: function () {
|
|
2521
|
-
return this.isServer
|
|
2522
|
-
? {
|
|
2523
|
-
userAgent: "angular-universal",
|
|
2524
|
-
os: "unknown",
|
|
2525
|
-
browser: "node",
|
|
2526
|
-
device: "node",
|
|
2527
|
-
os_version: "unknown",
|
|
2528
|
-
browser_version: "unknown",
|
|
2529
|
-
deviceType: "unknown",
|
|
2530
|
-
orientation: "landscape"
|
|
2531
|
-
}
|
|
2532
|
-
: this.dds.getDeviceInfo();
|
|
2533
|
-
},
|
|
2534
|
-
enumerable: false,
|
|
2535
|
-
configurable: true
|
|
2536
|
-
});
|
|
2537
|
-
Object.defineProperty(UniversalService.prototype, "browserName", {
|
|
2538
|
-
get: function () {
|
|
2539
|
-
return this.dds.browser;
|
|
2540
|
-
},
|
|
2541
|
-
enumerable: false,
|
|
2542
|
-
configurable: true
|
|
2543
|
-
});
|
|
2544
|
-
Object.defineProperty(UniversalService.prototype, "browserVersion", {
|
|
2545
|
-
get: function () {
|
|
2546
|
-
return this.dds.browser_version;
|
|
2547
|
-
},
|
|
2548
|
-
enumerable: false,
|
|
2549
|
-
configurable: true
|
|
2550
|
-
});
|
|
2551
|
-
Object.defineProperty(UniversalService.prototype, "isExplorer", {
|
|
2552
|
-
get: function () {
|
|
2553
|
-
return this.dds.browser == "ie";
|
|
2554
|
-
},
|
|
2555
|
-
enumerable: false,
|
|
2556
|
-
configurable: true
|
|
2557
|
-
});
|
|
2558
|
-
Object.defineProperty(UniversalService.prototype, "isEdge", {
|
|
2559
|
-
get: function () {
|
|
2560
|
-
return this.dds.browser == "ms-edge";
|
|
2561
|
-
},
|
|
2562
|
-
enumerable: false,
|
|
2563
|
-
configurable: true
|
|
2564
|
-
});
|
|
2565
|
-
Object.defineProperty(UniversalService.prototype, "isChrome", {
|
|
2566
|
-
get: function () {
|
|
2567
|
-
return this.dds.browser == "chrome";
|
|
2568
|
-
},
|
|
2569
|
-
enumerable: false,
|
|
2570
|
-
configurable: true
|
|
2571
|
-
});
|
|
2572
|
-
Object.defineProperty(UniversalService.prototype, "isFirefox", {
|
|
2573
|
-
get: function () {
|
|
2574
|
-
return this.dds.browser == "firefox";
|
|
2575
|
-
},
|
|
2576
|
-
enumerable: false,
|
|
2577
|
-
configurable: true
|
|
2578
|
-
});
|
|
2579
|
-
Object.defineProperty(UniversalService.prototype, "isSafari", {
|
|
2580
|
-
get: function () {
|
|
2581
|
-
return this.dds.browser == "safari";
|
|
2582
|
-
},
|
|
2583
|
-
enumerable: false,
|
|
2584
|
-
configurable: true
|
|
2585
|
-
});
|
|
2586
|
-
Object.defineProperty(UniversalService.prototype, "isTablet", {
|
|
2587
|
-
get: function () {
|
|
2588
|
-
return this.dds.isTablet();
|
|
2589
|
-
},
|
|
2590
|
-
enumerable: false,
|
|
2591
|
-
configurable: true
|
|
2592
|
-
});
|
|
2593
|
-
Object.defineProperty(UniversalService.prototype, "isMobile", {
|
|
2594
|
-
get: function () {
|
|
2595
|
-
return this.dds.isMobile();
|
|
2596
|
-
},
|
|
2597
|
-
enumerable: false,
|
|
2598
|
-
configurable: true
|
|
2599
|
-
});
|
|
2600
|
-
Object.defineProperty(UniversalService.prototype, "isDesktop", {
|
|
2601
|
-
get: function () {
|
|
2602
|
-
return this.dds.isDesktop();
|
|
2603
|
-
},
|
|
2604
|
-
enumerable: false,
|
|
2605
|
-
configurable: true
|
|
2606
|
-
});
|
|
2607
|
-
Object.defineProperty(UniversalService.prototype, "isCrawler", {
|
|
2608
|
-
get: function () {
|
|
2609
|
-
return this.crawler;
|
|
2610
|
-
},
|
|
2611
|
-
enumerable: false,
|
|
2612
|
-
configurable: true
|
|
2613
|
-
});
|
|
2614
|
-
return UniversalService;
|
|
2615
|
-
}());
|
|
2616
|
-
UniversalService.decorators = [
|
|
2617
|
-
{ type: core.Injectable }
|
|
2618
|
-
];
|
|
2619
|
-
UniversalService.ctorParameters = function () { return [
|
|
2620
|
-
{ type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
|
|
2621
|
-
{ type: ngxDeviceDetector.DeviceDetectorService }
|
|
2622
|
-
]; };
|
|
2623
|
-
|
|
2624
2675
|
var emptyGuards = [];
|
|
2625
2676
|
var AclService = /** @class */ (function () {
|
|
2626
2677
|
function AclService(injector, state, auth) {
|
|
@@ -3403,40 +3454,6 @@
|
|
|
3403
3454
|
{ type: undefined, decorators: [{ type: core.Inject, args: [LANGUAGE_SERVICE,] }] }
|
|
3404
3455
|
]; };
|
|
3405
3456
|
|
|
3406
|
-
var GlobalTemplateService = /** @class */ (function () {
|
|
3407
|
-
function GlobalTemplateService() {
|
|
3408
|
-
this.templatesUpdated = new core.EventEmitter();
|
|
3409
|
-
this.globalTemplates = {};
|
|
3410
|
-
this.componentModifiers = {};
|
|
3411
|
-
}
|
|
3412
|
-
GlobalTemplateService.prototype.get = function (id, component) {
|
|
3413
|
-
var template = this.globalTemplates[id];
|
|
3414
|
-
if (!template)
|
|
3415
|
-
return null;
|
|
3416
|
-
var modifier = this.componentModifiers[id];
|
|
3417
|
-
if (ObjectUtils.isFunction(modifier) && component) {
|
|
3418
|
-
modifier(component);
|
|
3419
|
-
}
|
|
3420
|
-
return template;
|
|
3421
|
-
};
|
|
3422
|
-
GlobalTemplateService.prototype.add = function (id, template) {
|
|
3423
|
-
this.globalTemplates[id] = template;
|
|
3424
|
-
this.templatesUpdated.emit();
|
|
3425
|
-
};
|
|
3426
|
-
GlobalTemplateService.prototype.remove = function (id) {
|
|
3427
|
-
delete this.globalTemplates[id];
|
|
3428
|
-
this.templatesUpdated.emit();
|
|
3429
|
-
};
|
|
3430
|
-
GlobalTemplateService.prototype.addComponentModifier = function (id, modifier) {
|
|
3431
|
-
this.componentModifiers[id] = modifier;
|
|
3432
|
-
};
|
|
3433
|
-
return GlobalTemplateService;
|
|
3434
|
-
}());
|
|
3435
|
-
GlobalTemplateService.decorators = [
|
|
3436
|
-
{ type: core.Injectable }
|
|
3437
|
-
];
|
|
3438
|
-
GlobalTemplateService.ctorParameters = function () { return []; };
|
|
3439
|
-
|
|
3440
3457
|
var IconService = /** @class */ (function () {
|
|
3441
3458
|
function IconService() {
|
|
3442
3459
|
this.iconsLoaded = new core.EventEmitter();
|
|
@@ -4032,6 +4049,9 @@
|
|
|
4032
4049
|
|
|
4033
4050
|
function emptyRemove$1() {
|
|
4034
4051
|
}
|
|
4052
|
+
function isWindow(el) {
|
|
4053
|
+
return typeof window !== "undefined" && el === window;
|
|
4054
|
+
}
|
|
4035
4055
|
var ResizeEventPlugin = /** @class */ (function (_super) {
|
|
4036
4056
|
__extends(ResizeEventPlugin, _super);
|
|
4037
4057
|
function ResizeEventPlugin(doc, universal) {
|
|
@@ -4051,32 +4071,26 @@
|
|
|
4051
4071
|
var cb = function (el) {
|
|
4052
4072
|
zone.run(function () { return handler(el); });
|
|
4053
4073
|
};
|
|
4054
|
-
|
|
4074
|
+
if (isWindow(element)) {
|
|
4075
|
+
element.addEventListener(eventName, cb);
|
|
4076
|
+
}
|
|
4077
|
+
else {
|
|
4078
|
+
resizeDetector.addListener(element, cb);
|
|
4079
|
+
}
|
|
4055
4080
|
return function () {
|
|
4056
4081
|
try {
|
|
4057
|
-
|
|
4082
|
+
if (isWindow(element)) {
|
|
4083
|
+
element.removeEventListener(eventName, cb);
|
|
4084
|
+
}
|
|
4085
|
+
else {
|
|
4086
|
+
resizeDetector.removeListener(element, cb);
|
|
4087
|
+
}
|
|
4058
4088
|
}
|
|
4059
4089
|
catch (e) {
|
|
4060
4090
|
}
|
|
4061
4091
|
};
|
|
4062
4092
|
});
|
|
4063
4093
|
};
|
|
4064
|
-
ResizeEventPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
|
|
4065
|
-
var _this = this;
|
|
4066
|
-
var zone = this.manager.getZone();
|
|
4067
|
-
return zone.runOutsideAngular(function () {
|
|
4068
|
-
if (_this.universal.isServer)
|
|
4069
|
-
return emptyRemove$1;
|
|
4070
|
-
if (!StringUtils.has(element, "document", "window")) {
|
|
4071
|
-
console.error("Global resize event other than window or document?", element);
|
|
4072
|
-
return emptyRemove$1;
|
|
4073
|
-
}
|
|
4074
|
-
var target = "window" == element ? window : document;
|
|
4075
|
-
var listener = handler;
|
|
4076
|
-
target.addEventListener(eventName, listener);
|
|
4077
|
-
return function () { return target.removeEventListener(eventName, listener); };
|
|
4078
|
-
});
|
|
4079
|
-
};
|
|
4080
4094
|
return ResizeEventPlugin;
|
|
4081
4095
|
}(platformBrowser["ɵangular_packages_platform_browser_platform_browser_g"]));
|
|
4082
4096
|
ResizeEventPlugin.EVENT_NAME = "resize";
|
|
@@ -4113,22 +4127,6 @@
|
|
|
4113
4127
|
return function () { return element.removeEventListener(eventName, callback); };
|
|
4114
4128
|
});
|
|
4115
4129
|
};
|
|
4116
|
-
ScrollEventPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
|
|
4117
|
-
var _this = this;
|
|
4118
|
-
var zone = this.manager.getZone();
|
|
4119
|
-
return zone.runOutsideAngular(function () {
|
|
4120
|
-
if (_this.universal.isServer)
|
|
4121
|
-
return emptyRemove;
|
|
4122
|
-
if (!StringUtils.has(element, "document", "window")) {
|
|
4123
|
-
console.error("Global resize event other than window or document?", element);
|
|
4124
|
-
return emptyRemove;
|
|
4125
|
-
}
|
|
4126
|
-
var target = "window" == element ? window : document;
|
|
4127
|
-
var listener = handler;
|
|
4128
|
-
target.addEventListener(eventName, listener);
|
|
4129
|
-
return function () { return target.removeEventListener(eventName, listener); };
|
|
4130
|
-
});
|
|
4131
|
-
};
|
|
4132
4130
|
return ScrollEventPlugin;
|
|
4133
4131
|
}(platformBrowser["ɵangular_packages_platform_browser_platform_browser_g"]));
|
|
4134
4132
|
ScrollEventPlugin.EVENT_NAME = "scroll";
|
|
@@ -4349,7 +4347,9 @@
|
|
|
4349
4347
|
this.templatesUpdated.unsubscribe();
|
|
4350
4348
|
};
|
|
4351
4349
|
GlobalTemplatePipe.prototype.transform = function (templateId, component) {
|
|
4352
|
-
if (
|
|
4350
|
+
if (!templateId)
|
|
4351
|
+
return null;
|
|
4352
|
+
if (this.cachedTemplate === null || this.cachedTemplateId !== templateId) {
|
|
4353
4353
|
this.cachedTemplateId = templateId;
|
|
4354
4354
|
this.cachedTemplate = this.globalTemplates.get(templateId, component);
|
|
4355
4355
|
}
|
|
@@ -4364,7 +4364,7 @@
|
|
|
4364
4364
|
},] }
|
|
4365
4365
|
];
|
|
4366
4366
|
GlobalTemplatePipe.ctorParameters = function () { return [
|
|
4367
|
-
{ type:
|
|
4367
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [GLOBAL_TEMPLATES,] }] }
|
|
4368
4368
|
]; };
|
|
4369
4369
|
|
|
4370
4370
|
var GroupByPipe = /** @class */ (function () {
|
|
@@ -4906,15 +4906,15 @@
|
|
|
4906
4906
|
};
|
|
4907
4907
|
|
|
4908
4908
|
var GlobalTemplateDirective = /** @class */ (function () {
|
|
4909
|
-
function GlobalTemplateDirective(
|
|
4910
|
-
this.
|
|
4909
|
+
function GlobalTemplateDirective(globalTemplates, template) {
|
|
4910
|
+
this.globalTemplates = globalTemplates;
|
|
4911
4911
|
this.template = template;
|
|
4912
4912
|
}
|
|
4913
4913
|
GlobalTemplateDirective.prototype.ngOnInit = function () {
|
|
4914
|
-
this.
|
|
4914
|
+
this.globalTemplates.add(this.id, this.template);
|
|
4915
4915
|
};
|
|
4916
4916
|
GlobalTemplateDirective.prototype.ngOnDestroy = function () {
|
|
4917
|
-
this.
|
|
4917
|
+
this.globalTemplates.remove(this.id);
|
|
4918
4918
|
};
|
|
4919
4919
|
return GlobalTemplateDirective;
|
|
4920
4920
|
}());
|
|
@@ -4924,7 +4924,7 @@
|
|
|
4924
4924
|
},] }
|
|
4925
4925
|
];
|
|
4926
4926
|
GlobalTemplateDirective.ctorParameters = function () { return [
|
|
4927
|
-
{ type:
|
|
4927
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [GLOBAL_TEMPLATES,] }] },
|
|
4928
4928
|
{ type: core.TemplateRef }
|
|
4929
4929
|
]; };
|
|
4930
4930
|
GlobalTemplateDirective.propDecorators = {
|
|
@@ -5730,6 +5730,40 @@
|
|
|
5730
5730
|
boundaryLinks: [{ type: core.Input }]
|
|
5731
5731
|
};
|
|
5732
5732
|
|
|
5733
|
+
var GlobalTemplateService = /** @class */ (function () {
|
|
5734
|
+
function GlobalTemplateService() {
|
|
5735
|
+
this.templatesUpdated = new core.EventEmitter();
|
|
5736
|
+
this.globalTemplates = {};
|
|
5737
|
+
this.componentModifiers = {};
|
|
5738
|
+
}
|
|
5739
|
+
GlobalTemplateService.prototype.get = function (id, component) {
|
|
5740
|
+
var template = this.globalTemplates[id];
|
|
5741
|
+
if (!template)
|
|
5742
|
+
return undefined;
|
|
5743
|
+
var modifier = this.componentModifiers[id];
|
|
5744
|
+
if (ObjectUtils.isFunction(modifier) && component) {
|
|
5745
|
+
modifier(component);
|
|
5746
|
+
}
|
|
5747
|
+
return template;
|
|
5748
|
+
};
|
|
5749
|
+
GlobalTemplateService.prototype.add = function (id, template) {
|
|
5750
|
+
this.globalTemplates[id] = template;
|
|
5751
|
+
this.templatesUpdated.emit();
|
|
5752
|
+
};
|
|
5753
|
+
GlobalTemplateService.prototype.remove = function (id) {
|
|
5754
|
+
delete this.globalTemplates[id];
|
|
5755
|
+
this.templatesUpdated.emit();
|
|
5756
|
+
};
|
|
5757
|
+
GlobalTemplateService.prototype.addComponentModifier = function (id, modifier) {
|
|
5758
|
+
this.componentModifiers[id] = modifier;
|
|
5759
|
+
};
|
|
5760
|
+
return GlobalTemplateService;
|
|
5761
|
+
}());
|
|
5762
|
+
GlobalTemplateService.decorators = [
|
|
5763
|
+
{ type: core.Injectable }
|
|
5764
|
+
];
|
|
5765
|
+
GlobalTemplateService.ctorParameters = function () { return []; };
|
|
5766
|
+
|
|
5733
5767
|
var StickyClassDirective = /** @class */ (function () {
|
|
5734
5768
|
function StickyClassDirective(events, element, renderer) {
|
|
5735
5769
|
this.events = events;
|
|
@@ -5894,6 +5928,10 @@
|
|
|
5894
5928
|
provide: CONFIG_SERVICE,
|
|
5895
5929
|
useExisting: (!config ? null : config.configService) || ConfigService
|
|
5896
5930
|
},
|
|
5931
|
+
{
|
|
5932
|
+
provide: GLOBAL_TEMPLATES,
|
|
5933
|
+
useExisting: (!config ? null : config.globalTemplates) || GlobalTemplateService
|
|
5934
|
+
},
|
|
5897
5935
|
{
|
|
5898
5936
|
provide: ROOT_ELEMENT,
|
|
5899
5937
|
useValue: null
|
|
@@ -5961,12 +5999,12 @@
|
|
|
5961
5999
|
exports.FindPipe = FindPipe;
|
|
5962
6000
|
exports.FormatNumberPipe = FormatNumberPipe;
|
|
5963
6001
|
exports.FormatterService = FormatterService;
|
|
6002
|
+
exports.GLOBAL_TEMPLATES = GLOBAL_TEMPLATES;
|
|
5964
6003
|
exports.GenericValue = GenericValue;
|
|
5965
6004
|
exports.GetOffsetPipe = GetOffsetPipe;
|
|
5966
6005
|
exports.GetTypePipe = GetTypePipe;
|
|
5967
6006
|
exports.GlobalTemplateDirective = GlobalTemplateDirective;
|
|
5968
6007
|
exports.GlobalTemplatePipe = GlobalTemplatePipe;
|
|
5969
|
-
exports.GlobalTemplateService = GlobalTemplateService;
|
|
5970
6008
|
exports.GroupByPipe = GroupByPipe;
|
|
5971
6009
|
exports.HttpPromise = HttpPromise;
|
|
5972
6010
|
exports.ICON_SERVICE = ICON_SERVICE;
|
|
@@ -6036,6 +6074,7 @@
|
|
|
6036
6074
|
exports["ɵd"] = providers;
|
|
6037
6075
|
exports["ɵe"] = loadConfig;
|
|
6038
6076
|
exports["ɵf"] = StickyClassDirective;
|
|
6077
|
+
exports["ɵg"] = GlobalTemplateService;
|
|
6039
6078
|
|
|
6040
6079
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6041
6080
|
|