@agorapulse/ui-components 22.0.6-beta.1 → 22.0.8

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 (64) hide show
  1. package/agorapulse-ui-components-22.0.8.tgz +0 -0
  2. package/fesm2022/agorapulse-ui-components-action-dropdown.mjs +2 -2
  3. package/fesm2022/agorapulse-ui-components-action-dropdown.mjs.map +1 -1
  4. package/fesm2022/agorapulse-ui-components-badge.mjs +2 -2
  5. package/fesm2022/agorapulse-ui-components-badge.mjs.map +1 -1
  6. package/fesm2022/agorapulse-ui-components-button.mjs +2 -2
  7. package/fesm2022/agorapulse-ui-components-button.mjs.map +1 -1
  8. package/fesm2022/agorapulse-ui-components-checkbox.mjs +2 -2
  9. package/fesm2022/agorapulse-ui-components-checkbox.mjs.map +1 -1
  10. package/fesm2022/agorapulse-ui-components-close-button.mjs +2 -2
  11. package/fesm2022/agorapulse-ui-components-close-button.mjs.map +1 -1
  12. package/fesm2022/agorapulse-ui-components-counter.mjs +2 -2
  13. package/fesm2022/agorapulse-ui-components-counter.mjs.map +1 -1
  14. package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs +4 -4
  15. package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs.map +1 -1
  16. package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +6 -4
  17. package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
  18. package/fesm2022/agorapulse-ui-components-form-field.mjs +2 -2
  19. package/fesm2022/agorapulse-ui-components-form-field.mjs.map +1 -1
  20. package/fesm2022/agorapulse-ui-components-form-message.mjs +2 -2
  21. package/fesm2022/agorapulse-ui-components-form-message.mjs.map +1 -1
  22. package/fesm2022/agorapulse-ui-components-icon-button.mjs +2 -2
  23. package/fesm2022/agorapulse-ui-components-icon-button.mjs.map +1 -1
  24. package/fesm2022/agorapulse-ui-components-input-group.mjs +2 -2
  25. package/fesm2022/agorapulse-ui-components-input-group.mjs.map +1 -1
  26. package/fesm2022/agorapulse-ui-components-labels.mjs +2 -2
  27. package/fesm2022/agorapulse-ui-components-labels.mjs.map +1 -1
  28. package/fesm2022/agorapulse-ui-components-legacy-textarea.mjs +2 -2
  29. package/fesm2022/agorapulse-ui-components-legacy-textarea.mjs.map +1 -1
  30. package/fesm2022/agorapulse-ui-components-modal.mjs +17 -13
  31. package/fesm2022/agorapulse-ui-components-modal.mjs.map +1 -1
  32. package/fesm2022/agorapulse-ui-components-nav-selector.mjs +16 -16
  33. package/fesm2022/agorapulse-ui-components-nav-selector.mjs.map +1 -1
  34. package/fesm2022/agorapulse-ui-components-radio-button-card.mjs +2 -2
  35. package/fesm2022/agorapulse-ui-components-radio-button-card.mjs.map +1 -1
  36. package/fesm2022/agorapulse-ui-components-radio.mjs +2 -2
  37. package/fesm2022/agorapulse-ui-components-radio.mjs.map +1 -1
  38. package/fesm2022/agorapulse-ui-components-segmented-control.mjs +2 -2
  39. package/fesm2022/agorapulse-ui-components-segmented-control.mjs.map +1 -1
  40. package/fesm2022/agorapulse-ui-components-select.mjs +64 -8
  41. package/fesm2022/agorapulse-ui-components-select.mjs.map +1 -1
  42. package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs +2 -2
  43. package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs.map +1 -1
  44. package/fesm2022/agorapulse-ui-components-split-button.mjs +2 -2
  45. package/fesm2022/agorapulse-ui-components-split-button.mjs.map +1 -1
  46. package/fesm2022/agorapulse-ui-components-status-card.mjs +3 -3
  47. package/fesm2022/agorapulse-ui-components-status-card.mjs.map +1 -1
  48. package/fesm2022/agorapulse-ui-components-status.mjs +3 -3
  49. package/fesm2022/agorapulse-ui-components-status.mjs.map +1 -1
  50. package/fesm2022/agorapulse-ui-components-tabs.mjs +5 -3
  51. package/fesm2022/agorapulse-ui-components-tabs.mjs.map +1 -1
  52. package/fesm2022/agorapulse-ui-components-tag.mjs +2 -2
  53. package/fesm2022/agorapulse-ui-components-tag.mjs.map +1 -1
  54. package/fesm2022/agorapulse-ui-components-toggle.mjs +2 -2
  55. package/fesm2022/agorapulse-ui-components-toggle.mjs.map +1 -1
  56. package/fesm2022/agorapulse-ui-components-tooltip.mjs +2 -2
  57. package/fesm2022/agorapulse-ui-components-tooltip.mjs.map +1 -1
  58. package/package.json +1 -1
  59. package/types/agorapulse-ui-components-filter-dropdown.d.ts +8 -0
  60. package/types/agorapulse-ui-components-modal.d.ts +19 -7
  61. package/types/agorapulse-ui-components-select.d.ts +10 -1
  62. package/types/agorapulse-ui-components-status-card.d.ts +1 -11
  63. package/types/agorapulse-ui-components-status.d.ts +1 -11
  64. package/agorapulse-ui-components-22.0.6-beta.1.tgz +0 -0
