@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.js
CHANGED
|
@@ -111,25 +111,114 @@ var DEFAULT_STYLES = `
|
|
|
111
111
|
top: 18px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
115
|
-
|
|
114
|
+
.navbar .dropdown-menu {
|
|
115
|
+
min-width: 215px;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.
|
|
118
|
+
.ui-table-scrollable-body::-webkit-scrollbar {
|
|
119
|
+
height: 5px !important;
|
|
120
|
+
width: 5px !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ui-table-scrollable-body::-webkit-scrollbar-track {
|
|
124
|
+
background: #ddd;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ui-table-scrollable-body::-webkit-scrollbar-thumb {
|
|
128
|
+
background: #8a8686;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.abp-ellipsis-inline {
|
|
119
132
|
display: inline-block;
|
|
120
133
|
overflow: hidden;
|
|
121
134
|
text-overflow: ellipsis;
|
|
122
135
|
white-space: nowrap;
|
|
123
136
|
}
|
|
124
137
|
|
|
138
|
+
.abp-ellipsis {
|
|
139
|
+
overflow: hidden !important;
|
|
140
|
+
text-overflow: ellipsis;
|
|
141
|
+
white-space: nowrap;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ui-widget-overlay {
|
|
145
|
+
z-index: 1000;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.color-white {
|
|
149
|
+
color: #FFF !important;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.custom-checkbox > label {
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
}
|
|
155
|
+
|
|
125
156
|
/* <animations */
|
|
126
157
|
|
|
127
158
|
.fade-in-top {
|
|
128
|
-
animation: fadeInTop 0.
|
|
159
|
+
animation: fadeInTop 0.2s ease-in-out;
|
|
129
160
|
}
|
|
130
161
|
|
|
131
162
|
.fade-out-top {
|
|
132
|
-
animation: fadeOutTop 0.
|
|
163
|
+
animation: fadeOutTop 0.2s ease-in-out;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.abp-collapsed-height {
|
|
167
|
+
-moz-transition: max-height linear 0.35s;
|
|
168
|
+
-ms-transition: max-height linear 0.35s;
|
|
169
|
+
-o-transition: max-height linear 0.35s;
|
|
170
|
+
-webkit-transition: max-height linear 0.35s;
|
|
171
|
+
overflow:hidden;
|
|
172
|
+
transition:max-height 0.35s linear;
|
|
173
|
+
height:auto;
|
|
174
|
+
max-height: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.abp-mh-25 {
|
|
178
|
+
max-height: 25vh;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.abp-mh-50 {
|
|
182
|
+
transition:max-height 0.65s linear;
|
|
183
|
+
max-height: 50vh;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.abp-mh-75 {
|
|
187
|
+
transition:max-height 0.85s linear;
|
|
188
|
+
max-height: 75vh;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.abp-mh-100 {
|
|
192
|
+
transition:max-height 1s linear;
|
|
193
|
+
max-height: 100vh;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Sorting icon styles - @since 2.0.0 */
|
|
197
|
+
[class^="sorting"] {
|
|
198
|
+
opacity: .3;
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
}
|
|
201
|
+
[class^="sorting"]:before {
|
|
202
|
+
right: 0.5rem;
|
|
203
|
+
content: "\u2191";
|
|
204
|
+
}
|
|
205
|
+
[class^="sorting"]:after {
|
|
206
|
+
right: 0.5rem;
|
|
207
|
+
content: "\u2193";
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.sorting_desc {
|
|
211
|
+
opacity: 1;
|
|
212
|
+
}
|
|
213
|
+
.sorting_desc:before {
|
|
214
|
+
opacity: .3;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.sorting_asc {
|
|
218
|
+
opacity: 1;
|
|
219
|
+
}
|
|
220
|
+
.sorting_asc:after {
|
|
221
|
+
opacity: .3;
|
|
133
222
|
}
|
|
134
223
|
|
|
135
224
|
@keyframes fadeInTop {
|
|
@@ -139,7 +228,7 @@ var DEFAULT_STYLES = `
|
|
|
139
228
|
}
|
|
140
229
|
|
|
141
230
|
to {
|
|
142
|
-
transform: translateY(
|
|
231
|
+
transform: translateY(0px);
|
|
143
232
|
opacity: 1;
|
|
144
233
|
}
|
|
145
234
|
}
|
|
@@ -179,37 +268,33 @@ var ToasterContext = (0, import_react.createContext)(null);
|
|
|
179
268
|
var toastCounter = 0;
|
|
180
269
|
function generateId() {
|
|
181
270
|
toastCounter += 1;
|
|
182
|
-
return
|
|
271
|
+
return toastCounter;
|
|
183
272
|
}
|
|
184
273
|
var DEFAULT_LIFE = 5e3;
|
|
185
|
-
function resolveLocalizationParam(param) {
|
|
186
|
-
if (param === void 0) return void 0;
|
|
187
|
-
if (typeof param === "string") return param;
|
|
188
|
-
return param.defaultValue || param.key;
|
|
189
|
-
}
|
|
190
274
|
function ToasterProvider({ children }) {
|
|
191
275
|
const [toasts, setToasts] = (0, import_react.useState)([]);
|
|
192
|
-
const
|
|
276
|
+
const subscribersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
277
|
+
(0, import_react.useEffect)(() => {
|
|
278
|
+
subscribersRef.current.forEach((subscriber) => {
|
|
279
|
+
subscriber(toasts);
|
|
280
|
+
});
|
|
281
|
+
}, [toasts]);
|
|
193
282
|
const remove = (0, import_react.useCallback)((id) => {
|
|
194
283
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
195
|
-
const resolver = resolversRef.current.get(id);
|
|
196
|
-
if (resolver) {
|
|
197
|
-
resolver(Toaster.Status.dismiss);
|
|
198
|
-
resolversRef.current.delete(id);
|
|
199
|
-
}
|
|
200
284
|
}, []);
|
|
201
285
|
const show = (0, import_react.useCallback)(
|
|
202
|
-
(message, title, severity, options) => {
|
|
203
|
-
const id = options?.id
|
|
286
|
+
(message, title, severity = "info", options) => {
|
|
287
|
+
const id = typeof options?.id === "number" ? options.id : generateId();
|
|
204
288
|
const life = options?.sticky ? void 0 : options?.life ?? DEFAULT_LIFE;
|
|
205
|
-
const resolvedMessage = resolveLocalizationParam(message) || "";
|
|
206
|
-
const resolvedTitle = resolveLocalizationParam(title);
|
|
207
289
|
const toast = {
|
|
208
290
|
id,
|
|
209
|
-
message
|
|
210
|
-
title
|
|
291
|
+
message,
|
|
292
|
+
title,
|
|
211
293
|
severity,
|
|
212
|
-
|
|
294
|
+
options: {
|
|
295
|
+
...options,
|
|
296
|
+
id
|
|
297
|
+
}
|
|
213
298
|
};
|
|
214
299
|
setToasts((prev) => [...prev, toast]);
|
|
215
300
|
if (life) {
|
|
@@ -217,9 +302,7 @@ function ToasterProvider({ children }) {
|
|
|
217
302
|
remove(id);
|
|
218
303
|
}, life);
|
|
219
304
|
}
|
|
220
|
-
return
|
|
221
|
-
resolversRef.current.set(id, resolve);
|
|
222
|
-
});
|
|
305
|
+
return id;
|
|
223
306
|
},
|
|
224
307
|
[remove]
|
|
225
308
|
);
|
|
@@ -232,44 +315,40 @@ function ToasterProvider({ children }) {
|
|
|
232
315
|
[show]
|
|
233
316
|
);
|
|
234
317
|
const warn = (0, import_react.useCallback)(
|
|
235
|
-
(message, title, options) => show(message, title, "
|
|
318
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
236
319
|
[show]
|
|
237
320
|
);
|
|
238
321
|
const error = (0, import_react.useCallback)(
|
|
239
322
|
(message, title, options) => show(message, title, "error", options),
|
|
240
323
|
[show]
|
|
241
324
|
);
|
|
242
|
-
const
|
|
243
|
-
(messages) => {
|
|
244
|
-
messages.forEach((msg) => {
|
|
245
|
-
show(msg.message, msg.title, msg.severity, msg);
|
|
246
|
-
});
|
|
247
|
-
},
|
|
248
|
-
[show]
|
|
249
|
-
);
|
|
250
|
-
const clear = (0, import_react.useCallback)((status) => {
|
|
325
|
+
const clear = (0, import_react.useCallback)((key) => {
|
|
251
326
|
setToasts((prev) => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
resolver(status ?? Toaster.Status.dismiss);
|
|
256
|
-
resolversRef.current.delete(toast.id);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
327
|
+
if (key) {
|
|
328
|
+
return prev.filter((toast) => toast.options?.containerKey !== key);
|
|
329
|
+
}
|
|
259
330
|
return [];
|
|
260
331
|
});
|
|
261
332
|
}, []);
|
|
333
|
+
const subscribe = (0, import_react.useCallback)((subscriber) => {
|
|
334
|
+
subscribersRef.current.add(subscriber);
|
|
335
|
+
subscriber(toasts);
|
|
336
|
+
return () => {
|
|
337
|
+
subscribersRef.current.delete(subscriber);
|
|
338
|
+
};
|
|
339
|
+
}, [toasts]);
|
|
262
340
|
const service = (0, import_react.useMemo)(
|
|
263
341
|
() => ({
|
|
264
342
|
info,
|
|
265
343
|
success,
|
|
266
344
|
warn,
|
|
267
345
|
error,
|
|
268
|
-
|
|
346
|
+
show,
|
|
347
|
+
remove,
|
|
269
348
|
clear,
|
|
270
|
-
|
|
349
|
+
subscribe
|
|
271
350
|
}),
|
|
272
|
-
[info, success, warn, error,
|
|
351
|
+
[info, success, warn, error, show, remove, clear, subscribe]
|
|
273
352
|
);
|
|
274
353
|
const value = (0, import_react.useMemo)(
|
|
275
354
|
() => ({ service, toasts }),
|
|
@@ -309,6 +388,13 @@ function generateId2() {
|
|
|
309
388
|
function ConfirmationProvider({ children }) {
|
|
310
389
|
const [confirmation, setConfirmation] = (0, import_react2.useState)(null);
|
|
311
390
|
const resolverRef = (0, import_react2.useRef)(null);
|
|
391
|
+
const subscribersRef = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
392
|
+
const escapeListenerRef = (0, import_react2.useRef)(false);
|
|
393
|
+
(0, import_react2.useEffect)(() => {
|
|
394
|
+
subscribersRef.current.forEach((subscriber) => {
|
|
395
|
+
subscriber(confirmation);
|
|
396
|
+
});
|
|
397
|
+
}, [confirmation]);
|
|
312
398
|
const respond = (0, import_react2.useCallback)((status) => {
|
|
313
399
|
if (resolverRef.current) {
|
|
314
400
|
resolverRef.current(status);
|
|
@@ -316,20 +402,34 @@ function ConfirmationProvider({ children }) {
|
|
|
316
402
|
}
|
|
317
403
|
setConfirmation(null);
|
|
318
404
|
}, []);
|
|
405
|
+
(0, import_react2.useEffect)(() => {
|
|
406
|
+
if (!escapeListenerRef.current) return;
|
|
407
|
+
const handleEscape = (event) => {
|
|
408
|
+
if (event.key === "Escape" && confirmation && confirmation.options?.closable !== false) {
|
|
409
|
+
respond(Toaster.Status.dismiss);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
document.addEventListener("keydown", handleEscape);
|
|
413
|
+
return () => {
|
|
414
|
+
document.removeEventListener("keydown", handleEscape);
|
|
415
|
+
};
|
|
416
|
+
}, [confirmation, respond]);
|
|
319
417
|
const show = (0, import_react2.useCallback)(
|
|
320
|
-
(message, title, severity, options = {}) => {
|
|
418
|
+
(message, title, severity = "neutral", options = {}) => {
|
|
321
419
|
if (resolverRef.current) {
|
|
322
420
|
resolverRef.current(Toaster.Status.dismiss);
|
|
323
421
|
}
|
|
324
422
|
const id = options.id?.toString() || generateId2();
|
|
325
|
-
const
|
|
326
|
-
id,
|
|
423
|
+
const dialogData = {
|
|
327
424
|
message,
|
|
328
425
|
title,
|
|
329
426
|
severity,
|
|
330
|
-
options
|
|
427
|
+
options: {
|
|
428
|
+
...options,
|
|
429
|
+
id
|
|
430
|
+
}
|
|
331
431
|
};
|
|
332
|
-
setConfirmation(
|
|
432
|
+
setConfirmation(dialogData);
|
|
333
433
|
return new Promise((resolve) => {
|
|
334
434
|
resolverRef.current = resolve;
|
|
335
435
|
});
|
|
@@ -345,7 +445,7 @@ function ConfirmationProvider({ children }) {
|
|
|
345
445
|
[show]
|
|
346
446
|
);
|
|
347
447
|
const warn = (0, import_react2.useCallback)(
|
|
348
|
-
(message, title, options) => show(message, title, "
|
|
448
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
349
449
|
[show]
|
|
350
450
|
);
|
|
351
451
|
const error = (0, import_react2.useCallback)(
|
|
@@ -358,15 +458,28 @@ function ConfirmationProvider({ children }) {
|
|
|
358
458
|
},
|
|
359
459
|
[respond]
|
|
360
460
|
);
|
|
461
|
+
const listenToEscape = (0, import_react2.useCallback)(() => {
|
|
462
|
+
escapeListenerRef.current = true;
|
|
463
|
+
}, []);
|
|
464
|
+
const subscribe = (0, import_react2.useCallback)((subscriber) => {
|
|
465
|
+
subscribersRef.current.add(subscriber);
|
|
466
|
+
subscriber(confirmation);
|
|
467
|
+
return () => {
|
|
468
|
+
subscribersRef.current.delete(subscriber);
|
|
469
|
+
};
|
|
470
|
+
}, [confirmation]);
|
|
361
471
|
const service = (0, import_react2.useMemo)(
|
|
362
472
|
() => ({
|
|
363
473
|
info,
|
|
364
474
|
success,
|
|
365
475
|
warn,
|
|
366
476
|
error,
|
|
367
|
-
|
|
477
|
+
show,
|
|
478
|
+
clear,
|
|
479
|
+
listenToEscape,
|
|
480
|
+
subscribe
|
|
368
481
|
}),
|
|
369
|
-
[info, success, warn, error, clear]
|
|
482
|
+
[info, success, warn, error, show, clear, listenToEscape, subscribe]
|
|
370
483
|
);
|
|
371
484
|
const value = (0, import_react2.useMemo)(
|
|
372
485
|
() => ({ service, confirmation, respond }),
|
|
@@ -484,6 +597,11 @@ var import_react5 = require("@chakra-ui/react");
|
|
|
484
597
|
var import_core = require("@abpjs/core");
|
|
485
598
|
var import_lucide_react = require("lucide-react");
|
|
486
599
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
600
|
+
function resolveLocalizationParam(param) {
|
|
601
|
+
if (param === void 0) return void 0;
|
|
602
|
+
if (typeof param === "string") return param;
|
|
603
|
+
return param.defaultValue || param.key;
|
|
604
|
+
}
|
|
487
605
|
function SeverityIcon({ severity }) {
|
|
488
606
|
const iconProps = { size: 20 };
|
|
489
607
|
switch (severity) {
|
|
@@ -491,10 +609,13 @@ function SeverityIcon({ severity }) {
|
|
|
491
609
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
492
610
|
case "info":
|
|
493
611
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
494
|
-
case "
|
|
612
|
+
case "warning":
|
|
495
613
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
496
614
|
case "error":
|
|
497
615
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
616
|
+
case "neutral":
|
|
617
|
+
default:
|
|
618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Circle, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
498
619
|
}
|
|
499
620
|
}
|
|
500
621
|
function getSeverityColorPalette(severity) {
|
|
@@ -503,10 +624,13 @@ function getSeverityColorPalette(severity) {
|
|
|
503
624
|
return "green";
|
|
504
625
|
case "info":
|
|
505
626
|
return "blue";
|
|
506
|
-
case "
|
|
627
|
+
case "warning":
|
|
507
628
|
return "yellow";
|
|
508
629
|
case "error":
|
|
509
630
|
return "red";
|
|
631
|
+
case "neutral":
|
|
632
|
+
default:
|
|
633
|
+
return "gray";
|
|
510
634
|
}
|
|
511
635
|
}
|
|
512
636
|
function getSeverityBg(severity) {
|
|
@@ -515,10 +639,13 @@ function getSeverityBg(severity) {
|
|
|
515
639
|
return "green.50";
|
|
516
640
|
case "info":
|
|
517
641
|
return "blue.50";
|
|
518
|
-
case "
|
|
642
|
+
case "warning":
|
|
519
643
|
return "yellow.50";
|
|
520
644
|
case "error":
|
|
521
645
|
return "red.50";
|
|
646
|
+
case "neutral":
|
|
647
|
+
default:
|
|
648
|
+
return "gray.50";
|
|
522
649
|
}
|
|
523
650
|
}
|
|
524
651
|
function getSeverityBorderColor(severity) {
|
|
@@ -527,10 +654,13 @@ function getSeverityBorderColor(severity) {
|
|
|
527
654
|
return "green.200";
|
|
528
655
|
case "info":
|
|
529
656
|
return "blue.200";
|
|
530
|
-
case "
|
|
657
|
+
case "warning":
|
|
531
658
|
return "yellow.200";
|
|
532
659
|
case "error":
|
|
533
660
|
return "red.200";
|
|
661
|
+
case "neutral":
|
|
662
|
+
default:
|
|
663
|
+
return "gray.200";
|
|
534
664
|
}
|
|
535
665
|
}
|
|
536
666
|
function mapSeverityToType(severity) {
|
|
@@ -539,10 +669,13 @@ function mapSeverityToType(severity) {
|
|
|
539
669
|
return "success";
|
|
540
670
|
case "info":
|
|
541
671
|
return "info";
|
|
542
|
-
case "
|
|
672
|
+
case "warning":
|
|
543
673
|
return "warning";
|
|
544
674
|
case "error":
|
|
545
675
|
return "error";
|
|
676
|
+
case "neutral":
|
|
677
|
+
default:
|
|
678
|
+
return "info";
|
|
546
679
|
}
|
|
547
680
|
}
|
|
548
681
|
function getPlacement(position) {
|
|
@@ -574,31 +707,38 @@ function getToaster(placement) {
|
|
|
574
707
|
}
|
|
575
708
|
return toasterCache.get(placement);
|
|
576
709
|
}
|
|
577
|
-
function ToastContainer({ position = "bottom-right" }) {
|
|
710
|
+
function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
578
711
|
const { toasts, service } = useToasterContext();
|
|
579
712
|
const { t } = (0, import_core.useLocalization)();
|
|
580
713
|
const displayedToastsRef = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
|
|
581
714
|
const placement = (0, import_react4.useMemo)(() => getPlacement(position), [position]);
|
|
582
715
|
const toaster = (0, import_react4.useMemo)(() => getToaster(placement), [placement]);
|
|
716
|
+
const filteredToasts = (0, import_react4.useMemo)(() => {
|
|
717
|
+
if (!containerKey) return toasts;
|
|
718
|
+
return toasts.filter((toast) => toast.options?.containerKey === containerKey);
|
|
719
|
+
}, [toasts, containerKey]);
|
|
583
720
|
(0, import_react4.useEffect)(() => {
|
|
584
|
-
const newToasts =
|
|
721
|
+
const newToasts = filteredToasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
|
|
585
722
|
newToasts.forEach((toast) => {
|
|
586
723
|
displayedToastsRef.current.add(toast.id);
|
|
724
|
+
const messageStr = resolveLocalizationParam(toast.message) || "";
|
|
587
725
|
const localizedMessage = t(
|
|
588
|
-
|
|
589
|
-
...toast.messageLocalizationParams || []
|
|
726
|
+
messageStr,
|
|
727
|
+
...toast.options?.messageLocalizationParams || []
|
|
590
728
|
);
|
|
591
|
-
const
|
|
729
|
+
const titleStr = resolveLocalizationParam(toast.title);
|
|
730
|
+
const localizedTitle = titleStr ? t(titleStr, ...toast.options?.titleLocalizationParams || []) : void 0;
|
|
731
|
+
const severity = toast.severity || "info";
|
|
592
732
|
requestAnimationFrame(() => {
|
|
593
733
|
toaster.create({
|
|
594
|
-
id: toast.id,
|
|
734
|
+
id: String(toast.id),
|
|
595
735
|
title: localizedTitle,
|
|
596
736
|
description: localizedMessage,
|
|
597
|
-
type: mapSeverityToType(
|
|
598
|
-
duration: toast.sticky ? void 0 : toast.life || 5e3,
|
|
737
|
+
type: mapSeverityToType(severity),
|
|
738
|
+
duration: toast.options?.sticky ? void 0 : toast.options?.life || 5e3,
|
|
599
739
|
meta: {
|
|
600
|
-
closable: toast.closable !== false,
|
|
601
|
-
severity
|
|
740
|
+
closable: toast.options?.closable !== false,
|
|
741
|
+
severity
|
|
602
742
|
},
|
|
603
743
|
onStatusChange: (details) => {
|
|
604
744
|
if (details.status === "unmounted") {
|
|
@@ -609,7 +749,7 @@ function ToastContainer({ position = "bottom-right" }) {
|
|
|
609
749
|
});
|
|
610
750
|
});
|
|
611
751
|
});
|
|
612
|
-
}, [
|
|
752
|
+
}, [filteredToasts, t, service, toaster]);
|
|
613
753
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Toaster, { toaster, insetInline: { mdDown: "4" }, children: (toast) => {
|
|
614
754
|
const severity = toast.meta?.severity || "info";
|
|
615
755
|
const closable = toast.meta?.closable !== false;
|
|
@@ -641,6 +781,11 @@ var import_react7 = require("@chakra-ui/react");
|
|
|
641
781
|
var import_core2 = require("@abpjs/core");
|
|
642
782
|
var import_lucide_react2 = require("lucide-react");
|
|
643
783
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
784
|
+
function resolveLocalizationParam2(param) {
|
|
785
|
+
if (param === void 0) return void 0;
|
|
786
|
+
if (typeof param === "string") return param;
|
|
787
|
+
return param.defaultValue || param.key;
|
|
788
|
+
}
|
|
644
789
|
function getLocalizationKey(param) {
|
|
645
790
|
if (param === void 0) return void 0;
|
|
646
791
|
if (typeof param === "string") return param;
|
|
@@ -653,10 +798,13 @@ function SeverityIcon2({ severity }) {
|
|
|
653
798
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
654
799
|
case "info":
|
|
655
800
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
656
|
-
case "
|
|
801
|
+
case "warning":
|
|
657
802
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
658
803
|
case "error":
|
|
659
804
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
805
|
+
case "neutral":
|
|
806
|
+
default:
|
|
807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Circle, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
660
808
|
}
|
|
661
809
|
}
|
|
662
810
|
function getSeverityColorPalette2(severity) {
|
|
@@ -665,10 +813,13 @@ function getSeverityColorPalette2(severity) {
|
|
|
665
813
|
return "green";
|
|
666
814
|
case "info":
|
|
667
815
|
return "blue";
|
|
668
|
-
case "
|
|
816
|
+
case "warning":
|
|
669
817
|
return "yellow";
|
|
670
818
|
case "error":
|
|
671
819
|
return "red";
|
|
820
|
+
case "neutral":
|
|
821
|
+
default:
|
|
822
|
+
return "gray";
|
|
672
823
|
}
|
|
673
824
|
}
|
|
674
825
|
function ConfirmationDialog({ className }) {
|
|
@@ -678,14 +829,16 @@ function ConfirmationDialog({ className }) {
|
|
|
678
829
|
if (!confirmation) {
|
|
679
830
|
return null;
|
|
680
831
|
}
|
|
681
|
-
const { message, title, severity, options } = confirmation;
|
|
832
|
+
const { message, title, severity = "neutral", options } = confirmation;
|
|
833
|
+
const messageStr = resolveLocalizationParam2(message) || "";
|
|
682
834
|
const localizedMessage = t(
|
|
683
|
-
|
|
684
|
-
...options
|
|
835
|
+
messageStr,
|
|
836
|
+
...options?.messageLocalizationParams || []
|
|
685
837
|
);
|
|
686
|
-
const
|
|
687
|
-
const
|
|
688
|
-
const
|
|
838
|
+
const titleStr = resolveLocalizationParam2(title);
|
|
839
|
+
const localizedTitle = titleStr ? t(titleStr, ...options?.titleLocalizationParams || []) : void 0;
|
|
840
|
+
const yesKey = getLocalizationKey(options?.yesText);
|
|
841
|
+
const cancelKey = getLocalizationKey(options?.cancelText);
|
|
689
842
|
const yesCopy = yesKey ? t(yesKey) : t("AbpUi::Yes");
|
|
690
843
|
const cancelCopy = cancelKey ? t(cancelKey) : t("AbpUi::Cancel");
|
|
691
844
|
const handleConfirm = () => {
|
|
@@ -698,7 +851,7 @@ function ConfirmationDialog({ className }) {
|
|
|
698
851
|
respond(Toaster.Status.dismiss);
|
|
699
852
|
};
|
|
700
853
|
const handleOpenChange = (details) => {
|
|
701
|
-
if (!details.open) {
|
|
854
|
+
if (!details.open && options?.closable !== false) {
|
|
702
855
|
handleDismiss();
|
|
703
856
|
}
|
|
704
857
|
};
|
|
@@ -719,7 +872,7 @@ function ConfirmationDialog({ className }) {
|
|
|
719
872
|
] }) }),
|
|
720
873
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Text, { color: "gray.600", children: localizedMessage }) }),
|
|
721
874
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Flex, { gap: 3, children: [
|
|
722
|
-
!options
|
|
875
|
+
!options?.hideCancelBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
723
876
|
import_react7.Button,
|
|
724
877
|
{
|
|
725
878
|
ref: cancelRef,
|
|
@@ -728,7 +881,7 @@ function ConfirmationDialog({ className }) {
|
|
|
728
881
|
children: cancelCopy
|
|
729
882
|
}
|
|
730
883
|
),
|
|
731
|
-
!options
|
|
884
|
+
!options?.hideYesBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
732
885
|
import_react7.Button,
|
|
733
886
|
{
|
|
734
887
|
colorPalette: getSeverityColorPalette2(severity),
|