Skip to content

Commit b058fd7

Browse files
authored
feat: do not use rxjs >= 7 exclusive feature to not break backward co… (#1521)
Co-authored-by: Markiewic <[email protected]>
1 parent 17a841c commit b058fd7

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

libs/cdk/excel/src/excel.service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Inject, Injectable } from '@angular/core';
22
import { exclude } from '@angular-ru/cdk/array';
33
import { Nullable, PlainObject } from '@angular-ru/cdk/typings';
4-
import { firstValueFrom, Observable, of } from 'rxjs';
4+
import { Observable, of } from 'rxjs';
55

66
import { EntriesKeys } from './domain/entries-keys';
77
import { ExcelBuilderTextColumnInterceptor } from './domain/excel-builder-text-column-interceptor';
@@ -19,16 +19,16 @@ export class ExcelService {
1919
) {}
2020

2121
public exportExcel<T>(workbook: Partial<ExcelWorkbook<T>>): void {
22-
firstValueFrom(
23-
this.getTranslatedColumn()
24-
// eslint-disable-next-line rxjs/no-topromise
25-
).then(async (translatedKeys: Nullable<PlainObject>): Promise<void> => {
26-
await this.builder.exportExcelByWorkbook({
27-
filename: this.interceptFilename<T>(workbook),
28-
worksheets: this.interceptWorksheets<T>(workbook),
29-
translatedKeys: translatedKeys ?? workbook.translatedKeys ?? {}
22+
this.getTranslatedColumn()
23+
// eslint-disable-next-line rxjs/no-topromise, deprecation/deprecation
24+
.toPromise()
25+
.then(async (translatedKeys: Nullable<PlainObject>): Promise<void> => {
26+
await this.builder.exportExcelByWorkbook({
27+
filename: this.interceptFilename<T>(workbook),
28+
worksheets: this.interceptWorksheets<T>(workbook),
29+
translatedKeys: translatedKeys ?? workbook.translatedKeys ?? {}
30+
});
3031
});
31-
});
3232
}
3333

3434
private interceptFilename<T>(workbook: Partial<ExcelWorkbook<T>>): string {

libs/cdk/table-utils/src/table-clipboard/table-clipboard.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EmptyValue, Nullable, PlainObject } from '@angular-ru/cdk/typings';
55
import { copyHtml, isNotNil } from '@angular-ru/cdk/utils';
66
import { WebWorkerThreadService } from '@angular-ru/cdk/webworker';
77
import { TranslateService } from '@ngx-translate/core';
8-
import { firstValueFrom, Observable, of } from 'rxjs';
8+
import { Observable, of } from 'rxjs';
99

1010
import { RulesDescriptor } from '../plain-table-composer/interfaces/rules-descriptor';
1111
import { PlainTableComposerService } from '../plain-table-composer/plain-table-composer.service';
@@ -123,8 +123,11 @@ export class TableClipboardService {
123123
const lang: Nullable<string> = this.translate.currentLang ?? this.translate.defaultLang;
124124
const translationMap$: Observable<PlainObject> = isNotNil(lang) ? this.translate.getTranslation(lang) : of({});
125125

126-
return firstValueFrom(translationMap$).then(
127-
(map: PlainObject): PlainObject => this.plainTableComposer.composeSingle(map)
126+
return (
127+
translationMap$
128+
// eslint-disable-next-line rxjs/no-topromise, deprecation/deprecation
129+
.toPromise()
130+
.then((map: PlainObject | nil): PlainObject => this.plainTableComposer.composeSingle(map!))
128131
);
129132
}
130133
}

0 commit comments

Comments
 (0)