@magic-xpa/angular 4.1300.0-dev4130.304 → 4.1300.0-dev4130.307

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # Magic-xpa/angular
2
-
3
- This package is part of Magic xpa Web Application Framework.
4
- It is used to easily create modern business apps powered by Angular to provide a rich user experience and meet the increasingly complex enterprise business expectations for digital transformation.
5
-
1
+ # Magic-xpa/angular
2
+
3
+ This package is part of Magic xpa Web Application Framework.
4
+ It is used to easily create modern business apps powered by Angular to provide a rich user experience and meet the increasingly complex enterprise business expectations for digital transformation.
5
+
@@ -1,6 +1,6 @@
1
1
  import { isNullOrUndefined, NString, List, isUndefined, StringBuilder, RefParam } from '@magic-xpa/mscorelib';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, inject, Injector, createNgModule, ViewContainerRef, ChangeDetectionStrategy, Component, Directive, EventEmitter, HostListener, Output, Input, ViewChild, ElementRef, input, output, viewChild, ChangeDetectorRef, InjectionToken, DestroyRef, Renderer2, Pipe, effect, forwardRef, NgModule } from '@angular/core';
3
+ import { Injectable, inject, Injector, createNgModule, ViewContainerRef, ChangeDetectionStrategy, Component, Directive, EventEmitter, HostListener, Output, Input, ViewChild, ElementRef, input, output, viewChild, ChangeDetectorRef, viewChildren, InjectionToken, DestroyRef, Renderer2, Pipe, effect, forwardRef, NgModule } from '@angular/core';
4
4
  import * as i1 from '@angular/common';
5
5
  import { DatePipe, CommonModule, formatDate } from '@angular/common';
6
6
  import { ActivatedRoute, Router, NavigationEnd, RouterModule } from '@angular/router';
@@ -1138,7 +1138,7 @@ class MagicViewContainerRef {
1138
1138
  }]
1139
1139
  }], () => [], null); })();
1140
1140
 
1141
- const _c0$3 = ["modalheader"];
1141
+ const _c0$4 = ["modalheader"];
1142
1142
  const _c1$1 = ["modalForeground"];
1143
1143
  function MagicOverlayContainer_Conditional_2_Template(rf, ctx) { if (rf & 1) {
1144
1144
  const _r1 = i0.ɵɵgetCurrentView();
@@ -1455,7 +1455,7 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
1455
1455
  }
1456
1456
  /** @nocollapse */ static ɵfac = function MagicOverlayContainer_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainer)(); };
1457
1457
  /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
1458
- i0.ɵɵviewQuery(_c0$3, 5)(_c1$1, 5);
1458
+ i0.ɵɵviewQuery(_c0$4, 5)(_c1$1, 5);
1459
1459
  } if (rf & 2) {
1460
1460
  let _t;
1461
1461
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
@@ -1571,6 +1571,56 @@ class OverlayContainerMagicProvider {
1571
1571
  type: Injectable
1572
1572
  }], null, null); })();
1573
1573
 
