@abpjs/theme-shared 1.0.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/loader-bar/LoaderBar.d.ts +13 -1
- 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 +89 -18
- package/dist/index.d.ts +20 -1
- package/dist/index.js +246 -77
- package/dist/index.mjs +264 -91
- package/dist/models/common.d.ts +42 -0
- package/dist/models/confirmation.d.ts +40 -7
- package/dist/models/index.d.ts +1 -0
- package/dist/models/toaster.d.ts +56 -10
- package/package.json +6 -5
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,30 +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
274
|
function ToasterProvider({ children }) {
|
|
186
275
|
const [toasts, setToasts] = (0, import_react.useState)([]);
|
|
187
|
-
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]);
|
|
188
282
|
const remove = (0, import_react.useCallback)((id) => {
|
|
189
283
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
190
|
-
const resolver = resolversRef.current.get(id);
|
|
191
|
-
if (resolver) {
|
|
192
|
-
resolver(Toaster.Status.dismiss);
|
|
193
|
-
resolversRef.current.delete(id);
|
|
194
|
-
}
|
|
195
284
|
}, []);
|
|
196
285
|
const show = (0, import_react.useCallback)(
|
|
197
|
-
(message, title, severity, options) => {
|
|
198
|
-
const id = options?.id
|
|
286
|
+
(message, title, severity = "info", options) => {
|
|
287
|
+
const id = typeof options?.id === "number" ? options.id : generateId();
|
|
199
288
|
const life = options?.sticky ? void 0 : options?.life ?? DEFAULT_LIFE;
|
|
200
289
|
const toast = {
|
|
201
290
|
id,
|
|
202
291
|
message,
|
|
203
292
|
title,
|
|
204
293
|
severity,
|
|
205
|
-
|
|
294
|
+
options: {
|
|
295
|
+
...options,
|
|
296
|
+
id
|
|
297
|
+
}
|
|
206
298
|
};
|
|
207
299
|
setToasts((prev) => [...prev, toast]);
|
|
208
300
|
if (life) {
|
|
@@ -210,9 +302,7 @@ function ToasterProvider({ children }) {
|
|
|
210
302
|
remove(id);
|
|
211
303
|
}, life);
|
|
212
304
|
}
|
|
213
|
-
return
|
|
214
|
-
resolversRef.current.set(id, resolve);
|
|
215
|
-
});
|
|
305
|
+
return id;
|
|
216
306
|
},
|
|
217
307
|
[remove]
|
|
218
308
|
);
|
|
@@ -225,44 +315,40 @@ function ToasterProvider({ children }) {
|
|
|
225
315
|
[show]
|
|
226
316
|
);
|
|
227
317
|
const warn = (0, import_react.useCallback)(
|
|
228
|
-
(message, title, options) => show(message, title, "
|
|
318
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
229
319
|
[show]
|
|
230
320
|
);
|
|
231
321
|
const error = (0, import_react.useCallback)(
|
|
232
322
|
(message, title, options) => show(message, title, "error", options),
|
|
233
323
|
[show]
|
|
234
324
|
);
|
|
235
|
-
const
|
|
236
|
-
(messages) => {
|
|
237
|
-
messages.forEach((msg) => {
|
|
238
|
-
show(msg.message, msg.title, msg.severity, msg);
|
|
239
|
-
});
|
|
240
|
-
},
|
|
241
|
-
[show]
|
|
242
|
-
);
|
|
243
|
-
const clear = (0, import_react.useCallback)((status) => {
|
|
325
|
+
const clear = (0, import_react.useCallback)((key) => {
|
|
244
326
|
setToasts((prev) => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
resolver(status ?? Toaster.Status.dismiss);
|
|
249
|
-
resolversRef.current.delete(toast.id);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
327
|
+
if (key) {
|
|
328
|
+
return prev.filter((toast) => toast.options?.containerKey !== key);
|
|
329
|
+
}
|
|
252
330
|
return [];
|
|
253
331
|
});
|
|
254
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]);
|
|
255
340
|
const service = (0, import_react.useMemo)(
|
|
256
341
|
() => ({
|
|
257
342
|
info,
|
|
258
343
|
success,
|
|
259
344
|
warn,
|
|
260
345
|
error,
|
|
261
|
-
|
|
346
|
+
show,
|
|
347
|
+
remove,
|
|
262
348
|
clear,
|
|
263
|
-
|
|
349
|
+
subscribe
|
|
264
350
|
}),
|
|
265
|
-
[info, success, warn, error,
|
|
351
|
+
[info, success, warn, error, show, remove, clear, subscribe]
|
|
266
352
|
);
|
|
267
353
|
const value = (0, import_react.useMemo)(
|
|
268
354
|
() => ({ service, toasts }),
|
|
@@ -302,6 +388,13 @@ function generateId2() {
|
|
|
302
388
|
function ConfirmationProvider({ children }) {
|
|
303
389
|
const [confirmation, setConfirmation] = (0, import_react2.useState)(null);
|
|
304
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]);
|
|
305
398
|
const respond = (0, import_react2.useCallback)((status) => {
|
|
306
399
|
if (resolverRef.current) {
|
|
307
400
|
resolverRef.current(status);
|
|
@@ -309,20 +402,34 @@ function ConfirmationProvider({ children }) {
|
|
|
309
402
|
}
|
|
310
403
|
setConfirmation(null);
|
|
311
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]);
|
|
312
417
|
const show = (0, import_react2.useCallback)(
|
|
313
|
-
(message, title, severity, options = {}) => {
|
|
418
|
+
(message, title, severity = "neutral", options = {}) => {
|
|
314
419
|
if (resolverRef.current) {
|
|
315
420
|
resolverRef.current(Toaster.Status.dismiss);
|
|
316
421
|
}
|
|
317
422
|
const id = options.id?.toString() || generateId2();
|
|
318
|
-
const
|
|
319
|
-
id,
|
|
423
|
+
const dialogData = {
|
|
320
424
|
message,
|
|
321
425
|
title,
|
|
322
426
|
severity,
|
|
323
|
-
options
|
|
427
|
+
options: {
|
|
428
|
+
...options,
|
|
429
|
+
id
|
|
430
|
+
}
|
|
324
431
|
};
|
|
325
|
-
setConfirmation(
|
|
432
|
+
setConfirmation(dialogData);
|
|
326
433
|
return new Promise((resolve) => {
|
|
327
434
|
resolverRef.current = resolve;
|
|
328
435
|
});
|
|
@@ -338,7 +445,7 @@ function ConfirmationProvider({ children }) {
|
|
|
338
445
|
[show]
|
|
339
446
|
);
|
|
340
447
|
const warn = (0, import_react2.useCallback)(
|
|
341
|
-
(message, title, options) => show(message, title, "
|
|
448
|
+
(message, title, options) => show(message, title, "warning", options),
|
|
342
449
|
[show]
|
|
343
450
|
);
|
|
344
451
|
const error = (0, import_react2.useCallback)(
|
|
@@ -351,15 +458,28 @@ function ConfirmationProvider({ children }) {
|
|
|
351
458
|
},
|
|
352
459
|
[respond]
|
|
353
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]);
|
|
354
471
|
const service = (0, import_react2.useMemo)(
|
|
355
472
|
() => ({
|
|
356
473
|
info,
|
|
357
474
|
success,
|
|
358
475
|
warn,
|
|
359
476
|
error,
|
|
360
|
-
|
|
477
|
+
show,
|
|
478
|
+
clear,
|
|
479
|
+
listenToEscape,
|
|
480
|
+
subscribe
|
|
361
481
|
}),
|
|
362
|
-
[info, success, warn, error, clear]
|
|
482
|
+
[info, success, warn, error, show, clear, listenToEscape, subscribe]
|
|
363
483
|
);
|
|
364
484
|
const value = (0, import_react2.useMemo)(
|
|
365
485
|
() => ({ service, confirmation, respond }),
|
|
@@ -477,6 +597,11 @@ var import_react5 = require("@chakra-ui/react");
|
|
|
477
597
|
var import_core = require("@abpjs/core");
|
|
478
598
|
var import_lucide_react = require("lucide-react");
|
|
479
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
|
+
}
|
|
480
605
|
function SeverityIcon({ severity }) {
|
|
481
606
|
const iconProps = { size: 20 };
|
|
482
607
|
switch (severity) {
|
|
@@ -484,10 +609,13 @@ function SeverityIcon({ severity }) {
|
|
|
484
609
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
485
610
|
case "info":
|
|
486
611
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
487
|
-
case "
|
|
612
|
+
case "warning":
|
|
488
613
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
489
614
|
case "error":
|
|
490
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)" });
|
|
491
619
|
}
|
|
492
620
|
}
|
|
493
621
|
function getSeverityColorPalette(severity) {
|
|
@@ -496,10 +624,13 @@ function getSeverityColorPalette(severity) {
|
|
|
496
624
|
return "green";
|
|
497
625
|
case "info":
|
|
498
626
|
return "blue";
|
|
499
|
-
case "
|
|
627
|
+
case "warning":
|
|
500
628
|
return "yellow";
|
|
501
629
|
case "error":
|
|
502
630
|
return "red";
|
|
631
|
+
case "neutral":
|
|
632
|
+
default:
|
|
633
|
+
return "gray";
|
|
503
634
|
}
|
|
504
635
|
}
|
|
505
636
|
function getSeverityBg(severity) {
|
|
@@ -508,10 +639,13 @@ function getSeverityBg(severity) {
|
|
|
508
639
|
return "green.50";
|
|
509
640
|
case "info":
|
|
510
641
|
return "blue.50";
|
|
511
|
-
case "
|
|
642
|
+
case "warning":
|
|
512
643
|
return "yellow.50";
|
|
513
644
|
case "error":
|
|
514
645
|
return "red.50";
|
|
646
|
+
case "neutral":
|
|
647
|
+
default:
|
|
648
|
+
return "gray.50";
|
|
515
649
|
}
|
|
516
650
|
}
|
|
517
651
|
function getSeverityBorderColor(severity) {
|
|
@@ -520,10 +654,13 @@ function getSeverityBorderColor(severity) {
|
|
|
520
654
|
return "green.200";
|
|
521
655
|
case "info":
|
|
522
656
|
return "blue.200";
|
|
523
|
-
case "
|
|
657
|
+
case "warning":
|
|
524
658
|
return "yellow.200";
|
|
525
659
|
case "error":
|
|
526
660
|
return "red.200";
|
|
661
|
+
case "neutral":
|
|
662
|
+
default:
|
|
663
|
+
return "gray.200";
|
|
527
664
|
}
|
|
528
665
|
}
|
|
529
666
|
function mapSeverityToType(severity) {
|
|
@@ -532,10 +669,13 @@ function mapSeverityToType(severity) {
|
|
|
532
669
|
return "success";
|
|
533
670
|
case "info":
|
|
534
671
|
return "info";
|
|
535
|
-
case "
|
|
672
|
+
case "warning":
|
|
536
673
|
return "warning";
|
|
537
674
|
case "error":
|
|
538
675
|
return "error";
|
|
676
|
+
case "neutral":
|
|
677
|
+
default:
|
|
678
|
+
return "info";
|
|
539
679
|
}
|
|
540
680
|
}
|
|
541
681
|
function getPlacement(position) {
|
|
@@ -567,31 +707,38 @@ function getToaster(placement) {
|
|
|
567
707
|
}
|
|
568
708
|
return toasterCache.get(placement);
|
|
569
709
|
}
|
|
570
|
-
function ToastContainer({ position = "bottom-right" }) {
|
|
710
|
+
function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
571
711
|
const { toasts, service } = useToasterContext();
|
|
572
712
|
const { t } = (0, import_core.useLocalization)();
|
|
573
713
|
const displayedToastsRef = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
|
|
574
714
|
const placement = (0, import_react4.useMemo)(() => getPlacement(position), [position]);
|
|
575
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]);
|
|
576
720
|
(0, import_react4.useEffect)(() => {
|
|
577
|
-
const newToasts =
|
|
721
|
+
const newToasts = filteredToasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
|
|
578
722
|
newToasts.forEach((toast) => {
|
|
579
723
|
displayedToastsRef.current.add(toast.id);
|
|
724
|
+
const messageStr = resolveLocalizationParam(toast.message) || "";
|
|
580
725
|
const localizedMessage = t(
|
|
581
|
-
|
|
582
|
-
...toast.messageLocalizationParams || []
|
|
726
|
+
messageStr,
|
|
727
|
+
...toast.options?.messageLocalizationParams || []
|
|
583
728
|
);
|
|
584
|
-
const
|
|
729
|
+
const titleStr = resolveLocalizationParam(toast.title);
|
|
730
|
+
const localizedTitle = titleStr ? t(titleStr, ...toast.options?.titleLocalizationParams || []) : void 0;
|
|
731
|
+
const severity = toast.severity || "info";
|
|
585
732
|
requestAnimationFrame(() => {
|
|
586
733
|
toaster.create({
|
|
587
|
-
id: toast.id,
|
|
734
|
+
id: String(toast.id),
|
|
588
735
|
title: localizedTitle,
|
|
589
736
|
description: localizedMessage,
|
|
590
|
-
type: mapSeverityToType(
|
|
591
|
-
duration: toast.sticky ? void 0 : toast.life || 5e3,
|
|
737
|
+
type: mapSeverityToType(severity),
|
|
738
|
+
duration: toast.options?.sticky ? void 0 : toast.options?.life || 5e3,
|
|
592
739
|
meta: {
|
|
593
|
-
closable: toast.closable !== false,
|
|
594
|
-
severity
|
|
740
|
+
closable: toast.options?.closable !== false,
|
|
741
|
+
severity
|
|
595
742
|
},
|
|
596
743
|
onStatusChange: (details) => {
|
|
597
744
|
if (details.status === "unmounted") {
|
|
@@ -602,7 +749,7 @@ function ToastContainer({ position = "bottom-right" }) {
|
|
|
602
749
|
});
|
|
603
750
|
});
|
|
604
751
|
});
|
|
605
|
-
}, [
|
|
752
|
+
}, [filteredToasts, t, service, toaster]);
|
|
606
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) => {
|
|
607
754
|
const severity = toast.meta?.severity || "info";
|
|
608
755
|
const closable = toast.meta?.closable !== false;
|
|
@@ -634,6 +781,16 @@ var import_react7 = require("@chakra-ui/react");
|
|
|
634
781
|
var import_core2 = require("@abpjs/core");
|
|
635
782
|
var import_lucide_react2 = require("lucide-react");
|
|
636
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
|
+
}
|
|
789
|
+
function getLocalizationKey(param) {
|
|
790
|
+
if (param === void 0) return void 0;
|
|
791
|
+
if (typeof param === "string") return param;
|
|
792
|
+
return param.key;
|
|
793
|
+
}
|
|
637
794
|
function SeverityIcon2({ severity }) {
|
|
638
795
|
const iconProps = { size: 24 };
|
|
639
796
|
switch (severity) {
|
|
@@ -641,10 +798,13 @@ function SeverityIcon2({ severity }) {
|
|
|
641
798
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
642
799
|
case "info":
|
|
643
800
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
644
|
-
case "
|
|
801
|
+
case "warning":
|
|
645
802
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
646
803
|
case "error":
|
|
647
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)" });
|
|
648
808
|
}
|
|
649
809
|
}
|
|
650
810
|
function getSeverityColorPalette2(severity) {
|
|
@@ -653,10 +813,13 @@ function getSeverityColorPalette2(severity) {
|
|
|
653
813
|
return "green";
|
|
654
814
|
case "info":
|
|
655
815
|
return "blue";
|
|
656
|
-
case "
|
|
816
|
+
case "warning":
|
|
657
817
|
return "yellow";
|
|
658
818
|
case "error":
|
|
659
819
|
return "red";
|
|
820
|
+
case "neutral":
|
|
821
|
+
default:
|
|
822
|
+
return "gray";
|
|
660
823
|
}
|
|
661
824
|
}
|
|
662
825
|
function ConfirmationDialog({ className }) {
|
|
@@ -666,14 +829,18 @@ function ConfirmationDialog({ className }) {
|
|
|
666
829
|
if (!confirmation) {
|
|
667
830
|
return null;
|
|
668
831
|
}
|
|
669
|
-
const { message, title, severity, options } = confirmation;
|
|
832
|
+
const { message, title, severity = "neutral", options } = confirmation;
|
|
833
|
+
const messageStr = resolveLocalizationParam2(message) || "";
|
|
670
834
|
const localizedMessage = t(
|
|
671
|
-
|
|
672
|
-
...options
|
|
835
|
+
messageStr,
|
|
836
|
+
...options?.messageLocalizationParams || []
|
|
673
837
|
);
|
|
674
|
-
const
|
|
675
|
-
const
|
|
676
|
-
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);
|
|
842
|
+
const yesCopy = yesKey ? t(yesKey) : t("AbpUi::Yes");
|
|
843
|
+
const cancelCopy = cancelKey ? t(cancelKey) : t("AbpUi::Cancel");
|
|
677
844
|
const handleConfirm = () => {
|
|
678
845
|
respond(Toaster.Status.confirm);
|
|
679
846
|
};
|
|
@@ -684,7 +851,7 @@ function ConfirmationDialog({ className }) {
|
|
|
684
851
|
respond(Toaster.Status.dismiss);
|
|
685
852
|
};
|
|
686
853
|
const handleOpenChange = (details) => {
|
|
687
|
-
if (!details.open) {
|
|
854
|
+
if (!details.open && options?.closable !== false) {
|
|
688
855
|
handleDismiss();
|
|
689
856
|
}
|
|
690
857
|
};
|
|
@@ -705,7 +872,7 @@ function ConfirmationDialog({ className }) {
|
|
|
705
872
|
] }) }),
|
|
706
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 }) }),
|
|
707
874
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Flex, { gap: 3, children: [
|
|
708
|
-
!options
|
|
875
|
+
!options?.hideCancelBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
709
876
|
import_react7.Button,
|
|
710
877
|
{
|
|
711
878
|
ref: cancelRef,
|
|
@@ -714,7 +881,7 @@ function ConfirmationDialog({ className }) {
|
|
|
714
881
|
children: cancelCopy
|
|
715
882
|
}
|
|
716
883
|
),
|
|
717
|
-
!options
|
|
884
|
+
!options?.hideYesBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
718
885
|
import_react7.Button,
|
|
719
886
|
{
|
|
720
887
|
colorPalette: getSeverityColorPalette2(severity),
|
|
@@ -769,7 +936,9 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
769
936
|
function LoaderBar({
|
|
770
937
|
containerClass = "abp-loader-bar",
|
|
771
938
|
progressClass = "abp-progress",
|
|
772
|
-
filter
|
|
939
|
+
filter,
|
|
940
|
+
intervalPeriod = 300,
|
|
941
|
+
stopDelay = 400
|
|
773
942
|
}) {
|
|
774
943
|
const { loading } = (0, import_core3.useLoader)();
|
|
775
944
|
const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
|
|
@@ -806,7 +975,7 @@ function LoaderBar({
|
|
|
806
975
|
}
|
|
807
976
|
return prev + 10;
|
|
808
977
|
});
|
|
809
|
-
},
|
|
978
|
+
}, intervalPeriod);
|
|
810
979
|
};
|
|
811
980
|
const stopLoading = () => {
|
|
812
981
|
setProgressLevel(100);
|
|
@@ -817,7 +986,7 @@ function LoaderBar({
|
|
|
817
986
|
setTimeout(() => {
|
|
818
987
|
setIsLoading(false);
|
|
819
988
|
setProgressLevel(0);
|
|
820
|
-
},
|
|
989
|
+
}, stopDelay);
|
|
821
990
|
};
|
|
822
991
|
if (!isLoading && progressLevel === 0) {
|
|
823
992
|
return null;
|