diff --git a/README.md b/README.md index 5d32a6e..a33f77f 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@

- npm version - license - npm total downloads - npm legacy total downloads + npm version + license + npm total downloads + npm legacy total downloads


@@ -39,7 +39,7 @@ This is not a regular API wrapper for SweetAlert (which already works very well 1) Install _ngx-sweetalert2_ and _sweetalert2_ via the npm registry: ```bash -npm install --save sweetalert2@^7.15.1 @toverux/ngx-sweetalert2 +npm install --save sweetalert2 @sweetalert2/ngx-sweetalert2 ``` :arrow_double_up: Always upgrade SweetAlert2 when you upgrade ngx-sweetalert2. The latter is statically linked with SweetAlert2's type definitions. @@ -47,7 +47,7 @@ npm install --save sweetalert2@^7.15.1 @toverux/ngx-sweetalert2 2) Import the module: ```typescript -import { SweetAlert2Module } from '@toverux/ngx-sweetalert2'; +import { SweetAlert2Module } from '@sweetalert2/ngx-sweetalert2'; @NgModule({ //=> Basic usage @@ -198,7 +198,7 @@ The other cool thing about using a structural directive is that the modal's cont You just have to change the _target_ of the partial view (_`content`_ is the default target). First, inject this service in your component: ```typescript -import { SwalPartialTargets } from '@toverux/ngx-sweetalert2'; +import { SwalPartialTargets } from '@sweetalert2/ngx-sweetalert2'; export class MyComponent { public constructor(public readonly swalTargets: SwalPartialTargets) { diff --git a/package.json b/package.json index e94eb02..32d2c05 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "karma-jasmine-html-reporter": "^1.1.0", "ng-packagr": "^4.3.1", "semantic-release": "^15.4.1", - "sweetalert2": "^7.8.0", + "sweetalert2": "^8.5.0", "travis-deploy-once": "^5.0.0", "ts-node": "^7.0.1", "tsickle": "^0.33.0", diff --git a/src/package.json b/src/package.json index 996e2cd..1c6794a 100644 --- a/src/package.json +++ b/src/package.json @@ -1,5 +1,5 @@ { - "name": "@toverux/ngx-sweetalert2", + "name": "@sweetalert2/ngx-sweetalert2", "version": "0.0.0-semantic-released", "description": "SweetAlert2 integration for Angular 4+", "repository": "git@github.com:sweetalert2/ngx-sweetalert2.git", @@ -9,7 +9,7 @@ "@angular/core": "^5.0.0 || ^6.0.0 || ^7.0.0", "@angular/common": "^5.0.0 || ^6.0.0 || ^7.0.0", "rxjs": "^6.1.0", - "sweetalert2": "^7.15.1" + "sweetalert2": "^8.5.0" }, "ngPackage": { "$schema": "./node_modules/ng-packagr/ng-package.schema.json", diff --git a/src/swal-partial-targets.ts b/src/swal-partial-targets.ts index 95c5ff0..35f881e 100644 --- a/src/swal-partial-targets.ts +++ b/src/swal-partial-targets.ts @@ -1,25 +1,20 @@ -import swal from 'sweetalert2'; +import Swal from 'sweetalert2'; /** * Represents an object of targets for partials (use with *swalPartial directive). - * We must use thunks to access the swal.* functions listed below, because they get created after the first modal is + * We must use thunks to access the Swal.* functions listed below, because they get created after the first modal is * shown, so this object lets us reference those functions safely and in a statically-typed manner. */ export class SwalPartialTargets { - public readonly title = () => swal.getTitle(); + public readonly title = () => Swal.getTitle(); - public readonly content = () => swal.getContent(); + public readonly content = () => Swal.getContent(); - /** - * @deprecated Will be removed in the next major version, please use {@link SwalPartialTargets#actions} instead. - */ - public readonly buttonsWrapper = () => swal.getButtonsWrapper(); + public readonly actions = () => Swal.getActions(); - public readonly actions = () => swal.getActions(); + public readonly confirmButton = () => Swal.getConfirmButton(); - public readonly confirmButton = () => swal.getConfirmButton(); + public readonly cancelButton = () => Swal.getCancelButton(); - public readonly cancelButton = () => swal.getCancelButton(); - - public readonly footer = () => swal.getFooter(); + public readonly footer = () => Swal.getFooter(); } diff --git a/src/swal.component.ts b/src/swal.component.ts index 98e0fb7..1e6bb09 100644 --- a/src/swal.component.ts +++ b/src/swal.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnChanges, OnDestroy, Output, SimpleChanges } from '@angular/core'; -import swal, { SweetAlertOptions } from 'sweetalert2'; +import Swal, { SweetAlertOptions } from 'sweetalert2'; import { SwalDefaults } from './di'; import * as events from './swal-events'; @@ -148,7 +148,7 @@ export class SwalComponent implements OnChanges, OnDestroy { return options; } - public nativeSwal = swal; + public nativeSwal = Swal; private isCurrentlyShown = false; @@ -170,7 +170,7 @@ export class SwalComponent implements OnChanges, OnDestroy { public ngOnDestroy(): void { if (this.isCurrentlyShown) { - swal.close(); + Swal.close(); } } @@ -206,7 +206,7 @@ export class SwalComponent implements OnChanges, OnDestroy { }; //=> Show the Swal! - const promise = swal(options); + const promise = Swal.fire(options); //=> Handle (confirm) and (cancel) @Outputs // tslint:disable-next-line:no-string-literal diff --git a/src/swal.directive.ts b/src/swal.directive.ts index 829eef4..53a18c5 100644 --- a/src/swal.directive.ts +++ b/src/swal.directive.ts @@ -2,7 +2,7 @@ import { ComponentFactoryResolver, ComponentRef, Directive, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output, ViewContainerRef } from '@angular/core'; -import swal, { SweetAlertArrayOptions, SweetAlertOptions } from 'sweetalert2'; +import Swal, { SweetAlertArrayOptions, SweetAlertOptions } from 'sweetalert2'; import { SwalComponent } from './swal.component'; /** @@ -33,7 +33,7 @@ export class SwalDirective implements OnInit, OnDestroy { if (options instanceof SwalComponent) { this.swalInstance = options; } else if (Array.isArray(options)) { - this.swalOptions = swal.argsToParams(options); + this.swalOptions = Swal.argsToParams(options); } else { this.swalOptions = options; } diff --git a/yarn.lock b/yarn.lock index 74d674d..3aedcad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9083,10 +9083,10 @@ supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0, supports-co dependencies: has-flag "^3.0.0" -sweetalert2@^7.8.0: - version "7.28.7" - resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-7.28.7.tgz#69a138f1e47b091fb0c310c47feeb123fcea14ca" - integrity sha512-gl+/201OeRJbGbor7GBM5pP6f8VUkAM1qxusNCQ9VmTMFtFHVUUntPctcNbGWh2r0vlsexO40u7ry5KIvQ5IGA== +sweetalert2@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-8.5.0.tgz#453ee0b3dd4ab5b8d89b1588c48ea90d74b16d63" + integrity sha512-cvGitYfnutaRIWuLJ+p+eLXieJyodWpB9F8AtD6Y5uNWN5OcQD1dDwN7VPDo4U7y4ni3rgK9gDYmkz9RCf4PSA== symbol-observable@1.2.0, symbol-observable@^1.2.0: version "1.2.0"