raise-common-lib 0.0.22 → 0.0.23

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.
@@ -1822,11 +1822,16 @@
1822
1822
  * @return {?}
1823
1823
  */
1824
1824
  function (future, curr) {
1825
- console.log("shouldReuseRoute");
1826
- // return this.getRoutePath(future) === this.getRoutePath(curr); // 复用相同的路由
1827
- return (future.routeConfig === curr.routeConfig &&
1828
- JSON.stringify(future.params) === JSON.stringify(curr.params) &&
1829
- JSON.stringify(future.queryParams) === JSON.stringify(curr.queryParams));
1825
+ if (future.routeConfig === curr.routeConfig) {
1826
+ if (future.children.length === 0 && curr.children.length === 0) {
1827
+ // 无子路由时, 通过params和queryParams判断是否复用路由
1828
+ return (JSON.stringify(future.params) === JSON.stringify(curr.params) &&
1829
+ JSON.stringify(future.queryParams) ===
1830
+ JSON.stringify(curr.queryParams));
1831
+ }
1832
+ return true;
1833
+ }
1834
+ return false;
1830
1835
  };
1831
1836
  /**
1832
1837
  * @param {?} route
@@ -2228,26 +2233,37 @@
2228
2233
  */
2229
2234
  var RSHeaderComponent = /** @class */ (function () {
2230
2235
  function RSHeaderComponent() {
2231
- this.toggleMenu = new core.EventEmitter();
2232
2236
  this.isCollapsed = false; // 接收输入属性
2233
2237
  // 接收输入属性
2234
2238
  this.lastLoginTime = new Date();
2235
- this.langOptions = [
2236
- {
2237
- value: 1,
2238
- text: "English",
2239
- },
2240
- {
2241
- value: 2,
2242
- text: "繁體中文",
2243
- },
2244
- {
2245
- value: 3,
2246
- text: "简体中文",
2247
- },
2248
- ];
2249
- this.currentLang = this.langOptions[0];
2239
+ this.toggleMenu = new core.EventEmitter();
2240
+ this.changeLanguage = new core.EventEmitter();
2241
+ this._langOptions = [];
2250
2242
  }
2243
+ Object.defineProperty(RSHeaderComponent.prototype, "langOptions", {
2244
+ get: /**
2245
+ * @return {?}
2246
+ */
2247
+ function () {
2248
+ return this._langOptions;
2249
+ },
2250
+ set: /**
2251
+ * @param {?} options
2252
+ * @return {?}
2253
+ */
2254
+ function (options) {
2255
+ this._langOptions = options;
2256
+ if (options && options.length > 0) {
2257
+ this.currentLang = options.find((/**
2258
+ * @param {?} e
2259
+ * @return {?}
2260
+ */
2261
+ function (e) { return e.defaultLang; }));
2262
+ }
2263
+ },
2264
+ enumerable: true,
2265
+ configurable: true
2266
+ });
2251
2267
  /**
2252
2268
  * @return {?}
2253
2269
  */
@@ -2255,7 +2271,7 @@
2255
2271
  * @return {?}
2256
2272
  */
2257
2273
  function () {
2258
- this.translation = JSON.parse(localStorage.getItem("translation"));
2274
+ this.translation = JSON.parse(localStorage.getItem("translation")) || {};
2259
2275
  };
2260
2276
  /**
2261
2277
  * @return {?}
@@ -2280,6 +2296,7 @@
2280
2296
  * @return {?}
2281
2297
  */
2282
2298
  function (item) { return item.text === event.item.text; }));
2299
+ this.changeLanguage.emit(this.currentLang.languageCode);
2283
2300
  };
2284
2301
  RSHeaderComponent.decorators = [
2285
2302
  { type: core.Component, args: [{
@@ -2289,25 +2306,32 @@
2289
2306
  }] }
2290
2307
  ];
2291
2308
  RSHeaderComponent.propDecorators = {
2292
- toggleMenu: [{ type: core.Output }],
2293
2309
  isCollapsed: [{ type: core.Input }],
2294
- lastLoginTime: [{ type: core.Input }]
2310
+ lastLoginTime: [{ type: core.Input }],
2311
+ langOptions: [{ type: core.Input }],
2312
+ toggleMenu: [{ type: core.Output }],
2313
+ changeLanguage: [{ type: core.Output }]
2295
2314
  };
2296
2315
  return RSHeaderComponent;
2297
2316
  }());
