raise-common-lib 0.0.31 → 0.0.33

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.
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, ContentChild, Injectable, ɵɵdefineInjectable, ɵɵinject, HostListener, ComponentFactoryResolver, ViewContainerRef, ViewChildren, Inject, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
2
  import { GridModule, PagerModule, GridAllModule, PageService, SortService, FilterService, ExcelExportService, EditService, ResizeService, ToolbarService, ColumnChooserService, AggregateService, ColumnMenuService, DetailRowService, SelectionService, GroupService } from '@syncfusion/ej2-angular-grids';
3
3
  import { debounce } from 'lodash';
4
- import { NavigationEnd, Router, ActivatedRoute } from '@angular/router';
4
+ import { NavigationEnd, Router, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
5
5
  import { filter } from 'rxjs/operators';
6
6
  import { BehaviorSubject } from 'rxjs';
7
7
  import { HttpClient, HttpClientModule } from '@angular/common/http';
@@ -1323,144 +1323,6 @@ CommonFunctionService.decorators = [
1323
1323
  CommonFunctionService.ctorParameters = () => [];
1324
1324
  /** @nocollapse */ CommonFunctionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function CommonFunctionService_Factory() { return new CommonFunctionService(); }, token: CommonFunctionService, providedIn: "root" });
1325
1325
 
1326
- /**
1327
- * @fileoverview added by tsickle
1328
- * Generated from: lib/service/keep-alive.service.ts
1329
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1330
- */
1331
- /** @type {?} */
1332
- const storedRoutes = new Map();
1333
- /** @type {?} */
1334
- let toBeDeleteUrl;
1335
- /** @type {?} */
1336
- let excludeRoutes = [];
1337
- // 不需要缓存的url
1338
- class KeepAliveService {
1339
- /**
1340
- * @param {?} routes
1341
- * @return {?}
1342
- */
1343
- setExcludeRoutes(routes) {
1344
- excludeRoutes = routes; // 设置不缓存的路由
1345
- }
1346
- /**
1347
- * @param {?} route
1348
- * @return {?}
1349
- */
1350
- shouldDetach(route) {
1351
- /** @type {?} */
1352
- let config = route.routeConfig;
1353
- // console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
1354
- if (toBeDeleteUrl === this.getRoutePath(route)) {
1355
- // 对于新开的又即将关闭的tab,不缓存
1356
- if (route.children.length === 0) {
1357
- toBeDeleteUrl = "";
1358
- }
1359
- return false;
1360
- }
1361
- if (config && excludeRoutes.includes(this.getRoutePath(route))) {
1362
- return false;
1363
- }
1364
- //Don't store lazy loaded routes
1365
- return config && !config.loadChildren;
1366
- }
1367
- /**
1368
- * @param {?} route
1369
- * @param {?} handle
1370
- * @return {?}
1371
- */
1372
- store(route, handle) {
1373
- // console.log("store", this.getRoutePath(route));
1374
- // console.log("store", storedRoutes);
1375
- /** @type {?} */
1376
- const key = this.getRoutePath(route);
1377
- storedRoutes.set(key, handle);
1378
- }
1379
- /**
1380
- * @param {?} route
1381
- * @return {?}
1382
- */
1383
- shouldAttach(route) {
1384
- /** @type {?} */
1385
- const key = this.getRoutePath(route);
1386
- return !!route.routeConfig && storedRoutes.has(key);
1387
- }
1388
- /**
1389
- * @param {?} route
1390
- * @return {?}
1391
- */
1392
- retrieve(route) {
1393
- /** @type {?} */
1394
- let config = route.routeConfig;
1395
- /** @type {?} */
1396
- const key = this.getRoutePath(route);
1397
- //We don't store lazy loaded routes, so don't even bother trying to retrieve them
1398
- if (!config || config.loadChildren) {
1399
- return false;
1400
- }
1401
- return storedRoutes.get(key) || null;
1402
- }
1403
- /**
1404
- * @param {?} future
1405
- * @param {?} curr
1406
- * @return {?}
1407
- */
1408
- shouldReuseRoute(future, curr) {
1409
- // console.log("shouldReuseRoute", future, curr);
1410
- // return future.routeConfig === curr.routeConfig;
1411
- if (future.routeConfig === curr.routeConfig) {
1412
- if (future.children.length === 0 && curr.children.length === 0) {
1413
- // 无子路由时, 通过params和queryParams判断是否复用路由
1414
- return (JSON.stringify(future.params) === JSON.stringify(curr.params) &&
1415
- JSON.stringify(future.queryParams) ===
1416
- JSON.stringify(curr.queryParams));
1417
- }
1418
- return true;
1419
- }
1420
- return false;
1421
- }
1422
- /**
1423
- * @param {?} route
1424
- * @return {?}
1425
- */
1426
- getRoutePath(route) {
1427
- if (route.routeConfig) {
1428
- // const pathParams = JSON.stringify(route.params);
1429
- /** @type {?} */
1430
- const queryParams = new URLSearchParams(route.queryParams).toString();
1431
- /** @type {?} */
1432
- const url = route._urlSegment.segments.map((/**
1433
- * @param {?} v
1434
- * @return {?}
1435
- */
1436
- (v) => v.path)).join("/");
1437
- return "/" + url + (queryParams ? "?" + queryParams : "");
1438
- }
1439
- return "";
1440
- }
1441
- /**
1442
- * @param {?} path
1443
- * @return {?}
1444
- */
1445
- clearCache(path) {
1446
- // console.log("clearCache", storedRoutes, path);
1447
- toBeDeleteUrl = path;
1448
- storedRoutes.delete(path);
1449
- }
1450
- /**
1451
- * @return {?}
1452
- */
1453
- clearAllCache() {
1454
- storedRoutes.clear();
1455
- }
1456
- }
1457
- KeepAliveService.decorators = [
1458
- { type: Injectable, args: [{
1459
- providedIn: "root",
1460
- },] }
1461
- ];
1462
- /** @nocollapse */ KeepAliveService.ngInjectableDef = ɵɵdefineInjectable({ factory: function KeepAliveService_Factory() { return new KeepAliveService(); }, token: KeepAliveService, providedIn: "root" });
1463
-
1464
1326
  /**
1465
1327
  * @fileoverview added by tsickle
1466
1328
  * Generated from: lib/service/drawer.service.ts
@@ -1657,19 +1519,18 @@ class MultiTabComponent {
1657
1519
  * @param {?} router
1658
1520
  * @param {?} cf
1659
1521
  * @param {?} activatedRoute
1660
- * @param {?} keepAlive
1661
1522
  * @param {?} ref
1662
1523
  * @param {?} drawer
1524
+ * @param {?} routeReuseStrategy
1663
1525
  */
