raise-common-lib 0.0.41 → 0.0.43

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.
@@ -1673,6 +1673,8 @@
1673
1673
  */
1674
1674
  var CommonFunctionService = /** @class */ (function () {
1675
1675
  function CommonFunctionService() {
1676
+ this.closeTabSubject = new rxjs.Subject();
1677
+ this.closeTab$ = this.closeTabSubject.asObservable();
1676
1678
  }
1677
1679
  /**
1678
1680
  * @return {?}
@@ -1749,6 +1751,21 @@
1749
1751
  }
1750
1752
  return url;
1751
1753
  };
1754
+ // 删除当前
1755
+ // 删除当前
1756
+ /**
1757
+ * @param {?=} tabIndex
1758
+ * @return {?}
1759
+ */
1760
+ CommonFunctionService.prototype.closeTab =
1761
+ // 删除当前
1762
+ /**
1763
+ * @param {?=} tabIndex
1764
+ * @return {?}
1765
+ */
1766
+ function (tabIndex) {
1767
+ return this.closeTabSubject.next(tabIndex);
1768
+ };
1752
1769
  CommonFunctionService.decorators = [
1753
1770
  { type: core.Injectable, args: [{
1754
1771
  providedIn: "root",
@@ -1758,7 +1775,16 @@
1758
1775
  CommonFunctionService.ctorParameters = function () { return []; };
1759
1776
  /** @nocollapse */ CommonFunctionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CommonFunctionService_Factory() { return new CommonFunctionService(); }, token: CommonFunctionService, providedIn: "root" });
1760
1777
  return CommonFunctionService;
1761
- }());
1778
+ }());
1779
+ if (false) {
1780
+ /**
1781
+ * @type {?}
1782
+ * @private
1783
+ */
1784
+ CommonFunctionService.prototype.closeTabSubject;
1785
+ /** @type {?} */
1786
+ CommonFunctionService.prototype.closeTab$;
1787
+ }
1762
1788
 
1763
1789
  /**
1764
1790
  * @fileoverview added by tsickle
@@ -2053,6 +2079,8 @@
2053
2079
  this.singleReuseUrls = []; //只能单个缓存的url
2054
2080
  //只能单个缓存的url
2055
2081
  this.noGenerateTabUrls = []; //不生成tab的url
2082
+ //不生成tab的url
2083
+ this.subscriptions = [];
2056
2084
  this.TAB_WIDTH = 164;
2057
2085
  this.GAP_NORMAL = 54;
2058
2086
  this.GAP_SMALL = 30;
@@ -2085,6 +2113,16 @@
2085
2113
  */
2086
2114
  function () {
2087
2115
  var _this = this;
2116
+ this.subscriptions.push(this.cf.closeTab$.subscribe((/**
2117
+ * @param {?} idx
2118
+ * @return {?}
2119
+ */
2120
+ function (idx) {
2121
+ if (idx === undefined) {
2122
+ idx = _this.selectedTab;
2123
+ }
2124
+ _this.closeTab(idx);
2125
+ })));
2088
2126
  this.initTab();
2089
2127
  // 解决刷新页面后,选中的 tab 丢失问题
2090
2128
  /** @type {?} */
@@ -2096,7 +2134,7 @@
2096
2134
  if (isExistIdx !== -1) {
2097
2135
  this.selectedTab = isExistIdx;
2098
2136
  }
2099
- this.subscription = this.router.events
2137
+ this.subscriptions.push(this.router.events
2100
2138
  .pipe(operators.filter((/**
2101
2139
  * @param {?} event
2102
2140
  * @return {?}
@@ -2117,17 +2155,20 @@
2117
2155
  // 获取是否跳过 location change
2118
2156
  /** @type {?} */
2119
2157
  var currentRoute = _this.router.routerState.root.firstChild;
2158
+ /** @type {?} */
2159
+ var title = state && state.title;
2120
2160
  if (currentRoute && !skipLocationChange) {
2121
- if (_this.tabList.length === 0 && !state) {
2122
- return; // 初始化第一个url不加入multi-tab
2123
- }
2124
2161
  if (_this.noGenerateTabUrls.includes(_this.router.url)) {
2125
2162
  return; // 排除不生成tab的url
2126
2163
  }
2127
- _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, state && state.title);
2164
+ if (_this.tabList.length === 0 && !state) {
2165
+ title = sessionStorage.getItem("firstTabTitle");
2166
+ sessionStorage.removeItem("firstTabTitle");
2167
+ }
2168
+ _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title);
2128
2169
  }
2129
2170
  }
2130
- }));
2171
+ })));
2131
2172
  };
2132
2173
  /**
2133
2174
  * @return {?}
@@ -2151,9 +2192,11 @@
2151
2192
  * @return {?}
2152
2193
  */
2153
2194
  function () {
2154
- if (this.subscription) {
2155
- this.subscription.unsubscribe();
2156
- }
2195
+ this.subscriptions.forEach((/**
2196
+ * @param {?} sub
2197
+ * @return {?}
2198
+ */
2199
+ function (sub) { return sub.unsubscribe(); }));
2157
2200
  };
2158
2201
  /**
2159
2202
  * @param {?=} title
@@ -2239,16 +2282,16 @@
2239
2282
  this.tabList = TabCache || [];
2240
2283
  };
2241
2284
  /**
2242
- * @param {?} tab
2243
2285
  * @param {?} idx
2244
2286
  * @return {?}
2245
2287
  */
2246
2288
  MultiTabComponent.prototype.closeTab = /**
2247
- * @param {?} tab
2248
2289
  * @param {?} idx
2249
2290
  * @return {?}
2250
2291
  */
2251
- function (tab, idx) {
2292
+ function (idx) {
2293
+ /** @type {?} */
2294
+ var tab = this.tabList[idx];
2252
2295
  this.tabList = this.tabList.filter((/**
2253
2296
  * @param {?} ele
2254
2297
  * @return {?}
@@ -2291,7 +2334,7 @@
2291
2334
  */
2292
2335
  function (url, title) {
2293
2336
  if (this.tabList.length >= this.maxTabs) {
2294
- this.closeTab(this.tabList[0], 0); // 删除第一个
2337
+ this.closeTab(0); // 删除第一个
2295
2338
  }
2296
2339
  this.tabList.push({
2297
2340
  url: url,
@@ -2380,7 +2423,7 @@
2380
2423
  MultiTabComponent.decorators = [
2381
2424
  { type: core.Component, args: [{
2382
2425
  selector: "rs-multi-tab",
2383
- template: "<div class=\"rs-multi-tab\" [ngClass]=\"{ 'b-line': 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()\" *ngIf=\"tabList.length > 0\">\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",
2426
+ template: "<div class=\"rs-multi-tab\" [ngClass]=\"{ 'b-line': 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(i)\"\r\n />\r\n </li>\r\n </ng-container>\r\n </ul>\r\n <div class=\"refresh-tab\" (click)=\"refreshTab()\" *ngIf=\"tabList.length > 0\">\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",
2384
2427
  styles: [".rs-multi-tab{width:100%;display:flex;justify-content:space-between}.rs-multi-tab.b-line{border-bottom:1px solid #e5eaef}.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:28px;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}}"]
2385
2428
  }] }
2386
2429
  ];
@@ -2411,7 +2454,7 @@
2411
2454
  * @type {?}
2412
2455
  * @private
2413
2456
  */
2414
- MultiTabComponent.prototype.subscription;
2457
+ MultiTabComponent.prototype.subscriptions;
2415
2458
  /** @type {?} */
2416
2459
  MultiTabComponent.prototype.TAB_WIDTH;
2417
2460
  /** @type {?} */