@abpjs/theme-shared 1.1.0 → 2.0.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/dist/components/confirmation/Confirmation.d.ts +2 -0
- package/dist/components/toast/Toast.d.ts +11 -1
- package/dist/constants/styles.d.ts +6 -1
- package/dist/contexts/confirmation.context.d.ts +79 -25
- package/dist/contexts/toaster.context.d.ts +88 -19
- package/dist/index.d.ts +14 -1
- package/dist/index.js +236 -83
- package/dist/index.mjs +254 -97
- package/dist/models/confirmation.d.ts +37 -19
- package/dist/models/toaster.d.ts +56 -10
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -36,25 +36,114 @@ var DEFAULT_STYLES = `
|
|
|
36
36
|
top: 18px;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
40
|
-
|
|
39
|
+
.navbar .dropdown-menu {
|
|
40
|
+
min-width: 215px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.
|
|
43
|
+
.ui-table-scrollable-body::-webkit-scrollbar {
|
|
44
|
+
height: 5px !important;
|
|
45
|
+
width: 5px !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ui-table-scrollable-body::-webkit-scrollbar-track {
|
|
49
|
+
background: #ddd;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ui-table-scrollable-body::-webkit-scrollbar-thumb {
|
|
53
|
+
background: #8a8686;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.abp-ellipsis-inline {
|
|
44
57
|
display: inline-block;
|
|
45
58
|
overflow: hidden;
|
|
46
59
|
text-overflow: ellipsis;
|
|
47
60
|
white-space: nowrap;
|
|
48
61
|
}
|
|
49
62
|
|
|
63
|
+
.abp-ellipsis {
|
|
64
|
+
overflow: hidden !important;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ui-widget-overlay {
|
|
70
|
+
z-index: 1000;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.color-white {
|
|
74
|
+
color: #FFF !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.custom-checkbox > label {
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
}
|
|
80
|
+
|
|
50
81
|
/* <animations */
|
|
51
82
|
|
|
52
83
|
.fade-in-top {
|
|
53
|
-
animation: fadeInTop 0.
|
|
84
|
+
animation: fadeInTop 0.2s ease-in-out;
|
|
54
85
|
}
|
|
55
86
|
|
|
56
87
|
.fade-out-top {
|
|
57
|
-
animation: fadeOutTop 0.
|
|
88
|
+
animation: fadeOutTop 0.2s ease-in-out;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.abp-collapsed-height {
|
|
92
|
+
-moz-transition: max-height linear 0.35s;
|
|
93
|
+
-ms-transition: max-height linear 0.35s;
|
|
94
|
+
-o-transition: max-height linear 0.35s;
|
|
95
|
+
-webkit-transition: max-height linear 0.35s;
|
|
96
|
+
overflow:hidden;
|
|
97
|
+
transition:max-height 0.35s linear;
|
|
98
|
+
height:auto;
|
|
99
|
+
max-height: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.abp-mh-25 {
|
|
103
|
+
max-height: 25vh;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.abp-mh-50 {
|
|
107
|
+
transition:max-height 0.65s linear;
|
|
108
|
+
max-height: 50vh;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.abp-mh-75 {
|
|
112
|
+
transition:max-height 0.85s linear;
|
|
113
|
+
max-height: 75vh;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.abp-mh-100 {
|
|
117
|
+
transition:max-height 1s linear;
|
|
118
|
+
max-height: 100vh;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Sorting icon styles - @since 2.0.0 */
|
|
122
|
+
[class^="sorting"] {
|
|
123
|
+
opacity: .3;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
[class^="sorting"]:before {
|
|
127
|
+
right: 0.5rem;
|
|
128
|
+
content: "\u2191";
|
|
129
|
+
}
|
|
130
|
+
[class^="sorting"]:after {
|
|
131
|
+
right: 0.5rem;
|
|
132
|
+
content: "\u2193";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.sorting_desc {
|
|
136
|
+
opacity: 1;
|
|
137
|
+
}
|
|
138
|
+
.sorting_desc:before {
|
|
139
|
+
opacity: .3;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.sorting_asc {
|
|
143
|
+
opacity: 1;
|
|
144
|
+
}
|
|
145
|
+
.sorting_asc:after {
|
|
146
|
+
opacity: .3;
|
|
58
147
|
}
|
|
59
148
|
|
|
60
149
|
@keyframes fadeInTop {
|
|
@@ -64,7 +153,7 @@ var DEFAULT_STYLES = `
|
|
|
64
153
|
}
|
|
65
154
|
|
|
66
155
|
to {
|
|
67
|
-
transform: translateY(
|
|
156
|
+
transform: translateY(0px);
|
|
68
157
|
opacity: 1;
|
|
69
158
|
}
|
|
70
159
|
}
|
|
@@ -104,44 +193,41 @@ import {
|
|
|
104
193
|
useCallback,
|
|
105
194
|
useState,
|
|
106
195
|
useRef,
|
|
107
|
-
useMemo
|
|
196
|
+
useMemo,
|
|
197
|
+
useEffect
|
|
108
198
|
} from "react";
|
|
109
199
|
import { jsx } from "react/jsx-runtime";
|
|
110
200
|
var ToasterContext = createContext(null);
|
|
111
201
|
var toastCounter = 0;
|
|
112
202
|
function generateId() {
|
|
113
203
|
toastCounter += 1;
|
|
114
|
-
return
|
|
204
|
+
return toastCounter;
|
|
115
205
|
}
|
|
116
206
|
var DEFAULT_LIFE = 5e3;
|
|
117
|
-
function resolveLocalizationParam(param) {
|
|
118
|
-
if (param === void 0) return void 0;
|
|
119
|
-
if (typeof param === "string") return param;
|
|
120
|
-
return param.defaultValue || param.key;
|
|
121
|
-
}
|
|
122
207
|
function ToasterProvider({ children }) {
|
|
123
208
|
const [toasts, setToasts] = useState([]);
|
|
124
|
-
const
|
|
209
|
+
const subscribersRef = useRef(/* @__PURE__ */ new Set());
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
subscribersRef.current.forEach((subscriber) => {
|
|
212
|
+
subscriber(toasts);
|
|
213
|
+
});
|
|
214
|
+
}, [toasts]);
|
|
125
215
|
const remove = useCallback((id) => {
|
|
126
216
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
127
|
-
const resolver = resolversRef.current.get(id);
|
|
128
|
-
if (resolver) {
|
|
129
|
-
resolver(Toaster.Status.dismiss);
|
|
130
|
-
resolversRef.current.delete(id);
|
|
131
|
-
}
|
|
132
217
|
}, []);
|
|
133
218
|
const show = useCallback(
|
|
134
|
-
(message, title, severity, options) => {
|
|
135
|
-
const id = options?.id
|
|
219
|
+
(message, title, severity = "info", options) => {
|
|
220
|
+
const id = typeof options?.id === "number" ? options.id : generateId();
|
|
136
221
|
const life = options?.sticky ? void 0 : options?.life ?? DEFAULT_LIFE;
|
|
137
|
-
const resolvedMessage = resolveLocalizationParam(message) || "";
|
|
138
|
-
const resolvedTitle = resolveLocalizationParam(title);
|
|
139
222
|
const toast = {
|
|
140
223
|
id,
|
|
141
|
-
message
|
|
142
|
-
title
|
|
224
|
+
message,
|
|
225
|
+
title,
|
|
143
226
|
severity,
|
|
144
|
-
|
|
227
|
+
options: {
|
|
228
|
+
...options,
|
|
229
|
+
id
|
|
230
|
+
}
|
|
145
231
|
};
|
|
146
232
|
setToasts((prev) => [...prev, toast]);
|
|
147
233
|
if (life) {
|
|
@@ -149,9 +235,7 @@ function ToasterProvider({ children }) {
|
|
|
149
235
|
remove(id);
|
|
150
236
|
}, life);
|
|
151
237
|
}
|
|
152
|
-
return
|
|
153
|
-
resolversRef.current.set(id, resolve);
|
|
154
|
-
});
|
|
238
|
+
return id;
|
|
155
239
|
},
|
|
156
240
|
[remove]
|
|
157
241
|
);
|
|
@@ -164,44 +248,40 @@ function ToasterProvider({ children }) {
|
|
|
164
248
|
[show]
|
|
165
249
|
);
|
|
166
250
|
const warn = useCallback(
|
|
167
|
-
(message, title, options) => show(message, title, "
|
|
251
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
168
252
|
[show]
|
|
169
253
|
);
|
|
170
254
|
const error = useCallback(
|
|
171
255
|
(message, title, options) => show(message, title, "error", options),
|
|
172
256
|
[show]
|
|
173
257
|
);
|
|
174
|
-
const
|
|
175
|
-
(messages) => {
|
|
176
|
-
messages.forEach((msg) => {
|
|
177
|
-
show(msg.message, msg.title, msg.severity, msg);
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
[show]
|
|
181
|
-
);
|
|
182
|
-
const clear = useCallback((status) => {
|
|
258
|
+
const clear = useCallback((key) => {
|
|
183
259
|
setToasts((prev) => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
resolver(status ?? Toaster.Status.dismiss);
|
|
188
|
-
resolversRef.current.delete(toast.id);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
260
|
+
if (key) {
|
|
261
|
+
return prev.filter((toast) => toast.options?.containerKey !== key);
|
|
262
|
+
}
|
|
191
263
|
return [];
|
|
192
264
|
});
|
|
193
265
|
}, []);
|
|
266
|
+
const subscribe = useCallback((subscriber) => {
|
|
267
|
+
subscribersRef.current.add(subscriber);
|
|
268
|
+
subscriber(toasts);
|
|
269
|
+
return () => {
|
|
270
|
+
subscribersRef.current.delete(subscriber);
|
|
271
|
+
};
|
|
272
|
+
}, [toasts]);
|
|
194
273
|
const service = useMemo(
|
|
195
274
|
() => ({
|
|
196
275
|
info,
|
|
197
276
|
success,
|
|
198
277
|
warn,
|
|
199
278
|
error,
|
|
200
|
-
|
|
279
|
+
show,
|
|
280
|
+
remove,
|
|
201
281
|
clear,
|
|
202
|
-
|
|
282
|
+
subscribe
|
|
203
283
|
}),
|
|
204
|
-
[info, success, warn, error,
|
|
284
|
+
[info, success, warn, error, show, remove, clear, subscribe]
|
|
205
285
|
);
|
|
206
286
|
const value = useMemo(
|
|
207
287
|
() => ({ service, toasts }),
|
|
@@ -238,7 +318,8 @@ import {
|
|
|
238
318
|
useCallback as useCallback2,
|
|
239
319
|
useState as useState2,
|
|
240
320
|
useRef as useRef2,
|
|
241
|
-
useMemo as useMemo2
|
|
321
|
+
useMemo as useMemo2,
|
|
322
|
+
useEffect as useEffect2
|
|
242
323
|
} from "react";
|
|
243
324
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
244
325
|
var ConfirmationContext = createContext2(null);
|
|
@@ -248,6 +329,13 @@ function generateId2() {
|
|
|
248
329
|
function ConfirmationProvider({ children }) {
|
|
249
330
|
const [confirmation, setConfirmation] = useState2(null);
|
|
250
331
|
const resolverRef = useRef2(null);
|
|
332
|
+
const subscribersRef = useRef2(/* @__PURE__ */ new Set());
|
|
333
|
+
const escapeListenerRef = useRef2(false);
|
|
334
|
+
useEffect2(() => {
|
|
335
|
+
subscribersRef.current.forEach((subscriber) => {
|
|
336
|
+
subscriber(confirmation);
|
|
337
|
+
});
|
|
338
|
+
}, [confirmation]);
|
|
251
339
|
const respond = useCallback2((status) => {
|
|
252
340
|
if (resolverRef.current) {
|
|
253
341
|
resolverRef.current(status);
|
|
@@ -255,20 +343,34 @@ function ConfirmationProvider({ children }) {
|
|
|
255
343
|
}
|
|
256
344
|
setConfirmation(null);
|
|
257
345
|
}, []);
|
|
346
|
+
useEffect2(() => {
|
|
347
|
+
if (!escapeListenerRef.current) return;
|
|
348
|
+
const handleEscape = (event) => {
|
|
349
|
+
if (event.key === "Escape" && confirmation && confirmation.options?.closable !== false) {
|
|
350
|
+
respond(Toaster.Status.dismiss);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
document.addEventListener("keydown", handleEscape);
|
|
354
|
+
return () => {
|
|
355
|
+
document.removeEventListener("keydown", handleEscape);
|
|
356
|
+
};
|
|
357
|
+
}, [confirmation, respond]);
|
|
258
358
|
const show = useCallback2(
|
|
259
|
-
(message, title, severity, options = {}) => {
|
|
359
|
+
(message, title, severity = "neutral", options = {}) => {
|
|
260
360
|
if (resolverRef.current) {
|
|
261
361
|
resolverRef.current(Toaster.Status.dismiss);
|
|
262
362
|
}
|
|
263
363
|
const id = options.id?.toString() || generateId2();
|
|
264
|
-
const
|
|
265
|
-
id,
|
|
364
|
+
const dialogData = {
|
|
266
365
|
message,
|
|
267
366
|
title,
|
|
268
367
|
severity,
|
|
269
|
-
options
|
|
368
|
+
options: {
|
|
369
|
+
...options,
|
|
370
|
+
id
|
|
371
|
+
}
|
|
270
372
|
};
|
|
271
|
-
setConfirmation(
|
|
373
|
+
setConfirmation(dialogData);
|
|
272
374
|
return new Promise((resolve) => {
|
|
273
375
|
resolverRef.current = resolve;
|
|
274
376
|
});
|
|
@@ -284,7 +386,7 @@ function ConfirmationProvider({ children }) {
|
|
|
284
386
|
[show]
|
|
285
387
|
);
|
|
286
388
|
const warn = useCallback2(
|
|
287
|
-
(message, title, options) => show(message, title, "
|
|
389
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
288
390
|
[show]
|
|
289
391
|
);
|
|
290
392
|
const error = useCallback2(
|
|
@@ -297,15 +399,28 @@ function ConfirmationProvider({ children }) {
|
|
|
297
399
|
},
|
|
298
400
|
[respond]
|
|
299
401
|
);
|
|
402
|
+
const listenToEscape = useCallback2(() => {
|
|
403
|
+
escapeListenerRef.current = true;
|
|
404
|
+
}, []);
|
|
405
|
+
const subscribe = useCallback2((subscriber) => {
|
|
406
|
+
subscribersRef.current.add(subscriber);
|
|
407
|
+
subscriber(confirmation);
|
|
408
|
+
return () => {
|
|
409
|
+
subscribersRef.current.delete(subscriber);
|
|
410
|
+
};
|
|
411
|
+
}, [confirmation]);
|
|
300
412
|
const service = useMemo2(
|
|
301
413
|
() => ({
|
|
302
414
|
info,
|
|
303
415
|
success,
|
|
304
416
|
warn,
|
|
305
417
|
error,
|
|
306
|
-
|
|
418
|
+
show,
|
|
419
|
+
clear,
|
|
420
|
+
listenToEscape,
|
|
421
|
+
subscribe
|
|
307
422
|
}),
|
|
308
|
-
[info, success, warn, error, clear]
|
|
423
|
+
[info, success, warn, error, show, clear, listenToEscape, subscribe]
|
|
309
424
|
);
|
|
310
425
|
const value = useMemo2(
|
|
311
426
|
() => ({ service, confirmation, respond }),
|
|
@@ -418,7 +533,7 @@ function isHttpErrorResponse(error) {
|
|
|
418
533
|
}
|
|
419
534
|
|
|
420
535
|
// src/components/toast/Toast.tsx
|
|
421
|
-
import { useEffect, useRef as useRef3, useMemo as useMemo3 } from "react";
|
|
536
|
+
import { useEffect as useEffect3, useRef as useRef3, useMemo as useMemo3 } from "react";
|
|
422
537
|
import {
|
|
423
538
|
Toaster as ChakraToaster,
|
|
424
539
|
Portal,
|
|
@@ -434,9 +549,15 @@ import {
|
|
|
434
549
|
CheckCircle,
|
|
435
550
|
Info,
|
|
436
551
|
AlertTriangle,
|
|
437
|
-
XCircle
|
|
552
|
+
XCircle,
|
|
553
|
+
Circle
|
|
438
554
|
} from "lucide-react";
|
|
439
555
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
556
|
+
function resolveLocalizationParam(param) {
|
|
557
|
+
if (param === void 0) return void 0;
|
|
558
|
+
if (typeof param === "string") return param;
|
|
559
|
+
return param.defaultValue || param.key;
|
|
560
|
+
}
|
|
440
561
|
function SeverityIcon({ severity }) {
|
|
441
562
|
const iconProps = { size: 20 };
|
|
442
563
|
switch (severity) {
|
|
@@ -444,10 +565,13 @@ function SeverityIcon({ severity }) {
|
|
|
444
565
|
return /* @__PURE__ */ jsx3(CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
445
566
|
case "info":
|
|
446
567
|
return /* @__PURE__ */ jsx3(Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
447
|
-
case "
|
|
568
|
+
case "warning":
|
|
448
569
|
return /* @__PURE__ */ jsx3(AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
449
570
|
case "error":
|
|
450
571
|
return /* @__PURE__ */ jsx3(XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
572
|
+
case "neutral":
|
|
573
|
+
default:
|
|
574
|
+
return /* @__PURE__ */ jsx3(Circle, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
451
575
|
}
|
|
452
576
|
}
|
|
453
577
|
function getSeverityColorPalette(severity) {
|
|
@@ -456,10 +580,13 @@ function getSeverityColorPalette(severity) {
|
|
|
456
580
|
return "green";
|
|
457
581
|
case "info":
|
|
458
582
|
return "blue";
|
|
459
|
-
case "
|
|
583
|
+
case "warning":
|
|
460
584
|
return "yellow";
|
|
461
585
|
case "error":
|
|
462
586
|
return "red";
|
|
587
|
+
case "neutral":
|
|
588
|
+
default:
|
|
589
|
+
return "gray";
|
|
463
590
|
}
|
|
464
591
|
}
|
|
465
592
|
function getSeverityBg(severity) {
|
|
@@ -468,10 +595,13 @@ function getSeverityBg(severity) {
|
|
|
468
595
|
return "green.50";
|
|
469
596
|
case "info":
|
|
470
597
|
return "blue.50";
|
|
471
|
-
case "
|
|
598
|
+
case "warning":
|
|
472
599
|
return "yellow.50";
|
|
473
600
|
case "error":
|
|
474
601
|
return "red.50";
|
|
602
|
+
case "neutral":
|
|
603
|
+
default:
|
|
604
|
+
return "gray.50";
|
|
475
605
|
}
|
|
476
606
|
}
|
|
477
607
|
function getSeverityBorderColor(severity) {
|
|
@@ -480,10 +610,13 @@ function getSeverityBorderColor(severity) {
|
|
|
480
610
|
return "green.200";
|
|
481
611
|
case "info":
|
|
482
612
|
return "blue.200";
|
|
483
|
-
case "
|
|
613
|
+
case "warning":
|
|
484
614
|
return "yellow.200";
|
|
485
615
|
case "error":
|
|
486
616
|
return "red.200";
|
|
617
|
+
case "neutral":
|
|
618
|
+
default:
|
|
619
|
+
return "gray.200";
|
|
487
620
|
}
|
|
488
621
|
}
|
|
489
622
|
function mapSeverityToType(severity) {
|
|
@@ -492,10 +625,13 @@ function mapSeverityToType(severity) {
|
|
|
492
625
|
return "success";
|
|
493
626
|
case "info":
|
|
494
627
|
return "info";
|
|
495
|
-
case "
|
|
628
|
+
case "warning":
|
|
496
629
|
return "warning";
|
|
497
630
|
case "error":
|
|
498
631
|
return "error";
|
|
632
|
+
case "neutral":
|
|
633
|
+
default:
|
|
634
|
+
return "info";
|
|
499
635
|
}
|
|
500
636
|
}
|
|
501
637
|
function getPlacement(position) {
|
|
@@ -527,31 +663,38 @@ function getToaster(placement) {
|
|
|
527
663
|
}
|
|
528
664
|
return toasterCache.get(placement);
|
|
529
665
|
}
|
|
530
|
-
function ToastContainer({ position = "bottom-right" }) {
|
|
666
|
+
function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
531
667
|
const { toasts, service } = useToasterContext();
|
|
532
668
|
const { t } = useLocalization();
|
|
533
669
|
const displayedToastsRef = useRef3(/* @__PURE__ */ new Set());
|
|
534
670
|
const placement = useMemo3(() => getPlacement(position), [position]);
|
|
535
671
|
const toaster = useMemo3(() => getToaster(placement), [placement]);
|
|
536
|
-
|
|
537
|
-
|
|
672
|
+
const filteredToasts = useMemo3(() => {
|
|
673
|
+
if (!containerKey) return toasts;
|
|
674
|
+
return toasts.filter((toast) => toast.options?.containerKey === containerKey);
|
|
675
|
+
}, [toasts, containerKey]);
|
|
676
|
+
useEffect3(() => {
|
|
677
|
+
const newToasts = filteredToasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
|
|
538
678
|
newToasts.forEach((toast) => {
|
|
539
679
|
displayedToastsRef.current.add(toast.id);
|
|
680
|
+
const messageStr = resolveLocalizationParam(toast.message) || "";
|
|
540
681
|
const localizedMessage = t(
|
|
541
|
-
|
|
542
|
-
...toast.messageLocalizationParams || []
|
|
682
|
+
messageStr,
|
|
683
|
+
...toast.options?.messageLocalizationParams || []
|
|
543
684
|
);
|
|
544
|
-
const
|
|
685
|
+
const titleStr = resolveLocalizationParam(toast.title);
|
|
686
|
+
const localizedTitle = titleStr ? t(titleStr, ...toast.options?.titleLocalizationParams || []) : void 0;
|
|
687
|
+
const severity = toast.severity || "info";
|
|
545
688
|
requestAnimationFrame(() => {
|
|
546
689
|
toaster.create({
|
|
547
|
-
id: toast.id,
|
|
690
|
+
id: String(toast.id),
|
|
548
691
|
title: localizedTitle,
|
|
549
692
|
description: localizedMessage,
|
|
550
|
-
type: mapSeverityToType(
|
|
551
|
-
duration: toast.sticky ? void 0 : toast.life || 5e3,
|
|
693
|
+
type: mapSeverityToType(severity),
|
|
694
|
+
duration: toast.options?.sticky ? void 0 : toast.options?.life || 5e3,
|
|
552
695
|
meta: {
|
|
553
|
-
closable: toast.closable !== false,
|
|
554
|
-
severity
|
|
696
|
+
closable: toast.options?.closable !== false,
|
|
697
|
+
severity
|
|
555
698
|
},
|
|
556
699
|
onStatusChange: (details) => {
|
|
557
700
|
if (details.status === "unmounted") {
|
|
@@ -562,7 +705,7 @@ function ToastContainer({ position = "bottom-right" }) {
|
|
|
562
705
|
});
|
|
563
706
|
});
|
|
564
707
|
});
|
|
565
|
-
}, [
|
|
708
|
+
}, [filteredToasts, t, service, toaster]);
|
|
566
709
|
return /* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3(ChakraToaster, { toaster, insetInline: { mdDown: "4" }, children: (toast) => {
|
|
567
710
|
const severity = toast.meta?.severity || "info";
|
|
568
711
|
const closable = toast.meta?.closable !== false;
|
|
@@ -602,9 +745,15 @@ import {
|
|
|
602
745
|
CheckCircle as CheckCircle2,
|
|
603
746
|
Info as Info2,
|
|
604
747
|
AlertTriangle as AlertTriangle2,
|
|
605
|
-
XCircle as XCircle2
|
|
748
|
+
XCircle as XCircle2,
|
|
749
|
+
Circle as Circle2
|
|
606
750
|
} from "lucide-react";
|
|
607
751
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
752
|
+
function resolveLocalizationParam2(param) {
|
|
753
|
+
if (param === void 0) return void 0;
|
|
754
|
+
if (typeof param === "string") return param;
|
|
755
|
+
return param.defaultValue || param.key;
|
|
756
|
+
}
|
|
608
757
|
function getLocalizationKey(param) {
|
|
609
758
|
if (param === void 0) return void 0;
|
|
610
759
|
if (typeof param === "string") return param;
|
|
@@ -617,10 +766,13 @@ function SeverityIcon2({ severity }) {
|
|
|
617
766
|
return /* @__PURE__ */ jsx4(CheckCircle2, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
618
767
|
case "info":
|
|
619
768
|
return /* @__PURE__ */ jsx4(Info2, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
620
|
-
case "
|
|
769
|
+
case "warning":
|
|
621
770
|
return /* @__PURE__ */ jsx4(AlertTriangle2, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
622
771
|
case "error":
|
|
623
772
|
return /* @__PURE__ */ jsx4(XCircle2, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
773
|
+
case "neutral":
|
|
774
|
+
default:
|
|
775
|
+
return /* @__PURE__ */ jsx4(Circle2, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
624
776
|
}
|
|
625
777
|
}
|
|
626
778
|
function getSeverityColorPalette2(severity) {
|
|
@@ -629,10 +781,13 @@ function getSeverityColorPalette2(severity) {
|
|
|
629
781
|
return "green";
|
|
630
782
|
case "info":
|
|
631
783
|
return "blue";
|
|
632
|
-
case "
|
|
784
|
+
case "warning":
|
|
633
785
|
return "yellow";
|
|
634
786
|
case "error":
|
|
635
787
|
return "red";
|
|
788
|
+
case "neutral":
|
|
789
|
+
default:
|
|
790
|
+
return "gray";
|
|
636
791
|
}
|
|
637
792
|
}
|
|
638
793
|
function ConfirmationDialog({ className }) {
|
|
@@ -642,14 +797,16 @@ function ConfirmationDialog({ className }) {
|
|
|
642
797
|
if (!confirmation) {
|
|
643
798
|
return null;
|
|
644
799
|
}
|
|
645
|
-
const { message, title, severity, options } = confirmation;
|
|
800
|
+
const { message, title, severity = "neutral", options } = confirmation;
|
|
801
|
+
const messageStr = resolveLocalizationParam2(message) || "";
|
|
646
802
|
const localizedMessage = t(
|
|
647
|
-
|
|
648
|
-
...options
|
|
803
|
+
messageStr,
|
|
804
|
+
...options?.messageLocalizationParams || []
|
|
649
805
|
);
|
|
650
|
-
const
|
|
651
|
-
const
|
|
652
|
-
const
|
|
806
|
+
const titleStr = resolveLocalizationParam2(title);
|
|
807
|
+
const localizedTitle = titleStr ? t(titleStr, ...options?.titleLocalizationParams || []) : void 0;
|
|
808
|
+
const yesKey = getLocalizationKey(options?.yesText);
|
|
809
|
+
const cancelKey = getLocalizationKey(options?.cancelText);
|
|
653
810
|
const yesCopy = yesKey ? t(yesKey) : t("AbpUi::Yes");
|
|
654
811
|
const cancelCopy = cancelKey ? t(cancelKey) : t("AbpUi::Cancel");
|
|
655
812
|
const handleConfirm = () => {
|
|
@@ -662,7 +819,7 @@ function ConfirmationDialog({ className }) {
|
|
|
662
819
|
respond(Toaster.Status.dismiss);
|
|
663
820
|
};
|
|
664
821
|
const handleOpenChange = (details) => {
|
|
665
|
-
if (!details.open) {
|
|
822
|
+
if (!details.open && options?.closable !== false) {
|
|
666
823
|
handleDismiss();
|
|
667
824
|
}
|
|
668
825
|
};
|
|
@@ -683,7 +840,7 @@ function ConfirmationDialog({ className }) {
|
|
|
683
840
|
] }) }),
|
|
684
841
|
/* @__PURE__ */ jsx4(Dialog.Body, { children: /* @__PURE__ */ jsx4(Text, { color: "gray.600", children: localizedMessage }) }),
|
|
685
842
|
/* @__PURE__ */ jsx4(Dialog.Footer, { children: /* @__PURE__ */ jsxs2(Flex2, { gap: 3, children: [
|
|
686
|
-
!options
|
|
843
|
+
!options?.hideCancelBtn && /* @__PURE__ */ jsx4(
|
|
687
844
|
Button,
|
|
688
845
|
{
|
|
689
846
|
ref: cancelRef,
|
|
@@ -692,7 +849,7 @@ function ConfirmationDialog({ className }) {
|
|
|
692
849
|
children: cancelCopy
|
|
693
850
|
}
|
|
694
851
|
),
|
|
695
|
-
!options
|
|
852
|
+
!options?.hideYesBtn && /* @__PURE__ */ jsx4(
|
|
696
853
|
Button,
|
|
697
854
|
{
|
|
698
855
|
colorPalette: getSeverityColorPalette2(severity),
|
|
@@ -741,7 +898,7 @@ function ErrorComponent({
|
|
|
741
898
|
}
|
|
742
899
|
|
|
743
900
|
// src/components/loader-bar/LoaderBar.tsx
|
|
744
|
-
import { useEffect as
|
|
901
|
+
import { useEffect as useEffect4, useRef as useRef5, useState as useState4 } from "react";
|
|
745
902
|
import { useLoader } from "@abpjs/core";
|
|
746
903
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
747
904
|
function LoaderBar({
|
|
@@ -755,14 +912,14 @@ function LoaderBar({
|
|
|
755
912
|
const [isLoading, setIsLoading] = useState4(false);
|
|
756
913
|
const [progressLevel, setProgressLevel] = useState4(0);
|
|
757
914
|
const intervalRef = useRef5(null);
|
|
758
|
-
|
|
915
|
+
useEffect4(() => {
|
|
759
916
|
if (loading) {
|
|
760
917
|
startLoading();
|
|
761
918
|
} else {
|
|
762
919
|
stopLoading();
|
|
763
920
|
}
|
|
764
921
|
}, [loading]);
|
|
765
|
-
|
|
922
|
+
useEffect4(() => {
|
|
766
923
|
return () => {
|
|
767
924
|
if (intervalRef.current) {
|
|
768
925
|
clearInterval(intervalRef.current);
|
|
@@ -1102,7 +1259,7 @@ function FormField({
|
|
|
1102
1259
|
}
|
|
1103
1260
|
|
|
1104
1261
|
// src/components/change-password/ChangePassword.tsx
|
|
1105
|
-
import { useEffect as
|
|
1262
|
+
import { useEffect as useEffect5 } from "react";
|
|
1106
1263
|
import {
|
|
1107
1264
|
Button as Button5,
|
|
1108
1265
|
VStack as VStack2,
|
|
@@ -1134,7 +1291,7 @@ function ChangePassword({
|
|
|
1134
1291
|
}
|
|
1135
1292
|
});
|
|
1136
1293
|
const newPassword = watch("newPassword");
|
|
1137
|
-
|
|
1294
|
+
useEffect5(() => {
|
|
1138
1295
|
if (visible) {
|
|
1139
1296
|
reset();
|
|
1140
1297
|
}
|
|
@@ -1254,7 +1411,7 @@ function ChangePassword({
|
|
|
1254
1411
|
}
|
|
1255
1412
|
|
|
1256
1413
|
// src/components/profile/Profile.tsx
|
|
1257
|
-
import { useEffect as
|
|
1414
|
+
import { useEffect as useEffect6 } from "react";
|
|
1258
1415
|
import {
|
|
1259
1416
|
Button as Button6,
|
|
1260
1417
|
VStack as VStack3,
|
|
@@ -1288,13 +1445,13 @@ function Profile({
|
|
|
1288
1445
|
}
|
|
1289
1446
|
});
|
|
1290
1447
|
const modalBusy = isSubmitting || loading;
|
|
1291
|
-
|
|
1448
|
+
useEffect6(() => {
|
|
1292
1449
|
if (visible) {
|
|
1293
1450
|
fetchProfile().then(() => {
|
|
1294
1451
|
});
|
|
1295
1452
|
}
|
|
1296
1453
|
}, [visible, fetchProfile]);
|
|
1297
|
-
|
|
1454
|
+
useEffect6(() => {
|
|
1298
1455
|
if (profile) {
|
|
1299
1456
|
reset({
|
|
1300
1457
|
userName: profile.userName || "",
|