2298
2317
  if (false) {
2299
- /** @type {?} */
2300
- RSHeaderComponent.prototype.toggleMenu;
2301
2318
  /** @type {?} */
2302
2319
  RSHeaderComponent.prototype.isCollapsed;
2303
2320
  /** @type {?} */
2304
2321
  RSHeaderComponent.prototype.lastLoginTime;
2305
2322
  /** @type {?} */
2306
- RSHeaderComponent.prototype.translation;
2323
+ RSHeaderComponent.prototype.toggleMenu;
2307
2324
  /** @type {?} */
2308
- RSHeaderComponent.prototype.langOptions;
2325
+ RSHeaderComponent.prototype.changeLanguage;
2326
+ /**
2327
+ * @type {?}
2328
+ * @private
2329
+ */
2330
+ RSHeaderComponent.prototype._langOptions;
2309
2331
  /** @type {?} */
2310
2332
  RSHeaderComponent.prototype.currentLang;
2333
+ /** @type {?} */
2334
+ RSHeaderComponent.prototype.translation;
2311
2335
  }
2312
2336
 
2313
2337
  /**
@@ -2410,7 +2434,7 @@
2410
2434
  this.isCollapsed = false; // 接收输入属性
2411
2435
  // 接收输入属性
2412
2436
  this.navList = [];
2413
- this.currentNav = null;
2437
+ this.currentNav = "";
2414
2438
  }
2415
2439
  /**
2416
2440
  * @return {?}
@@ -2418,7 +2442,22 @@
2418
2442
  RSAsideComponent.prototype.ngOnInit = /**
2419
2443
  * @return {?}
2420
2444
  */
2421
- function () { };
2445
+ function () {
2446
+ var _this = this;
2447
+ // 监听路由变化
2448
+ this.router.events
2449
+ .pipe(operators.filter((/**
2450
+ * @param {?} event
2451
+ * @return {?}
2452
+ */
2453
+ function (event) { return event instanceof router.NavigationEnd; })))
2454
+ .subscribe((/**
2455
+ * @return {?}
2456
+ */
2457
+ function () {
2458
+ _this.currentNav = _this.router.url;
2459
+ }));
2460
+ };
2422
2461
  /**
2423
2462
  * @param {?} item
2424
2463
  * @return {?}
@@ -2428,8 +2467,8 @@
2428
2467
  * @return {?}
2429
2468
  */
