@sdcorejs/angular 19.0.10 → 19.0.11

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 (109) hide show
  1. package/README.md +2 -2
  2. package/assets/STYLE-GUIDE.md +2 -2
  3. package/assets/scss/core/_inline-edit.scss +1 -1
  4. package/assets/scss/core/form.scss +1 -1
  5. package/assets/scss/themes/default.scss +2 -2
  6. package/components/badge/src/badge.component.d.ts +3 -14
  7. package/components/button/src/button.component.d.ts +5 -3
  8. package/components/inform/src/inform.component.d.ts +2 -8
  9. package/components/query-builder/src/query-builder.component.d.ts +3 -3
  10. package/components/query-builder/src/query-builder.model.d.ts +3 -3
  11. package/components/table/src/components/command/desktop-command.component.d.ts +0 -1
  12. package/components/table/src/models/table-command.model.d.ts +3 -3
  13. package/components/table/src/models/table-option-selector.model.d.ts +5 -5
  14. package/components/tree/src/tree.model.d.ts +3 -2
  15. package/fesm2022/sdcorejs-angular-components-anchor.mjs +5 -6
  16. package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
  17. package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +4 -5
  18. package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
  19. package/fesm2022/sdcorejs-angular-components-badge.mjs +14 -12
  20. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  21. package/fesm2022/sdcorejs-angular-components-button.mjs +10 -11
  22. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  23. package/fesm2022/sdcorejs-angular-components-code-editor.mjs +4 -5
  24. package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
  25. package/fesm2022/sdcorejs-angular-components-editor.mjs +4 -5
  26. package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
  27. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +7 -13
  28. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  29. package/fesm2022/sdcorejs-angular-components-history.mjs +2 -2
  30. package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
  31. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +5 -7
  32. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  33. package/fesm2022/sdcorejs-angular-components-inform.mjs +5 -15
  34. package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
  35. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +5 -6
  36. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
  37. package/fesm2022/sdcorejs-angular-components-modal.mjs +3 -4
  38. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  39. package/fesm2022/sdcorejs-angular-components-org-chart.mjs +4 -5
  40. package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
  41. package/fesm2022/sdcorejs-angular-components-preview.mjs +7 -8
  42. package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
  43. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +24 -28
  44. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  45. package/fesm2022/sdcorejs-angular-components-query-builder.mjs +3 -4
  46. package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
  47. package/fesm2022/sdcorejs-angular-components-section.mjs +3 -4
  48. package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
  49. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +3 -4
  50. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  51. package/fesm2022/sdcorejs-angular-components-stepper.mjs +3 -4
  52. package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
  53. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +5 -6
  54. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  55. package/fesm2022/sdcorejs-angular-components-tab.mjs +3 -4
  56. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  57. package/fesm2022/sdcorejs-angular-components-table.mjs +23 -27
  58. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  59. package/fesm2022/sdcorejs-angular-components-tree.mjs +6 -8
  60. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  61. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +8 -9
  62. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  63. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +5 -7
  64. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  65. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +7 -9
  66. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  67. package/fesm2022/sdcorejs-angular-forms-chip.mjs +5 -7
  68. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  69. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +7 -9
  70. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  71. package/fesm2022/sdcorejs-angular-forms-date.mjs +6 -8
  72. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  73. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +5 -7
  74. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  75. package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +4 -5
  76. package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
  77. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +5 -7
  78. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  79. package/fesm2022/sdcorejs-angular-forms-input.mjs +5 -7
  80. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  81. package/fesm2022/sdcorejs-angular-forms-label.mjs +4 -5
  82. package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
  83. package/fesm2022/sdcorejs-angular-forms-radio.mjs +1 -3
  84. package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
  85. package/fesm2022/sdcorejs-angular-forms-select.mjs +6 -8
  86. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  87. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +5 -7
  88. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  89. package/fesm2022/sdcorejs-angular-modules-icon.mjs +523 -0
  90. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -0
  91. package/fesm2022/sdcorejs-angular-modules-layout.mjs +24 -26
  92. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  93. package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
  94. package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
  95. package/fesm2022/sdcorejs-angular-services-confirm.mjs +3 -4
  96. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  97. package/fesm2022/sdcorejs-angular-services-excel.mjs +22 -14
  98. package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
  99. package/fesm2022/sdcorejs-angular-utilities-models.mjs +3 -2
  100. package/fesm2022/sdcorejs-angular-utilities-models.mjs.map +1 -1
  101. package/modules/icon/index.d.ts +1 -0
  102. package/modules/icon/src/icon.component.d.ts +101 -0
  103. package/modules/icon/src/icon.model.d.ts +59 -0
  104. package/modules/icon/src/icon.provider.d.ts +33 -0
  105. package/modules/icon/src/index.d.ts +3 -0
  106. package/modules/index.d.ts +1 -0
  107. package/package.json +10 -5
  108. package/services/excel/src/lib/spreadsheet-formula-injection.util.d.ts +5 -0
  109. package/utilities/models/src/icon.model.d.ts +4 -2
