jsl-ui 9.22.0 → 9.24.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.
|
@@ -6,9 +6,11 @@ export interface INotificationOptions {
|
|
|
6
6
|
timeOut?: number;
|
|
7
7
|
class?: string;
|
|
8
8
|
style?: string;
|
|
9
|
+
onClick?: () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare class Notification {
|
|
11
|
-
static show(options: INotificationOptions):
|
|
12
|
+
static show(options: INotificationOptions): string;
|
|
13
|
+
static clearNotification(id: string): void;
|
|
12
14
|
static clearAll(): void;
|
|
13
15
|
private static container;
|
|
14
16
|
private static containerVNode;
|
|
@@ -5,14 +5,14 @@ var Notification = /** @class */ (function () {
|
|
|
5
5
|
function Notification() {
|
|
6
6
|
}
|
|
7
7
|
Notification.show = function (options) {
|
|
8
|
-
var _a;
|
|
9
8
|
if (Notification.container == null) {
|
|
10
9
|
Notification.createContainer();
|
|
11
10
|
}
|
|
11
|
+
var id = helper.newDomGuid();
|
|
12
12
|
// add
|
|
13
13
|
var notification = {
|
|
14
14
|
tag: "div",
|
|
15
|
-
attr: { id:
|
|
15
|
+
attr: { id: id, style: options.style, class: "jsl-notification " + (options.class || "") },
|
|
16
16
|
animation: { attr: "opacity", from: 0, to: 1, duration: 600 },
|
|
17
17
|
children: [
|
|
18
18
|
typeof options.content === "string" ? { tag: "div", content: options.content } : options.content
|
|
@@ -30,14 +30,23 @@ var Notification = /** @class */ (function () {
|
|
|
30
30
|
Notification.renderer.refresh();
|
|
31
31
|
}, options.timeOut);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
notification.attr.click = function () {
|
|
34
|
+
var _a;
|
|
35
|
+
if (options.onClick != null) {
|
|
36
|
+
options.onClick();
|
|
37
|
+
}
|
|
38
|
+
if (((_a = options.closeOnClick) !== null && _a !== void 0 ? _a : true) === true) {
|
|
35
39
|
var idx = Notification.containerVNode.children.indexOf(notification);
|
|
36
40
|
if (idx >= 0) {
|
|
37
41
|
Notification.containerVNode.children.splice(idx, 1);
|
|
38
42
|
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return id;
|
|
46
|
+
};
|
|
47
|
+
Notification.clearNotification = function (id) {
|
|
48
|
+
Notification.containerVNode.children = Notification.containerVNode.children.filter(function (x) { var _a; return ((_a = x.attr) === null || _a === void 0 ? void 0 : _a.id) !== id; });
|
|
49
|
+
Notification.renderer.refresh();
|
|
41
50
|
};
|
|
42
51
|
Notification.clearAll = function () {
|
|
43
52
|
Notification.containerVNode.children = [];
|