@sd-angular/core 19.0.31 → 19.0.32

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 (65) hide show
  1. package/components/data-state/index.d.ts +1 -0
  2. package/components/data-state/src/data-state.component.d.ts +41 -0
  3. package/components/import-excel/src/import-excel.component.d.ts +23 -1
  4. package/components/index.d.ts +1 -0
  5. package/components/quick-action/src/quick-action.component.d.ts +3 -1
  6. package/components/table/src/components/selector-action/selector-action.component.d.ts +11 -0
  7. package/components/table/src/table.component.d.ts +10 -1
  8. package/components/upload-file/src/upload-file.component.d.ts +5 -1
  9. package/fesm2022/sd-angular-core-components-button.mjs +2 -2
  10. package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
  11. package/fesm2022/sd-angular-core-components-data-state.mjs +72 -0
  12. package/fesm2022/sd-angular-core-components-data-state.mjs.map +1 -0
  13. package/fesm2022/sd-angular-core-components-form-generic.mjs +14 -14
  14. package/fesm2022/sd-angular-core-components-form-generic.mjs.map +1 -1
  15. package/fesm2022/sd-angular-core-components-import-excel.mjs +67 -18
  16. package/fesm2022/sd-angular-core-components-import-excel.mjs.map +1 -1
  17. package/fesm2022/sd-angular-core-components-inform.mjs +6 -6
  18. package/fesm2022/sd-angular-core-components-inform.mjs.map +1 -1
  19. package/fesm2022/sd-angular-core-components-query-bar.mjs +3 -3
  20. package/fesm2022/sd-angular-core-components-query-bar.mjs.map +1 -1
  21. package/fesm2022/sd-angular-core-components-query-builder.mjs +1 -1
  22. package/fesm2022/sd-angular-core-components-query-builder.mjs.map +1 -1
  23. package/fesm2022/sd-angular-core-components-quick-action.mjs +4 -2
  24. package/fesm2022/sd-angular-core-components-quick-action.mjs.map +1 -1
  25. package/fesm2022/sd-angular-core-components-stepper.mjs +2 -2
  26. package/fesm2022/sd-angular-core-components-stepper.mjs.map +1 -1
  27. package/fesm2022/sd-angular-core-components-table.mjs +119 -26
  28. package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
  29. package/fesm2022/sd-angular-core-components-tree.mjs +1 -1
  30. package/fesm2022/sd-angular-core-components-tree.mjs.map +1 -1
  31. package/fesm2022/sd-angular-core-components-upload-file.mjs +20 -6
  32. package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
  33. package/fesm2022/sd-angular-core-components.mjs +1 -0
  34. package/fesm2022/sd-angular-core-components.mjs.map +1 -1
  35. package/fesm2022/sd-angular-core-forms-autocomplete.mjs +247 -59
  36. package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
  37. package/fesm2022/sd-angular-core-forms-date-range.mjs +2 -2
  38. package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
  39. package/fesm2022/sd-angular-core-forms-date.mjs +2 -2
  40. package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
  41. package/fesm2022/sd-angular-core-forms-datetime.mjs +2 -2
  42. package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
  43. package/fesm2022/sd-angular-core-forms-select.mjs +290 -67
  44. package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
  45. package/fesm2022/sd-angular-core-i18n.mjs +155 -0
  46. package/fesm2022/sd-angular-core-i18n.mjs.map +1 -1
  47. package/fesm2022/sd-angular-core-modules-layout.mjs +6 -6
  48. package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
  49. package/fesm2022/sd-angular-core-services-confirm.mjs +43 -7
  50. package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
  51. package/fesm2022/sd-angular-core-services-notify.mjs +2 -2
  52. package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
  53. package/fesm2022/sd-angular-core-utilities-read-state.mjs +87 -0
  54. package/fesm2022/sd-angular-core-utilities-read-state.mjs.map +1 -0
  55. package/fesm2022/sd-angular-core-utilities.mjs +1 -0
  56. package/fesm2022/sd-angular-core-utilities.mjs.map +1 -1
  57. package/forms/autocomplete/src/autocomplete.component.d.ts +13 -2
  58. package/forms/select/src/select.component.d.ts +11 -1
  59. package/i18n/src/en.d.ts +31 -0
  60. package/package.json +9 -1
  61. package/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +4 -0
  62. package/services/confirm/src/lib/confirm.service.d.ts +6 -0
  63. package/utilities/index.d.ts +1 -0
  64. package/utilities/read-state/index.d.ts +1 -0
  65. package/utilities/read-state/src/read-state.d.ts +37 -0
@@ -1,6 +1,6 @@
1
1
  import { CommonModule } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { inject, Component, Injectable } from '@angular/core';