@@ -3,6 +3,7 @@ export * from '@sdcorejs/angular/modules/permission';
3
3
  export * from '@sdcorejs/angular/modules/auth';
4
4
  export * from '@sdcorejs/angular/modules/layout';
5
5
  export * from '@sdcorejs/angular/modules/authom';
6
+ export * from '@sdcorejs/angular/modules/icon';
6
7
 
7
8
  /**
8
9
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-modules.mjs","sources":["../../../projects/sdcorejs-angular/modules/sdcorejs-angular-modules.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;AAEG"}
1
+ {"version":3,"file":"sdcorejs-angular-modules.mjs","sources":["../../../projects/sdcorejs-angular/modules/sdcorejs-angular-modules.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;;AAEG"}
@@ -4,13 +4,12 @@ import { inject, 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';
7
- import * as i2 from '@angular/material/icon';
8
- import { MatIconModule } from '@angular/material/icon';
9
7
  import { SdButton } from '@sdcorejs/angular/components/button';
10
8
  import { SdDate } from '@sdcorejs/angular/forms/date';
11
9
  import { SdRadio } from '@sdcorejs/angular/forms/radio';
12
10
  import { SdTextarea } from '@sdcorejs/angular/forms/textarea';
13
11
  import { Utilities } from '@sdcorejs/utils/fns';
12
+ import { SdIcon } from '@sdcorejs/angular/modules/icon';
14
13
  import { I18nService } from '@sdcorejs/angular/i18n';
15
14
 
16
15
  class DialogConfirmComponent {
@@ -46,11 +45,11 @@ class DialogConfirmComponent {
46
45
  }
47
46
  };
48
47
  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"] }] });
48
+ 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 <sd-icon [name]=\"data.icon\"></sd-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 sd-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title sd-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title sd-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title sd-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title sd-icon.error{color:var(--sd-error)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: 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: "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"] }] });
50
49
  }
51
50
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogConfirmComponent, decorators: [{
52
51
  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"] }]
52
+ args: [{ selector: 'sd-dialog-confirm', imports: [SdIcon, CommonModule, FormsModule, MatDialogModule, SdButton, SdDate, SdRadio, SdTextarea], template: "<div mat-dialog-title class=\"\">\n @if (data.icon) {\n <sd-icon [name]=\"data.icon\"></sd-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 sd-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title sd-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title sd-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title sd-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title sd-icon.error{color:var(--sd-error)}\n"] }]
54
53
  }], ctorParameters: () => [] });
55
54
 
56
55
  class SdConfirmService {
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-services-confirm.mjs","sources":["../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sdcorejs-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sdcorejs-angular/services/confirm/src/public-api.ts","../../../projects/sdcorejs-angular/services/confirm/sdcorejs-angular-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 { MatIconModule } from '@angular/material/icon';\nimport { SdButton } from '@sdcorejs/angular/components/button';\nimport { SdDate } from '@sdcorejs/angular/forms/date';\nimport { SdRadio } from '@sdcorejs/angular/forms/radio';\nimport { SdTextarea } from '@sdcorejs/angular/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 '@sdcorejs/angular/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":";;;;;;;;;;;;;;;MAkDa,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,Q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,KAAK,QAAQ,EAAE;AAC9B,wBAAA,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;oBACvB;AAAO,yBAAA,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE;AACrC,wBAAA,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;oBACvB;gBACF;AACF,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGAnLU,gBAAgB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,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":"sdcorejs-angular-services-confirm.mjs","sources":["../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sdcorejs-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sdcorejs-angular/services/confirm/src/public-api.ts","../../../projects/sdcorejs-angular/services/confirm/sdcorejs-angular-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 { SdButton } from '@sdcorejs/angular/components/button';\nimport { SdDate } from '@sdcorejs/angular/forms/date';\nimport { SdRadio } from '@sdcorejs/angular/forms/radio';\nimport { SdTextarea } from '@sdcorejs/angular/forms/textarea';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Utilities } from '@sdcorejs/utils/fns';\nimport { SdIcon } from '@sdcorejs/angular/modules/icon';\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: [SdIcon, CommonModule, FormsModule, MatDialogModule, 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 <sd-icon [name]=\"data.icon\"></sd-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 '@sdcorejs/angular/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":";;;;;;;;;;;;;;MAkDa,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,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;IACF;IAEA,QAAQ,GAAG,MAAK;AACd,QAAA,IAAI,CAAC,SAAS,CAAC,KAA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rowserUtilities } from '@sdcorejs/utils/fns';
5
5
  import { I18nService } from '@sdcorejs/angular/i18n';
6
6
 
7
+ const DANGEROUS_SPREADSHEET_FORMULA_PREFIX = /^[=+\-@\t\r\n]/;
8
+ function neutralizeSpreadsheetFormula(value) {
9
+ if (typeof value !== 'string' || value === '' || value.startsWith("'")) {
10
+ return value;
11
+ }
12
+ return DANGEROUS_SPREADSHEET_FORMULA_PREFIX.test(value) ? `'${value}` : value;
13
+ }
14
+
7
15
  class SdExcelService {
8
16
  #i18n = inject(I18nService);
9
17
  #fieldStyle = {
@@ -167,11 +175,11 @@ class SdExcelService {
167
175
  },
168
176
  },
169
177
  };
170
- cellField.value = column.field;
171
- cellTitle.value = column.title;
178
+ cellField.value = neutralizeSpreadsheetFormula(column.field);
179
+ cellTitle.value = neutralizeSpreadsheetFormula(column.title);
172
180
  if (hasDescription) {
173
181
  cellDescription.style = this.#descriptionStyle;
174
- cellDescription.value = column.description || '';
182
+ cellDescription.value = neutralizeSpreadsheetFormula(column.description || '');
175
183
  }
176
184
  });
177
185
  if (sheets?.length) {
@@ -181,13 +189,13 @@ class SdExcelService {
181
189
  sheet.headers.forEach((header, index) => {
182
190
  newSheet.getColumn(index + 1).width = 30;
183
191
  newSheet.getCell(1, index + 1).style = this.#titleStyle;
184
- newSheet.getCell(1, index + 1).value = header.value;
192
+ newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);
185
193
  newSheet.getCell(2, index + 1).style = this.#titleStyle;
186
- newSheet.getCell(2, index + 1).value = header.display || header.value;
194
+ newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);
187
195
  });
188
196
  sheet.items.forEach((item, idx1) => {
189
197
  sheet.headers.forEach((header, idx2) => {
190
- newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];
198
+ newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]);
191
199
  newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;
192
200
  });
193
201
  });
@@ -207,7 +215,7 @@ class SdExcelService {
207
215
  const escape = (v) => {
208
216
  if (v == null)
209
217
  return '';
210
- const s = String(v);
218
+ const s = typeof v === 'string' ? neutralizeSpreadsheetFormula(v) : String(v);
211
219
  return /[",\n\r]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
212
220
  };
213
221
  const headerLine = columns.map(c => escape(c.title)).join(',');
@@ -247,11 +255,11 @@ class SdExcelService {
247
255
  else {
248
256
  firstSheet.getCell(2, index + 1).style = this.#titleStyle;
249
257
  }
250
- firstSheet.getCell(1, index + 1).value = column.field;
251
- firstSheet.getCell(2, index + 1).value = column.title;
258
+ firstSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(column.field);
259
+ firstSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(column.title);
252
260
  if (hasDescription) {
253
261
  firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;
254
- firstSheet.getCell(3, index + 1).value = column.description || '';
262
+ firstSheet.getCell(3, index + 1).value = neutralizeSpreadsheetFormula(column.description || '');
255
263
  }
256
264
  });
257
265
  if (sheets?.length) {
@@ -261,13 +269,13 @@ class SdExcelService {
261
269
  sheet.headers.forEach((header, index) => {
262
270
  newSheet.getColumn(index + 1).width = 30;
263
271
  newSheet.getCell(1, index + 1).style = this.#titleStyle;
264
- newSheet.getCell(1, index + 1).value = header.value;
272
+ newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);
265
273
  newSheet.getCell(2, index + 1).style = this.#titleStyle;
266
- newSheet.getCell(2, index + 1).value = header.display || header.value;
274
+ newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);
267
275
  });
268
276
  sheet.items.forEach((item, idx1) => {
269
277
  sheet.headers.forEach((header, idx2) => {
270
- newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];
278
+ newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]);
271
279
  newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;
272
280
  });
273
281
  });
@@ -283,7 +291,7 @@ class SdExcelService {
283
291
  firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';
284
292
  }
285
293
  else {
286
- firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];
294
+ firstSheet.getCell(fromRow + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(e[column.field]);
287
295
  }
288
296
  firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {
289
297
  ...this.#cellStyle,
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/angular/utilities/extensions';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = column.field;\n cellTitle.value = column.title;\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = column.description || '';\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = header.value;\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = header.display || header.value;\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = column.field;\n firstSheet.getCell(2, index + 1).value = column.title;\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = column.description || '';\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = header.value;\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = header.display || header.value;\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n if (typeof e[column.field] === 'number') {\n // Format mặc định với kiểu số\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\n } else {\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\n }\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\n ...this.#cellStyle,\n };\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAWa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE,QAAQ;AACf,aAAA;AACF,SAAA;KACF;IACD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B,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGA7aU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/spreadsheet-formula-injection.util.ts","../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["const DANGEROUS_SPREADSHEET_FORMULA_PREFIX = /^[=+\\-@\\t\\r\\n]/;\n\n/**\n * Prefix spreadsheet formula-like strings so exported files treat them as text.\n */\nexport function neutralizeSpreadsheetFormula(value: string): string;\nexport function neutralizeSpreadsheetFormula<T>(value: T): T;\nexport function neutralizeSpreadsheetFormula(value: unknown): unknown {\n if (typeof value !== 'string' || value === '' || value.startsWith(\"'\")) {\n return value;\n }\n\n return DANGEROUS_SPREADSHEET_FORMULA_PREFIX.test(value) ? `'${value}` : value;\n}\n","import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/angular/utilities/extensions';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\nimport { neutralizeSpreadsheetFormula } from './spreadsheet-formula-injection.util';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = neutralizeSpreadsheetFormula(column.field);\n cellTitle.value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = typeof v === 'string' ? neutralizeSpreadsheetFormula(v) : String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(column.field);\n firstSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n if (typeof e[column.field] === 'number') {\n // Format mặc định với kiểu số\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\n } else {\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(e[column.field]) as CellValue;\n }\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\n ...this.#cellStyle,\n };\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,oCAAoC,GAAG,gBAAgB;AAOvD,SAAU,4BAA4B,CAAC,KAAc,EAAA;AACzD,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACtE,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,OAAO,oCAAoC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,GAAG,KAAK;AAC/E;;MCDa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE,QAAQ;AACf,aAAA;AACF,SAAA;KACF;IACD,WAAW,GAAG,QAAQ;IACtB,aA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F,oBAAA,CAAC,CAAC;AAEF,oBAAA,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBAC1B;gBAAE,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC;gBACb;AACF,YAAA,CAAC;YAED,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;AACvC,YAAA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGA7aU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -4,7 +4,8 @@ import { StringUtilities } from '@sdcorejs/utils/fns';
4
4
  import { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';
5
5
  export { normalizeAsync, resolveMaybeAsync } from '@sdcorejs/utils/models';
6
6
 
7
- const DefaultMaterialIconFontSet = 'material-icons-outlined';
7
+ const DefaultSdIconSet = 'material-icons-outlined';
8
+ const DefaultSdMaterialIconSet = 'material-icons-outlined';
8
9
 
9
10
  // `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).
10
11
  /** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */
@@ -66,5 +67,5 @@ const SdOperators = [
66
67
  * Generated bundle index. Do not edit.
67
68
  */
68
69
 
69
- export { DefaultMaterialIconFontSet, SD_EMPTY_STR, SdNormalizeAsync, SdOperators, SdPatternCommons, SdResolveMaybeAsync };
70
+ export { DefaultSdIconSet, DefaultSdMaterialIconSet, SD_EMPTY_STR, SdNormalizeAsync, SdOperators, SdPatternCommons, SdResolveMaybeAsync };
70
71
  //# sourceMappingURL=sdcorejs-angular-utilities-models.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-utilities-models.mjs","sources":["../../../projects/sdcorejs-angular/utilities/models/src/icon.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/pattern.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/empty.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/operator.model.ts","../../../projects/sdcorejs-angular/utilities/models/sdcorejs-angular-utilities-models.ts"],"sourcesContent":["export type MaterialIconFontSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp';\nexport const DefaultMaterialIconFontSet: MaterialIconFontSet = 'material-icons-outlined';\n","import type { ValidationPatternType, ValidationPattern } from '@sdcorejs/utils/models';\nimport { VALIDATION_PATTERNS } from '@sdcorejs/utils/constants';\nimport { StringUtilities } from '@sdcorejs/utils/fns';\nexport type { ValidationPatternType, ValidationPattern };\nexport { VALIDATION_PATTERNS };\n\n/**\n * @deprecated Use {@link ValidationPatternType} from `@sdcorejs/utils/models` instead.\n * Note: member names changed — PHONE_VN → VN_PHONE, IDVN → VN_ID, IDVN_OR_PASSPORT → VN_ID_OR_PASSPORT.\n */\nexport type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN' | 'PASSPORT' | 'IDVN_OR_PASSPORT' | 'TIME';\n\n/**\n * @deprecated Use {@link ValidationPattern} from `@sdcorejs/utils/models` instead.\n * Note: `regex` field renamed to `pattern` to align with Angular `Validators.pattern()`.\n */\nexport interface SdPatternCommon {\n type: SdPatternType;\n name: string;\n regex: string;\n errorMessage: string;\n}\n\n// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).\n/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */\nexport const SdPatternCommons: SdPatternCommon[] = [\n { type: 'EMAIL', name: 'core.validator.email.name', regex: StringUtilities.REGEX_EMAIL, errorMessage: 'core.validator.email.error' },\n { type: 'PHONE', name: 'core.validator.phone.name', regex: StringUtilities.REGEX_PHONE, errorMessage: 'core.validator.phone.error' },\n {\n type: 'PHONE_VN',\n name: 'core.validator.phone-vn.name',\n regex: StringUtilities.REGEX_VN_PHONE,\n errorMessage: 'core.validator.phone-vn.error',\n },\n { type: 'IDVN', name: 'core.validator.cccd.name', regex: StringUtilities.REGEX_VN_ID, errorMessage: 'core.validator.cccd.error' },\n {\n type: 'PASSPORT',\n name: 'core.validator.passport.name',\n regex: StringUtilities.REGEX_PASSPORT,\n errorMessage: 'core.validator.passport.error',\n },\n {\n type: 'IDVN_OR_PASSPORT',\n name: 'core.validator.id-vn.name',\n regex: StringUtilities.REGEX_VN_ID_OR_PASSPORT,\n errorMessage: 'core.validator.id-vn.error',\n },\n { type: 'TIME', name: 'core.validator.time.name', regex: StringUtilities.REGEX_TIME, errorMessage: 'core.validator.time.error' },\n];\n","import { EMPTY_STR } from '@sdcorejs/utils/constants';\nexport { EMPTY_STR };\n\n/** @deprecated Use {@link EMPTY_STR} from `@sdcorejs/utils/constants` instead */\nexport const SD_EMPTY_STR = EMPTY_STR;\n","import type { MaybeAsync } from '@sdcorejs/utils/models';\nimport { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';\nexport type { MaybeAsync };\nexport { resolveMaybeAsync, normalizeAsync };\n\n/** @deprecated Use {@link MaybeAsync} from `@sdcorejs/utils/models` instead */\nexport type SdMaybeAsync<T> = MaybeAsync<T>;\n/** @deprecated Use {@link resolveMaybeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdResolveMaybeAsync = resolveMaybeAsync;\n/** @deprecated Use {@link normalizeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdNormalizeAsync = normalizeAsync;\n","import type { Operator, OperatorHasData, OperatorNoData } from '@sdcorejs/utils/models';\nexport type { Operator, OperatorHasData, OperatorNoData };\n\n/** @deprecated Use {@link Operator} from `@sdcorejs/utils/models` instead */\nexport type SdOperator = Operator;\n/** @deprecated Use {@link OperatorHasData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorHasData = OperatorHasData;\n/** @deprecated Use {@link OperatorNoData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorNoData = OperatorNoData;\n\n// `display` chứa i18n KEY (không phải chuỗi đã dịch).\n// Consumer phải gọi i18n.t(display) trước khi render ra UI.\n// @deprecated Use `OPERATORS` from `@sdcorejs/utils/constants` instead.\n// Note: OPERATORS has translated display labels; SdOperators uses i18n keys.\nexport const SdOperators: {\n value: Operator;\n symbol?: string;\n display: string;\n}[] = [\n { value: 'EQUAL', symbol: '=', display: 'core.operator.equal.display' },\n { value: 'NOT_EQUAL', symbol: '≠', display: 'core.operator.not-equal.display' },\n { value: 'GREATER_THAN', symbol: '>', display: 'core.operator.greater-than.display' },\n { value: 'LESS_THAN', symbol: '<', display: 'core.operator.less-than.display' },\n { value: 'GREATER_OR_EQUAL', symbol: '≥', display: 'core.operator.greater-or-equal.display' },\n { value: 'LESS_OR_EQUAL', symbol: '≤', display: 'core.operator.less-or-equal.display' },\n { value: 'CONTAIN', symbol: 'join_inner', display: 'core.operator.contain.display' },\n { value: 'NOT_CONTAIN', symbol: 'join', display: 'core.operator.not-contain.display' },\n { value: 'START_WITH', symbol: 'line_start_circle', display: 'core.operator.start-with.display' },\n { value: 'END_WITH', symbol: 'line_end_circle', display: 'core.operator.end-with.display' },\n { value: 'IN', symbol: 'checklist_rtl', display: 'core.operator.in.display' },\n { value: 'NOT_IN', symbol: 'event_list', display: 'core.operator.not-in.display' },\n { value: 'NULL', symbol: 'motion_photos_off', display: 'core.operator.null.display' },\n { value: 'NOT_NULL', symbol: 'adjust', display: 'core.operator.not-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AM,EAAE,QAAQ,EAAE,OAAO,EAAE,gCAAgC,EAAE;;;AChCpF;;AAEG;;;;"}
1
+ {"version":3,"file":"sdcorejs-angular-utilities-models.mjs","sources":["../../../projects/sdcorejs-angular/utilities/models/src/icon.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/pattern.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/empty.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/operator.model.ts","../../../projects/sdcorejs-angular/utilities/models/sdcorejs-angular-utilities-models.ts"],"sourcesContent":["export type SdIconSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp' | 'lucide';\nexport type SdMaterialIconSet = Exclude<SdIconSet, 'lucide'>;\nexport const DefaultSdIconSet: SdIconSet = 'material-icons-outlined';\nexport const DefaultSdMaterialIconSet: SdMaterialIconSet = 'material-icons-outlined';\n","import type { ValidationPatternType, ValidationPattern } from '@sdcorejs/utils/models';\nimport { VALIDATION_PATTERNS } from '@sdcorejs/utils/constants';\nimport { StringUtilities } from '@sdcorejs/utils/fns';\nexport type { ValidationPatternType, ValidationPattern };\nexport { VALIDATION_PATTERNS };\n\n/**\n * @deprecated Use {@link ValidationPatternType} from `@sdcorejs/utils/models` instead.\n * Note: member names changed — PHONE_VN → VN_PHONE, IDVN → VN_ID, IDVN_OR_PASSPORT → VN_ID_OR_PASSPORT.\n */\nexport type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN' | 'PASSPORT' | 'IDVN_OR_PASSPORT' | 'TIME';\n\n/**\n * @deprecated Use {@link ValidationPattern} from `@sdcorejs/utils/models` instead.\n * Note: `regex` field renamed to `pattern` to align with Angular `Validators.pattern()`.\n */\nexport interface SdPatternCommon {\n type: SdPatternType;\n name: string;\n regex: string;\n errorMessage: string;\n}\n\n// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).\n/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */\nexport const SdPatternCommons: SdPatternCommon[] = [\n { type: 'EMAIL', name: 'core.validator.email.name', regex: StringUtilities.REGEX_EMAIL, errorMessage: 'core.validator.email.error' },\n { type: 'PHONE', name: 'core.validator.phone.name', regex: StringUtilities.REGEX_PHONE, errorMessage: 'core.validator.phone.error' },\n {\n type: 'PHONE_VN',\n name: 'core.validator.phone-vn.name',\n regex: StringUtilities.REGEX_VN_PHONE,\n errorMessage: 'core.validator.phone-vn.error',\n },\n { type: 'IDVN', name: 'core.validator.cccd.name', regex: StringUtilities.REGEX_VN_ID, errorMessage: 'core.validator.cccd.error' },\n {\n type: 'PASSPORT',\n name: 'core.validator.passport.name',\n regex: StringUtilities.REGEX_PASSPORT,\n errorMessage: 'core.validator.passport.error',\n },\n {\n type: 'IDVN_OR_PASSPORT',\n name: 'core.validator.id-vn.name',\n regex: StringUtilities.REGEX_VN_ID_OR_PASSPORT,\n errorMessage: 'core.validator.id-vn.error',\n },\n { type: 'TIME', name: 'core.validator.time.name', regex: StringUtilities.REGEX_TIME, errorMessage: 'core.validator.time.error' },\n];\n","import { EMPTY_STR } from '@sdcorejs/utils/constants';\nexport { EMPTY_STR };\n\n/** @deprecated Use {@link EMPTY_STR} from `@sdcorejs/utils/constants` instead */\nexport const SD_EMPTY_STR = EMPTY_STR;\n","import type { MaybeAsync } from '@sdcorejs/utils/models';\nimport { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';\nexport type { MaybeAsync };\nexport { resolveMaybeAsync, normalizeAsync };\n\n/** @deprecated Use {@link MaybeAsync} from `@sdcorejs/utils/models` instead */\nexport type SdMaybeAsync<T> = MaybeAsync<T>;\n/** @deprecated Use {@link resolveMaybeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdResolveMaybeAsync = resolveMaybeAsync;\n/** @deprecated Use {@link normalizeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdNormalizeAsync = normalizeAsync;\n","import type { Operator, OperatorHasData, OperatorNoData } from '@sdcorejs/utils/models';\nexport type { Operator, OperatorHasData, OperatorNoData };\n\n/** @deprecated Use {@link Operator} from `@sdcorejs/utils/models` instead */\nexport type SdOperator = Operator;\n/** @deprecated Use {@link OperatorHasData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorHasData = OperatorHasData;\n/** @deprecated Use {@link OperatorNoData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorNoData = OperatorNoData;\n\n// `display` chứa i18n KEY (không phải chuỗi đã dịch).\n// Consumer phải gọi i18n.t(display) trước khi render ra UI.\n// @deprecated Use `OPERATORS` from `@sdcorejs/utils/constants` instead.\n// Note: OPERATORS has translated display labels; SdOperators uses i18n keys.\nexport const SdOperators: {\n value: Operator;\n symbol?: string;\n display: string;\n}[] = [\n { value: 'EQUAL', symbol: '=', display: 'core.operator.equal.display' },\n { value: 'NOT_EQUAL', symbol: '≠', display: 'core.operator.not-equal.display' },\n { value: 'GREATER_THAN', symbol: '>', display: 'core.operator.greater-than.display' },\n { value: 'LESS_THAN', symbol: '<', display: 'core.operator.less-than.display' },\n { value: 'GREATER_OR_EQUAL', symbol: '≥', display: 'core.operator.greater-or-equal.display' },\n { value: 'LESS_OR_EQUAL', symbol: '≤', display: 'core.operator.less-or-equal.display' },\n { value: 'CONTAIN', symbol: 'join_inner', display: 'core.operator.contain.display' },\n { value: 'NOT_CONTAIN', symbol: 'join', display: 'core.operator.not-contain.display' },\n { value: 'START_WITH', symbol: 'line_start_circle', display: 'core.operator.start-with.display' },\n { value: 'END_WITH', symbol: 'line_end_circle', display: 'core.operator.end-with.display' },\n { value: 'IN', symbol: 'checklist_rtl', display: 'core.operator.in.display' },\n { value: 'NOT_IN', symbol: 'event_list', display: 'core.operator.not-in.display' },\n { value: 'NULL', symbol: 'motion_photos_off', display: 'core.operator.null.display' },\n { value: 'NOT_NULL', symbol: 'adjust', display: 'core.operator.not-null.display' },\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[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