1574
+ /**
1575
+ * Sets of buttons that can be displayed in the confirmation box.
1576
+ * Values match the button codes received from the server (Styles.MSGBOX_BUTTON_xxx)
1577
+ */
1578
+ var MagicConfirmationButtons;
1579
+ (function (MagicConfirmationButtons) {
1580
+ MagicConfirmationButtons[MagicConfirmationButtons["Ok"] = 0] = "Ok";
1581
+ MagicConfirmationButtons[MagicConfirmationButtons["OkCancel"] = 1] = "OkCancel";
1582
+ MagicConfirmationButtons[MagicConfirmationButtons["AbortRetryIgnore"] = 2] = "AbortRetryIgnore";
1583
+ MagicConfirmationButtons[MagicConfirmationButtons["YesNoCancel"] = 3] = "YesNoCancel";
1584
+ MagicConfirmationButtons[MagicConfirmationButtons["YesNo"] = 4] = "YesNo";
1585
+ MagicConfirmationButtons[MagicConfirmationButtons["RetryCancel"] = 5] = "RetryCancel";
1586
+ })(MagicConfirmationButtons || (MagicConfirmationButtons = {}));
1587
+ /**
1588
+ * Button pressed in the confirmation box.
1589
+ * Values match the result codes returned to the server (Styles.MSGBOX_RESULT_xxx)
1590
+ */
1591
+ var MagicConfirmationResult;
1592
+ (function (MagicConfirmationResult) {
1593
+ MagicConfirmationResult[MagicConfirmationResult["Ok"] = 1] = "Ok";
1594
+ MagicConfirmationResult[MagicConfirmationResult["Cancel"] = 2] = "Cancel";
1595
+ MagicConfirmationResult[MagicConfirmationResult["Abort"] = 3] = "Abort";
1596
+ MagicConfirmationResult[MagicConfirmationResult["Retry"] = 4] = "Retry";
1597
+ MagicConfirmationResult[MagicConfirmationResult["Ignore"] = 5] = "Ignore";
1598
+ MagicConfirmationResult[MagicConfirmationResult["Yes"] = 6] = "Yes";
1599
+ MagicConfirmationResult[MagicConfirmationResult["No"] = 7] = "No";
1600
+ })(MagicConfirmationResult || (MagicConfirmationResult = {}));
1601
+ /**
1602
+ * Buttons displayed for each set of buttons, in display order
1603
+ */
1604
+ const ButtonSets = {
1605
+ [MagicConfirmationButtons.Ok]: [MagicConfirmationResult.Ok],
1606
+ [MagicConfirmationButtons.OkCancel]: [MagicConfirmationResult.Ok, MagicConfirmationResult.Cancel],
1607
+ [MagicConfirmationButtons.AbortRetryIgnore]: [MagicConfirmationResult.Abort, MagicConfirmationResult.Retry, MagicConfirmationResult.Ignore],
1608
+ [MagicConfirmationButtons.YesNoCancel]: [MagicConfirmationResult.Yes, MagicConfirmationResult.No, MagicConfirmationResult.Cancel],
1609
+ [MagicConfirmationButtons.YesNo]: [MagicConfirmationResult.Yes, MagicConfirmationResult.No],
1610
+ [MagicConfirmationButtons.RetryCancel]: [MagicConfirmationResult.Retry, MagicConfirmationResult.Cancel]
1611
+ };
1612
+ /**
1613
+ * Text of each button
1614
+ */
1615
+ const ButtonTexts = {
1616
+ [MagicConfirmationResult.Ok]: 'OK',
1617
+ [MagicConfirmationResult.Cancel]: 'Cancel',
1618
+ [MagicConfirmationResult.Abort]: 'Abort',
1619
+ [MagicConfirmationResult.Retry]: 'Retry',
1620
+ [MagicConfirmationResult.Ignore]: 'Ignore',
1621
+ [MagicConfirmationResult.Yes]: 'Yes',
1622
+ [MagicConfirmationResult.No]: 'No'
1623
+ };
1574
1624
  /**
1575
1625
  * This is a base class for the magic confirm components
1576
1626
  */
@@ -1583,21 +1633,24 @@ class BaseMagicConfirmComponent {
1583
1633
  * message of the component
1584
1634
  */
1585
1635
  message;
1636
+ /**
1637
+ * set of buttons to display
1638
+ */
1639
+ buttons = MagicConfirmationButtons.Ok;
1586
1640
  /**
1587
1641
  * onClose Event - to be raised when the component is closed
1588
- * should pass true when OK is pressed and false when cancel is pressed
1642
+ * passes the button that was pressed
1589
1643
  */
1590
1644
  onClose = new EventEmitter();
1591
1645
  /**
1592
1646
  * raises close Event
1593
- * @param result true when OK is pressed and false when cancel is pressed
1594
- *
1647
+ * @param result the button that was pressed.
1595
1648
  */
1596
1649
  OnClose(result) {
1597
1650
  this.onClose.emit(result);
1598
1651
  }
1599
1652
  /** @nocollapse */ static ɵfac = function BaseMagicConfirmComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicConfirmComponent)(); };
1600
- /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, encapsulation: 2, changeDetection: 1 });
1653
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message", buttons: "buttons" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, encapsulation: 2, changeDetection: 1 });
1601
1654
  }
1602
1655
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
1603
1656
  type: Component,
@@ -1606,10 +1659,12 @@ class BaseMagicConfirmComponent {
1606
1659
  type: Input
1607
1660
  }], message: [{
1608
1661
  type: Input
1662
+ }], buttons: [{
1663
+ type: Input
1609
1664
  }], onClose: [{
1610
1665
  type: Output
1611
1666
  }] }); })();
1612
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src/ui/components/base-magic-confirm.component.ts", lineNumber: 14 }); })();
1667
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src/ui/components/base-magic-confirm.component.ts", lineNumber: 65 }); })();
1613
1668
 
