@delon/abc 16.0.1 → 16.1.0
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 +51 -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 +88 -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() {
|
|
@@ -301,21 +313,23 @@ class ReuseTabService {
|
|
|
301
313
|
}
|
|
302
314
|
/** 自定义当前标题 */
|
|
303
315
|
set title(value) {
|
|
316
|
+
if (this.cached == null)
|
|
317
|
+
return;
|
|
304
318
|
const url = this.curUrl;
|
|
305
319
|
if (typeof value === 'string')
|
|
306
320
|
value = { text: value };
|
|
307
|
-
this.
|
|
321
|
+
this.cached.title[url] = value;
|
|
308
322
|
this.di('update current tag title: ', value);
|
|
309
323
|
this._cachedChange.next({
|
|
310
324
|
active: 'title',
|
|
311
325
|
url,
|
|
312
326
|
title: value,
|
|
313
|
-
list: this.
|
|
327
|
+
list: this.cached.list
|
|
314
328
|
});
|
|
315
329
|
}
|
|
316
330
|
/** 获取指定路径缓存所在位置,`-1` 表示无缓存 */
|
|
317
331
|
index(url) {
|
|
318
|
-
return this.
|
|
332
|
+
return this.cached.list.findIndex(w => w.url === url);
|
|
319
333
|
}
|
|
320
334
|
/** 获取指定路径缓存是否存在 */
|
|
321
335
|
exists(url) {
|
|
@@ -323,16 +337,16 @@ class ReuseTabService {
|
|
|
323
337
|
}
|
|
324
338
|
/** 获取指定路径缓存 */
|
|
325
339
|
get(url) {
|
|
326
|
-
return url ? this.
|
|
340
|
+
return url ? this.cached.list.find(w => w.url === url) || null : null;
|
|
327
341
|
}
|
|
328
342
|
remove(url, includeNonCloseable) {
|
|
329
343
|
const idx = typeof url === 'string' ? this.index(url) : url;
|
|
330
|
-
const item = idx !== -1 ? this.
|
|
344
|
+
const item = idx !== -1 ? this.cached.list[idx] : null;
|
|
331
345
|
if (!item || (!includeNonCloseable && !item.closable))
|
|
332
346
|
return false;
|
|
333
347
|
this.destroy(item._handle);
|
|
334
|
-
this.
|
|
335
|
-
delete this.
|
|
348
|
+
this.cached.list.splice(idx, 1);
|
|
349
|
+
delete this.cached.title[url];
|
|
336
350
|
return true;
|
|
337
351
|
}
|
|
338
352
|
/**
|
|
@@ -343,7 +357,7 @@ class ReuseTabService {
|
|
|
343
357
|
close(url, includeNonCloseable = false) {
|
|
344
358
|
this.removeUrlBuffer = url;
|
|
345
359
|
this.remove(url, includeNonCloseable);
|
|
346
|
-
this._cachedChange.next({ active: 'close', url, list: this.
|
|
360
|
+
this._cachedChange.next({ active: 'close', url, list: this.cached.list });
|
|
347
361
|
this.di('close tag', url);
|
|
348
362
|
return true;
|
|
349
363
|
}
|
|
@@ -358,7 +372,7 @@ class ReuseTabService {
|
|
|
358
372
|
this.remove(i, includeNonCloseable);
|
|
359
373
|
}
|
|
360
374
|
this.removeUrlBuffer = null;
|
|
361
|
-
this._cachedChange.next({ active: 'closeRight', url, list: this.
|
|
375
|
+
this._cachedChange.next({ active: 'closeRight', url, list: this.cached.list });
|
|
362
376
|
this.di('close right tages', url);
|
|
363
377
|
return true;
|
|
364
378
|
}
|
|
@@ -368,13 +382,13 @@ class ReuseTabService {
|
|
|
368
382
|
* @param [includeNonCloseable=false] 是否强制包含不可关闭
|
|
369
383
|
*/
|
|
370
384
|
clear(includeNonCloseable = false) {
|
|
371
|
-
this.
|
|
385
|
+
this.cached.list.forEach(w => {
|
|
372
386
|
if (!includeNonCloseable && w.closable)
|
|
373
387
|
this.destroy(w._handle);
|
|
374
388
|
});
|
|
375
|
-
this.
|
|
389
|
+
this.cached.list = this.cached.list.filter(w => !includeNonCloseable && !w.closable);
|
|
376
390
|
this.removeUrlBuffer = null;
|
|
377
|
-
this._cachedChange.next({ active: 'clear', list: this.
|
|
391
|
+
this._cachedChange.next({ active: 'clear', list: this.cached.list });
|
|
378
392
|
this.di('clear all catch');
|
|
379
393
|
}
|
|
380
394
|
/**
|
|
@@ -396,17 +410,17 @@ class ReuseTabService {
|
|
|
396
410
|
* ```
|
|
397
411
|
*/
|
|
398
412
|
move(url, position) {
|
|
399
|
-
const start = this.
|
|
413
|
+
const start = this.cached.list.findIndex(w => w.url === url);
|
|
400
414
|
if (start === -1)
|
|
401
415
|
return;
|
|
402
|
-
const data = this.
|
|
416
|
+
const data = this.cached.list.slice();
|
|
403
417
|
data.splice(position < 0 ? data.length + position : position, 0, data.splice(start, 1)[0]);
|
|
404
|
-
this.
|
|
418
|
+
this.cached.list = data;
|
|
405
419
|
this._cachedChange.next({
|
|
406
420
|
active: 'move',
|
|
407
421
|
url,
|
|
408
422
|
position,
|
|
409
|
-
list: this.
|
|
423
|
+
list: this.cached.list
|
|
410
424
|
});
|
|
411
425
|
}
|
|
412
426
|
/**
|
|
@@ -433,8 +447,8 @@ class ReuseTabService {
|
|
|
433
447
|
* @param route 指定路由快照
|
|
434
448
|
*/
|
|
435
449
|
getTitle(url, route) {
|
|
436
|
-
if (this.
|
|
437
|
-
return this.
|
|
450
|
+
if (this.cached.title[url]) {
|
|
451
|
+
return this.cached.title[url];
|
|
438
452
|
}
|
|
439
453
|
if (route && route.data && (route.data.titleI18n || route.data.title)) {
|
|
440
454
|
return {
|
|
@@ -449,17 +463,17 @@ class ReuseTabService {
|
|
|
449
463
|
* 清除标题缓存
|
|
450
464
|
*/
|
|
451
465
|
clearTitleCached() {
|
|
452
|
-
this.
|
|
466
|
+
this.cached.title = {};
|
|
453
467
|
}
|
|
454
468
|
/** 自定义当前 `closable` 状态 */
|
|
455
469
|
set closable(value) {
|
|
456
470
|
const url = this.curUrl;
|
|
457
|
-
this.
|
|
471
|
+
this.cached.closable[url] = value;
|
|
458
472
|
this.di('update current tag closable: ', value);
|
|
459
473
|
this._cachedChange.next({
|
|
460
474
|
active: 'closable',
|
|
461
475
|
closable: value,
|
|
462
|
-
list: this.
|
|
476
|
+
list: this.cached.list
|
|
463
477
|
});
|
|
464
478
|
}
|
|
465
479
|
/**
|
|
@@ -473,8 +487,8 @@ class ReuseTabService {
|
|
|
473
487
|
* @param route 指定路由快照
|
|
474
488
|
*/
|
|
475
489
|
getClosable(url, route) {
|
|
476
|
-
if (typeof this.
|
|
477
|
-
return this.
|
|
490
|
+
if (typeof this.cached.closable[url] !== 'undefined')
|
|
491
|
+
return this.cached.closable[url];
|
|
478
492
|
if (route && route.data && typeof route.data.reuseClosable === 'boolean')
|
|
479
493
|
return route.data.reuseClosable;
|
|
480
494
|
const menu = this.mode !== ReuseTabMatchMode.URL ? this.getMenu(url) : null;
|
|
@@ -486,7 +500,7 @@ class ReuseTabService {
|
|
|
486
500
|
* 清空 `closable` 缓存
|
|
487
501
|
*/
|
|
488
502
|
clearClosableCached() {
|
|
489
|
-
this.
|
|
503
|
+
this.cached.closable = {};
|
|
490
504
|
}
|
|
491
505
|
getTruthRoute(route) {
|
|
492
506
|
let next = route;
|
|
@@ -558,18 +572,16 @@ class ReuseTabService {
|
|
|
558
572
|
}
|
|
559
573
|
}
|
|
560
574
|
// #endregion
|
|
561
|
-
constructor(injector, menuService, stateKey, stateSrv) {
|
|
575
|
+
constructor(injector, menuService, cached, stateKey, stateSrv) {
|
|
562
576
|
this.injector = injector;
|
|
563
577
|
this.menuService = menuService;
|
|
578
|
+
this.cached = cached;
|
|
564
579
|
this.stateKey = stateKey;
|
|
565
580
|
this.stateSrv = stateSrv;
|
|
566
581
|
this._inited = false;
|
|
567
582
|
this._max = 10;
|
|
568
583
|
this._keepingScroll = false;
|
|
569
584
|
this._cachedChange = new BehaviorSubject(null);
|
|
570
|
-
this._cached = [];
|
|
571
|
-
this._titleCached = {};
|
|
572
|
-
this._closableCached = {};
|
|
573
585
|
this.removeUrlBuffer = null;
|
|
574
586
|
this.positionBuffer = {};
|
|
575
587
|
this.debug = false;
|
|
@@ -587,7 +599,7 @@ class ReuseTabService {
|
|
|
587
599
|
loadState() {
|
|
588
600
|
if (!this.storageState)
|
|
589
601
|
return;
|
|
590
|
-
this.
|
|
602
|
+
this.cached.list = this.stateSrv.get(this.stateKey).map(v => ({
|
|
591
603
|
title: { text: v.title },
|
|
592
604
|
url: v.url,
|
|
593
605
|
position: v.position
|
|
@@ -602,7 +614,7 @@ class ReuseTabService {
|
|
|
602
614
|
}
|
|
603
615
|
runHook(method, comp, type = 'init') {
|
|
604
616
|
if (typeof comp === 'number') {
|
|
605
|
-
const item = this.
|
|
617
|
+
const item = this.cached.list[comp];
|
|
606
618
|
comp = item._handle?.componentRef;
|
|
607
619
|
}
|
|
608
620
|
if (comp == null || !comp.instance) {
|
|
@@ -650,20 +662,20 @@ class ReuseTabService {
|
|
|
650
662
|
if (isAdd) {
|
|
651
663
|
if (this.count >= this._max) {
|
|
652
664
|
// Get the oldest closable location
|
|
653
|
-
const closeIdx = this.
|
|
665
|
+
const closeIdx = this.cached.list.findIndex(w => w.closable);
|
|
654
666
|
if (closeIdx !== -1)
|
|
655
667
|
this.remove(closeIdx, false);
|
|
656
668
|
}
|
|
657
|
-
this.
|
|
669
|
+
this.cached.list.push(item);
|
|
658
670
|
}
|
|
659
671
|
else {
|
|
660
672
|
// Current handler is null when activate routes
|
|
661
673
|
// For better reliability, we need to wait for the component to be attached before call _onReuseInit
|
|
662
|
-
const cahcedComponentRef = this.
|
|
674
|
+
const cahcedComponentRef = this.cached.list[idx]._handle?.componentRef;
|
|
663
675
|
if (_handle == null && cahcedComponentRef != null) {
|
|
664
676
|
timer(100).subscribe(() => this.runHook('_onReuseInit', cahcedComponentRef));
|
|
665
677
|
}
|
|
666
|
-
this.
|
|
678
|
+
this.cached.list[idx] = item;
|
|
667
679
|
}
|
|
668
680
|
this.removeUrlBuffer = null;
|
|
669
681
|
this.di('#store', isAdd ? '[new]' : '[override]', url);
|
|
@@ -671,7 +683,7 @@ class ReuseTabService {
|
|
|
671
683
|
this.runHook('_onReuseDestroy', _handle.componentRef);
|
|
672
684
|
}
|
|
673
685
|
if (!isAdd) {
|
|
674
|
-
this._cachedChange.next({ active: 'override', item, list: this.
|
|
686
|
+
this._cachedChange.next({ active: 'override', item, list: this.cached.list });
|
|
675
687
|
}
|
|
676
688
|
}
|
|
677
689
|
/**
|
|
@@ -685,7 +697,7 @@ class ReuseTabService {
|
|
|
685
697
|
const ret = !!(data && data._handle);
|
|
686
698
|
this.di('#shouldAttach', ret, url);
|
|
687
699
|
if (!ret) {
|
|
688
|
-
this._cachedChange.next({ active: 'add', url, list: this.
|
|
700
|
+
this._cachedChange.next({ active: 'add', url, list: this.cached.list });
|
|
689
701
|
}
|
|
690
702
|
return ret;
|
|
691
703
|
}
|
|
@@ -776,20 +788,25 @@ class ReuseTabService {
|
|
|
776
788
|
ngOnDestroy() {
|
|
777
789
|
const { _cachedChange, _router$ } = this;
|
|
778
790
|
this.clear();
|
|
779
|
-
this.
|
|
791
|
+
this.cached.list = [];
|
|
780
792
|
_cachedChange.complete();
|
|
781
793
|
if (_router$) {
|
|
782
794
|
_router$.unsubscribe();
|
|
783
795
|
}
|
|
784
796
|
}
|
|
785
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
786
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
797
|
+
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 }); }
|
|
798
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabService, providedIn: 'root' }); }
|
|
787
799
|
}
|
|
788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabService, decorators: [{
|
|
789
801
|
type: Injectable,
|
|
790
802
|
args: [{ providedIn: 'root' }]
|
|
791
803
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.MenuService }, { type: undefined, decorators: [{
|
|
792
804
|
type: Optional
|
|
805
|
+
}, {
|
|
806
|
+
type: Inject,
|
|
807
|
+
args: [REUSE_TAB_CACHED_MANAGER]
|
|
808
|
+
}] }, { type: undefined, decorators: [{
|
|
809
|
+
type: Optional
|
|
793
810
|
}, {
|
|
794
811
|
type: Inject,
|
|
795
812
|
args: [REUSE_TAB_STORAGE_KEY]
|
|
@@ -1048,8 +1065,8 @@ class ReuseTabComponent {
|
|
|
1048
1065
|
destroy$.next();
|
|
1049
1066
|
destroy$.complete();
|
|
1050
1067
|
}
|
|
1051
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1052
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
1068
|
+
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 }); }
|
|
1069
|
+
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
1070
|
}
|
|
1054
1071
|
__decorate([
|
|
1055
1072
|
InputBoolean()
|
|
@@ -1072,7 +1089,7 @@ __decorate([
|
|
|
1072
1089
|
__decorate([
|
|
1073
1090
|
InputBoolean()
|
|
1074
1091
|
], ReuseTabComponent.prototype, "disabled", void 0);
|
|
1075
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1092
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabComponent, decorators: [{
|
|
1076
1093
|
type: Component,
|
|
1077
1094
|
args: [{ selector: 'reuse-tab, [reuse-tab]', exportAs: 'reuseTab', host: {
|
|
1078
1095
|
'[class.reuse-tab]': 'true',
|
|
@@ -1172,9 +1189,9 @@ class ReuseTabStrategy {
|
|
|
1172
1189
|
const COMPONENTS = [ReuseTabComponent];
|
|
1173
1190
|
const NOEXPORTS = [ReuseTabContextMenuComponent, ReuseTabContextComponent, ReuseTabContextDirective];
|
|
1174
1191
|
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.
|
|
1192
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1193
|
+
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] }); }
|
|
1194
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, providers: [
|
|
1178
1195
|
{
|
|
1179
1196
|
provide: REUSE_TAB_STORAGE_KEY,
|
|
1180
1197
|
useValue: '_reuse-tab-state'
|
|
@@ -1182,10 +1199,14 @@ class ReuseTabModule {
|
|
|
1182
1199
|
{
|
|
1183
1200
|
provide: REUSE_TAB_STORAGE_STATE,
|
|
1184
1201
|
useFactory: () => new ReuseTabLocalStorageState()
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
provide: REUSE_TAB_CACHED_MANAGER,
|
|
1205
|
+
useFactory: () => new ReuseTabCachedManagerFactory()
|
|
1185
1206
|
}
|
|
1186
1207
|
], imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule] }); }
|
|
1187
1208
|
}
|
|
1188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ReuseTabModule, decorators: [{
|
|
1189
1210
|
type: NgModule,
|
|
1190
1211
|
args: [{
|
|
1191
1212
|
imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule],
|
|
@@ -1198,6 +1219,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImpor
|
|
|
1198
1219
|
{
|
|
1199
1220
|
provide: REUSE_TAB_STORAGE_STATE,
|
|
1200
1221
|
useFactory: () => new ReuseTabLocalStorageState()
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
provide: REUSE_TAB_CACHED_MANAGER,
|
|
1225
|
+
useFactory: () => new ReuseTabCachedManagerFactory()
|
|
1201
1226
|
}
|
|
1202
1227
|
],
|
|
1203
1228
|
exports: COMPONENTS
|