3
+ import { inject, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
4
4
  import { FormsModule } from '@angular/forms';
5
5
  import * as i1 from '@angular/material/dialog';
6
6
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
@@ -19,6 +19,20 @@ class DialogConfirmComponent {
19
19
  id = `I${Utilities.generateUuid()}`;
20
20
  dialogRef = inject((MatDialogRef));
21
21
  data = inject(MAT_DIALOG_DATA);
22
+ iconTone = this.data.yesButtonColor || 'primary';
23
+ resolvedIcon = this.data.icon?.trim() ||
24
+ (this.iconTone === 'error'
25
+ ? 'delete'
26
+ : this.iconTone === 'warning'
27
+ ? 'warning_amber'
28
+ : this.data.input
29
+ ? 'edit_note'
30
+ : this.data.date
31
+ ? 'today'
32
+ : this.data.radio
33
+ ? 'list'
34
+ : 'check_circle');
35
+ hasFields = !!(this.data.input || this.data.date || this.data.radio);
22
36
  constructor() {
23
37
  if (this.data?.input) {
24
38
  this.value = this.data?.input?.defaultValue ?? '';
@@ -46,11 +60,11 @@ class DialogConfirmComponent {
46
60
  }
47
61
  };
48
62
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogConfirmComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
49
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DialogConfirmComponent, isStandalone: true, selector: "sd-dialog-confirm", ngImport: i0, template: "<div mat-dialog-title class=\"\">\n @if (data.icon) {\n <mat-icon>\n {{ data.icon }}\n </mat-icon>\n }\n <span class=\"T24M\" [innerHtml]=\"data.title || 'Confirm'\"></span>\n</div>\n<div mat-dialog-content>\n <div class=\"T14R mb-4\" [innerHtml]=\"data.message\"></div>\n @if (data.input) {\n <sd-textarea [placeholder]=\"data.input.placeholder\" [(model)]=\"value\" [rows]=\"5\" [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n</div>\n<div mat-dialog-actions align=\"end\">\n @if (data.noTitle) {\n <sd-button [color]=\"data.noButtonColor || 'secondary'\" [title]=\"data.noTitle\" (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n class=\"ml-8\"\n type=\"fill\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"required && !value\"\n cdkFocusInitial\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host ::ng-deep .mat-dialog-title{display:flex;align-items:center;justify-content:flex-start}:host ::ng-deep .mat-dialog-title .mat-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title .mat-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title .mat-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title .mat-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title .mat-icon.error{color:var(--sd-error)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdRadio, selector: "sd-radio", inputs: ["autoId", "name", "form", "label", "placeholder", "display", "items", "valueField", "displayField", "required", "inlineError", "disabled", "viewed", "color", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange"] }] });
63
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DialogConfirmComponent, isStandalone: true, selector: "sd-dialog-confirm", ngImport: i0, template: "<div mat-dialog-content class=\"sd-dialog-confirm__content\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <div class=\"sd-dialog-confirm__header\">\n <span class=\"sd-dialog-confirm__icon\" aria-hidden=\"true\" [attr.data-icon]=\"resolvedIcon\" [attr.data-tone]=\"iconTone\">\n <mat-icon fontSet=\"material-icons-outlined\">{{ resolvedIcon }}</mat-icon>\n </span>\n <div class=\"sd-dialog-confirm__copy\">\n <h2 mat-dialog-title class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n @if (data.message) {\n <div class=\"sd-dialog-confirm__message\" [innerHtml]=\"data.message\"></div>\n }\n </div>\n </div>\n @if (hasFields) {\n <div class=\"sd-dialog-confirm__fields\">\n @if (data.input) {\n <sd-textarea\n [label]=\"data.input.label\"\n [placeholder]=\"data.input.placeholder\"\n [(model)]=\"value\"\n [rows]=\"3\"\n [required]=\"data.input.required\"\n [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n </div>\n }\n</div>\n<div mat-dialog-actions align=\"end\" class=\"sd-dialog-confirm__actions\">\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n size=\"sm\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n size=\"sm\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"\n required &&\n (value === undefined ||\n value === null ||\n value === '' ||\n (data.input && !value.trim()) ||\n (value.length !== undefined && value.length === 0))\n \"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;min-height:0;max-height:calc(100dvh - 32px);padding:24px;overflow:hidden}.sd-dialog-confirm__content{min-height:0;max-height:none;margin:0;padding:0;color:var(--sd-black500)}.sd-dialog-confirm__header{display:flex;align-items:flex-start;gap:12px}.sd-dialog-confirm__icon{display:grid;place-items:center;flex:0 0 40px;width:40px;height:40px;border-radius:8px;color:var(--sd-primary-dark);background:var(--sd-primary-light)}.sd-dialog-confirm__icon[data-tone=success]{color:var(--sd-success-dark);background:var(--sd-success-light)}.sd-dialog-confirm__icon[data-tone=info]{color:var(--sd-info-dark);background:var(--sd-info-light)}.sd-dialog-confirm__icon[data-tone=warning]{color:var(--sd-warning-dark);background:var(--sd-warning-light)}.sd-dialog-confirm__icon[data-tone=error]{color:var(--sd-error-dark);background:var(--sd-error-light)}.sd-dialog-confirm__icon mat-icon{width:22px;height:22px;font-size:22px;line-height:22px}.sd-dialog-confirm__copy{min-width:0}.sd-dialog-confirm__title{margin:0 0 6px;padding:0;font:inherit;font-size:18px;font-weight:600;line-height:25px;letter-spacing:normal;color:var(--sd-black500);overflow-wrap:anywhere}.sd-dialog-confirm__title:before{display:none}.sd-dialog-confirm__message{font-size:14px;line-height:21px;letter-spacing:normal;color:var(--sd-black400);overflow-wrap:anywhere}.sd-dialog-confirm__fields{margin-top:20px}.sd-dialog-confirm__fields sd-radio{height:auto}.sd-dialog-confirm__actions{flex-shrink:0;gap:8px;min-height:0;margin:24px 0 0;padding:0}::ng-deep .sd-confirm-panel .mat-mdc-dialog-surface{border-radius:8px;box-shadow:0 16px 48px #00000029,0 2px 8px #0000000f}::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:3px}::ng-deep .sd-confirm-panel .sd-dialog-confirm__message>:first-child{margin-top:0}::ng-deep .sd-confirm-panel .sd-dialog-confirm__message>:last-child{margin-bottom:0}@media(prefers-reduced-motion:reduce){::ng-deep .sd-confirm-panel .mat-mdc-dialog-container,::ng-deep .sd-confirm-panel .mat-mdc-dialog-surface{transition:none!important}}@media(max-width:600px){::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions sd-button{flex:1}::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions sd-button button{width:100%;min-height:44px}}@media(max-width:600px){:host{padding:20px;padding-bottom:max(20px,env(safe-area-inset-bottom))}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdRadio, selector: "sd-radio", inputs: ["autoId", "name", "form", "label", "placeholder", "display", "items", "valueField", "displayField", "required", "inlineError", "disabled", "viewed", "color", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
50
64
  }
51
65
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogConfirmComponent, decorators: [{
52
66
  type: Component,
53
- args: [{ selector: 'sd-dialog-confirm', imports: [CommonModule, FormsModule, MatDialogModule, MatIconModule, SdButton, SdDate, SdRadio, SdTextarea], template: "<div mat-dialog-title class=\"\">\n @if (data.icon) {\n <mat-icon>\n {{ data.icon }}\n </mat-icon>\n }\n <span class=\"T24M\" [innerHtml]=\"data.title || 'Confirm'\"></span>\n</div>\n<div mat-dialog-content>\n <div class=\"T14R mb-4\" [innerHtml]=\"data.message\"></div>\n @if (data.input) {\n <sd-textarea [placeholder]=\"data.input.placeholder\" [(model)]=\"value\" [rows]=\"5\" [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n</div>\n<div mat-dialog-actions align=\"end\">\n @if (data.noTitle) {\n <sd-button [color]=\"data.noButtonColor || 'secondary'\" [title]=\"data.noTitle\" (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n class=\"ml-8\"\n type=\"fill\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"required && !value\"\n cdkFocusInitial\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host ::ng-deep .mat-dialog-title{display:flex;align-items:center;justify-content:flex-start}:host ::ng-deep .mat-dialog-title .mat-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title .mat-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title .mat-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title .mat-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title .mat-icon.error{color:var(--sd-error)}\n"] }]
67
+ args: [{ selector: 'sd-dialog-confirm', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, FormsModule, MatDialogModule, MatIconModule, SdButton, SdDate, SdRadio, SdTextarea], template: "<div mat-dialog-content class=\"sd-dialog-confirm__content\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <div class=\"sd-dialog-confirm__header\">\n <span class=\"sd-dialog-confirm__icon\" aria-hidden=\"true\" [attr.data-icon]=\"resolvedIcon\" [attr.data-tone]=\"iconTone\">\n <mat-icon fontSet=\"material-icons-outlined\">{{ resolvedIcon }}</mat-icon>\n </span>\n <div class=\"sd-dialog-confirm__copy\">\n <h2 mat-dialog-title class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n @if (data.message) {\n <div class=\"sd-dialog-confirm__message\" [innerHtml]=\"data.message\"></div>\n }\n </div>\n </div>\n @if (hasFields) {\n <div class=\"sd-dialog-confirm__fields\">\n @if (data.input) {\n <sd-textarea\n [label]=\"data.input.label\"\n [placeholder]=\"data.input.placeholder\"\n [(model)]=\"value\"\n [rows]=\"3\"\n [required]=\"data.input.required\"\n [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n </div>\n }\n</div>\n<div mat-dialog-actions align=\"end\" class=\"sd-dialog-confirm__actions\">\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n size=\"sm\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n size=\"sm\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"\n required &&\n (value === undefined ||\n value === null ||\n value === '' ||\n (data.input && !value.trim()) ||\n (value.length !== undefined && value.length === 0))\n \"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;min-height:0;max-height:calc(100dvh - 32px);padding:24px;overflow:hidden}.sd-dialog-confirm__content{min-height:0;max-height:none;margin:0;padding:0;color:var(--sd-black500)}.sd-dialog-confirm__header{display:flex;align-items:flex-start;gap:12px}.sd-dialog-confirm__icon{display:grid;place-items:center;flex:0 0 40px;width:40px;height:40px;border-radius:8px;color:var(--sd-primary-dark);background:var(--sd-primary-light)}.sd-dialog-confirm__icon[data-tone=success]{color:var(--sd-success-dark);background:var(--sd-success-light)}.sd-dialog-confirm__icon[data-tone=info]{color:var(--sd-info-dark);background:var(--sd-info-light)}.sd-dialog-confirm__icon[data-tone=warning]{color:var(--sd-warning-dark);background:var(--sd-warning-light)}.sd-dialog-confirm__icon[data-tone=error]{color:var(--sd-error-dark);background:var(--sd-error-light)}.sd-dialog-confirm__icon mat-icon{width:22px;height:22px;font-size:22px;line-height:22px}.sd-dialog-confirm__copy{min-width:0}.sd-dialog-confirm__title{margin:0 0 6px;padding:0;font:inherit;font-size:18px;font-weight:600;line-height:25px;letter-spacing:normal;color:var(--sd-black500);overflow-wrap:anywhere}.sd-dialog-confirm__title:before{display:none}.sd-dialog-confirm__message{font-size:14px;line-height:21px;letter-spacing:normal;color:var(--sd-black400);overflow-wrap:anywhere}.sd-dialog-confirm__fields{margin-top:20px}.sd-dialog-confirm__fields sd-radio{height:auto}.sd-dialog-confirm__actions{flex-shrink:0;gap:8px;min-height:0;margin:24px 0 0;padding:0}::ng-deep .sd-confirm-panel .mat-mdc-dialog-surface{border-radius:8px;box-shadow:0 16px 48px #00000029,0 2px 8px #0000000f}::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:3px}::ng-deep .sd-confirm-panel .sd-dialog-confirm__message>:first-child{margin-top:0}::ng-deep .sd-confirm-panel .sd-dialog-confirm__message>:last-child{margin-bottom:0}@media(prefers-reduced-motion:reduce){::ng-deep .sd-confirm-panel .mat-mdc-dialog-container,::ng-deep .sd-confirm-panel .mat-mdc-dialog-surface{transition:none!important}}@media(max-width:600px){::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions sd-button{flex:1}::ng-deep .sd-confirm-panel .sd-dialog-confirm__actions sd-button button{width:100%;min-height:44px}}@media(max-width:600px){:host{padding:20px;padding-bottom:max(20px,env(safe-area-inset-bottom))}}\n"] }]
54
68
  }], ctorParameters: () => [] });
