Skip to content

Commit 175a7e4

Browse files
author
Danil Khaliulin
committed
dialog: UiDialogService.providers() инкапсулирует DialogService, праймовский импорт убран из сторис
1 parent 0bc52f5 commit 175a7e4

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

src/lib/components/dialog/dialog-open.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export { DynamicDialogRef, DynamicDialogConfig };
1111

1212
@Injectable()
1313
export class UiDialogService {
14+
static providers() {
15+
return [DialogService, UiDialogService];
16+
}
17+
1418
constructor(private readonly primengDialogService: DialogService) {}
1519

1620
open<T>(componentType: Type<T>, config: UiDynamicDialogConfig = {}): DynamicDialogRef<T> | null {

src/stories/components/dialog/dialog.stories.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,18 @@ export const Dynamic: Story = {
318318
language: 'ts',
319319
code: `
320320
import { Component } from '@angular/core';
321-
import { Button } from 'primeng/button';
322-
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
323-
import { UiDialogService } from '@cdek-it/angular-ui-kit';
321+
import { ButtonComponent, DynamicDialogRef, UiDialogService } from '@cdek-it/angular-ui-kit';
324322
325323
// Содержимое диалога
326324
@Component({
327325
selector: 'app-dialog-dynamic-content',
328326
standalone: true,
329-
imports: [Button],
327+
imports: [ButtonComponent],
330328
template: \`
331329
<p>Заявка на доставку груза №CDEK-2025-00478312 готова к оформлению.</p>
332330
<div class="flex justify-end gap-2 mt-4">
333-
<p-button variant="text" label="Отмена" (onClick)="ref.close()"></p-button>
334-
<p-button label="Подтвердить" (onClick)="ref.close(true)"></p-button>
331+
<button variant="text" label="Отмена" (click)="ref.close()"></button>
332+
<button label="Подтвердить" (click)="ref.close(true)"></button>
335333
</div>
336334
\`,
337335
})
@@ -343,10 +341,10 @@ export class DialogDynamicContentComponent {
343341
@Component({
344342
selector: 'app-dialog-dynamic',
345343
standalone: true,
346-
imports: [Button],
347-
providers: [DialogService, UiDialogService],
344+
imports: [ButtonComponent],
345+
providers: [UiDialogService.providers()],
348346
template: \`
349-
<p-button (onClick)="open()" label="Создать заявку"></p-button>
347+
<button (click)="open()" label="Создать заявку"></button>
350348
\`,
351349
})
352350
export class DialogDynamicComponent {

src/stories/components/dialog/examples/dialog-dynamic.component.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import { Component } from '@angular/core';
2-
import { Button } from 'primeng/button';
3-
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
4-
import { UiDialogService } from '../../../../lib/components/dialog/dialog-open.service';
2+
import { ButtonComponent } from '../../../../lib/components/button/button.component';
3+
import { DynamicDialogRef, UiDialogService } from '../../../../lib/components/dialog/dialog-open.service';
54

65
// ── Содержимое диалога ────────────────────────────────────────────────────────
76

87
@Component({
98
selector: 'app-dialog-dynamic-content',
109
standalone: true,
11-
imports: [Button],
10+
imports: [ButtonComponent],
1211
template: `
1312
<p>Заявка на доставку груза №CDEK-2025-00478312 готова к оформлению.</p>
1413
<p>Вес отправления: 3,5 кг, габариты: 40×30×20 см. Ориентировочный срок — 3 рабочих дня.</p>
1514
<div class="flex justify-end gap-2 mt-4">
16-
<p-button variant="text" label="Отмена" (onClick)="ref.close()"></p-button>
17-
<p-button label="Подтвердить" (onClick)="ref.close(true)"></p-button>
15+
<button variant="text" label="Отмена" (click)="ref.close()"></button>
16+
<button label="Подтвердить" (click)="ref.close(true)"></button>
1817
</div>
1918
`,
2019
})
@@ -26,15 +25,15 @@ export class DialogDynamicContentComponent {
2625

2726
export const template = `
2827
<div class="bg-surface-ground">
29-
<p-button (onClick)="open()" label="Создать заявку"></p-button>
28+
<button (click)="open()" label="Создать заявку"></button>
3029
</div>
3130
`;
3231

3332
@Component({
3433
selector: 'app-dialog-dynamic',
3534
standalone: true,
36-
imports: [Button],
37-
providers: [DialogService, UiDialogService],
35+
imports: [ButtonComponent],
36+
providers: [UiDialogService.providers()],
3837
template,
3938
})
4039
export class DialogDynamicComponent {

0 commit comments

Comments
 (0)