1614
1669
  /**
1615
1670
  * This is a base class for the magic alert components
@@ -1669,7 +1724,7 @@ class MagicFocusDirective {
1669
1724
  }]
1670
1725
  }], () => [], null); })();
1671
1726
 
1672
- const _c0$2 = ["overlayContainerWrapper"];
1727
+ const _c0$3 = ["overlayContainerWrapper"];
1673
1728
  class MagicOverlayContainerWrapper {
1674
1729
  /**
1675
1730
  *
@@ -1741,6 +1796,8 @@ class MagicOverlayContainerWrapper {
1741
1796
  else {
1742
1797
  componentRef.setInput('title', this.Parameters().title);
1743
1798
  componentRef.setInput('message', this.Parameters().message);
1799
+ if (this.OverlayTypeParam() === OverlayType.ConfirmationBox)
1800
+ componentRef.setInput('buttons', this.Parameters().buttons);
1744
1801
  }
1745
1802
  componentRef.instance.onClose.subscribe((res) => {
1746
1803
  this.onClose.emit(res);
@@ -1762,7 +1819,7 @@ class MagicOverlayContainerWrapper {
1762
1819
  }
1763
1820
  /** @nocollapse */ static ɵfac = function MagicOverlayContainerWrapper_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainerWrapper)(); };
1764
1821
  /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
1765
- i0.ɵɵviewQuerySignal(ctx.overlayContainerWrapperElementRef, _c0$2, 5);
1822
+ i0.ɵɵviewQuerySignal(ctx.overlayContainerWrapperElementRef, _c0$3, 5);
1766
1823
  } if (rf & 2) {
1767
1824
  i0.ɵɵqueryAdvance();
1768
1825
  } }, inputs: { Component: [1, "Component"], Parameters: [1, "Parameters"], OverlayTypeParam: [1, "OverlayTypeParam"] }, outputs: { onClose: "onClose" }, standalone: false, decls: 7, vars: 0, consts: [["overlayContainerWrapper", ""], ["overlayContent", ""], ["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["magicViewContainerRef", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
@@ -1790,83 +1847,80 @@ class MagicOverlayContainerWrapper {
1790
1847
  }], () => [], { Component: [{ type: i0.Input, args: [{ isSignal: true, alias: "Component", required: false }] }], Parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "Parameters", required: false }] }], OverlayTypeParam: [{ type: i0.Input, args: [{ isSignal: true, alias: "OverlayTypeParam", required: false }] }], onClose: [{ type: i0.Output, args: ["onClose"] }], overlayContainerWrapperElementRef: [{ type: i0.ViewChild, args: ['overlayContainerWrapper', { isSignal: true }] }] }); })();
1791
1848
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src/ui/magic-modal/magic-overlay-container-wrapper.ts", lineNumber: 46 }); })();
1792
1849
 