55
69
 
56
70
  class SdConfirmService {
@@ -61,9 +75,14 @@ class SdConfirmService {
61
75
  }
62
76
  confirm = (message, option = {}) => {
63
77
  const dialogRef = this.dialog.open(DialogConfirmComponent, {
64
- width: option?.width || '400px',
78
+ width: option?.width || '440px',
79
+ panelClass: 'sd-confirm-panel',
80
+ maxWidth: 'calc(100vw - 32px)',
81
+ maxHeight: 'calc(100dvh - 32px)',
82
+ autoFocus: '[data-confirm-cancel] button',
65
83
  disableClose: option?.disableBackdropClose ?? true,
66
84
  data: {
85
+ icon: option?.icon,
67
86
  title: option?.title || this.#i18n.t('core.confirm.title'),
68
87
  message,
69
88
  yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes'),
@@ -87,9 +106,14 @@ class SdConfirmService {
87
106
  };
88
107
  withInput = (message, option) => {
89
108
  const dialogRef = this.dialog.open(DialogConfirmComponent, {
90
- width: '400px',
109
+ width: '440px',
110
+ panelClass: 'sd-confirm-panel',
111
+ maxWidth: 'calc(100vw - 32px)',
112
+ maxHeight: 'calc(100dvh - 32px)',
113
+ autoFocus: 'textarea',
91
114
  disableClose: option?.disableBackdropClose ?? true,
92
115
  data: {
116
+ icon: option?.icon,
93
117
  title: option?.title || this.#i18n.t('core.confirm.title'),
94
118
  message,
95
119
  yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),
@@ -97,6 +121,8 @@ class SdConfirmService {
97
121
  noButtonColor: option?.noButtonColor || 'secondary',
98
122
  yesButtonColor: option?.yesButtonColor || 'primary',
99
123
  input: {
124
+ label: option?.label,
125
+ placeholder: option?.placeholder,
100
126
  maxlength: option?.maxlength || 255,
101
127
  required: option?.required,
102
128
  defaultValue: option?.defaultValue || '',
@@ -118,9 +144,14 @@ class SdConfirmService {
118
144
  };
119
145
  withRadio = (message, option) => {
120
146
  const dialogRef = this.dialog.open(DialogConfirmComponent, {
121
- width: '400px',
147
+ width: '440px',
148
+ panelClass: 'sd-confirm-panel',
149
+ maxWidth: 'calc(100vw - 32px)',
150
+ maxHeight: 'calc(100dvh - 32px)',
151
+ autoFocus: 'first-tabbable',
122
152
  disableClose: option?.disableBackdropClose ?? true,
123
153
  data: {
154
+ icon: option?.icon,
124
155
  title: option?.title || this.#i18n.t('core.confirm.title'),
125
156
  message,
126
157
  yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),
@@ -152,9 +183,14 @@ class SdConfirmService {
152
183
  };
153
184
  withDate = (message, option) => {
154
185
  const dialogRef = this.dialog.open(DialogConfirmComponent, {
155
- width: '400px',
186
+ width: '440px',
187
+ panelClass: 'sd-confirm-panel',
188
+ maxWidth: 'calc(100vw - 32px)',
189
+ maxHeight: 'calc(100dvh - 32px)',
190
+ autoFocus: 'first-tabbable',
156
191
  disableClose: option?.disableBackdropClose ?? true,
157
192
  data: {
193
+ icon: option?.icon,
158
194
  title: option?.title || this.#i18n.t('core.confirm.title'),
159
195
  message,
160
196
  yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-services-confirm.mjs","sources":["../../../projects/sd-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sd-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sd-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sd-angular/services/confirm/src/public-api.ts","../../../projects/sd-angular/services/confirm/sd-angular-core-services-confirm.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { SdButton } from '@sd-angular/core/components/button';\nimport { SdDate } from '@sd-angular/core/forms/date';\nimport { SdRadio } from '@sd-angular/core/forms/radio';\nimport { SdTextarea } from '@sd-angular/core/forms/textarea';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Utilities } from '@sdcorejs/utils/fns';\n\nexport interface DialogData {\n icon?: string;\n title?: string;\n message?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n input?: {\n placeholder?: string;\n minlength?: number;\n maxlength?: number;\n required?: boolean;\n defaultValue?: string;\n };\n date?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n };\n radio?: {\n required?: boolean;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n };\n}\n\n@Component({\n selector: 'sd-dialog-confirm',\n templateUrl: 'dialog-confirm.component.html',\n styleUrl: './dialog-confirm.component.scss',\n imports: [CommonModule, FormsModule, MatDialogModule, MatIconModule, SdButton, SdDate, SdRadio, SdTextarea],\n})\nexport class DialogConfirmComponent {\n value: any;\n required = false;\n id = `I${Utilities.generateUuid()}`;\n public readonly dialogRef = inject(MatDialogRef<DialogConfirmComponent>);\n public readonly data = inject<DialogData>(MAT_DIALOG_DATA);\n\n constructor() {\n if (this.data?.input) {\n this.value = this.data?.input?.defaultValue ?? '';\n this.required = this.data?.input?.required || false;\n }\n if (this.data?.date) {\n this.value = this.data?.date?.defaultValue ?? '';\n this.required = this.data?.date?.required || false;\n }\n if (this.data?.radio) {\n this.value = this.data?.radio?.defaultValue ?? '';\n this.required = this.data?.radio?.required || false;\n }\n }\n\n onCancel = () => {\n this.dialogRef.close({ action: 'CANCEL', value: null });\n };\n\n onAccept = () => {\n // Always return an object with action and value for consistency\n if (this.data?.radio || this.data?.input || this.data?.date) {\n this.dialogRef.close({ action: 'ACCEPT', value: this.value });\n } else {\n this.dialogRef.close({ action: 'ACCEPT', value: null });\n }\n };\n}\n","<div mat-dialog-title class=\"\">\n @if (data.icon) {\n <mat-icon>\n {{ data.icon }}\n </mat-icon>\n }\n <span class=\"T24M\" [innerHtml]=\"data.title || 'Confirm'\"></span>\n</div>\n<div mat-dialog-content>\n <div class=\"T14R mb-4\" [innerHtml]=\"data.message\"></div>\n @if (data.input) {\n <sd-textarea [placeholder]=\"data.input.placeholder\" [(model)]=\"value\" [rows]=\"5\" [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n</div>\n<div mat-dialog-actions align=\"end\">\n @if (data.noTitle) {\n <sd-button [color]=\"data.noButtonColor || 'secondary'\" [title]=\"data.noTitle\" (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n class=\"ml-8\"\n type=\"fill\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"required && !value\"\n cdkFocusInitial\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { DialogConfirmComponent } from './components/dialog-confirm/dialog-confirm.component';\nimport { Color } from '@sdcorejs/utils/models';\nimport { I18nService } from '@sd-angular/core/i18n';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdConfirmService {\n readonly #i18n = inject(I18nService);\n\n constructor(private dialog: MatDialog) {}\n\n confirm = (\n message: string,\n option: {\n title?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n width?: string;\n disableBackdropClose?: boolean;\n } = {}\n ) => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: option?.width || '400px',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withInput = (\n message?: string,\n option?: {\n title?: string;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n maxlength?: number;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string;\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '400px',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n input: {\n maxlength: option?.maxlength || 255,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withRadio = (\n message?: string,\n option?: {\n title?: string;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '400px',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n radio: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n display: option?.display || 'row',\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withDate = (\n message?: string,\n option?: {\n title?: string;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '400px',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n date: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n}\n","/*\n * Public API Surface of superdev-angular-core\n */\n\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\nexport * from './lib/confirm.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAmDa,sBAAsB,CAAA;AACjC,IAAA,KAAK;IACL,QAAQ,GAAG,KAAK;AAChB,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,SAAS,CAAC,YAAY,EAAE,EAAE;AACnB,IAAA,SAAS,GAAG,MAAM,EAAC,YAAoC,EAAC;AACxD,IAAA,IAAI,GAAG,MAAM,CAAa,eAAe,CAAC;AAE1D,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;AACpB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,IAAI,EAAE;AACjD,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,IAAI,KAAK;QACrD;AACA,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;AACnB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,IAAI,EAAE;AAChD,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,IAAI,KAAK;QACpD;AACA,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,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A,EAAA,EAAA,CAAA,SAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;4FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACRD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-services-confirm.mjs","sources":["../../../projects/sd-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sd-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sd-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sd-angular/services/confirm/src/public-api.ts","../../../projects/sd-angular/services/confirm/sd-angular-core-services-confirm.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { SdButton } from '@sd-angular/core/components/button';\nimport { SdDate } from '@sd-angular/core/forms/date';\nimport { SdRadio } from '@sd-angular/core/forms/radio';\nimport { SdTextarea } from '@sd-angular/core/forms/textarea';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Utilities } from '@sdcorejs/utils/fns';\n\nexport interface DialogData {\n icon?: string;\n title?: string;\n message?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n input?: {\n label?: string;\n placeholder?: string;\n minlength?: number;\n maxlength?: number;\n required?: boolean;\n defaultValue?: string;\n };\n date?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n };\n radio?: {\n required?: boolean;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n };\n}\n\n@Component({\n selector: 'sd-dialog-confirm',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: 'dialog-confirm.component.html',\n styleUrl: './dialog-confirm.component.scss',\n imports: [CommonModule, FormsModule, MatDialogModule, MatIconModule, SdButton, SdDate, SdRadio, SdTextarea],\n})\nexport class DialogConfirmComponent {\n value: any;\n required = false;\n id = `I${Utilities.generateUuid()}`;\n public readonly dialogRef = inject(MatDialogRef<DialogConfirmComponent>);\n public readonly data = inject<DialogData>(MAT_DIALOG_DATA);\n\n readonly iconTone = this.data.yesButtonColor || 'primary';\n readonly resolvedIcon =\n this.data.icon?.trim() ||\n (this.iconTone === 'error'\n ? 'delete'\n : this.iconTone === 'warning'\n ? 'warning_amber'\n : this.data.input\n ? 'edit_note'\n : this.data.date\n ? 'today'\n : this.data.radio\n ? 'list'\n : 'check_circle');\n readonly hasFields = !!(this.data.input || this.data.date || this.data.radio);\n\n constructor() {\n if (this.data?.input) {\n this.value = this.data?.input?.defaultValue ?? '';\n this.required = this.data?.input?.required || false;\n }\n if (this.data?.date) {\n this.value = this.data?.date?.defaultValue ?? '';\n this.required = this.data?.date?.required || false;\n }\n if (this.data?.radio) {\n this.value = this.data?.radio?.defaultValue ?? '';\n this.required = this.data?.radio?.required || false;\n }\n }\n\n onCancel = () => {\n this.dialogRef.close({ action: 'CANCEL', value: null });\n };\n\n onAccept = () => {\n // Always return an object with action and value for consistency\n if (this.data?.radio || this.data?.input || this.data?.date) {\n this.dialogRef.close({ action: 'ACCEPT', value: this.value });\n } else {\n this.dialogRef.close({ action: 'ACCEPT', value: null });\n }\n };\n}\n","<div mat-dialog-content class=\"sd-dialog-confirm__content\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <div class=\"sd-dialog-confirm__header\">\n <span class=\"sd-dialog-confirm__icon\" aria-hidden=\"true\" [attr.data-icon]=\"resolvedIcon\" [attr.data-tone]=\"iconTone\">\n <mat-icon fontSet=\"material-icons-outlined\">{{ resolvedIcon }}</mat-icon>\n </span>\n <div class=\"sd-dialog-confirm__copy\">\n <h2 mat-dialog-title class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n @if (data.message) {\n <div class=\"sd-dialog-confirm__message\" [innerHtml]=\"data.message\"></div>\n }\n </div>\n </div>\n @if (hasFields) {\n <div class=\"sd-dialog-confirm__fields\">\n @if (data.input) {\n <sd-textarea\n [label]=\"data.input.label\"\n [placeholder]=\"data.input.placeholder\"\n [(model)]=\"value\"\n [rows]=\"3\"\n [required]=\"data.input.required\"\n [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n </div>\n }\n</div>\n<div mat-dialog-actions align=\"end\" class=\"sd-dialog-confirm__actions\">\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n size=\"sm\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n size=\"sm\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"\n required &&\n (value === undefined ||\n value === null ||\n value === '' ||\n (data.input && !value.trim()) ||\n (value.length !== undefined && value.length === 0))\n \"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { DialogConfirmComponent } from './components/dialog-confirm/dialog-confirm.component';\nimport { Color } from '@sdcorejs/utils/models';\nimport { I18nService } from '@sd-angular/core/i18n';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdConfirmService {\n readonly #i18n = inject(I18nService);\n\n constructor(private dialog: MatDialog) {}\n\n confirm = (\n message: string,\n option: {\n title?: string;\n icon?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n width?: string;\n disableBackdropClose?: boolean;\n } = {}\n ) => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: option?.width || '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: '[data-confirm-cancel] button',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withInput = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n maxlength?: number;\n label?: string;\n placeholder?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string;\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'textarea',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n input: {\n label: option?.label,\n placeholder: option?.placeholder,\n maxlength: option?.maxlength || 255,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withRadio = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n radio: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n display: option?.display || 'row',\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n\n withDate = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n date: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n },\n });\n return new Promise((resolve, reject) => {\n dialogRef.afterClosed().subscribe(result => {\n if (result) {\n if (result.action === 'CANCEL') {\n reject(result.action);\n } else if (result.action === 'ACCEPT') {\n resolve(result.value);\n }\n }\n });\n });\n };\n}\n","/*\n * Public API Surface of superdev-angular-core\n */\n\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\nexport * from './lib/confirm.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAoDa,sBAAsB,CAAA;AACjC,IAAA,KAAK;IACL,QAAQ,GAAG,KAAK;AAChB,IAAA,EAAE,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EG;;ACFH;;AAEG;;;;"}
@@ -109,7 +109,7 @@ class ToastComponent {
109
109
  this.closeTimer = null;
110
110
  }
111
111
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastComponent, deps: [{ token: SdNotifyService }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
112
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ToastComponent, isStandalone: true, selector: "toast", inputs: { data: "data" }, host: { listeners: { "mouseenter": "pauseTimer()", "mouseleave": "resumeTimer()" }, properties: { "class": "hostClasses()", "attr.data-autoid": "autoId", "attr.data-type": "data.type", "attr.data-title": "data.title ?? null", "attr.data-message": "dataMessage" } }, ngImport: i0, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto;animation:sd-toast-enter .3s ease-out}:host(.sd-toast--closing){pointer-events:none;animation:sd-toast-leave .2s ease-in forwards}@keyframes sd-toast-enter{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes sd-toast-leave{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@media(prefers-reduced-motion:reduce){:host,:host(.sd-toast--closing){animation:none}}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
112
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ToastComponent, isStandalone: true, selector: "toast", inputs: { data: "data" }, host: { listeners: { "mouseenter": "pauseTimer()", "mouseleave": "resumeTimer()" }, properties: { "class": "hostClasses()", "attr.data-autoid": "autoId", "attr.data-type": "data.type", "attr.data-title": "data.title ?? null", "attr.data-message": "dataMessage" } }, ngImport: i0, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" aria-hidden=\"true\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"m8 12 2.5 2.5L16 9\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 11v5M12 8h.01\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M10.3 3.9a2 2 0 0 1 3.4 0l8 13.8a2 2 0 0 1-1.7 3H4a2 2 0 0 1-1.7-3zM12 9v4M12 17h.01\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7v6M12 17h.01\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto;animation:sd-toast-enter .3s ease-out}:host(.sd-toast--closing){pointer-events:none;animation:sd-toast-leave .2s ease-in forwards}@keyframes sd-toast-enter{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes sd-toast-leave{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@media(prefers-reduced-motion:reduce){:host,:host(.sd-toast--closing){animation:none}}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{display:grid;place-items:center;width:32px;height:32px;margin:12px 0 0 12px;border-radius:6px;flex-shrink:0}.sd-toast__icon svg{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.sd-toast__content{min-width:0;flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}:host([data-type=success]) .sd-toast__icon{color:var(--sd-success-dark);background:var(--sd-success-light)}:host([data-type=info]) .sd-toast__icon{color:var(--sd-info-dark);background:var(--sd-info-light)}:host([data-type=warning]) .sd-toast__icon{color:var(--sd-warning-dark);background:var(--sd-warning-light)}:host([data-type=error]) .sd-toast__icon{color:var(--sd-error-dark);background:var(--sd-error-light)}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
113
113
  }
114
114
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastComponent, decorators: [{
115
115
  type: Component,
@@ -119,7 +119,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
119
119
  '[attr.data-type]': 'data.type',
120
120
  '[attr.data-title]': 'data.title ?? null',
121
121
  '[attr.data-message]': 'dataMessage',
122
- }, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto;animation:sd-toast-enter .3s ease-out}:host(.sd-toast--closing){pointer-events:none;animation:sd-toast-leave .2s ease-in forwards}@keyframes sd-toast-enter{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes sd-toast-leave{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@media(prefers-reduced-motion:reduce){:host,:host(.sd-toast--closing){animation:none}}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"] }]
122
+ }, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" aria-hidden=\"true\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"m8 12 2.5 2.5L16 9\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 11v5M12 8h.01\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M10.3 3.9a2 2 0 0 1 3.4 0l8 13.8a2 2 0 0 1-1.7 3H4a2 2 0 0 1-1.7-3zM12 9v4M12 17h.01\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7v6M12 17h.01\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto;animation:sd-toast-enter .3s ease-out}:host(.sd-toast--closing){pointer-events:none;animation:sd-toast-leave .2s ease-in forwards}@keyframes sd-toast-enter{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes sd-toast-leave{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@media(prefers-reduced-motion:reduce){:host,:host(.sd-toast--closing){animation:none}}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{display:grid;place-items:center;width:32px;height:32px;margin:12px 0 0 12px;border-radius:6px;flex-shrink:0}.sd-toast__icon svg{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.sd-toast__content{min-width:0;flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}:host([data-type=success]) .sd-toast__icon{color:var(--sd-success-dark);background:var(--sd-success-light)}:host([data-type=info]) .sd-toast__icon{color:var(--sd-info-dark);background:var(--sd-info-light)}:host([data-type=warning]) .sd-toast__icon{color:var(--sd-warning-dark);background:var(--sd-warning-light)}:host([data-type=error]) .sd-toast__icon{color:var(--sd-error-dark);background:var(--sd-error-light)}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"] }]
123
123
  }], ctorParameters: () => [{ type: SdNotifyService }, { type: i2.DomSanitizer }], propDecorators: { data: [{
124
124
  type: Input,
125
125
  args: [{ required: true }]
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-services-notify.mjs","sources":["../../../projects/sd-angular/services/notify/src/components/toast/toast.component.ts","../../../projects/sd-angular/services/notify/src/components/toast/toast.component.html","../../../projects/sd-angular/services/notify/src/components/toast-container.component.ts","../../../projects/sd-angular/services/notify/src/notify.service.ts","../../../projects/sd-angular/services/notify/sd-angular-core-services-notify.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n SecurityContext,\n computed,\n signal,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { TranslatePipe } from '@sd-angular/core/i18n';\n\nimport { ToastData } from '../../notify.model';\nimport { SdNotifyService } from '../../notify.service';\n\nconst TOAST_EXIT_ANIMATION_MS = 200;\n\n@Component({\n selector: 'toast',\n standalone: true,\n imports: [CommonModule, TranslatePipe],\n templateUrl: './toast.component.html',\n styleUrl: './toast.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n '[attr.data-autoid]': 'autoId',\n '[attr.data-type]': 'data.type',\n '[attr.data-title]': 'data.title ?? null',\n '[attr.data-message]': 'dataMessage',\n },\n})\nexport class ToastComponent implements OnInit, OnDestroy {\n @Input({ required: true }) data!: ToastData;\n\n readonly isExpanded = signal(false);\n readonly isClosing = signal(false);\n readonly hostClasses = computed(() => (this.isClosing() ? 'bg-white sd-toast sd-toast--closing' : 'bg-white sd-toast'));\n readonly MAX_SHOW = 2;\n\n private timer: ReturnType<typeof setTimeout> | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private start = 0;\n private remaining = 0;\n\n constructor(\n private notifyService: SdNotifyService,\n private sanitizer: DomSanitizer\n ) {}\n\n ngOnInit(): void {\n this.remaining = this.data.duration;\n this.resumeTimer();\n }\n\n ngOnDestroy(): void {\n this.clearAutoDismissTimer();\n this.clearCloseTimer();\n }\n\n @HostListener('mouseenter')\n pauseTimer(): void {\n if (!this.timer || this.isClosing()) {\n return;\n }\n\n clearTimeout(this.timer);\n this.timer = null;\n this.remaining = Math.max(this.remaining - (Date.now() - this.start), 0);\n }\n\n @HostListener('mouseleave')\n resumeTimer(): void {\n if (this.remaining <= 0 || this.timer || this.isClosing()) {\n return;\n }\n\n this.start = Date.now();\n this.timer = setTimeout(() => {\n this.close();\n }, this.remaining);\n }\n\n close(): void {\n if (this.isClosing()) {\n return;\n }\n\n this.clearAutoDismissTimer();\n this.isClosing.set(true);\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n this.notifyService.remove(this.data.id);\n }, TOAST_EXIT_ANIMATION_MS);\n }\n\n onActionClick(): void {\n this.data.onAction?.();\n }\n\n toggleExpand(): void {\n this.isExpanded.update(v => !v);\n }\n\n sanitizeHtml(value: string): string {\n return this.sanitizer.sanitize(SecurityContext.HTML, value) ?? '';\n }\n\n get singleMessage(): string {\n return this.data.message as string;\n }\n\n get isMultiMessage(): boolean {\n return Array.isArray(this.data.message);\n }\n\n get messages(): string[] {\n return this.data.message as string[];\n }\n\n get displayMessages(): string[] {\n const msgs = this.messages;\n if (this.isExpanded()) return msgs;\n return msgs.slice(0, this.MAX_SHOW);\n }\n\n get restCount(): number {\n return this.messages.length - this.MAX_SHOW;\n }\n\n get hasMore(): boolean {\n return this.isMultiMessage && this.messages.length > this.MAX_SHOW;\n }\n\n get autoId(): string {\n return `services-notify-toast-${this.data.type}`;\n }\n\n get dataMessage(): string {\n return Array.isArray(this.data.message) ? this.data.message.join(' | ') : this.data.message;\n }\n\n private clearAutoDismissTimer(): void {\n if (!this.timer) {\n return;\n }\n\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n private clearCloseTimer(): void {\n if (!this.closeTimer) {\n return;\n }\n\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n}\n","<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n","import { Component, signal, WritableSignal } from '@angular/core';\nimport { ToastData } from '../notify.model';\nimport { ToastComponent } from './toast/toast.component';\n\n@Component({\n selector: 'toast-container',\n standalone: true,\n imports: [ToastComponent],\n template: `\n <div class=\"toast-container\">\n @for (toast of toasts(); track toast.id) {\n <toast [data]=\"toast\"> </toast>\n }\n </div>\n `,\n styles: [\n `\n .toast-container {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: 9999;\n display: flex;\n flex-direction: column;\n pointer-events: none; /* Cho phép click xuyên qua vùng trống */\n }\n sd-toast {\n pointer-events: auto; /* Bật lại click cho toast */\n }\n `,\n ],\n})\nexport class ToastContainerComponent {\n toasts: WritableSignal<ToastData[]> = signal([]);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ApplicationRef, createComponent, EnvironmentInjector, inject, Injectable, signal } from '@angular/core';\nimport { Utilities } from '@sdcorejs/utils/fns';\n\nimport { I18nService } from '@sd-angular/core/i18n';\n\nimport { ToastContainerComponent } from './components/toast-container.component';\nimport { NotifyOption, ToastData, ToastType } from './notify.model';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdNotifyService {\n readonly toasts = signal<ToastData[]>([]);\n\n // Constants\n readonly #DEBOUNCE_TIME = 500;\n readonly #DEFAULT_SUCCESS_DURATION = 3000;\n readonly #DEFAULT_BUFFERED_DURATION = 5000;\n readonly #MAX_TOASTS = 5;\n\n // State\n #buffer: Record<string, string[]> = {};\n #timers: Record<string, ReturnType<typeof setTimeout> | null> = {};\n private readonly appRef = inject(ApplicationRef);\n private readonly injector = inject(EnvironmentInjector);\n private readonly document = inject(DOCUMENT);\n readonly #i18n = inject(I18nService);\n\n constructor() {\n this.#initContainer();\n }\n\n #initContainer() {\n const componentRef = createComponent(ToastContainerComponent, {\n environmentInjector: this.injector,\n });\n componentRef.instance.toasts = this.toasts;\n this.appRef.attachView(componentRef.hostView);\n const domElem = (componentRef.hostView as any).rootNodes[0] as HTMLElement;\n this.document.body.appendChild(domElem);\n }\n\n // Public API\n success(message: string, option?: NotifyOption) {\n this.#addImmediate('success', message, option);\n }\n\n info(message: string, option?: NotifyOption) {\n this.#addImmediate('info', message, option);\n }\n\n warning(message: string | string[], option?: NotifyOption) {\n this.#addToBuffer('warning', message, option);\n }\n\n error(message: string | string[], option?: NotifyOption) {\n this.#addToBuffer('error', message, option);\n }\n\n remove(id: string) {\n this.toasts.update(current => current.filter(t => t.id !== id));\n }\n\n clearAll() {\n this.toasts.set([]);\n this.#clearAllTimers();\n }\n\n clearByType(type: ToastType) {\n this.toasts.update(current => current.filter(t => t.type !== type));\n }\n\n // Private helpers\n #addImmediate(type: ToastType, message: string, option?: NotifyOption) {\n const newToast: ToastData = {\n id: Utilities.generateUuid(),\n type,\n message,\n title: option?.title,\n duration: option?.duration ?? this.#DEFAULT_SUCCESS_DURATION,\n actionLabel: option?.actionLabel,\n onAction: option?.onAction,\n html: option?.html,\n };\n\n this.toasts.update(current => {\n const updated = [newToast, ...current];\n return updated.slice(0, this.#MAX_TOASTS);\n });\n }\n\n #addToBuffer(type: ToastType, message: string | string[], option?: NotifyOption) {\n if (!this.#buffer[type]) {\n this.#buffer[type] = [];\n }\n\n const msgs = Array.isArray(message) ? message : [message];\n this.#buffer[type].push(...msgs);\n\n // Clear existing timer and set new one\n if (this.#timers[type]) {\n clearTimeout(this.#timers[type]!);\n }\n\n this.#timers[type] = setTimeout(() => {\n this.#flushBuffer(type, option);\n }, this.#DEBOUNCE_TIME);\n }\n\n #flushBuffer(type: ToastType, option?: NotifyOption) {\n const messages = [...new Set(this.#buffer[type])];\n\n // Cleanup\n this.#buffer[type] = [];\n this.#timers[type] = null;\n\n if (messages.length === 0) return;\n\n const title = option?.title ?? this.#i18n.t(`core.notify.type.${type}`);\n const finalTitle = messages.length > 1 ? `${title} (${messages.length})` : title;\n\n const newToast: ToastData = {\n id: Utilities.generateUuid(),\n type,\n message: messages.length === 1 ? messages[0] : messages,\n title: finalTitle,\n duration: option?.duration ?? this.#DEFAULT_BUFFERED_DURATION,\n actionLabel: option?.actionLabel,\n onAction: option?.onAction,\n html: option?.html,\n };\n\n this.toasts.update(current => {\n const updated = [newToast, ...current];\n return updated.slice(0, this.#MAX_TOASTS);\n });\n }\n\n #clearAllTimers() {\n Object.values(this.#timers).forEach(timer => {\n if (timer) clearTimeout(timer);\n });\n this.#timers = {};\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.SdNotifyService"],"mappings":";;;;;;;AAkBA,MAAM,uBAAuB,GAAG,GAAG;MAiBtB,cAAc,CAAA;AAcf,IAAA,aAAA;AACA,IAAA,SAAA;AAdiB,IAAA,IAAI;AAEtB,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;AAC1B,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;IACzB,WAAW,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE,GAAG,qCAAqC,GAAG,mBAAmB,CAAC,CAAC;IAC9G,QAAQ,GAAG,CAAC;IAEb,KAAK,GAAyC,IAAI;IAClD,UAAU,GAAyC,IAAI;IACvD,KAAK,GAAG,CAAC;IACT,SAAS,GAAG,CAAC;IAErB,WAAA,CACU,aAA8B,EAC9B,SAAuB,EAAA;QADvB,IAAA,CAAA,aAAa,GAAb,aAAa;QACb,IAAA,CAAA,SAAS,GAAT,SAAS;IAChB;IAEH,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ;QACnC,IAAI,CAAC,WAAW,EAAE;IACpB;IAEA,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,EAAE;QAC5B,IAAI,CAAC,eAAe,EAAE;IACxB;IAGA,UAAU,GAAA;QACR,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YACnC;QACF;AAEA,QAAA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1E;IAGA,WAAW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A,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-services-notify.mjs","sources":["../../../projects/sd-angular/services/notify/src/components/toast/toast.component.ts","../../../projects/sd-angular/services/notify/src/components/toast/toast.component.html","../../../projects/sd-angular/services/notify/src/components/toast-container.component.ts","../../../projects/sd-angular/services/notify/src/notify.service.ts","../../../projects/sd-angular/services/notify/sd-angular-core-services-notify.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n SecurityContext,\n computed,\n signal,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { TranslatePipe } from '@sd-angular/core/i18n';\n\nimport { ToastData } from '../../notify.model';\nimport { SdNotifyService } from '../../notify.service';\n\nconst TOAST_EXIT_ANIMATION_MS = 200;\n\n@Component({\n selector: 'toast',\n standalone: true,\n imports: [CommonModule, TranslatePipe],\n templateUrl: './toast.component.html',\n styleUrl: './toast.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n '[attr.data-autoid]': 'autoId',\n '[attr.data-type]': 'data.type',\n '[attr.data-title]': 'data.title ?? null',\n '[attr.data-message]': 'dataMessage',\n },\n})\nexport class ToastComponent implements OnInit, OnDestroy {\n @Input({ required: true }) data!: ToastData;\n\n readonly isExpanded = signal(false);\n readonly isClosing = signal(false);\n readonly hostClasses = computed(() => (this.isClosing() ? 'bg-white sd-toast sd-toast--closing' : 'bg-white sd-toast'));\n readonly MAX_SHOW = 2;\n\n private timer: ReturnType<typeof setTimeout> | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private start = 0;\n private remaining = 0;\n\n constructor(\n private notifyService: SdNotifyService,\n private sanitizer: DomSanitizer\n ) {}\n\n ngOnInit(): void {\n this.remaining = this.data.duration;\n this.resumeTimer();\n }\n\n ngOnDestroy(): void {\n this.clearAutoDismissTimer();\n this.clearCloseTimer();\n }\n\n @HostListener('mouseenter')\n pauseTimer(): void {\n if (!this.timer || this.isClosing()) {\n return;\n }\n\n clearTimeout(this.timer);\n this.timer = null;\n this.remaining = Math.max(this.remaining - (Date.now() - this.start), 0);\n }\n\n @HostListener('mouseleave')\n resumeTimer(): void {\n if (this.remaining <= 0 || this.timer || this.isClosing()) {\n return;\n }\n\n this.start = Date.now();\n this.timer = setTimeout(() => {\n this.close();\n }, this.remaining);\n }\n\n close(): void {\n if (this.isClosing()) {\n return;\n }\n\n this.clearAutoDismissTimer();\n this.isClosing.set(true);\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n this.notifyService.remove(this.data.id);\n }, TOAST_EXIT_ANIMATION_MS);\n }\n\n onActionClick(): void {\n this.data.onAction?.();\n }\n\n toggleExpand(): void {\n this.isExpanded.update(v => !v);\n }\n\n sanitizeHtml(value: string): string {\n return this.sanitizer.sanitize(SecurityContext.HTML, value) ?? '';\n }\n\n get singleMessage(): string {\n return this.data.message as string;\n }\n\n get isMultiMessage(): boolean {\n return Array.isArray(this.data.message);\n }\n\n get messages(): string[] {\n return this.data.message as string[];\n }\n\n get displayMessages(): string[] {\n const msgs = this.messages;\n if (this.isExpanded()) return msgs;\n return msgs.slice(0, this.MAX_SHOW);\n }\n\n get restCount(): number {\n return this.messages.length - this.MAX_SHOW;\n }\n\n get hasMore(): boolean {\n return this.isMultiMessage && this.messages.length > this.MAX_SHOW;\n }\n\n get autoId(): string {\n return `services-notify-toast-${this.data.type}`;\n }\n\n get dataMessage(): string {\n return Array.isArray(this.data.message) ? this.data.message.join(' | ') : this.data.message;\n }\n\n private clearAutoDismissTimer(): void {\n if (!this.timer) {\n return;\n }\n\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n private clearCloseTimer(): void {\n if (!this.closeTimer) {\n return;\n }\n\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n}\n","<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\n\n<div class=\"sd-toast__icon\" aria-hidden=\"true\">\n @switch (data.type) {\n @case ('success') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"m8 12 2.5 2.5L16 9\"/></svg>\n }\n @case ('info') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 11v5M12 8h.01\"/></svg>\n }\n @case ('warning') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M10.3 3.9a2 2 0 0 1 3.4 0l8 13.8a2 2 0 0 1-1.7 3H4a2 2 0 0 1-1.7-3zM12 9v4M12 17h.01\"/></svg>\n }\n @case ('error') {\n <svg viewBox=\"0 0 24 24\" focusable=\"false\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7v6M12 17h.01\"/></svg>\n }\n }\n</div>\n\n<div class=\"sd-toast__content\">\n <div class=\"sd-toast__header\">\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\n <button class=\"sd-toast__close\" (click)=\"close()\">&times;</button>\n </div>\n\n <div class=\"sd-toast__body\">\n @if (!isMultiMessage) {\n <!-- Text rendering is the default safe path; HTML is opt-in and sanitized. -->\n @if (data.html) {\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\n } @else {\n <div>{{ singleMessage }}</div>\n }\n } @else {\n <ul class=\"msg-list\">\n @for (msg of displayMessages; track msg) {\n @if (data.html) {\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\n } @else {\n <li>{{ '- ' + msg }}</li>\n }\n }\n </ul>\n\n @if (hasMore) {\n <button\n type=\"button\"\n class=\"toggle-more btn-link\"\n [class]=\"'text-' + data.type\"\n (click)=\"toggleExpand()\">\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\n </button>\n }\n }\n </div>\n\n @if (data.actionLabel) {\n <div class=\"sd-toast__actions\">\n <button\n class=\"btn-action\"\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\n (click)=\"onActionClick()\">\n {{ data.actionLabel }}\n </button>\n </div>\n }\n</div>\n","import { Component, signal, WritableSignal } from '@angular/core';\nimport { ToastData } from '../notify.model';\nimport { ToastComponent } from './toast/toast.component';\n\n@Component({\n selector: 'toast-container',\n standalone: true,\n imports: [ToastComponent],\n template: `\n <div class=\"toast-container\">\n @for (toast of toasts(); track toast.id) {\n <toast [data]=\"toast\"> </toast>\n }\n </div>\n `,\n styles: [\n `\n .toast-container {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: 9999;\n display: flex;\n flex-direction: column;\n pointer-events: none; /* Cho phép click xuyên qua vùng trống */\n }\n sd-toast {\n pointer-events: auto; /* Bật lại click cho toast */\n }\n `,\n ],\n})\nexport class ToastContainerComponent {\n toasts: WritableSignal<ToastData[]> = signal([]);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ApplicationRef, createComponent, EnvironmentInjector, inject, Injectable, signal } from '@angular/core';\nimport { Utilities } from '@sdcorejs/utils/fns';\n\nimport { I18nService } from '@sd-angular/core/i18n';\n\nimport { ToastContainerComponent } from './components/toast-container.component';\nimport { NotifyOption, ToastData, ToastType } from './notify.model';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdNotifyService {\n readonly toasts = signal<ToastData[]>([]);\n\n // Constants\n readonly #DEBOUNCE_TIME = 500;\n readonly #DEFAULT_SUCCESS_DURATION = 3000;\n readonly #DEFAULT_BUFFERED_DURATION = 5000;\n readonly #MAX_TOASTS = 5;\n\n // State\n #buffer: Record<string, string[]> = {};\n #timers: Record<string, ReturnType<typeof setTimeout> | null> = {};\n private readonly appRef = inject(ApplicationRef);\n private readonly injector = inject(EnvironmentInjector);\n private readonly document = inject(DOCUMENT);\n readonly #i18n = inject(I18nService);\n\n constructor() {\n this.#initContainer();\n }\n\n #initContainer() {\n const componentRef = createComponent(ToastContainerComponent, {\n environmentInjector: this.injector,\n });\n componentRef.instance.toasts = this.toasts;\n this.appRef.attachView(componentRef.hostView);\n const domElem = (componentRef.hostView as any).rootNodes[0] as HTMLElement;\n this.document.body.appendChild(domElem);\n }\n\n // Public API\n success(message: string, option?: NotifyOption) {\n this.#addImmediate('success', message, option);\n }\n\n info(message: string, option?: NotifyOption) {\n this.#addImmediate('info', message, option);\n }\n\n warning(message: string | string[], option?: NotifyOption) {\n this.#addToBuffer('warning', message, option);\n }\n\n error(message: string | string[], option?: NotifyOption) {\n this.#addToBuffer('error', message, option);\n }\n\n remove(id: string) {\n this.toasts.update(current => current.filter(t => t.id !== id));\n }\n\n clearAll() {\n this.toasts.set([]);\n this.#clearAllTimers();\n }\n\n clearByType(type: ToastType) {\n this.toasts.update(current => current.filter(t => t.type !== type));\n }\n\n // Private helpers\n #addImmediate(type: ToastType, message: string, option?: NotifyOption) {\n const newToast: ToastData = {\n id: Utilities.generateUuid(),\n type,\n message,\n title: option?.title,\n duration: option?.duration ?? this.#DEFAULT_SUCCESS_DURATION,\n actionLabel: option?.actionLabel,\n onAction: option?.onAction,\n html: option?.html,\n };\n\n this.toasts.update(current => {\n const updated = [newToast, ...current];\n return updated.slice(0, this.#MAX_TOASTS);\n });\n }\n\n #addToBuffer(type: ToastType, message: string | string[], option?: NotifyOption) {\n if (!this.#buffer[type]) {\n this.#buffer[type] = [];\n }\n\n const msgs = Array.isArray(message) ? message : [message];\n this.#buffer[type].push(...msgs);\n\n // Clear existing timer and set new one\n if (this.#timers[type]) {\n clearTimeout(this.#timers[type]!);\n }\n\n this.#timers[type] = setTimeout(() => {\n this.#flushBuffer(type, option);\n }, this.#DEBOUNCE_TIME);\n }\n\n #flushBuffer(type: ToastType, option?: NotifyOption) {\n const messages = [...new Set(this.#buffer[type])];\n\n // Cleanup\n this.#buffer[type] = [];\n this.#timers[type] = null;\n\n if (messages.length === 0) return;\n\n const title = option?.title ?? this.#i18n.t(`core.notify.type.${type}`);\n const finalTitle = messages.length > 1 ? `${title} (${messages.length})` : title;\n\n const newToast: ToastData = {\n id: Utilities.generateUuid(),\n type,\n message: messages.length === 1 ? messages[0] : messages,\n title: finalTitle,\n duration: option?.duration ?? this.#DEFAULT_BUFFERED_DURATION,\n actionLabel: option?.actionLabel,\n onAction: option?.onAction,\n html: option?.html,\n };\n\n this.toasts.update(current => {\n const updated = [newToast, ...current];\n return updated.slice(0, this.#MAX_TOASTS);\n });\n }\n\n #clearAllTimers() {\n Object.values(this.#timers).forEach(timer => {\n if (timer) clearTimeout(timer);\n });\n this.#timers = {};\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.SdNotifyService"],"mappings":";;;;;;;AAkBA,MAAM,uBAAuB,GAAG,GAAG;MAiBtB,cAAc,CAAA;AAcf,IAAA,aAAA;AACA,IAAA,SAAA;AAdiB,IAAA,IAAI;AAEtB,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;AAC1B,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;IACzB,WAAW,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE,GAAG,qCAAqC,GAAG,mBAAmB,CAAC,CAAC;IAC9G,QAAQ,GAAG,CAAC;IAEb,KAAK,GAAyC,IAAI;IAClD,UAAU,GAAyC,IAAI;IACvD,KAAK,GAAG,CAAC;IACT,SAAS,GAAG,CAAC;IAErB,WAAA,CACU,aAA8B,EAC9B,SAAuB,EAAA;QADvB,IAAA,CAAA,aAAa,GAAb,aAAa;QACb,IAAA,CAAA,SAAS,GAAT,SAAS;IAChB;IAEH,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ;QACnC,IAAI,CAAC,WAAW,EAAE;IACpB;IAEA,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,EAAE;QAC5B,IAAI,CAAC,eAAe,EAAE;IACxB;IAGA,UAAU,GA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E;IACnB;wGApIW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA;;4FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -0,0 +1,87 @@
1
+ import { signal, TemplateRef } from '@angular/core';
2
+
3
+ /** VALUE errors take precedence; otherwise SEARCH errors, then the active SEARCH channel. */
4
+ function combineReadStates(value, search) {
5
+ const current = value.status === 'error' ? value : search.status !== 'idle' ? search : value;
6
+ return Object.freeze({ ...current, channels: Object.freeze({ VALUE: value, SEARCH: search }) });
7
+ }
8
+ /** @internal Request guard shared by controls. Context is checked even before Angular effects run. */
9
+ class SdReadChannel {
10
+ operation;
11
+ changed;
12
+ #state;
13
+ state;
14
+ #revision = 0;
15
+ #valid = () => true;
16
+ constructor(operation, changed) {
17
+ this.operation = operation;
18
+ this.changed = changed;
19
+ this.#state = signal(Object.freeze({ status: 'idle', operation }));
20
+ this.state = this.#state.asReadonly();
21
+ }
22
+ begin(valid = () => true) {
23
+ this.#valid = valid;
24
+ const revision = ++this.#revision;
25
+ this.#set({ status: 'loading', operation: this.operation });
26
+ return revision;
27
+ }
28
+ isCurrent(revision) {
29
+ return revision === this.#revision && this.#valid();
30
+ }
31
+ succeed(revision, count) {
32
+ if (!this.isCurrent(revision))
33
+ return false;
34
+ this.#set({ status: count ? 'ready' : 'empty', operation: this.operation });
35
+ return true;
36
+ }
37
+ fail(revision, error) {
38
+ if (!this.isCurrent(revision))
39
+ return false;
40
+ this.#set({ status: 'error', operation: this.operation, error });
41
+ return true;
42
+ }
43
+ invalidate() {
44
+ ++this.#revision;
45
+ this.#valid = () => true;
46
+ if (this.state().status !== 'idle')
47
+ this.#set({ status: 'idle', operation: this.operation });
48
+ }
49
+ #set(state) {
50
+ const snapshot = Object.freeze(state);
51
+ this.#state.set(snapshot);
52
+ this.changed?.(snapshot);
53
+ }
54
+ }
55
+ /**
56
+ * @internal Copy request-owned data, including Dates. Unlike ObjectUtilities.clone,
57
+ * Dates must be copied too; structuredClone cannot retain table column callbacks.
58
+ */
59
+ function cloneReadRequest(value, seen = new WeakMap()) {
60
+ if (value === null || typeof value !== 'object')
61
+ return value;
62
+ // why: TemplateRef là handle thuộc Angular view, không phải dữ liệu request có thể sao chép.
63
+ if (value instanceof TemplateRef)
64
+ return value;
65
+ if (seen.has(value))
66
+ return seen.get(value);
67
+ if (value instanceof Date)
68
+ return new Date(value.getTime());
69
+ const copy = (Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(value)));
70
+ seen.set(value, copy);
71
+ for (const key of Object.keys(value)) {
72
+ Object.defineProperty(copy, key, {
73
+ value: cloneReadRequest(value[key], seen),
74
+ enumerable: true,
75
+ writable: true,
76
+ configurable: true,
77
+ });
78
+ }
79
+ return copy;
80
+ }
81
+
82
+ /**
83
+ * Generated bundle index. Do not edit.
84
+ */
85
+
86
+ export { SdReadChannel, cloneReadRequest, combineReadStates };
87
+ //# sourceMappingURL=sd-angular-core-utilities-read-state.mjs.map