1664
- constructor(router, cf, activatedRoute, keepAlive, ref, drawer) {
1526
+ constructor(router, cf, activatedRoute, ref, drawer, routeReuseStrategy) {
1665
1527
  this.router = router;
1666
1528
  this.cf = cf;
1667
1529
  this.activatedRoute = activatedRoute;
1668
- this.keepAlive = keepAlive;
1669
1530
  this.ref = ref;
1670
1531
  this.drawer = drawer;
1532
+ this.routeReuseStrategy = routeReuseStrategy;
1671
1533
  this.singleReuseUrls = []; //只能单个缓存的url
1672
- //只能单个缓存的url
1673
1534
  this.TAB_WIDTH = 164;
1674
1535
  this.GAP_NORMAL = 54;
1675
1536
  this.GAP_SMALL = 30;
@@ -1677,6 +1538,7 @@ class MultiTabComponent {
1677
1538
  this.selectedTab = 0;
1678
1539
  this.maxTabs = 10;
1679
1540
  this.screenWidth = window.innerWidth; // 初始化屏幕宽度
1541
+ this.keepAlive = (/** @type {?} */ (this.routeReuseStrategy));
1680
1542
  }
1681
1543
  // 初始化屏幕宽度
1682
1544
  /**
@@ -1702,7 +1564,7 @@ class MultiTabComponent {
1702
1564
  if (isExistIdx !== -1) {
1703
1565
  this.selectedTab = isExistIdx;
1704
1566
  }
1705
- this.router.events
1567
+ this.subscription = this.router.events
1706
1568
  .pipe(filter((/**
1707
1569
  * @param {?} event
1708
1570
  * @return {?}
@@ -1743,6 +1605,14 @@ class MultiTabComponent {
1743
1605
  this.setEllipsisTitle();
1744
1606
  }), 50);
1745
1607
  }
1608
+ /**
1609
+ * @return {?}
1610
+ */
1611
+ ngOnDestroy() {
1612
+ if (this.subscription) {
1613
+ this.subscription.unsubscribe();
1614
+ }
1615
+ }
1746
1616
  /**
1747
1617
  * @param {?=} title
1748
1618
  * @return {?}
@@ -1789,17 +1659,17 @@ class MultiTabComponent {
1789
1659
  let leftWidth;
1790
1660
  /** @type {?} */
1791
1661
  let rightWidth;
1792
- if (wrap && ulElement && refreshTabDiv) {
1662
+ if (wrap && ulElement) {
1793
1663
  // 获取元素的位置信息
1794
1664
  /** @type {?} */
1795
1665
  const wrapRect = wrap.getBoundingClientRect();
1796
1666
  /** @type {?} */
1797
1667
  const ulRect = ulElement.getBoundingClientRect();
1798
1668
  /** @type {?} */
1799
- const refreshTabRect = refreshTabDiv.getBoundingClientRect();
1669
+ const refreshTabRect = refreshTabDiv && refreshTabDiv.getBoundingClientRect();
1800
1670
  allWidth = wrapRect.width;
1801
1671
  leftWidth = ulRect.width;
1802
- rightWidth = refreshTabRect.width;
1672
+ rightWidth = (refreshTabRect && refreshTabRect.width) || 100;
1803
1673
  }
1804
1674
  return {
1805
1675
  allWidth,
@@ -1927,7 +1797,7 @@ class MultiTabComponent {
1927
1797
  }
1928
1798
  MultiTabComponent.decorators = [
1929
1799
  { type: Component, args: [{
1930
- selector: "rs-multi-tab",
1800
+ selector: "kt-multi-tab",
1931
1801
  template: "<div class=\"rs-multi-tab\" *ngIf=\"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()\">\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",
1932
1802
  styles: [".rs-multi-tab{border-bottom:1px solid #e5eaef;height:28px;width:100%;display:flex;justify-content:space-between}.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:100%;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}}"]
1933
1803
  }] }
@@ -1937,17 +1807,24 @@ MultiTabComponent.ctorParameters = () => [
1937
1807
  { type: Router },
1938
1808
  { type: CommonFunctionService },
1939
1809
  { type: ActivatedRoute },
1940
- { type: KeepAliveService },
1941
1810
  { type: ChangeDetectorRef },
1942
- { type: DrawerService }
1811
+ { type: DrawerService },
1812
+ { type: RouteReuseStrategy }
1943
1813
  ];
1944
1814
  MultiTabComponent.propDecorators = {
1945
1815
  singleReuseUrls: [{ type: Input }],
1946
1816
  onResize: [{ type: HostListener, args: ["window:resize", ["$event"],] }]
1947
1817
  };
1948
1818
  if (false) {
1819
+ /** @type {?} */
1820
+ MultiTabComponent.prototype.keepAlive;
1949
1821
  /** @type {?} */
1950
1822
  MultiTabComponent.prototype.singleReuseUrls;
1823
+ /**
1824
+ * @type {?}
1825
+ * @private
1826
+ */
1827
+ MultiTabComponent.prototype.subscription;
1951
1828
  /** @type {?} */
1952
1829
  MultiTabComponent.prototype.TAB_WIDTH;
1953
1830
  /** @type {?} */
@@ -1974,8 +1851,6 @@ if (false) {
1974
1851
  MultiTabComponent.prototype.cf;
1975
1852
  /** @type {?} */
1976
1853
  MultiTabComponent.prototype.activatedRoute;
1977
- /** @type {?} */
1978
- MultiTabComponent.prototype.keepAlive;
1979
1854
  /**
1980
1855
  * @type {?}
1981
1856
  * @private
@@ -1986,6 +1861,11 @@ if (false) {
1986
1861
  * @private
1987
1862
  */
1988
1863
  MultiTabComponent.prototype.drawer;
1864
+ /**
1865
+ * @type {?}
1866
+ * @private
1867
+ */
1868
+ MultiTabComponent.prototype.routeReuseStrategy;
1989
1869
  }
1990
1870
 
1991
1871
  /**
@@ -20501,6 +20381,157 @@ if (false) {
20501
20381
  DialogService.prototype.dialog;
20502
20382
  }
20503
20383
 
20384
+ /**
20385
+ * @fileoverview added by tsickle
20386
+ * Generated from: lib/service/keep-alive.service.ts
20387
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
20388
+ */
20389
+ /** @type {?} */
20390
+ const storedRoutes = new Map();
20391
+ /** @type {?} */
20392
+ let toBeDeleteUrl;
20393
+ /** @type {?} */
20394
+ let excludeRoutes = [];
20395
+ // 不需要缓存的url
20396
+ class KeepAliveService {
20397
+ // 用于存储 BaseComponent 的实例
20398
+ /**
20399
+ * @param {?} routes
20400
+ * @return {?}
20401
+ */
20402
+ setExcludeRoutes(routes) {
20403
+ excludeRoutes = routes; // 设置不缓存的路由
20404
+ }
20405
+ /**
20406
+ * @param {?} route
20407
+ * @return {?}
20408
+ */
20409
+ shouldDetach(route) {
20410
+ /** @type {?} */
20411
+ let config = route.routeConfig;
20412
+ // console.log("shouldDetach", toBeDeleteUrl, this.getRoutePath(route));
20413
+ if (toBeDeleteUrl === this.getRoutePath(route)) {
20414
+ // 对于新开的又即将关闭的tab,不缓存
20415
+ if (route.children.length === 0) {
20416
+ toBeDeleteUrl = "";
20417
+ }
20418
+ return false;
20419
+ }
20420
+ if (config && excludeRoutes.includes(this.getRoutePath(route))) {
20421
+ return false;
20422
+ }
20423
+ //Don't store lazy loaded routes
20424
+ return config && !config.loadChildren;
20425
+ }
20426
+ /**
20427
+ * @param {?} route
20428
+ * @param {?} handle
20429
+ * @return {?}
20430
+ */
20431
+ store(route, handle) {
20432
+ // console.log("store", this.getRoutePath(route));
20433
+ // console.log("store", storedRoutes);
20434
+ /** @type {?} */
20435
+ const key = this.getRoutePath(route);
20436
+ storedRoutes.set(key, handle);
20437
+ }
20438
+ /**
20439
+ * @param {?} route
20440
+ * @return {?}
20441
+ */
20442
+ shouldAttach(route) {
20443
+ /** @type {?} */
20444
+ const key = this.getRoutePath(route);
20445
+ return !!route.routeConfig && storedRoutes.has(key);
20446
+ }
20447
+ /**
20448
+ * @param {?} route
20449
+ * @return {?}
20450
+ */
20451
+ retrieve(route) {
20452
+ /** @type {?} */
20453
+ let config = route.routeConfig;
20454
+ /** @type {?} */
20455
+ const key = this.getRoutePath(route);
20456
+ //We don't store lazy loaded routes, so don't even bother trying to retrieve them
20457
+ if (!config || config.loadChildren) {
20458
+ return false;
20459
+ }
20460
+ return storedRoutes.get(key) || null;
20461
+ }
20462
+ /**
20463
+ * @param {?} future
20464
+ * @param {?} curr
20465
+ * @return {?}
20466
+ */
20467
+ shouldReuseRoute(future, curr) {
20468
+ // console.log("shouldReuseRoute", future, curr);
20469
+ // return future.routeConfig === curr.routeConfig;
20470
+ if (future.routeConfig === curr.routeConfig) {
20471
+ if (future.children.length === 0 && curr.children.length === 0) {
20472
+ // 无子路由时, 通过params和queryParams判断是否复用路由
20473
+ return (JSON.stringify(future.params) === JSON.stringify(curr.params) &&
20474
+ JSON.stringify(future.queryParams) ===
20475
+ JSON.stringify(curr.queryParams));
20476
+ }
20477
+ return true;
20478
+ }
20479
+ return false;
20480
+ }
20481
+ /**
20482
+ * @param {?} route
20483
+ * @return {?}
20484
+ */
20485
+ getRoutePath(route) {
20486
+ if (route.routeConfig) {
20487
+ // const pathParams = JSON.stringify(route.params);
20488
+ /** @type {?} */
20489
+ const queryParams = new URLSearchParams(route.queryParams).toString();
20490
+ /** @type {?} */
20491
+ const url = route._urlSegment.segments.map((/**
20492
+ * @param {?} v
20493
+ * @return {?}
20494
+ */
20495
+ (v) => v.path)).join("/");
20496
+ return "/" + url + (queryParams ? "?" + queryParams : "");
20497
+ }
20498
+ return "";
20499
+ }
20500
+ /**
20501
+ * @param {?} path
20502
+ * @return {?}
20503
+ */
20504
+ clearCache(path) {
20505
+ // console.log("clearCache", storedRoutes, path);
20506
+ toBeDeleteUrl = path;
20507
+ storedRoutes.delete(path);
20508
+ }
20509
+ /**
20510
+ * @return {?}
20511
+ */
20512
+ clearAllCache() {
20513
+ sessionStorage.removeItem("TabCache");
20514
+ if (this.baseComponent) {
20515
+ this.baseComponent.ngOnDestroy();
20516
+ }
20517
+ storedRoutes.clear();
20518
+ }
20519
+ /**
20520
+ * @param {?} component
20521
+ * @return {?}
20522
+ */
20523
+ setBaseComponent(component) {
20524
+ this.baseComponent = component;
20525
+ }
20526
+ }
20527
+ if (false) {
20528
+ /**
20529
+ * @type {?}
20530
+ * @private
20531
+ */
20532
+ KeepAliveService.prototype.baseComponent;
20533
+ }
20534
+
20504
20535
  /**
20505
20536
  * @fileoverview added by tsickle
20506
20537
  * Generated from: lib/dialog/common-dialog/index.component.ts
@@ -20742,8 +20773,6 @@ RaiseCommonLibModule.decorators = [
20742
20773
  CommonFunctionService,
20743
20774
  IconLoaderService,
20744
20775
  DialogService,
20745
- KeepAliveService,
20746
- DrawerService,
20747
20776
  TranslationService,
20748
20777
  ],
20749
20778
  exports: [