1850
+ const _c0$2 = ["button"];
1851
+ function MagicConfirmationBoxComponent_For_8_Template(rf, ctx) { if (rf & 1) {
1852
+ const _r1 = i0.ɵɵgetCurrentView();
1853
+ i0.ɵɵelementStart(0, "button", 4, 0);
1854
+ i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_For_8_Template_button_click_0_listener() { const result_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.OnClose(result_r2)); });
1855
+ i0.ɵɵtext(2);
1856
+ i0.ɵɵelementEnd();
1857
+ } if (rf & 2) {
1858
+ const result_r2 = ctx.$implicit;
1859
+ const ctx_r2 = i0.ɵɵnextContext();
1860
+ i0.ɵɵclassProp("cancel", result_r2 === ctx_r2.Result.Cancel);
1861
+ i0.ɵɵadvance(2);
1862
+ i0.ɵɵtextInterpolate(ctx_r2.buttonTexts[result_r2]);
1863
+ } }
1793
1864
  /***
1794
- * This is sample component for the alert message
1795
- */
1796
- class MagicAlertComponent extends BaseMagicAlertComponent {
1797
- /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(__ngFactoryType__) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(__ngFactoryType__ || MagicAlertComponent); }; })();
1798
- /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
1799
- i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1800
- i0.ɵɵtext(3);
1801
- i0.ɵɵelementEnd();
1802
- i0.ɵɵelementStart(4, "p");
1803
- i0.ɵɵtext(5);
1804
- i0.ɵɵelementEnd();
1805
- i0.ɵɵelementStart(6, "button", 1);
1806
- i0.ɵɵlistener("click", function MagicAlertComponent_Template_button_click_6_listener() { return ctx.OnClose(); });
1807
- i0.ɵɵtext(7, "OK");
1808
- i0.ɵɵelementEnd()()();
1809
- } if (rf & 2) {
1810
- i0.ɵɵadvance(3);
1811
- i0.ɵɵtextInterpolate1(" ", ctx.title);
1812
- i0.ɵɵadvance(2);
1813
- i0.ɵɵtextInterpolate1("", ctx.message, " ");
1814
- } }, styles: [".mg-message-background[_ngcontent-%COMP%]{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}"] });
1815
- }
1816
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicAlertComponent, [{
1817
- type: Component,
1818
- args: [{ selector: 'sample-magic-alert-component', template: `<div>
1819
- <div class="mg-message-background">
1820
- <h2> {{title}}</h2>
1821
- <p>{{message}} </p>
1822
-
1823
- <button (click)="OnClose()">OK</button>
1824
- </div>
1825
- </div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
1826
- }], null, null); })();
1827
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src/ui/components/magic-alert.component.ts", lineNumber: 49 }); })();
1828
-
1829
- /***
1830
- * This is sample component for the confirmation box
1865
+ * This is the default confirmation box of Magic.
1866
+ * It masks the application behind it until one of the buttons is pressed
1831
1867
  */
1832
1868
  class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1869
+ Result = MagicConfirmationResult;
1870
+ buttonTexts = ButtonTexts;
1871
+ buttonElements = viewChildren('button', /* @ts-ignore */
1872
+ ...(ngDevMode ? [{ debugName: "buttonElements" }] : /* istanbul ignore next */ []));
1873
+ /**
1874
+ * buttons to display for the current set of buttons
1875
+ */
1876
+ get buttonResults() {
1877
+ return ButtonSets[this.buttons];
1878
+ }
1879
+ /**
1880
+ * focus the first button, so it can be pressed with Enter
1881
+ */
1882
+ ngAfterViewInit() {
1883
+ // the overlay wrapper sets its own focus after this component is created
1884
+ setTimeout(() => this.buttonElements()[0]?.nativeElement.focus());
1885
+ }
1833
1886
  /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(__ngFactoryType__) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(__ngFactoryType__ || MagicConfirmationBoxComponent); }; })();
1834
- /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "mg-message-background"], [3, "click"], [1, "cancel", 3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) { if (rf & 1) {
1835
- i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1887
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], viewQuery: function MagicConfirmationBoxComponent_Query(rf, ctx) { if (rf & 1) {
1888
+ i0.ɵɵviewQuerySignal(ctx.buttonElements, _c0$2, 5);
1889
+ } if (rf & 2) {
1890
+ i0.ɵɵqueryAdvance();
1891
+ } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 2, consts: [["button", ""], [1, "mg-message-mask"], [1, "mg-message-background"], [3, "cancel"], [3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) { if (rf & 1) {
1892
+ i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "h2");
1836
1893
  i0.ɵɵtext(3);
1837
1894
  i0.ɵɵelementEnd();
1838
1895
  i0.ɵɵtext(4);
1839
1896
  i0.ɵɵelement(5, "br")(6, "br");
1840
- i0.ɵɵelementStart(7, "button", 1);
1841
- i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_7_listener() { return ctx.OnClose(true); });
1842
- i0.ɵɵtext(8, "OK");
1843
- i0.ɵɵelementEnd();
1844
- i0.ɵɵelementStart(9, "button", 2);
1845
- i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_9_listener() { return ctx.OnClose(false); });
1846
- i0.ɵɵtext(10, "Cancel");
1847
- i0.ɵɵelementEnd()()();
1897
+ i0.ɵɵrepeaterCreate(7, MagicConfirmationBoxComponent_For_8_Template, 3, 3, "button", 3, i0.ɵɵrepeaterTrackByIdentity);
1898
+ i0.ɵɵelementEnd()();
1848
1899
  } if (rf & 2) {
1849
1900
  i0.ɵɵadvance(3);
1850
1901
  i0.ɵɵtextInterpolate1(" ", ctx.title);
1851
1902
  i0.ɵɵadvance();
1852
1903
  i0.ɵɵtextInterpolate1(" ", ctx.message, " ");
1853
- } }, styles: [".mg-message-background[_ngcontent-%COMP%]{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel[_ngcontent-%COMP%]{background-color:#c1c1c1}"] });
1904
+ i0.ɵɵadvance(3);
1905
+ i0.ɵɵrepeater(ctx.buttonResults);
1906
+ } }, styles: [".mg-message-mask[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#0006}.mg-message-background[_ngcontent-%COMP%]{background-color:#f5f5f5;text-align:center;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel[_ngcontent-%COMP%]{background-color:#c1c1c1}"] });
1854
1907
  }
1855
1908
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicConfirmationBoxComponent, [{
1856
1909
  type: Component,
1857
- args: [{ selector: 'sample-magic-confirmation-box', template: `<div>
1858
- <div class="mg-message-background">
1859
- <h2> {{title}}</h2>
1860
- {{message}}
1861
- <br>
1862
- <br>
1863
-
1864
- <button (click)="OnClose(true)">OK</button>
1865
- <button class="cancel" (click)="OnClose(false)">Cancel</button>
1866
- </div>
1867
- </div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1868
- }], null, null); })();
1869
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src/ui/components/magic-confirmation-box.component.ts", lineNumber: 55 }); })();
1910
+ args: [{ selector: 'sample-magic-confirmation-box', template: `<div class="mg-message-mask">
1911
+ <div class="mg-message-background">
1912
+ <h2> {{title}}</h2>
1913
+ {{message}}
1914
+ <br>
1915
+ <br>
1916
+
1917
+ @for (result of buttonResults; track result) {
1918
+ <button #button [class.cancel]="result === Result.Cancel" (click)="OnClose(result)">{{buttonTexts[result]}}</button>
1919
+ }
1920
+ </div>
1921
+ </div>`, standalone: false, styles: [".mg-message-mask{position:fixed;inset:0;background-color:#0006}.mg-message-background{background-color:#f5f5f5;text-align:center;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1922
+ }], null, { buttonElements: [{ type: i0.ViewChildren, args: ['button', { isSignal: true }] }] }); })();
1923
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src/ui/components/magic-confirmation-box.component.ts", lineNumber: 65 }); })();
1870
1924
 
