Razor.SweetAlert2 Versions Save

A Razor class library for interacting with SweetAlert2

v5.0.0

2 years ago

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

3 years ago

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

3 years ago

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

3 years ago

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

3 years ago

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: (https://github.com/Basaingeal/Razor.SweetAlert2/issues/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

3 years ago

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

3 years ago

v4.1.0

🎉 New Features

Additional SweetAlertOptions properties

  • ReturnInputValueOnDeny
  • CustomClass.Loader

Dependencies

  • bump sweetalert2 to 10.7.0

v4.0.0

3 years ago

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. (https://github.com/sweetalert2/sweetalert2/pull/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

3 years ago

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

3 years ago

v2.10.1

Dependencies

  • bump sweetalert2 to 9.17.1

Bug Fixes

Changes:

  • 92baa483fac474c92209a6c592fd1dccff2fd4b1 Merge pull request #843 from Basaingeal/release/v2.10.1
  • 3e0e62920b2958b764905116ca9bd5825e008d7b v2.10.1 changes
  • c4f7464fcb49a8f4b9bed0c445e3fb9eab24b508 Merge pull request #821 from Basaingeal/dependabot/npm_and_yarn/develop/sweetalert2-9.17.1
  • 170eb897d73dfb8d70915d21a208a39f65d7f7ae Merge pull request #842 from Basaingeal/feature/theme-check
  • 896c9c6ef38f942970e05bec37b272c3fef18343 send theme in constructor
  • 382c1e581230c2a0fd3494e8a0b34f0ecbf1f2fe Merge pull request #841 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.2.1
  • 45fd0faf5d22b91167b3dc0baf819b15c6119f1f Bump css-loader from 4.2.0 to 4.2.1
  • bf4ca064b5f608b7eadfb2ba7058aaab95c322b8 Merge pull request #840 from Basaingeal/dependabot/npm_and_yarn/develop/sass-loader-9.0.3
  • c8906ca539339e85709dd6d71c63c213267b9d1b Bump sass-loader from 9.0.2 to 9.0.3
  • de7f3a74d0209c4e5850e6bcf1b37416a78fd00d Merge pull request #839 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.11.1
See More
  • a9c993c8a0ea560cbabe7bbbc43970062c949350 Bump @babel/core from 7.11.0 to 7.11.1
  • d121b60e281d4a20f42ee91047ec9114d0d75ec0 Merge pull request #838 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-4.0.0
  • 64b662464b1084bfd1f95b3e41bf5edc0bcd8368 Bump terser-webpack-plugin from 3.1.0 to 4.0.0
  • 526cd4fa5171088d7066e12f65e0e00d62b807c2 Merge pull request #837 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.1.0
  • 645e47e28acbb501c27f74fdfe04703039dc48a5 Bump terser-webpack-plugin from 3.0.8 to 3.1.0
  • c58d353256ed6d825f23325591810ddf5774f481 Merge pull request #836 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.8.0
  • 4834cdc6250826b17d92ff71108633f654984326 Bump @typescript-eslint/parser from 3.7.1 to 3.8.0
  • 8106e3bba1a32f98c1dd8f0845880fbd9c7a2cfc Merge pull request #835 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.8.0
  • 72d1033d4927465e7ca1b1434030757cf8b7c7ff Bump @typescript-eslint/eslint-plugin from 3.7.1 to 3.8.0
  • fb9a18547ea28498dbc4efd582f6aac8a87f99e4 Merge pull request #834 from Basaingeal/dependabot/npm_and_yarn/develop/eslint-7.6.0
  • e5c88fac2678e5ab6cfdba7c34cd4c54614ffbce Bump eslint from 7.5.0 to 7.6.0
  • 83d02cbc4ab069301f292ad3f07057a7d19ec125 Merge pull request #833 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.2.0
  • 1860c04f00d854ed7c641b13a6cb9b3c614b2d28 Bump css-loader from 4.1.1 to 4.2.0
  • 496227926cf6d52dac8a45f0ad21d82840e670ab Merge pull request #832 from Basaingeal/dependabot/npm_and_yarn/develop/babel/preset-env-7.11.0
  • 3b47de0d58ff2a600ea1aba82be68efc3f4ae453 Bump @babel/preset-env from 7.10.4 to 7.11.0
  • 73f5f1974a8950b2e1b3fafc08aa47bcadbe97e0 Merge pull request #831 from Basaingeal/dependabot/npm_and_yarn/develop/babel/plugin-proposal-object-rest-spread-7.11.0
  • 1cde2395033e5135d29d2f96971262bccf06571c Bump @babel/plugin-proposal-object-rest-spread from 7.10.4 to 7.11.0
  • 6459ebc9203866d17308efd6134aee08832bb227 Merge pull request #830 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.11.0
  • d3ad00f7fd21c0f042abab689d8ed292ad9caecc Bump @babel/core from 7.10.5 to 7.11.0
  • 73566ed1369569ba34b43fc9e58c99d788cbd69b Merge pull request #829 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.1.1
  • 30871812d373b6255d7890f8ecfdf0de8a14a0c9 Bump css-loader from 4.1.0 to 4.1.1
  • f204210790685750436a0ceb1cc57074fa885be5 Merge pull request #828 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.1.0
  • 4ca17ecd09f37077375badb781a7970c1ca266ce Merge pull request #827 from Basaingeal/dependabot/npm_and_yarn/develop/webpack-4.44.1
  • 887ece6967a7f3a4ec64b31eba7c156c57b50c6c Bump css-loader from 4.0.0 to 4.1.0
  • 8155acf545a5ad627c324d8c1bdf93b22995cc6e Bump webpack from 4.44.0 to 4.44.1
  • ac414c8d95261452a301dc8a212a18227d1079df Merge pull request #826 from Basaingeal/dependabot/npm_and_yarn/develop/elliptic-6.5.3
  • 3c16e3c527d652f960839c3a5bcfc39c4586c1e2 [Security] Bump elliptic from 6.5.2 to 6.5.3
  • 0534e31392a02e94d72e6af46f52bfab256ae663 Merge pull request #825 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.27
  • c758af834c77fe05891af644cb925323eb6ead01 Bump @types/node from 14.0.26 to 14.0.27
  • 4ee75763f1e186f86f01c5a3aa83b8df44349825 Merge pull request #824 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.7.1
  • 1ef3700d8bc9d8a84b645266808fa23beef9965f Bump @typescript-eslint/eslint-plugin from 3.7.0 to 3.7.1
  • bd8100e2579c6f47cdfa53adb36a7f874e360d29 Merge pull request #823 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.7.1
  • 7b03af3b88ac547a7e5ffe4c8284334f77c0ef7b Bump @typescript-eslint/parser from 3.7.0 to 3.7.1
  • d57bb1e68c541da11d07dda619f95dd991ca06d8 Merge pull request #822 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.0.8
  • f1244f106ed8cfc4fe261ade1493b9ab4ea5d3f4 Bump terser-webpack-plugin from 3.0.7 to 3.0.8
  • b5b9616f726574bae4ebf1ff5c9468c5305abc15 Bump sweetalert2 from 9.17.0 to 9.17.1
  • 4068dd0ba2cae10e4a39f10f77f58824c3094b7f Merge pull request #820 from Basaingeal/dependabot/npm_and_yarn/develop/css-loader-4.0.0
  • ef1912af631e7b0de08d84edf867dad3ce58dc2e Bump css-loader from 3.6.0 to 4.0.0
  • 99bdea446a0ec5eb7adb3cdcc0a1c1bca8d2a3b6 Merge pull request #819 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.26
  • 28a40606aa6b23d64f03bbbc76482427d7c8df91 Bump @types/node from 14.0.25 to 14.0.26
  • 098725ff2e2b7145381b6ab09349da84c37ba444 Merge pull request #818 from Basaingeal/dependabot/npm_and_yarn/develop/webpack-4.44.0
  • 98bd8f84e4ef55845c6101b258408425b2be6d85 Bump webpack from 4.43.0 to 4.44.0
  • 5131d5333d907549d63c91f1f0330551bff53189 Merge pull request #817 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.25
  • 695b5ab9549472222151d49b6f670724c9078983 Bump @types/node from 14.0.24 to 14.0.25
  • f2986c43dfadc9090dbc4aa1cfb61f8f9271ee0a Merge pull request #815 from Basaingeal/dependabot/npm_and_yarn/develop/types/node-14.0.24
  • 9868ccfc70833bf82660caa79594e7ae929e7710 Bump @types/node from 14.0.23 to 14.0.24
  • 5bb11a17f043535b3ec4dacdfd8f0e207bca2849 Merge pull request #814 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/parser-3.7.0
  • 8d590b5add4209202bf344ac2d1ead5690e22f24 Bump @typescript-eslint/parser from 3.6.1 to 3.7.0
  • 15f63dbd0178ebf1a58dfe18a183ffa1fa5c99d2 Merge pull request #813 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-3.7.0
  • a2e7f3eb1211545690ac481d7f9a5503ff76b7f5 Bump @typescript-eslint/eslint-plugin from 3.6.1 to 3.7.0
  • 8cd7003ca1b30884b2e5947c59125d34a41844ee Merge pull request #812 from Basaingeal/dependabot/npm_and_yarn/develop/eslint-7.5.0
  • bf83065ab7ac437caddd6f267912d4b9146b6af6 Bump eslint from 7.4.0 to 7.5.0
  • f21d04705f3de5cdfc6afe959d455db6bd501319 Merge pull request #811 from Basaingeal/dependabot/npm_and_yarn/develop/typescript-3.9.7
  • ede873d8c50b13cb94517b96788fdb3a79b6f5e2 Bump typescript from 3.9.6 to 3.9.7
  • 88dd75f2f19f27987b46a0fefc35d389b124de43 Merge pull request #810 from Basaingeal/dependabot/npm_and_yarn/develop/terser-webpack-plugin-3.0.7
  • 3988a8226d55c88ac22e5770721885d50693d290 Bump terser-webpack-plugin from 3.0.6 to 3.0.7
  • 88c9a7f3bd2a8f69f06392d668781d5ed1615b10 Merge pull request #809 from Basaingeal/dependabot/npm_and_yarn/develop/babel/core-7.10.5
  • 45b079d9f16a569c6a4b6c0cc28af78034c8ccd9 Bump @babel/core from 7.10.4 to 7.10.5
  • 7765c621de842963c824b272c821ce151db01eb3 Merge pull request #808 from Basaingeal/dependabot/npm_and_yarn/develop/babel/cli-7.10.5
  • 15c7615448695b839ec36aa2f3c688cdb630029b Bump @babel/cli from 7.10.4 to 7.10.5
  • dd765298a28f3d2435572d3bb1f1aecc4c039759 Merge pull request #807 from Basaingeal/release/v2.10.0

This list of changes was auto generated.