@shival99/z-ui 2.1.28 → 2.1.29

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.
Files changed (68) hide show
  1. package/package.json +1 -1
  2. package/types/shival99-z-ui-components-z-select.d.ts +1 -1
  3. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +0 -1079
  4. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +0 -1
  5. package/fesm2022/shival99-z-ui-components-z-drawer.mjs +0 -742
  6. package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +0 -1
  7. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +0 -58
  8. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +0 -1
  9. package/fesm2022/shival99-z-ui-components-z-editor.mjs +0 -1750
  10. package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +0 -1
  11. package/fesm2022/shival99-z-ui-components-z-gallery.mjs +0 -2419
  12. package/fesm2022/shival99-z-ui-components-z-gallery.mjs.map +0 -1
  13. package/fesm2022/shival99-z-ui-components-z-kanban.mjs +0 -981
  14. package/fesm2022/shival99-z-ui-components-z-kanban.mjs.map +0 -1
  15. package/fesm2022/shival99-z-ui-components-z-marquee.mjs +0 -70
  16. package/fesm2022/shival99-z-ui-components-z-marquee.mjs.map +0 -1
  17. package/fesm2022/shival99-z-ui-components-z-media-player.mjs +0 -668
  18. package/fesm2022/shival99-z-ui-components-z-media-player.mjs.map +0 -1
  19. package/fesm2022/shival99-z-ui-components-z-menu.mjs +0 -843
  20. package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +0 -1
  21. package/fesm2022/shival99-z-ui-components-z-metric-card.mjs +0 -128
  22. package/fesm2022/shival99-z-ui-components-z-metric-card.mjs.map +0 -1
  23. package/fesm2022/shival99-z-ui-components-z-pagination.mjs +0 -158
  24. package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +0 -1
  25. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs +0 -383
  26. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs.map +0 -1
  27. package/fesm2022/shival99-z-ui-components-z-radio.mjs +0 -167
  28. package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +0 -1
  29. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs +0 -131
  30. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs.map +0 -1
  31. package/fesm2022/shival99-z-ui-components-z-show-more.mjs +0 -121
  32. package/fesm2022/shival99-z-ui-components-z-show-more.mjs.map +0 -1
  33. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs +0 -61
  34. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs.map +0 -1
  35. package/fesm2022/shival99-z-ui-components-z-steps.mjs +0 -396
  36. package/fesm2022/shival99-z-ui-components-z-steps.mjs.map +0 -1
  37. package/fesm2022/shival99-z-ui-components-z-table.mjs +0 -10508
  38. package/fesm2022/shival99-z-ui-components-z-table.mjs.map +0 -1
  39. package/fesm2022/shival99-z-ui-components-z-tabs.mjs +0 -507
  40. package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +0 -1
  41. package/fesm2022/shival99-z-ui-components-z-tags.mjs +0 -349
  42. package/fesm2022/shival99-z-ui-components-z-tags.mjs.map +0 -1
  43. package/fesm2022/shival99-z-ui-components-z-timeline.mjs +0 -237
  44. package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +0 -1
  45. package/fesm2022/shival99-z-ui-components-z-upload.mjs +0 -523
  46. package/fesm2022/shival99-z-ui-components-z-upload.mjs.map +0 -1
  47. package/types/shival99-z-ui-components-z-autocomplete.d.ts +0 -290
  48. package/types/shival99-z-ui-components-z-drawer.d.ts +0 -266
  49. package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +0 -54
  50. package/types/shival99-z-ui-components-z-editor.d.ts +0 -337
  51. package/types/shival99-z-ui-components-z-gallery.d.ts +0 -402
  52. package/types/shival99-z-ui-components-z-kanban.d.ts +0 -237
  53. package/types/shival99-z-ui-components-z-marquee.d.ts +0 -35
  54. package/types/shival99-z-ui-components-z-media-player.d.ts +0 -124
  55. package/types/shival99-z-ui-components-z-menu.d.ts +0 -222
  56. package/types/shival99-z-ui-components-z-metric-card.d.ts +0 -67
  57. package/types/shival99-z-ui-components-z-pagination.d.ts +0 -55
  58. package/types/shival99-z-ui-components-z-qrcode.d.ts +0 -76
  59. package/types/shival99-z-ui-components-z-radio.d.ts +0 -69
  60. package/types/shival99-z-ui-components-z-scrollarea.d.ts +0 -46
  61. package/types/shival99-z-ui-components-z-show-more.d.ts +0 -36
  62. package/types/shival99-z-ui-components-z-skeleton-auto.d.ts +0 -35
  63. package/types/shival99-z-ui-components-z-steps.d.ts +0 -106
  64. package/types/shival99-z-ui-components-z-table.d.ts +0 -1924
  65. package/types/shival99-z-ui-components-z-tabs.d.ts +0 -92
  66. package/types/shival99-z-ui-components-z-tags.d.ts +0 -128
  67. package/types/shival99-z-ui-components-z-timeline.d.ts +0 -71
  68. package/types/shival99-z-ui-components-z-upload.d.ts +0 -153
