ngx-toastr 14.1.1 → 14.2.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.
- package/{esm2015/ngx-toastr.js → esm2020/ngx-toastr.mjs} +0 -0
- package/esm2020/overlay/overlay-container.mjs +46 -0
- package/{esm2015/overlay/overlay-ref.js → esm2020/overlay/overlay-ref.mjs} +0 -0
- package/{esm2015/overlay/overlay.js → esm2020/overlay/overlay.mjs} +11 -14
- package/{esm2015/portal/dom-portal-host.js → esm2020/portal/dom-portal-host.mjs} +0 -0
- package/{esm2015/portal/portal.js → esm2020/portal/portal.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/{esm2015/toastr/toast-injector.js → esm2020/toastr/toast-injector.mjs} +0 -0
- package/esm2020/toastr/toast-noanimation.component.mjs +237 -0
- package/esm2020/toastr/toast.component.mjs +251 -0
- package/esm2020/toastr/toast.directive.mjs +32 -0
- package/esm2020/toastr/toastr-config.mjs +72 -0
- package/esm2020/toastr/toastr.module.mjs +63 -0
- package/esm2020/toastr/toastr.service.mjs +197 -0
- package/fesm2015/{ngx-toastr.js → ngx-toastr.mjs} +339 -262
- package/fesm2015/ngx-toastr.mjs.map +1 -0
- package/fesm2020/ngx-toastr.mjs +1170 -0
- package/fesm2020/ngx-toastr.mjs.map +1 -0
- package/ngx-toastr.d.ts +1 -0
- package/overlay/overlay-container.d.ts +3 -0
- package/overlay/overlay.d.ts +3 -0
- package/package.json +20 -8
- package/toastr/toast-noanimation.component.d.ts +7 -0
- package/toastr/toast.component.d.ts +3 -0
- package/toastr/toast.directive.d.ts +6 -0
- package/toastr/toastr-config.d.ts +5 -0
- package/toastr/toastr.module.d.ts +9 -0
- package/toastr/toastr.service.d.ts +3 -0
- package/toastr.css +4 -4
- package/bundles/ngx-toastr.umd.js +0 -1507
- package/bundles/ngx-toastr.umd.js.map +0 -1
- package/esm2015/overlay/overlay-container.js +0 -45
- package/esm2015/toastr/toast-noanimation.component.js +0 -204
- package/esm2015/toastr/toast.component.js +0 -216
- package/esm2015/toastr/toast.directive.js +0 -27
- package/esm2015/toastr/toastr-config.js +0 -71
- package/esm2015/toastr/toastr.module.js +0 -51
- package/esm2015/toastr/toastr.service.js +0 -196
- package/fesm2015/ngx-toastr.js.map +0 -1
- package/ngx-toastr.metadata.json +0 -1
@@ -1,1507 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/animations'), require('rxjs'), require('@angular/platform-browser'), require('@angular/common')) :
|
3
|
-
typeof define === 'function' && define.amd ? define('ngx-toastr', ['exports', '@angular/core', '@angular/animations', 'rxjs', '@angular/platform-browser', '@angular/common'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-toastr'] = {}, global.ng.core, global.ng.animations, global.rxjs, global.ng.platformBrowser, global.ng.common));
|
5
|
-
}(this, (function (exports, i0, animations, rxjs, i3, i1) { 'use strict';
|
6
|
-
|
7
|
-
function _interopNamespace(e) {
|
8
|
-
if (e && e.__esModule) return e;
|
9
|
-
var n = Object.create(null);
|
10
|
-
if (e) {
|
11
|
-
Object.keys(e).forEach(function (k) {
|
12
|
-
if (k !== 'default') {
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
15
|
-
enumerable: true,
|
16
|
-
get: function () {
|
17
|
-
return e[k];
|
18
|
-
}
|
19
|
-
});
|
20
|
-
}
|
21
|
-
});
|
22
|
-
}
|
23
|
-
n['default'] = e;
|
24
|
-
return Object.freeze(n);
|
25
|
-
}
|
26
|
-
|
27
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
28
|
-
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
29
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
30
|
-
|
31
|
-
var ToastContainerDirective = /** @class */ (function () {
|
32
|
-
function ToastContainerDirective(el) {
|
33
|
-
this.el = el;
|
34
|
-
}
|
35
|
-
ToastContainerDirective.prototype.getContainerElement = function () {
|
36
|
-
return this.el.nativeElement;
|
37
|
-
};
|
38
|
-
return ToastContainerDirective;
|
39
|
-
}());
|
40
|
-
ToastContainerDirective.decorators = [
|
41
|
-
{ type: i0.Directive, args: [{
|
42
|
-
selector: '[toastContainer]',
|
43
|
-
exportAs: 'toastContainer',
|
44
|
-
},] }
|
45
|
-
];
|
46
|
-
ToastContainerDirective.ctorParameters = function () { return [
|
47
|
-
{ type: i0.ElementRef }
|
48
|
-
]; };
|
49
|
-
var ToastContainerModule = /** @class */ (function () {
|
50
|
-
function ToastContainerModule() {
|
51
|
-
}
|
52
|
-
return ToastContainerModule;
|
53
|
-
}());
|
54
|
-
ToastContainerModule.decorators = [
|
55
|
-
{ type: i0.NgModule, args: [{
|
56
|
-
declarations: [ToastContainerDirective],
|
57
|
-
exports: [ToastContainerDirective],
|
58
|
-
},] }
|
59
|
-
];
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Everything a toast needs to launch
|
63
|
-
*/
|
64
|
-
var ToastPackage = /** @class */ (function () {
|
65
|
-
function ToastPackage(toastId, config, message, title, toastType, toastRef) {
|
66
|
-
var _this = this;
|
67
|
-
this.toastId = toastId;
|
68
|
-
this.config = config;
|
69
|
-
this.message = message;
|
70
|
-
this.title = title;
|
71
|
-
this.toastType = toastType;
|
72
|
-
this.toastRef = toastRef;
|
73
|
-
this._onTap = new rxjs.Subject();
|
74
|
-
this._onAction = new rxjs.Subject();
|
75
|
-
this.toastRef.afterClosed().subscribe(function () {
|
76
|
-
_this._onAction.complete();
|
77
|
-
_this._onTap.complete();
|
78
|
-
});
|
79
|
-
}
|
80
|
-
/** Fired on click */
|
81
|
-
ToastPackage.prototype.triggerTap = function () {
|
82
|
-
this._onTap.next();
|
83
|
-
if (this.config.tapToDismiss) {
|
84
|
-
this._onTap.complete();
|
85
|
-
}
|
86
|
-
};
|
87
|
-
ToastPackage.prototype.onTap = function () {
|
88
|
-
return this._onTap.asObservable();
|
89
|
-
};
|
90
|
-
/** available for use in custom toast */
|
91
|
-
ToastPackage.prototype.triggerAction = function (action) {
|
92
|
-
this._onAction.next(action);
|
93
|
-
};
|
94
|
-
ToastPackage.prototype.onAction = function () {
|
95
|
-
return this._onAction.asObservable();
|
96
|
-
};
|
97
|
-
return ToastPackage;
|
98
|
-
}());
|
99
|
-
var DefaultNoComponentGlobalConfig = {
|
100
|
-
maxOpened: 0,
|
101
|
-
autoDismiss: false,
|
102
|
-
newestOnTop: true,
|
103
|
-
preventDuplicates: false,
|
104
|
-
countDuplicates: false,
|
105
|
-
resetTimeoutOnDuplicate: false,
|
106
|
-
includeTitleDuplicates: false,
|
107
|
-
iconClasses: {
|
108
|
-
error: 'toast-error',
|
109
|
-
info: 'toast-info',
|
110
|
-
success: 'toast-success',
|
111
|
-
warning: 'toast-warning',
|
112
|
-
},
|
113
|
-
// Individual
|
114
|
-
closeButton: false,
|
115
|
-
disableTimeOut: false,
|
116
|
-
timeOut: 5000,
|
117
|
-
extendedTimeOut: 1000,
|
118
|
-
enableHtml: false,
|
119
|
-
progressBar: false,
|
120
|
-
toastClass: 'ngx-toastr',
|
121
|
-
positionClass: 'toast-top-right',
|
122
|
-
titleClass: 'toast-title',
|
123
|
-
messageClass: 'toast-message',
|
124
|
-
easing: 'ease-in',
|
125
|
-
easeTime: 300,
|
126
|
-
tapToDismiss: true,
|
127
|
-
onActivateTick: false,
|
128
|
-
progressAnimation: 'decreasing',
|
129
|
-
};
|
130
|
-
var TOAST_CONFIG = new i0.InjectionToken('ToastConfig');
|
131
|
-
|
132
|
-
/*! *****************************************************************************
|
133
|
-
Copyright (c) Microsoft Corporation.
|
134
|
-
|
135
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
136
|
-
purpose with or without fee is hereby granted.
|
137
|
-
|
138
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
139
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
140
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
141
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
142
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
143
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
144
|
-
PERFORMANCE OF THIS SOFTWARE.
|
145
|
-
***************************************************************************** */
|
146
|
-
/* global Reflect, Promise */
|
147
|
-
var extendStatics = function (d, b) {
|
148
|
-
extendStatics = Object.setPrototypeOf ||
|
149
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
150
|
-
function (d, b) { for (var p in b)
|
151
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
152
|
-
d[p] = b[p]; };
|
153
|
-
return extendStatics(d, b);
|
154
|
-
};
|
155
|
-
function __extends(d, b) {
|
156
|
-
if (typeof b !== "function" && b !== null)
|
157
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
158
|
-
extendStatics(d, b);
|
159
|
-
function __() { this.constructor = d; }
|
160
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
161
|
-
}
|
162
|
-
var __assign = function () {
|
163
|
-
__assign = Object.assign || function __assign(t) {
|
164
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
165
|
-
s = arguments[i];
|
166
|
-
for (var p in s)
|
167
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
168
|
-
t[p] = s[p];
|
169
|
-
}
|
170
|
-
return t;
|
171
|
-
};
|
172
|
-
return __assign.apply(this, arguments);
|
173
|
-
};
|
174
|
-
function __rest(s, e) {
|
175
|
-
var t = {};
|
176
|
-
for (var p in s)
|
177
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
178
|
-
t[p] = s[p];
|
179
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
180
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
181
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
182
|
-
t[p[i]] = s[p[i]];
|
183
|
-
}
|
184
|
-
return t;
|
185
|
-
}
|
186
|
-
function __decorate(decorators, target, key, desc) {
|
187
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
188
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
189
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
190
|
-
else
|
191
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
192
|
-
if (d = decorators[i])
|
193
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
194
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
195
|
-
}
|
196
|
-
function __param(paramIndex, decorator) {
|
197
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
198
|
-
}
|
199
|
-
function __metadata(metadataKey, metadataValue) {
|
200
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
201
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
202
|
-
}
|
203
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
204
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
205
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
206
|
-
function fulfilled(value) { try {
|
207
|
-
step(generator.next(value));
|
208
|
-
}
|
209
|
-
catch (e) {
|
210
|
-
reject(e);
|
211
|
-
} }
|
212
|
-
function rejected(value) { try {
|
213
|
-
step(generator["throw"](value));
|
214
|
-
}
|
215
|
-
catch (e) {
|
216
|
-
reject(e);
|
217
|
-
} }
|
218
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
219
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
220
|
-
});
|
221
|
-
}
|
222
|
-
function __generator(thisArg, body) {
|
223
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
224
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
225
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
226
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
227
|
-
function step(op) {
|
228
|
-
if (f)
|
229
|
-
throw new TypeError("Generator is already executing.");
|
230
|
-
while (_)
|
231
|
-
try {
|
232
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
233
|
-
return t;
|
234
|
-
if (y = 0, t)
|
235
|
-
op = [op[0] & 2, t.value];
|
236
|
-
switch (op[0]) {
|
237
|
-
case 0:
|
238
|
-
case 1:
|
239
|
-
t = op;
|
240
|
-
break;
|
241
|
-
case 4:
|
242
|
-
_.label++;
|
243
|
-
return { value: op[1], done: false };
|
244
|
-
case 5:
|
245
|
-
_.label++;
|
246
|
-
y = op[1];
|
247
|
-
op = [0];
|
248
|
-
continue;
|
249
|
-
case 7:
|
250
|
-
op = _.ops.pop();
|
251
|
-
_.trys.pop();
|
252
|
-
continue;
|
253
|
-
default:
|
254
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
255
|
-
_ = 0;
|
256
|
-
continue;
|
257
|
-
}
|
258
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
259
|
-
_.label = op[1];
|
260
|
-
break;
|
261
|
-
}
|
262
|
-
if (op[0] === 6 && _.label < t[1]) {
|
263
|
-
_.label = t[1];
|
264
|
-
t = op;
|
265
|
-
break;
|
266
|
-
}
|
267
|
-
if (t && _.label < t[2]) {
|
268
|
-
_.label = t[2];
|
269
|
-
_.ops.push(op);
|
270
|
-
break;
|
271
|
-
}
|
272
|
-
if (t[2])
|
273
|
-
_.ops.pop();
|
274
|
-
_.trys.pop();
|
275
|
-
continue;
|
276
|
-
}
|
277
|
-
op = body.call(thisArg, _);
|
278
|
-
}
|
279
|
-
catch (e) {
|
280
|
-
op = [6, e];
|
281
|
-
y = 0;
|
282
|
-
}
|
283
|
-
finally {
|
284
|
-
f = t = 0;
|
285
|
-
}
|
286
|
-
if (op[0] & 5)
|
287
|
-
throw op[1];
|
288
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
289
|
-
}
|
290
|
-
}
|
291
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
292
|
-
if (k2 === undefined)
|
293
|
-
k2 = k;
|
294
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
295
|
-
}) : (function (o, m, k, k2) {
|
296
|
-
if (k2 === undefined)
|
297
|
-
k2 = k;
|
298
|
-
o[k2] = m[k];
|
299
|
-
});
|
300
|
-
function __exportStar(m, o) {
|
301
|
-
for (var p in m)
|
302
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
303
|
-
__createBinding(o, m, p);
|
304
|
-
}
|
305
|
-
function __values(o) {
|
306
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
307
|
-
if (m)
|
308
|
-
return m.call(o);
|
309
|
-
if (o && typeof o.length === "number")
|
310
|
-
return {
|
311
|
-
next: function () {
|
312
|
-
if (o && i >= o.length)
|
313
|
-
o = void 0;
|
314
|
-
return { value: o && o[i++], done: !o };
|
315
|
-
}
|
316
|
-
};
|
317
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
318
|
-
}
|
319
|
-
function __read(o, n) {
|
320
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
321
|
-
if (!m)
|
322
|
-
return o;
|
323
|
-
var i = m.call(o), r, ar = [], e;
|
324
|
-
try {
|
325
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
326
|
-
ar.push(r.value);
|
327
|
-
}
|
328
|
-
catch (error) {
|
329
|
-
e = { error: error };
|
330
|
-
}
|
331
|
-
finally {
|
332
|
-
try {
|
333
|
-
if (r && !r.done && (m = i["return"]))
|
334
|
-
m.call(i);
|
335
|
-
}
|
336
|
-
finally {
|
337
|
-
if (e)
|
338
|
-
throw e.error;
|
339
|
-
}
|
340
|
-
}
|
341
|
-
return ar;
|
342
|
-
}
|
343
|
-
/** @deprecated */
|
344
|
-
function __spread() {
|
345
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
346
|
-
ar = ar.concat(__read(arguments[i]));
|
347
|
-
return ar;
|
348
|
-
}
|
349
|
-
/** @deprecated */
|
350
|
-
function __spreadArrays() {
|
351
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
352
|
-
s += arguments[i].length;
|
353
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
354
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
355
|
-
r[k] = a[j];
|
356
|
-
return r;
|
357
|
-
}
|
358
|
-
function __spreadArray(to, from, pack) {
|
359
|
-
if (pack || arguments.length === 2)
|
360
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
361
|
-
if (ar || !(i in from)) {
|
362
|
-
if (!ar)
|
363
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
364
|
-
ar[i] = from[i];
|
365
|
-
}
|
366
|
-
}
|
367
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
368
|
-
}
|
369
|
-
function __await(v) {
|
370
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
371
|
-
}
|
372
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
373
|
-
if (!Symbol.asyncIterator)
|
374
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
375
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
376
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
377
|
-
function verb(n) { if (g[n])
|
378
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
379
|
-
function resume(n, v) { try {
|
380
|
-
step(g[n](v));
|
381
|
-
}
|
382
|
-
catch (e) {
|
383
|
-
settle(q[0][3], e);
|
384
|
-
} }
|
385
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
386
|
-
function fulfill(value) { resume("next", value); }
|
387
|
-
function reject(value) { resume("throw", value); }
|
388
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
389
|
-
resume(q[0][0], q[0][1]); }
|
390
|
-
}
|
391
|
-
function __asyncDelegator(o) {
|
392
|
-
var i, p;
|
393
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
394
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
395
|
-
}
|
396
|
-
function __asyncValues(o) {
|
397
|
-
if (!Symbol.asyncIterator)
|
398
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
399
|
-
var m = o[Symbol.asyncIterator], i;
|
400
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
401
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
402
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
403
|
-
}
|
404
|
-
function __makeTemplateObject(cooked, raw) {
|
405
|
-
if (Object.defineProperty) {
|
406
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
407
|
-
}
|
408
|
-
else {
|
409
|
-
cooked.raw = raw;
|
410
|
-
}
|
411
|
-
return cooked;
|
412
|
-
}
|
413
|
-
;
|
414
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
415
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
416
|
-
}) : function (o, v) {
|
417
|
-
o["default"] = v;
|
418
|
-
};
|
419
|
-
function __importStar(mod) {
|
420
|
-
if (mod && mod.__esModule)
|
421
|
-
return mod;
|
422
|
-
var result = {};
|
423
|
-
if (mod != null)
|
424
|
-
for (var k in mod)
|
425
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
426
|
-
__createBinding(result, mod, k);
|
427
|
-
__setModuleDefault(result, mod);
|
428
|
-
return result;
|
429
|
-
}
|
430
|
-
function __importDefault(mod) {
|
431
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
432
|
-
}
|
433
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
434
|
-
if (kind === "a" && !f)
|
435
|
-
throw new TypeError("Private accessor was defined without a getter");
|
436
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
437
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
438
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
439
|
-
}
|
440
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
441
|
-
if (kind === "m")
|
442
|
-
throw new TypeError("Private method is not writable");
|
443
|
-
if (kind === "a" && !f)
|
444
|
-
throw new TypeError("Private accessor was defined without a setter");
|
445
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
446
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
447
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
448
|
-
}
|
449
|
-
|
450
|
-
/**
|
451
|
-
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
|
452
|
-
*/
|
453
|
-
var ComponentPortal = /** @class */ (function () {
|
454
|
-
function ComponentPortal(component, injector) {
|
455
|
-
this.component = component;
|
456
|
-
this.injector = injector;
|
457
|
-
}
|
458
|
-
/** Attach this portal to a host. */
|
459
|
-
ComponentPortal.prototype.attach = function (host, newestOnTop) {
|
460
|
-
this._attachedHost = host;
|
461
|
-
return host.attach(this, newestOnTop);
|
462
|
-
};
|
463
|
-
/** Detach this portal from its host */
|
464
|
-
ComponentPortal.prototype.detach = function () {
|
465
|
-
var host = this._attachedHost;
|
466
|
-
if (host) {
|
467
|
-
this._attachedHost = undefined;
|
468
|
-
return host.detach();
|
469
|
-
}
|
470
|
-
};
|
471
|
-
Object.defineProperty(ComponentPortal.prototype, "isAttached", {
|
472
|
-
/** Whether this portal is attached to a host. */
|
473
|
-
get: function () {
|
474
|
-
return this._attachedHost != null;
|
475
|
-
},
|
476
|
-
enumerable: false,
|
477
|
-
configurable: true
|
478
|
-
});
|
479
|
-
/**
|
480
|
-
* Sets the PortalHost reference without performing `attach()`. This is used directly by
|
481
|
-
* the PortalHost when it is performing an `attach()` or `detach()`.
|
482
|
-
*/
|
483
|
-
ComponentPortal.prototype.setAttachedHost = function (host) {
|
484
|
-
this._attachedHost = host;
|
485
|
-
};
|
486
|
-
return ComponentPortal;
|
487
|
-
}());
|
488
|
-
/**
|
489
|
-
* Partial implementation of PortalHost that only deals with attaching a
|
490
|
-
* ComponentPortal
|
491
|
-
*/
|
492
|
-
var BasePortalHost = /** @class */ (function () {
|
493
|
-
function BasePortalHost() {
|
494
|
-
}
|
495
|
-
BasePortalHost.prototype.attach = function (portal, newestOnTop) {
|
496
|
-
this._attachedPortal = portal;
|
497
|
-
return this.attachComponentPortal(portal, newestOnTop);
|
498
|
-
};
|
499
|
-
BasePortalHost.prototype.detach = function () {
|
500
|
-
if (this._attachedPortal) {
|
501
|
-
this._attachedPortal.setAttachedHost();
|
502
|
-
}
|
503
|
-
this._attachedPortal = undefined;
|
504
|
-
if (this._disposeFn) {
|
505
|
-
this._disposeFn();
|
506
|
-
this._disposeFn = undefined;
|
507
|
-
}
|
508
|
-
};
|
509
|
-
BasePortalHost.prototype.setDisposeFn = function (fn) {
|
510
|
-
this._disposeFn = fn;
|
511
|
-
};
|
512
|
-
return BasePortalHost;
|
513
|
-
}());
|
514
|
-
|
515
|
-
/**
|
516
|
-
* A PortalHost for attaching portals to an arbitrary DOM element outside of the Angular
|
517
|
-
* application context.
|
518
|
-
*
|
519
|
-
* This is the only part of the portal core that directly touches the DOM.
|
520
|
-
*/
|
521
|
-
var DomPortalHost = /** @class */ (function (_super) {
|
522
|
-
__extends(DomPortalHost, _super);
|
523
|
-
function DomPortalHost(_hostDomElement, _componentFactoryResolver, _appRef) {
|
524
|
-
var _this = _super.call(this) || this;
|
525
|
-
_this._hostDomElement = _hostDomElement;
|
526
|
-
_this._componentFactoryResolver = _componentFactoryResolver;
|
527
|
-
_this._appRef = _appRef;
|
528
|
-
return _this;
|
529
|
-
}
|
530
|
-
/**
|
531
|
-
* Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.
|
532
|
-
* @param portal Portal to be attached
|
533
|
-
*/
|
534
|
-
DomPortalHost.prototype.attachComponentPortal = function (portal, newestOnTop) {
|
535
|
-
var _this = this;
|
536
|
-
var componentFactory = this._componentFactoryResolver.resolveComponentFactory(portal.component);
|
537
|
-
var componentRef;
|
538
|
-
// If the portal specifies a ViewContainerRef, we will use that as the attachment point
|
539
|
-
// for the component (in terms of Angular's component tree, not rendering).
|
540
|
-
// When the ViewContainerRef is missing, we use the factory to create the component directly
|
541
|
-
// and then manually attach the ChangeDetector for that component to the application (which
|
542
|
-
// happens automatically when using a ViewContainer).
|
543
|
-
componentRef = componentFactory.create(portal.injector);
|
544
|
-
// When creating a component outside of a ViewContainer, we need to manually register
|
545
|
-
// its ChangeDetector with the application. This API is unfortunately not yet published
|
546
|
-
// in Angular core. The change detector must also be deregistered when the component
|
547
|
-
// is destroyed to prevent memory leaks.
|
548
|
-
this._appRef.attachView(componentRef.hostView);
|
549
|
-
this.setDisposeFn(function () {
|
550
|
-
_this._appRef.detachView(componentRef.hostView);
|
551
|
-
componentRef.destroy();
|
552
|
-
});
|
553
|
-
// At this point the component has been instantiated, so we move it to the location in the DOM
|
554
|
-
// where we want it to be rendered.
|
555
|
-
if (newestOnTop) {
|
556
|
-
this._hostDomElement.insertBefore(this._getComponentRootNode(componentRef), this._hostDomElement.firstChild);
|
557
|
-
}
|
558
|
-
else {
|
559
|
-
this._hostDomElement.appendChild(this._getComponentRootNode(componentRef));
|
560
|
-
}
|
561
|
-
return componentRef;
|
562
|
-
};
|
563
|
-
/** Gets the root HTMLElement for an instantiated component. */
|
564
|
-
DomPortalHost.prototype._getComponentRootNode = function (componentRef) {
|
565
|
-
return componentRef.hostView.rootNodes[0];
|
566
|
-
};
|
567
|
-
return DomPortalHost;
|
568
|
-
}(BasePortalHost));
|
569
|
-
|
570
|
-
/** Container inside which all toasts will render. */
|
571
|
-
var OverlayContainer = /** @class */ (function () {
|
572
|
-
function OverlayContainer(_document) {
|
573
|
-
this._document = _document;
|
574
|
-
}
|
575
|
-
OverlayContainer.prototype.ngOnDestroy = function () {
|
576
|
-
if (this._containerElement && this._containerElement.parentNode) {
|
577
|
-
this._containerElement.parentNode.removeChild(this._containerElement);
|
578
|
-
}
|
579
|
-
};
|
580
|
-
/**
|
581
|
-
* This method returns the overlay container element. It will lazily
|
582
|
-
* create the element the first time it is called to facilitate using
|
583
|
-
* the container in non-browser environments.
|
584
|
-
* @returns the container element
|
585
|
-
*/
|
586
|
-
OverlayContainer.prototype.getContainerElement = function () {
|
587
|
-
if (!this._containerElement) {
|
588
|
-
this._createContainer();
|
589
|
-
}
|
590
|
-
return this._containerElement;
|
591
|
-
};
|
592
|
-
/**
|
593
|
-
* Create the overlay container element, which is simply a div
|
594
|
-
* with the 'cdk-overlay-container' class on the document body.
|
595
|
-
*/
|
596
|
-
OverlayContainer.prototype._createContainer = function () {
|
597
|
-
var container = this._document.createElement('div');
|
598
|
-
container.classList.add('overlay-container');
|
599
|
-
this._document.body.appendChild(container);
|
600
|
-
this._containerElement = container;
|
601
|
-
};
|
602
|
-
return OverlayContainer;
|
603
|
-
}());
|
604
|
-
OverlayContainer.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function OverlayContainer_Factory() { return new OverlayContainer(i0__namespace.ɵɵinject(i1__namespace.DOCUMENT)); }, token: OverlayContainer, providedIn: "root" });
|
605
|
-
OverlayContainer.decorators = [
|
606
|
-
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
607
|
-
];
|
608
|
-
OverlayContainer.ctorParameters = function () { return [
|
609
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] }
|
610
|
-
]; };
|
611
|
-
|
612
|
-
/**
|
613
|
-
* Reference to an overlay that has been created with the Overlay service.
|
614
|
-
* Used to manipulate or dispose of said overlay.
|
615
|
-
*/
|
616
|
-
var OverlayRef = /** @class */ (function () {
|
617
|
-
function OverlayRef(_portalHost) {
|
618
|
-
this._portalHost = _portalHost;
|
619
|
-
}
|
620
|
-
OverlayRef.prototype.attach = function (portal, newestOnTop) {
|
621
|
-
if (newestOnTop === void 0) { newestOnTop = true; }
|
622
|
-
return this._portalHost.attach(portal, newestOnTop);
|
623
|
-
};
|
624
|
-
/**
|
625
|
-
* Detaches an overlay from a portal.
|
626
|
-
* @returns Resolves when the overlay has been detached.
|
627
|
-
*/
|
628
|
-
OverlayRef.prototype.detach = function () {
|
629
|
-
return this._portalHost.detach();
|
630
|
-
};
|
631
|
-
return OverlayRef;
|
632
|
-
}());
|
633
|
-
|
634
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
635
|
-
/**
|
636
|
-
* Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
|
637
|
-
* used as a low-level building building block for other components. Dialogs, tooltips, menus,
|
638
|
-
* selects, etc. can all be built using overlays. The service should primarily be used by authors
|
639
|
-
* of re-usable components rather than developers building end-user applications.
|
640
|
-
*
|
641
|
-
* An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.
|
642
|
-
*/
|
643
|
-
var Overlay = /** @class */ (function () {
|
644
|
-
function Overlay(_overlayContainer, _componentFactoryResolver, _appRef, _document) {
|
645
|
-
this._overlayContainer = _overlayContainer;
|
646
|
-
this._componentFactoryResolver = _componentFactoryResolver;
|
647
|
-
this._appRef = _appRef;
|
648
|
-
this._document = _document;
|
649
|
-
// Namespace panes by overlay container
|
650
|
-
this._paneElements = new Map();
|
651
|
-
}
|
652
|
-
/**
|
653
|
-
* Creates an overlay.
|
654
|
-
* @returns A reference to the created overlay.
|
655
|
-
*/
|
656
|
-
Overlay.prototype.create = function (positionClass, overlayContainer) {
|
657
|
-
// get existing pane if possible
|
658
|
-
return this._createOverlayRef(this.getPaneElement(positionClass, overlayContainer));
|
659
|
-
};
|
660
|
-
Overlay.prototype.getPaneElement = function (positionClass, overlayContainer) {
|
661
|
-
if (positionClass === void 0) { positionClass = ''; }
|
662
|
-
if (!this._paneElements.get(overlayContainer)) {
|
663
|
-
this._paneElements.set(overlayContainer, {});
|
664
|
-
}
|
665
|
-
if (!this._paneElements.get(overlayContainer)[positionClass]) {
|
666
|
-
this._paneElements.get(overlayContainer)[positionClass] = this._createPaneElement(positionClass, overlayContainer);
|
667
|
-
}
|
668
|
-
return this._paneElements.get(overlayContainer)[positionClass];
|
669
|
-
};
|
670
|
-
/**
|
671
|
-
* Creates the DOM element for an overlay and appends it to the overlay container.
|
672
|
-
* @returns Newly-created pane element
|
673
|
-
*/
|
674
|
-
Overlay.prototype._createPaneElement = function (positionClass, overlayContainer) {
|
675
|
-
var pane = this._document.createElement('div');
|
676
|
-
pane.id = 'toast-container';
|
677
|
-
pane.classList.add(positionClass);
|
678
|
-
pane.classList.add('toast-container');
|
679
|
-
if (!overlayContainer) {
|
680
|
-
this._overlayContainer.getContainerElement().appendChild(pane);
|
681
|
-
}
|
682
|
-
else {
|
683
|
-
overlayContainer.getContainerElement().appendChild(pane);
|
684
|
-
}
|
685
|
-
return pane;
|
686
|
-
};
|
687
|
-
/**
|
688
|
-
* Create a DomPortalHost into which the overlay content can be loaded.
|
689
|
-
* @param pane The DOM element to turn into a portal host.
|
690
|
-
* @returns A portal host for the given DOM element.
|
691
|
-
*/
|
692
|
-
Overlay.prototype._createPortalHost = function (pane) {
|
693
|
-
return new DomPortalHost(pane, this._componentFactoryResolver, this._appRef);
|
694
|
-
};
|
695
|
-
/**
|
696
|
-
* Creates an OverlayRef for an overlay in the given DOM element.
|
697
|
-
* @param pane DOM element for the overlay
|
698
|
-
*/
|
699
|
-
Overlay.prototype._createOverlayRef = function (pane) {
|
700
|
-
return new OverlayRef(this._createPortalHost(pane));
|
701
|
-
};
|
702
|
-
return Overlay;
|
703
|
-
}());
|
704
|
-
Overlay.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Overlay_Factory() { return new Overlay(i0__namespace.ɵɵinject(OverlayContainer), i0__namespace.ɵɵinject(i0__namespace.ComponentFactoryResolver), i0__namespace.ɵɵinject(i0__namespace.ApplicationRef), i0__namespace.ɵɵinject(i1__namespace.DOCUMENT)); }, token: Overlay, providedIn: "root" });
|
705
|
-
Overlay.decorators = [
|
706
|
-
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
707
|
-
];
|
708
|
-
Overlay.ctorParameters = function () { return [
|
709
|
-
{ type: OverlayContainer },
|
710
|
-
{ type: i0.ComponentFactoryResolver },
|
711
|
-
{ type: i0.ApplicationRef },
|
712
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] }
|
713
|
-
]; };
|
714
|
-
|
715
|
-
/**
|
716
|
-
* Reference to a toast opened via the Toastr service.
|
717
|
-
*/
|
718
|
-
var ToastRef = /** @class */ (function () {
|
719
|
-
function ToastRef(_overlayRef) {
|
720
|
-
this._overlayRef = _overlayRef;
|
721
|
-
/** Count of duplicates of this toast */
|
722
|
-
this.duplicatesCount = 0;
|
723
|
-
/** Subject for notifying the user that the toast has finished closing. */
|
724
|
-
this._afterClosed = new rxjs.Subject();
|
725
|
-
/** triggered when toast is activated */
|
726
|
-
this._activate = new rxjs.Subject();
|
727
|
-
/** notifies the toast that it should close before the timeout */
|
728
|
-
this._manualClose = new rxjs.Subject();
|
729
|
-
/** notifies the toast that it should reset the timeouts */
|
730
|
-
this._resetTimeout = new rxjs.Subject();
|
731
|
-
/** notifies the toast that it should count a duplicate toast */
|
732
|
-
this._countDuplicate = new rxjs.Subject();
|
733
|
-
}
|
734
|
-
ToastRef.prototype.manualClose = function () {
|
735
|
-
this._manualClose.next();
|
736
|
-
this._manualClose.complete();
|
737
|
-
};
|
738
|
-
ToastRef.prototype.manualClosed = function () {
|
739
|
-
return this._manualClose.asObservable();
|
740
|
-
};
|
741
|
-
ToastRef.prototype.timeoutReset = function () {
|
742
|
-
return this._resetTimeout.asObservable();
|
743
|
-
};
|
744
|
-
ToastRef.prototype.countDuplicate = function () {
|
745
|
-
return this._countDuplicate.asObservable();
|
746
|
-
};
|
747
|
-
/**
|
748
|
-
* Close the toast.
|
749
|
-
*/
|
750
|
-
ToastRef.prototype.close = function () {
|
751
|
-
this._overlayRef.detach();
|
752
|
-
this._afterClosed.next();
|
753
|
-
this._manualClose.next();
|
754
|
-
this._afterClosed.complete();
|
755
|
-
this._manualClose.complete();
|
756
|
-
this._activate.complete();
|
757
|
-
this._resetTimeout.complete();
|
758
|
-
this._countDuplicate.complete();
|
759
|
-
};
|
760
|
-
/** Gets an observable that is notified when the toast is finished closing. */
|
761
|
-
ToastRef.prototype.afterClosed = function () {
|
762
|
-
return this._afterClosed.asObservable();
|
763
|
-
};
|
764
|
-
ToastRef.prototype.isInactive = function () {
|
765
|
-
return this._activate.isStopped;
|
766
|
-
};
|
767
|
-
ToastRef.prototype.activate = function () {
|
768
|
-
this._activate.next();
|
769
|
-
this._activate.complete();
|
770
|
-
};
|
771
|
-
/** Gets an observable that is notified when the toast has started opening. */
|
772
|
-
ToastRef.prototype.afterActivate = function () {
|
773
|
-
return this._activate.asObservable();
|
774
|
-
};
|
775
|
-
/** Reset the toast timouts and count duplicates */
|
776
|
-
ToastRef.prototype.onDuplicate = function (resetTimeout, countDuplicate) {
|
777
|
-
if (resetTimeout) {
|
778
|
-
this._resetTimeout.next();
|
779
|
-
}
|
780
|
-
if (countDuplicate) {
|
781
|
-
this._countDuplicate.next(++this.duplicatesCount);
|
782
|
-
}
|
783
|
-
};
|
784
|
-
return ToastRef;
|
785
|
-
}());
|
786
|
-
/** Custom injector type specifically for instantiating components with a toast. */
|
787
|
-
var ToastInjector = /** @class */ (function () {
|
788
|
-
function ToastInjector(_toastPackage, _parentInjector) {
|
789
|
-
this._toastPackage = _toastPackage;
|
790
|
-
this._parentInjector = _parentInjector;
|
791
|
-
}
|
792
|
-
ToastInjector.prototype.get = function (token, notFoundValue, flags) {
|
793
|
-
if (token === ToastPackage) {
|
794
|
-
return this._toastPackage;
|
795
|
-
}
|
796
|
-
return this._parentInjector.get(token, notFoundValue, flags);
|
797
|
-
};
|
798
|
-
return ToastInjector;
|
799
|
-
}());
|
800
|
-
|
801
|
-
var ToastrService = /** @class */ (function () {
|
802
|
-
function ToastrService(token, overlay, _injector, sanitizer, ngZone) {
|
803
|
-
this.overlay = overlay;
|
804
|
-
this._injector = _injector;
|
805
|
-
this.sanitizer = sanitizer;
|
806
|
-
this.ngZone = ngZone;
|
807
|
-
this.currentlyActive = 0;
|
808
|
-
this.toasts = [];
|
809
|
-
this.index = 0;
|
810
|
-
this.toastrConfig = Object.assign(Object.assign({}, token.default), token.config);
|
811
|
-
if (token.config.iconClasses) {
|
812
|
-
this.toastrConfig.iconClasses = Object.assign(Object.assign({}, token.default.iconClasses), token.config.iconClasses);
|
813
|
-
}
|
814
|
-
}
|
815
|
-
/** show toast */
|
816
|
-
ToastrService.prototype.show = function (message, title, override, type) {
|
817
|
-
if (override === void 0) { override = {}; }
|
818
|
-
if (type === void 0) { type = ''; }
|
819
|
-
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
820
|
-
};
|
821
|
-
/** show successful toast */
|
822
|
-
ToastrService.prototype.success = function (message, title, override) {
|
823
|
-
if (override === void 0) { override = {}; }
|
824
|
-
var type = this.toastrConfig.iconClasses.success || '';
|
825
|
-
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
826
|
-
};
|
827
|
-
/** show error toast */
|
828
|
-
ToastrService.prototype.error = function (message, title, override) {
|
829
|
-
if (override === void 0) { override = {}; }
|
830
|
-
var type = this.toastrConfig.iconClasses.error || '';
|
831
|
-
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
832
|
-
};
|
833
|
-
/** show info toast */
|
834
|
-
ToastrService.prototype.info = function (message, title, override) {
|
835
|
-
if (override === void 0) { override = {}; }
|
836
|
-
var type = this.toastrConfig.iconClasses.info || '';
|
837
|
-
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
838
|
-
};
|
839
|
-
/** show warning toast */
|
840
|
-
ToastrService.prototype.warning = function (message, title, override) {
|
841
|
-
if (override === void 0) { override = {}; }
|
842
|
-
var type = this.toastrConfig.iconClasses.warning || '';
|
843
|
-
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
844
|
-
};
|
845
|
-
/**
|
846
|
-
* Remove all or a single toast by id
|
847
|
-
*/
|
848
|
-
ToastrService.prototype.clear = function (toastId) {
|
849
|
-
var e_1, _a;
|
850
|
-
try {
|
851
|
-
// Call every toastRef manualClose function
|
852
|
-
for (var _b = __values(this.toasts), _c = _b.next(); !_c.done; _c = _b.next()) {
|
853
|
-
var toast = _c.value;
|
854
|
-
if (toastId !== undefined) {
|
855
|
-
if (toast.toastId === toastId) {
|
856
|
-
toast.toastRef.manualClose();
|
857
|
-
return;
|
858
|
-
}
|
859
|
-
}
|
860
|
-
else {
|
861
|
-
toast.toastRef.manualClose();
|
862
|
-
}
|
863
|
-
}
|
864
|
-
}
|
865
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
866
|
-
finally {
|
867
|
-
try {
|
868
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
869
|
-
}
|
870
|
-
finally { if (e_1) throw e_1.error; }
|
871
|
-
}
|
872
|
-
};
|
873
|
-
/**
|
874
|
-
* Remove and destroy a single toast by id
|
875
|
-
*/
|
876
|
-
ToastrService.prototype.remove = function (toastId) {
|
877
|
-
var found = this._findToast(toastId);
|
878
|
-
if (!found) {
|
879
|
-
return false;
|
880
|
-
}
|
881
|
-
found.activeToast.toastRef.close();
|
882
|
-
this.toasts.splice(found.index, 1);
|
883
|
-
this.currentlyActive = this.currentlyActive - 1;
|
884
|
-
if (!this.toastrConfig.maxOpened || !this.toasts.length) {
|
885
|
-
return false;
|
886
|
-
}
|
887
|
-
if (this.currentlyActive < this.toastrConfig.maxOpened && this.toasts[this.currentlyActive]) {
|
888
|
-
var p = this.toasts[this.currentlyActive].toastRef;
|
889
|
-
if (!p.isInactive()) {
|
890
|
-
this.currentlyActive = this.currentlyActive + 1;
|
891
|
-
p.activate();
|
892
|
-
}
|
893
|
-
}
|
894
|
-
return true;
|
895
|
-
};
|
896
|
-
/**
|
897
|
-
* Determines if toast message is already shown
|
898
|
-
*/
|
899
|
-
ToastrService.prototype.findDuplicate = function (title, message, resetOnDuplicate, countDuplicates) {
|
900
|
-
var e_2, _a;
|
901
|
-
if (title === void 0) { title = ''; }
|
902
|
-
if (message === void 0) { message = ''; }
|
903
|
-
var includeTitleDuplicates = this.toastrConfig.includeTitleDuplicates;
|
904
|
-
try {
|
905
|
-
for (var _b = __values(this.toasts), _c = _b.next(); !_c.done; _c = _b.next()) {
|
906
|
-
var toast = _c.value;
|
907
|
-
var hasDuplicateTitle = includeTitleDuplicates && toast.title === title;
|
908
|
-
if ((!includeTitleDuplicates || hasDuplicateTitle) && toast.message === message) {
|
909
|
-
toast.toastRef.onDuplicate(resetOnDuplicate, countDuplicates);
|
910
|
-
return toast;
|
911
|
-
}
|
912
|
-
}
|
913
|
-
}
|
914
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
915
|
-
finally {
|
916
|
-
try {
|
917
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
918
|
-
}
|
919
|
-
finally { if (e_2) throw e_2.error; }
|
920
|
-
}
|
921
|
-
return null;
|
922
|
-
};
|
923
|
-
/** create a clone of global config and apply individual settings */
|
924
|
-
ToastrService.prototype.applyConfig = function (override) {
|
925
|
-
if (override === void 0) { override = {}; }
|
926
|
-
return Object.assign(Object.assign({}, this.toastrConfig), override);
|
927
|
-
};
|
928
|
-
/**
|
929
|
-
* Find toast object by id
|
930
|
-
*/
|
931
|
-
ToastrService.prototype._findToast = function (toastId) {
|
932
|
-
for (var i = 0; i < this.toasts.length; i++) {
|
933
|
-
if (this.toasts[i].toastId === toastId) {
|
934
|
-
return { index: i, activeToast: this.toasts[i] };
|
935
|
-
}
|
936
|
-
}
|
937
|
-
return null;
|
938
|
-
};
|
939
|
-
/**
|
940
|
-
* Determines the need to run inside angular's zone then builds the toast
|
941
|
-
*/
|
942
|
-
ToastrService.prototype._preBuildNotification = function (toastType, message, title, config) {
|
943
|
-
var _this = this;
|
944
|
-
if (config.onActivateTick) {
|
945
|
-
return this.ngZone.run(function () { return _this._buildNotification(toastType, message, title, config); });
|
946
|
-
}
|
947
|
-
return this._buildNotification(toastType, message, title, config);
|
948
|
-
};
|
949
|
-
/**
|
950
|
-
* Creates and attaches toast data to component
|
951
|
-
* returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.
|
952
|
-
*/
|
953
|
-
ToastrService.prototype._buildNotification = function (toastType, message, title, config) {
|
954
|
-
if (!config.toastComponent) {
|
955
|
-
throw new Error('toastComponent required');
|
956
|
-
}
|
957
|
-
// max opened and auto dismiss = true
|
958
|
-
// if timeout = 0 resetting it would result in setting this.hideTime = Date.now(). Hence, we only want to reset timeout if there is
|
959
|
-
// a timeout at all
|
960
|
-
var duplicate = this.findDuplicate(title, message, this.toastrConfig.resetTimeoutOnDuplicate && config.timeOut > 0, this.toastrConfig.countDuplicates);
|
961
|
-
if (((this.toastrConfig.includeTitleDuplicates && title) || message) &&
|
962
|
-
this.toastrConfig.preventDuplicates &&
|
963
|
-
duplicate !== null) {
|
964
|
-
return duplicate;
|
965
|
-
}
|
966
|
-
this.previousToastMessage = message;
|
967
|
-
var keepInactive = false;
|
968
|
-
if (this.toastrConfig.maxOpened && this.currentlyActive >= this.toastrConfig.maxOpened) {
|
969
|
-
keepInactive = true;
|
970
|
-
if (this.toastrConfig.autoDismiss) {
|
971
|
-
this.clear(this.toasts[0].toastId);
|
972
|
-
}
|
973
|
-
}
|
974
|
-
var overlayRef = this.overlay.create(config.positionClass, this.overlayContainer);
|
975
|
-
this.index = this.index + 1;
|
976
|
-
var sanitizedMessage = message;
|
977
|
-
if (message && config.enableHtml) {
|
978
|
-
sanitizedMessage = this.sanitizer.sanitize(i0.SecurityContext.HTML, message);
|
979
|
-
}
|
980
|
-
var toastRef = new ToastRef(overlayRef);
|
981
|
-
var toastPackage = new ToastPackage(this.index, config, sanitizedMessage, title, toastType, toastRef);
|
982
|
-
var toastInjector = new ToastInjector(toastPackage, this._injector);
|
983
|
-
var component = new ComponentPortal(config.toastComponent, toastInjector);
|
984
|
-
var portal = overlayRef.attach(component, this.toastrConfig.newestOnTop);
|
985
|
-
toastRef.componentInstance = portal.instance;
|
986
|
-
var ins = {
|
987
|
-
toastId: this.index,
|
988
|
-
title: title || '',
|
989
|
-
message: message || '',
|
990
|
-
toastRef: toastRef,
|
991
|
-
onShown: toastRef.afterActivate(),
|
992
|
-
onHidden: toastRef.afterClosed(),
|
993
|
-
onTap: toastPackage.onTap(),
|
994
|
-
onAction: toastPackage.onAction(),
|
995
|
-
portal: portal,
|
996
|
-
};
|
997
|
-
if (!keepInactive) {
|
998
|
-
this.currentlyActive = this.currentlyActive + 1;
|
999
|
-
setTimeout(function () {
|
1000
|
-
ins.toastRef.activate();
|
1001
|
-
});
|
1002
|
-
}
|
1003
|
-
this.toasts.push(ins);
|
1004
|
-
return ins;
|
1005
|
-
};
|
1006
|
-
return ToastrService;
|
1007
|
-
}());
|
1008
|
-
ToastrService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ToastrService_Factory() { return new ToastrService(i0__namespace.ɵɵinject(TOAST_CONFIG), i0__namespace.ɵɵinject(Overlay), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(i3__namespace.DomSanitizer), i0__namespace.ɵɵinject(i0__namespace.NgZone)); }, token: ToastrService, providedIn: "root" });
|
1009
|
-
ToastrService.decorators = [
|
1010
|
-
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
1011
|
-
];
|
1012
|
-
ToastrService.ctorParameters = function () { return [
|
1013
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [TOAST_CONFIG,] }] },
|
1014
|
-
{ type: Overlay },
|
1015
|
-
{ type: i0.Injector },
|
1016
|
-
{ type: i3.DomSanitizer },
|
1017
|
-
{ type: i0.NgZone }
|
1018
|
-
]; };
|
1019
|
-
|
1020
|
-
var Toast = /** @class */ (function () {
|
1021
|
-
function Toast(toastrService, toastPackage, ngZone) {
|
1022
|
-
var _this = this;
|
1023
|
-
this.toastrService = toastrService;
|
1024
|
-
this.toastPackage = toastPackage;
|
1025
|
-
this.ngZone = ngZone;
|
1026
|
-
/** width of progress bar */
|
1027
|
-
this.width = -1;
|
1028
|
-
/** a combination of toast type and options.toastClass */
|
1029
|
-
this.toastClasses = '';
|
1030
|
-
/** controls animation */
|
1031
|
-
this.state = {
|
1032
|
-
value: 'inactive',
|
1033
|
-
params: {
|
1034
|
-
easeTime: this.toastPackage.config.easeTime,
|
1035
|
-
easing: 'ease-in'
|
1036
|
-
}
|
1037
|
-
};
|
1038
|
-
this.message = toastPackage.message;
|
1039
|
-
this.title = toastPackage.title;
|
1040
|
-
this.options = toastPackage.config;
|
1041
|
-
this.originalTimeout = toastPackage.config.timeOut;
|
1042
|
-
this.toastClasses = toastPackage.toastType + " " + toastPackage.config.toastClass;
|
1043
|
-
this.sub = toastPackage.toastRef.afterActivate().subscribe(function () {
|
1044
|
-
_this.activateToast();
|
1045
|
-
});
|
1046
|
-
this.sub1 = toastPackage.toastRef.manualClosed().subscribe(function () {
|
1047
|
-
_this.remove();
|
1048
|
-
});
|
1049
|
-
this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(function () {
|
1050
|
-
_this.resetTimeout();
|
1051
|
-
});
|
1052
|
-
this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(function (count) {
|
1053
|
-
_this.duplicatesCount = count;
|
1054
|
-
});
|
1055
|
-
}
|
1056
|
-
Object.defineProperty(Toast.prototype, "displayStyle", {
|
1057
|
-
/** hides component when waiting to be displayed */
|
1058
|
-
get: function () {
|
1059
|
-
if (this.state.value === 'inactive') {
|
1060
|
-
return 'none';
|
1061
|
-
}
|
1062
|
-
return;
|
1063
|
-
},
|
1064
|
-
enumerable: false,
|
1065
|
-
configurable: true
|
1066
|
-
});
|
1067
|
-
Toast.prototype.ngOnDestroy = function () {
|
1068
|
-
this.sub.unsubscribe();
|
1069
|
-
this.sub1.unsubscribe();
|
1070
|
-
this.sub2.unsubscribe();
|
1071
|
-
this.sub3.unsubscribe();
|
1072
|
-
clearInterval(this.intervalId);
|
1073
|
-
clearTimeout(this.timeout);
|
1074
|
-
};
|
1075
|
-
/**
|
1076
|
-
* activates toast and sets timeout
|
1077
|
-
*/
|
1078
|
-
Toast.prototype.activateToast = function () {
|
1079
|
-
var _this = this;
|
1080
|
-
this.state = Object.assign(Object.assign({}, this.state), { value: 'active' });
|
1081
|
-
if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
|
1082
|
-
this.outsideTimeout(function () { return _this.remove(); }, this.options.timeOut);
|
1083
|
-
this.hideTime = new Date().getTime() + this.options.timeOut;
|
1084
|
-
if (this.options.progressBar) {
|
1085
|
-
this.outsideInterval(function () { return _this.updateProgress(); }, 10);
|
1086
|
-
}
|
1087
|
-
}
|
1088
|
-
};
|
1089
|
-
/**
|
1090
|
-
* updates progress bar width
|
1091
|
-
*/
|
1092
|
-
Toast.prototype.updateProgress = function () {
|
1093
|
-
if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
|
1094
|
-
return;
|
1095
|
-
}
|
1096
|
-
var now = new Date().getTime();
|
1097
|
-
var remaining = this.hideTime - now;
|
1098
|
-
this.width = (remaining / this.options.timeOut) * 100;
|
1099
|
-
if (this.options.progressAnimation === 'increasing') {
|
1100
|
-
this.width = 100 - this.width;
|
1101
|
-
}
|
1102
|
-
if (this.width <= 0) {
|
1103
|
-
this.width = 0;
|
1104
|
-
}
|
1105
|
-
if (this.width >= 100) {
|
1106
|
-
this.width = 100;
|
1107
|
-
}
|
1108
|
-
};
|
1109
|
-
Toast.prototype.resetTimeout = function () {
|
1110
|
-
var _this = this;
|
1111
|
-
clearTimeout(this.timeout);
|
1112
|
-
clearInterval(this.intervalId);
|
1113
|
-
this.state = Object.assign(Object.assign({}, this.state), { value: 'active' });
|
1114
|
-
this.outsideTimeout(function () { return _this.remove(); }, this.originalTimeout);
|
1115
|
-
this.options.timeOut = this.originalTimeout;
|
1116
|
-
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
1117
|
-
this.width = -1;
|
1118
|
-
if (this.options.progressBar) {
|
1119
|
-
this.outsideInterval(function () { return _this.updateProgress(); }, 10);
|
1120
|
-
}
|
1121
|
-
};
|
1122
|
-
/**
|
1123
|
-
* tells toastrService to remove this toast after animation time
|
1124
|
-
*/
|
1125
|
-
Toast.prototype.remove = function () {
|
1126
|
-
var _this = this;
|
1127
|
-
if (this.state.value === 'removed') {
|
1128
|
-
return;
|
1129
|
-
}
|
1130
|
-
clearTimeout(this.timeout);
|
1131
|
-
this.state = Object.assign(Object.assign({}, this.state), { value: 'removed' });
|
1132
|
-
this.outsideTimeout(function () { return _this.toastrService.remove(_this.toastPackage.toastId); }, +this.toastPackage.config.easeTime);
|
1133
|
-
};
|
1134
|
-
Toast.prototype.tapToast = function () {
|
1135
|
-
if (this.state.value === 'removed') {
|
1136
|
-
return;
|
1137
|
-
}
|
1138
|
-
this.toastPackage.triggerTap();
|
1139
|
-
if (this.options.tapToDismiss) {
|
1140
|
-
this.remove();
|
1141
|
-
}
|
1142
|
-
};
|
1143
|
-
Toast.prototype.stickAround = function () {
|
1144
|
-
if (this.state.value === 'removed') {
|
1145
|
-
return;
|
1146
|
-
}
|
1147
|
-
clearTimeout(this.timeout);
|
1148
|
-
this.options.timeOut = 0;
|
1149
|
-
this.hideTime = 0;
|
1150
|
-
// disable progressBar
|
1151
|
-
clearInterval(this.intervalId);
|
1152
|
-
this.width = 0;
|
1153
|
-
};
|
1154
|
-
Toast.prototype.delayedHideToast = function () {
|
1155
|
-
var _this = this;
|
1156
|
-
if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
|
1157
|
-
this.options.extendedTimeOut === 0 ||
|
1158
|
-
this.state.value === 'removed') {
|
1159
|
-
return;
|
1160
|
-
}
|
1161
|
-
this.outsideTimeout(function () { return _this.remove(); }, this.options.extendedTimeOut);
|
1162
|
-
this.options.timeOut = this.options.extendedTimeOut;
|
1163
|
-
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
1164
|
-
this.width = -1;
|
1165
|
-
if (this.options.progressBar) {
|
1166
|
-
this.outsideInterval(function () { return _this.updateProgress(); }, 10);
|
1167
|
-
}
|
1168
|
-
};
|
1169
|
-
Toast.prototype.outsideTimeout = function (func, timeout) {
|
1170
|
-
var _this = this;
|
1171
|
-
if (this.ngZone) {
|
1172
|
-
this.ngZone.runOutsideAngular(function () { return (_this.timeout = setTimeout(function () { return _this.runInsideAngular(func); }, timeout)); });
|
1173
|
-
}
|
1174
|
-
else {
|
1175
|
-
this.timeout = setTimeout(function () { return func(); }, timeout);
|
1176
|
-
}
|
1177
|
-
};
|
1178
|
-
Toast.prototype.outsideInterval = function (func, timeout) {
|
1179
|
-
var _this = this;
|
1180
|
-
if (this.ngZone) {
|
1181
|
-
this.ngZone.runOutsideAngular(function () { return (_this.intervalId = setInterval(function () { return _this.runInsideAngular(func); }, timeout)); });
|
1182
|
-
}
|
1183
|
-
else {
|
1184
|
-
this.intervalId = setInterval(function () { return func(); }, timeout);
|
1185
|
-
}
|
1186
|
-
};
|
1187
|
-
Toast.prototype.runInsideAngular = function (func) {
|
1188
|
-
if (this.ngZone) {
|
1189
|
-
this.ngZone.run(function () { return func(); });
|
1190
|
-
}
|
1191
|
-
else {
|
1192
|
-
func();
|
1193
|
-
}
|
1194
|
-
};
|
1195
|
-
return Toast;
|
1196
|
-
}());
|
1197
|
-
Toast.decorators = [
|
1198
|
-
{ type: i0.Component, args: [{
|
1199
|
-
selector: '[toast-component]',
|
1200
|
-
template: "\n <button *ngIf=\"options.closeButton\" (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n <div *ngIf=\"title\" [class]=\"options.titleClass\" [attr.aria-label]=\"title\">\n {{ title }} <ng-container *ngIf=\"duplicatesCount\">[{{ duplicatesCount + 1 }}]</ng-container>\n </div>\n <div *ngIf=\"message && options.enableHtml\" role=\"alertdialog\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [innerHTML]=\"message\">\n </div>\n <div *ngIf=\"message && !options.enableHtml\" role=\"alertdialog\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [attr.aria-label]=\"message\">\n {{ message }}\n </div>\n <div *ngIf=\"options.progressBar\">\n <div class=\"toast-progress\" [style.width]=\"width + '%'\"></div>\n </div>\n ",
|
1201
|
-
animations: [
|
1202
|
-
animations.trigger('flyInOut', [
|
1203
|
-
animations.state('inactive', animations.style({ opacity: 0 })),
|
1204
|
-
animations.state('active', animations.style({ opacity: 1 })),
|
1205
|
-
animations.state('removed', animations.style({ opacity: 0 })),
|
1206
|
-
animations.transition('inactive => active', animations.animate('{{ easeTime }}ms {{ easing }}')),
|
1207
|
-
animations.transition('active => removed', animations.animate('{{ easeTime }}ms {{ easing }}'))
|
1208
|
-
])
|
1209
|
-
],
|
1210
|
-
preserveWhitespaces: false
|
1211
|
-
},] }
|
1212
|
-
];
|
1213
|
-
Toast.ctorParameters = function () { return [
|
1214
|
-
{ type: ToastrService },
|
1215
|
-
{ type: ToastPackage },
|
1216
|
-
{ type: i0.NgZone }
|
1217
|
-
]; };
|
1218
|
-
Toast.propDecorators = {
|
1219
|
-
toastClasses: [{ type: i0.HostBinding, args: ['class',] }],
|
1220
|
-
state: [{ type: i0.HostBinding, args: ['@flyInOut',] }],
|
1221
|
-
displayStyle: [{ type: i0.HostBinding, args: ['style.display',] }],
|
1222
|
-
tapToast: [{ type: i0.HostListener, args: ['click',] }],
|
1223
|
-
stickAround: [{ type: i0.HostListener, args: ['mouseenter',] }],
|
1224
|
-
delayedHideToast: [{ type: i0.HostListener, args: ['mouseleave',] }]
|
1225
|
-
};
|
1226
|
-
|
1227
|
-
var DefaultGlobalConfig = Object.assign(Object.assign({}, DefaultNoComponentGlobalConfig), { toastComponent: Toast });
|
1228
|
-
var ToastrModule = /** @class */ (function () {
|
1229
|
-
function ToastrModule() {
|
1230
|
-
}
|
1231
|
-
ToastrModule.forRoot = function (config) {
|
1232
|
-
if (config === void 0) { config = {}; }
|
1233
|
-
return {
|
1234
|
-
ngModule: ToastrModule,
|
1235
|
-
providers: [
|
1236
|
-
{
|
1237
|
-
provide: TOAST_CONFIG,
|
1238
|
-
useValue: {
|
1239
|
-
default: DefaultGlobalConfig,
|
1240
|
-
config: config,
|
1241
|
-
},
|
1242
|
-
},
|
1243
|
-
],
|
1244
|
-
};
|
1245
|
-
};
|
1246
|
-
return ToastrModule;
|
1247
|
-
}());
|
1248
|
-
ToastrModule.decorators = [
|
1249
|
-
{ type: i0.NgModule, args: [{
|
1250
|
-
imports: [i1.CommonModule],
|
1251
|
-
declarations: [Toast],
|
1252
|
-
exports: [Toast],
|
1253
|
-
entryComponents: [Toast],
|
1254
|
-
},] }
|
1255
|
-
];
|
1256
|
-
var ToastrComponentlessModule = /** @class */ (function () {
|
1257
|
-
function ToastrComponentlessModule() {
|
1258
|
-
}
|
1259
|
-
ToastrComponentlessModule.forRoot = function (config) {
|
1260
|
-
if (config === void 0) { config = {}; }
|
1261
|
-
return {
|
1262
|
-
ngModule: ToastrModule,
|
1263
|
-
providers: [
|
1264
|
-
{
|
1265
|
-
provide: TOAST_CONFIG,
|
1266
|
-
useValue: {
|
1267
|
-
default: DefaultNoComponentGlobalConfig,
|
1268
|
-
config: config,
|
1269
|
-
},
|
1270
|
-
},
|
1271
|
-
],
|
1272
|
-
};
|
1273
|
-
};
|
1274
|
-
return ToastrComponentlessModule;
|
1275
|
-
}());
|
1276
|
-
ToastrComponentlessModule.decorators = [
|
1277
|
-
{ type: i0.NgModule, args: [{
|
1278
|
-
imports: [i1.CommonModule],
|
1279
|
-
},] }
|
1280
|
-
];
|
1281
|
-
|
1282
|
-
var ToastNoAnimation = /** @class */ (function () {
|
1283
|
-
function ToastNoAnimation(toastrService, toastPackage, appRef) {
|
1284
|
-
var _this = this;
|
1285
|
-
this.toastrService = toastrService;
|
1286
|
-
this.toastPackage = toastPackage;
|
1287
|
-
this.appRef = appRef;
|
1288
|
-
/** width of progress bar */
|
1289
|
-
this.width = -1;
|
1290
|
-
/** a combination of toast type and options.toastClass */
|
1291
|
-
this.toastClasses = '';
|
1292
|
-
/** controls animation */
|
1293
|
-
this.state = 'inactive';
|
1294
|
-
this.message = toastPackage.message;
|
1295
|
-
this.title = toastPackage.title;
|
1296
|
-
this.options = toastPackage.config;
|
1297
|
-
this.originalTimeout = toastPackage.config.timeOut;
|
1298
|
-
this.toastClasses = toastPackage.toastType + " " + toastPackage.config.toastClass;
|
1299
|
-
this.sub = toastPackage.toastRef.afterActivate().subscribe(function () {
|
1300
|
-
_this.activateToast();
|
1301
|
-
});
|
1302
|
-
this.sub1 = toastPackage.toastRef.manualClosed().subscribe(function () {
|
1303
|
-
_this.remove();
|
1304
|
-
});
|
1305
|
-
this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(function () {
|
1306
|
-
_this.resetTimeout();
|
1307
|
-
});
|
1308
|
-
this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(function (count) {
|
1309
|
-
_this.duplicatesCount = count;
|
1310
|
-
});
|
1311
|
-
}
|
1312
|
-
Object.defineProperty(ToastNoAnimation.prototype, "displayStyle", {
|
1313
|
-
/** hides component when waiting to be displayed */
|
1314
|
-
get: function () {
|
1315
|
-
if (this.state === 'inactive') {
|
1316
|
-
return 'none';
|
1317
|
-
}
|
1318
|
-
},
|
1319
|
-
enumerable: false,
|
1320
|
-
configurable: true
|
1321
|
-
});
|
1322
|
-
ToastNoAnimation.prototype.ngOnDestroy = function () {
|
1323
|
-
this.sub.unsubscribe();
|
1324
|
-
this.sub1.unsubscribe();
|
1325
|
-
this.sub2.unsubscribe();
|
1326
|
-
this.sub3.unsubscribe();
|
1327
|
-
clearInterval(this.intervalId);
|
1328
|
-
clearTimeout(this.timeout);
|
1329
|
-
};
|
1330
|
-
/**
|
1331
|
-
* activates toast and sets timeout
|
1332
|
-
*/
|
1333
|
-
ToastNoAnimation.prototype.activateToast = function () {
|
1334
|
-
var _this = this;
|
1335
|
-
this.state = 'active';
|
1336
|
-
if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
|
1337
|
-
this.timeout = setTimeout(function () {
|
1338
|
-
_this.remove();
|
1339
|
-
}, this.options.timeOut);
|
1340
|
-
this.hideTime = new Date().getTime() + this.options.timeOut;
|
1341
|
-
if (this.options.progressBar) {
|
1342
|
-
this.intervalId = setInterval(function () { return _this.updateProgress(); }, 10);
|
1343
|
-
}
|
1344
|
-
}
|
1345
|
-
if (this.options.onActivateTick) {
|
1346
|
-
this.appRef.tick();
|
1347
|
-
}
|
1348
|
-
};
|
1349
|
-
/**
|
1350
|
-
* updates progress bar width
|
1351
|
-
*/
|
1352
|
-
ToastNoAnimation.prototype.updateProgress = function () {
|
1353
|
-
if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
|
1354
|
-
return;
|
1355
|
-
}
|
1356
|
-
var now = new Date().getTime();
|
1357
|
-
var remaining = this.hideTime - now;
|
1358
|
-
this.width = (remaining / this.options.timeOut) * 100;
|
1359
|
-
if (this.options.progressAnimation === 'increasing') {
|
1360
|
-
this.width = 100 - this.width;
|
1361
|
-
}
|
1362
|
-
if (this.width <= 0) {
|
1363
|
-
this.width = 0;
|
1364
|
-
}
|
1365
|
-
if (this.width >= 100) {
|
1366
|
-
this.width = 100;
|
1367
|
-
}
|
1368
|
-
};
|
1369
|
-
ToastNoAnimation.prototype.resetTimeout = function () {
|
1370
|
-
var _this = this;
|
1371
|
-
clearTimeout(this.timeout);
|
1372
|
-
clearInterval(this.intervalId);
|
1373
|
-
this.state = 'active';
|
1374
|
-
this.options.timeOut = this.originalTimeout;
|
1375
|
-
this.timeout = setTimeout(function () { return _this.remove(); }, this.originalTimeout);
|
1376
|
-
this.hideTime = new Date().getTime() + (this.originalTimeout || 0);
|
1377
|
-
this.width = -1;
|
1378
|
-
if (this.options.progressBar) {
|
1379
|
-
this.intervalId = setInterval(function () { return _this.updateProgress(); }, 10);
|
1380
|
-
}
|
1381
|
-
};
|
1382
|
-
/**
|
1383
|
-
* tells toastrService to remove this toast after animation time
|
1384
|
-
*/
|
1385
|
-
ToastNoAnimation.prototype.remove = function () {
|
1386
|
-
var _this = this;
|
1387
|
-
if (this.state === 'removed') {
|
1388
|
-
return;
|
1389
|
-
}
|
1390
|
-
clearTimeout(this.timeout);
|
1391
|
-
this.state = 'removed';
|
1392
|
-
this.timeout = setTimeout(function () { return _this.toastrService.remove(_this.toastPackage.toastId); });
|
1393
|
-
};
|
1394
|
-
ToastNoAnimation.prototype.tapToast = function () {
|
1395
|
-
if (this.state === 'removed') {
|
1396
|
-
return;
|
1397
|
-
}
|
1398
|
-
this.toastPackage.triggerTap();
|
1399
|
-
if (this.options.tapToDismiss) {
|
1400
|
-
this.remove();
|
1401
|
-
}
|
1402
|
-
};
|
1403
|
-
ToastNoAnimation.prototype.stickAround = function () {
|
1404
|
-
if (this.state === 'removed') {
|
1405
|
-
return;
|
1406
|
-
}
|
1407
|
-
clearTimeout(this.timeout);
|
1408
|
-
this.options.timeOut = 0;
|
1409
|
-
this.hideTime = 0;
|
1410
|
-
// disable progressBar
|
1411
|
-
clearInterval(this.intervalId);
|
1412
|
-
this.width = 0;
|
1413
|
-
};
|
1414
|
-
ToastNoAnimation.prototype.delayedHideToast = function () {
|
1415
|
-
var _this = this;
|
1416
|
-
if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
|
1417
|
-
this.options.extendedTimeOut === 0 ||
|
1418
|
-
this.state === 'removed') {
|
1419
|
-
return;
|
1420
|
-
}
|
1421
|
-
this.timeout = setTimeout(function () { return _this.remove(); }, this.options.extendedTimeOut);
|
1422
|
-
this.options.timeOut = this.options.extendedTimeOut;
|
1423
|
-
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
1424
|
-
this.width = -1;
|
1425
|
-
if (this.options.progressBar) {
|
1426
|
-
this.intervalId = setInterval(function () { return _this.updateProgress(); }, 10);
|
1427
|
-
}
|
1428
|
-
};
|
1429
|
-
return ToastNoAnimation;
|
1430
|
-
}());
|
1431
|
-
ToastNoAnimation.decorators = [
|
1432
|
-
{ type: i0.Component, args: [{
|
1433
|
-
selector: '[toast-component]',
|
1434
|
-
template: "\n <button *ngIf=\"options.closeButton\" (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n <div *ngIf=\"title\" [class]=\"options.titleClass\" [attr.aria-label]=\"title\">\n {{ title }} <ng-container *ngIf=\"duplicatesCount\">[{{ duplicatesCount + 1 }}]</ng-container>\n </div>\n <div *ngIf=\"message && options.enableHtml\" role=\"alert\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [innerHTML]=\"message\">\n </div>\n <div *ngIf=\"message && !options.enableHtml\" role=\"alert\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [attr.aria-label]=\"message\">\n {{ message }}\n </div>\n <div *ngIf=\"options.progressBar\">\n <div class=\"toast-progress\" [style.width]=\"width + '%'\"></div>\n </div>\n "
|
1435
|
-
},] }
|
1436
|
-
];
|
1437
|
-
ToastNoAnimation.ctorParameters = function () { return [
|
1438
|
-
{ type: ToastrService },
|
1439
|
-
{ type: ToastPackage },
|
1440
|
-
{ type: i0.ApplicationRef }
|
1441
|
-
]; };
|
1442
|
-
ToastNoAnimation.propDecorators = {
|
1443
|
-
toastClasses: [{ type: i0.HostBinding, args: ['class',] }],
|
1444
|
-
displayStyle: [{ type: i0.HostBinding, args: ['style.display',] }],
|
1445
|
-
tapToast: [{ type: i0.HostListener, args: ['click',] }],
|
1446
|
-
stickAround: [{ type: i0.HostListener, args: ['mouseenter',] }],
|
1447
|
-
delayedHideToast: [{ type: i0.HostListener, args: ['mouseleave',] }]
|
1448
|
-
};
|
1449
|
-
var DefaultNoAnimationsGlobalConfig = Object.assign(Object.assign({}, DefaultNoComponentGlobalConfig), { toastComponent: ToastNoAnimation });
|
1450
|
-
var ToastNoAnimationModule = /** @class */ (function () {
|
1451
|
-
function ToastNoAnimationModule() {
|
1452
|
-
}
|
1453
|
-
ToastNoAnimationModule.forRoot = function (config) {
|
1454
|
-
if (config === void 0) { config = {}; }
|
1455
|
-
return {
|
1456
|
-
ngModule: ToastNoAnimationModule,
|
1457
|
-
providers: [
|
1458
|
-
{
|
1459
|
-
provide: TOAST_CONFIG,
|
1460
|
-
useValue: {
|
1461
|
-
default: DefaultNoAnimationsGlobalConfig,
|
1462
|
-
config: config,
|
1463
|
-
},
|
1464
|
-
},
|
1465
|
-
],
|
1466
|
-
};
|
1467
|
-
};
|
1468
|
-
return ToastNoAnimationModule;
|
1469
|
-
}());
|
1470
|
-
ToastNoAnimationModule.decorators = [
|
1471
|
-
{ type: i0.NgModule, args: [{
|
1472
|
-
imports: [i1.CommonModule],
|
1473
|
-
declarations: [ToastNoAnimation],
|
1474
|
-
exports: [ToastNoAnimation],
|
1475
|
-
entryComponents: [ToastNoAnimation],
|
1476
|
-
},] }
|
1477
|
-
];
|
1478
|
-
|
1479
|
-
/**
|
1480
|
-
* Generated bundle index. Do not edit.
|
1481
|
-
*/
|
1482
|
-
|
1483
|
-
exports.BasePortalHost = BasePortalHost;
|
1484
|
-
exports.ComponentPortal = ComponentPortal;
|
1485
|
-
exports.DefaultGlobalConfig = DefaultGlobalConfig;
|
1486
|
-
exports.DefaultNoAnimationsGlobalConfig = DefaultNoAnimationsGlobalConfig;
|
1487
|
-
exports.DefaultNoComponentGlobalConfig = DefaultNoComponentGlobalConfig;
|
1488
|
-
exports.Overlay = Overlay;
|
1489
|
-
exports.OverlayContainer = OverlayContainer;
|
1490
|
-
exports.OverlayRef = OverlayRef;
|
1491
|
-
exports.TOAST_CONFIG = TOAST_CONFIG;
|
1492
|
-
exports.Toast = Toast;
|
1493
|
-
exports.ToastContainerDirective = ToastContainerDirective;
|
1494
|
-
exports.ToastContainerModule = ToastContainerModule;
|
1495
|
-
exports.ToastInjector = ToastInjector;
|
1496
|
-
exports.ToastNoAnimation = ToastNoAnimation;
|
1497
|
-
exports.ToastNoAnimationModule = ToastNoAnimationModule;
|
1498
|
-
exports.ToastPackage = ToastPackage;
|
1499
|
-
exports.ToastRef = ToastRef;
|
1500
|
-
exports.ToastrComponentlessModule = ToastrComponentlessModule;
|
1501
|
-
exports.ToastrModule = ToastrModule;
|
1502
|
-
exports.ToastrService = ToastrService;
|
1503
|
-
|
1504
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
1505
|
-
|
1506
|
-
})));
|
1507
|
-
//# sourceMappingURL=ngx-toastr.umd.js.map
|