raise-common-lib 0.0.42 → 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 {?}
@@ -1935,7 +1973,7 @@ var MultiTabComponent = /** @class */ (function () {
1935
1973
  _this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title);
1936
1974
  }
1937
1975
  }
1938
- }));
1976
+ })));
1939
1977
  };
1940
1978
  /**
1941
1979
  * @return {?}
@@ -1959,9 +1997,11 @@ var MultiTabComponent = /** @class */ (function () {
1959
1997
  * @return {?}
1960
1998
  */
1961
1999
  function () {
1962
- if (this.subscription) {
1963
- this.subscription.unsubscribe();
1964
- }
2000
+ this.subscriptions.forEach((/**
2001
+ * @param {?} sub
2002
+ * @return {?}
2003
+ */
2004
+ function (sub) { return sub.unsubscribe(); }));
1965
2005
  };
1966
2006
  /**
1967
2007
  * @param {?=} title
@@ -2047,16 +2087,16 @@ var MultiTabComponent = /** @class */ (function () {
2047
2087
  this.tabList = TabCache || [];
2048
2088
  };
2049
2089
  /**
2050
- * @param {?} tab
2051
2090
  * @param {?} idx
2052
2091
  * @return {?}
2053
2092
  */
2054
2093
  MultiTabComponent.prototype.closeTab = /**
2055
- * @param {?} tab
2056
2094
  * @param {?} idx
2057
2095
  * @return {?}
2058
2096
  */
2059
- function (tab, idx) {
2097
+ function (idx) {
2098
+ /** @type {?} */
2099
+ var tab = this.tabList[idx];
2060
2100
  this.tabList = this.tabList.filter((/**
2061
2101
  * @param {?} ele
2062
2102
  * @return {?}
@@ -2099,7 +2139,7 @@ var MultiTabComponent = /** @class */ (function () {
2099
2139
  */
2100
2140
  function (url, title) {
2101
2141
  if (this.tabList.length >= this.maxTabs) {
2102
- this.closeTab(this.tabList[0], 0); // 删除第一个
2142
+ this.closeTab(0); // 删除第一个
2103
2143
  }
2104
2144
  this.tabList.push({
2105
2145
  url: url,
@@ -2188,7 +2228,7 @@ var MultiTabComponent = /** @class */ (function () {
2188
2228
  MultiTabComponent.decorators = [
2189
2229
  { type: Component, args: [{
2190
2230
  selector: "rs-multi-tab",
2191
- 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",
2192
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}}"]
2193
2233
  }] }
2194
2234
  ];
@@ -2219,7 +2259,7 @@ if (false) {
2219
2259
  * @type {?}
2220
2260
  * @private
2221
2261
  */
2222
- MultiTabComponent.prototype.subscription;
2262
+ MultiTabComponent.prototype.subscriptions;
2223
2263
  /** @type {?} */
2224
2264
  MultiTabComponent.prototype.TAB_WIDTH;
2225
2265
  /** @type {?} */