Skip to content

Releases: Basaingeal/Razor.SweetAlert2

v5.0.0

16 Jun 18:49
b3a5a81

Choose a tag to compare

v5.0.0

Breaking Changes

🔴 Breaking change # 1 - IE11 and Legacy Edge support is DISCONTINUED

If you need to support these old browsers in your project, please use the previous major release v4.5.0

🔴 Breaking change # 2 - .QueueAsync(), .GetQueueStepAsync(), .InsertQueueStepAsync(), .DeleteQueueStepAsync() methods are REMOVED

async/await can perfectly replace all use-cases of .QueueAsync().

💅 Styling Changes

sweetalert2@11 introduced a variety of styling changes.

  • Update button color
  • Switch to CSS Grid Layout
  • Refreshed look for toasts
  • Loaded in toasts moved to the left side (instead of the icon)

Examples and explainations for these changes can be found on the sweetalert2 v11.0.0 release notes.

🎉 New features

Default Settings

You can now specify global defaults during Startup for your SweetAlertOptions that apply to all your SweetAlert2 dialogs.

services.AddSweetAlert2(options => {
 options.DefaultOptions = new SweetAlertOptions {
   HeightAuto = false
 };
});

View the README.md for more information

Dependencies

  • bump sweetalert2 to 11.0.17
  • bump @sweetalert2/themes to 5.0.0

Multi-targetting enabled

Blazor dependencies are now dependant on which version of .NET is being used in the application.

.NETCoreApp 3.1

  • Microsoft.AspNetCore.Components (>= 3.1.0 && < 5.0.0)
  • Microsoft.AspNetCore.Components.Web (>= 3.1.0 && < 5.0.0)

.NETStandard 2.0

  • Microsoft.AspNetCore.Components (>= 3.1.0 && < 5.0.0)
  • Microsoft.AspNetCore.Components.Web (>= 3.1.0 && < 5.0.0)

net5.0

  • Microsoft.AspNetCore.Components (>= 5.0.0 && < 6.0.0)
  • Microsoft.AspNetCore.Components.Web (>= 5.0.0 && < 6.0.0)

v4.5.0

07 May 18:30
99e9545

Choose a tag to compare

v4.5.0

Bug Fixes

Handle custom serialization settings better

Previously, if a user were to change their default JSON serialization settings, it would break the JSInterop.
Now interop properties won't be affected by user serialization settings.

Changes

Deprecate Queue methods

Generally, as a rule, this library doesn't include deprecated methods from the sweetalert2 library.
The library just deprecated all of the queue functions in anticiaption of v11 which will remove them.

If I were to remove them, that would require a new major verison release now, and then another when they realease v11.
So for now those methods are also deprecated in this library.

  • QueueAsync
  • GetQueueStepAsync
  • InsertQueueStepAsync
  • DeleteQueueStepAsync

Dependencies

  • bump sweetalert2 to 10.16.7
  • bump @sweetalert2/themes to 4.0.5

v4.4.0

07 Apr 16:20
5f0c9f0

Choose a tag to compare

v4.4.0

🎉 New Features

Additional SweetAlertOptions properties

  • ReturnFocus
  • ShowLoaderOnDeny
  • CustomClass.InputLabel
  • CustomClass.HtmlContainer

Dependencies

  • bump sweetalert2 to 10.16.0
  • bump @sweetalert2/themes to 4.0.3
  • bump Microsoft.AspNetCore.Components to 3.1.14
  • bump Microsoft.AspNetCore.Components.Web to 3.1.14
  • replaced deprecated Microsoft.CodeAnalysis.FxCopAnalyzers with Microsoft.CodeAnalysis.NetAnalyzers version 5.0.3

v4.3.1

20 Nov 17:46
ce3e41e

Choose a tag to compare

v4.3.1

Dependencies

  • bump sweetalert2 to 10.10.1
  • bump Microsoft.AspNetCore.Components to 3.1.10
  • bump Microsoft.AspNetCore.Components.Web to 3.1.10

Microsoft.AspNetCore.Components version 5.0.0 is now out. It only supports .NET 5, not .NET Standard 2.0. Upgrading would make this library only usable by .NET 5 applications. I will not be upgrading to >= 5.0.0 unless there are new features added to the Blazor framework worth taking advantage of. In that case, the library would start targeting multiple frameworks in order to preserve functionality on pre .NET 5 applications.