1871
1925
  /**
1872
1926
  * Service managing overlay windows
@@ -1878,22 +1932,9 @@ class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1878
1932
  */
1879
1933
  class ConfirmationComponentsMagicProvider {
1880
1934
  /**
1881
- * Return true when use default javascript alert and confirmation or return false to provide custom components
1882
- * @returns true is we want to use default javascript alert and confirmation
1883
- */
1884
- showDefaultConfirmations() {
1885
- return true;
1886
- }
1887
- /**
1888
- * Returns component that will replace javascript alert. The component will be used only if showDefaultConfirmations = false
1889
- * @returns component that will replace javascript Alert
1890
- */
1891
- getAlertComponent() {
1892
- return MagicAlertComponent;
1893
- }
1894
- /**
1895
- * Returns component that will replace javascript confirmation box. The component will be used only if showDefaultConfirmations = false
1896
- * @returns component that will replace javascript confirmation box
1935
+ * Returns the component used to display the confirmation box, for all sets of buttons.
1936
+ * Override it to provide a custom component that extends BaseMagicConfirmComponent
1937
+ * @returns component used to display the confirmation box
1897
1938
  */
1898
1939
  getConfirmtionComponent() {
1899
1940
  return MagicConfirmationBoxComponent;
@@ -2040,22 +2081,20 @@ class OverlayWindowService {
2040
2081
  * @param style Magic style
2041
2082
  */
2042
2083
  openConfirmationBox(title, msg, style) {
2043
- //show default confirmations
2044
- if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
2045
- let res = confirmationBox.showConfirmationBox(title, msg, style);
2046
- this.finishConfirmation(style, res);
2047
- }
2048
- else {
2049
- //show custom confirmations
2050
- let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
2051
- let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
2052
- let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
2053
- componentRef.instance.onClose.subscribe((res) => {
2054
- this.overlayWindowsContainerViewRef.remove();
2055
- this.overlayWindowFocusManager.popDialog();
2056
- this.finishConfirmation(style, res);
2057
- });
2058
- }
2084
+ let overlayType;
2085
+ //show default confirmations - the confirmation box, for all sets of buttons
2086
+ let comp = this.confirmationComponentsMagicProvider.getConfirmtionComponent();
2087
+ overlayType = OverlayType.ConfirmationBox;
2088
+ // style holds both the buttons and the icon: the lowest 4 bits are the button set (Styles.MSGBOX_BUTTON_xxx),
2089
+ // and the next 4 bits are the icon (Styles.MSGBOX_ICON_xxx), e.g., YES_NO | ICON_QUESTION = 0x04 | 0x20 = 0x24.
2090
+ // "& 0x0F" keeps only the lowest 4 bits, so 0x24 & 0x0F = 0x04 = MagicConfirmationButtons.YesNo
2091
+ let buttons = style & 0x0F;
2092
+ let componentRef = this.createModalComponent({ title: title, message: msg, buttons: buttons }, comp, overlayType);
2093
+ componentRef.instance.onClose.subscribe((res) => {
2094
+ this.overlayWindowsContainerViewRef.remove();
2095
+ this.overlayWindowFocusManager.popDialog();
2096
+ this.sendConfirmationResult(res);
2097
+ });
2059
2098
  }
2060
2099
  /**
2061
2100
  * This method is called on close of the confirmation
@@ -2063,8 +2102,15 @@ class OverlayWindowService {
2063
2102
  * @param result
2064
2103
  */
2065
2104
  finishConfirmation(style, result) {
2105
+ this.sendConfirmationResult(confirmationBox.convertToExcpectedResultBox(style, result));
2106
+ }
2107
+ /**
2108
+ * Sends the button pressed in the confirmation to the engine
2109
+ * @param result the button pressed
2110
+ */
2111
+ sendConfirmationResult(result) {
2066
2112
  let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
2067
- guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
2113
+ guiEvent.keyCode = result;
2068
2114
  this.engineMagicService.insertEvent(guiEvent);
2069
2115
  }
2070
2116
  /**
@@ -6701,6 +6747,42 @@ class NonMagicControlDirective {
6701
6747
  args: ['NonMagicControl']
6702
6748
  }] }); })();
6703
6749
 
6750
+ /***
6751
+ * This is sample component for the alert message
6752
+ */
6753
+ class MagicAlertComponent extends BaseMagicAlertComponent {
6754
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(__ngFactoryType__) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(__ngFactoryType__ || MagicAlertComponent); }; })();
6755
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
6756
+ i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
6757
+ i0.ɵɵtext(3);
6758
+ i0.ɵɵelementEnd();
6759
+ i0.ɵɵelementStart(4, "p");
6760
+ i0.ɵɵtext(5);
6761
+ i0.ɵɵelementEnd();
6762
+ i0.ɵɵelementStart(6, "button", 1);
6763
+ i0.ɵɵlistener("click", function MagicAlertComponent_Template_button_click_6_listener() { return ctx.OnClose(); });
6764
+ i0.ɵɵtext(7, "OK");
6765
+ i0.ɵɵelementEnd()()();
6766
+ } if (rf & 2) {
6767
+ i0.ɵɵadvance(3);
6768
+ i0.ɵɵtextInterpolate1(" ", ctx.title);
6769
+ i0.ɵɵadvance(2);
6770
+ i0.ɵɵtextInterpolate1("", ctx.message, " ");
6771
+ } }, styles: [".mg-message-background[_ngcontent-%COMP%]{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}"] });
6772
+ }
6773
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicAlertComponent, [{
6774
+ type: Component,
6775
+ args: [{ selector: 'sample-magic-alert-component', template: `<div>
6776
+ <div class="mg-message-background">
6777
+ <h2> {{title}}</h2>
6778
+ <p>{{message}} </p>
6779
+
6780
+ <button (click)="OnClose()">OK</button>
6781
+ </div>
6782
+ </div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
6783
+ }], null, null); })();
6784
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src/ui/components/magic-alert.component.ts", lineNumber: 49 }); })();
6785
+
6704
6786
  class Time24MagicPipe {
6705
6787
  _task = inject(TaskMagicService);
6706
6788
  constructor() {
@@ -7167,5 +7249,5 @@ class ModalFormDefinition {
7167
7249
  * Generated bundle index. Do not edit.
7168
7250
  */
7169
7251
 
7170
- export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicChangeDetectionService, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, MagicModalProperties, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, SubscriberService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
7252
+ export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, ButtonSets, ButtonTexts, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicChangeDetectionService, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicConfirmationButtons, MagicConfirmationResult, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, MagicModalProperties, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, SubscriberService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
7171
7253
  //# sourceMappingURL=magic-xpa-angular.mjs.map