Skip to content

Commit 444fdb6

Browse files
committed
fixed #5716: Support IE11 in Angular template
1 parent 02600d1 commit 444fdb6

File tree

8 files changed

+129
-187
lines changed

8 files changed

+129
-187
lines changed

angular/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"@angular/router": "^9.1.4",
2424
"@aspnet/signalr": "^1.1.4",
2525
"@fortawesome/fontawesome-free": "^5.13.0",
26-
"abp-ng2-module": "^6.0.0",
27-
"abp-web-resources": "^5.1.1",
26+
"abp-ng2-module": "^6.2.0",
27+
"abp-web-resources": "^5.3.0",
2828
"admin-lte-css-only": "^3.0.4",
2929
"core-js": "^3.2.1",
3030
"famfamfam-flags": "^1.0.0",
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
"use strict";
2+
13
var abp = abp || {};
2-
(() => {
4+
5+
(function () {
36
if (!FreezeUI || !UnFreezeUI) {
47
return;
58
}
69

7-
abp.ui.setBusy = (elm, text, delay) => {
10+
abp.ui.setBusy = function (elm, text, delay) {
811
FreezeUI({
912
element: elm,
1013
text: text ? text : " ",
11-
delay: delay,
14+
delay: delay
1215
});
1316
};
1417

15-
abp.ui.clearBusy = (elm, delay) => {
16-
UnFreezeUI({ element: elm, delay: delay });
18+
abp.ui.clearBusy = function (elm, delay) {
19+
UnFreezeUI({
20+
element: elm,
21+
delay: delay
22+
});
1723
};
18-
})();
24+
})();
Lines changed: 49 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
var abp = abp || {};
2-
(() => {
2+
3+
(function () {
34
if (!Swal) {
45
return;
56
}
6-
77
/* MESSAGE **************************************************/
88

9-
let showMessage = (type, message, title, isHtml, options) => {
9+
10+
var showMessage = function showMessage(type, message, title, isHtml, options) {
1011
if (!title) {
1112
title = message;
1213
message = undefined;
@@ -15,8 +16,7 @@ var abp = abp || {};
1516
options = options || {};
1617
options.title = title;
1718
options.icon = type;
18-
options.confirmButtonText =
19-
options.confirmButtonText || abp.localization.abpWeb("Ok");
19+
options.confirmButtonText = options.confirmButtonText || abp.localization.abpWeb("Ok");
2020

2121
if (isHtml) {
2222
options.html = message;
@@ -27,30 +27,24 @@ var abp = abp || {};
2727
return Swal.fire(options);
2828
};
2929

30-
abp.message.info = (message, title, isHtml, options) => {
30+
abp.message.info = function (message, title, isHtml, options) {
3131
return showMessage("info", message, title, isHtml, options);
3232
};
3333

34-
abp.message.success = (message, title, isHtml, options) => {
34+
abp.message.success = function (message, title, isHtml, options) {
3535
return showMessage("success", message, title, isHtml, options);
3636
};
3737

38-
abp.message.warn = (message, title, isHtml, options) => {
38+
abp.message.warn = function (message, title, isHtml, options) {
3939
return showMessage("warning", message, title, isHtml, options);
4040
};
4141

42-
abp.message.error = (message, title, isHtml, options) => {
42+
abp.message.error = function (message, title, isHtml, options) {
4343
return showMessage("error", message, title, isHtml, options);
4444
};
4545

46-
abp.message.confirm = (
47-
message,
48-
titleOrCallback,
49-
callback,
50-
isHtml,
51-
options
52-
) => {
53-
let title = undefined;
46+
abp.message.confirm = function (message, titleOrCallback, callback, isHtml, options) {
47+
var title = undefined;
5448

5549
if (typeof titleOrCallback === "function") {
5650
callback = titleOrCallback;
@@ -61,11 +55,8 @@ var abp = abp || {};
6155
options = options || {};
6256
options.title = title ? title : abp.localization.abpWeb("AreYouSure");
6357
options.icon = "warning";
64-
65-
options.confirmButtonText =
66-
options.confirmButtonText || abp.localization.abpWeb("Yes");
67-
options.cancelButtonText =
68-
options.cancelButtonText || abp.localization.abpWeb("Cancel");
58+
options.confirmButtonText = options.confirmButtonText || abp.localization.abpWeb("Yes");
59+
options.cancelButtonText = options.cancelButtonText || abp.localization.abpWeb("Cancel");
6960
options.showCancelButton = true;
7061

7162
if (isHtml) {
@@ -78,96 +69,60 @@ var abp = abp || {};
7869
callback && callback(result.value);
7970
});
8071
};
81-
8272
/* NOTIFICATION *********************************************/
8373

84-
const Toast = Swal.mixin({
74+
75+
var Toast = Swal.mixin({
8576
toast: true,
8677
position: "bottom-end",
8778
showConfirmButton: false,
88-
timer: 3000,
79+
timer: 3000
8980
});
9081

91-
let showNotification = (type, message, title, options) => {
92-
const icon = options.customClass.icon
93-
? `<i class="mr-2 text-light ${options.customClass.icon}"></i>`
94-
: "";
82+
var showNotification = function showNotification(type, message, title, options) {
83+
var icon = options.customClass.icon ? "<i class=\"mr-2 text-light ".concat(options.customClass.icon, "\"></i>") : "";
9584

9685
if (title) {
97-
options.title = `${icon}<span class="text-light">${title}</span>`;
86+
options.title = "".concat(icon, "<span class=\"text-light\">").concat(title, "</span>");
9887
}
9988

100-
options.html = `${title ? "" : icon}
101-
<span class="text-light">${message}</span>`;
102-
89+
options.html = "".concat(title ? "" : icon, "\n <span class=\"text-light\">").concat(message, "</span>");
10390
Toast.fire(options);
10491
};
10592

106-
abp.notify.success = (message, title, options) => {
107-
showNotification(
108-
"success",
109-
message,
110-
title,
111-
Object.assign(
112-
{
113-
background: "#34bfa3",
114-
customClass: {
115-
icon: "fas fa-check-circle",
116-
},
117-
},
118-
options
119-
)
120-
);
93+
abp.notify.success = function (message, title, options) {
94+
showNotification("success", message, title, Object.assign({
95+
background: "#34bfa3",
96+
customClass: {
97+
icon: "fas fa-check-circle"
98+
}
99+
}, options));
121100
};
122101

123-
abp.notify.info = (message, title, options) => {
124-
showNotification(
125-
"info",
126-
message,
127-
title,
128-
Object.assign(
129-
{
130-
background: "#36a3f7",
131-
customClass: {
132-
icon: "fas fa-info-circle",
133-
},
134-
},
135-
options
136-
)
137-
);
102+
abp.notify.info = function (message, title, options) {
103+
showNotification("info", message, title, Object.assign({
104+
background: "#36a3f7",
105+
customClass: {
106+
icon: "fas fa-info-circle"
107+
}
108+
}, options));
138109
};
139110

140-
abp.notify.warn = (message, title, options) => {
141-
showNotification(
142-
"warning",
143-
message,
144-
title,
145-
Object.assign(
146-
{
147-
background: "#ffb822",
148-
customClass: {
149-
icon: "fas fa-exclamation-triangle",
150-
},
151-
},
152-
options
153-
)
154-
);
111+
abp.notify.warn = function (message, title, options) {
112+
showNotification("warning", message, title, Object.assign({
113+
background: "#ffb822",
114+
customClass: {
115+
icon: "fas fa-exclamation-triangle"
116+
}
117+
}, options));
155118
};
156119

157-
abp.notify.error = (message, title, options) => {
158-
showNotification(
159-
"error",
160-
message,
161-
title,
162-
Object.assign(
163-
{
164-
background: "#f4516c",
165-
customClass: {
166-
icon: "fas fa-exclamation-circle",
167-
},
168-
},
169-
options
170-
)
171-
);
120+
abp.notify.error = function (message, title, options) {
121+
showNotification("error", message, title, Object.assign({
122+
background: "#f4516c",
123+
customClass: {
124+
icon: "fas fa-exclamation-circle"
125+
}
126+
}, options));
172127
};
173-
})();
128+
})();
Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,50 @@
1-
// taken from https://raw.githubusercontent.com/alexradulescu/FreezeUI and modified
2-
(() => {
3-
let freezeHtml = document.createElement("div");
4-
freezeHtml.classList.add("freeze-ui");
1+
"use strict";
52

6-
let freezedItems = [];
3+
// taken from https://raw.githubusercontent.com/alexradulescu/FreezeUI, modified and converted to ES5
4+
(function () {
5+
var freezeHtml = document.createElement("div");
6+
freezeHtml.classList.add("freeze-ui");
7+
var freezedItems = [];
78

8-
let getSelector = (selector) => (selector ? selector : "body");
9+
var getSelector = function getSelector(selector) {
10+
return selector ? selector : "body";
11+
};
912

10-
let normalizeFreezeDelay = (delay) => (delay ? delay : 250);
13+
var normalizeFreezeDelay = function normalizeFreezeDelay(delay) {
14+
return delay ? delay : 250;
15+
};
1116

12-
let shouldFreezeItem = (selector) => {
13-
let itemSelector = getSelector(selector);
17+
var shouldFreezeItem = function shouldFreezeItem(selector) {
18+
var itemSelector = getSelector(selector);
1419
return freezedItems.indexOf(itemSelector) >= 0;
1520
};
1621

17-
let addFreezedItem = (selector) => {
18-
let itemSelector = getSelector(selector);
22+
var addFreezedItem = function addFreezedItem(selector) {
23+
var itemSelector = getSelector(selector);
1924
freezedItems.push(itemSelector);
2025
};
2126

22-
let removeFreezedItem = (selector) => {
23-
let itemSelector = getSelector(selector);
24-
for (let i = 0; i < freezedItems.length; i++) {
27+
var removeFreezedItem = function removeFreezedItem(selector) {
28+
var itemSelector = getSelector(selector);
29+
30+
for (var i = 0; i < freezedItems.length; i++) {
2531
if (freezedItems[i] === itemSelector) {
2632
freezedItems.splice(i, 1);
2733
}
2834
}
2935
};
3036

31-
window.FreezeUI = (options = {}) => {
37+
window.FreezeUI = function () {
38+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3239
addFreezedItem(options.selector);
33-
const delay = normalizeFreezeDelay(options.delay);
34-
35-
setTimeout(() => {
40+
var delay = normalizeFreezeDelay(options.delay);
41+
setTimeout(function () {
3642
if (!shouldFreezeItem(options.selector)) {
3743
return;
3844
}
3945

40-
let parent;
46+
var parent;
47+
4148
if (options.element) {
4249
parent = options.element;
4350
} else {
@@ -54,12 +61,13 @@
5461
}, delay);
5562
};
5663

57-
window.UnFreezeUI = (options = {}) => {
64+
window.UnFreezeUI = function () {
65+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5866
removeFreezedItem(options.selector);
59-
const delay = normalizeFreezeDelay(options.delay) + 250;
67+
var delay = normalizeFreezeDelay(options.delay) + 250;
68+
setTimeout(function () {
69+
var freezeHtml;
6070

61-
setTimeout(() => {
62-
let freezeHtml;
6371
if (options.element) {
6472
freezeHtml = options.element.querySelector(".freeze-ui");
6573
} else {
@@ -68,10 +76,11 @@
6876

6977
if (freezeHtml) {
7078
freezeHtml.classList.remove("is-unfreezing");
79+
7180
if (freezeHtml.parentElement) {
7281
freezeHtml.parentElement.removeChild(freezeHtml);
7382
}
7483
}
7584
}, delay);
7685
};
77-
})();
86+
})();

0 commit comments

Comments
 (0)