@@ -1,742 +0,0 @@
1
- import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';
2
- import * as i1 from '@angular/cdk/portal';
3
- import { BasePortalOutlet, CdkPortalOutlet, TemplatePortal, PortalModule, ComponentPortal } from '@angular/cdk/portal';
4
- import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
5
- import * as i0 from '@angular/core';
6
- import { inject, TemplateRef, Directive, InjectionToken, output, input, model, contentChild, viewChild, PLATFORM_ID, ElementRef, ViewContainerRef, ChangeDetectorRef, DestroyRef, signal, computed, effect, ChangeDetectionStrategy, Component, EventEmitter, Inject, Injector, Injectable } from '@angular/core';
7
- import { TranslatePipe } from '@ngx-translate/core';
8
- import { ZSkeletonComponent } from '@shival99/z-ui/components/z-skeleton';
9
- import { ZTranslateService, ZOverlayContainerService, ZOverlayZIndexService } from '@shival99/z-ui/services';
10
- import { zDetectBrowser, zMergeClasses } from '@shival99/z-ui/utils';
11
- import { cva } from 'class-variance-authority';
12
- import { __decorate, __param, __metadata } from 'tslib';
13
- import { Subject, takeUntil, fromEvent, filter } from 'rxjs';
14
-
15
- class ZDrawerContentDirective {
16
- templateRef = inject((TemplateRef));
17
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
18
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.9", type: ZDrawerContentDirective, isStandalone: true, selector: "[z-drawer-content], [zDrawerContent]", ngImport: i0 });
19
- }
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerContentDirective, decorators: [{
21
- type: Directive,
22
- args: [{
23
- selector: '[z-drawer-content], [zDrawerContent]',
24
- standalone: true,
25
- }]
26
- }] });
27
-
28
- class ZDrawerFooterDirective {
29
- templateRef = inject((TemplateRef));
30
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerFooterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
31
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.9", type: ZDrawerFooterDirective, isStandalone: true, selector: "[z-drawer-footer], [zDrawerFooter]", ngImport: i0 });
32
- }
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerFooterDirective, decorators: [{
34
- type: Directive,
35
- args: [{
36
- selector: '[z-drawer-footer], [zDrawerFooter]',
37
- standalone: true,
38
- }]
39
- }] });
40
-
41
- class ZDrawerHeaderDirective {
42
- templateRef = inject((TemplateRef));
43
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
44
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.9", type: ZDrawerHeaderDirective, isStandalone: true, selector: "[z-drawer-header], [zDrawerHeader]", ngImport: i0 });
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerHeaderDirective, decorators: [{
47
- type: Directive,
48
- args: [{
49
- selector: '[z-drawer-header], [zDrawerHeader]',
50
- standalone: true,
51
- }]
52
- }] });
53
-
54
- const Z_DRAWER_DATA = new InjectionToken('Z_DRAWER_DATA');
55
- const Z_DRAWER_ANIMATION_DURATION = 250;
56
- var ZDrawerTriggerAction;
57
- (function (ZDrawerTriggerAction) {
58
- ZDrawerTriggerAction["CANCEL"] = "cancel";
59
- ZDrawerTriggerAction["OK"] = "ok";
60
- })(ZDrawerTriggerAction || (ZDrawerTriggerAction = {}));
61
- const noopFun = () => { };
62
- /**
63
- * Configuration options for z-drawer component.
64
- *
65
- * @template T - The type of the content component
66
- * @template U - The type of the data passed to the drawer
67
- */
68
- class ZDrawerOptions {
69
- /** Icon for the cancel button */
70
- zCancelIcon;
71
- /** Text for the cancel button. Set to null to hide the button */
72
- zCancelText;
73
- /** Whether the drawer is closable (shows close button) */
74
- zClosable;
75
- /** Drawer content - can be a component, template, or string */
76
- zContent;
77
- /** Custom CSS classes for the drawer */
78
- class;
79
- /** Custom CSS classes for the drawer body */
80
- zBodyClass;
81
- /** Data to be passed to the content component via Z_DRAWER_DATA token */
82
- zData;
83
- /**
84
- * Observable for deferred data loading before showing drawer content.
85
- * Drawer will show a loading spinner until the Observable completes.
86
- * The resolved data will be available via Z_DRAWER_DATA.
87
- */
88
- zDefer;
89
- /** Description text shown below the title */
90
- zDescription;
91
- /** Whether to disable the header and footer shadows */
92
- zDisableShadow;
93
- /** Whether to show a border below the header */
94
- zHeaderBorder;
95
- /** Whether to show a border above the footer */
96
- zFooterBorder;
97
- /** Whether to hide the default footer */
98
- zHideFooter;
99
- /** Whether to hide the default header */
100
- zHideHeader;
101
- /**
102
- * WritableSignal to control loading state of the OK button.
103
- * Use this when submitting forms or calling APIs.
104
- */
105
- zLoading;
106
- /** Whether clicking mask closes the drawer */
107
- zMaskClosable;
108
- /** Whether OK button has destructive (red) style */
109
- zOkDestructive;
110
- /** Whether OK button is disabled */
111
- zOkDisabled;
112
- /** Overlay style: 'dark' (black overlay) or 'blur' (backdrop blur) */
113
- zOverlay;
114
- /** Icon for the OK button */
115
- zOkIcon;
116
- /** Text for the OK button. Set to null to hide the button */
117
- zOkText;
118
- /** Callback or EventEmitter when cancel is clicked */
119
- zOnCancel = noopFun;
120
- /** Callback or EventEmitter when OK is clicked */
121
- zOnOk = noopFun;
122
- /** Drawer title - supports string, HTML string, or TemplateRef */
123
- zTitle;
124
- /** ViewContainerRef for the drawer portal */
125
- zViewContainerRef;
126
- /** Drawer width for left/right placement (e.g., '400px', '80%') */
127
- zWidth;
128
- /** Drawer height for top/bottom placement (e.g., '400px', '50%') */
129
- zHeight;
130
- /** Placement of the drawer: 'left', 'right', 'top', 'bottom' */
131
- zPlacement;
132
- /** Force shadow on header/footer regardless of scroll state */
133
- zShadow;
134
- /** Shape of the drawer: 'rounded' (with border-radius) or 'square' (no border-radius) */
135
- zShape;
136
- /** WritableSignal to control content loading state (shows skeleton when true) */
137
- zContentLoading;
138
- /** Number of skeleton rows to show when content is loading (default: 5 for left/right, 3 for top/bottom) */
139
- zSkeletonRows;
140
- }
141
-
142
- const getOverlayType = () => {
143
- const browser = zDetectBrowser();
144
- return browser.name === 'Chrome' ? 'dark' : 'blur';
145
- };
146
-
147
- const zDrawerVariants = cva(['fixed z-50 flex flex-col bg-background overflow-hidden'].join(' '), {
148
- variants: {
149
- placement: {
150
- left: 'left-0 top-0 h-full max-w-[90vw] dark:border-r shadow-[3px_0_10px_rgba(0,0,0,0.08)]',
151
- right: 'right-0 top-0 h-full max-w-[90vw] dark:border-l shadow-[-3px_0_10px_rgba(0,0,0,0.08)]',
152
- top: 'top-0 left-0 w-full max-h-[90vh] dark:border-b shadow-[0_3px_10px_rgba(0,0,0,0.08)]',
153
- bottom: 'bottom-0 left-0 w-full max-h-[90vh] dark:border-t shadow-[0_-3px_10px_rgba(0,0,0,0.08)]',
154
- },
155
- shape: {
156
- rounded: '',
157
- square: '',
158
- },
159
- },
160
- compoundVariants: [
161
- { placement: 'left', shape: 'rounded', class: 'rounded-r-lg' },
162
- { placement: 'right', shape: 'rounded', class: 'rounded-l-lg' },
163
- { placement: 'top', shape: 'rounded', class: 'rounded-b-lg' },
164
- { placement: 'bottom', shape: 'rounded', class: 'rounded-t-lg' },
165
- ],
166
- defaultVariants: {
167
- placement: 'right',
168
- shape: 'rounded',
169
- },
170
- });
171
-
172
- class ZDrawerComponent extends BasePortalOutlet {
173
- zOnOk = output();
174
- zOnCancel = output();
175
- zAfterClose = output();
176
- zScrollbar = output();
177
- class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
178
- zBodyClass = input('', ...(ngDevMode ? [{ debugName: "zBodyClass" }] : []));
179
- zVisible = model(false, ...(ngDevMode ? [{ debugName: "zVisible" }] : []));
180
- zTitle = input(...(ngDevMode ? [undefined, { debugName: "zTitle" }] : []));
181
- zDescription = input(...(ngDevMode ? [undefined, { debugName: "zDescription" }] : []));
182
- zWidth = input('400px', ...(ngDevMode ? [{ debugName: "zWidth" }] : []));
183
- zHeight = input('400px', ...(ngDevMode ? [{ debugName: "zHeight" }] : []));
184
- zPlacement = input('right', ...(ngDevMode ? [{ debugName: "zPlacement" }] : []));
185
- zClosable = input(true, ...(ngDevMode ? [{ debugName: "zClosable" }] : []));
186
- zMaskClosable = input(true, ...(ngDevMode ? [{ debugName: "zMaskClosable" }] : []));
187
- zDisableShadow = input(false, ...(ngDevMode ? [{ debugName: "zDisableShadow" }] : []));
188
- zHeaderBorder = input(false, ...(ngDevMode ? [{ debugName: "zHeaderBorder" }] : []));
189
- zFooterBorder = input(false, ...(ngDevMode ? [{ debugName: "zFooterBorder" }] : []));
190
- zHideFooter = input(false, ...(ngDevMode ? [{ debugName: "zHideFooter" }] : []));
191
- zHideHeader = input(false, ...(ngDevMode ? [{ debugName: "zHideHeader" }] : []));
192
- zOkText = input(null, ...(ngDevMode ? [{ debugName: "zOkText" }] : []));
193
- zCancelText = input(null, ...(ngDevMode ? [{ debugName: "zCancelText" }] : []));
194
- zOkDestructive = input(false, ...(ngDevMode ? [{ debugName: "zOkDestructive" }] : []));
195
- zOkDisabled = input(false, ...(ngDevMode ? [{ debugName: "zOkDisabled" }] : []));
196
- zLoading = input(false, ...(ngDevMode ? [{ debugName: "zLoading" }] : []));
197
- zOverlay = input(getOverlayType(), ...(ngDevMode ? [{ debugName: "zOverlay" }] : []));
198
- zShadow = input(false, ...(ngDevMode ? [{ debugName: "zShadow" }] : []));
199
- zShape = input('rounded', ...(ngDevMode ? [{ debugName: "zShape" }] : []));
200
- zContentLoading = input(false, ...(ngDevMode ? [{ debugName: "zContentLoading" }] : []));
201
- zSkeletonRows = input(null, ...(ngDevMode ? [{ debugName: "zSkeletonRows" }] : []));
202
- customHeader = contentChild(ZDrawerHeaderDirective, ...(ngDevMode ? [{ debugName: "customHeader" }] : []));
203
- customContent = contentChild(ZDrawerContentDirective, ...(ngDevMode ? [{ debugName: "customContent" }] : []));
204
- customFooter = contentChild(ZDrawerFooterDirective, ...(ngDevMode ? [{ debugName: "customFooter" }] : []));
205
- drawerRef;
206
- portalOutlet = viewChild(CdkPortalOutlet, ...(ngDevMode ? [{ debugName: "portalOutlet" }] : []));
207
- dummyTemplateRef = viewChild('dummyTemplate', ...(ngDevMode ? [{ debugName: "dummyTemplateRef" }] : []));
208
- mainContentRef = viewChild('mainContent', ...(ngDevMode ? [{ debugName: "mainContentRef" }] : []));
209
- config = inject((ZDrawerOptions), { optional: true }) || new ZDrawerOptions();
210
- _platformId = inject(PLATFORM_ID);
211
- _host = inject((ElementRef));
212
- _overlay = inject(Overlay);
213
- _viewContainerRef = inject(ViewContainerRef);
214
- _cdr = inject(ChangeDetectorRef);
215
- _destroyRef = inject(DestroyRef);
216
- _zTranslate = inject(ZTranslateService);
217
- _overlayContainerService = inject(ZOverlayContainerService);
218
- _zIndexService = inject(ZOverlayZIndexService);
219
- _templateOverlayRef = null;
220
- _originalParent = null;
221
- _originalNextSibling = null;
222
- _backdropSubscription = null;
223
- _closeTimeout = null;
224
- isLeaving = signal(false, ...(ngDevMode ? [{ debugName: "isLeaving" }] : []));
225
- hasScrollableContent = signal(false, ...(ngDevMode ? [{ debugName: "hasScrollableContent" }] : []));
226
- isScrolledFromTop = signal(false, ...(ngDevMode ? [{ debugName: "isScrolledFromTop" }] : []));
227
- isScrolledToBottom = signal(false, ...(ngDevMode ? [{ debugName: "isScrolledToBottom" }] : []));
228
- isServiceMode = computed(() => !!this.drawerRef, ...(ngDevMode ? [{ debugName: "isServiceMode" }] : []));
229
- isTemplateMode = computed(() => !this.isServiceMode(), ...(ngDevMode ? [{ debugName: "isTemplateMode" }] : []));
230
- shouldRenderContent = computed(() => this.zVisible() || this.isLeaving(), ...(ngDevMode ? [{ debugName: "shouldRenderContent" }] : []));
231
- isStringContent = computed(() => typeof this.config.zContent === 'string', ...(ngDevMode ? [{ debugName: "isStringContent" }] : []));
232
- _lastScrollHeight = 0;
233
- ngAfterViewChecked() {
234
- this._checkScrollState();
235
- }
236
- _checkScrollState() {
237
- const scrollbar = this.mainContentRef();
238
- if (!scrollbar) {
239
- return;
240
- }
241
- const viewport = scrollbar.nativeElement.querySelector('.ng-scroll-viewport');
242
- if (!viewport) {
243
- return;
244
- }
245
- if (viewport.scrollHeight === this._lastScrollHeight) {
246
- return;
247
- }
248
- this._lastScrollHeight = viewport.scrollHeight;
249
- const hasVerticalScroll = viewport.scrollHeight > viewport.clientHeight;
250
- this.hasScrollableContent.set(hasVerticalScroll);
251
- }
252
- onContentScroll(event) {
253
- const target = event.target;
254
- if (!target) {
255
- return;
256
- }
257
- const { scrollTop } = target;
258
- const { scrollHeight } = target;
259
- const { clientHeight } = target;
260
- this.isScrolledFromTop.set(scrollTop > 0);
261
- this.isScrolledToBottom.set(scrollTop + clientHeight >= scrollHeight - 1);
262
- }
263
- effectiveTitle = computed(() => {
264
- this._zTranslate.currentLang();
265
- return this.isServiceMode() ? this.config.zTitle : this.zTitle();
266
- }, ...(ngDevMode ? [{ debugName: "effectiveTitle" }] : []));
267
- effectiveDescription = computed(() => this.isServiceMode() ? this.config.zDescription : this.zDescription(), ...(ngDevMode ? [{ debugName: "effectiveDescription" }] : []));
268
- hasEffectiveDescription = computed(() => !!this.effectiveDescription(), ...(ngDevMode ? [{ debugName: "hasEffectiveDescription" }] : []));
269
- headerContentClasses = computed(() => zMergeClasses('flex w-full justify-between overflow-hidden px-4', this.hasEffectiveDescription() ? 'items-start' : 'items-center'), ...(ngDevMode ? [{ debugName: "headerContentClasses" }] : []));
270
- effectiveBodyClass = computed(() => this.isServiceMode() ? this.config.zBodyClass : this.zBodyClass(), ...(ngDevMode ? [{ debugName: "effectiveBodyClass" }] : []));
271
- bodyClasses = computed(() => zMergeClasses('flex min-h-0 flex-col gap-4 px-4 py-4', this.effectiveBodyClass()), ...(ngDevMode ? [{ debugName: "bodyClasses" }] : []));
272
- effectiveClosable = computed(() => this.isServiceMode() ? (this.config.zClosable ?? true) : this.zClosable(), ...(ngDevMode ? [{ debugName: "effectiveClosable" }] : []));
273
- effectiveDisableShadow = computed(() => this.isServiceMode() ? (this.config.zDisableShadow ?? false) : this.zDisableShadow(), ...(ngDevMode ? [{ debugName: "effectiveDisableShadow" }] : []));
274
- shouldShowShadow = computed(() => !this.effectiveDisableShadow(), ...(ngDevMode ? [{ debugName: "shouldShowShadow" }] : []));
275
- effectiveHeaderBorder = computed(() => this.isServiceMode() ? (this.config.zHeaderBorder ?? false) : this.zHeaderBorder(), ...(ngDevMode ? [{ debugName: "effectiveHeaderBorder" }] : []));
276
- effectiveFooterBorder = computed(() => this.isServiceMode() ? (this.config.zFooterBorder ?? false) : this.zFooterBorder(), ...(ngDevMode ? [{ debugName: "effectiveFooterBorder" }] : []));
277
- effectiveHideFooter = computed(() => this.isServiceMode() ? this.config.zHideFooter : this.zHideFooter(), ...(ngDevMode ? [{ debugName: "effectiveHideFooter" }] : []));
278
- effectiveHideHeader = computed(() => this.isServiceMode() ? (this.config.zHideHeader ?? false) : this.zHideHeader(), ...(ngDevMode ? [{ debugName: "effectiveHideHeader" }] : []));
279
- effectiveOkText = computed(() => (this.isServiceMode() ? this.config.zOkText : this.zOkText()), ...(ngDevMode ? [{ debugName: "effectiveOkText" }] : []));
280
- effectiveCancelText = computed(() => this.isServiceMode() ? this.config.zCancelText : this.zCancelText(), ...(ngDevMode ? [{ debugName: "effectiveCancelText" }] : []));
281
- effectiveOkDestructive = computed(() => this.isServiceMode() ? this.config.zOkDestructive : this.zOkDestructive(), ...(ngDevMode ? [{ debugName: "effectiveOkDestructive" }] : []));
282
- effectiveOkDisabled = computed(() => this.isServiceMode() ? this.config.zOkDisabled : this.zOkDisabled(), ...(ngDevMode ? [{ debugName: "effectiveOkDisabled" }] : []));
283
- effectiveLoading = computed(() => {
284
- if (this.isServiceMode()) {
285
- return this.drawerRef?.loading() || (this.config.zLoading?.() ?? false);
286
- }
287
- return this.zLoading();
288
- }, ...(ngDevMode ? [{ debugName: "effectiveLoading" }] : []));
289
- effectiveContentLoading = computed(() => {
290
- if (this.isServiceMode()) {
291
- return this.config.zContentLoading?.() ?? false;
292
- }
293
- return this.zContentLoading();
294
- }, ...(ngDevMode ? [{ debugName: "effectiveContentLoading" }] : []));
295
- effectiveSkeletonRows = computed(() => {
296
- if (this.isServiceMode() && this.config.zSkeletonRows != null) {
297
- return this.config.zSkeletonRows;
298
- }
299
- if (this.zSkeletonRows() != null) {
300
- return this.zSkeletonRows();
301
- }
302
- const placement = this.effectivePlacement();
303
- return placement === 'left' || placement === 'right' ? 6 : 3;
304
- }, ...(ngDevMode ? [{ debugName: "effectiveSkeletonRows" }] : []));
305
- effectivePlacement = computed(() => {
306
- if (this.isServiceMode()) {
307
- return this.config.zPlacement ?? 'right';
308
- }
309
- return this.zPlacement();
310
- }, ...(ngDevMode ? [{ debugName: "effectivePlacement" }] : []));
311
- effectiveShadow = computed(() => {
312
- if (this.isServiceMode()) {
313
- return this.config.zShadow ?? false;
314
- }
315
- return this.zShadow();
316
- }, ...(ngDevMode ? [{ debugName: "effectiveShadow" }] : []));
317
- effectiveShape = computed(() => {
318
- if (this.isServiceMode()) {
319
- return this.config.zShape ?? 'rounded';
320
- }
321
- return this.zShape();
322
- }, ...(ngDevMode ? [{ debugName: "effectiveShape" }] : []));
323
- effectiveWidth = computed(() => {
324
- const placement = this.effectivePlacement();
325
- if (placement === 'top' || placement === 'bottom') {
326
- return null;
327
- }
328
- if (this.isServiceMode()) {
329
- return this.zWidth() || this.config.zWidth || null;
330
- }
331
- return this.shouldRenderContent() ? this.zWidth() : null;
332
- }, ...(ngDevMode ? [{ debugName: "effectiveWidth" }] : []));
333
- effectiveHeight = computed(() => {
334
- const placement = this.effectivePlacement();
335
- if (placement === 'left' || placement === 'right') {
336
- return null;
337
- }
338
- if (this.isServiceMode()) {
339
- return this.zHeight() || this.config.zHeight || null;
340
- }
341
- return this.shouldRenderContent() ? this.zHeight() : null;
342
- }, ...(ngDevMode ? [{ debugName: "effectiveHeight" }] : []));
343
- isDeferLoading = computed(() => {
344
- if (!this.isServiceMode()) {
345
- return false;
346
- }
347
- return !!this.config.zDefer && !this.portalOutlet()?.hasAttached();
348
- }, ...(ngDevMode ? [{ debugName: "isDeferLoading" }] : []));
349
- classes = computed(() => zMergeClasses(zDrawerVariants({ placement: this.effectivePlacement(), shape: this.effectiveShape() }), this.isServiceMode() ? this.config.class : this.class()), ...(ngDevMode ? [{ debugName: "classes" }] : []));
350
- hostClasses = computed(() => {
351
- const baseClasses = this.classes();
352
- if (this.isServiceMode()) {
353
- return `${baseClasses} z-drawer-service-mode`.trim();
354
- }
355
- if (this.shouldRenderContent()) {
356
- return `${baseClasses} z-drawer-template-mode`.trim();
357
- }
358
- return 'z-drawer-template-host';
359
- }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
360
- constructor() {
361
- super();
362
- effect(() => {
363
- this._zTranslate.currentLang();
364
- this._cdr.markForCheck();
365
- });
366
- effect(() => {
367
- const scrollbar = this.mainContentRef();
368
- if (scrollbar) {
369
- this.zScrollbar.emit(scrollbar);
370
- }
371
- });
372
- effect(() => {
373
- const visible = this.zVisible();
374
- if (visible && this.isTemplateMode() && !this._templateOverlayRef) {
375
- this._openTemplateOverlay();
376
- return;
377
- }
378
- if (!visible && this.isTemplateMode() && this._templateOverlayRef && !this.isLeaving()) {
379
- this._closeWithAnimation();
380
- }
381
- });
382
- }
383
- ngOnDestroy() {
384
- this._clearCloseTimeout();
385
- this._disposeTemplateOverlay();
386
- }
387
- isDestroyed() {
388
- return this._destroyRef.destroyed;
389
- }
390
- getNativeElement() {
391
- return this._host.nativeElement;
392
- }
393
- attachComponentPortal(portal) {
394
- this._cdr.detectChanges();
395
- const outlet = this.portalOutlet();
396
- if (outlet?.hasAttached()) {
397
- throw new Error('Attempting to attach drawer content after content is already attached');
398
- }
399
- return outlet?.attachComponentPortal(portal);
400
- }
401
- attachTemplatePortal(portal) {
402
- const outlet = this.portalOutlet();
403
- if (outlet?.hasAttached()) {
404
- throw new Error('Attempting to attach drawer content after content is already attached');
405
- }
406
- return outlet?.attachTemplatePortal(portal);
407
- }
408
- onOkClick() {
409
- if (this.effectiveLoading()) {
410
- return;
411
- }
412
- this.zOnOk.emit();
413
- }
414
- onCloseClick() {
415
- if (this.effectiveLoading()) {
416
- return;
417
- }
418
- this.zOnCancel.emit();
419
- if (this.isTemplateMode()) {
420
- this._closeWithAnimation();
421
- }
422
- }
423
- onBackdropClick() {
424
- if (this.zMaskClosable() && !this.effectiveLoading()) {
425
- this.zOnCancel.emit();
426
- this._closeWithAnimation();
427
- }
428
- }
429
- open() {
430
- this.isLeaving.set(false);
431
- this.zVisible.set(true);
432
- }
433
- close() {
434
- this._closeWithAnimation();
435
- }
436
- _createOverlay() {
437
- if (!isPlatformBrowser(this._platformId)) {
438
- return null;
439
- }
440
- const overlayType = this.zOverlay();
441
- const backdropClass = overlayType === 'blur' ? 'z-drawer-backdrop-blur' : 'z-drawer-backdrop-dark';
442
- const overlayConfig = new OverlayConfig({
443
- hasBackdrop: true,
444
- backdropClass,
445
- panelClass: 'z-drawer-overlay-pane',
446
- positionStrategy: this._overlay.position().global(),
447
- scrollStrategy: this._overlay.scrollStrategies.block(),
448
- });
449
- return this._overlay.create(overlayConfig);
450
- }
451
- _openTemplateOverlay() {
452
- if (this._templateOverlayRef) {
453
- return;
454
- }
455
- const dummyRef = this.dummyTemplateRef();
456
- if (!dummyRef) {
457
- return;
458
- }
459
- this._templateOverlayRef = this._createOverlay();
460
- if (!this._templateOverlayRef) {
461
- return;
462
- }
463
- this._zIndexService.applyToOverlay(this._templateOverlayRef);
464
- const hostElement = this._host.nativeElement;
465
- this._originalParent = hostElement.parentElement;
466
- this._originalNextSibling = hostElement.nextSibling;
467
- const portal = new TemplatePortal(dummyRef, this._viewContainerRef);
468
- this._templateOverlayRef.attach(portal);
469
- const overlayPane = this._templateOverlayRef.overlayElement;
470
- overlayPane.style.position = 'static';
471
- overlayPane.appendChild(hostElement);
472
- this._backdropSubscription = this._templateOverlayRef.backdropClick().subscribe(() => {
473
- this.onBackdropClick();
474
- });
475
- }
476
- _closeWithAnimation() {
477
- if (this.isLeaving()) {
478
- return;
479
- }
480
- this._overlayContainerService.notifyClosing();
481
- this.isLeaving.set(true);
482
- this.zVisible.set(false);
483
- const hostElement = this._host.nativeElement;
484
- const { backdropElement } = this._templateOverlayRef ?? {};
485
- if (backdropElement) {
486
- backdropElement.classList.add('z-backdrop-leaving');
487
- }
488
- hostElement.classList.add('drawer-leave');
489
- this._clearCloseTimeout();
490
- this._closeTimeout = setTimeout(() => {
491
- if (this._destroyRef.destroyed) {
492
- return;
493
- }
494
- this.isLeaving.set(false);
495
- this._disposeTemplateOverlay();
496
- this.zAfterClose.emit();
497
- }, Z_DRAWER_ANIMATION_DURATION);
498
- }
499
- _clearCloseTimeout() {
500
- if (!this._closeTimeout) {
501
- return;
502
- }
503
- clearTimeout(this._closeTimeout);
504
- this._closeTimeout = null;
505
- }
506
- _disposeTemplateOverlay() {
507
- const hostElement = this._host.nativeElement;
508
- if (this._originalParent && this._originalNextSibling) {
509
- this._originalParent.insertBefore(hostElement, this._originalNextSibling);
510
- }
511
- if (this._originalParent && !this._originalNextSibling) {
512
- this._originalParent.appendChild(hostElement);
513
- }
514
- hostElement.classList.remove('drawer-leave');
515
- if (this._templateOverlayRef) {
516
- this._templateOverlayRef.dispose();
517
- this._templateOverlayRef = null;
518
- }
519
- this._originalParent = null;
520
- this._originalNextSibling = null;
521
- if (this._backdropSubscription) {
522
- this._backdropSubscription.unsubscribe();
523
- this._backdropSubscription = null;
524
- }
525
- }
526
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
527
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.9", type: ZDrawerComponent, isStandalone: true, selector: "z-drawer", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zBodyClass: { classPropertyName: "zBodyClass", publicName: "zBodyClass", isSignal: true, isRequired: false, transformFunction: null }, zVisible: { classPropertyName: "zVisible", publicName: "zVisible", isSignal: true, isRequired: false, transformFunction: null }, zTitle: { classPropertyName: "zTitle", publicName: "zTitle", isSignal: true, isRequired: false, transformFunction: null }, zDescription: { classPropertyName: "zDescription", publicName: "zDescription", isSignal: true, isRequired: false, transformFunction: null }, zWidth: { classPropertyName: "zWidth", publicName: "zWidth", isSignal: true, isRequired: false, transformFunction: null }, zHeight: { classPropertyName: "zHeight", publicName: "zHeight", isSignal: true, isRequired: false, transformFunction: null }, zPlacement: { classPropertyName: "zPlacement", publicName: "zPlacement", isSignal: true, isRequired: false, transformFunction: null }, zClosable: { classPropertyName: "zClosable", publicName: "zClosable", isSignal: true, isRequired: false, transformFunction: null }, zMaskClosable: { classPropertyName: "zMaskClosable", publicName: "zMaskClosable", isSignal: true, isRequired: false, transformFunction: null }, zDisableShadow: { classPropertyName: "zDisableShadow", publicName: "zDisableShadow", isSignal: true, isRequired: false, transformFunction: null }, zHeaderBorder: { classPropertyName: "zHeaderBorder", publicName: "zHeaderBorder", isSignal: true, isRequired: false, transformFunction: null }, zFooterBorder: { classPropertyName: "zFooterBorder", publicName: "zFooterBorder", isSignal: true, isRequired: false, transformFunction: null }, zHideFooter: { classPropertyName: "zHideFooter", publicName: "zHideFooter", isSignal: true, isRequired: false, transformFunction: null }, zHideHeader: { classPropertyName: "zHideHeader", publicName: "zHideHeader", isSignal: true, isRequired: false, transformFunction: null }, zOkText: { classPropertyName: "zOkText", publicName: "zOkText", isSignal: true, isRequired: false, transformFunction: null }, zCancelText: { classPropertyName: "zCancelText", publicName: "zCancelText", isSignal: true, isRequired: false, transformFunction: null }, zOkDestructive: { classPropertyName: "zOkDestructive", publicName: "zOkDestructive", isSignal: true, isRequired: false, transformFunction: null }, zOkDisabled: { classPropertyName: "zOkDisabled", publicName: "zOkDisabled", isSignal: true, isRequired: false, transformFunction: null }, zLoading: { classPropertyName: "zLoading", publicName: "zLoading", isSignal: true, isRequired: false, transformFunction: null }, zOverlay: { classPropertyName: "zOverlay", publicName: "zOverlay", isSignal: true, isRequired: false, transformFunction: null }, zShadow: { classPropertyName: "zShadow", publicName: "zShadow", isSignal: true, isRequired: false, transformFunction: null }, zShape: { classPropertyName: "zShape", publicName: "zShape", isSignal: true, isRequired: false, transformFunction: null }, zContentLoading: { classPropertyName: "zContentLoading", publicName: "zContentLoading", isSignal: true, isRequired: false, transformFunction: null }, zSkeletonRows: { classPropertyName: "zSkeletonRows", publicName: "zSkeletonRows", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zOnOk: "zOnOk", zOnCancel: "zOnCancel", zAfterClose: "zAfterClose", zScrollbar: "zScrollbar", zVisible: "zVisibleChange" }, host: { properties: { "class": "hostClasses()", "style.width": "effectiveWidth()", "style.height": "effectiveHeight()", "attr.data-placement": "effectivePlacement()" } }, providers: [TranslatePipe], queries: [{ propertyName: "customHeader", first: true, predicate: ZDrawerHeaderDirective, descendants: true, isSignal: true }, { propertyName: "customContent", first: true, predicate: ZDrawerContentDirective, descendants: true, isSignal: true }, { propertyName: "customFooter", first: true, predicate: ZDrawerFooterDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, isSignal: true }, { propertyName: "dummyTemplateRef", first: true, predicate: ["dummyTemplate"], descendants: true, isSignal: true }, { propertyName: "mainContentRef", first: true, predicate: ["mainContent"], descendants: true, isSignal: true }], exportAs: ["zDrawer"], usesInheritance: true, ngImport: i0, template: "<!-- Dummy template to trigger CDK backdrop creation -->\n<ng-template #dummyTemplate />\n\n<!-- Template mode content (rendered in host element, which is moved to overlay) -->\n@if (isTemplateMode() && shouldRenderContent()) {\n @defer (when !effectiveContentLoading()) {\n @if (customHeader(); as headerDir) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex items-start justify-between px-4\">\n <ng-container *ngTemplateOutlet=\"headerDir.templateRef\" />\n </div>\n </header>\n } @else if (!effectiveHideHeader()) {\n @if (effectiveTitle()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div [class]=\"headerContentClasses()\">\n <div class=\"min-w-0 flex-1 overflow-hidden pr-2\">\n @if (effectiveTitle(); as title) {\n @switch (title | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(title)\" />\n }\n @case ('html') {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"title\"\n [innerHTML]=\"$any(title) | zSafeHtml\"></h4>\n }\n @default {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"$any(title) | translate\">\n {{ $any(title) | translate }}\n </h4>\n }\n }\n }\n @if (effectiveDescription(); as description) {\n @switch (description | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(description)\" />\n }\n @case ('html') {\n <p\n data-testid=\"z-drawer-description\"\n class=\"text-muted-foreground m-0 mt-1 text-sm\"\n [innerHTML]=\"$any(description) | zSafeHtml\"></p>\n }\n @default {\n <p data-testid=\"z-drawer-description\" class=\"text-muted-foreground m-0 mt-1 text-sm\">\n {{ $any(description) | translate }}\n </p>\n }\n }\n }\n </div>\n @if (effectiveClosable()) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n }\n </div>\n </header>\n } @else if (effectiveClosable()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex justify-end px-4\">\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n class=\"-mt-1 -mr-2 shrink-0\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n </div>\n </header>\n }\n }\n\n <ng-scrollbar\n class=\"z-drawer-scrollbar flex-1\"\n #mainContent\n track=\"vertical\"\n cdkScrollable\n (scroll)=\"onContentScroll($event)\">\n <main [class]=\"bodyClasses()\">\n @if (customContent(); as contentDir) {\n <ng-container *ngTemplateOutlet=\"contentDir.templateRef\" />\n } @else {\n <ng-content />\n }\n </main>\n </ng-scrollbar>\n\n @if (customFooter(); as footerDir) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n <ng-container *ngTemplateOutlet=\"footerDir.templateRef\" />\n </div>\n </footer>\n } @else if (!effectiveHideFooter()) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n @if (effectiveCancelText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-cancel-button\"\n z-button\n zType=\"outline\"\n (click)=\"onCloseClick()\">\n {{ effectiveCancelText() ?? 'i18n_z_ui_modal_cancel' | translate }}\n </button>\n }\n\n @if (effectiveOkText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-ok-button\"\n z-button\n [zType]=\"effectiveOkDestructive() ? 'destructive' : 'default'\"\n [disabled]=\"effectiveOkDisabled() || effectiveLoading()\"\n [zLoading]=\"effectiveLoading()\"\n (click)=\"onOkClick()\">\n {{ effectiveOkText() ?? 'i18n_z_ui_common_ok' | translate }}\n </button>\n }\n </div>\n </footer>\n }\n } @placeholder {\n <div class=\"flex flex-1 flex-col gap-4 p-4\">\n <z-skeleton class=\"h-full\" [zRows]=\"effectiveSkeletonRows()\" />\n </div>\n }\n}\n\n<!-- Service mode content -->\n@if (isServiceMode()) {\n @defer (when !effectiveContentLoading()) {\n @if (!effectiveHideHeader()) {\n @if (effectiveTitle()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div [class]=\"headerContentClasses()\">\n <div class=\"min-w-0 flex-1 overflow-hidden pr-2\">\n @if (effectiveTitle(); as title) {\n @switch (title | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(title)\" />\n }\n @case ('html') {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"title\"\n [innerHTML]=\"$any(title) | zSafeHtml\"></h4>\n }\n @default {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"$any(title) | translate\">\n {{ $any(title) | translate }}\n </h4>\n }\n }\n }\n @if (effectiveDescription(); as description) {\n @switch (description | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(description)\" />\n }\n @case ('html') {\n <p\n data-testid=\"z-drawer-description\"\n class=\"text-muted-foreground m-0 mt-1 text-sm\"\n [innerHTML]=\"$any(description) | zSafeHtml\"></p>\n }\n @default {\n <p data-testid=\"z-drawer-description\" class=\"text-muted-foreground m-0 mt-1 text-sm\">\n {{ $any(description) | translate }}\n </p>\n }\n }\n }\n </div>\n @if (effectiveClosable()) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n }\n </div>\n </header>\n } @else if (effectiveClosable()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex justify-end px-4\">\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n </div>\n </header>\n }\n }\n\n <ng-scrollbar\n class=\"z-drawer-scrollbar flex-1\"\n #mainContent\n track=\"vertical\"\n cdkScrollable\n (scroll)=\"onContentScroll($event)\">\n <main [class]=\"bodyClasses()\">\n <ng-template cdkPortalOutlet />\n\n @if (isStringContent()) {\n <div data-testid=\"z-drawer-content\" [innerHTML]=\"$any(config.zContent) | zSafeHtml\"></div>\n }\n </main>\n </ng-scrollbar>\n\n @if (!effectiveHideFooter()) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n @if (effectiveCancelText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-cancel-button\"\n z-button\n zType=\"outline\"\n (click)=\"onCloseClick()\">\n @if (config.zCancelIcon) {\n <z-icon [zType]=\"config.zCancelIcon\" />\n }\n {{ effectiveCancelText() ?? 'i18n_z_ui_modal_cancel' | translate }}\n </button>\n }\n\n @if (effectiveOkText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-ok-button\"\n z-button\n [zType]=\"effectiveOkDestructive() ? 'destructive' : 'default'\"\n [disabled]=\"effectiveOkDisabled() || effectiveLoading()\"\n [zLoading]=\"effectiveLoading()\"\n (click)=\"onOkClick()\">\n @if (config.zOkIcon && !effectiveLoading()) {\n <z-icon [zType]=\"config.zOkIcon\" />\n }\n {{ effectiveOkText() ?? 'i18n_z_ui_common_ok' | translate }}\n </button>\n }\n </div>\n </footer>\n }\n } @placeholder {\n <div class=\"flex flex-1 flex-col gap-4 p-4\">\n <z-skeleton class=\"h-full\" [zRows]=\"effectiveSkeletonRows()\" />\n </div>\n }\n}\n", styles: [":host.z-drawer-service-mode[data-placement=left],:host.z-drawer-template-mode[data-placement=left]{--z-enter-translate-x: -100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=left].drawer-leave,:host.z-drawer-template-mode[data-placement=left].drawer-leave{--z-exit-translate-x: -100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=right],:host.z-drawer-template-mode[data-placement=right]{--z-enter-translate-x: 100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=right].drawer-leave,:host.z-drawer-template-mode[data-placement=right].drawer-leave{--z-exit-translate-x: 100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=top],:host.z-drawer-template-mode[data-placement=top]{--z-enter-translate-y: -100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=top].drawer-leave,:host.z-drawer-template-mode[data-placement=top].drawer-leave{--z-exit-translate-y: -100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=bottom],:host.z-drawer-template-mode[data-placement=bottom]{--z-enter-translate-y: 100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=bottom].drawer-leave,:host.z-drawer-template-mode[data-placement=bottom].drawer-leave{--z-exit-translate-y: 100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-template-host{display:contents}::ng-deep .z-drawer-backdrop-dark{background-color:#0009}::ng-deep .z-drawer-backdrop-blur{background-color:#0000000d;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.z-drawer-header-shadow{box-shadow:0 2px 8px -2px #0000001a;z-index:50}.z-drawer-footer-shadow{box-shadow:0 -2px 8px -2px #0000001a;z-index:50}.z-drawer-header-border{border-bottom:1px solid var(--border)}.z-drawer-footer-border{border-top:1px solid var(--border)}:host header{padding-top:1rem;padding-bottom:1rem}:host footer{padding-top:1rem;padding-bottom:1rem}:host main{overscroll-behavior:contain}:host header,:host footer{transition:box-shadow .2s ease-out}.z-drawer-scrollbar{--scrollbar-padding: .125rem}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "component", type: ZSkeletonComponent, selector: "z-skeleton", inputs: ["class", "zType", "zSize", "zWidth", "zHeight", "zRows", "zGap", "zAnimated", "zRadius"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, deferBlockDependencies: [() => [NgTemplateOutlet, import('@shival99/z-ui/components/z-button').then(m => m.ZButtonComponent), import('@shival99/z-ui/components/z-icon').then(m => m.ZIconComponent), import('@shival99/z-ui/components/z-tooltip').then(m => m.ZTooltipDirective), import('ngx-scrollbar').then(m => m.NgScrollbar), import('@angular/cdk/scrolling').then(m => m.CdkScrollable), import('@shival99/z-ui/pipes').then(m => m.ZContentTypePipe), import('@shival99/z-ui/pipes').then(m => m.ZSafeHtmlPipe), TranslatePipe], () => [i1.CdkPortalOutlet, NgTemplateOutlet, import('@shival99/z-ui/components/z-button').then(m => m.ZButtonComponent), import('@shival99/z-ui/components/z-icon').then(m => m.ZIconComponent), import('@shival99/z-ui/components/z-tooltip').then(m => m.ZTooltipDirective), import('ngx-scrollbar').then(m => m.NgScrollbar), import('@angular/cdk/scrolling').then(m => m.CdkScrollable), import('@shival99/z-ui/pipes').then(m => m.ZContentTypePipe), import('@shival99/z-ui/pipes').then(m => m.ZSafeHtmlPipe), TranslatePipe]] });
528
- }
529
- i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerComponent, resolveDeferredDeps: () => [import('@shival99/z-ui/components/z-button').then(m => m.ZButtonComponent), import('@shival99/z-ui/components/z-icon').then(m => m.ZIconComponent), import('@shival99/z-ui/components/z-tooltip').then(m => m.ZTooltipDirective), import('ngx-scrollbar').then(m => m.NgScrollbar), import('@angular/cdk/scrolling').then(m => m.CdkScrollable), import('@shival99/z-ui/pipes').then(m => m.ZContentTypePipe), import('@shival99/z-ui/pipes').then(m => m.ZSafeHtmlPipe)], resolveMetadata: (ZButtonComponent, ZIconComponent, ZTooltipDirective, NgScrollbar, CdkScrollable, ZContentTypePipe, ZSafeHtmlPipe) => ({ decorators: [{
530
- type: Component,
531
- args: [{ selector: 'z-drawer', imports: [
532
- PortalModule,
533
- NgTemplateOutlet,
534
- ZButtonComponent,
535
- ZIconComponent,
536
- ZContentTypePipe,
537
- ZTooltipDirective,
538
- ZSkeletonComponent,
539
- NgScrollbar,
540
- ZSafeHtmlPipe,
541
- TranslatePipe,
542
- CdkScrollable,
543
- ], standalone: true, providers: [TranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: {
544
- '[class]': 'hostClasses()',
545
- '[style.width]': 'effectiveWidth()',
546
- '[style.height]': 'effectiveHeight()',
547
- '[attr.data-placement]': 'effectivePlacement()',
548
- }, exportAs: 'zDrawer', template: "<!-- Dummy template to trigger CDK backdrop creation -->\n<ng-template #dummyTemplate />\n\n<!-- Template mode content (rendered in host element, which is moved to overlay) -->\n@if (isTemplateMode() && shouldRenderContent()) {\n @defer (when !effectiveContentLoading()) {\n @if (customHeader(); as headerDir) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex items-start justify-between px-4\">\n <ng-container *ngTemplateOutlet=\"headerDir.templateRef\" />\n </div>\n </header>\n } @else if (!effectiveHideHeader()) {\n @if (effectiveTitle()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div [class]=\"headerContentClasses()\">\n <div class=\"min-w-0 flex-1 overflow-hidden pr-2\">\n @if (effectiveTitle(); as title) {\n @switch (title | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(title)\" />\n }\n @case ('html') {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"title\"\n [innerHTML]=\"$any(title) | zSafeHtml\"></h4>\n }\n @default {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"$any(title) | translate\">\n {{ $any(title) | translate }}\n </h4>\n }\n }\n }\n @if (effectiveDescription(); as description) {\n @switch (description | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(description)\" />\n }\n @case ('html') {\n <p\n data-testid=\"z-drawer-description\"\n class=\"text-muted-foreground m-0 mt-1 text-sm\"\n [innerHTML]=\"$any(description) | zSafeHtml\"></p>\n }\n @default {\n <p data-testid=\"z-drawer-description\" class=\"text-muted-foreground m-0 mt-1 text-sm\">\n {{ $any(description) | translate }}\n </p>\n }\n }\n }\n </div>\n @if (effectiveClosable()) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n }\n </div>\n </header>\n } @else if (effectiveClosable()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex justify-end px-4\">\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n class=\"-mt-1 -mr-2 shrink-0\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n </div>\n </header>\n }\n }\n\n <ng-scrollbar\n class=\"z-drawer-scrollbar flex-1\"\n #mainContent\n track=\"vertical\"\n cdkScrollable\n (scroll)=\"onContentScroll($event)\">\n <main [class]=\"bodyClasses()\">\n @if (customContent(); as contentDir) {\n <ng-container *ngTemplateOutlet=\"contentDir.templateRef\" />\n } @else {\n <ng-content />\n }\n </main>\n </ng-scrollbar>\n\n @if (customFooter(); as footerDir) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n <ng-container *ngTemplateOutlet=\"footerDir.templateRef\" />\n </div>\n </footer>\n } @else if (!effectiveHideFooter()) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n @if (effectiveCancelText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-cancel-button\"\n z-button\n zType=\"outline\"\n (click)=\"onCloseClick()\">\n {{ effectiveCancelText() ?? 'i18n_z_ui_modal_cancel' | translate }}\n </button>\n }\n\n @if (effectiveOkText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-ok-button\"\n z-button\n [zType]=\"effectiveOkDestructive() ? 'destructive' : 'default'\"\n [disabled]=\"effectiveOkDisabled() || effectiveLoading()\"\n [zLoading]=\"effectiveLoading()\"\n (click)=\"onOkClick()\">\n {{ effectiveOkText() ?? 'i18n_z_ui_common_ok' | translate }}\n </button>\n }\n </div>\n </footer>\n }\n } @placeholder {\n <div class=\"flex flex-1 flex-col gap-4 p-4\">\n <z-skeleton class=\"h-full\" [zRows]=\"effectiveSkeletonRows()\" />\n </div>\n }\n}\n\n<!-- Service mode content -->\n@if (isServiceMode()) {\n @defer (when !effectiveContentLoading()) {\n @if (!effectiveHideHeader()) {\n @if (effectiveTitle()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div [class]=\"headerContentClasses()\">\n <div class=\"min-w-0 flex-1 overflow-hidden pr-2\">\n @if (effectiveTitle(); as title) {\n @switch (title | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(title)\" />\n }\n @case ('html') {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"title\"\n [innerHTML]=\"$any(title) | zSafeHtml\"></h4>\n }\n @default {\n <h4\n data-testid=\"z-drawer-title\"\n class=\"m-0 truncate text-base leading-snug font-semibold\"\n z-tooltip\n [zContent]=\"$any(title) | translate\">\n {{ $any(title) | translate }}\n </h4>\n }\n }\n }\n @if (effectiveDescription(); as description) {\n @switch (description | zContentType) {\n @case ('template') {\n <ng-container *ngTemplateOutlet=\"$any(description)\" />\n }\n @case ('html') {\n <p\n data-testid=\"z-drawer-description\"\n class=\"text-muted-foreground m-0 mt-1 text-sm\"\n [innerHTML]=\"$any(description) | zSafeHtml\"></p>\n }\n @default {\n <p data-testid=\"z-drawer-description\" class=\"text-muted-foreground m-0 mt-1 text-sm\">\n {{ $any(description) | translate }}\n </p>\n }\n }\n }\n </div>\n @if (effectiveClosable()) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n }\n </div>\n </header>\n } @else if (effectiveClosable()) {\n <header\n [class.z-drawer-header-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-header-border]=\"effectiveHeaderBorder()\">\n <div class=\"flex justify-end px-4\">\n <button\n type=\"button\"\n data-testid=\"z-drawer-close-header-button\"\n z-button\n zType=\"subtle\"\n zSize=\"xs\"\n [zWave]=\"false\"\n (click)=\"onCloseClick()\">\n <z-icon zType=\"lucideX\" />\n </button>\n </div>\n </header>\n }\n }\n\n <ng-scrollbar\n class=\"z-drawer-scrollbar flex-1\"\n #mainContent\n track=\"vertical\"\n cdkScrollable\n (scroll)=\"onContentScroll($event)\">\n <main [class]=\"bodyClasses()\">\n <ng-template cdkPortalOutlet />\n\n @if (isStringContent()) {\n <div data-testid=\"z-drawer-content\" [innerHTML]=\"$any(config.zContent) | zSafeHtml\"></div>\n }\n </main>\n </ng-scrollbar>\n\n @if (!effectiveHideFooter()) {\n <footer\n [class.z-drawer-footer-shadow]=\"shouldShowShadow()\"\n [class.z-drawer-footer-border]=\"effectiveFooterBorder()\">\n <div class=\"flex flex-row justify-end gap-2 px-4\">\n @if (effectiveCancelText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-cancel-button\"\n z-button\n zType=\"outline\"\n (click)=\"onCloseClick()\">\n @if (config.zCancelIcon) {\n <z-icon [zType]=\"config.zCancelIcon\" />\n }\n {{ effectiveCancelText() ?? 'i18n_z_ui_modal_cancel' | translate }}\n </button>\n }\n\n @if (effectiveOkText() !== null) {\n <button\n type=\"button\"\n data-testid=\"z-drawer-ok-button\"\n z-button\n [zType]=\"effectiveOkDestructive() ? 'destructive' : 'default'\"\n [disabled]=\"effectiveOkDisabled() || effectiveLoading()\"\n [zLoading]=\"effectiveLoading()\"\n (click)=\"onOkClick()\">\n @if (config.zOkIcon && !effectiveLoading()) {\n <z-icon [zType]=\"config.zOkIcon\" />\n }\n {{ effectiveOkText() ?? 'i18n_z_ui_common_ok' | translate }}\n </button>\n }\n </div>\n </footer>\n }\n } @placeholder {\n <div class=\"flex flex-1 flex-col gap-4 p-4\">\n <z-skeleton class=\"h-full\" [zRows]=\"effectiveSkeletonRows()\" />\n </div>\n }\n}\n", styles: [":host.z-drawer-service-mode[data-placement=left],:host.z-drawer-template-mode[data-placement=left]{--z-enter-translate-x: -100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=left].drawer-leave,:host.z-drawer-template-mode[data-placement=left].drawer-leave{--z-exit-translate-x: -100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=right],:host.z-drawer-template-mode[data-placement=right]{--z-enter-translate-x: 100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=right].drawer-leave,:host.z-drawer-template-mode[data-placement=right].drawer-leave{--z-exit-translate-x: 100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=top],:host.z-drawer-template-mode[data-placement=top]{--z-enter-translate-y: -100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=top].drawer-leave,:host.z-drawer-template-mode[data-placement=top].drawer-leave{--z-exit-translate-y: -100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=bottom],:host.z-drawer-template-mode[data-placement=bottom]{--z-enter-translate-y: 100%;animation:z-enter .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-service-mode[data-placement=bottom].drawer-leave,:host.z-drawer-template-mode[data-placement=bottom].drawer-leave{--z-exit-translate-y: 100%;animation:z-exit .25s cubic-bezier(.16,1,.3,1) forwards}:host.z-drawer-template-host{display:contents}::ng-deep .z-drawer-backdrop-dark{background-color:#0009}::ng-deep .z-drawer-backdrop-blur{background-color:#0000000d;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.z-drawer-header-shadow{box-shadow:0 2px 8px -2px #0000001a;z-index:50}.z-drawer-footer-shadow{box-shadow:0 -2px 8px -2px #0000001a;z-index:50}.z-drawer-header-border{border-bottom:1px solid var(--border)}.z-drawer-footer-border{border-top:1px solid var(--border)}:host header{padding-top:1rem;padding-bottom:1rem}:host footer{padding-top:1rem;padding-bottom:1rem}:host main{overscroll-behavior:contain}:host header,:host footer{transition:box-shadow .2s ease-out}.z-drawer-scrollbar{--scrollbar-padding: .125rem}\n"] }]
549
- }], ctorParameters: () => [], propDecorators: { zOnOk: [{ type: i0.Output, args: ["zOnOk"] }], zOnCancel: [{ type: i0.Output, args: ["zOnCancel"] }], zAfterClose: [{ type: i0.Output, args: ["zAfterClose"] }], zScrollbar: [{ type: i0.Output, args: ["zScrollbar"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zBodyClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zBodyClass", required: false }] }], zVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "zVisible", required: false }] }, { type: i0.Output, args: ["zVisibleChange"] }], zTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTitle", required: false }] }], zDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDescription", required: false }] }], zWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "zWidth", required: false }] }], zHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHeight", required: false }] }], zPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPlacement", required: false }] }], zClosable: [{ type: i0.Input, args: [{ isSignal: true, alias: "zClosable", required: false }] }], zMaskClosable: [{ type: i0.Input, args: [{ isSignal: true, alias: "zMaskClosable", required: false }] }], zDisableShadow: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisableShadow", required: false }] }], zHeaderBorder: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHeaderBorder", required: false }] }], zFooterBorder: [{ type: i0.Input, args: [{ isSignal: true, alias: "zFooterBorder", required: false }] }], zHideFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHideFooter", required: false }] }], zHideHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHideHeader", required: false }] }], zOkText: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOkText", required: false }] }], zCancelText: [{ type: i0.Input, args: [{ isSignal: true, alias: "zCancelText", required: false }] }], zOkDestructive: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOkDestructive", required: false }] }], zOkDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOkDisabled", required: false }] }], zLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLoading", required: false }] }], zOverlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOverlay", required: false }] }], zShadow: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShadow", required: false }] }], zShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShape", required: false }] }], zContentLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "zContentLoading", required: false }] }], zSkeletonRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSkeletonRows", required: false }] }], customHeader: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZDrawerHeaderDirective), { isSignal: true }] }], customContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZDrawerContentDirective), { isSignal: true }] }], customFooter: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZDrawerFooterDirective), { isSignal: true }] }], portalOutlet: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkPortalOutlet), { isSignal: true }] }], dummyTemplateRef: [{ type: i0.ViewChild, args: ['dummyTemplate', { isSignal: true }] }], mainContentRef: [{ type: i0.ViewChild, args: ['mainContent', { isSignal: true }] }] } }) });
550
-
551
- let ZDrawerRef = class ZDrawerRef {
552
- _overlayRef;
553
- _config;
554
- _containerInstance;
555
- _platformId;
556
- _destroy$ = new Subject();
557
- _isClosing = false;
558
- _result;
559
- componentInstance = null;
560
- loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
561
- zAfterClose = new EventEmitter();
562
- constructor(_overlayRef, _config, _containerInstance, _platformId) {
563
- this._overlayRef = _overlayRef;
564
- this._config = _config;
565
- this._containerInstance = _containerInstance;
566
- this._platformId = _platformId;
567
- this._containerInstance.zOnCancel.subscribe(() => this._trigger(ZDrawerTriggerAction.CANCEL));
568
- this._containerInstance.zOnOk.subscribe(() => this._trigger(ZDrawerTriggerAction.OK));
569
- if ((this._config.zMaskClosable ?? true) && isPlatformBrowser(this._platformId)) {
570
- this._overlayRef
571
- .outsidePointerEvents()
572
- .pipe(takeUntil(this._destroy$))
573
- .subscribe(() => {
574
- if (!this.loading()) {
575
- this._trigger(ZDrawerTriggerAction.CANCEL);
576
- }
577
- });
578
- }
579
- if (isPlatformBrowser(this._platformId)) {
580
- fromEvent(document, 'keydown')
581
- .pipe(filter(event => event.key === 'Escape'), takeUntil(this._destroy$))
582
- .subscribe(() => {
583
- if (!this.loading()) {
584
- this._trigger(ZDrawerTriggerAction.CANCEL);
585
- }
586
- });
587
- }
588
- }
589
- setLoading(value) {
590
- this.loading.set(value);
591
- }
592
- close(result) {
593
- if (this._isClosing) {
594
- return;
595
- }
596
- this._isClosing = true;
597
- this._result = result;
598
- if (isPlatformBrowser(this._platformId)) {
599
- const hostElement = this._containerInstance.getNativeElement();
600
- hostElement.classList.add('drawer-leave');
601
- const { backdropElement } = this._overlayRef;
602
- if (backdropElement) {
603
- backdropElement.classList.add('z-backdrop-leaving');
604
- }
605
- }
606
- setTimeout(() => {
607
- if (!this._containerInstance.isDestroyed()) {
608
- this._containerInstance.zAfterClose.emit();
609
- }
610
- this.zAfterClose.emit(this._result);
611
- if (this._overlayRef) {
612
- if (this._overlayRef.hasAttached()) {
613
- this._overlayRef.detachBackdrop();
614
- }
615
- this._overlayRef.dispose();
616
- }
617
- if (!this._destroy$.closed) {
618
- this._destroy$.next();
619
- this._destroy$.complete();
620
- }
621
- }, Z_DRAWER_ANIMATION_DURATION);
622
- }
623
- _trigger(action) {
624
- if (this.loading()) {
625
- return;
626
- }
627
- const trigger = {
628
- ok: this._config.zOnOk,
629
- cancel: this._config.zOnCancel,
630
- }[action];
631
- if (trigger instanceof EventEmitter) {
632
- trigger.emit(this._getContentComponent());
633
- return;
634
- }
635
- if (typeof trigger === 'function') {
636
- const result = trigger(this._getContentComponent(), this);
637
- this._closeWithResult(result);
638
- return;
639
- }
640
- this.close();
641
- }
642
- _getContentComponent() {
643
- return this.componentInstance;
644
- }
645
- _closeWithResult(result) {
646
- if (result !== false) {
647
- this.close(result);
648
- }
649
- }
650
- };
651
- ZDrawerRef = __decorate([
652
- __param(3, Inject(PLATFORM_ID)),
653
- __metadata("design:paramtypes", [OverlayRef,
654
- ZDrawerOptions,
655
- ZDrawerComponent, Object])
656
- ], ZDrawerRef);
657
-
658
- class ZDrawerService {
659
- _overlay = inject(Overlay);
660
- _injector = inject(Injector);
661
- _platformId = inject(PLATFORM_ID);
662
- _zIndexService = inject(ZOverlayZIndexService);
663
- create(config) {
664
- return this._open(config.zContent, config);
665
- }
666
- _open(componentOrTemplateRef, config) {
667
- const overlayRef = this._createOverlay(config);
668
- if (!overlayRef) {
669
- return new ZDrawerRef(undefined, config, undefined, this._platformId);
670
- }
671
- const drawerContainer = this._attachDrawerContainer(overlayRef, config);
672
- const drawerRef = this._attachDrawerContent(componentOrTemplateRef, drawerContainer, overlayRef, config);
673
- return drawerRef;
674
- }
675
- _createOverlay(config) {
676
- if (!isPlatformBrowser(this._platformId)) {
677
- return undefined;
678
- }
679
- const overlayType = config.zOverlay ?? getOverlayType();
680
- const backdropClass = overlayType === 'blur' ? 'z-drawer-backdrop-blur' : 'z-drawer-backdrop-dark';
681
- const overlayConfig = new OverlayConfig({
682
- hasBackdrop: true,
683
- backdropClass,
684
- positionStrategy: this._overlay.position().global(),
685
- });
686
- const overlayRef = this._overlay.create(overlayConfig);
687
- this._zIndexService.applyToOverlay(overlayRef);
688
- return overlayRef;
689
- }
690
- _attachDrawerContainer(overlayRef, config) {
691
- const injector = Injector.create({
692
- parent: this._injector,
693
- providers: [
694
- { provide: OverlayRef, useValue: overlayRef },
695
- { provide: ZDrawerOptions, useValue: config },
696
- ],
697
- });
698
- const containerPortal = new ComponentPortal(ZDrawerComponent, config.zViewContainerRef, injector);
699
- const containerRef = overlayRef.attach(containerPortal);
700
- return containerRef.instance;
701
- }
702
- _attachDrawerContent(componentOrTemplateRef, drawerContainer, overlayRef, config) {
703
- const drawerRef = new ZDrawerRef(overlayRef, config, drawerContainer, this._platformId);
704
- drawerContainer.drawerRef = drawerRef;
705
- if (componentOrTemplateRef instanceof TemplateRef) {
706
- drawerContainer.attachTemplatePortal(new TemplatePortal(componentOrTemplateRef, null, { drawerRef }));
707
- return drawerRef;
708
- }
709
- if (typeof componentOrTemplateRef !== 'string') {
710
- const injector = this._createInjector(drawerRef, config);
711
- const contentRef = drawerContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, config.zViewContainerRef, injector));
712
- if (contentRef) {
713
- drawerRef.componentInstance = contentRef.instance;
714
- }
715
- }
716
- return drawerRef;
717
- }
718
- _createInjector(drawerRef, config) {
719
- return Injector.create({
720
- parent: this._injector,
721
- providers: [
722
- { provide: ZDrawerRef, useValue: drawerRef },
723
- { provide: Z_DRAWER_DATA, useValue: config.zData },
724
- ],
725
- });
726
- }
727
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
728
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerService, providedIn: 'root' });
729
- }
730
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZDrawerService, decorators: [{
731
- type: Injectable,
732
- args: [{
733
- providedIn: 'root',
734
- }]
735
- }] });
736
-
737
- /**
738
- * Generated bundle index. Do not edit.
739
- */
740
-
741
- export { ZDrawerComponent, ZDrawerContentDirective, ZDrawerFooterDirective, ZDrawerHeaderDirective, ZDrawerRef, ZDrawerService, Z_DRAWER_DATA, zDrawerVariants };
742
- //# sourceMappingURL=shival99-z-ui-components-z-drawer.mjs.map