2430
2469
  function (item) {
2431
- this.currentNav = item.title;
2432
- this.router.navigate([item.url], { state: { title: item.title } });
2470
+ this.currentNav = item.url;
2471
+ this.router.navigate([item.url], { state: { title: item.label } });
2433
2472
  /** @type {?} */
2434
2473
  var screenWidth = window.innerWidth;
2435
2474
  if (screenWidth <= 992 && this.isCollapsed) {
@@ -2439,7 +2478,7 @@
2439
2478
  RSAsideComponent.decorators = [
2440
2479
  { type: core.Component, args: [{
2441
2480
  selector: "rs-aside",
2442
- template: "<div class=\"rs-aside\" [ngClass]=\"{ isCollapsed: isCollapsed }\">\r\n <div class=\"nav-list\">\r\n <div\r\n class=\"nav-item\"\r\n [ngClass]=\"{ isCurrent: currentNav === nav.title }\"\r\n *ngFor=\"let nav of navList\"\r\n (click)=\"onNavClick(nav)\"\r\n >\r\n <div class=\"nav-item-inner\">\r\n <mat-icon class=\"menu-icon\" [svgIcon]=\"nav.icon\"></mat-icon>\r\n <span class=\"nav-text\" [ngClass]=\"{ isCollapsed: isCollapsed }\">{{\r\n nav.title\r\n }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"bottom-iconbox\" [ngClass]=\"{ isCollapsed: isCollapsed }\">\r\n <ng-content select=\"[bottomIconBox]\"></ng-content>\r\n </div>\r\n</div>\r\n",
2481
+ template: "<div class=\"rs-aside\" [ngClass]=\"{ isCollapsed: isCollapsed }\">\r\n <div class=\"nav-list\">\r\n <div\r\n class=\"nav-item\"\r\n [ngClass]=\"{ isCurrent: currentNav === nav.url }\"\r\n *ngFor=\"let nav of navList\"\r\n (click)=\"onNavClick(nav)\"\r\n >\r\n <div class=\"nav-item-inner\">\r\n <mat-icon class=\"menu-icon\" [svgIcon]=\"nav.iconCode\"></mat-icon>\r\n <span class=\"nav-text\" [ngClass]=\"{ isCollapsed: isCollapsed }\">{{\r\n nav.label\r\n }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"bottom-iconbox\" [ngClass]=\"{ isCollapsed: isCollapsed }\">\r\n <ng-content select=\"[bottomIconBox]\"></ng-content>\r\n </div>\r\n</div>\r\n",
2443
2482
  styles: [".rs-aside{display:flex;flex-direction:column;height:100%;width:240px;will-change:width;transition:width .3s;padding-right:16px}.rs-aside.isCollapsed{width:64px;padding-right:0}.rs-aside .nav-list{padding-top:12px;flex:1;overflow:auto;height:0}.rs-aside .nav-list .nav-item{height:32px;cursor:pointer;padding-left:11px}.rs-aside .nav-list .nav-item .nav-item-inner{display:flex;align-items:center;padding:8px 8px 8px 12px}.rs-aside .nav-list .nav-item .nav-item-inner ::ng-deep .menu-icon{width:33px;height:16px}.rs-aside .nav-list .nav-item .nav-item-inner ::ng-deep .menu-icon svg{width:16px;height:16px;color:#6c7c90;stroke:#6c7c90}.rs-aside .nav-list .nav-item:hover .nav-item-inner{border-radius:6px;background:rgba(31,123,255,.04)}.rs-aside .nav-list .nav-item:hover .nav-item-inner ::ng-deep .menu-icon svg{color:#44566c;stroke:#44566c}.rs-aside .nav-list .nav-item .nav-text{color:#5f6f81;font-family:Arial;font-size:12px;font-weight:400;line-height:16px;transition:.3s;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;position:relative;top:1px}@media (min-width:992px){.rs-aside .nav-list .nav-item .nav-text.isCollapsed{opacity:0;width:0}}.rs-aside .nav-list .nav-item.isCurrent{position:relative}.rs-aside .nav-list .nav-item.isCurrent .nav-text{color:#44566c;font-weight:700}.rs-aside .nav-list .nav-item.isCurrent::before{content:\"\";position:absolute;left:4px;top:8px;width:3px;height:16px;background-color:#1364b3;border-radius:2px}.rs-aside .bottom-iconbox{padding:12px 20px;height:48px;display:flex;gap:12px}.rs-aside .bottom-iconbox ::ng-deep .menu-bottom-icon{width:24px;height:24px;display:flex;justify-content:center;align-items:center;border:1px solid #eaedf0;border-radius:24px;cursor:pointer}.rs-aside .bottom-iconbox ::ng-deep .menu-bottom-icon svg{width:16px;height:16px;color:#6c7c90;stroke:#6c7c90}.rs-aside .bottom-iconbox ::ng-deep .menu-bottom-icon.disabled{cursor:default;opacity:.5}.rs-aside .bottom-iconbox ::ng-deep .menu-bottom-icon:not(.disabled):hover{background-color:#fff}.rs-aside .bottom-iconbox ::ng-deep .menu-bottom-icon:not(.disabled):hover svg{color:#1f7bff;stroke:#1f7bff}@media (min-width:992px){.rs-aside .bottom-iconbox.isCollapsed{flex-direction:column;height:auto}}@media (max-width:992px){.rs-aside{width:0;overflow:hidden;position:absolute;height:calc(100% - 50px);z-index:10;background-color:var(--rs-container-bg);padding-right:0}.rs-aside.isCollapsed{width:240px;padding-right:16px}}"]
2444
2483
  }] }
2445
2484
  ];
@@ -3038,7 +3077,7 @@
3038
3077
  * @return {?}
3039
3078
  */
3040
3079
  function () {
3041
- this.translation = JSON.parse(localStorage.getItem("translation"));
3080
+ this.translation = JSON.parse(localStorage.getItem("translation")) || {};
3042
3081
  this.title =
3043
3082
  this.data.title || this.translation["DELETE_RECORD"] || ".DELETE_RECORD";
3044
3083
  this.saveBtnLabel =
@@ -3122,7 +3161,7 @@
3122
3161
  * @param dialog: MatDialog
3123
3162
  */
3124
3163
  this.translation = null;
3125
- this.translation = JSON.parse(localStorage.getItem("translation"));
3164
+ this.translation = JSON.parse(localStorage.getItem("translation")) || {};
3126
3165
  }
3127
3166
  /**
3128
3167
  * @param {?} config
@@ -3422,7 +3461,7 @@
3422
3461
  * @return {?}
3423
3462
  */
3424
3463
  function () {
3425
- this.translation = JSON.parse(localStorage.getItem("translation"));
3464
+ this.translation = JSON.parse(localStorage.getItem("translation")) || {};
3426
3465
  this.saveBtnLabel =
3427
3466
  this.saveBtnLabel || this.translation.SAVE || ".SAVE";
3428
3467
  this.cancelBtnLabel =