@sdcorejs/angular 20.1.2 → 20.1.4

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 (177) hide show
  1. package/README.md +127 -807
  2. package/components/audit-diff/index.d.ts +74 -0
  3. package/components/badge/index.d.ts +1 -1
  4. package/components/breadcrumb/index.d.ts +53 -0
  5. package/components/data-state/index.d.ts +44 -0
  6. package/components/document-builder/index.d.ts +5 -5
  7. package/components/form-generic/index.d.ts +89 -103
  8. package/components/import-excel/index.d.ts +4 -14
  9. package/components/index.d.ts +4 -0
  10. package/components/job-progress/index.d.ts +38 -0
  11. package/components/mini-editor/index.d.ts +9 -9
  12. package/components/modal/index.d.ts +7 -1
  13. package/components/preview/index.d.ts +181 -28
  14. package/components/side-drawer/index.d.ts +7 -1
  15. package/components/tab/index.d.ts +9 -2
  16. package/components/table/index.d.ts +8 -7
  17. package/components/tree/index.d.ts +24 -2
  18. package/components/upload-file/index.d.ts +5 -4
  19. package/directives/index.d.ts +10 -8
  20. package/fesm2022/sdcorejs-angular-components-anchor.mjs +14 -14
  21. package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
  22. package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +332 -0
  23. package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -0
  24. package/fesm2022/sdcorejs-angular-components-badge.mjs +1 -0
  25. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  26. package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +121 -0
  27. package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -0
  28. package/fesm2022/sdcorejs-angular-components-data-state.mjs +68 -0
  29. package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -0
  30. package/fesm2022/sdcorejs-angular-components-document-builder.mjs +18 -23
  31. package/fesm2022/sdcorejs-angular-components-document-builder.mjs.map +1 -1
  32. package/fesm2022/sdcorejs-angular-components-editor.mjs +6 -4
  33. package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
  34. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +633 -886
  35. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  36. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +26 -41
  37. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  38. package/fesm2022/sdcorejs-angular-components-job-progress.mjs +97 -0
  39. package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -0
  40. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +10 -20
  41. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
  42. package/fesm2022/sdcorejs-angular-components-modal.mjs +61 -4
  43. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  44. package/fesm2022/sdcorejs-angular-components-preview.mjs +1438 -218
  45. package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
  46. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +9 -17
  47. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  48. package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
  49. package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
  50. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +39 -2
  51. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  52. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +76 -52
  53. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  54. package/fesm2022/sdcorejs-angular-components-tab.mjs +48 -4
  55. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  56. package/fesm2022/sdcorejs-angular-components-table.mjs +123 -89
  57. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  58. package/fesm2022/sdcorejs-angular-components-tree.mjs +188 -18
  59. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  60. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +17 -23
  61. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  62. package/fesm2022/sdcorejs-angular-components.mjs +4 -0
  63. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  64. package/fesm2022/sdcorejs-angular-directives.mjs +29 -41
  65. package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
  66. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +9 -8
  67. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  68. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +20 -83
  69. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
  70. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +8 -4
  71. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  72. package/fesm2022/sdcorejs-angular-forms-chip.mjs +8 -4
  73. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  74. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +18 -14
  75. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  76. package/fesm2022/sdcorejs-angular-forms-date.mjs +48 -70
  77. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  78. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +62 -528
  79. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  80. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +384 -0
  81. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -0
  82. package/fesm2022/sdcorejs-angular-forms-input-color.mjs +5 -3
  83. package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
  84. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +16 -11
  85. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  86. package/fesm2022/sdcorejs-angular-forms-input.mjs +297 -59
  87. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  88. package/fesm2022/sdcorejs-angular-forms-models.mjs +155 -2
  89. package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
  90. package/fesm2022/sdcorejs-angular-forms-radio.mjs +44 -78
  91. package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
  92. package/fesm2022/sdcorejs-angular-forms-select.mjs +8 -21
  93. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  94. package/fesm2022/sdcorejs-angular-forms-switch.mjs +19 -76
  95. package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
  96. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +8 -6
  97. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  98. package/fesm2022/sdcorejs-angular-forms-time-range.mjs +280 -0
  99. package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -0
  100. package/fesm2022/sdcorejs-angular-forms-time.mjs +310 -0
  101. package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -0
  102. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +210 -0
  103. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -0
  104. package/fesm2022/sdcorejs-angular-forms.mjs +73 -4
  105. package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
  106. package/fesm2022/sdcorejs-angular-i18n.mjs +355 -10
  107. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  108. package/fesm2022/sdcorejs-angular-interceptors.mjs +12 -17
  109. package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
  110. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  111. package/fesm2022/sdcorejs-angular-modules-layout.mjs +861 -80
  112. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  113. package/fesm2022/sdcorejs-angular-modules.mjs +0 -1
  114. package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
  115. package/fesm2022/sdcorejs-angular-pipes.mjs +5 -7
  116. package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
  117. package/fesm2022/sdcorejs-angular-services-api.mjs +407 -137
  118. package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
  119. package/fesm2022/sdcorejs-angular-services-cache.mjs +515 -105
  120. package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
  121. package/fesm2022/sdcorejs-angular-services-confirm.mjs +5 -7
  122. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  123. package/fesm2022/sdcorejs-angular-services-docx.mjs +7 -10
  124. package/fesm2022/sdcorejs-angular-services-docx.mjs.map +1 -1
  125. package/fesm2022/sdcorejs-angular-services-loading.mjs +340 -66
  126. package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
  127. package/fesm2022/sdcorejs-angular-services-notify.mjs +7 -10
  128. package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
  129. package/fesm2022/sdcorejs-angular-services-persistence.mjs +899 -0
  130. package/fesm2022/sdcorejs-angular-services-persistence.mjs.map +1 -0
  131. package/fesm2022/sdcorejs-angular-services-storage.mjs +324 -122
  132. package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
  133. package/fesm2022/sdcorejs-angular-services-task.mjs +389 -0
  134. package/fesm2022/sdcorejs-angular-services-task.mjs.map +1 -0
  135. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +255 -0
  136. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -0
  137. package/fesm2022/sdcorejs-angular-services-viewport.mjs +76 -0
  138. package/fesm2022/sdcorejs-angular-services-viewport.mjs.map +1 -0
  139. package/fesm2022/sdcorejs-angular-services.mjs +4 -0
  140. package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
  141. package/forms/autocomplete/index.d.ts +3 -4
  142. package/forms/checkbox/index.d.ts +4 -8
  143. package/forms/date/index.d.ts +3 -3
  144. package/forms/date-range/index.d.ts +6 -7
  145. package/forms/datetime/index.d.ts +3 -3
  146. package/forms/entity-picker/index.d.ts +128 -0
  147. package/forms/index.d.ts +15 -5
  148. package/forms/input/index.d.ts +76 -11
  149. package/forms/input-color/index.d.ts +3 -1
  150. package/forms/input-number/index.d.ts +4 -2
  151. package/forms/models/index.d.ts +86 -3
  152. package/forms/radio/index.d.ts +12 -8
  153. package/forms/switch/index.d.ts +4 -7
  154. package/forms/time/index.d.ts +117 -0
  155. package/forms/time-range/index.d.ts +98 -0
  156. package/forms/tree-select/index.d.ts +76 -0
  157. package/i18n/index.d.ts +68 -2
  158. package/interceptors/index.d.ts +5 -6
  159. package/modules/icon/index.d.ts +2 -3
  160. package/modules/index.d.ts +0 -1
  161. package/modules/layout/index.d.ts +288 -15
  162. package/package.json +50 -5
  163. package/pipes/index.d.ts +2 -2
  164. package/services/api/index.d.ts +68 -24
  165. package/services/cache/index.d.ts +52 -16
  166. package/services/confirm/index.d.ts +3 -2
  167. package/services/docx/index.d.ts +2 -3
  168. package/services/index.d.ts +4 -0
  169. package/services/loading/index.d.ts +16 -8
  170. package/services/persistence/index.d.ts +159 -0
  171. package/services/storage/index.d.ts +26 -8
  172. package/services/task/index.d.ts +104 -0
  173. package/services/unsaved-changes/index.d.ts +83 -0
  174. package/services/viewport/index.d.ts +42 -0
  175. package/fesm2022/sdcorejs-angular-modules-authom.mjs +0 -360
  176. package/fesm2022/sdcorejs-angular-modules-authom.mjs.map +0 -1
  177. package/modules/authom/index.d.ts +0 -70
