turbogui-angular 20.3.0 → 20.4.0

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.
@@ -943,19 +943,14 @@ class DialogService extends SingletoneStrictClass {
943
943
  * Show a dialog with a calendar to let the user pick a date.
944
944
  *
945
945
  * @param properties An object containing the different visual and textual options that this dialog allows:
946
- * - id: The html unique identifier that the dialog will have once created. If not specified, no id will be explicitly set
947
- * - width: Specify the css value for the default dialog width. As the dialog is responsive, the value will be automatically
948
- * reduced if the available screen is not enough, and will reach the desired value otherwise. We can set any css unit like pixels,
949
- * %, vh, vw, or any other. For example: '400px', '50%', etc.
950
- * - maxWidth: Defines the maximum width that the dialog will have regarding the viewport. We can specify it in % or vw, just like is done in
951
- * css. By default it is defined as 96vw, which will fit 96% of the viewport on small devices
952
- * - height: TODO docs
953
- * - maxHeight: TODO docs
954
- * - modal: True (default) if selecting an option is mandatory to close the dialog, false if the dialog can be closed
955
- * by the user clicking outside it
956
- * - title: An optional dialog title
957
- * - viewContainerRef: This is important to propagate providers from a parent component to this dialog. We must specify
958
- * this reference to make sure the same services injected on the parent are available too at the child dialog
946
+ * - id: see addDialog() docs
947
+ * - width: see addDialog() docs
948
+ * - maxWidth: see addDialog() docs
949
+ * - height: see addDialog() docs
950
+ * - maxHeight: see addDialog() docs
951
+ * - modal: see addDialog() docs
952
+ * - title: see addDialog() docs
953
+ * - viewContainerRef: see addDialog() docs
959
954
  *
960
955
  * @returns A Promise that resolves to a Date() object selected by the user or null if no selection was made
961
956
  */
@@ -975,6 +970,44 @@ class DialogService extends SingletoneStrictClass {
975
970
  });
976
971
  return selection.index === -1 ? null : selection.value;
977
972
  }
973
+ /**
974
+ * Show a dialog with an error message and a single option button to close it.
975
+ *
976
+ * This method is a shortcut for addDialog() method using DialogErrorComponent as the dialog component class
977
+ *
978
+ * @param properties An object containing the different visual and textual options that this dialog allows:
979
+ * - title (mandatory): The dialog title
980
+ * - option (mandatory): The text to place on the single option button
981
+ * - description: An optional description text to show below the title
982
+ * - id: see addDialog() docs
983
+ * - width: see addDialog() docs
984
+ * - maxWidth: see addDialog() docs
985
+ * - height: see addDialog() docs
986
+ * - maxHeight: see addDialog() docs
987
+ * - modal: see addDialog() docs
988
+ * - dialogErrorComponentClass: A custom component class to use instead of the default DialogErrorComponent. This custom component must extend DialogErrorComponent
989
+ *
990
+ * @returns A Promise that resolves once the user selects the button with the option caption
991
+ */
992
+ async addErrorDialog(properties) {
993
+ if (this._isEnabled) {
994
+ let texts = [properties.title];
995
+ if (properties.description && properties.description !== undefined) {
996
+ texts.push(properties.description);
997
+ }
998
+ await this.addDialog(properties.dialogErrorComponentClass ?? DialogErrorComponent, {
999
+ id: properties.id ?? undefined,
1000
+ width: properties.width ?? "70%",
1001
+ maxWidth: properties.maxWidth ?? "500px",
1002
+ height: properties.height ?? "auto",
1003
+ maxHeight: properties.maxHeight ?? "92vw",
1004
+ modal: properties.modal ?? false,
1005
+ texts: texts,
1006
+ options: [properties.option]
1007
+ });
1008
+ }
1009
+ return null;
1010
+ }
978
1011
  /**
979
1012
  * Force the removal of all the dialogs that are currently visible.
980
1013
  *