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.
@@ -1536,7 +1536,7 @@ var CommonFunctionService = /** @class */ (function () {
1536
1536
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1537
1537
  */
1538
1538
  /** @type {?} */
1539
- var storedRoutes = {};
1539
+ var storedRoutes = new Map();
1540
1540
  /** @type {?} */
1541
1541
  var toBeDeleteUrl;
1542
1542
  /** @type {?} */
@@ -1565,12 +1565,21 @@ var KeepAliveService = /** @class */ (function () {
1565
1565
  * @return {?}
1566
1566
  */
1567
1567
  function (route) {
1568
+ /** @type {?} */
1569
+ var config = route.routeConfig;
1570
+ // console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
1568
1571
  if (toBeDeleteUrl === this.getRoutePath(route)) {
1569
1572
  // 对于新开的又即将关闭的tab,不缓存
1570
- toBeDeleteUrl = "";
1573
+ if (route.children.length === 0) {
1574
+ toBeDeleteUrl = "";
1575
+ }
1576
+ return false;
1577
+ }
1578
+ if (config && excludeRoutes.includes(this.getRoutePath(route))) {
1571
1579
  return false;
1572
1580
  }
1573
- return !excludeRoutes.includes(route.routeConfig.path);
1581
+ //Don't store lazy loaded routes
1582
+ return config && !config.loadChildren;
1574
1583
  };
1575
1584
  /**
1576
1585
  * @param {?} route
@@ -1585,7 +1594,9 @@ var KeepAliveService = /** @class */ (function () {
1585
1594
  function (route, handle) {
1586
1595
  // console.log("store", this.getRoutePath(route));
1587
1596
  // console.log("store", storedRoutes);
1588
- storedRoutes[this.getRoutePath(route)] = handle;
1597
+ /** @type {?} */
1598
+ var key = this.getRoutePath(route);
1599
+ storedRoutes.set(key, handle);
1589
1600
  };
1590
1601
  /**
1591
1602
  * @param {?} route
@@ -1596,7 +1607,9 @@ var KeepAliveService = /** @class */ (function () {
1596
1607
  * @return {?}
1597
1608
  */
1598
1609
  function (route) {
1599
- return !!storedRoutes[this.getRoutePath(route)];
1610
+ /** @type {?} */
1611
+ var key = this.getRoutePath(route);
1612
+ return !!route.routeConfig && storedRoutes.has(key);
1600
1613
  };
1601
1614
  /**
1602
1615
  * @param {?} route
@@ -1607,11 +1620,15 @@ var KeepAliveService = /** @class */ (function () {
1607
1620
  * @return {?}
1608
1621
  */
1609
1622
  function (route) {
1610
- if (!route.routeConfig)
1611
- return null;
1612
- if (route.routeConfig.loadChildren)
1613
- return null;
1614
- return storedRoutes[this.getRoutePath(route)];
1623
+ /** @type {?} */
1624
+ var config = route.routeConfig;
1625
+ /** @type {?} */
1626
+ var key = this.getRoutePath(route);
1627
+ //We don't store lazy loaded routes, so don't even bother trying to retrieve them
1628
+ if (!config || config.loadChildren) {
1629
+ return false;
1630
+ }
1631
+ return storedRoutes.get(key) || null;
1615
1632
  };
1616
1633
  /**
1617
1634
  * @param {?} future
@@ -1624,6 +1641,8 @@ var KeepAliveService = /** @class */ (function () {
1624
1641
  * @return {?}
1625
1642
  */
1626
1643
  function (future, curr) {
1644
+ // console.log("shouldReuseRoute", future, curr);
1645
+ // return future.routeConfig === curr.routeConfig;
1627
1646
  if (future.routeConfig === curr.routeConfig) {
1628
1647
  if (future.children.length === 0 && curr.children.length === 0) {
1629
1648
  // 无子路由时, 通过params和queryParams判断是否复用路由
@@ -1645,6 +1664,7 @@ var KeepAliveService = /** @class */ (function () {
1645
1664
  */
1646
1665
  function (route) {
1647
1666
  if (route.routeConfig) {
1667
+ // const pathParams = JSON.stringify(route.params);
1648
1668
  /** @type {?} */
1649
1669
  var queryParams = new URLSearchParams(route.queryParams).toString();
1650
1670
  /** @type {?} */
@@ -1668,7 +1688,16 @@ var KeepAliveService = /** @class */ (function () {
1668
1688
  function (path) {
1669
1689
  // console.log("clearCache", storedRoutes, path);
1670
1690
  toBeDeleteUrl = path;
1671
- delete storedRoutes[path]; // 清除指定路径的缓存
1691
+ storedRoutes.delete(path);
1692
+ };
1693
+ /**
1694
+ * @return {?}
1695
+ */
1696
+ KeepAliveService.prototype.clearAllCache = /**
1697
+ * @return {?}
1698
+ */
1699
+ function () {
1700
+ storedRoutes.clear();
1672
1701
  };
1673
1702
  KeepAliveService.decorators = [
1674
1703
  { type: Injectable, args: [{
@@ -1725,6 +1754,16 @@ var MultiTabComponent = /** @class */ (function () {
1725
1754
  function () {
1726
1755
  var _this = this;
1727
1756
  this.initTab();
1757
+ // 解决刷新页面后,选中的 tab 丢失问题
1758
+ /** @type {?} */
1759
+ var isExistIdx = this.tabList.findIndex((/**
1760
+ * @param {?} ele
1761
+ * @return {?}
1762
+ */
1763
+ function (ele) { return ele.url === _this.router.url; }));
1764
+ if (isExistIdx !== -1) {
1765
+ this.selectedTab = isExistIdx;
1766
+ }
1728
1767
  this.router.events
1729
1768
  .pipe(filter((/**
1730
1769
  * @param {?} event
@@ -1742,8 +1781,11 @@ var MultiTabComponent = /** @class */ (function () {
1742
1781
  var state = navigation.extras.state;
1743
1782
  // 获取传递的 state
1744
1783
  /** @type {?} */
1784
+ var skipLocationChange = navigation.extras.skipLocationChange;
1785
+ // 获取是否跳过 location change
1786
+ /** @type {?} */
1745
1787
  var currentRoute = _this.router.routerState.root.firstChild;
1746
- if (currentRoute) {
1788
+ if (currentRoute && !skipLocationChange) {
1747
1789
  _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, state && state.title);
1748
1790
  }
1749
1791
  }
@@ -1900,14 +1942,14 @@ var MultiTabComponent = /** @class */ (function () {
1900
1942
  };
1901
1943
  /**
1902
1944
  * @param {?} url
1903
- * @param {?} pureUrl
1904
- * @param {?} title
1945
+ * @param {?=} pureUrl
1946
+ * @param {?=} title
1905
1947
  * @return {?}
1906
1948
  */
1907
1949
  MultiTabComponent.prototype.setTab = /**
1908
1950
  * @param {?} url
1909
- * @param {?} pureUrl
1910
- * @param {?} title
1951
+ * @param {?=} pureUrl
1952
+ * @param {?=} title
1911
1953
  * @return {?}
1912
1954
  */
1913
1955
  function (url, pureUrl, title) {
@@ -2056,11 +2098,13 @@ var RSHeaderComponent = /** @class */ (function () {
2056
2098
  function (options) {
2057
2099
  this._langOptions = options;
2058
2100
  if (options && options.length > 0) {
2101
+ /** @type {?} */
2102
+ var languageCode_1 = localStorage.getItem("language");
2059
2103
  this.currentLang = options.find((/**
2060
2104
  * @param {?} e
2061
2105
  * @return {?}
2062
2106
  */
2063
- function (e) { return e.defaultLang; }));
2107
+ function (e) { return e.languageCode === languageCode_1; }));
2064
2108
  }
2065
2109
  },
2066
2110
  enumerable: true,