@delon/abc 16.0.1 → 16.1.1
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/date-picker/range.directive.d.ts +0 -1
- package/esm2022/auto-focus/auto-focus.directive.mjs +3 -3
- package/esm2022/auto-focus/auto-focus.module.mjs +4 -4
- package/esm2022/avatar-list/avatar-list-item.component.mjs +3 -3
- package/esm2022/avatar-list/avatar-list.component.mjs +3 -3
- package/esm2022/avatar-list/avatar-list.module.mjs +4 -4
- package/esm2022/count-down/count-down.component.mjs +3 -3
- package/esm2022/count-down/count-down.module.mjs +4 -4
- package/esm2022/date-picker/date-picker.module.mjs +4 -4
- package/esm2022/date-picker/range-shortcut.component.mjs +3 -3
- package/esm2022/date-picker/range.directive.mjs +4 -8
- package/esm2022/down-file/down-file.directive.mjs +3 -3
- package/esm2022/down-file/down-file.module.mjs +4 -4
- package/esm2022/ellipsis/ellipsis.component.mjs +3 -3
- package/esm2022/ellipsis/ellipsis.module.mjs +4 -4
- package/esm2022/error-collect/error-collect.component.mjs +3 -3
- package/esm2022/error-collect/error-collect.module.mjs +4 -4
- package/esm2022/exception/exception.component.mjs +3 -3
- package/esm2022/exception/exception.module.mjs +4 -4
- package/esm2022/footer-toolbar/footer-toolbar.component.mjs +3 -3
- package/esm2022/footer-toolbar/footer-toolbar.module.mjs +4 -4
- package/esm2022/full-content/full-content-toggle.directive.mjs +3 -3
- package/esm2022/full-content/full-content.component.mjs +3 -3
- package/esm2022/full-content/full-content.module.mjs +4 -4
- package/esm2022/full-content/full-content.service.mjs +3 -3
- package/esm2022/global-footer/global-footer-item.component.mjs +3 -3
- package/esm2022/global-footer/global-footer.component.mjs +3 -3
- package/esm2022/global-footer/global-footer.module.mjs +4 -4
- package/esm2022/hotkey/hotkey.directive.mjs +3 -3
- package/esm2022/hotkey/hotkey.module.mjs +4 -4
- package/esm2022/let/let.directive.mjs +3 -3
- package/esm2022/let/let.module.mjs +4 -4
- package/esm2022/loading/loading.component.mjs +3 -3
- package/esm2022/loading/loading.module.mjs +4 -4
- package/esm2022/loading/loading.service.mjs +3 -3
- package/esm2022/lodop/lodop.module.mjs +4 -4
- package/esm2022/lodop/lodop.service.mjs +3 -3
- package/esm2022/media/media.component.mjs +3 -3
- package/esm2022/media/media.module.mjs +4 -4
- package/esm2022/media/media.service.mjs +3 -3
- package/esm2022/notice-icon/notice-icon-tab.component.mjs +3 -3
- package/esm2022/notice-icon/notice-icon.component.mjs +3 -3
- package/esm2022/notice-icon/notice-icon.module.mjs +4 -4
- package/esm2022/observers/observer-size.mjs +10 -10
- package/esm2022/onboarding/onboarding.component.mjs +3 -3
- package/esm2022/onboarding/onboarding.module.mjs +4 -4
- package/esm2022/onboarding/onboarding.service.mjs +3 -3
- package/esm2022/page-header/page-header.component.mjs +3 -3
- package/esm2022/page-header/page-header.module.mjs +4 -4
- package/esm2022/pdf/pdf.component.mjs +3 -3
- package/esm2022/pdf/pdf.module.mjs +4 -4
- package/esm2022/qr/qr.component.mjs +3 -3
- package/esm2022/qr/qr.module.mjs +4 -4
- package/esm2022/quick-menu/quick-menu.component.mjs +3 -3
- package/esm2022/quick-menu/quick-menu.module.mjs +4 -4
- package/esm2022/result/result.component.mjs +3 -3
- package/esm2022/result/result.module.mjs +4 -4
- package/esm2022/reuse-tab/reuse-tab-context-menu.component.mjs +3 -3
- package/esm2022/reuse-tab/reuse-tab-context.component.mjs +3 -3
- package/esm2022/reuse-tab/reuse-tab-context.directive.mjs +3 -3
- package/esm2022/reuse-tab/reuse-tab-context.service.mjs +3 -3
- package/esm2022/reuse-tab/reuse-tab.cache.mjs +13 -0
- package/esm2022/reuse-tab/reuse-tab.component.mjs +3 -3
- package/esm2022/reuse-tab/reuse-tab.module.mjs +14 -5
- package/esm2022/reuse-tab/reuse-tab.service.mjs +52 -45
- package/esm2022/se/se-container.component.mjs +6 -6
- package/esm2022/se/se.component.mjs +3 -3
- package/esm2022/se/se.module.mjs +4 -4
- package/esm2022/sg/sg-container.component.mjs +3 -3
- package/esm2022/sg/sg.component.mjs +3 -3
- package/esm2022/sg/sg.module.mjs +4 -4
- package/esm2022/st/st-column-source.mjs +3 -3
- package/esm2022/st/st-data-source.mjs +3 -3
- package/esm2022/st/st-export.mjs +3 -3
- package/esm2022/st/st-filter.component.mjs +3 -3
- package/esm2022/st/st-row.directive.mjs +6 -6
- package/esm2022/st/st-widget-host.directive.mjs +3 -3
- package/esm2022/st/st-widget.mjs +3 -3
- package/esm2022/st/st.component.mjs +6 -6
- package/esm2022/st/st.module.mjs +4 -4
- package/esm2022/sv/sv-container.component.mjs +6 -6
- package/esm2022/sv/sv-value.component.mjs +3 -3
- package/esm2022/sv/sv.component.mjs +3 -3
- package/esm2022/sv/sv.module.mjs +4 -4
- package/esm2022/tag-select/tag-select.component.mjs +3 -3
- package/esm2022/tag-select/tag-select.module.mjs +4 -4
- package/esm2022/xlsx/xlsx.directive.mjs +3 -3
- package/esm2022/xlsx/xlsx.module.mjs +4 -4
- package/esm2022/xlsx/xlsx.service.mjs +3 -3
- package/esm2022/zip/zip.module.mjs +4 -4
- package/esm2022/zip/zip.service.mjs +3 -3
- package/fesm2022/auto-focus.mjs +7 -7
- package/fesm2022/avatar-list.mjs +10 -10
- package/fesm2022/chart-observer-size.mjs +10 -10
- package/fesm2022/count-down.mjs +7 -7
- package/fesm2022/date-picker.mjs +10 -14
- package/fesm2022/date-picker.mjs.map +1 -1
- package/fesm2022/down-file.mjs +7 -7
- package/fesm2022/ellipsis.mjs +7 -7
- package/fesm2022/error-collect.mjs +7 -7
- package/fesm2022/exception.mjs +7 -7
- package/fesm2022/footer-toolbar.mjs +7 -7
- package/fesm2022/full-content.mjs +13 -13
- package/fesm2022/global-footer.mjs +10 -10
- package/fesm2022/hotkey.mjs +7 -7
- package/fesm2022/let.mjs +7 -7
- package/fesm2022/loading.mjs +10 -10
- package/fesm2022/lodop.mjs +7 -7
- package/fesm2022/media.mjs +10 -10
- package/fesm2022/notice-icon.mjs +10 -10
- package/fesm2022/onboarding.mjs +10 -10
- package/fesm2022/page-header.mjs +7 -7
- package/fesm2022/pdf.mjs +7 -7
- package/fesm2022/qr.mjs +7 -7
- package/fesm2022/quick-menu.mjs +7 -7
- package/fesm2022/result.mjs +7 -7
- package/fesm2022/reuse-tab.mjs +89 -63
- package/fesm2022/reuse-tab.mjs.map +1 -1
- package/fesm2022/se.mjs +13 -13
- package/fesm2022/sg.mjs +10 -10
- package/fesm2022/st.mjs +34 -34
- package/fesm2022/sv.mjs +16 -16
- package/fesm2022/tag-select.mjs +7 -7
- package/fesm2022/xlsx.mjs +10 -10
- package/fesm2022/zip.mjs +7 -7
- package/package.json +4 -4
- package/page-header/style/index.less +5 -0
- package/page-header/style/rtl.less +2 -0
- package/reuse-tab/reuse-tab.cache.d.ts +24 -0
- package/reuse-tab/reuse-tab.service.d.ts +4 -5
package/fesm2022/reuse-tab.mjs
CHANGED
|
@@ -72,10 +72,10 @@ class ReuseTabContextMenuComponent {
|
|
|
72
72
|
return;
|
|
73
73
|
this.notify(null);
|
|
74
74
|
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
76
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextMenuComponent, deps: [{ token: i1.DelonLocaleService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
76
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: ReuseTabContextMenuComponent, selector: "reuse-tab-context-menu", inputs: { i18n: "i18n", item: "item", event: "event", customContextMenu: "customContextMenu" }, outputs: { close: "close" }, host: { listeners: { "document:click": "closeMenu($event)", "document:contextmenu": "closeMenu($event)" } }, ngImport: i0, template: "<ul nz-menu>\n <li\n *ngIf=\"item.active\"\n nz-menu-item\n (click)=\"click($event, 'refresh')\"\n data-type=\"refresh\"\n [innerHTML]=\"i18n.refresh\"\n ></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'close')\"\n data-type=\"close\"\n [nzDisabled]=\"!item.closable\"\n [innerHTML]=\"i18n.close\"\n ></li>\n <li nz-menu-item (click)=\"click($event, 'closeOther')\" data-type=\"closeOther\" [innerHTML]=\"i18n.closeOther\"></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'closeRight')\"\n data-type=\"closeRight\"\n [nzDisabled]=\"item.last\"\n [innerHTML]=\"i18n.closeRight\"\n ></li>\n <ng-container *ngIf=\"customContextMenu!.length > 0\">\n <li nz-menu-divider></li>\n <li\n *ngFor=\"let i of customContextMenu\"\n nz-menu-item\n [attr.data-type]=\"i.id\"\n [nzDisabled]=\"isDisabled(i)\"\n (click)=\"click($event, 'custom', i)\"\n [innerHTML]=\"i.title\"\n ></li>\n </ng-container>\n</ul>\n", dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i3.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i3.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
77
77
|
}
|
|
78
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextMenuComponent, decorators: [{
|
|
79
79
|
type: Component,
|
|
80
80
|
args: [{ selector: 'reuse-tab-context-menu', host: {
|
|
81
81
|
'(document:click)': 'closeMenu($event)',
|
|
@@ -134,10 +134,10 @@ class ReuseTabContextService {
|
|
|
134
134
|
}));
|
|
135
135
|
comp.onDestroy(() => sub$.unsubscribe());
|
|
136
136
|
}
|
|
137
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
138
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
137
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextService, deps: [{ token: i1$1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
138
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextService }); }
|
|
139
139
|
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextService, decorators: [{
|
|
141
141
|
type: Injectable
|
|
142
142
|
}], ctorParameters: function () { return [{ type: i1$1.Overlay }]; } });
|
|
143
143
|
|
|
@@ -155,10 +155,10 @@ class ReuseTabContextComponent {
|
|
|
155
155
|
ngOnDestroy() {
|
|
156
156
|
this.sub$.unsubscribe();
|
|
157
157
|
}
|
|
158
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
159
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
158
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextComponent, deps: [{ token: ReuseTabContextService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
159
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: ReuseTabContextComponent, selector: "reuse-tab-context", inputs: { i18n: "i18n" }, outputs: { change: "change" }, ngImport: i0, template: ``, isInline: true }); }
|
|
160
160
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextComponent, decorators: [{
|
|
162
162
|
type: Component,
|
|
163
163
|
args: [{
|
|
164
164
|
selector: 'reuse-tab-context',
|
|
@@ -183,10 +183,10 @@ class ReuseTabContextDirective {
|
|
|
183
183
|
event.preventDefault();
|
|
184
184
|
event.stopPropagation();
|
|
185
185
|
}
|
|
186
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
187
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
186
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextDirective, deps: [{ token: ReuseTabContextService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
187
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: ReuseTabContextDirective, selector: "[reuse-tab-context-menu]", inputs: { item: ["reuse-tab-context-menu", "item"], customContextMenu: "customContextMenu" }, host: { listeners: { "contextmenu": "_onContextMenu($event)" } }, exportAs: ["reuseTabContextMenu"], ngImport: i0 }); }
|
|
188
188
|
}
|
|
189
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabContextDirective, decorators: [{
|
|
190
190
|
type: Directive,
|
|
191
191
|
args: [{
|
|
192
192
|
selector: '[reuse-tab-context-menu]',
|
|
@@ -250,6 +250,18 @@ class ReuseTabLocalStorageState {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Storage manager that can change rules by implementing `get`, `set` accessors
|
|
255
|
+
*/
|
|
256
|
+
const REUSE_TAB_CACHED_MANAGER = new InjectionToken('REUSE_TAB_CACHED_MANAGER');
|
|
257
|
+
class ReuseTabCachedManagerFactory {
|
|
258
|
+
constructor() {
|
|
259
|
+
this.list = [];
|
|
260
|
+
this.title = {};
|
|
261
|
+
this.closable = {};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
253
265
|
class ReuseTabService {
|
|
254
266
|
get snapshot() {
|
|
255
267
|
return this.injector.get(ActivatedRoute).snapshot;
|
|
@@ -276,8 +288,8 @@ class ReuseTabService {
|
|
|
276
288
|
*/
|
|
277
289
|
set max(value) {
|
|
278
290
|
this._max = Math.min(Math.max(value, 2), 100);
|
|
279
|
-
for (let i = this.
|
|
280
|
-
this.
|
|
291
|
+
for (let i = this.cached.list.length; i > this._max; i--) {
|
|
292
|
+
this.cached.list.pop();
|
|
281
293
|
}
|
|
282
294
|
}
|
|
283
295
|
set keepingScroll(value) {
|
|
@@ -289,11 +301,11 @@ class ReuseTabService {
|
|
|
289
301
|
}
|
|
290
302
|
/** 获取已缓存的路由 */
|
|
291
303
|
get items() {
|
|
292
|
-
return this.
|
|
304
|
+
return this.cached.list;
|
|
293
305
|
}
|
|
294
306
|
/** 获取当前缓存的路由总数 */
|
|
295
307
|
get count() {
|
|
296
|
-
return this.
|
|
308
|
+
return this.cached.list.length;
|
|
297
309
|
}
|
|
298
310
|
/** 订阅缓存变更通知 */
|
|
299
311
|
get change() {
|
|
@@ -304,18 +316,18 @@ class ReuseTabService {
|
|
|
304
316
|
const url = this.curUrl;
|
|
305
317
|
if (typeof value === 'string')
|
|
306
318
|
value = { text: value };
|
|
307
|
-
this.
|
|
319
|
+
this.cached.title[url] = value;
|
|
308
320
|
this.di('update current tag title: ', value);
|
|
309
321
|
this._cachedChange.next({
|
|
310
322
|
active: 'title',
|
|
311
323
|
url,
|
|
312
324
|
title: value,
|
|
313
|
-
list: this.
|
|
325
|
+
list: this.cached.list
|
|
314
326
|
});
|
|
315
327
|
}
|
|
316
328
|
/** 获取指定路径缓存所在位置,`-1` 表示无缓存 */
|
|
317
329
|
index(url) {
|
|
318
|
-
return this.
|
|
330
|
+
return this.cached.list.findIndex(w => w.url === url);
|
|
319
331
|
}
|
|
320
332
|
/** 获取指定路径缓存是否存在 */
|
|
321
333
|
exists(url) {
|
|
@@ -323,16 +335,16 @@ class ReuseTabService {
|
|
|
323
335
|
}
|
|
324
336
|
/** 获取指定路径缓存 */
|
|
325
337
|
get(url) {
|
|
326
|
-
return url ? this.
|
|
338
|
+
return url ? this.cached.list.find(w => w.url === url) || null : null;
|
|
327
339
|
}
|
|
328
340
|
remove(url, includeNonCloseable) {
|
|
329
341
|
const idx = typeof url === 'string' ? this.index(url) : url;
|
|
330
|
-
const item = idx !== -1 ? this.
|
|
342
|
+
const item = idx !== -1 ? this.cached.list[idx] : null;
|
|
331
343
|
if (!item || (!includeNonCloseable && !item.closable))
|
|
332
344
|
return false;
|
|
333
345
|
this.destroy(item._handle);
|
|
334
|
-
this.
|
|
335
|
-
delete this.
|
|
346
|
+
this.cached.list.splice(idx, 1);
|
|
347
|
+
delete this.cached.title[url];
|
|
336
348
|
return true;
|
|
337
349
|
}
|
|
338
350
|
/**
|
|
@@ -343,7 +355,7 @@ class ReuseTabService {
|
|
|
343
355
|
close(url, includeNonCloseable = false) {
|
|
344
356
|
this.removeUrlBuffer = url;
|
|
345
357
|
this.remove(url, includeNonCloseable);
|
|
346
|
-
this._cachedChange.next({ active: 'close', url, list: this.
|
|
358
|
+
this._cachedChange.next({ active: 'close', url, list: this.cached.list });
|
|
347
359
|
this.di('close tag', url);
|
|
348
360
|
return true;
|
|
349
361
|
}
|
|
@@ -358,7 +370,7 @@ class ReuseTabService {
|
|
|
358
370
|
this.remove(i, includeNonCloseable);
|
|
359
371
|
}
|
|
360
372
|
this.removeUrlBuffer = null;
|
|
361
|
-
this._cachedChange.next({ active: 'closeRight', url, list: this.
|
|
373
|
+
this._cachedChange.next({ active: 'closeRight', url, list: this.cached.list });
|
|
362
374
|
this.di('close right tages', url);
|
|
363
375
|
return true;
|
|
364
376
|
}
|
|
@@ -368,13 +380,13 @@ class ReuseTabService {
|
|
|
368
380
|
* @param [includeNonCloseable=false] 是否强制包含不可关闭
|
|
369
381
|
*/
|
|
370
382
|
clear(includeNonCloseable = false) {
|
|
371
|
-
this.
|
|
383
|
+
this.cached.list.forEach(w => {
|
|
372
384
|
if (!includeNonCloseable && w.closable)
|
|
373
385
|
this.destroy(w._handle);
|
|
374
386
|
});
|
|
375
|
-
this.
|
|
387
|
+
this.cached.list = this.cached.list.filter(w => !includeNonCloseable && !w.closable);
|
|
376
388
|
this.removeUrlBuffer = null;
|
|
377
|
-
this._cachedChange.next({ active: 'clear', list: this.
|
|
389
|
+
this._cachedChange.next({ active: 'clear', list: this.cached.list });
|
|
378
390
|
this.di('clear all catch');
|
|
379
391
|
}
|
|
380
392
|
/**
|
|
@@ -396,17 +408,17 @@ class ReuseTabService {
|
|
|
396
408
|
* ```
|
|
397
409
|
*/
|
|
398
410
|
move(url, position) {
|
|
399
|
-
const start = this.
|
|
411
|
+
const start = this.cached.list.findIndex(w => w.url === url);
|
|
400
412
|
if (start === -1)
|
|
401
413
|
return;
|
|
402
|
-
const data = this.
|
|
414
|
+
const data = this.cached.list.slice();
|
|
403
415
|
data.splice(position < 0 ? data.length + position : position, 0, data.splice(start, 1)[0]);
|
|
404
|
-
this.
|
|
416
|
+
this.cached.list = data;
|
|
405
417
|
this._cachedChange.next({
|
|
406
418
|
active: 'move',
|
|
407
419
|
url,
|
|
408
420
|
position,
|
|
409
|
-
list: this.
|
|
421
|
+
list: this.cached.list
|
|
410
422
|
});
|
|
411
423
|
}
|
|
412
424
|
/**
|
|
@@ -433,8 +445,8 @@ class ReuseTabService {
|
|
|
433
445
|
* @param route 指定路由快照
|
|
434
446
|
*/
|
|
435
447
|
getTitle(url, route) {
|
|
436
|
-
if (this.
|
|
437
|
-
return this.
|
|
448
|
+
if (this.cached.title[url]) {
|
|
449
|
+
return this.cached.title[url];
|
|
438
450
|
}
|
|
439
451
|
if (route && route.data && (route.data.titleI18n || route.data.title)) {
|
|
440
452
|
return {
|
|
@@ -449,17 +461,17 @@ class ReuseTabService {
|
|
|
449
461
|
* 清除标题缓存
|
|
450
462
|
*/
|
|
451
463
|
clearTitleCached() {
|
|
452
|
-
this.
|
|
464
|
+
this.cached.title = {};
|
|
453
465
|
}
|
|
454
466
|
/** 自定义当前 `closable` 状态 */
|
|
455
467
|
set closable(value) {
|
|
456
468
|
const url = this.curUrl;
|
|
457
|
-
this.
|
|
469
|
+
this.cached.closable[url] = value;
|
|
458
470
|
this.di('update current tag closable: ', value);
|
|
459
471
|
this._cachedChange.next({
|
|
460
472
|
active: 'closable',
|
|
461
473
|
closable: value,
|
|
462
|
-
list: this.
|
|
474
|
+
list: this.cached.list
|
|
463
475
|
});
|
|
464
476
|
}
|
|
465
477
|
/**
|
|
@@ -473,8 +485,8 @@ class ReuseTabService {
|
|
|
473
485
|
* @param route 指定路由快照
|
|
474
486
|
*/
|
|
475
487
|
getClosable(url, route) {
|
|
476
|
-
if (typeof this.
|
|
477
|
-
return this.
|
|
488
|
+
if (typeof this.cached.closable[url] !== 'undefined')
|
|
489
|
+
return this.cached.closable[url];
|
|
478
490
|
if (route && route.data && typeof route.data.reuseClosable === 'boolean')
|
|
479
491
|
return route.data.reuseClosable;
|
|
480
492
|
const menu = this.mode !== ReuseTabMatchMode.URL ? this.getMenu(url) : null;
|
|
@@ -486,7 +498,7 @@ class ReuseTabService {
|
|
|
486
498
|
* 清空 `closable` 缓存
|
|
487
499
|
*/
|
|
488
500
|
clearClosableCached() {
|
|
489
|
-
this.
|
|
501
|
+
this.cached.closable = {};
|
|
490
502
|
}
|
|
491
503
|
getTruthRoute(route) {
|
|
492
504
|
let next = route;
|
|
@@ -558,18 +570,16 @@ class ReuseTabService {
|
|
|
558
570
|
}
|
|
559
571
|
}
|
|
560
572
|
// #endregion
|
|
561
|
-
constructor(injector, menuService, stateKey, stateSrv) {
|
|
573
|
+
constructor(injector, menuService, cached, stateKey, stateSrv) {
|
|
562
574
|
this.injector = injector;
|
|
563
575
|
this.menuService = menuService;
|
|
576
|
+
this.cached = cached;
|
|
564
577
|
this.stateKey = stateKey;
|
|
565
578
|
this.stateSrv = stateSrv;
|
|
566
579
|
this._inited = false;
|
|
567
580
|
this._max = 10;
|
|
568
581
|
this._keepingScroll = false;
|
|
569
582
|
this._cachedChange = new BehaviorSubject(null);
|
|
570
|
-
this._cached = [];
|
|
571
|
-
this._titleCached = {};
|
|
572
|
-
this._closableCached = {};
|
|
573
583
|
this.removeUrlBuffer = null;
|
|
574
584
|
this.positionBuffer = {};
|
|
575
585
|
this.debug = false;
|
|
@@ -578,6 +588,9 @@ class ReuseTabService {
|
|
|
578
588
|
/** 排除规则,限 `mode=URL` */
|
|
579
589
|
this.excludes = [];
|
|
580
590
|
this.storageState = false;
|
|
591
|
+
if (this.cached == null) {
|
|
592
|
+
this.cached = { list: [], title: {}, closable: {} };
|
|
593
|
+
}
|
|
581
594
|
}
|
|
582
595
|
init() {
|
|
583
596
|
this.initScroll();
|
|
@@ -587,7 +600,7 @@ class ReuseTabService {
|
|
|
587
600
|
loadState() {
|
|
588
601
|
if (!this.storageState)
|
|
589
602
|
return;
|
|
590
|
-
this.
|
|
603
|
+
this.cached.list = this.stateSrv.get(this.stateKey).map(v => ({
|
|
591
604
|
title: { text: v.title },
|
|
592
605
|
url: v.url,
|
|
593
606
|
position: v.position
|
|
@@ -602,7 +615,7 @@ class ReuseTabService {
|
|
|
602
615
|
}
|
|
603
616
|
runHook(method, comp, type = 'init') {
|
|
604
617
|
if (typeof comp === 'number') {
|
|
605
|
-
const item = this.
|
|
618
|
+
const item = this.cached.list[comp];
|
|
606
619
|
comp = item._handle?.componentRef;
|
|
607
620
|
}
|
|
608
621
|
if (comp == null || !comp.instance) {
|
|
@@ -650,20 +663,20 @@ class ReuseTabService {
|
|
|
650
663
|
if (isAdd) {
|
|
651
664
|
if (this.count >= this._max) {
|
|
652
665
|
// Get the oldest closable location
|
|
653
|
-
const closeIdx = this.
|
|
666
|
+
const closeIdx = this.cached.list.findIndex(w => w.closable);
|
|
654
667
|
if (closeIdx !== -1)
|
|
655
668
|
this.remove(closeIdx, false);
|
|
656
669
|
}
|
|
657
|
-
this.
|
|
670
|
+
this.cached.list.push(item);
|
|
658
671
|
}
|
|
659
672
|
else {
|
|
660
673
|
// Current handler is null when activate routes
|
|
661
674
|
// For better reliability, we need to wait for the component to be attached before call _onReuseInit
|
|
662
|
-
const cahcedComponentRef = this.
|
|
675
|
+
const cahcedComponentRef = this.cached.list[idx]._handle?.componentRef;
|
|
663
676
|
if (_handle == null && cahcedComponentRef != null) {
|
|
664
677
|
timer(100).subscribe(() => this.runHook('_onReuseInit', cahcedComponentRef));
|
|
665
678
|
}
|
|
666
|
-
this.
|
|
679
|
+
this.cached.list[idx] = item;
|
|
667
680
|
}
|
|
668
681
|
this.removeUrlBuffer = null;
|
|
669
682
|
this.di('#store', isAdd ? '[new]' : '[override]', url);
|
|
@@ -671,7 +684,7 @@ class ReuseTabService {
|
|
|
671
684
|
this.runHook('_onReuseDestroy', _handle.componentRef);
|
|
672
685
|
}
|
|
673
686
|
if (!isAdd) {
|
|
674
|
-
this._cachedChange.next({ active: 'override', item, list: this.
|
|
687
|
+
this._cachedChange.next({ active: 'override', item, list: this.cached.list });
|
|
675
688
|
}
|
|
676
689
|
}
|
|
677
690
|
/**
|
|
@@ -685,7 +698,7 @@ class ReuseTabService {
|
|
|
685
698
|
const ret = !!(data && data._handle);
|
|
686
699
|
this.di('#shouldAttach', ret, url);
|
|
687
700
|
if (!ret) {
|
|
688
|
-
this._cachedChange.next({ active: 'add', url, list: this.
|
|
701
|
+
this._cachedChange.next({ active: 'add', url, list: this.cached.list });
|
|
689
702
|
}
|
|
690
703
|
return ret;
|
|
691
704
|
}
|
|
@@ -776,20 +789,25 @@ class ReuseTabService {
|
|
|
776
789
|
ngOnDestroy() {
|
|
777
790
|
const { _cachedChange, _router$ } = this;
|
|
778
791
|
this.clear();
|
|
779
|
-
this.
|
|
792
|
+
this.cached.list = [];
|
|
780
793
|
_cachedChange.complete();
|
|
781
794
|
if (_router$) {
|
|
782
795
|
_router$.unsubscribe();
|
|
783
796
|
}
|
|
784
797
|
}
|
|
785
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
786
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
798
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabService, deps: [{ token: i0.Injector }, { token: i1.MenuService }, { token: REUSE_TAB_CACHED_MANAGER, optional: true }, { token: REUSE_TAB_STORAGE_KEY, optional: true }, { token: REUSE_TAB_STORAGE_STATE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
799
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabService, providedIn: 'root' }); }
|
|
787
800
|
}
|
|
788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabService, decorators: [{
|
|
789
802
|
type: Injectable,
|
|
790
803
|
args: [{ providedIn: 'root' }]
|
|
791
804
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.MenuService }, { type: undefined, decorators: [{
|
|
792
805
|
type: Optional
|
|
806
|
+
}, {
|
|
807
|
+
type: Inject,
|
|
808
|
+
args: [REUSE_TAB_CACHED_MANAGER]
|
|
809
|
+
}] }, { type: undefined, decorators: [{
|
|
810
|
+
type: Optional
|
|
793
811
|
}, {
|
|
794
812
|
type: Inject,
|
|
795
813
|
args: [REUSE_TAB_STORAGE_KEY]
|
|
@@ -1048,8 +1066,8 @@ class ReuseTabComponent {
|
|
|
1048
1066
|
destroy$.next();
|
|
1049
1067
|
destroy$.complete();
|
|
1050
1068
|
}
|
|
1051
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1052
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
1069
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabComponent, deps: [{ token: ReuseTabService }, { token: i0.ChangeDetectorRef }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: ALAIN_I18N_TOKEN, optional: true }, { token: DOCUMENT }, { token: i3$1.Platform }, { token: i4.Directionality, optional: true }, { token: REUSE_TAB_STORAGE_KEY, optional: true }, { token: REUSE_TAB_STORAGE_STATE, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1070
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: ReuseTabComponent, selector: "reuse-tab, [reuse-tab]", inputs: { mode: "mode", i18n: "i18n", debug: "debug", max: "max", tabMaxWidth: "tabMaxWidth", excludes: "excludes", allowClose: "allowClose", keepingScroll: "keepingScroll", storageState: "storageState", keepingScrollContainer: "keepingScrollContainer", customContextMenu: "customContextMenu", tabBarExtraContent: "tabBarExtraContent", tabBarGutter: "tabBarGutter", tabBarStyle: "tabBarStyle", tabType: "tabType", routeParamMatchMode: "routeParamMatchMode", disabled: "disabled", titleRender: "titleRender", canClose: "canClose" }, outputs: { change: "change", close: "close" }, host: { properties: { "class.reuse-tab": "true", "class.reuse-tab__line": "tabType === 'line'", "class.reuse-tab__card": "tabType === 'card'", "class.reuse-tab__disabled": "disabled", "class.reuse-tab-rtl": "dir === 'rtl'" } }, providers: [ReuseTabContextService], viewQueries: [{ propertyName: "tabset", first: true, predicate: ["tabset"], descendants: true }], exportAs: ["reuseTab"], usesOnChanges: true, ngImport: i0, template: "<nz-tabset\n #tabset\n [nzSelectedIndex]=\"pos\"\n [nzAnimated]=\"false\"\n [nzType]=\"tabType\"\n [nzTabBarExtraContent]=\"tabBarExtraContent\"\n [nzTabBarGutter]=\"tabBarGutter\"\n [nzTabBarStyle]=\"tabBarStyle\"\n>\n <nz-tab *ngFor=\"let i of list; let index = index\" [nzTitle]=\"titleTemplate\" (nzClick)=\"_to(index)\">\n <ng-template #titleTemplate>\n <div\n [reuse-tab-context-menu]=\"i\"\n [customContextMenu]=\"customContextMenu\"\n class=\"reuse-tab__name\"\n [attr.title]=\"i.title\"\n >\n <span [class.reuse-tab__name-width]=\"tabMaxWidth\" [style.max-width.px]=\"tabMaxWidth\">\n <ng-container\n *ngIf=\"titleRender; else defaultTitle\"\n [ngTemplateOutlet]=\"titleRender\"\n [ngTemplateOutletContext]=\"{ $implicit: i }\"\n ></ng-container>\n <ng-template #defaultTitle>{{ i.title }}</ng-template>\n </span>\n </div>\n <i *ngIf=\"i.closable\" nz-icon nzType=\"close\" class=\"reuse-tab__op\" (click)=\"_close($event, index, false)\"></i>\n </ng-template>\n </nz-tab>\n</nz-tabset>\n<reuse-tab-context [i18n]=\"i18n\" (change)=\"contextMenuChange($event)\"></reuse-tab-context>\n", dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i6.NzTabSetComponent, selector: "nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabset"] }, { kind: "component", type: i6.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { kind: "directive", type: i7.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: ReuseTabContextComponent, selector: "reuse-tab-context", inputs: ["i18n"], outputs: ["change"] }, { kind: "directive", type: ReuseTabContextDirective, selector: "[reuse-tab-context-menu]", inputs: ["reuse-tab-context-menu", "customContextMenu"], exportAs: ["reuseTabContextMenu"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1053
1071
|
}
|
|
1054
1072
|
__decorate([
|
|
1055
1073
|
InputBoolean()
|
|
@@ -1072,7 +1090,7 @@ __decorate([
|
|
|
1072
1090
|
__decorate([
|
|
1073
1091
|
InputBoolean()
|
|
1074
1092
|
], ReuseTabComponent.prototype, "disabled", void 0);
|
|
1075
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1093
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabComponent, decorators: [{
|
|
1076
1094
|
type: Component,
|
|
1077
1095
|
args: [{ selector: 'reuse-tab, [reuse-tab]', exportAs: 'reuseTab', host: {
|
|
1078
1096
|
'[class.reuse-tab]': 'true',
|
|
@@ -1172,9 +1190,9 @@ class ReuseTabStrategy {
|
|
|
1172
1190
|
const COMPONENTS = [ReuseTabComponent];
|
|
1173
1191
|
const NOEXPORTS = [ReuseTabContextMenuComponent, ReuseTabContextComponent, ReuseTabContextDirective];
|
|
1174
1192
|
class ReuseTabModule {
|
|
1175
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1176
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.
|
|
1177
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.
|
|
1193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1194
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, declarations: [ReuseTabComponent, ReuseTabContextMenuComponent, ReuseTabContextComponent, ReuseTabContextDirective], imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule], exports: [ReuseTabComponent] }); }
|
|
1195
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, providers: [
|
|
1178
1196
|
{
|
|
1179
1197
|
provide: REUSE_TAB_STORAGE_KEY,
|
|
1180
1198
|
useValue: '_reuse-tab-state'
|
|
@@ -1182,10 +1200,14 @@ class ReuseTabModule {
|
|
|
1182
1200
|
{
|
|
1183
1201
|
provide: REUSE_TAB_STORAGE_STATE,
|
|
1184
1202
|
useFactory: () => new ReuseTabLocalStorageState()
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
provide: REUSE_TAB_CACHED_MANAGER,
|
|
1206
|
+
useFactory: () => new ReuseTabCachedManagerFactory()
|
|
1185
1207
|
}
|
|
1186
1208
|
], imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule] }); }
|
|
1187
1209
|
}
|
|
1188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, decorators: [{
|
|
1189
1211
|
type: NgModule,
|
|
1190
1212
|
args: [{
|
|
1191
1213
|
imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule],
|
|
@@ -1198,6 +1220,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImpor
|
|
|
1198
1220
|
{
|
|
1199
1221
|
provide: REUSE_TAB_STORAGE_STATE,
|
|
1200
1222
|
useFactory: () => new ReuseTabLocalStorageState()
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
provide: REUSE_TAB_CACHED_MANAGER,
|
|
1226
|
+
useFactory: () => new ReuseTabCachedManagerFactory()
|
|
1201
1227
|
}
|
|
1202
1228
|
],
|
|
1203
1229
|
exports: COMPONENTS
|