v4.3.0

05 Nov 16:19
7e7ae44

Choose a tag to compare

v4.3.0

🎉 New Features

Expose JavaScript Swal object to DOM window

Previously, the Swal JavaScript object was used by JSInterop but not available through window.Swal. That meant that you couldn't write your own JavaScript snippets that reference Swal without duplicating the library through a CDN tag.

Now, if you add the <script src="_content/CurrieTechnologies.Razor.SweetAlert2/sweetAlert2.min.js"></script> tag to your page, that page has access to Swal and you can do custom functionality like assigning event listeners, and in this issue: (#1012)

Example

Previously, this was not possible due to Swal not being available on the DOM. It will now work.

<script src="_content/CurrieTechnologies.Razor.SweetAlert2/sweetAlert2.min.js"></script>
<script>
    function bindSwalMouseOver() {
        var toast = Swal.getContainer();

        toast.removeEventListener('mouseover', Swal.stopTimer);
        toast.removeEventListener('mouseleave', Swal.resumeTimer);

        toast.addEventListener('mouseenter', Swal.stopTimer);
        toast.addEventListener('mouseleave', Swal.resumeTimer);
    }
</script>

v4.2.0

02 Nov 17:56
0ff0ca0

Choose a tag to compare

v4.2.0

🎉 New Features

New PreDeny Callback propoerty

There is a new property on SweetAlertOptions called PreDeny. This is fired when someone hits the deny button. It can be a sync or async function that takes a string and returns a string (Func<string, Task<string>> or Func<string, string>).

The input string of the callback is the value that would be returned by SweetAlertResult.Value.

If you return null, the original value is passed along to SweetAlertResult.Value.
If you return "false", the popup does not close.
If you return anything else, that returned value goes in to SweetAlertResult.Value.

NB: Be sure that ReturnInputValueOnDeny is set to true in order for the value to be passed into the PreDeny callback function.

Example

var result = await Swal.FireAsync(new SweetAlertOptions
    {
        Input = SweetAlertInputType.Select,
        InputOptions = new Dictionary<string, string>
        {
            { "DC", "Don't Close" },
            { "Normal Result", "Result is Normal" },
            { "OV", "Result is overriden" }
        },
        ReturnInputValueOnDeny = true,
        PreDeny = new PreDenyCallback((string input) =>
        {
            return input switch
            {
                "DC" => "false",
                "OV" => "PreConfirm override!!!!",
                _ => null
            };
        }, this),
        ShowDenyButton = true
    });

// If "Don't Close" is selected, modal doesn't close.
// If "Result is Normal" is selected, result.Value = "Normal Result"
// If "Result is overriden" is selected, result.Value = "PreConfirm override!!!!"

Similar functionality on PreConfirm callback property

The PreConfirm callback has been in place form day one.
If you returned null, the original value would be returned to SweetAlertResult.Value, otherwise the returned value of the callback would be passed to SweetAlertResult.Value.

Now, if you return "false", the popup modal will stay open.

Dependencies

  • bump sweetalert2 to 10.9.0
  • bump @sweetalert2/themes to 4.0.1

v4.1.0

22 Oct 20:30
065fd9b

Choose a tag to compare

v4.1.0

🎉 New Features

Additional SweetAlertOptions properties

  • ReturnInputValueOnDeny
  • CustomClass.Loader

Dependencies

  • bump sweetalert2 to 10.7.0

v4.0.0

14 Oct 16:26
4f512ef

Choose a tag to compare

v4.0.0

🔴 Breaking Changes

Just a couple of releases after sweetalert2@10 was released, they renamed the lifecycle hooks and deprecated the old names. (sweetalert2/sweetalert2#2057)
As a rule, this wrapper library does not include deprecated functionality.
As a result, the old lifecycle hook names have been completely replaced with the new ones, resulting in a new major version.

Hook name changes

Hooks were previously named as follows:

Before Hook After hook
OnBeforeOpen OnOpen
OnRender
OnClose OnAfterClose
OnDestroy

All have been renamed according to the convention used by frameworks like UIKit or React:

Before Hook After hook
WillOpen DidOpen
DidRender
WillClose DidClose
DidDstroy

🎉 New Features

Additional SweetAlertOptions properties

  • InputLabel
  • CustomClass.ValidationMessage

Dependencies

  • bump sweetalert2 to 10.5.1
  • bump Microsoft.AspNetCore.Components to 3.1.9
  • bump Microsoft.AspNetCore.Components.Web to 3.1.9

Webpack 5

Webpack 5 is now used behind the scenes to create the JavaScript component of the wrapper, which uses more modern JavaScript syntax for slightly smaller file sizes.

NB: The IE11 Compat version wich contains some polyfills still uses the more traditional JS syntax.

v3.0.0

17 Sep 20:42
c628d8a

Choose a tag to compare

v3.0.0

🔴 Breaking Changes

In this major release, no breaking changes have been made in the API surface. However, the underlying SweetAlert2 library has changed the HTML structure of the loader.

For the sake of customization, the loader has been separated from the confirm button into its own DOM element (<div class="swal2-loader"></div>).

As a part of that breaking change, there's a new API param loaderHtml which allow to set custom HTML, e.g. SVG icon inside of the loader.

sweetalert2 v10.0.0 release.

🎉 New Features

The third DENY button

Additional SweetAlertOptions properties

  • ShowDenyButton
  • DenyButtonText
  • DenyButtonColor
  • DenyButtonAriaLabel
  • FocusDeny
  • CustomerClass.DenyButton

Additional SweetAlertResult and SweetAlertQueueResult properties

  • IsDenied

Additional SweetAlertService methods

  • Swal.ClickDenyAsync()

NB: There is no Swal.GetDenyButtonAsync() method as methods which return HTMLElements are not included in the wrapper library.

Loader HTML

As part of the breaking change in sweetalert2@10 there is a new options property to set custom HTML for the loader.

Additional SweetlertOptions properties

  • LoaderHtml

Icon Color

Introduced in [email protected], there is a new options property to set the color of the popup icon.

Additional SweetlertOptions properties

  • IconColor

Dependencies

  • bump sweetalert2 to 10.1.0
  • bump @sweetalert2/themes to 4.0.0

For more information, read the sweetalert2 v10.0.0 release.

v2.10.1

10 Aug 15:50
92baa48

Choose a tag to compare

v2.10.1

Dependencies

  • bump sweetalert2 to 9.17.1

Bug Fixes

  • resolved issue where the popup theme would flicker when using a theme. (#842) (#632)

Changes:

  • 92baa48 Merge pull request #843 from Basaingeal/release/v2.10.1
  • 3e0e629 v2.10.1 changes
  • c4f7464 Merge pull request #821 from Basaingeal/dependabot/npm_and_yarn/develop/sweetalert2-9.17.1
  • 170eb89 Merge pull request #842 from Basaingeal/feature/theme-check
  • 896c9c6 send theme in constructor
  • 382c1e5 Merge pull request #841 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.2.1
  • 45fd0fa Bump css-loader from 4.2.0 to 4.2.1
  • bf4ca06 Merge pull request #840 from Basaingeal/dependabot/npm_and_yarn/develop/sass-loader-9.0.3
  • c8906ca Bump sass-loader from 9.0.2 to 9.0.3
  • de7f3a7 Merge pull request #839 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.11.1
See More
  • a9c993c Bump @babel/core from 7.11.0 to 7.11.1
  • d121b60 Merge pull request #838 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-4.0.0
  • 64b6624 Bump terser-webpack-plugin from 3.1.0 to 4.0.0
  • 526cd4f Merge pull request #837 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.1.0
  • 645e47e Bump terser-webpack-plugin from 3.0.8 to 3.1.0
  • c58d353 Merge pull request #836 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.8.0
  • 4834cdc Bump @typescript-eslint/parser from 3.7.1 to 3.8.0
  • 8106e3b Merge pull request #835 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.8.0
  • 72d1033 Bump @typescript-eslint/eslint-plugin from 3.7.1 to 3.8.0
  • fb9a185 Merge pull request #834 from Basaingeal/dependabot/npm_and_yarn/develop/eslint-7.6.0
  • e5c88fa Bump eslint from 7.5.0 to 7.6.0
  • 83d02cb Merge pull request #833 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.2.0
  • 1860c04 Bump css-loader from 4.1.1 to 4.2.0
  • 4962279 Merge pull request #832 from Basaingeal/dependabot/npm_and_yarn/develop/babel/preset-env-7.11.0
  • 3b47de0 Bump @babel/preset-env from 7.10.4 to 7.11.0
  • 73f5f19 Merge pull request #831 from Basaingeal/dependabot/npm_and_yarn/develop/babel/plugin-proposal-object-rest-spread-7.11.0
  • 1cde239 Bump @babel/plugin-proposal-object-rest-spread from 7.10.4 to 7.11.0
  • 6459ebc Merge pull request #830 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.11.0
  • d3ad00f Bump @babel/core from 7.10.5 to 7.11.0
  • 73566ed Merge pull request #829 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.1.1
  • 3087181 Bump css-loader from 4.1.0 to 4.1.1
  • f204210 Merge pull request #828 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.1.0
  • 4ca17ec Merge pull request #827 from Basaingeal/dependabot/npm_and_yarn/develop/webpack-4.44.1
  • 887ece6 Bump css-loader from 4.0.0 to 4.1.0
  • 8155acf Bump webpack from 4.44.0 to 4.44.1
  • ac414c8 Merge pull request #826 from Basaingeal/dependabot/npm_and_yarn/develop/elliptic-6.5.3
  • 3c16e3c [Security] Bump elliptic from 6.5.2 to 6.5.3
  • 0534e31 Merge pull request #825 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.27
  • c758af8 Bump @types/node from 14.0.26 to 14.0.27
  • 4ee7576 Merge pull request #824 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.7.1
  • 1ef3700 Bump @typescript-eslint/eslint-plugin from 3.7.0 to 3.7.1
  • bd8100e Merge pull request #823 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.7.1
  • 7b03af3 Bump @typescript-eslint/parser from 3.7.0 to 3.7.1
  • d57bb1e Merge pull request #822 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.0.8
  • f1244f1 Bump terser-webpack-plugin from 3.0.7 to 3.0.8
  • b5b9616 Bump sweetalert2 from 9.17.0 to 9.17.1
  • 4068dd0 Merge pull request #820 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.0.0
  • ef1912a Bump css-loader from 3.6.0 to 4.0.0
  • 99bdea4 Merge pull request #819 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.26
  • 28a4060 Bump @types/node from 14.0.25 to 14.0.26
  • 098725f Merge pull request #818 from Basaingeal/dependabot/npm_and_yarn/develop/webpack-4.44.0
  • 98bd8f8 Bump webpack from 4.43.0 to 4.44.0
  • 5131d53 Merge pull request #817 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.25
  • 695b5ab Bump @types/node from 14.0.24 to 14.0.25
  • f2986c4 Merge pull request #815 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.24
  • 9868ccf Bump @types/node from 14.0.23 to 14.0.24
  • 5bb11a1 Merge pull request #814 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.7.0
  • 8d590b5 Bump @typescript-eslint/parser from 3.6.1 to 3.7.0
  • 15f63db Merge pull request #813 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.7.0
  • a2e7f3e Bump @typescript-eslint/eslint-plugin from 3.6.1 to 3.7.0
  • 8cd7003 Merge pull request #812 from Basaingeal/dependabot/npm_and_yarn/develop/eslint-7.5.0
  • bf83065 Bump eslint from 7.4.0 to 7.5.0
  • f21d047 Merge pull request #811 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-3.9.7
  • ede873d Bump typescript from 3.9.6 to 3.9.7
  • 88dd75f Merge pull request #810 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.0.7
  • 3988a82 Bump terser-webpack-plugin from 3.0.6 to 3.0.7
  • 88c9a7f Merge pull request #809 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.10.5
  • 45b079d Bump @babel/core from 7.10.4 to 7.10.5
  • 7765c62 Merge pull request #808 from Basaingeal/dependabot/npm_and_yarn/develop/babel/cli-7.10.5
  • 15c7615 Bump @babel/cli from 7.10.4 to 7.10.5
  • dd76529 Merge pull request #807 from Basaingeal/release/v2.10.0

This list of changes was auto generated.