@@ -0,0 +1,97 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, booleanAttribute, output, inject, computed, HostBinding, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { I18nService } from '@sdcorejs/angular/i18n';
4
+ import { SdTaskService } from '@sdcorejs/angular/services/task';
5
+
6
+ class SdJobProgress {
7
+ taskId = input(undefined, ...(ngDevMode ? [{ debugName: "taskId" }] : []));
8
+ state = input(undefined, ...(ngDevMode ? [{ debugName: "state" }] : []));
9
+ mode = input('bar', ...(ngDevMode ? [{ debugName: "mode" }] : []));
10
+ title = input(undefined, ...(ngDevMode ? [{ debugName: "title" }] : []));
11
+ message = input(undefined, ...(ngDevMode ? [{ debugName: "message" }] : []));
12
+ showActions = input(true, ...(ngDevMode ? [{ debugName: "showActions", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
13
+ sdCancel = output();
14
+ sdRetry = output();
15
+ #tasks = inject(SdTaskService);
16
+ #i18n = inject(I18nService);
17
+ task = computed(() => {
18
+ if (this.state())
19
+ return undefined;
20
+ const id = this.taskId();
21
+ return id ? this.#tasks.get(id) : undefined;
22
+ }, ...(ngDevMode ? [{ debugName: "task" }] : []));
23
+ resolvedState = computed(() => this.state() ?? this.task()?.state(), ...(ngDevMode ? [{ debugName: "resolvedState" }] : []));
24
+ progress = computed(() => {
25
+ const value = this.resolvedState()?.progress;
26
+ return value === undefined || !Number.isFinite(value) ? undefined : Math.max(0, Math.min(100, value));
27
+ }, ...(ngDevMode ? [{ debugName: "progress" }] : []));
28
+ effectiveTitle = computed(() => this.title() ?? this.resolvedState()?.title, ...(ngDevMode ? [{ debugName: "effectiveTitle" }] : []));
29
+ effectiveMessage = computed(() => this.message() ?? this.resolvedState()?.message, ...(ngDevMode ? [{ debugName: "effectiveMessage" }] : []));
30
+ statusLabel = computed(() => this.#i18n.t(`core.component.job-progress.status.${this.resolvedState()?.status ?? 'idle'}`), ...(ngDevMode ? [{ debugName: "statusLabel" }] : []));
31
+ progressLabel = computed(() => {
32
+ const title = this.effectiveTitle();
33
+ return title ? `${title}: ${this.statusLabel()}` : this.statusLabel();
34
+ }, ...(ngDevMode ? [{ debugName: "progressLabel" }] : []));
35
+ cancelLabel = computed(() => this.#i18n.t('core.component.job-progress.cancel'), ...(ngDevMode ? [{ debugName: "cancelLabel" }] : []));
36
+ retryLabel = computed(() => this.#i18n.t('core.component.job-progress.retry'), ...(ngDevMode ? [{ debugName: "retryLabel" }] : []));
37
+ displayedError = computed(() => formatError(this.resolvedState()?.error ?? this.task()?.error()), ...(ngDevMode ? [{ debugName: "displayedError" }] : []));
38
+ active = computed(() => {
39
+ const status = this.resolvedState()?.status;
40
+ return status === 'queued' || status === 'running';
41
+ }, ...(ngDevMode ? [{ debugName: "active" }] : []));
42
+ canCancel = computed(() => this.showActions() && this.active() && (this.task()?.canCancel() ?? true), ...(ngDevMode ? [{ debugName: "canCancel" }] : []));
43
+ canRetry = computed(() => {
44
+ if (!this.showActions())
45
+ return false;
46
+ const status = this.resolvedState()?.status;
47
+ return this.task()?.canRetry() ?? (status === 'failed' || status === 'cancelled');
48
+ }, ...(ngDevMode ? [{ debugName: "canRetry" }] : []));
49
+ get modeAttr() {
50
+ return this.mode();
51
+ }
52
+ get statusAttr() {
53
+ return this.resolvedState()?.status ?? 'idle';
54
+ }
55
+ ariaLive = 'polite';
56
+ onCancel() {
57
+ const id = this.taskId();
58
+ if (id && this.task())
59
+ void this.#tasks.cancel(id);
60
+ this.sdCancel.emit();
61
+ }
62
+ onRetry() {
63
+ const id = this.taskId();
64
+ if (id && this.task())
65
+ this.#tasks.retry(id);
66
+ this.sdRetry.emit();
67
+ }
68
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdJobProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
69
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdJobProgress, isStandalone: true, selector: "sd-job-progress", inputs: { taskId: { classPropertyName: "taskId", publicName: "taskId", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, showActions: { classPropertyName: "showActions", publicName: "showActions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdCancel: "sdCancel", sdRetry: "sdRetry" }, host: { properties: { "attr.data-mode": "this.modeAttr", "attr.data-status": "this.statusAttr", "attr.aria-live": "this.ariaLive" } }, ngImport: i0, template: "@if (resolvedState()) {\n <section class=\"sd-job-progress\" [attr.aria-label]=\"progressLabel()\">\n <div class=\"sd-job-progress__header\">\n <div class=\"sd-job-progress__identity\">\n @if (effectiveTitle()) {\n <strong class=\"sd-job-progress__title\">{{ effectiveTitle() }}</strong>\n }\n <span class=\"sd-job-progress__status\">{{ statusLabel() }}</span>\n </div>\n\n @if (progress() !== undefined) {\n <span class=\"sd-job-progress__percentage\">{{ progress() }}%</span>\n }\n </div>\n\n @if (active() || progress() !== undefined) {\n <div\n class=\"sd-job-progress__track\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"progress()\"\n [attr.aria-label]=\"progressLabel()\"\n [attr.data-indeterminate]=\"progress() === undefined ? 'true' : 'false'\">\n <span\n class=\"sd-job-progress__fill\"\n [class.sd-job-progress__fill--indeterminate]=\"progress() === undefined\"\n [style.width.%]=\"progress() ?? 30\"></span>\n </div>\n }\n\n @if (mode() === 'details' && effectiveMessage()) {\n <p class=\"sd-job-progress__message\" data-task-details>{{ effectiveMessage() }}</p>\n }\n\n @if (displayedError()) {\n <p class=\"sd-job-progress__error\" role=\"alert\">{{ displayedError() }}</p>\n }\n\n @if (canCancel() || canRetry()) {\n <div class=\"sd-job-progress__actions\">\n @if (canCancel()) {\n <button type=\"button\" data-task-cancel (click)=\"onCancel()\">\n {{ cancelLabel() }}\n </button>\n }\n @if (canRetry()) {\n <button type=\"button\" data-task-retry (click)=\"onRetry()\">\n {{ retryLabel() }}\n </button>\n }\n </div>\n }\n </section>\n}\n", styles: [":host{display:block}.sd-job-progress{display:grid;gap:8px;padding:12px;border:1px solid var(--sd-border-color, #dfe3e8);border-radius:8px;background:var(--sd-surface, #fff)}.sd-job-progress__header,.sd-job-progress__identity,.sd-job-progress__actions{display:flex;align-items:center;gap:8px}.sd-job-progress__header{justify-content:space-between}.sd-job-progress__identity{min-width:0;flex-wrap:wrap}.sd-job-progress__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-job-progress__status,.sd-job-progress__percentage,.sd-job-progress__message{color:var(--sd-text-muted, #5f6772);font-size:.875rem}.sd-job-progress__track{position:relative;height:8px;overflow:hidden;border-radius:999px;background:var(--sd-progress-track, #e8edf3)}.sd-job-progress__fill{display:block;height:100%;border-radius:inherit;background:var(--sd-primary, #1565c0);transition:width .16s ease}.sd-job-progress__fill--indeterminate{animation:sd-job-progress-indeterminate 1.2s ease-in-out infinite}.sd-job-progress__message,.sd-job-progress__error{margin:0}.sd-job-progress__error{color:var(--sd-error, #ba1a1a)}.sd-job-progress__actions{justify-content:flex-end}.sd-job-progress__actions button{padding:6px 10px;border:1px solid currentColor;border-radius:6px;color:var(--sd-primary, #1565c0);background:transparent;cursor:pointer}:host([data-mode=compact]) .sd-job-progress{grid-template-columns:minmax(0,1fr) minmax(80px,30%);align-items:center;padding:8px 10px}:host([data-mode=compact]) .sd-job-progress__actions,:host([data-mode=compact]) .sd-job-progress__error{grid-column:1/-1}@keyframes sd-job-progress-indeterminate{0%{transform:translate(-120%)}to{transform:translate(380%)}}@media(prefers-reduced-motion:reduce){.sd-job-progress__fill{transition:none}.sd-job-progress__fill--indeterminate{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
70
+ }
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdJobProgress, decorators: [{
72
+ type: Component,
73
+ args: [{ selector: 'sd-job-progress', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (resolvedState()) {\n <section class=\"sd-job-progress\" [attr.aria-label]=\"progressLabel()\">\n <div class=\"sd-job-progress__header\">\n <div class=\"sd-job-progress__identity\">\n @if (effectiveTitle()) {\n <strong class=\"sd-job-progress__title\">{{ effectiveTitle() }}</strong>\n }\n <span class=\"sd-job-progress__status\">{{ statusLabel() }}</span>\n </div>\n\n @if (progress() !== undefined) {\n <span class=\"sd-job-progress__percentage\">{{ progress() }}%</span>\n }\n </div>\n\n @if (active() || progress() !== undefined) {\n <div\n class=\"sd-job-progress__track\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"progress()\"\n [attr.aria-label]=\"progressLabel()\"\n [attr.data-indeterminate]=\"progress() === undefined ? 'true' : 'false'\">\n <span\n class=\"sd-job-progress__fill\"\n [class.sd-job-progress__fill--indeterminate]=\"progress() === undefined\"\n [style.width.%]=\"progress() ?? 30\"></span>\n </div>\n }\n\n @if (mode() === 'details' && effectiveMessage()) {\n <p class=\"sd-job-progress__message\" data-task-details>{{ effectiveMessage() }}</p>\n }\n\n @if (displayedError()) {\n <p class=\"sd-job-progress__error\" role=\"alert\">{{ displayedError() }}</p>\n }\n\n @if (canCancel() || canRetry()) {\n <div class=\"sd-job-progress__actions\">\n @if (canCancel()) {\n <button type=\"button\" data-task-cancel (click)=\"onCancel()\">\n {{ cancelLabel() }}\n </button>\n }\n @if (canRetry()) {\n <button type=\"button\" data-task-retry (click)=\"onRetry()\">\n {{ retryLabel() }}\n </button>\n }\n </div>\n }\n </section>\n}\n", styles: [":host{display:block}.sd-job-progress{display:grid;gap:8px;padding:12px;border:1px solid var(--sd-border-color, #dfe3e8);border-radius:8px;background:var(--sd-surface, #fff)}.sd-job-progress__header,.sd-job-progress__identity,.sd-job-progress__actions{display:flex;align-items:center;gap:8px}.sd-job-progress__header{justify-content:space-between}.sd-job-progress__identity{min-width:0;flex-wrap:wrap}.sd-job-progress__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-job-progress__status,.sd-job-progress__percentage,.sd-job-progress__message{color:var(--sd-text-muted, #5f6772);font-size:.875rem}.sd-job-progress__track{position:relative;height:8px;overflow:hidden;border-radius:999px;background:var(--sd-progress-track, #e8edf3)}.sd-job-progress__fill{display:block;height:100%;border-radius:inherit;background:var(--sd-primary, #1565c0);transition:width .16s ease}.sd-job-progress__fill--indeterminate{animation:sd-job-progress-indeterminate 1.2s ease-in-out infinite}.sd-job-progress__message,.sd-job-progress__error{margin:0}.sd-job-progress__error{color:var(--sd-error, #ba1a1a)}.sd-job-progress__actions{justify-content:flex-end}.sd-job-progress__actions button{padding:6px 10px;border:1px solid currentColor;border-radius:6px;color:var(--sd-primary, #1565c0);background:transparent;cursor:pointer}:host([data-mode=compact]) .sd-job-progress{grid-template-columns:minmax(0,1fr) minmax(80px,30%);align-items:center;padding:8px 10px}:host([data-mode=compact]) .sd-job-progress__actions,:host([data-mode=compact]) .sd-job-progress__error{grid-column:1/-1}@keyframes sd-job-progress-indeterminate{0%{transform:translate(-120%)}to{transform:translate(380%)}}@media(prefers-reduced-motion:reduce){.sd-job-progress__fill{transition:none}.sd-job-progress__fill--indeterminate{animation:none}}\n"] }]
74
+ }], propDecorators: { taskId: [{ type: i0.Input, args: [{ isSignal: true, alias: "taskId", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], showActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActions", required: false }] }], sdCancel: [{ type: i0.Output, args: ["sdCancel"] }], sdRetry: [{ type: i0.Output, args: ["sdRetry"] }], modeAttr: [{
75
+ type: HostBinding,
76
+ args: ['attr.data-mode']
77
+ }], statusAttr: [{
78
+ type: HostBinding,
79
+ args: ['attr.data-status']
80
+ }], ariaLive: [{
81
+ type: HostBinding,
82
+ args: ['attr.aria-live']
83
+ }] } });
84
+ function formatError(error) {
85
+ if (error === null || error === undefined)
86
+ return undefined;
87
+ if (error instanceof Error)
88
+ return error.message;
89
+ return typeof error === 'string' ? error : String(error);
90
+ }
91
+
92
+ /**
93
+ * Generated bundle index. Do not edit.
94
+ */
95
+
96
+ export { SdJobProgress };
97
+ //# sourceMappingURL=sdcorejs-angular-components-job-progress.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdcorejs-angular-components-job-progress.mjs","sources":["../../../projects/sdcorejs-angular/components/job-progress/src/job-progress.component.ts","../../../projects/sdcorejs-angular/components/job-progress/src/job-progress.component.html","../../../projects/sdcorejs-angular/components/job-progress/sdcorejs-angular-components-job-progress.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, HostBinding, booleanAttribute, computed, inject, input, output } from '@angular/core';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdTaskService, SdTaskState, SdTaskStatus, SdTaskView } from '@sdcorejs/angular/services/task';\n\nexport type SdJobProgressMode = 'bar' | 'compact' | 'details';\n\n@Component({\n selector: 'sd-job-progress',\n standalone: true,\n templateUrl: './job-progress.component.html',\n styleUrl: './job-progress.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SdJobProgress {\n readonly taskId = input<string | undefined>(undefined);\n readonly state = input<SdTaskState | undefined>(undefined);\n readonly mode = input<SdJobProgressMode>('bar');\n readonly title = input<string | undefined>(undefined);\n readonly message = input<string | undefined>(undefined);\n readonly showActions = input(true, { transform: booleanAttribute });\n\n readonly sdCancel = output<void>();\n readonly sdRetry = output<void>();\n\n readonly #tasks = inject(SdTaskService);\n readonly #i18n = inject(I18nService);\n\n readonly task = computed<SdTaskView | undefined>(() => {\n if (this.state()) return undefined;\n const id = this.taskId();\n return id ? this.#tasks.get(id) : undefined;\n });\n readonly resolvedState = computed<SdTaskState | undefined>(() => this.state() ?? this.task()?.state());\n readonly progress = computed<number | undefined>(() => {\n const value = this.resolvedState()?.progress;\n return value === undefined || !Number.isFinite(value) ? undefined : Math.max(0, Math.min(100, value));\n });\n readonly effectiveTitle = computed(() => this.title() ?? this.resolvedState()?.title);\n readonly effectiveMessage = computed(() => this.message() ?? this.resolvedState()?.message);\n readonly statusLabel = computed(() => this.#i18n.t(`core.component.job-progress.status.${this.resolvedState()?.status ?? 'idle'}`));\n readonly progressLabel = computed(() => {\n const title = this.effectiveTitle();\n return title ? `${title}: ${this.statusLabel()}` : this.statusLabel();\n });\n readonly cancelLabel = computed(() => this.#i18n.t('core.component.job-progress.cancel'));\n readonly retryLabel = computed(() => this.#i18n.t('core.component.job-progress.retry'));\n readonly displayedError = computed(() => formatError(this.resolvedState()?.error ?? this.task()?.error()));\n readonly active = computed(() => {\n const status = this.resolvedState()?.status;\n return status === 'queued' || status === 'running';\n });\n readonly canCancel = computed(() => this.showActions() && this.active() && (this.task()?.canCancel() ?? true));\n readonly canRetry = computed(() => {\n if (!this.showActions()) return false;\n const status = this.resolvedState()?.status;\n return this.task()?.canRetry() ?? (status === 'failed' || status === 'cancelled');\n });\n\n @HostBinding('attr.data-mode') get modeAttr(): SdJobProgressMode {\n return this.mode();\n }\n\n @HostBinding('attr.data-status') get statusAttr(): SdTaskStatus {\n return this.resolvedState()?.status ?? 'idle';\n }\n\n @HostBinding('attr.aria-live') readonly ariaLive = 'polite';\n\n onCancel(): void {\n const id = this.taskId();\n if (id && this.task()) void this.#tasks.cancel(id);\n this.sdCancel.emit();\n }\n\n onRetry(): void {\n const id = this.taskId();\n if (id && this.task()) this.#tasks.retry(id);\n this.sdRetry.emit();\n }\n}\n\nfunction formatError(error: unknown): string | undefined {\n if (error === null || error === undefined) return undefined;\n if (error instanceof Error) return error.message;\n return typeof error === 'string' ? error : String(error);\n}\n","@if (resolvedState()) {\n <section class=\"sd-job-progress\" [attr.aria-label]=\"progressLabel()\">\n <div class=\"sd-job-progress__header\">\n <div class=\"sd-job-progress__identity\">\n @if (effectiveTitle()) {\n <strong class=\"sd-job-progress__title\">{{ effectiveTitle() }}</strong>\n }\n <span class=\"sd-job-progress__status\">{{ statusLabel() }}</span>\n </div>\n\n @if (progress() !== undefined) {\n <span class=\"sd-job-progress__percentage\">{{ progress() }}%</span>\n }\n </div>\n\n @if (active() || progress() !== undefined) {\n <div\n class=\"sd-job-progress__track\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"progress()\"\n [attr.aria-label]=\"progressLabel()\"\n [attr.data-indeterminate]=\"progress() === undefined ? 'true' : 'false'\">\n <span\n class=\"sd-job-progress__fill\"\n [class.sd-job-progress__fill--indeterminate]=\"progress() === undefined\"\n [style.width.%]=\"progress() ?? 30\"></span>\n </div>\n }\n\n @if (mode() === 'details' && effectiveMessage()) {\n <p class=\"sd-job-progress__message\" data-task-details>{{ effectiveMessage() }}</p>\n }\n\n @if (displayedError()) {\n <p class=\"sd-job-progress__error\" role=\"alert\">{{ displayedError() }}</p>\n }\n\n @if (canCancel() || canRetry()) {\n <div class=\"sd-job-progress__actions\">\n @if (canCancel()) {\n <button type=\"button\" data-task-cancel (click)=\"onCancel()\">\n {{ cancelLabel() }}\n </button>\n }\n @if (canRetry()) {\n <button type=\"button\" data-task-retry (click)=\"onRetry()\">\n {{ retryLabel() }}\n </button>\n }\n </div>\n }\n </section>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAaa,aAAa,CAAA;AACf,IAAA,MAAM,GAAG,KAAK,CAAqB,SAAS,kDAAC;AAC7C,IAAA,KAAK,GAAG,KAAK,CAA0B,SAAS,iDAAC;AACjD,IAAA,IAAI,GAAG,KAAK,CAAoB,KAAK,gDAAC;AACtC,IAAA,KAAK,GAAG,KAAK,CAAqB,SAAS,iDAAC;AAC5C,IAAA,OAAO,GAAG,KAAK,CAAqB,SAAS,mDAAC;AAC9C,IAAA,WAAW,GAAG,KAAK,CAAC,IAAI,+CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;IAE1D,QAAQ,GAAG,MAAM,EAAQ;IACzB,OAAO,GAAG,MAAM,EAAQ;AAExB,IAAA,MAAM,G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A,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FD1Ca,aAAa,EAAA,UAAA,EAAA,CAAA;kBAPzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,eAAA,EAGC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,s2DAAA,EAAA,MAAA,EAAA,CAAA,sxDAAA,CAAA,EAAA;;sBA+C9C,WAAW;uBAAC,gBAAgB;;sBAI5B,WAAW;uBAAC,kBAAkB;;sBAI9B,WAAW;uBAAC,gBAAgB;;AAe/B,SAAS,WAAW,CAAC,KAAc,EAAA;AACjC,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IAC3D,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO;AAChD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC1D;;AErFA;;AAEG;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { CommonModule } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, forwardRef, Input, Output, HostBinding, Component } from '@angular/core';
3
+ import { output, input, forwardRef, Input, HostBinding, Component } from '@angular/core';
4
4
  import * as i1 from '@ckeditor/ckeditor5-angular';
5
5
  import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
6
6
  import { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';
@@ -32,15 +32,15 @@ class SdMiniEditor {
32
32
  }
33
33
  /** NgModel binding - nội dung HTML/Markdown */
34
34
  value = '';
35
- valueChange = new EventEmitter();
35
+ valueChange = output();
36
36
  /** Event emitter khi content thay đổi */
37
- contentChange = new EventEmitter();
37
+ contentChange = output();
38
38
  /** Event emitter khi blur */
39
- blur = new EventEmitter();
39
+ blur = output();
40
40
  /** Event emitter khi focus */
41
- focus = new EventEmitter();
41
+ focus = output();
42
42
  /** Disabled state */
43
- disabled = false;
43
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
44
44
  Editor = ClassicEditor;
45
45
  #editor;
46
46
  #subscription = new Subscription();
@@ -288,13 +288,13 @@ class SdMiniEditor {
288
288
  #onChange = () => { };
289
289
  #onTouched = () => { };
290
290
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdMiniEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
291
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: SdMiniEditor, isStandalone: true, selector: "sd-mini-editor", inputs: { option: "option", value: "value", disabled: "disabled" }, outputs: { valueChange: "valueChange", contentChange: "contentChange", blur: "blur", focus: "focus" }, host: { properties: { "style.--sd-mini-editor-max-height": "this.maxEditorHeight" } }, providers: [
291
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: SdMiniEditor, isStandalone: true, selector: "sd-mini-editor", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: false, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", contentChange: "contentChange", blur: "blur", focus: "focus" }, host: { properties: { "style.--sd-mini-editor-max-height": "this.maxEditorHeight" } }, providers: [
292
292
  {
293
293
  provide: NG_VALUE_ACCESSOR,
294
294
  useExisting: forwardRef(() => SdMiniEditor),
295
295
  multi: true,
296
296
  },
297
- ], ngImport: i0, template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:#fff!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:#fff!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:600;padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i1.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableWatchdog", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "component", type: SdCKEditorStyles, selector: "sd-ckeditor-styles" }] });
297
+ ], ngImport: i0, template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:#fff!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:#fff!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:600;padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i1.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableWatchdog", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "component", type: SdCKEditorStyles, selector: "sd-ckeditor-styles" }] });
298
298
  }
299
299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdMiniEditor, decorators: [{
300
300
  type: Component,
@@ -304,7 +304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
304
304
  useExisting: forwardRef(() => SdMiniEditor),
305
305
  multi: true,
306
306
  },
307
- ], template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:#fff!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:#fff!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:600;padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"] }]
307
+ ], template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:#fff!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:#fff!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:600;padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"] }]
308
308
  }], ctorParameters: () => [], propDecorators: { option: [{
309
309
  type: Input,
310
310
  args: [{ required: true }]
@@ -313,17 +313,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
313
313
  args: ['style.--sd-mini-editor-max-height']
314
314
  }], value: [{
315
315
  type: Input
316
- }], valueChange: [{
317
- type: Output
318
- }], contentChange: [{
319
- type: Output
320
- }], blur: [{
321
- type: Output
322
- }], focus: [{
323
- type: Output
324
- }], disabled: [{
325
- type: Input
326
- }] } });
316
+ }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], contentChange: [{ type: i0.Output, args: ["contentChange"] }], blur: [{ type: i0.Output, args: ["blur"] }], focus: [{ type: i0.Output, args: ["focus"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
327
317
 
328
318
  /**
329
319
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-components-mini-editor.mjs","sources":["../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.ts","../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.html","../../../projects/sdcorejs-angular/components/mini-editor/sdcorejs-angular-components-mini-editor.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, HostBinding, Input, Output, forwardRef, OnDestroy } from '@angular/core';\nimport { CKEditorModule } from '@ckeditor/ckeditor5-angular';\nimport { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';\nimport {\n Bold,\n ClassicEditor,\n Essentials,\n Italic,\n Link,\n List,\n FontColor,\n Markdown,\n Mention,\n Paragraph,\n Underline,\n Undo,\n Widget,\n} from 'ckeditor5';\nimport { Subject, Subscription } from 'rxjs';\nimport { throttleTime } from 'rxjs/operators';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { SdMiniEditorOption, SdMiniEditorConfig, SdMiniEditorMentionItem } from './mini-editor.model';\n\n/**\n * Component sd-mini-editor - Editor đơn giản cho comment input\n * Sử dụng CKEditor với chế độ đơn giản (bold, italic, link)\n * Hỗ trợ mention và output format (html/markdown)\n *\n * @example\n * ```html\n * <sd-mini-editor\n * [option]=\"editorOption\"\n * [(ngModel)]=\"content\"\n * (contentChange)=\"onContentChange($event)\"\n * >\n * </sd-mini-editor>\n * ```\n */\n@Component({\n selector: 'sd-mini-editor',\n standalone: true,\n imports: [CommonModule, CKEditorModule, SdCKEditorStyles],\n templateUrl: './mini-editor.component.html',\n styleUrl: './mini-editor.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SdMiniEditor),\n multi: true,\n },\n ],\n})\nexport class SdMiniEditor implements ControlValueAccessor, OnDestroy {\n /** Cấu hình option cho editor */\n @Input({ required: true }) option!: SdMiniEditorOption;\n\n @HostBinding('style.--sd-mini-editor-max-height')\n get maxEditorHeight(): string | undefined {\n return this.option?.maxHeight;\n }\n\n /** NgModel binding - nội dung HTML/Markdown */\n @Input() value = '';\n @Output() valueChange = new EventEmitter<string>();\n\n /** Event emitter khi content thay đổi */\n @Output() contentChange = new EventEmitter<string>();\n\n /** Event emitter khi blur */\n @Output() blur = new EventEmitter<FocusEvent>();\n\n /** Event emitter khi focus */\n @Output() focus = new EventEmitter<FocusEvent>();\n\n /** Disabled state */\n @Input() disabled = false;\n\n Editor = ClassicEditor;\n #editor!: ClassicEditor;\n #subscription = new Subscription();\n #contentChangeSubject = new Subject<string>();\n\n // Build editor config dynamically\n get editorConfig(): SdMiniEditorConfig {\n const enableMention = this.option?.enableMention ?? false;\n const useMarkdown = this.option?.outputFormat === 'markdown';\n const plugins: any[] = [Essentials, FontColor, Paragraph, Bold, Italic, Underline, Link, List, Undo, Widget];\n\n // Add Markdown plugin if outputFormat is markdown\n if (useMarkdown) {\n plugins.push(Markdown);\n }\n\n // Add Mention plugin if enabled\n if (enableMention) {\n plugins.push(Mention);\n }\n\n // Build base config\n const config: SdMiniEditorConfig = {\n licenseKey: 'GPL',\n getOption: () => this.option,\n plugins,\n toolbar: {\n items: ['bold', 'italic', 'underline', '|', 'fontColor', '|', 'bulletedList', 'numberedList', '|', 'link'],\n shouldNotGroupWhenFull: true,\n },\n placeholder: this.option?.placeholder,\n link: {\n addTargetToExternalLinks: true,\n defaultProtocol: 'https://',\n },\n fontColor: {\n columns: 5,\n documentColors: 10,\n colorPicker: { format: 'hex' },\n },\n };\n\n // Add mention configuration if enabled\n if (enableMention && this.option?.mentionConfig?.feeds) {\n config.mention = {\n feeds: this.option.mentionConfig.feeds,\n };\n }\n\n return config;\n }\n\n constructor() {\n // Setup debounce cho content change\n this.#subscription.add(\n this.#contentChangeSubject.pipe(throttleTime(500, undefined, { leading: true, trailing: true })).subscribe(content => {\n const output = this.#convertOutput(content);\n this.value = output;\n this.#onChange(output);\n this.valueChange.emit(output);\n this.contentChange.emit(output);\n this.option?.onChange?.(output);\n })\n );\n }\n\n ngOnDestroy() {\n this.#subscription.unsubscribe();\n this.#editor?.destroy?.();\n }\n\n /**\n * Kiểm tra có nên enable mention plugin không\n */\n #shouldEnableMention(): boolean {\n return this.option?.enableMention ?? false;\n }\n\n /**\n * Xử lý khi editor ready\n */\n onReady(editor: ClassicEditor) {\n this.#editor = editor;\n\n // Set initial content\n if (this.value) {\n this.setContent(this.value);\n }\n\n // Lắng nghe sự kiện thay đổi nội dung\n editor.model.document.on('change:data', () => {\n const content = editor.getData();\n this.#contentChangeSubject.next(content);\n });\n\n // Lắng nghe focus/blur events\n editor.editing.view.document.on('focus', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.focus.emit(domEvent);\n this.option?.onFocus?.(domEvent);\n });\n\n editor.editing.view.document.on('blur', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.blur.emit(domEvent);\n this.option?.onBlur?.(domEvent);\n });\n\n // Lắng nghe sự kiện mention được chọn\n if (this.#shouldEnableMention()) {\n editor.commands.get('mention')?.on('execute', (_evt, data: any) => {\n const mentionData = data[0];\n this.option?.onMentionSelect?.(mentionData.mention);\n // Trigger content change sau khi insert mention\n const content = editor.getData();\n this.#contentChangeSubject.next(content);\n });\n\n // Custom downcast converter để thay đổi cấu trúc mention HTML\n editor.conversion.for('downcast').attributeToElement({\n model: 'mention',\n view: (mentionData, { writer }) => {\n const data = mentionData as SdMiniEditorMentionItem;\n const rawId = data?.id || '';\n const marker = rawId[0];\n const cleanId = rawId.slice(1);\n\n return writer.createAttributeElement('span', {\n class: 'ck-custom-mention',\n 'data-id': cleanId,\n 'data-marker': marker,\n contenteditable: 'false',\n });\n },\n converterPriority: 'highest',\n });\n\n // Xử lý keyboard để xóa mention 1 lần\n editor.editing.view.document.on('keydown', (evt, data) => {\n const keyEvent = data as { keyCode: number; domEvent: KeyboardEvent };\n // Delete (46) hoặc Backspace (8)\n if (keyEvent.keyCode === 46 || keyEvent.keyCode === 8) {\n const model = editor.model;\n const selection = model.document.selection;\n const position = selection.getFirstPosition();\n if (!position) return;\n\n // Tìm text node có mention attribute\n const node = position.textNode || position.nodeBefore || position.nodeAfter;\n if (node && node.is('$text')) {\n const mentionAttr = node.getAttribute('mention');\n if (mentionAttr) {\n // Xóa toàn bộ text node chứa mention\n model.change(writer => {\n writer.remove(node);\n });\n evt.stop();\n }\n }\n }\n });\n }\n }\n\n /**\n * Convert output theo format (html hoặc markdown)\n * Khi sử dụng CKEditor Markdown plugin, getData() tự động trả về Markdown\n */\n #convertOutput(content: string): string {\n // CKEditor Markdown plugin tự động xử lý conversion\n // Không cần manual conversion nữa\n return content;\n }\n\n /**\n * Set nội dung cho editor\n */\n setContent(content: string) {\n this.#editor?.setData?.(content);\n }\n\n /**\n * Get nội dung từ editor\n */\n getContent(): string {\n if (this.#editor) {\n const html = this.#editor.getData();\n return this.#convertOutput(html);\n }\n return '';\n }\n\n /**\n * Get nội dung HTML gốc (không convert)\n */\n getHtmlContent(): string {\n return this.#editor?.getData?.() || '';\n }\n\n /**\n * Focus vào editor\n */\n focusEditor() {\n this.#editor?.editing?.view?.focus?.();\n }\n\n /**\n * Insert mention vào vị trí con trỏ hiện tại\n */\n insertMention(item: { id: string; name: string; marker?: string }) {\n if (!this.#editor) return;\n\n const firstFeed = this.option?.mentionConfig?.feeds?.[0];\n const marker = item.marker || (firstFeed as any)?.marker || '@';\n\n // Sử dụng CKEditor mention command\n this.#editor.execute('mention', {\n marker,\n mention: {\n id: item.id,\n text: `${marker}${item.name}`,\n },\n });\n }\n\n /**\n * Get danh sách mentions trong nội dung\n */\n getMentions(): { id: string; name: string; marker: string }[] {\n if (!this.#editor) return [];\n\n const mentions: { id: string; name: string; marker: string }[] = [];\n const root = this.#editor.model.document.getRoot();\n if (!root) return mentions;\n\n const range = this.#editor.model.createRangeIn(root);\n\n for (const item of range.getItems()) {\n if (item.is('$text')) {\n const mentionAttr = item.getAttribute('mention');\n if (mentionAttr) {\n const text = (item as any).data as string;\n const marker = text.charAt(0);\n const name = text.substring(1);\n const id = item.getAttribute('data-user-id') as string;\n\n mentions.push({ id, name, marker });\n }\n }\n }\n\n return mentions;\n }\n\n /**\n * ControlValueAccessor: Write value\n */\n writeValue(value: string): void {\n this.value = value || '';\n if (this.#editor) {\n this.setContent(this.value);\n }\n }\n\n /**\n * ControlValueAccessor: Register change callback\n */\n registerOnChange(fn: (value: string) => void): void {\n this.#onChange = fn;\n }\n\n /**\n * ControlValueAccessor: Register touched callback\n */\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn;\n }\n\n /** ControlValueAccessor callbacks */\n #onChange: (value: string) => void = () => {};\n #onTouched: () => void = () => {};\n}\n","<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled\" (ready)=\"onReady($event)\"> </ckeditor>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAyBA;;;;;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ular-components-mini-editor.mjs","sources":["../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.ts","../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.html","../../../projects/sdcorejs-angular/components/mini-editor/sdcorejs-angular-components-mini-editor.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, HostBinding, Input, forwardRef, OnDestroy, input, output } from '@angular/core';\nimport { CKEditorModule } from '@ckeditor/ckeditor5-angular';\nimport { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';\nimport {\n Bold,\n ClassicEditor,\n Essentials,\n Italic,\n Link,\n List,\n FontColor,\n Markdown,\n Mention,\n Paragraph,\n Underline,\n Undo,\n Widget,\n} from 'ckeditor5';\nimport { Subject, Subscription } from 'rxjs';\nimport { throttleTime } from 'rxjs/operators';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { SdMiniEditorOption, SdMiniEditorConfig, SdMiniEditorMentionItem } from './mini-editor.model';\n\n/**\n * Component sd-mini-editor - Editor đơn giản cho comment input\n * Sử dụng CKEditor với chế độ đơn giản (bold, italic, link)\n * Hỗ trợ mention và output format (html/markdown)\n *\n * @example\n * ```html\n * <sd-mini-editor\n * [option]=\"editorOption\"\n * [(ngModel)]=\"content\"\n * (contentChange)=\"onContentChange($event)\"\n * >\n * </sd-mini-editor>\n * ```\n */\n@Component({\n selector: 'sd-mini-editor',\n standalone: true,\n imports: [CommonModule, CKEditorModule, SdCKEditorStyles],\n templateUrl: './mini-editor.component.html',\n styleUrl: './mini-editor.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SdMiniEditor),\n multi: true,\n },\n ],\n})\nexport class SdMiniEditor implements ControlValueAccessor, OnDestroy {\n /** Cấu hình option cho editor */\n @Input({ required: true }) option!: SdMiniEditorOption;\n\n @HostBinding('style.--sd-mini-editor-max-height')\n get maxEditorHeight(): string | undefined {\n return this.option?.maxHeight;\n }\n\n /** NgModel binding - nội dung HTML/Markdown */\n @Input() value = '';\n readonly valueChange = output<string>();\n\n /** Event emitter khi content thay đổi */\n readonly contentChange = output<string>();\n\n /** Event emitter khi blur */\n readonly blur = output<FocusEvent>();\n\n /** Event emitter khi focus */\n readonly focus = output<FocusEvent>();\n\n /** Disabled state */\n readonly disabled = input(false);\n\n Editor = ClassicEditor;\n #editor!: ClassicEditor;\n #subscription = new Subscription();\n #contentChangeSubject = new Subject<string>();\n\n // Build editor config dynamically\n get editorConfig(): SdMiniEditorConfig {\n const enableMention = this.option?.enableMention ?? false;\n const useMarkdown = this.option?.outputFormat === 'markdown';\n const plugins: any[] = [Essentials, FontColor, Paragraph, Bold, Italic, Underline, Link, List, Undo, Widget];\n\n // Add Markdown plugin if outputFormat is markdown\n if (useMarkdown) {\n plugins.push(Markdown);\n }\n\n // Add Mention plugin if enabled\n if (enableMention) {\n plugins.push(Mention);\n }\n\n // Build base config\n const config: SdMiniEditorConfig = {\n licenseKey: 'GPL',\n getOption: () => this.option,\n plugins,\n toolbar: {\n items: ['bold', 'italic', 'underline', '|', 'fontColor', '|', 'bulletedList', 'numberedList', '|', 'link'],\n shouldNotGroupWhenFull: true,\n },\n placeholder: this.option?.placeholder,\n link: {\n addTargetToExternalLinks: true,\n defaultProtocol: 'https://',\n },\n fontColor: {\n columns: 5,\n documentColors: 10,\n colorPicker: { format: 'hex' },\n },\n };\n\n // Add mention configuration if enabled\n if (enableMention && this.option?.mentionConfig?.feeds) {\n config.mention = {\n feeds: this.option.mentionConfig.feeds,\n };\n }\n\n return config;\n }\n\n constructor() {\n // Setup debounce cho content change\n this.#subscription.add(\n this.#contentChangeSubject.pipe(throttleTime(500, undefined, { leading: true, trailing: true })).subscribe(content => {\n const output = this.#convertOutput(content);\n this.value = output;\n this.#onChange(output);\n this.valueChange.emit(output);\n this.contentChange.emit(output);\n this.option?.onChange?.(output);\n })\n );\n }\n\n ngOnDestroy() {\n this.#subscription.unsubscribe();\n this.#editor?.destroy?.();\n }\n\n /**\n * Kiểm tra có nên enable mention plugin không\n */\n #shouldEnableMention(): boolean {\n return this.option?.enableMention ?? false;\n }\n\n /**\n * Xử lý khi editor ready\n */\n onReady(editor: ClassicEditor) {\n this.#editor = editor;\n\n // Set initial content\n if (this.value) {\n this.setContent(this.value);\n }\n\n // Lắng nghe sự kiện thay đổi nội dung\n editor.model.document.on('change:data', () => {\n const content = editor.getData();\n this.#contentChangeSubject.next(content);\n });\n\n // Lắng nghe focus/blur events\n editor.editing.view.document.on('focus', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.focus.emit(domEvent);\n this.option?.onFocus?.(domEvent);\n });\n\n editor.editing.view.document.on('blur', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.blur.emit(domEvent);\n this.option?.onBlur?.(domEvent);\n });\n\n // Lắng nghe sự kiện mention được chọn\n if (this.#shouldEnableMention()) {\n editor.commands.get('mention')?.on('execute', (_evt, data: any) => {\n const mentionData = data[0];\n this.option?.onMentionSelect?.(mentionData.mention);\n // Trigger content change sau khi insert mention\n const content = editor.getData();\n this.#contentChangeSubject.next(content);\n });\n\n // Custom downcast converter để thay đổi cấu trúc mention HTML\n editor.conversion.for('downcast').attributeToElement({\n model: 'mention',\n view: (mentionData, { writer }) => {\n const data = mentionData as SdMiniEditorMentionItem;\n const rawId = data?.id || '';\n const marker = rawId[0];\n const cleanId = rawId.slice(1);\n\n return writer.createAttributeElement('span', {\n class: 'ck-custom-mention',\n 'data-id': cleanId,\n 'data-marker': marker,\n contenteditable: 'false',\n });\n },\n converterPriority: 'highest',\n });\n\n // Xử lý keyboard để xóa mention 1 lần\n editor.editing.view.document.on('keydown', (evt, data) => {\n const keyEvent = data as { keyCode: number; domEvent: KeyboardEvent };\n // Delete (46) hoặc Backspace (8)\n if (keyEvent.keyCode === 46 || keyEvent.keyCode === 8) {\n const model = editor.model;\n const selection = model.document.selection;\n const position = selection.getFirstPosition();\n if (!position) return;\n\n // Tìm text node có mention attribute\n const node = position.textNode || position.nodeBefore || position.nodeAfter;\n if (node && node.is('$text')) {\n const mentionAttr = node.getAttribute('mention');\n if (mentionAttr) {\n // Xóa toàn bộ text node chứa mention\n model.change(writer => {\n writer.remove(node);\n });\n evt.stop();\n }\n }\n }\n });\n }\n }\n\n /**\n * Convert output theo format (html hoặc markdown)\n * Khi sử dụng CKEditor Markdown plugin, getData() tự động trả về Markdown\n */\n #convertOutput(content: string): string {\n // CKEditor Markdown plugin tự động xử lý conversion\n // Không cần manual conversion nữa\n return content;\n }\n\n /**\n * Set nội dung cho editor\n */\n setContent(content: string) {\n this.#editor?.setData?.(content);\n }\n\n /**\n * Get nội dung từ editor\n */\n getContent(): string {\n if (this.#editor) {\n const html = this.#editor.getData();\n return this.#convertOutput(html);\n }\n return '';\n }\n\n /**\n * Get nội dung HTML gốc (không convert)\n */\n getHtmlContent(): string {\n return this.#editor?.getData?.() || '';\n }\n\n /**\n * Focus vào editor\n */\n focusEditor() {\n this.#editor?.editing?.view?.focus?.();\n }\n\n /**\n * Insert mention vào vị trí con trỏ hiện tại\n */\n insertMention(item: { id: string; name: string; marker?: string }) {\n if (!this.#editor) return;\n\n const firstFeed = this.option?.mentionConfig?.feeds?.[0];\n const marker = item.marker || (firstFeed as any)?.marker || '@';\n\n // Sử dụng CKEditor mention command\n this.#editor.execute('mention', {\n marker,\n mention: {\n id: item.id,\n text: `${marker}${item.name}`,\n },\n });\n }\n\n /**\n * Get danh sách mentions trong nội dung\n */\n getMentions(): { id: string; name: string; marker: string }[] {\n if (!this.#editor) return [];\n\n const mentions: { id: string; name: string; marker: string }[] = [];\n const root = this.#editor.model.document.getRoot();\n if (!root) return mentions;\n\n const range = this.#editor.model.createRangeIn(root);\n\n for (const item of range.getItems()) {\n if (item.is('$text')) {\n const mentionAttr = item.getAttribute('mention');\n if (mentionAttr) {\n const text = (item as any).data as string;\n const marker = text.charAt(0);\n const name = text.substring(1);\n const id = item.getAttribute('data-user-id') as string;\n\n mentions.push({ id, name, marker });\n }\n }\n }\n\n return mentions;\n }\n\n /**\n * ControlValueAccessor: Write value\n */\n writeValue(value: string): void {\n this.value = value || '';\n if (this.#editor) {\n this.setContent(this.value);\n }\n }\n\n /**\n * ControlValueAccessor: Register change callback\n */\n registerOnChange(fn: (value: string) => void): void {\n this.#onChange = fn;\n }\n\n /**\n * ControlValueAccessor: Register touched callback\n */\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn;\n }\n\n /** ControlValueAccessor callbacks */\n #onChange: (value: string) => void = () => {};\n #onTouched: () => void = () => {};\n}\n","<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAyBA;;;;;;;;;;;;;;AAcG;MAeU,YAAY,CAAA;;AAEI,IAAA,MAAM;AAEjC,IAAA,IACI,eAAe,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,MAAM,EAAE,SAAS;IAC/B;;IAGS,KAAK,GAAG,EAAE;IACV,WAAW,GAAG,MAAM,EAAU;;IAG9B,aAAa,GAAG,MAAM,EAAU;;IAGhC,IAAI,GAAG,MAAM,EAAc;;IAG3B,KAAK,GAAG,MAAM,EAAc;;AAG5B,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,oDAAC;IAEhC,MAAM,GAAG,aAAa;AACtB,IAAA,OAAO;AACP,IAAA,aAAa,GAAG,IAAI,YAAY,EAAE;AAClC,IAAA,qBAAqB,GAAG,IAAI,OAAO,EAAU;;AAG7C,IAAA,IAAI,YAAY,GAAA;QACd,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,aAAa,IAAI,KAAK;QACzD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,YAAY,KAAK,UAAU;QAC5D,MAAM,OAAO,GAAU,CAAC,UAAU,EAAE,SAAS,EAAE,S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AAA;AACF,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECpDH,+KAEA,EAAA,MAAA,EAAA,CAAA,0nCAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDyCY,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,cAAc,gTAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,CAAA,EAAA,CAAA;;4FAW7C,YAAY,EAAA,UAAA,EAAA,CAAA;kBAdxB,SAAS;+BACE,gBAAgB,EAAA,UAAA,EACd,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,EAAA,SAAA,EAG9C;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC;AAC3C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,+KAAA,EAAA,MAAA,EAAA,CAAA,0nCAAA,CAAA,EAAA;;sBAIA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAExB,WAAW;uBAAC,mCAAmC;;sBAM/C;;;AEhEH;;AAEG;;;;"}
@@ -32,13 +32,16 @@ class SdModal {
32
32
  lazyLoadContent = input(true, ...(ngDevMode ? [{ debugName: "lazyLoadContent", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
33
33
  hideClose = input(false, ...(ngDevMode ? [{ debugName: "hideClose", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
34
34
  disableBackdropClose = input(true, ...(ngDevMode ? [{ debugName: "disableBackdropClose", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // default to true to keep backward compatibility
35
+ beforeClose = input(undefined, ...(ngDevMode ? [{ debugName: "beforeClose" }] : []));
35
36
  sdClosed = output();
37
+ sdCloseError = output();
36
38
  isOpened = signal(false, ...(ngDevMode ? [{ debugName: "isOpened" }] : []));
37
39
  alreadyOpened = signal(false, ...(ngDevMode ? [{ debugName: "alreadyOpened" }] : []));
38
40
  #isMobile = false;
39
41
  #resolvedWidth = 'md';
40
42
  #bottomSheetRef;
41
43
  #dialogRef;
44
+ #closeRequest;
42
45
  #dialog = inject(MatDialog);
43
46
  #bottomSheet = inject(MatBottomSheet);
44
47
  #destroyRef = inject(DestroyRef);
@@ -72,13 +75,15 @@ class SdModal {
72
75
  if ((!this.view() && this.#isMobile) || this.view() === 'bottom-sheet') {
73
76
  this.#bottomSheetRef = this.#bottomSheet.open(this.templateRef(), {
74
77
  panelClass: this.#resolvePanelClass('sd-modal-bottom-sheet-panel'),
75
- disableClose: this.disableBackdropClose(),
78
+ disableClose: this.disableBackdropClose() || !!this.beforeClose(),
76
79
  });
80
+ this.#bindGuardedDismiss(this.#bottomSheetRef);
77
81
  this.#bottomSheetRef
78
82
  .afterDismissed()
79
83
  .pipe(takeUntilDestroyed(this.#destroyRef))
80
84
  .subscribe(() => {
81
85
  this.isOpened.set(false);
86
+ this.#closeRequest = undefined;
82
87
  this.sdClosed.emit();
83
88
  });
84
89
  }
@@ -87,21 +92,73 @@ class SdModal {
87
92
  width: this.#resolvedWidth,
88
93
  maxWidth: this.#resolvedWidth,
89
94
  panelClass: this.#resolvePanelClass('sd-modal-panel'),
90
- disableClose: this.disableBackdropClose(),
95
+ disableClose: this.disableBackdropClose() || !!this.beforeClose(),
91
96
  });
97
+ this.#bindGuardedDismiss(this.#dialogRef);
92
98
  this.#dialogRef
93
99
  .afterClosed()
94
100
  .pipe(takeUntilDestroyed(this.#destroyRef))
95
101
  .subscribe(() => {
96
102
  this.isOpened.set(false);
103
+ this.#closeRequest = undefined;
97
104
  this.sdClosed.emit();
98
105
  });
99
106
  }
100
107
  };
101
108
  close = () => {
109
+ if (this.beforeClose()) {
110
+ void this.requestClose();
111
+ return;
112
+ }
113
+ this.forceClose();
114
+ };
115
+ requestClose = () => {
116
+ const guard = this.beforeClose();
117
+ if (!guard) {
118
+ this.forceClose();
119
+ return Promise.resolve(true);
120
+ }
121
+ if (this.#closeRequest)
122
+ return this.#closeRequest;
123
+ const request = Promise.resolve()
124
+ .then(() => guard())
125
+ .then(canClose => {
126
+ if (!canClose)
127
+ return false;
128
+ this.forceClose();
129
+ return true;
130
+ })
131
+ .catch((error) => {
132
+ this.sdCloseError.emit(error);
133
+ return false;
134
+ });
135
+ this.#closeRequest = request;
136
+ void request.finally(() => {
137
+ if (this.#closeRequest === request)
138
+ this.#closeRequest = undefined;
139
+ });
140
+ return request;
141
+ };
142
+ forceClose = () => {
102
143
  this.#bottomSheetRef?.dismiss();
103
144
  this.#dialogRef?.close();
104
145
  };
146
+ #bindGuardedDismiss(ref) {
147
+ if (!this.beforeClose() || this.disableBackdropClose())
148
+ return;
149
+ const dismissRef = ref;
150
+ dismissRef
151
+ .backdropClick?.()
152
+ .pipe(takeUntilDestroyed(this.#destroyRef))
153
+ .subscribe(() => this.close());
154
+ dismissRef
155
+ .keydownEvents?.()
156
+ .pipe(takeUntilDestroyed(this.#destroyRef))
157
+ .subscribe((event) => {
158
+ if (event.key === 'Escape')
159
+ this.close();
160
+ });
161
+ }
105
162
  #resolvePanelClass(baseClass) {
106
163
  const customClass = this.modalClass();
107
164
  const classes = [baseClass];
@@ -122,12 +179,12 @@ class SdModal {
122
179
  return classes;
123
180
  }
124
181
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdModal, deps: [], target: i0.ɵɵFactoryTarget.Component });
125
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdModal, isStandalone: true, selector: "sd-modal", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, modalClass: { classPropertyName: "modalClass", publicName: "modalClass", isSignal: true, isRequired: false, transformFunction: null }, lazyLoadContent: { classPropertyName: "lazyLoadContent", publicName: "lazyLoadContent", isSignal: true, isRequired: false, transformFunction: null }, hideClose: { classPropertyName: "hideClose", publicName: "hideClose", isSignal: true, isRequired: false, transformFunction: null }, disableBackdropClose: { classPropertyName: "disableBackdropClose", publicName: "disableBackdropClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdClosed: "sdClosed" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }, { propertyName: "modal", first: true, predicate: ["modal"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef>\n <div\n class=\"sd-modal-root\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\">\n @if (!lazyLoadContent() || alreadyOpened()) {\n @if (title()) {\n <div class=\"sd-modal-header\">\n <div class=\"sd-modal-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-modal-title T18M\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-modal-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <button\n type=\"button\"\n class=\"sd-modal-close-btn\"\n aria-label=\"Close\"\n (click)=\"close()\"\n [attr.data-autoId]=\"closeButtonAutoId()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"sd-modal-body\">\n <ng-content></ng-content>\n </div>\n <div class=\"sd-modal-footer\" #footer>\n <div class=\"sd-modal-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-modal-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n }\n </div>\n</ng-template>\n", styles: [".sd-modal-root button:focus{outline:none!important}.sd-modal-panel,.sd-modal-bottom-sheet-panel{--sd-modal-radius: var(--sd-overlay-radius, 24px);--sd-modal-bottom-sheet-radius: var(--sd-overlay-bottom-sheet-radius, 28px);--sd-modal-surface: var(--sd-surface, #fff);--sd-modal-border: var(--sd-border, #dde0e5);--sd-modal-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12)}.sd-modal-panel .mat-mdc-dialog-container{--mdc-dialog-container-shape: var(--sd-modal-radius);--mat-dialog-container-shape: var(--sd-modal-radius)}.sd-modal-panel .mat-mdc-dialog-surface,.sd-modal-panel .mdc-dialog__surface,.sd-modal-panel .mat-dialog-container{padding:0!important;border-radius:var(--sd-modal-radius)!important;background:var(--sd-modal-surface);max-height:calc(100vh - 32px);overflow:hidden;box-shadow:var(--sd-modal-shadow)}.sd-modal-panel .mat-dialog-container .mat-dialog-content,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-content{max-height:80vh}.sd-modal-panel .mat-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-actions{min-height:auto;margin-bottom:0;padding:0}.sd-modal-root{display:flex;width:100%;max-height:inherit;flex-direction:column;background:var(--sd-modal-surface, var(--sd-surface, #fff));border-radius:inherit;overflow:hidden}.sd-modal-header{min-height:64px;padding:16px;display:flex;align-items:center;gap:16px}.sd-modal-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-modal-header-right{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex:0 0 auto}.sd-modal-title{min-width:0}.sd-modal-body{flex:1 1 auto;min-height:0;width:100%;max-height:80vh;overflow:auto;padding:0}.sd-modal-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;margin-left:8px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-modal-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-modal-close-btn:active{background:var(--sd-border)}.sd-modal-close-btn:focus{outline:none!important}.sd-modal-close-btn:focus-visible{outline:2px solid var(--sd-primary)!important;outline-offset:2px}.sd-modal-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-modal-bottom-sheet-panel.mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel.mat-mdc-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-mdc-bottom-sheet-container{padding:0;min-width:100vw;box-sizing:border-box;outline:0;max-height:min(80vh,100vh - 16px);overflow:hidden;border-radius:var(--sd-modal-bottom-sheet-radius) var(--sd-modal-bottom-sheet-radius) 0 0!important;background:var(--sd-modal-surface);box-shadow:var(--sd-modal-shadow);display:flex;flex-direction:column}.sd-modal-footer{min-height:56px;padding:16px;border-top:1px solid var(--sd-modal-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-modal-footer-left,.sd-modal-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-modal-footer-left{flex:1 1 auto}.sd-modal-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-modal-footer-left:empty,.sd-modal-footer-right:empty{display:none}.sd-modal-footer:has(.sd-modal-footer-left:empty):has(.sd-modal-footer-right:empty){display:none}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatBottomSheetModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: MatButtonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
182
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdModal, isStandalone: true, selector: "sd-modal", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, modalClass: { classPropertyName: "modalClass", publicName: "modalClass", isSignal: true, isRequired: false, transformFunction: null }, lazyLoadContent: { classPropertyName: "lazyLoadContent", publicName: "lazyLoadContent", isSignal: true, isRequired: false, transformFunction: null }, hideClose: { classPropertyName: "hideClose", publicName: "hideClose", isSignal: true, isRequired: false, transformFunction: null }, disableBackdropClose: { classPropertyName: "disableBackdropClose", publicName: "disableBackdropClose", isSignal: true, isRequired: false, transformFunction: null }, beforeClose: { classPropertyName: "beforeClose", publicName: "beforeClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdClosed: "sdClosed", sdCloseError: "sdCloseError" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }, { propertyName: "modal", first: true, predicate: ["modal"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef>\n <div\n class=\"sd-modal-root\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\">\n @if (!lazyLoadContent() || alreadyOpened()) {\n @if (title()) {\n <div class=\"sd-modal-header\">\n <div class=\"sd-modal-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-modal-title T18M\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-modal-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <button\n type=\"button\"\n class=\"sd-modal-close-btn\"\n aria-label=\"Close\"\n (click)=\"close()\"\n [attr.data-autoId]=\"closeButtonAutoId()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"sd-modal-body\">\n <ng-content></ng-content>\n </div>\n <div class=\"sd-modal-footer\" #footer>\n <div class=\"sd-modal-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-modal-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n }\n </div>\n</ng-template>\n", styles: [".sd-modal-root button:focus{outline:none!important}.sd-modal-panel,.sd-modal-bottom-sheet-panel{--sd-modal-radius: var(--sd-overlay-radius, 24px);--sd-modal-bottom-sheet-radius: var(--sd-overlay-bottom-sheet-radius, 28px);--sd-modal-surface: var(--sd-surface, #fff);--sd-modal-border: var(--sd-border, #dde0e5);--sd-modal-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12)}.sd-modal-panel .mat-mdc-dialog-container{--mdc-dialog-container-shape: var(--sd-modal-radius);--mat-dialog-container-shape: var(--sd-modal-radius)}.sd-modal-panel .mat-mdc-dialog-surface,.sd-modal-panel .mdc-dialog__surface,.sd-modal-panel .mat-dialog-container{padding:0!important;border-radius:var(--sd-modal-radius)!important;background:var(--sd-modal-surface);max-height:calc(100vh - 32px);overflow:hidden;box-shadow:var(--sd-modal-shadow)}.sd-modal-panel .mat-dialog-container .mat-dialog-content,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-content{max-height:80vh}.sd-modal-panel .mat-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-actions{min-height:auto;margin-bottom:0;padding:0}.sd-modal-root{display:flex;width:100%;max-height:inherit;flex-direction:column;background:var(--sd-modal-surface, var(--sd-surface, #fff));border-radius:inherit;overflow:hidden}.sd-modal-header{min-height:64px;padding:16px;display:flex;align-items:center;gap:16px}.sd-modal-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-modal-header-right{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex:0 0 auto}.sd-modal-title{min-width:0}.sd-modal-body{flex:1 1 auto;min-height:0;width:100%;max-height:80vh;overflow:auto;padding:0}.sd-modal-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;margin-left:8px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-modal-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-modal-close-btn:active{background:var(--sd-border)}.sd-modal-close-btn:focus{outline:none!important}.sd-modal-close-btn:focus-visible{outline:2px solid var(--sd-primary)!important;outline-offset:2px}.sd-modal-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-modal-bottom-sheet-panel.mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel.mat-mdc-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-mdc-bottom-sheet-container{padding:0;min-width:100vw;box-sizing:border-box;outline:0;max-height:min(80vh,100vh - 16px);overflow:hidden;border-radius:var(--sd-modal-bottom-sheet-radius) var(--sd-modal-bottom-sheet-radius) 0 0!important;background:var(--sd-modal-surface);box-shadow:var(--sd-modal-shadow);display:flex;flex-direction:column}.sd-modal-footer{min-height:56px;padding:16px;border-top:1px solid var(--sd-modal-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-modal-footer-left,.sd-modal-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-modal-footer-left{flex:1 1 auto}.sd-modal-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-modal-footer-left:empty,.sd-modal-footer-right:empty{display:none}.sd-modal-footer:has(.sd-modal-footer-left:empty):has(.sd-modal-footer-right:empty){display:none}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatBottomSheetModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: MatButtonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
126
183
  }
127
184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdModal, decorators: [{
128
185
  type: Component,
129
186
  args: [{ selector: 'sd-modal', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [SdIcon, CommonModule, MatBottomSheetModule, MatDialogModule, MatDividerModule, MatButtonModule], template: "<ng-template #templateRef>\n <div\n class=\"sd-modal-root\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\">\n @if (!lazyLoadContent() || alreadyOpened()) {\n @if (title()) {\n <div class=\"sd-modal-header\">\n <div class=\"sd-modal-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-modal-title T18M\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-modal-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <button\n type=\"button\"\n class=\"sd-modal-close-btn\"\n aria-label=\"Close\"\n (click)=\"close()\"\n [attr.data-autoId]=\"closeButtonAutoId()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"sd-modal-body\">\n <ng-content></ng-content>\n </div>\n <div class=\"sd-modal-footer\" #footer>\n <div class=\"sd-modal-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-modal-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n }\n </div>\n</ng-template>\n", styles: [".sd-modal-root button:focus{outline:none!important}.sd-modal-panel,.sd-modal-bottom-sheet-panel{--sd-modal-radius: var(--sd-overlay-radius, 24px);--sd-modal-bottom-sheet-radius: var(--sd-overlay-bottom-sheet-radius, 28px);--sd-modal-surface: var(--sd-surface, #fff);--sd-modal-border: var(--sd-border, #dde0e5);--sd-modal-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12)}.sd-modal-panel .mat-mdc-dialog-container{--mdc-dialog-container-shape: var(--sd-modal-radius);--mat-dialog-container-shape: var(--sd-modal-radius)}.sd-modal-panel .mat-mdc-dialog-surface,.sd-modal-panel .mdc-dialog__surface,.sd-modal-panel .mat-dialog-container{padding:0!important;border-radius:var(--sd-modal-radius)!important;background:var(--sd-modal-surface);max-height:calc(100vh - 32px);overflow:hidden;box-shadow:var(--sd-modal-shadow)}.sd-modal-panel .mat-dialog-container .mat-dialog-content,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-content,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-content{max-height:80vh}.sd-modal-panel .mat-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-dialog-container .mat-mdc-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-dialog-actions,.sd-modal-panel .mat-mdc-dialog-container .mat-mdc-dialog-actions{min-height:auto;margin-bottom:0;padding:0}.sd-modal-root{display:flex;width:100%;max-height:inherit;flex-direction:column;background:var(--sd-modal-surface, var(--sd-surface, #fff));border-radius:inherit;overflow:hidden}.sd-modal-header{min-height:64px;padding:16px;display:flex;align-items:center;gap:16px}.sd-modal-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-modal-header-right{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex:0 0 auto}.sd-modal-title{min-width:0}.sd-modal-body{flex:1 1 auto;min-height:0;width:100%;max-height:80vh;overflow:auto;padding:0}.sd-modal-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;margin-left:8px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-modal-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-modal-close-btn:active{background:var(--sd-border)}.sd-modal-close-btn:focus{outline:none!important}.sd-modal-close-btn:focus-visible{outline:2px solid var(--sd-primary)!important;outline-offset:2px}.sd-modal-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-modal-bottom-sheet-panel.mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel.mat-mdc-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-bottom-sheet-container,.sd-modal-bottom-sheet-panel .mat-mdc-bottom-sheet-container{padding:0;min-width:100vw;box-sizing:border-box;outline:0;max-height:min(80vh,100vh - 16px);overflow:hidden;border-radius:var(--sd-modal-bottom-sheet-radius) var(--sd-modal-bottom-sheet-radius) 0 0!important;background:var(--sd-modal-surface);box-shadow:var(--sd-modal-shadow);display:flex;flex-direction:column}.sd-modal-footer{min-height:56px;padding:16px;border-top:1px solid var(--sd-modal-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-modal-footer-left,.sd-modal-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-modal-footer-left{flex:1 1 auto}.sd-modal-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-modal-footer-left:empty,.sd-modal-footer-right:empty{display:none}.sd-modal-footer:has(.sd-modal-footer-left:empty):has(.sd-modal-footer-right:empty){display:none}\n"] }]
130
- }], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], modal: [{ type: i0.ViewChild, args: ['modal', { isSignal: true }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], modalClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalClass", required: false }] }], lazyLoadContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyLoadContent", required: false }] }], hideClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideClose", required: false }] }], disableBackdropClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBackdropClose", required: false }] }], sdClosed: [{ type: i0.Output, args: ["sdClosed"] }] } });
187
+ }], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], modal: [{ type: i0.ViewChild, args: ['modal', { isSignal: true }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], modalClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalClass", required: false }] }], lazyLoadContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyLoadContent", required: false }] }], hideClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideClose", required: false }] }], disableBackdropClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBackdropClose", required: false }] }], beforeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "beforeClose", required: false }] }], sdClosed: [{ type: i0.Output, args: ["sdClosed"] }], sdCloseError: [{ type: i0.Output, args: ["sdCloseError"] }] } });
131
188
 
132
189
  /**
133
190
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-components-modal.mjs","sources":["../../../projects/sdcorejs-angular/components/modal/src/modal.component.ts","../../../projects/sdcorejs-angular/components/modal/src/modal.component.html","../../../projects/sdcorejs-angular/components/modal/sdcorejs-angular-components-modal.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n TemplateRef,\n booleanAttribute,\n computed,\n inject,\n input,\n output,\n signal,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatBottomSheet, MatBottomSheetModule, MatBottomSheetRef } from '@angular/material/bottom-sheet';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { Color, Size } from '@sdcorejs/utils/models';\nimport { SdIcon } from '@sdcorejs/angular/modules/icon';\n\n@Component({\n selector: 'sd-modal',\n templateUrl: './modal.component.html',\n styleUrl: './modal.component.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [SdIcon, CommonModule, MatBottomSheetModule, MatDialogModule, MatDividerModule, MatButtonModule],\n})\nexport class SdModal {\n static index = signal(0);\n\n templateRef = viewChild.required<TemplateRef<any>>('templateRef');\n modal = viewChild<ElementRef>('modal');\n\n // autoId prefix `modal-`. Lưu ý: footer/body buttons render qua <ng-content> nên consumer phải\n // tự đặt [attr.data-autoId] cho các nút đó. Component chỉ tự bind autoId cho NÚT ĐÓNG (X icon).\n readonly autoIdInput = input<string | undefined | null>(undefined, { alias: 'autoId' });\n readonly autoId = computed(() => (this.autoIdInput() ? `components-modal-${this.autoIdInput()}` : undefined));\n readonly closeButtonAutoId = computed(() => (this.autoId() ? `${this.autoId()}-close` : undefined));\n readonly dataOpened = computed(() => (this.isOpened() ? 'true' : 'false'));\n\n title = input<string, string | null | undefined>('', { transform: v => v ?? '' });\n color = input<Color, Color | null | undefined>('primary', { transform: v => v ?? 'primary' });\n width = input<Size | string, Size | string | null | undefined>('md', { transform: v => v ?? 'md' });\n height = input<string, string | null | undefined>('auto', { transform: v => v ?? 'auto' });\n view = input<'dialog' | 'bottom-sheet' | undefined, 'dialog' | 'bottom-sheet' | null | undefined>(undefined, {\n transform: v => v ?? undefined,\n });\n modalClass = input<string | string[] | Record<string, boolean>, string | string[] | Record<string, boolean> | null | undefined>('', {\n transform: v => v ?? '',\n });\n lazyLoadContent = input(true, { transform: booleanAttribute });\n hideClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n disableBackdropClose = input<boolean, boolean | ''>(true, { transform: booleanAttribute }); // default to true to keep backward compatibility\n\n sdClosed = output<void>();\n\n isOpened = signal(false);\n alreadyOpened = signal(false);\n\n #isMobile = false;\n #resolvedWidth = 'md';\n #bottomSheetRef!: MatBottomSheetRef<any>;\n #dialogRef!: MatDialogRef<any>;\n\n #dialog = inject(MatDialog);\n #bottomSheet = inject(MatBottomSheet);\n #destroyRef = inject(DestroyRef);\n\n constructor() {\n this.#isMobile = BrowserUtilities.isMobile();\n }\n\n #resolveWidth(): string {\n const w = this.width() || '80vw';\n if (this.#isMobile) return w;\n switch (w) {\n case 'lg':\n return '80vw';\n case 'md':\n return '60vw';\n case 'sm':\n return '40vw';\n case 'sx':\n return '20vw';\n default:\n return w;\n }\n }\n\n open = (): void => {\n if (this.isOpened()) {\n return;\n }\n this.alreadyOpened.set(true);\n this.isOpened.set(true);\n this.#resolvedWidth = this.#resolveWidth();\n\n if ((!this.view() && this.#isMobile) || this.view() === 'bottom-sheet') {\n this.#bottomSheetRef = this.#bottomSheet.open(this.templateRef(), {\n panelClass: this.#resolvePanelClass('sd-modal-bottom-sheet-panel'),\n disableClose: this.disableBackdropClose(),\n });\n this.#bottomSheetRef\n .afterDismissed()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(() => {\n this.isOpened.set(false);\n this.sdClosed.emit();\n });\n } else {\n this.#dialogRef = this.#dialog.open(this.templateRef(), {\n width: this.#resolvedWidth,\n maxWidth: this.#resolvedWidth,\n panelClass: this.#resolvePanelClass('sd-modal-panel'),\n disableClose: this.disableBackdropClose(),\n });\n this.#dialogRef\n .afterClosed()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(() => {\n this.isOpened.set(false);\n this.sdClosed.emit();\n });\n }\n };\n\n close = (): void => {\n this.#bottomSheetRef?.dismiss();\n this.#dialogRef?.close();\n };\n\n #resolvePanelClass(baseClass: string): string[] {\n const customClass = this.modalClass();\n const classes = [baseClass];\n\n if (typeof customClass === 'string') {\n classes.push(...customClass.split(/\\s+/).filter(Boolean));\n return classes;\n }\n\n if (Array.isArray(customClass)) {\n classes.push(...customClass.filter(Boolean));\n return classes;\n }\n\n if (customClass && typeof customClass === 'object') {\n Object.entries(customClass).forEach(([className, enabled]) => {\n if (enabled) classes.push(className);\n });\n }\n\n return classes;\n }\n}\n","<ng-template #templateRef>\n <div\n class=\"sd-modal-root\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\">\n @if (!lazyLoadContent() || alreadyOpened()) {\n @if (title()) {\n <div class=\"sd-modal-header\">\n <div class=\"sd-modal-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-modal-title T18M\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-modal-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <button\n type=\"button\"\n class=\"sd-modal-close-btn\"\n aria-label=\"Close\"\n (click)=\"close()\"\n [attr.data-autoId]=\"closeButtonAutoId()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"sd-modal-body\">\n <ng-content></ng-content>\n </div>\n <div class=\"sd-modal-footer\" #footer>\n <div class=\"sd-modal-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-modal-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n }\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAkCa,OAAO,CAAA;AAClB,IAAA,OAAO,KAAK,GAAG,MAAM,CAAC,CAAC,iDAAC;AAExB,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmB,aAAa,CAAC;AACjE,IAAA,KAAK,GAAG,SAAS,CAAa,OAAO,iDAAC;;;AAI7B,IAAA,WAAW,GAAG,KAAK,CAA4B,SAAS,+CAAI,KAAK,EAAE,QAAQ,EAAA,CAAA,GAAA,CAAjB,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAC;IAC9E,MAAM,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,CAAA,iBAAA,EAAoB,IAAI,CAAC,WAAW,EAAE,CAAA,CAAE,GAAG,SAAS,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,E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AAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,IAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,MAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,YAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,oBAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEtCvC;;AAEG;;;;"}
1
+ {"version":3,"file":"sdcorejs-angular-components-modal.mjs","sources":["../../../projects/sdcorejs-angular/components/modal/src/modal.component.ts","../../../projects/sdcorejs-angular/components/modal/src/modal.component.html","../../../projects/sdcorejs-angular/components/modal/sdcorejs-angular-components-modal.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n TemplateRef,\n booleanAttribute,\n computed,\n inject,\n input,\n output,\n signal,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatBottomSheet, MatBottomSheetModule, MatBottomSheetRef } from '@angular/material/bottom-sheet';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { Color, Size } from '@sdcorejs/utils/models';\nimport { SdIcon } from '@sdcorejs/angular/modules/icon';\nimport { Observable } from 'rxjs';\n\nexport type SdModalBeforeClose = () => boolean | Promise<boolean>;\n\ninterface SdModalDismissRef {\n backdropClick?: () => Observable<MouseEvent>;\n keydownEvents?: () => Observable<KeyboardEvent>;\n}\n\n@Component({\n selector: 'sd-modal',\n templateUrl: './modal.component.html',\n styleUrl: './modal.component.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [SdIcon, CommonModule, MatBottomSheetModule, MatDialogModule, MatDividerModule, MatButtonModule],\n})\nexport class SdModal {\n static index = signal(0);\n\n templateRef = viewChild.required<TemplateRef<any>>('templateRef');\n modal = viewChild<ElementRef>('modal');\n\n // autoId prefix `modal-`. Lưu ý: footer/body buttons render qua <ng-content> nên consumer phải\n // tự đặt [attr.data-autoId] cho các nút đó. Component chỉ tự bind autoId cho NÚT ĐÓNG (X icon).\n readonly autoIdInput = input<string | undefined | null>(undefined, { alias: 'autoId' });\n readonly autoId = computed(() => (this.autoIdInput() ? `components-modal-${this.autoIdInput()}` : undefined));\n readonly closeButtonAutoId = computed(() => (this.autoId() ? `${this.autoId()}-close` : undefined));\n readonly dataOpened = computed(() => (this.isOpened() ? 'true' : 'false'));\n\n title = input<string, string | null | undefined>('', { transform: v => v ?? '' });\n color = input<Color, Color | null | undefined>('primary', { transform: v => v ?? 'primary' });\n width = input<Size | string, Size | string | null | undefined>('md', { transform: v => v ?? 'md' });\n height = input<string, string | null | undefined>('auto', { transform: v => v ?? 'auto' });\n view = input<'dialog' | 'bottom-sheet' | undefined, 'dialog' | 'bottom-sheet' | null | undefined>(undefined, {\n transform: v => v ?? undefined,\n });\n modalClass = input<string | string[] | Record<string, boolean>, string | string[] | Record<string, boolean> | null | undefined>('', {\n transform: v => v ?? '',\n });\n lazyLoadContent = input(true, { transform: booleanAttribute });\n hideClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n disableBackdropClose = input<boolean, boolean | ''>(true, { transform: booleanAttribute }); // default to true to keep backward compatibility\n beforeClose = input<SdModalBeforeClose | undefined>(undefined);\n\n sdClosed = output<void>();\n sdCloseError = output<unknown>();\n\n isOpened = signal(false);\n alreadyOpened = signal(false);\n\n #isMobile = false;\n #resolvedWidth = 'md';\n #bottomSheetRef!: MatBottomSheetRef<any>;\n #dialogRef!: MatDialogRef<any>;\n #closeRequest?: Promise<boolean>;\n\n #dialog = inject(MatDialog);\n #bottomSheet = inject(MatBottomSheet);\n #destroyRef = inject(DestroyRef);\n\n constructor() {\n this.#isMobile = BrowserUtilities.isMobile();\n }\n\n #resolveWidth(): string {\n const w = this.width() || '80vw';\n if (this.#isMobile) return w;\n switch (w) {\n case 'lg':\n return '80vw';\n case 'md':\n return '60vw';\n case 'sm':\n return '40vw';\n case 'sx':\n return '20vw';\n default:\n return w;\n }\n }\n\n open = (): void => {\n if (this.isOpened()) {\n return;\n }\n this.alreadyOpened.set(true);\n this.isOpened.set(true);\n this.#resolvedWidth = this.#resolveWidth();\n\n if ((!this.view() && this.#isMobile) || this.view() === 'bottom-sheet') {\n this.#bottomSheetRef = this.#bottomSheet.open(this.templateRef(), {\n panelClass: this.#resolvePanelClass('sd-modal-bottom-sheet-panel'),\n disableClose: this.disableBackdropClose() || !!this.beforeClose(),\n });\n this.#bindGuardedDismiss(this.#bottomSheetRef);\n this.#bottomSheetRef\n .afterDismissed()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(() => {\n this.isOpened.set(false);\n this.#closeRequest = undefined;\n this.sdClosed.emit();\n });\n } else {\n this.#dialogRef = this.#dialog.open(this.templateRef(), {\n width: this.#resolvedWidth,\n maxWidth: this.#resolvedWidth,\n panelClass: this.#resolvePanelClass('sd-modal-panel'),\n disableClose: this.disableBackdropClose() || !!this.beforeClose(),\n });\n this.#bindGuardedDismiss(this.#dialogRef);\n this.#dialogRef\n .afterClosed()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(() => {\n this.isOpened.set(false);\n this.#closeRequest = undefined;\n this.sdClosed.emit();\n });\n }\n };\n\n close = (): void => {\n if (this.beforeClose()) {\n void this.requestClose();\n return;\n }\n this.forceClose();\n };\n\n requestClose = (): Promise<boolean> => {\n const guard = this.beforeClose();\n if (!guard) {\n this.forceClose();\n return Promise.resolve(true);\n }\n if (this.#closeRequest) return this.#closeRequest;\n\n const request = Promise.resolve()\n .then(() => guard())\n .then(canClose => {\n if (!canClose) return false;\n this.forceClose();\n return true;\n })\n .catch((error: unknown) => {\n this.sdCloseError.emit(error);\n return false;\n });\n\n this.#closeRequest = request;\n void request.finally(() => {\n if (this.#closeRequest === request) this.#closeRequest = undefined;\n });\n return request;\n };\n\n forceClose = (): void => {\n this.#bottomSheetRef?.dismiss();\n this.#dialogRef?.close();\n };\n\n #bindGuardedDismiss(ref: MatDialogRef<any> | MatBottomSheetRef<any>): void {\n if (!this.beforeClose() || this.disableBackdropClose()) return;\n\n const dismissRef = ref as SdModalDismissRef;\n dismissRef\n .backdropClick?.()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(() => this.close());\n dismissRef\n .keydownEvents?.()\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe((event: KeyboardEvent) => {\n if (event.key === 'Escape') this.close();\n });\n }\n\n #resolvePanelClass(baseClass: string): string[] {\n const customClass = this.modalClass();\n const classes = [baseClass];\n\n if (typeof customClass === 'string') {\n classes.push(...customClass.split(/\\s+/).filter(Boolean));\n return classes;\n }\n\n if (Array.isArray(customClass)) {\n classes.push(...customClass.filter(Boolean));\n return classes;\n }\n\n if (customClass && typeof customClass === 'object') {\n Object.entries(customClass).forEach(([className, enabled]) => {\n if (enabled) classes.push(className);\n });\n }\n\n return classes;\n }\n}\n","<ng-template #templateRef>\n <div\n class=\"sd-modal-root\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\">\n @if (!lazyLoadContent() || alreadyOpened()) {\n @if (title()) {\n <div class=\"sd-modal-header\">\n <div class=\"sd-modal-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-modal-title T18M\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-modal-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <button\n type=\"button\"\n class=\"sd-modal-close-btn\"\n aria-label=\"Close\"\n (click)=\"close()\"\n [attr.data-autoId]=\"closeButtonAutoId()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"sd-modal-body\">\n <ng-content></ng-content>\n </div>\n <div class=\"sd-modal-footer\" #footer>\n <div class=\"sd-modal-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-modal-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n }\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MA0Ca,OAAO,CAAA;AAClB,IAAA,OAAO,KAAK,GAAG,MAAM,CAAC,CAAC,iDAAC;AAExB,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmB,aAAa,CAAC;AACjE,IAAA,KAAK,G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