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.
- package/bundles/raise-common-lib.umd.js +59 -16
- 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 +33 -15
- package/esm2015/lib/service/common-function.service.js +23 -2
- package/esm5/lib/layout/multi-tab/index.component.js +33 -16
- package/esm5/lib/service/common-function.service.js +28 -1
- package/fesm2015/raise-common-lib.js +55 -17
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +60 -17
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/layout/multi-tab/index.component.d.ts +2 -2
- package/lib/service/common-function.service.d.ts +4 -0
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
- package/src/assets/style/reset/button.scss +18 -2
- package/src/assets/style/reset/dropdown.scss +2 -2
- package/src/assets/style/reset/grid.scss +23 -0
- package/src/assets/style/reset/input.scss +6 -0
- package/src/assets/style/variables.scss +1 -1
|
@@ -3,7 +3,7 @@ import { GridModule, PagerModule, GridAllModule, PageService, SortService, Filte
|
|
|
3
3
|
import { debounce } from 'lodash';
|
|
4
4
|
import { NavigationEnd, Router, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
|
|
5
5
|
import { filter } from 'rxjs/operators';
|
|
6
|
-
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
7
7
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
8
8
|
import { setCulture, L10n } from '@syncfusion/ej2-base';
|
|
9
9
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
@@ -1252,7 +1252,10 @@ if (false) {
|
|
|
1252
1252
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1253
1253
|
*/
|
|
1254
1254
|
class CommonFunctionService {
|
|
1255
|
-
constructor() {
|
|
1255
|
+
constructor() {
|
|
1256
|
+
this.closeTabSubject = new Subject();
|
|
1257
|
+
this.closeTab$ = this.closeTabSubject.asObservable();
|
|
1258
|
+
}
|
|
1256
1259
|
/**
|
|
1257
1260
|
* @return {?}
|
|
1258
1261
|
*/
|
|
@@ -1313,6 +1316,14 @@ class CommonFunctionService {
|
|
|
1313
1316
|
}
|
|
1314
1317
|
return url;
|
|
1315
1318
|
}
|
|
1319
|
+
// 删除当前
|
|
1320
|
+
/**
|
|
1321
|
+
* @param {?=} tabIndex
|
|
1322
|
+
* @return {?}
|
|
1323
|
+
*/
|
|
1324
|
+
closeTab(tabIndex) {
|
|
1325
|
+
return this.closeTabSubject.next(tabIndex);
|
|
1326
|
+
}
|
|
1316
1327
|
}
|
|
1317
1328
|
CommonFunctionService.decorators = [
|
|
1318
1329
|
{ type: Injectable, args: [{
|
|
@@ -1321,7 +1332,16 @@ CommonFunctionService.decorators = [
|
|
|
1321
1332
|
];
|
|
1322
1333
|
/** @nocollapse */
|
|
1323
1334
|
CommonFunctionService.ctorParameters = () => [];
|
|
1324
|
-
/** @nocollapse */ CommonFunctionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function CommonFunctionService_Factory() { return new CommonFunctionService(); }, token: CommonFunctionService, providedIn: "root" });
|
|
1335
|
+
/** @nocollapse */ CommonFunctionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function CommonFunctionService_Factory() { return new CommonFunctionService(); }, token: CommonFunctionService, providedIn: "root" });
|
|
1336
|
+
if (false) {
|
|
1337
|
+
/**
|
|
1338
|
+
* @type {?}
|
|
1339
|
+
* @private
|
|
1340
|
+
*/
|
|
1341
|
+
CommonFunctionService.prototype.closeTabSubject;
|
|
1342
|
+
/** @type {?} */
|
|
1343
|
+
CommonFunctionService.prototype.closeTab$;
|
|
1344
|
+
}
|
|
1325
1345
|
|
|
1326
1346
|
/**
|
|
1327
1347
|
* @fileoverview added by tsickle
|
|
@@ -1575,6 +1595,8 @@ class MultiTabComponent {
|
|
|
1575
1595
|
this.singleReuseUrls = []; //只能单个缓存的url
|
|
1576
1596
|
//只能单个缓存的url
|
|
1577
1597
|
this.noGenerateTabUrls = []; //不生成tab的url
|
|
1598
|
+
//不生成tab的url
|
|
1599
|
+
this.subscriptions = [];
|
|
1578
1600
|
this.TAB_WIDTH = 164;
|
|
1579
1601
|
this.GAP_NORMAL = 54;
|
|
1580
1602
|
this.GAP_SMALL = 30;
|
|
@@ -1597,6 +1619,16 @@ class MultiTabComponent {
|
|
|
1597
1619
|
* @return {?}
|
|
1598
1620
|
*/
|
|
1599
1621
|
ngOnInit() {
|
|
1622
|
+
this.subscriptions.push(this.cf.closeTab$.subscribe((/**
|
|
1623
|
+
* @param {?} idx
|
|
1624
|
+
* @return {?}
|
|
1625
|
+
*/
|
|
1626
|
+
(idx) => {
|
|
1627
|
+
if (idx === undefined) {
|
|
1628
|
+
idx = this.selectedTab;
|
|
1629
|
+
}
|
|
1630
|
+
this.closeTab(idx);
|
|
1631
|
+
})));
|
|
1600
1632
|
this.initTab();
|
|
1601
1633
|
// 解决刷新页面后,选中的 tab 丢失问题
|
|
1602
1634
|
/** @type {?} */
|
|
@@ -1608,7 +1640,7 @@ class MultiTabComponent {
|
|
|
1608
1640
|
if (isExistIdx !== -1) {
|
|
1609
1641
|
this.selectedTab = isExistIdx;
|
|
1610
1642
|
}
|
|
1611
|
-
this.
|
|
1643
|
+
this.subscriptions.push(this.router.events
|
|
1612
1644
|
.pipe(filter((/**
|
|
1613
1645
|
* @param {?} event
|
|
1614
1646
|
* @return {?}
|
|
@@ -1629,17 +1661,20 @@ class MultiTabComponent {
|
|
|
1629
1661
|
// 获取是否跳过 location change
|
|
1630
1662
|
/** @type {?} */
|
|
1631
1663
|
const currentRoute = this.router.routerState.root.firstChild;
|
|
1664
|
+
/** @type {?} */
|
|
1665
|
+
let title = state && state.title;
|
|
1632
1666
|
if (currentRoute && !skipLocationChange) {
|
|
1633
|
-
if (this.tabList.length === 0 && !state) {
|
|
1634
|
-
return; // 初始化第一个url不加入multi-tab
|
|
1635
|
-
}
|
|
1636
1667
|
if (this.noGenerateTabUrls.includes(this.router.url)) {
|
|
1637
1668
|
return; // 排除不生成tab的url
|
|
1638
1669
|
}
|
|
1639
|
-
|
|
1670
|
+
if (this.tabList.length === 0 && !state) {
|
|
1671
|
+
title = sessionStorage.getItem("firstTabTitle");
|
|
1672
|
+
sessionStorage.removeItem("firstTabTitle");
|
|
1673
|
+
}
|
|
1674
|
+
this.setTab(this.router.url, currentRoute.snapshot.routeConfig.path, title);
|
|
1640
1675
|
}
|
|
1641
1676
|
}
|
|
1642
|
-
}));
|
|
1677
|
+
})));
|
|
1643
1678
|
}
|
|
1644
1679
|
/**
|
|
1645
1680
|
* @return {?}
|
|
@@ -1656,9 +1691,11 @@ class MultiTabComponent {
|
|
|
1656
1691
|
* @return {?}
|
|
1657
1692
|
*/
|
|
1658
1693
|
ngOnDestroy() {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1694
|
+
this.subscriptions.forEach((/**
|
|
1695
|
+
* @param {?} sub
|
|
1696
|
+
* @return {?}
|
|
1697
|
+
*/
|
|
1698
|
+
(sub) => sub.unsubscribe()));
|
|
1662
1699
|
}
|
|
1663
1700
|
/**
|
|
1664
1701
|
* @param {?=} title
|
|
@@ -1733,11 +1770,12 @@ class MultiTabComponent {
|
|
|
1733
1770
|
this.tabList = TabCache || [];
|
|
1734
1771
|
}
|
|
1735
1772
|
/**
|
|
1736
|
-
* @param {?} tab
|
|
1737
1773
|
* @param {?} idx
|
|
1738
1774
|
* @return {?}
|
|
1739
1775
|
*/
|
|
1740
|
-
closeTab(
|
|
1776
|
+
closeTab(idx) {
|
|
1777
|
+
/** @type {?} */
|
|
1778
|
+
const tab = this.tabList[idx];
|
|
1741
1779
|
this.tabList = this.tabList.filter((/**
|
|
1742
1780
|
* @param {?} ele
|
|
1743
1781
|
* @return {?}
|
|
@@ -1770,7 +1808,7 @@ class MultiTabComponent {
|
|
|
1770
1808
|
*/
|
|
1771
1809
|
addTab(url, title) {
|
|
1772
1810
|
if (this.tabList.length >= this.maxTabs) {
|
|
1773
|
-
this.closeTab(
|
|
1811
|
+
this.closeTab(0); // 删除第一个
|
|
1774
1812
|
}
|
|
1775
1813
|
this.tabList.push({
|
|
1776
1814
|
url: url,
|
|
@@ -1845,7 +1883,7 @@ class MultiTabComponent {
|
|
|
1845
1883
|
MultiTabComponent.decorators = [
|
|
1846
1884
|
{ type: Component, args: [{
|
|
1847
1885
|
selector: "rs-multi-tab",
|
|
1848
|
-
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(
|
|
1886
|
+
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",
|
|
1849
1887
|
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}}"]
|
|
1850
1888
|
}] }
|
|
1851
1889
|
];
|
|
@@ -1874,7 +1912,7 @@ if (false) {
|
|
|
1874
1912
|
* @type {?}
|
|
1875
1913
|
* @private
|
|
1876
1914
|
*/
|
|
1877
|
-
MultiTabComponent.prototype.
|
|
1915
|
+
MultiTabComponent.prototype.subscriptions;
|
|
1878
1916
|
/** @type {?} */
|
|
1879
1917
|
MultiTabComponent.prototype.TAB_WIDTH;
|
|
1880
1918
|
/** @type {?} */
|