raise-common-lib 0.0.31 → 0.0.33
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/raise-common-lib.umd.js +232 -192
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/layout/multi-tab/index.component.js +34 -16
- package/esm2015/lib/raise-common-lib.module.js +1 -5
- package/esm2015/lib/service/keep-alive.service.js +20 -9
- package/esm5/lib/layout/multi-tab/index.component.js +36 -15
- package/esm5/lib/raise-common-lib.module.js +1 -5
- package/esm5/lib/service/keep-alive.service.js +31 -11
- package/fesm2015/raise-common-lib.js +183 -154
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +233 -193
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/layout/multi-tab/index.component.d.ts +9 -5
- package/lib/service/keep-alive.service.d.ts +2 -0
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -2,7 +2,7 @@ import { __assign, __read, __spread } from 'tslib';
|
|
|
2
2
|
import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, ContentChild, Injectable, ɵɵdefineInjectable, ɵɵinject, HostListener, ComponentFactoryResolver, ViewContainerRef, ViewChildren, Inject, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import { GridModule, PagerModule, GridAllModule, PageService, SortService, FilterService, ExcelExportService, EditService, ResizeService, ToolbarService, ColumnChooserService, AggregateService, ColumnMenuService, DetailRowService, SelectionService, GroupService } from '@syncfusion/ej2-angular-grids';
|
|
4
4
|
import { debounce } from 'lodash';
|
|
5
|
-
import { NavigationEnd, Router, ActivatedRoute } from '@angular/router';
|
|
5
|
+
import { NavigationEnd, Router, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
|
|
6
6
|
import { filter } from 'rxjs/operators';
|
|
7
7
|
import { BehaviorSubject } from 'rxjs';
|
|
8
8
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
@@ -1565,184 +1565,6 @@ var CommonFunctionService = /** @class */ (function () {
|
|
|
1565
1565
|
return CommonFunctionService;
|
|
1566
1566
|
}());
|
|
1567
1567
|
|
|
1568
|
-
/**
|
|
1569
|
-
* @fileoverview added by tsickle
|
|
1570
|
-
* Generated from: lib/service/keep-alive.service.ts
|
|
1571
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1572
|
-
*/
|
|
1573
|
-
/** @type {?} */
|
|
1574
|
-
var storedRoutes = new Map();
|
|
1575
|
-
/** @type {?} */
|
|
1576
|
-
var toBeDeleteUrl;
|
|
1577
|
-
/** @type {?} */
|
|
1578
|
-
var excludeRoutes = [];
|
|
1579
|
-
// 不需要缓存的url
|
|
1580
|
-
var KeepAliveService = /** @class */ (function () {
|
|
1581
|
-
function KeepAliveService() {
|
|
1582
|
-
}
|
|
1583
|
-
/**
|
|
1584
|
-
* @param {?} routes
|
|
1585
|
-
* @return {?}
|
|
1586
|
-
*/
|
|
1587
|
-
KeepAliveService.prototype.setExcludeRoutes = /**
|
|
1588
|
-
* @param {?} routes
|
|
1589
|
-
* @return {?}
|
|
1590
|
-
*/
|
|
1591
|
-
function (routes) {
|
|
1592
|
-
excludeRoutes = routes; // 设置不缓存的路由
|
|
1593
|
-
};
|
|
1594
|
-
/**
|
|
1595
|
-
* @param {?} route
|
|
1596
|
-
* @return {?}
|
|
1597
|
-
*/
|
|
1598
|
-
KeepAliveService.prototype.shouldDetach = /**
|
|
1599
|
-
* @param {?} route
|
|
1600
|
-
* @return {?}
|
|
1601
|
-
*/
|
|
1602
|
-
function (route) {
|
|
1603
|
-
/** @type {?} */
|
|
1604
|
-
var config = route.routeConfig;
|
|
1605
|
-
// console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
|
|
1606
|
-
if (toBeDeleteUrl === this.getRoutePath(route)) {
|
|
1607
|
-
// 对于新开的又即将关闭的tab,不缓存
|
|
1608
|
-
if (route.children.length === 0) {
|
|
1609
|
-
toBeDeleteUrl = "";
|
|
1610
|
-
}
|
|
1611
|
-
return false;
|
|
1612
|
-
}
|
|
1613
|
-
if (config && excludeRoutes.includes(this.getRoutePath(route))) {
|
|
1614
|
-
return false;
|
|
1615
|
-
}
|
|
1616
|
-
//Don't store lazy loaded routes
|
|
1617
|
-
return config && !config.loadChildren;
|
|
1618
|
-
};
|
|
1619
|
-
/**
|
|
1620
|
-
* @param {?} route
|
|
1621
|
-
* @param {?} handle
|
|
1622
|
-
* @return {?}
|
|
1623
|
-
*/
|
|
1624
|
-
KeepAliveService.prototype.store = /**
|
|
1625
|
-
* @param {?} route
|
|
1626
|
-
* @param {?} handle
|
|
1627
|
-
* @return {?}
|
|
1628
|
-
*/
|
|
1629
|
-
function (route, handle) {
|
|
1630
|
-
// console.log("store", this.getRoutePath(route));
|
|
1631
|
-
// console.log("store", storedRoutes);
|
|
1632
|
-
/** @type {?} */
|
|
1633
|
-
var key = this.getRoutePath(route);
|
|
1634
|
-
storedRoutes.set(key, handle);
|
|
1635
|
-
};
|
|
1636
|
-
/**
|
|
1637
|
-
* @param {?} route
|
|
1638
|
-
* @return {?}
|
|
1639
|
-
*/
|
|
1640
|
-
KeepAliveService.prototype.shouldAttach = /**
|
|
1641
|
-
* @param {?} route
|
|
1642
|
-
* @return {?}
|
|
1643
|
-
*/
|
|
1644
|
-
function (route) {
|
|
1645
|
-
/** @type {?} */
|
|
1646
|
-
var key = this.getRoutePath(route);
|
|
1647
|
-
return !!route.routeConfig && storedRoutes.has(key);
|
|
1648
|
-
};
|
|
1649
|
-
/**
|
|
1650
|
-
* @param {?} route
|
|
1651
|
-
* @return {?}
|
|
1652
|
-
*/
|
|
1653
|
-
KeepAliveService.prototype.retrieve = /**
|
|
1654
|
-
* @param {?} route
|
|
1655
|
-
* @return {?}
|
|
1656
|
-
*/
|
|
1657
|
-
function (route) {
|
|
1658
|
-
/** @type {?} */
|
|
1659
|
-
var config = route.routeConfig;
|
|
1660
|
-
/** @type {?} */
|
|
1661
|
-
var key = this.getRoutePath(route);
|
|
1662
|
-
//We don't store lazy loaded routes, so don't even bother trying to retrieve them
|
|
1663
|
-
if (!config || config.loadChildren) {
|
|
1664
|
-
return false;
|
|
1665
|
-
}
|
|
1666
|
-
return storedRoutes.get(key) || null;
|
|
1667
|
-
};
|
|
1668
|
-
/**
|
|
1669
|
-
* @param {?} future
|
|
1670
|
-
* @param {?} curr
|
|
1671
|
-
* @return {?}
|
|
1672
|
-
*/
|
|
1673
|
-
KeepAliveService.prototype.shouldReuseRoute = /**
|
|
1674
|
-
* @param {?} future
|
|
1675
|
-
* @param {?} curr
|
|
1676
|
-
* @return {?}
|
|
1677
|
-
*/
|
|
1678
|
-
function (future, curr) {
|
|
1679
|
-
// console.log("shouldReuseRoute", future, curr);
|
|
1680
|
-
// return future.routeConfig === curr.routeConfig;
|
|
1681
|
-
if (future.routeConfig === curr.routeConfig) {
|
|
1682
|
-
if (future.children.length === 0 && curr.children.length === 0) {
|
|
1683
|
-
// 无子路由时, 通过params和queryParams判断是否复用路由
|
|
1684
|
-
return (JSON.stringify(future.params) === JSON.stringify(curr.params) &&
|
|
1685
|
-
JSON.stringify(future.queryParams) ===
|
|
1686
|
-
JSON.stringify(curr.queryParams));
|
|
1687
|
-
}
|
|
1688
|
-
return true;
|
|
1689
|
-
}
|
|
1690
|
-
return false;
|
|
1691
|
-
};
|
|
1692
|
-
/**
|
|
1693
|
-
* @param {?} route
|
|
1694
|
-
* @return {?}
|
|
1695
|
-
*/
|
|
1696
|
-
KeepAliveService.prototype.getRoutePath = /**
|
|
1697
|
-
* @param {?} route
|
|
1698
|
-
* @return {?}
|
|
1699
|
-
*/
|
|
1700
|
-
function (route) {
|
|
1701
|
-
if (route.routeConfig) {
|
|
1702
|
-
// const pathParams = JSON.stringify(route.params);
|
|
1703
|
-
/** @type {?} */
|
|
1704
|
-
var queryParams = new URLSearchParams(route.queryParams).toString();
|
|
1705
|
-
/** @type {?} */
|
|
1706
|
-
var url = route._urlSegment.segments.map((/**
|
|
1707
|
-
* @param {?} v
|
|
1708
|
-
* @return {?}
|
|
1709
|
-
*/
|
|
1710
|
-
function (v) { return v.path; })).join("/");
|
|
1711
|
-
return "/" + url + (queryParams ? "?" + queryParams : "");
|
|
1712
|
-
}
|
|
1713
|
-
return "";
|
|
1714
|
-
};
|
|
1715
|
-
/**
|
|
1716
|
-
* @param {?} path
|
|
1717
|
-
* @return {?}
|
|
1718
|
-
*/
|
|
1719
|
-
KeepAliveService.prototype.clearCache = /**
|
|
1720
|
-
* @param {?} path
|
|
1721
|
-
* @return {?}
|
|
1722
|
-
*/
|
|
1723
|
-
function (path) {
|
|
1724
|
-
// console.log("clearCache", storedRoutes, path);
|
|
1725
|
-
toBeDeleteUrl = path;
|
|
1726
|
-
storedRoutes.delete(path);
|
|
1727
|
-
};
|
|
1728
|
-
/**
|
|
1729
|
-
* @return {?}
|
|
1730
|
-
*/
|
|
1731
|
-
KeepAliveService.prototype.clearAllCache = /**
|
|
1732
|
-
* @return {?}
|
|
1733
|
-
*/
|
|
1734
|
-
function () {
|
|
1735
|
-
storedRoutes.clear();
|
|
1736
|
-
};
|
|
1737
|
-
KeepAliveService.decorators = [
|
|
1738
|
-
{ type: Injectable, args: [{
|
|
1739
|
-
providedIn: "root",
|
|
1740
|
-
},] }
|
|
1741
|
-
];
|
|
1742
|
-
/** @nocollapse */ KeepAliveService.ngInjectableDef = ɵɵdefineInjectable({ factory: function KeepAliveService_Factory() { return new KeepAliveService(); }, token: KeepAliveService, providedIn: "root" });
|
|
1743
|
-
return KeepAliveService;
|
|
1744
|
-
}());
|
|
1745
|
-
|
|
1746
1568
|
/**
|
|
1747
1569
|
* @fileoverview added by tsickle
|
|
1748
1570
|
* Generated from: lib/service/drawer.service.ts
|
|
@@ -1972,15 +1794,14 @@ if (false) {
|
|
|
1972
1794
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1973
1795
|
*/
|
|
1974
1796
|
var MultiTabComponent = /** @class */ (function () {
|
|
1975
|
-
function MultiTabComponent(router, cf, activatedRoute,
|
|
1797
|
+
function MultiTabComponent(router, cf, activatedRoute, ref, drawer, routeReuseStrategy) {
|
|
1976
1798
|
this.router = router;
|
|
1977
1799
|
this.cf = cf;
|
|
1978
1800
|
this.activatedRoute = activatedRoute;
|
|
1979
|
-
this.keepAlive = keepAlive;
|
|
1980
1801
|
this.ref = ref;
|
|
1981
1802
|
this.drawer = drawer;
|
|
1803
|
+
this.routeReuseStrategy = routeReuseStrategy;
|
|
1982
1804
|
this.singleReuseUrls = []; //只能单个缓存的url
|
|
1983
|
-
//只能单个缓存的url
|
|
1984
1805
|
this.TAB_WIDTH = 164;
|
|
1985
1806
|
this.GAP_NORMAL = 54;
|
|
1986
1807
|
this.GAP_SMALL = 30;
|
|
@@ -1988,6 +1809,7 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
1988
1809
|
this.selectedTab = 0;
|
|
1989
1810
|
this.maxTabs = 10;
|
|
1990
1811
|
this.screenWidth = window.innerWidth; // 初始化屏幕宽度
|
|
1812
|
+
this.keepAlive = (/** @type {?} */ (this.routeReuseStrategy));
|
|
1991
1813
|
}
|
|
1992
1814
|
// 初始化屏幕宽度
|
|
1993
1815
|
/**
|
|
@@ -2023,7 +1845,7 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2023
1845
|
if (isExistIdx !== -1) {
|
|
2024
1846
|
this.selectedTab = isExistIdx;
|
|
2025
1847
|
}
|
|
2026
|
-
this.router.events
|
|
1848
|
+
this.subscription = this.router.events
|
|
2027
1849
|
.pipe(filter((/**
|
|
2028
1850
|
* @param {?} event
|
|
2029
1851
|
* @return {?}
|
|
@@ -2068,6 +1890,17 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2068
1890
|
_this.setEllipsisTitle();
|
|
2069
1891
|
}), 50);
|
|
2070
1892
|
};
|
|
1893
|
+
/**
|
|
1894
|
+
* @return {?}
|
|
1895
|
+
*/
|
|
1896
|
+
MultiTabComponent.prototype.ngOnDestroy = /**
|
|
1897
|
+
* @return {?}
|
|
1898
|
+
*/
|
|
1899
|
+
function () {
|
|
1900
|
+
if (this.subscription) {
|
|
1901
|
+
this.subscription.unsubscribe();
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
2071
1904
|
/**
|
|
2072
1905
|
* @param {?=} title
|
|
2073
1906
|
* @return {?}
|
|
@@ -2122,17 +1955,17 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2122
1955
|
var leftWidth;
|
|
2123
1956
|
/** @type {?} */
|
|
2124
1957
|
var rightWidth;
|
|
2125
|
-
if (wrap && ulElement
|
|
1958
|
+
if (wrap && ulElement) {
|
|
2126
1959
|
// 获取元素的位置信息
|
|
2127
1960
|
/** @type {?} */
|
|
2128
1961
|
var wrapRect = wrap.getBoundingClientRect();
|
|
2129
1962
|
/** @type {?} */
|
|
2130
1963
|
var ulRect = ulElement.getBoundingClientRect();
|
|
2131
1964
|
/** @type {?} */
|
|
2132
|
-
var refreshTabRect = refreshTabDiv.getBoundingClientRect();
|
|
1965
|
+
var refreshTabRect = refreshTabDiv && refreshTabDiv.getBoundingClientRect();
|
|
2133
1966
|
allWidth = wrapRect.width;
|
|
2134
1967
|
leftWidth = ulRect.width;
|
|
2135
|
-
rightWidth = refreshTabRect.width;
|
|
1968
|
+
rightWidth = (refreshTabRect && refreshTabRect.width) || 100;
|
|
2136
1969
|
}
|
|
2137
1970
|
return {
|
|
2138
1971
|
allWidth: allWidth,
|
|
@@ -2292,7 +2125,7 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2292
2125
|
};
|
|
2293
2126
|
MultiTabComponent.decorators = [
|
|
2294
2127
|
{ type: Component, args: [{
|
|
2295
|
-
selector: "
|
|
2128
|
+
selector: "kt-multi-tab",
|
|
2296
2129
|
template: "<div class=\"rs-multi-tab\" *ngIf=\"tabList.length > 0\">\r\n <ul>\r\n <ng-container *ngFor=\"let tab of tabList; let i = index\">\r\n <li\r\n [ngClass]=\"selectedTab === i ? 'isSelect' : 'notSelect'\"\r\n (click)=\"changeTab(tab, i)\"\r\n >\r\n <ejs-tooltip\r\n id=\"notSelectTooltip\"\r\n [showTipPointer]=\"false\"\r\n [openDelay]=\"500\"\r\n *ngIf=\"tab.displayTitle !== tab.title; else originText\"\r\n style=\"height: 27px\"\r\n >\r\n <ng-template #content>\r\n <div class=\"tooltip-content\">\r\n {{ tab.title }}\r\n </div>\r\n </ng-template>\r\n <span class=\"tabTitle\">{{ tab.displayTitle }}</span>\r\n </ejs-tooltip>\r\n <ng-template #originText>\r\n <span class=\"tabTitle\">\r\n {{ tab.displayTitle }}\r\n </span>\r\n </ng-template>\r\n <span class=\"img-block\" *ngIf=\"selectedTab !== i\"></span>\r\n <img\r\n *ngIf=\"tabList.length !== 1\"\r\n src=\"../../../assets/img/close-url.svg\"\r\n (click)=\"closeTab(tab, i)\"\r\n />\r\n </li>\r\n </ng-container>\r\n </ul>\r\n <div class=\"refresh-tab\" (click)=\"refreshTab()\">\r\n <img\r\n id=\"loadingIcon\"\r\n alt\r\n class=\"refresh-btn\"\r\n src=\"../../../assets/img/desktop-refresh-btn.svg\"\r\n />\r\n <span>Refresh Current Tab</span>\r\n </div>\r\n</div>\r\n",
|
|
2297
2130
|
styles: [".rs-multi-tab{border-bottom:1px solid #e5eaef;height:28px;width:100%;display:flex;justify-content:space-between}.rs-multi-tab ul{display:flex;margin:0 8px;padding:0;overflow:hidden;height:100%}.rs-multi-tab ul li{max-width:164px;padding:0 12px;display:flex;align-items:center;flex:auto;border:1px solid #e5eaef;border-bottom:none;color:#5f6f81;font-family:Arial;font-size:11px;font-style:normal;font-weight:400;line-height:28px;height:100%;background:#f8fafb;vertical-align:top;position:relative;cursor:default}.rs-multi-tab ul li .tabTitle{display:inline-block;white-space:nowrap;font-size:11px;font-family:Arial;font-style:normal;font-weight:400;line-height:16px;transition:width .3s}.rs-multi-tab ul li img{border-radius:4px;padding:4px;margin-left:6px;margin-top:1px;vertical-align:top;cursor:pointer}.rs-multi-tab ul li img:hover{background:#dce8f6}.rs-multi-tab ul li:not(:last-child){border-right:none}.rs-multi-tab ul li:first-of-type{border-top-left-radius:8px}.rs-multi-tab ul li:last-child{border-top-right-radius:8px}.rs-multi-tab ul .isSelect{color:#1f3f5c;background:#fff}.rs-multi-tab ul .notSelect img{display:none}.rs-multi-tab ul .notSelect .img-block{display:inline-block;width:22px}.rs-multi-tab ul .notSelect:hover{color:#1f3f5c;background-color:rgba(31,123,255,.04)}.rs-multi-tab ul .notSelect:hover .img-block{display:none}.rs-multi-tab ul .notSelect:hover img{display:inline-block}.rs-multi-tab .refresh-tab{cursor:pointer;text-align:right;color:#6c7c90;font-family:Arial;font-size:11px;font-style:normal;font-weight:400;line-height:28px;padding-right:12px}.rs-multi-tab .refresh-tab img{vertical-align:middle;margin-right:4px}.refresh-tab-loading{-webkit-animation:1s linear infinite spin;animation:1s linear infinite spin}@-webkit-keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.tooltip-content{padding:4px;color:#f8fafb;font-family:Arial;font-size:11px;font-style:normal;font-weight:400;line-height:14px}@media (max-width:1400px){.refresh-tab{padding-right:0!important}.refresh-tab span{display:none!important}}@media (max-width:1100px){.rs-multi-tab ul li img{position:absolute;right:3px;background-color:#fff}.notSelect:hover img{position:absolute;right:3px;background-color:#eff5fb}.img-block{display:none!important}}@media (max-width:600px){.rs-multi-tab ul li{padding:0 8px}.rs-multi-tab ul .notSelect .img-block{width:0!important}}"]
|
|
2298
2131
|
}] }
|
|
@@ -2302,9 +2135,9 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2302
2135
|
{ type: Router },
|
|
2303
2136
|
{ type: CommonFunctionService },
|
|
2304
2137
|
{ type: ActivatedRoute },
|
|
2305
|
-
{ type: KeepAliveService },
|
|
2306
2138
|
{ type: ChangeDetectorRef },
|
|
2307
|
-
{ type: DrawerService }
|
|
2139
|
+
{ type: DrawerService },
|
|
2140
|
+
{ type: RouteReuseStrategy }
|
|
2308
2141
|
]; };
|
|
2309
2142
|
MultiTabComponent.propDecorators = {
|
|
2310
2143
|
singleReuseUrls: [{ type: Input }],
|
|
@@ -2313,8 +2146,15 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
2313
2146
|
return MultiTabComponent;
|
|
2314
2147
|
}());
|
|
2315
2148
|
if (false) {
|
|
2149
|
+
/** @type {?} */
|
|
2150
|
+
MultiTabComponent.prototype.keepAlive;
|
|
2316
2151
|
/** @type {?} */
|
|
2317
2152
|
MultiTabComponent.prototype.singleReuseUrls;
|
|
2153
|
+
/**
|
|
2154
|
+
* @type {?}
|
|
2155
|
+
* @private
|
|
2156
|
+
*/
|
|
2157
|
+
MultiTabComponent.prototype.subscription;
|
|
2318
2158
|
/** @type {?} */
|
|
2319
2159
|
MultiTabComponent.prototype.TAB_WIDTH;
|
|
2320
2160
|
/** @type {?} */
|
|
@@ -2341,8 +2181,6 @@ if (false) {
|
|
|
2341
2181
|
MultiTabComponent.prototype.cf;
|
|
2342
2182
|
/** @type {?} */
|
|
2343
2183
|
MultiTabComponent.prototype.activatedRoute;
|
|
2344
|
-
/** @type {?} */
|
|
2345
|
-
MultiTabComponent.prototype.keepAlive;
|
|
2346
2184
|
/**
|
|
2347
2185
|
* @type {?}
|
|
2348
2186
|
* @private
|
|
@@ -2353,6 +2191,11 @@ if (false) {
|
|
|
2353
2191
|
* @private
|
|
2354
2192
|
*/
|
|
2355
2193
|
MultiTabComponent.prototype.drawer;
|
|
2194
|
+
/**
|
|
2195
|
+
* @type {?}
|
|
2196
|
+
* @private
|
|
2197
|
+
*/
|
|
2198
|
+
MultiTabComponent.prototype.routeReuseStrategy;
|
|
2356
2199
|
}
|
|
2357
2200
|
|
|
2358
2201
|
/**
|
|
@@ -21201,6 +21044,205 @@ if (false) {
|
|
|
21201
21044
|
DialogService.prototype.dialog;
|
|
21202
21045
|
}
|
|
21203
21046
|
|
|
21047
|
+
/**
|
|
21048
|
+
* @fileoverview added by tsickle
|
|
21049
|
+
* Generated from: lib/service/keep-alive.service.ts
|
|
21050
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
21051
|
+
*/
|
|
21052
|
+
/** @type {?} */
|
|
21053
|
+
var storedRoutes = new Map();
|
|
21054
|
+
/** @type {?} */
|
|
21055
|
+
var toBeDeleteUrl;
|
|
21056
|
+
/** @type {?} */
|
|
21057
|
+
var excludeRoutes = [];
|
|
21058
|
+
// 不需要缓存的url
|
|
21059
|
+
var
|
|
21060
|
+
// 不需要缓存的url
|
|
21061
|
+
KeepAliveService = /** @class */ (function () {
|
|
21062
|
+
function KeepAliveService() {
|
|
21063
|
+
}
|
|
21064
|
+
// 用于存储 BaseComponent 的实例
|
|
21065
|
+
/**
|
|
21066
|
+
* @param {?} routes
|
|
21067
|
+
* @return {?}
|
|
21068
|
+
*/
|
|
21069
|
+
KeepAliveService.prototype.setExcludeRoutes =
|
|
21070
|
+
// 用于存储 BaseComponent 的实例
|
|
21071
|
+
/**
|
|
21072
|
+
* @param {?} routes
|
|
21073
|
+
* @return {?}
|
|
21074
|
+
*/
|
|
21075
|
+
function (routes) {
|
|
21076
|
+
excludeRoutes = routes; // 设置不缓存的路由
|
|
21077
|
+
};
|
|
21078
|
+
/**
|
|
21079
|
+
* @param {?} route
|
|
21080
|
+
* @return {?}
|
|
21081
|
+
*/
|
|
21082
|
+
KeepAliveService.prototype.shouldDetach = /**
|
|
21083
|
+
* @param {?} route
|
|
21084
|
+
* @return {?}
|
|
21085
|
+
*/
|
|
21086
|
+
function (route) {
|
|
21087
|
+
/** @type {?} */
|
|
21088
|
+
var config = route.routeConfig;
|
|
21089
|
+
// console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
|
|
21090
|
+
if (toBeDeleteUrl === this.getRoutePath(route)) {
|
|
21091
|
+
// 对于新开的又即将关闭的tab,不缓存
|
|
21092
|
+
if (route.children.length === 0) {
|
|
21093
|
+
toBeDeleteUrl = "";
|
|
21094
|
+
}
|
|
21095
|
+
return false;
|
|
21096
|
+
}
|
|
21097
|
+
if (config && excludeRoutes.includes(this.getRoutePath(route))) {
|
|
21098
|
+
return false;
|
|
21099
|
+
}
|
|
21100
|
+
//Don't store lazy loaded routes
|
|
21101
|
+
return config && !config.loadChildren;
|
|
21102
|
+
};
|
|
21103
|
+
/**
|
|
21104
|
+
* @param {?} route
|
|
21105
|
+
* @param {?} handle
|
|
21106
|
+
* @return {?}
|
|
21107
|
+
*/
|
|
21108
|
+
KeepAliveService.prototype.store = /**
|
|
21109
|
+
* @param {?} route
|
|
21110
|
+
* @param {?} handle
|
|
21111
|
+
* @return {?}
|
|
21112
|
+
*/
|
|
21113
|
+
function (route, handle) {
|
|
21114
|
+
// console.log("store", this.getRoutePath(route));
|
|
21115
|
+
// console.log("store", storedRoutes);
|
|
21116
|
+
/** @type {?} */
|
|
21117
|
+
var key = this.getRoutePath(route);
|
|
21118
|
+
storedRoutes.set(key, handle);
|
|
21119
|
+
};
|
|
21120
|
+
/**
|
|
21121
|
+
* @param {?} route
|
|
21122
|
+
* @return {?}
|
|
21123
|
+
*/
|
|
21124
|
+
KeepAliveService.prototype.shouldAttach = /**
|
|
21125
|
+
* @param {?} route
|
|
21126
|
+
* @return {?}
|
|
21127
|
+
*/
|
|
21128
|
+
function (route) {
|
|
21129
|
+
/** @type {?} */
|
|
21130
|
+
var key = this.getRoutePath(route);
|
|
21131
|
+
return !!route.routeConfig && storedRoutes.has(key);
|
|
21132
|
+
};
|
|
21133
|
+
/**
|
|
21134
|
+
* @param {?} route
|
|
21135
|
+
* @return {?}
|
|
21136
|
+
*/
|
|
21137
|
+
KeepAliveService.prototype.retrieve = /**
|
|
21138
|
+
* @param {?} route
|
|
21139
|
+
* @return {?}
|
|
21140
|
+
*/
|
|
21141
|
+
function (route) {
|
|
21142
|
+
/** @type {?} */
|
|
21143
|
+
var config = route.routeConfig;
|
|
21144
|
+
/** @type {?} */
|
|
21145
|
+
var key = this.getRoutePath(route);
|
|
21146
|
+
//We don't store lazy loaded routes, so don't even bother trying to retrieve them
|
|
21147
|
+
if (!config || config.loadChildren) {
|
|
21148
|
+
return false;
|
|
21149
|
+
}
|
|
21150
|
+
return storedRoutes.get(key) || null;
|
|
21151
|
+
};
|
|
21152
|
+
/**
|
|
21153
|
+
* @param {?} future
|
|
21154
|
+
* @param {?} curr
|
|
21155
|
+
* @return {?}
|
|
21156
|
+
*/
|
|
21157
|
+
KeepAliveService.prototype.shouldReuseRoute = /**
|
|
21158
|
+
* @param {?} future
|
|
21159
|
+
* @param {?} curr
|
|
21160
|
+
* @return {?}
|
|
21161
|
+
*/
|
|
21162
|
+
function (future, curr) {
|
|
21163
|
+
// console.log("shouldReuseRoute", future, curr);
|
|
21164
|
+
// return future.routeConfig === curr.routeConfig;
|
|
21165
|
+
if (future.routeConfig === curr.routeConfig) {
|
|
21166
|
+
if (future.children.length === 0 && curr.children.length === 0) {
|
|
21167
|
+
// 无子路由时, 通过params和queryParams判断是否复用路由
|
|
21168
|
+
return (JSON.stringify(future.params) === JSON.stringify(curr.params) &&
|
|
21169
|
+
JSON.stringify(future.queryParams) ===
|
|
21170
|
+
JSON.stringify(curr.queryParams));
|
|
21171
|
+
}
|
|
21172
|
+
return true;
|
|
21173
|
+
}
|
|
21174
|
+
return false;
|
|
21175
|
+
};
|
|
21176
|
+
/**
|
|
21177
|
+
* @param {?} route
|
|
21178
|
+
* @return {?}
|
|
21179
|
+
*/
|
|
21180
|
+
KeepAliveService.prototype.getRoutePath = /**
|
|
21181
|
+
* @param {?} route
|
|
21182
|
+
* @return {?}
|
|
21183
|
+
*/
|
|
21184
|
+
function (route) {
|
|
21185
|
+
if (route.routeConfig) {
|
|
21186
|
+
// const pathParams = JSON.stringify(route.params);
|
|
21187
|
+
/** @type {?} */
|
|
21188
|
+
var queryParams = new URLSearchParams(route.queryParams).toString();
|
|
21189
|
+
/** @type {?} */
|
|
21190
|
+
var url = route._urlSegment.segments.map((/**
|
|
21191
|
+
* @param {?} v
|
|
21192
|
+
* @return {?}
|
|
21193
|
+
*/
|
|
21194
|
+
function (v) { return v.path; })).join("/");
|
|
21195
|
+
return "/" + url + (queryParams ? "?" + queryParams : "");
|
|
21196
|
+
}
|
|
21197
|
+
return "";
|
|
21198
|
+
};
|
|
21199
|
+
/**
|
|
21200
|
+
* @param {?} path
|
|
21201
|
+
* @return {?}
|
|
21202
|
+
*/
|
|
21203
|
+
KeepAliveService.prototype.clearCache = /**
|
|
21204
|
+
* @param {?} path
|
|
21205
|
+
* @return {?}
|
|
21206
|
+
*/
|
|
21207
|
+
function (path) {
|
|
21208
|
+
// console.log("clearCache", storedRoutes, path);
|
|
21209
|
+
toBeDeleteUrl = path;
|
|
21210
|
+
storedRoutes.delete(path);
|
|
21211
|
+
};
|
|
21212
|
+
/**
|
|
21213
|
+
* @return {?}
|
|
21214
|
+
*/
|
|
21215
|
+
KeepAliveService.prototype.clearAllCache = /**
|
|
21216
|
+
* @return {?}
|
|
21217
|
+
*/
|
|
21218
|
+
function () {
|
|
21219
|
+
sessionStorage.removeItem("TabCache");
|
|
21220
|
+
if (this.baseComponent) {
|
|
21221
|
+
this.baseComponent.ngOnDestroy();
|
|
21222
|
+
}
|
|
21223
|
+
storedRoutes.clear();
|
|
21224
|
+
};
|
|
21225
|
+
/**
|
|
21226
|
+
* @param {?} component
|
|
21227
|
+
* @return {?}
|
|
21228
|
+
*/
|
|
21229
|
+
KeepAliveService.prototype.setBaseComponent = /**
|
|
21230
|
+
* @param {?} component
|
|
21231
|
+
* @return {?}
|
|
21232
|
+
*/
|
|
21233
|
+
function (component) {
|
|
21234
|
+
this.baseComponent = component;
|
|
21235
|
+
};
|
|
21236
|
+
return KeepAliveService;
|
|
21237
|
+
}());
|
|
21238
|
+
if (false) {
|
|
21239
|
+
/**
|
|
21240
|
+
* @type {?}
|
|
21241
|
+
* @private
|
|
21242
|
+
*/
|
|
21243
|
+
KeepAliveService.prototype.baseComponent;
|
|
21244
|
+
}
|
|
21245
|
+
|
|
21204
21246
|
/**
|
|
21205
21247
|
* @fileoverview added by tsickle
|
|
21206
21248
|
* Generated from: lib/dialog/common-dialog/index.component.ts
|
|
@@ -21459,8 +21501,6 @@ var RaiseCommonLibModule = /** @class */ (function () {
|
|
|
21459
21501
|
CommonFunctionService,
|
|
21460
21502
|
IconLoaderService,
|
|
21461
21503
|
DialogService,
|
|
21462
|
-
KeepAliveService,
|
|
21463
|
-
DrawerService,
|
|
21464
21504
|
TranslationService,
|
|
21465
21505
|
],
|
|
21466
21506
|
exports: [
|