@@ -35,19 +35,6 @@ class ModalComponent {
35
35
  * Use it to open a modal containing the {@link componentType} component, with the right configuration.
36
36
  */
37
37
  static openDialog(matDialog, config, componentType) {
38
- return this.openWithComponent(matDialog, config, componentType);
39
- }
40
- /**
41
- * Use it to open a modal containing the {@link componentType} component, with the right configuration, and wait for it to be closed.
42
- */
43
- static async openDialogAndWait(matDialog, config, componentType) {
44
- return firstValueFrom(ModalComponent.openDialog(matDialog, config, componentType).afterClosed());
45
- }
46
- /**
47
- * Use it to open a modal containing the {@link componentType} component, with the right configuration.
48
- * @deprecated use {@link openDialog} instead for better type inference
49
- */
50
- static openWithComponent(matDialog, config, componentType) {
51
38
  let matDialogConfig;
52
39
  if (config) {
53
40
  matDialogConfig = config.matDialogConfig;
@@ -70,8 +57,25 @@ class ModalComponent {
70
57
  if (config?.backdropCloseEnable === true) {
71
58
  dialogRef.disableClose = false;
72
59
  }
60
+ // `ExtractDialogRef<C>` stays unresolved as long as `C` is a type parameter, so the compiler
61
+ // cannot see that `MatDialog.open` already returns the right ref shape.
73
62
  return dialogRef;
74
63
  }
64
+ /**
65
+ * Use it to open a modal containing the {@link componentType} component, with the right configuration, and wait for it to be closed.
66
+ *
67
+ * Resolves `undefined` when the modal is dismissed without a result, e.g. through the backdrop.
68
+ */
69
+ static async openDialogAndWait(matDialog, config, componentType) {
70
+ return firstValueFrom(ModalComponent.openDialog(matDialog, config, componentType).afterClosed());
71
+ }
72
+ /**
73
+ * Use it to open a modal containing the {@link componentType} component, with the right configuration.
74
+ * @deprecated use {@link openDialog} instead, which this now simply forwards to
75
+ */
76
+ static openWithComponent(matDialog, config, componentType) {
77
+ return ModalComponent.openDialog(matDialog, config, componentType);
78
+ }
75
79
  /**
76
80
  * Use it to open a modal containing the provided templates, with the right configuration.
77
81
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-modal.mjs","sources":["../../../libs/ui-components/modal/src/modal.component.ts","../../../libs/ui-components/modal/src/modal.component.html","../../../libs/ui-components/modal/src/agorapulse-ui-components-modal.ts"],"sourcesContent":["import { IconButtonComponent } from '@agorapulse/ui-components/icon-button';\nimport { apClose, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';\nimport { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';\nimport { firstValueFrom } from 'rxjs';\n\nexport interface ModalConfig<T = unknown> extends ModalConfigBase<T> {\n closable?: boolean;\n headerBottomBorderEnabled?: boolean;\n}\n\nexport interface ModalConfigBase<T> {\n backdropCloseEnable?: boolean;\n matDialogConfig?: MatDialogConfig<T>;\n}\n\ninterface HasDialogRef<T, R> {\n dialogRef: MatDialogRef<T, R>;\n}\ntype HasModalData<D> = {\n [x in 'modalData' | 'dialogData' | 'data']: D;\n};\n\ntype ExtractDialogRef<C> = C extends HasDialogRef<infer T, infer R> ? MatDialogRef<T, R> : MatDialogRef<C>;\ntype ExtractModalData<C> = C extends HasModalData<infer D> ? D : unknown;\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-modal',\n templateUrl: 'modal.component.html',\n imports: [SymbolComponent, NgStyle, NgClass, NgTemplateOutlet, IconButtonComponent],\n styleUrls: ['modal.component.scss'],\n})\nexport class ModalComponent {\n static readonly PANEL_CLASS = 'modal-container';\n\n constructor(\n public dialogRef: MatDialogRef<ModalComponent, void>,\n public symbolRegistry: SymbolRegistry\n ) {\n dialogRef.disableClose = true;\n this.symbolRegistry.registerSymbols([apClose]);\n }\n\n @Input() closable = false;\n @Input() headerBottomBorderEnabled = false;\n @Input() footerTemplate: TemplateRef<any> | undefined = undefined;\n @Input() footerVisible = true;\n @Input() headerTemplate: TemplateRef<any> | undefined = undefined;\n @Input() headerVisible = true;\n @Input({\n required: true,\n })\n mainTemplate!: TemplateRef<any>;\n @Input() sidePaneTemplate: TemplateRef<any> | undefined = undefined;\n @Input() sidePaneStyle: { [arg: string]: string } | undefined = {};\n @Input() containerStyle: { [arg: string]: string } | undefined = {};\n @Input() headerStyle: { [arg: string]: string } | undefined = {};\n @Input() contentStyle: { [arg: string]: string } | undefined = {};\n @Input() footerStyle: { [arg: string]: string } | undefined = {};\n @Input() defaultLayout = true;\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration.\n */\n static openDialog<C>(matDialog: MatDialog, config: ModalConfigBase<ExtractModalData<C>> | undefined, componentType: ComponentType<C>) {\n return this.openWithComponent(matDialog, config, componentType) as ExtractDialogRef<C>;\n }\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration, and wait for it to be closed.\n */\n static async openDialogAndWait<C>(\n matDialog: MatDialog,\n config: ModalConfigBase<ExtractModalData<C>> | undefined,\n componentType: ComponentType<C>\n ): Promise<C extends HasDialogRef<unknown, infer R> ? R : unknown> {\n return firstValueFrom(ModalComponent.openDialog(matDialog, config, componentType).afterClosed());\n }\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration.\n * @deprecated use {@link openDialog} instead for better type inference\n */\n static openWithComponent<T, Y>(\n matDialog: MatDialog,\n config: ModalConfigBase<Y> | undefined,\n componentType: ComponentType<T>\n ): MatDialogRef<T> {\n let matDialogConfig: MatDialogConfig<Y> | undefined;\n if (config) {\n matDialogConfig = config.matDialogConfig;\n if (matDialogConfig && config.matDialogConfig) {\n matDialogConfig.panelClass = Array.isArray(config.matDialogConfig.panelClass)\n ? [...config.matDialogConfig.panelClass, ModalComponent.PANEL_CLASS] // in case where the panelClass is an array\n : [config.matDialogConfig.panelClass ?? '', ModalComponent.PANEL_CLASS]; // in the other case, it's a String\n } else {\n matDialogConfig = { panelClass: ModalComponent.PANEL_CLASS };\n }\n } else {\n matDialogConfig = {\n panelClass: ModalComponent.PANEL_CLASS,\n };\n }\n matDialogConfig.autoFocus = false; // Prevent first button to be focused\n\n const dialogRef = matDialog.open(componentType, matDialogConfig);\n if (config?.backdropCloseEnable === true) {\n dialogRef.disableClose = false;\n }\n return dialogRef;\n }\n\n /**\n * Use it to open a modal containing the provided templates, with the right configuration.\n */\n static openWithTemplates<T>(\n matDialog: MatDialog,\n headerTemplate: TemplateRef<any> | undefined,\n mainTemplate: TemplateRef<any>,\n footerTemplate?: TemplateRef<any> | undefined,\n config?: ModalConfig<T>,\n sidePaneTemplate?: TemplateRef<any> | undefined\n ): MatDialogRef<ModalComponent> {\n const dialogRef = ModalComponent.openDialog(matDialog, config, ModalComponent);\n dialogRef.componentInstance.closable = config && config.closable ? config.closable : false;\n dialogRef.componentInstance.headerBottomBorderEnabled =\n config && config.headerBottomBorderEnabled ? config.headerBottomBorderEnabled : false;\n dialogRef.componentInstance.headerTemplate = headerTemplate;\n dialogRef.componentInstance.mainTemplate = mainTemplate;\n dialogRef.componentInstance.footerTemplate = footerTemplate;\n dialogRef.componentInstance.sidePaneTemplate = sidePaneTemplate;\n return dialogRef;\n }\n\n close(): void {\n this.dialogRef.close();\n }\n}\n","@if (sidePaneTemplate) {\n <div\n [ngStyle]=\"sidePaneStyle\"\n [ngClass]=\"{ pane: defaultLayout }\">\n <ng-template [ngTemplateOutlet]=\"sidePaneTemplate\" />\n </div>\n}\n\n<div\n class=\"modal-wrapper\"\n [ngStyle]=\"containerStyle\"\n [class.default-layout]=\"defaultLayout\">\n @if (closable) {\n <ap-icon-button\n class=\"close-button\"\n ariaLabel=\"Close button\"\n name=\"close-button\"\n color=\"none\"\n type=\"flat\"\n (onClick)=\"close()\">\n <ap-symbol symbolId=\"close\" />\n </ap-icon-button>\n }\n @if (headerTemplate && headerVisible) {\n <div\n [ngStyle]=\"headerStyle\"\n [ngClass]=\"{ header: defaultLayout }\"\n [class.border-bottom]=\"headerBottomBorderEnabled\">\n <ng-template [ngTemplateOutlet]=\"headerTemplate\" />\n </div>\n }\n @if (mainTemplate) {\n <div\n [ngStyle]=\"contentStyle\"\n [class.content]=\"defaultLayout\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\" />\n </div>\n }\n @if (footerTemplate && footerVisible) {\n <div\n [ngStyle]=\"footerStyle\"\n [ngClass]=\"{ footer: defaultLayout }\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\" />\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MAmCa,cAAc,CAAA;AAIZ,IAAA,SAAA;AACA,IAAA,cAAA;AAJX,IAAA,OAAgB,WAAW,GAAG,iBAAiB;IAE/C,WAAA,CACW,SAA6C,EAC7C,cAA8B,EAAA;QAD9B,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,cAAc,GAAd,cAAc;AAErB,QAAA,SAAS,CAAC,YAAY,GAAG,IAAI;QAC7B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;IAClD;IAES,QAAQ,GAAG,KAAK;IAChB,yBAAyB,GAAG,KAAK;IACjC,cAAc,GAAiC,SAAS;IACxD,aAAa,GAAG,IAAI;IACpB,cAAc,GAAiC,SAAS;IACxD,aAAa,GAAG,IAAI;AAI7B,IAAA,YAAY;IACH,gBAAgB,GAAiC,SAAS;IAC1D,aAAa,GAA0C,EAAE;IACzD,cAAc,GAA0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AA,EAAA,SAAA,EAAA,MAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,EAAA,SAAA,EAAA,QAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGzE,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AACW,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,UAAU,WAEX,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,EAAA,QAAA,EAAA,+4CAAA,EAAA,MAAA,EAAA,CAAA,4mNAAA,CAAA,EAAA;;sBAclF;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,QAAQ,EAAE,IAAI;AACjB,qBAAA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;;AE9DL;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-modal.mjs","sources":["../../../libs/ui-components/modal/src/modal.component.ts","../../../libs/ui-components/modal/src/modal.component.html","../../../libs/ui-components/modal/src/agorapulse-ui-components-modal.ts"],"sourcesContent":["import { IconButtonComponent } from '@agorapulse/ui-components/icon-button';\nimport { apClose, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';\nimport { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';\nimport { firstValueFrom } from 'rxjs';\n\nexport interface ModalConfig<T = unknown> extends ModalConfigBase<T> {\n closable?: boolean;\n headerBottomBorderEnabled?: boolean;\n}\n\nexport interface ModalConfigBase<T> {\n backdropCloseEnable?: boolean;\n matDialogConfig?: MatDialogConfig<T>;\n}\n\ninterface HasDialogRef<T, R> {\n dialogRef: MatDialogRef<T, R>;\n}\n\ntype ExtractDialogRef<C> = C extends HasDialogRef<infer T, infer R> ? MatDialogRef<T, R> : MatDialogRef<C>;\ntype ExtractModalResult<C> = C extends HasDialogRef<unknown, infer R> ? R : unknown;\n\n/**\n * Reads the modal data type off whichever of the three conventional property names the component\n * declares. Checked one at a time, so declaring a single one is enough and `modalData` wins over a\n * plain `data`. Keep the properties required: `{ data?: infer D }` would match every component with\n * `D = unknown` and silence the check again.\n */\ntype ExtractModalData<C> = C extends { modalData: infer D }\n ? D\n : C extends { dialogData: infer D }\n ? D\n : C extends { data: infer D }\n ? D\n : unknown;\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-modal',\n templateUrl: 'modal.component.html',\n imports: [SymbolComponent, NgStyle, NgClass, NgTemplateOutlet, IconButtonComponent],\n styleUrls: ['modal.component.scss'],\n})\nexport class ModalComponent {\n static readonly PANEL_CLASS = 'modal-container';\n\n constructor(\n public dialogRef: MatDialogRef<ModalComponent, void>,\n public symbolRegistry: SymbolRegistry\n ) {\n dialogRef.disableClose = true;\n this.symbolRegistry.registerSymbols([apClose]);\n }\n\n @Input() closable = false;\n @Input() headerBottomBorderEnabled = false;\n @Input() footerTemplate: TemplateRef<any> | undefined = undefined;\n @Input() footerVisible = true;\n @Input() headerTemplate: TemplateRef<any> | undefined = undefined;\n @Input() headerVisible = true;\n @Input({\n required: true,\n })\n mainTemplate!: TemplateRef<any>;\n @Input() sidePaneTemplate: TemplateRef<any> | undefined = undefined;\n @Input() sidePaneStyle: { [arg: string]: string } | undefined = {};\n @Input() containerStyle: { [arg: string]: string } | undefined = {};\n @Input() headerStyle: { [arg: string]: string } | undefined = {};\n @Input() contentStyle: { [arg: string]: string } | undefined = {};\n @Input() footerStyle: { [arg: string]: string } | undefined = {};\n @Input() defaultLayout = true;\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration.\n */\n static openDialog<C>(\n matDialog: MatDialog,\n config: ModalConfigBase<ExtractModalData<C>> | undefined,\n componentType: ComponentType<C>\n ): ExtractDialogRef<C> {\n let matDialogConfig: MatDialogConfig<ExtractModalData<C>> | undefined;\n if (config) {\n matDialogConfig = config.matDialogConfig;\n if (matDialogConfig && config.matDialogConfig) {\n matDialogConfig.panelClass = Array.isArray(config.matDialogConfig.panelClass)\n ? [...config.matDialogConfig.panelClass, ModalComponent.PANEL_CLASS] // in case where the panelClass is an array\n : [config.matDialogConfig.panelClass ?? '', ModalComponent.PANEL_CLASS]; // in the other case, it's a String\n } else {\n matDialogConfig = { panelClass: ModalComponent.PANEL_CLASS };\n }\n } else {\n matDialogConfig = {\n panelClass: ModalComponent.PANEL_CLASS,\n };\n }\n matDialogConfig.autoFocus = false; // Prevent first button to be focused\n\n const dialogRef = matDialog.open(componentType, matDialogConfig);\n if (config?.backdropCloseEnable === true) {\n dialogRef.disableClose = false;\n }\n // `ExtractDialogRef<C>` stays unresolved as long as `C` is a type parameter, so the compiler\n // cannot see that `MatDialog.open` already returns the right ref shape.\n return dialogRef as ExtractDialogRef<C>;\n }\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration, and wait for it to be closed.\n *\n * Resolves `undefined` when the modal is dismissed without a result, e.g. through the backdrop.\n */\n static async openDialogAndWait<C>(\n matDialog: MatDialog,\n config: ModalConfigBase<ExtractModalData<C>> | undefined,\n componentType: ComponentType<C>\n ): Promise<ExtractModalResult<C> | undefined> {\n return firstValueFrom(ModalComponent.openDialog(matDialog, config, componentType).afterClosed());\n }\n\n /**\n * Use it to open a modal containing the {@link componentType} component, with the right configuration.\n * @deprecated use {@link openDialog} instead, which this now simply forwards to\n */\n static openWithComponent<C>(\n matDialog: MatDialog,\n config: ModalConfigBase<ExtractModalData<C>> | undefined,\n componentType: ComponentType<C>\n ): ExtractDialogRef<C> {\n return ModalComponent.openDialog(matDialog, config, componentType);\n }\n\n /**\n * Use it to open a modal containing the provided templates, with the right configuration.\n */\n static openWithTemplates<T>(\n matDialog: MatDialog,\n headerTemplate: TemplateRef<any> | undefined,\n mainTemplate: TemplateRef<any>,\n footerTemplate?: TemplateRef<any> | undefined,\n config?: ModalConfig<T>,\n sidePaneTemplate?: TemplateRef<any> | undefined\n ): MatDialogRef<ModalComponent> {\n const dialogRef = ModalComponent.openDialog(matDialog, config, ModalComponent);\n dialogRef.componentInstance.closable = config && config.closable ? config.closable : false;\n dialogRef.componentInstance.headerBottomBorderEnabled =\n config && config.headerBottomBorderEnabled ? config.headerBottomBorderEnabled : false;\n dialogRef.componentInstance.headerTemplate = headerTemplate;\n dialogRef.componentInstance.mainTemplate = mainTemplate;\n dialogRef.componentInstance.footerTemplate = footerTemplate;\n dialogRef.componentInstance.sidePaneTemplate = sidePaneTemplate;\n return dialogRef;\n }\n\n close(): void {\n this.dialogRef.close();\n }\n}\n","@if (sidePaneTemplate) {\n <div\n [ngStyle]=\"sidePaneStyle\"\n [ngClass]=\"{ pane: defaultLayout }\">\n <ng-template [ngTemplateOutlet]=\"sidePaneTemplate\" />\n </div>\n}\n\n<div\n class=\"modal-wrapper\"\n [ngStyle]=\"containerStyle\"\n [class.default-layout]=\"defaultLayout\">\n @if (closable) {\n <ap-icon-button\n class=\"close-button\"\n ariaLabel=\"Close button\"\n name=\"close-button\"\n color=\"none\"\n type=\"flat\"\n (onClick)=\"close()\">\n <ap-symbol symbolId=\"close\" />\n </ap-icon-button>\n }\n @if (headerTemplate && headerVisible) {\n <div\n [ngStyle]=\"headerStyle\"\n [ngClass]=\"{ header: defaultLayout }\"\n [class.border-bottom]=\"headerBottomBorderEnabled\">\n <ng-template [ngTemplateOutlet]=\"headerTemplate\" />\n </div>\n }\n @if (mainTemplate) {\n <div\n [ngStyle]=\"contentStyle\"\n [class.content]=\"defaultLayout\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\" />\n </div>\n }\n @if (footerTemplate && footerVisible) {\n <div\n [ngStyle]=\"footerStyle\"\n [ngClass]=\"{ footer: defaultLayout }\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\" />\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MA8Ca,cAAc,CAAA;AAIZ,IAAA,SAAA;AACA,IAAA,cAAA;AAJX,IAAA,OAAgB,WAAW,GAAG,iBAAiB;IAE/C,WAAA,CACW,SAA6C,EAC7C,cAA8B,EAAA;QAD9B,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,cAAc,GAAd,cAAc;AAErB,QAAA,SAAS,CAAC,YAAY,GAAG,IAAI;QAC7B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;IAClD;IAES,QAAQ,GAAG,KAAK;IAChB,yBAAyB,GAAG,KAAK;IACjC,cAAc,GAAiC,SAAS;IACxD,aAAa,GAAG,IAAI;IACpB,cAAc,GAAiC,SAAS;IACxD,aAAa,GAAG,IAAI;AAI7B,IAAA,YAAY;IACH,gBAAgB,GAAiC,SAAS;IAC1D,aAAa,GAA0C,EAAE;IACzD,cAAc,GAA0C,EAAE;IAC1D,WAAW,GAA0C,EAAE;IACvD,YAAY,GAA0C,EAAE;IACxD,WAAW,GAA0C,EAAE;IACvD,aAAa,GAAG,IAAI;AAE7B;;AAEG;AACH,IAAA,OAAO,UAAU,CACb,SAAoB,EACpB,MAAwD,EACxD,aAA+B,EAAA;AAE/B,QAAA,IAAI,eAAiE;QACrE,IAAI,MAAM,EAAE;AACR,YAAA,eAAe,GAAG,MAAM,CAAC,eAAe;AACxC,YAAA,IAAI,eAAe,IAAI,MAAM,CAAC,eAAe,EAAE;AAC3C,gBAAA,eAAe,CAAC,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU;AACxE,sBAAE,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,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