raise-common-lib 0.0.24 → 0.0.26
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 +61 -17
- 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 +17 -4
- package/esm2015/lib/layout/rs-header/index.component.js +4 -2
- package/esm2015/lib/service/keep-alive.service.js +38 -12
- package/esm5/lib/layout/multi-tab/index.component.js +19 -6
- package/esm5/lib/layout/rs-header/index.component.js +4 -2
- package/esm5/lib/service/keep-alive.service.js +41 -12
- package/fesm2015/raise-common-lib.js +56 -15
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +61 -17
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/layout/multi-tab/index.component.d.ts +1 -1
- package/lib/service/keep-alive.service.d.ts +1 -0
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -1734,7 +1734,7 @@
|
|
|
1734
1734
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1735
1735
|
*/
|
|
1736
1736
|
/** @type {?} */
|
|
1737
|
-
var storedRoutes =
|
|
1737
|
+
var storedRoutes = new Map();
|
|
1738
1738
|
/** @type {?} */
|
|
1739
1739
|
var toBeDeleteUrl;
|
|
1740
1740
|
/** @type {?} */
|
|
@@ -1763,12 +1763,21 @@
|
|
|
1763
1763
|
* @return {?}
|
|
1764
1764
|
*/
|
|
1765
1765
|
function (route) {
|
|
1766
|
+
/** @type {?} */
|
|
1767
|
+
var config = route.routeConfig;
|
|
1768
|
+
// console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
|
|
1766
1769
|
if (toBeDeleteUrl === this.getRoutePath(route)) {
|
|
1767
1770
|
// 对于新开的又即将关闭的tab,不缓存
|
|
1768
|
-
|
|
1771
|
+
if (route.children.length === 0) {
|
|
1772
|
+
toBeDeleteUrl = "";
|
|
1773
|
+
}
|
|
1774
|
+
return false;
|
|
1775
|
+
}
|
|
1776
|
+
if (config && excludeRoutes.includes(this.getRoutePath(route))) {
|
|
1769
1777
|
return false;
|
|
1770
1778
|
}
|
|
1771
|
-
|
|
1779
|
+
//Don't store lazy loaded routes
|
|
1780
|
+
return config && !config.loadChildren;
|
|
1772
1781
|
};
|
|
1773
1782
|
/**
|
|
1774
1783
|
* @param {?} route
|
|
@@ -1783,7 +1792,9 @@
|
|
|
1783
1792
|
function (route, handle) {
|
|
1784
1793
|
// console.log("store", this.getRoutePath(route));
|
|
1785
1794
|
// console.log("store", storedRoutes);
|
|
1786
|
-
|
|
1795
|
+
/** @type {?} */
|
|
1796
|
+
var key = this.getRoutePath(route);
|
|
1797
|
+
storedRoutes.set(key, handle);
|
|
1787
1798
|
};
|
|
1788
1799
|
/**
|
|
1789
1800
|
* @param {?} route
|
|
@@ -1794,7 +1805,9 @@
|
|
|
1794
1805
|
* @return {?}
|
|
1795
1806
|
*/
|
|
1796
1807
|
function (route) {
|
|
1797
|
-
|
|
1808
|
+
/** @type {?} */
|
|
1809
|
+
var key = this.getRoutePath(route);
|
|
1810
|
+
return !!route.routeConfig && storedRoutes.has(key);
|
|
1798
1811
|
};
|
|
1799
1812
|
/**
|
|
1800
1813
|
* @param {?} route
|
|
@@ -1805,11 +1818,15 @@
|
|
|
1805
1818
|
* @return {?}
|
|
1806
1819
|
*/
|
|
1807
1820
|
function (route) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1821
|
+
/** @type {?} */
|
|
1822
|
+
var config = route.routeConfig;
|
|
1823
|
+
/** @type {?} */
|
|
1824
|
+
var key = this.getRoutePath(route);
|
|
1825
|
+
//We don't store lazy loaded routes, so don't even bother trying to retrieve them
|
|
1826
|
+
if (!config || config.loadChildren) {
|
|
1827
|
+
return false;
|
|
1828
|
+
}
|
|
1829
|
+
return storedRoutes.get(key) || null;
|
|
1813
1830
|
};
|
|
1814
1831
|
/**
|
|
1815
1832
|
* @param {?} future
|
|
@@ -1822,6 +1839,8 @@
|
|
|
1822
1839
|
* @return {?}
|
|
1823
1840
|
*/
|
|
1824
1841
|
function (future, curr) {
|
|
1842
|
+
// console.log("shouldReuseRoute", future, curr);
|
|
1843
|
+
// return future.routeConfig === curr.routeConfig;
|
|
1825
1844
|
if (future.routeConfig === curr.routeConfig) {
|
|
1826
1845
|
if (future.children.length === 0 && curr.children.length === 0) {
|
|
1827
1846
|
// 无子路由时, 通过params和queryParams判断是否复用路由
|
|
@@ -1843,6 +1862,7 @@
|
|
|
1843
1862
|
*/
|
|
1844
1863
|
function (route) {
|
|
1845
1864
|
if (route.routeConfig) {
|
|
1865
|
+
// const pathParams = JSON.stringify(route.params);
|
|
1846
1866
|
/** @type {?} */
|
|
1847
1867
|
var queryParams = new URLSearchParams(route.queryParams).toString();
|
|
1848
1868
|
/** @type {?} */
|
|
@@ -1866,7 +1886,16 @@
|
|
|
1866
1886
|
function (path) {
|
|
1867
1887
|
// console.log("clearCache", storedRoutes, path);
|
|
1868
1888
|
toBeDeleteUrl = path;
|
|
1869
|
-
delete
|
|
1889
|
+
storedRoutes.delete(path);
|
|
1890
|
+
};
|
|
1891
|
+
/**
|
|
1892
|
+
* @return {?}
|
|
1893
|
+
*/
|
|
1894
|
+
KeepAliveService.prototype.clearAllCache = /**
|
|
1895
|
+
* @return {?}
|
|
1896
|
+
*/
|
|
1897
|
+
function () {
|
|
1898
|
+
storedRoutes.clear();
|
|
1870
1899
|
};
|
|
1871
1900
|
KeepAliveService.decorators = [
|
|
1872
1901
|
{ type: core.Injectable, args: [{
|
|
@@ -1923,6 +1952,16 @@
|
|
|
1923
1952
|
function () {
|
|
1924
1953
|
var _this = this;
|
|
1925
1954
|
this.initTab();
|
|
1955
|
+
// 解决刷新页面后,选中的 tab 丢失问题
|
|
1956
|
+
/** @type {?} */
|
|
1957
|
+
var isExistIdx = this.tabList.findIndex((/**
|
|
1958
|
+
* @param {?} ele
|
|
1959
|
+
* @return {?}
|
|
1960
|
+
*/
|
|
1961
|
+
function (ele) { return ele.url === _this.router.url; }));
|
|
1962
|
+
if (isExistIdx !== -1) {
|
|
1963
|
+
this.selectedTab = isExistIdx;
|
|
1964
|
+
}
|
|
1926
1965
|
this.router.events
|
|
1927
1966
|
.pipe(operators.filter((/**
|
|
1928
1967
|
* @param {?} event
|
|
@@ -1940,8 +1979,11 @@
|
|
|
1940
1979
|
var state = navigation.extras.state;
|
|
1941
1980
|
// 获取传递的 state
|
|
1942
1981
|
/** @type {?} */
|
|
1982
|
+
var skipLocationChange = navigation.extras.skipLocationChange;
|
|
1983
|
+
// 获取是否跳过 location change
|
|
1984
|
+
/** @type {?} */
|
|
1943
1985
|
var currentRoute = _this.router.routerState.root.firstChild;
|
|
1944
|
-
if (currentRoute) {
|
|
1986
|
+
if (currentRoute && !skipLocationChange) {
|
|
1945
1987
|
_this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, state && state.title);
|
|
1946
1988
|
}
|
|
1947
1989
|
}
|
|
@@ -2098,14 +2140,14 @@
|
|
|
2098
2140
|
};
|
|
2099
2141
|
/**
|
|
2100
2142
|
* @param {?} url
|
|
2101
|
-
* @param {
|
|
2102
|
-
* @param {
|
|
2143
|
+
* @param {?=} pureUrl
|
|
2144
|
+
* @param {?=} title
|
|
2103
2145
|
* @return {?}
|
|
2104
2146
|
*/
|
|
2105
2147
|
MultiTabComponent.prototype.setTab = /**
|
|
2106
2148
|
* @param {?} url
|
|
2107
|
-
* @param {
|
|
2108
|
-
* @param {
|
|
2149
|
+
* @param {?=} pureUrl
|
|
2150
|
+
* @param {?=} title
|
|
2109
2151
|
* @return {?}
|
|
2110
2152
|
*/
|
|
2111
2153
|
function (url, pureUrl, title) {
|
|
@@ -2254,11 +2296,13 @@
|
|
|
2254
2296
|
function (options) {
|
|
2255
2297
|
this._langOptions = options;
|
|
2256
2298
|
if (options && options.length > 0) {
|
|
2299
|
+
/** @type {?} */
|
|
2300
|
+
var languageCode_1 = localStorage.getItem("language");
|
|
2257
2301
|
this.currentLang = options.find((/**
|
|
2258
2302
|
* @param {?} e
|
|
2259
2303
|
* @return {?}
|
|
2260
2304
|
*/
|
|
2261
|
-
function (e) { return e.
|
|
2305
|
+
function (e) { return e.languageCode === languageCode_1; }));
|
|
2262
2306
|
}
|
|
2263
2307
|
},
|
|
2264
2308
|
enumerable: true,
|