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.
@@ -4,7 +4,7 @@ import { GridModule, PagerModule, GridAllModule, PageService, SortService, Filte
4
4
  import { debounce } from 'lodash';
5
5
  import { NavigationEnd, Router, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
6
6
  import { filter } from 'rxjs/operators';
7
- import { BehaviorSubject } from 'rxjs';
7
+ import { Subject, BehaviorSubject } from 'rxjs';
8
8
  import { HttpClient, HttpClientModule } from '@angular/common/http';
9
9
  import { setCulture, L10n } from '@syncfusion/ej2-base';
10
10
  import { DatePipe, CommonModule } from '@angular/common';
@@ -1478,6 +1478,8 @@ if (false) {
1478
1478
  */
1479
1479
  var CommonFunctionService = /** @class */ (function () {
1480
1480
  function CommonFunctionService() {
1481
+ this.closeTabSubject = new Subject();
1482
+ this.closeTab$ = this.closeTabSubject.asObservable();
1481
1483
  }
1482
1484
  /**
1483
1485
  * @return {?}
@@ -1554,6 +1556,21 @@ var CommonFunctionService = /** @class */ (function () {
1554
1556
  }
1555
1557
  return url;
1556
1558
  };
1559
+ // 删除当前
1560
+ // 删除当前
1561
+ /**
1562
+ * @param {?=} tabIndex
1563
+ * @return {?}
1564
+ */
1565
+ CommonFunctionService.prototype.closeTab =
1566
+ // 删除当前
1567
+ /**
1568
+ * @param {?=} tabIndex
1569
+ * @return {?}
1570
+ */
1571
+ function (tabIndex) {
1572
+ return this.closeTabSubject.next(tabIndex);
1573
+ };
1557
1574
  CommonFunctionService.decorators = [
1558
1575
  { type: Injectable, args: [{
1559
1576
  providedIn: "root",
@@ -1563,7 +1580,16 @@ var CommonFunctionService = /** @class */ (function () {
1563
1580
  CommonFunctionService.ctorParameters = function () { return []; };
1564
1581
  /** @nocollapse */ CommonFunctionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function CommonFunctionService_Factory() { return new CommonFunctionService(); }, token: CommonFunctionService, providedIn: "root" });
1565
1582
  return CommonFunctionService;
1566
- }());
1583
+ }());
1584
+ if (false) {
1585
+ /**
1586
+ * @type {?}
1587
+ * @private
1588
+ */
1589
+ CommonFunctionService.prototype.closeTabSubject;
1590
+ /** @type {?} */
1591
+ CommonFunctionService.prototype.closeTab$;
1592
+ }
1567
1593
 
1568
1594
  /**
1569
1595
  * @fileoverview added by tsickle
@@ -1858,6 +1884,8 @@ var MultiTabComponent = /** @class */ (function () {
1858
1884
  this.singleReuseUrls = []; //只能单个缓存的url
1859
1885
  //只能单个缓存的url
1860
1886
  this.noGenerateTabUrls = []; //不生成tab的url
1887
+ //不生成tab的url
1888
+ this.subscriptions = [];
1861
1889
  this.TAB_WIDTH = 164;
1862
1890
  this.GAP_NORMAL = 54;
1863
1891
  this.GAP_SMALL = 30;
@@ -1890,6 +1918,16 @@ var MultiTabComponent = /** @class */ (function () {
1890
1918
  */
1891
1919
  function () {
1892
1920
  var _this = this;
1921
+ this.subscriptions.push(this.cf.closeTab$.subscribe((/**
1922
+ * @param {?} idx
1923
+ * @return {?}
1924
+ */
1925
+ function (idx) {
1926
+ if (idx === undefined) {
1927
+ idx = _this.selectedTab;
1928
+ }
1929
+ _this.closeTab(idx);
1930
+ })));
1893
1931
  this.initTab();
1894
1932
  // 解决刷新页面后,选中的 tab 丢失问题
1895
1933
  /** @type {?} */
@@ -1901,7 +1939,7 @@ var MultiTabComponent = /** @class */ (function () {
1901
1939
  if (isExistIdx !== -1) {
1902
1940
  this.selectedTab = isExistIdx;
1903
1941
  }
1904
- this.subscription = this.router.events
1942
+ this.subscriptions.push(this.router.events
1905
1943
  .pipe(filter((/**
1906
1944
  * @param {?} event
1907
1945
  * @return {?}
@@ -1922,17 +1960,20 @@ var MultiTabComponent = /** @class */ (function () {
1922
1960
  // 获取是否跳过 location change
1923
1961
  /** @type {?} */
1924
1962
  var currentRoute = _this.router.routerState.root.firstChild;
1963
+ /** @type {?} */
1964
+ var title = state && state.title;
1925
1965
  if (currentRoute && !skipLocationChange) {
1926
- if (_this.tabList.length === 0 && !state) {
1927
- return; // 初始化第一个url不加入multi-tab
1928
- }
1929
1966
  if (_this.noGenerateTabUrls.includes(_this.router.url)) {
1930
1967
  return; // 排除不生成tab的url
1931
1968
  }
1932
- _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, state && state.title);
1969
+ if (_this.tabList.length === 0 && !state) {
1970
+ title = sessionStorage.getItem("firstTabTitle");
1971
+ sessionStorage.removeItem("firstTabTitle");
1972
+ }
1973
+ _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title);
1933
1974
  }
1934
1975
  }
1935
- }));
1976
+ })));
1936
1977
  };
1937
1978
  /**
1938
1979
  * @return {?}
@@ -1956,9 +1997,11 @@ var MultiTabComponent = /** @class */ (function () {
1956
1997
  * @return {?}
1957
1998
  */
1958
1999
  function () {
1959
- if (this.subscription) {
1960
- this.subscription.unsubscribe();
1961
- }
2000
+ this.subscriptions.forEach((/**
2001
+ * @param {?} sub
2002
+ * @return {?}
2003
+ */
2004
+ function (sub) { return sub.unsubscribe(); }));
1962
2005
  };
1963
2006
  /**
1964
2007
  * @param {?=} title
@@ -2044,16 +2087,16 @@ var MultiTabComponent = /** @class */ (function () {
2044
2087
  this.tabList = TabCache || [];
2045
2088
  };
2046
2089
  /**
2047
- * @param {?} tab
2048
2090
  * @param {?} idx
2049
2091
  * @return {?}
2050
2092
  */
2051
2093
  MultiTabComponent.prototype.closeTab = /**
2052
- * @param {?} tab
2053
2094
  * @param {?} idx
2054
2095
  * @return {?}
2055
2096
  */
2056
- function (tab, idx) {
2097
+ function (idx) {
2098
+ /** @type {?} */
2099
+ var tab = this.tabList[idx];
2057
2100
  this.tabList = this.tabList.filter((/**
2058
2101
  * @param {?} ele
2059
2102
  * @return {?}
@@ -2096,7 +2139,7 @@ var MultiTabComponent = /** @class */ (function () {
2096
2139
  */
2097
2140
  function (url, title) {
2098
2141
  if (this.tabList.length >= this.maxTabs) {
2099
- this.closeTab(this.tabList[0], 0); // 删除第一个
2142
+ this.closeTab(0); // 删除第一个
2100
2143
  }
2101
2144
  this.tabList.push({
2102
2145
  url: url,
@@ -2185,7 +2228,7 @@ var MultiTabComponent = /** @class */ (function () {
2185
2228
  MultiTabComponent.decorators = [
2186
2229
  { type: Component, args: [{
2187
2230
  selector: "rs-multi-tab",
2188
- 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",
2231
+ 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",
2189
2232
  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}}"]
2190
2233
  }] }
2191
2234
  ];
@@ -2216,7 +2259,7 @@ if (false) {
2216
2259
  * @type {?}
2217
2260
  * @private
2218
2261
  */
2219
- MultiTabComponent.prototype.subscription;
2262
+ MultiTabComponent.prototype.subscriptions;
2220
2263
  /** @type {?} */
2221
2264
  MultiTabComponent.prototype.TAB_WIDTH;
2222
2265
  /** @type {?} */