@abpjs/theme-shared 2.9.0 → 3.1.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/loader-bar/LoaderBar.d.ts +1 -1
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/route-names.d.ts +15 -0
- package/dist/handlers/error.handler.d.ts +34 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-nav-items.d.ts +33 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +416 -245
- package/dist/index.mjs +270 -102
- package/dist/models/confirmation.d.ts +3 -7
- package/dist/models/index.d.ts +7 -2
- package/dist/models/nav-item.d.ts +89 -0
- package/dist/models/toaster.d.ts +2 -44
- package/dist/providers/ThemeSharedProvider.d.ts +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/route.provider.d.ts +53 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/nav-items.service.d.ts +119 -0
- package/dist/utils/index.d.ts +4 -1
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
// src/models/toaster.ts
|
|
2
|
-
var Toaster;
|
|
3
|
-
((Toaster2) => {
|
|
4
|
-
let Status;
|
|
5
|
-
((Status2) => {
|
|
6
|
-
Status2["confirm"] = "confirm";
|
|
7
|
-
Status2["reject"] = "reject";
|
|
8
|
-
Status2["dismiss"] = "dismiss";
|
|
9
|
-
})(Status = Toaster2.Status || (Toaster2.Status = {}));
|
|
10
|
-
})(Toaster || (Toaster = {}));
|
|
11
|
-
|
|
12
1
|
// src/models/confirmation.ts
|
|
13
2
|
var Confirmation;
|
|
14
3
|
((Confirmation2) => {
|
|
@@ -20,6 +9,24 @@ var Confirmation;
|
|
|
20
9
|
})(Status = Confirmation2.Status || (Confirmation2.Status = {}));
|
|
21
10
|
})(Confirmation || (Confirmation = {}));
|
|
22
11
|
|
|
12
|
+
// src/models/nav-item.ts
|
|
13
|
+
var NavItem = class {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new NavItem.
|
|
16
|
+
* @param props - Partial properties to initialize the nav item
|
|
17
|
+
* @since 3.1.0
|
|
18
|
+
*/
|
|
19
|
+
constructor(props) {
|
|
20
|
+
this.id = props.id ?? "";
|
|
21
|
+
this.component = props.component;
|
|
22
|
+
this.html = props.html;
|
|
23
|
+
this.action = props.action;
|
|
24
|
+
this.order = props.order;
|
|
25
|
+
this.requiredPolicy = props.requiredPolicy;
|
|
26
|
+
this.visible = props.visible;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
// src/constants/styles.ts
|
|
24
31
|
var BOOTSTRAP = "bootstrap-{{dir}}.min.css";
|
|
25
32
|
var DEFAULT_STYLES = `
|
|
@@ -392,7 +399,7 @@ function ConfirmationProvider({ children }) {
|
|
|
392
399
|
useEffect2(() => {
|
|
393
400
|
if (!escapeListenerRef.current) return;
|
|
394
401
|
const handleEscape = (event) => {
|
|
395
|
-
if (event.key === "Escape" && confirmation && confirmation.options?.
|
|
402
|
+
if (event.key === "Escape" && confirmation && confirmation.options?.dismissible !== false) {
|
|
396
403
|
respond(Confirmation.Status.dismiss);
|
|
397
404
|
}
|
|
398
405
|
};
|
|
@@ -580,6 +587,28 @@ var DEFAULT_ERROR_MESSAGES = {
|
|
|
580
587
|
500: "AbpUi::DefaultErrorMessage500",
|
|
581
588
|
503: "AbpUi::DefaultErrorMessage503"
|
|
582
589
|
};
|
|
590
|
+
var DEFAULT_ERROR_LOCALIZATIONS = {
|
|
591
|
+
defaultError: {
|
|
592
|
+
title: "AbpUi::DefaultErrorMessage",
|
|
593
|
+
details: "AbpUi::DefaultErrorMessageDetail"
|
|
594
|
+
},
|
|
595
|
+
defaultError401: {
|
|
596
|
+
title: "AbpUi::DefaultErrorMessage401",
|
|
597
|
+
details: "AbpUi::DefaultErrorMessage401Detail"
|
|
598
|
+
},
|
|
599
|
+
defaultError403: {
|
|
600
|
+
title: "AbpUi::DefaultErrorMessage403",
|
|
601
|
+
details: "AbpUi::DefaultErrorMessage403Detail"
|
|
602
|
+
},
|
|
603
|
+
defaultError404: {
|
|
604
|
+
title: "AbpUi::DefaultErrorMessage404",
|
|
605
|
+
details: "AbpUi::DefaultErrorMessage404Detail"
|
|
606
|
+
},
|
|
607
|
+
defaultError500: {
|
|
608
|
+
title: "AbpUi::DefaultErrorMessage500",
|
|
609
|
+
details: "AbpUi::DefaultErrorMessage500Detail"
|
|
610
|
+
}
|
|
611
|
+
};
|
|
583
612
|
function useErrorHandler(options = {}) {
|
|
584
613
|
const { navigate, loginPath = "/account/login" } = options;
|
|
585
614
|
const confirmation = useConfirmation();
|
|
@@ -652,8 +681,152 @@ function isHttpErrorResponse(error) {
|
|
|
652
681
|
return typeof error === "object" && error !== null && "status" in error && typeof error.status === "number";
|
|
653
682
|
}
|
|
654
683
|
|
|
684
|
+
// src/hooks/use-nav-items.ts
|
|
685
|
+
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
686
|
+
|
|
687
|
+
// src/services/nav-items.service.ts
|
|
688
|
+
var _NavItemsService = class _NavItemsService {
|
|
689
|
+
constructor() {
|
|
690
|
+
this._items = [];
|
|
691
|
+
this._listeners = /* @__PURE__ */ new Set();
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Get singleton instance
|
|
695
|
+
* @since 3.0.0
|
|
696
|
+
*/
|
|
697
|
+
static getInstance() {
|
|
698
|
+
if (!_NavItemsService._instance) {
|
|
699
|
+
_NavItemsService._instance = new _NavItemsService();
|
|
700
|
+
}
|
|
701
|
+
return _NavItemsService._instance;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Reset the singleton instance (useful for testing)
|
|
705
|
+
* @internal
|
|
706
|
+
*/
|
|
707
|
+
static resetInstance() {
|
|
708
|
+
_NavItemsService._instance = null;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Get current items (sorted by order)
|
|
712
|
+
* @since 3.0.0
|
|
713
|
+
*/
|
|
714
|
+
get items() {
|
|
715
|
+
return [...this._items].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Subscribe to item changes.
|
|
719
|
+
* Returns an unsubscribe function.
|
|
720
|
+
*
|
|
721
|
+
* @param listener - Callback function to receive item updates
|
|
722
|
+
* @returns Unsubscribe function
|
|
723
|
+
* @since 3.0.0
|
|
724
|
+
*/
|
|
725
|
+
subscribe(listener) {
|
|
726
|
+
this._listeners.add(listener);
|
|
727
|
+
listener(this.items);
|
|
728
|
+
return () => {
|
|
729
|
+
this._listeners.delete(listener);
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Get items as an observable-like interface.
|
|
734
|
+
* Compatible with Angular's Observable pattern.
|
|
735
|
+
*
|
|
736
|
+
* @returns Object with subscribe method
|
|
737
|
+
* @since 3.0.0
|
|
738
|
+
*/
|
|
739
|
+
get items$() {
|
|
740
|
+
return {
|
|
741
|
+
subscribe: (callback) => {
|
|
742
|
+
const unsubscribe = this.subscribe(callback);
|
|
743
|
+
return { unsubscribe };
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Add one or more items.
|
|
749
|
+
* Items are automatically sorted by order.
|
|
750
|
+
*
|
|
751
|
+
* @param newItems - Array of items to add
|
|
752
|
+
* @since 3.0.0
|
|
753
|
+
* @since 3.1.0 - Renamed parameter from items to newItems
|
|
754
|
+
*/
|
|
755
|
+
addItems(newItems) {
|
|
756
|
+
const existingIds = new Set(this._items.map((item) => item.id));
|
|
757
|
+
const itemsToAdd = newItems.filter((item) => !existingIds.has(item.id)).map((item) => item instanceof NavItem ? item : new NavItem(item));
|
|
758
|
+
this._items = [...this._items, ...itemsToAdd];
|
|
759
|
+
this.notify();
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Remove an item by id.
|
|
763
|
+
*
|
|
764
|
+
* @param id - The id of the item to remove
|
|
765
|
+
* @since 3.0.0
|
|
766
|
+
*/
|
|
767
|
+
removeItem(id) {
|
|
768
|
+
const initialLength = this._items.length;
|
|
769
|
+
this._items = this._items.filter((item) => item.id !== id);
|
|
770
|
+
if (this._items.length !== initialLength) {
|
|
771
|
+
this.notify();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Patch an existing item by id.
|
|
776
|
+
* Updates only the specified properties.
|
|
777
|
+
*
|
|
778
|
+
* @param id - The id of the item to patch
|
|
779
|
+
* @param patch - Partial item data to merge
|
|
780
|
+
* @since 3.0.0
|
|
781
|
+
*/
|
|
782
|
+
patchItem(id, patch) {
|
|
783
|
+
const index = this._items.findIndex((item) => item.id === id);
|
|
784
|
+
if (index !== -1) {
|
|
785
|
+
this._items = [
|
|
786
|
+
...this._items.slice(0, index),
|
|
787
|
+
{ ...this._items[index], ...patch },
|
|
788
|
+
...this._items.slice(index + 1)
|
|
789
|
+
];
|
|
790
|
+
this.notify();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Clear all items.
|
|
795
|
+
* @since 3.0.0
|
|
796
|
+
*/
|
|
797
|
+
clear() {
|
|
798
|
+
if (this._items.length > 0) {
|
|
799
|
+
this._items = [];
|
|
800
|
+
this.notify();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Notify all listeners of changes.
|
|
805
|
+
*/
|
|
806
|
+
notify() {
|
|
807
|
+
const currentItems = this.items;
|
|
808
|
+
this._listeners.forEach((listener) => listener(currentItems));
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
_NavItemsService._instance = null;
|
|
812
|
+
var NavItemsService = _NavItemsService;
|
|
813
|
+
function getNavItemsService() {
|
|
814
|
+
return NavItemsService.getInstance();
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// src/hooks/use-nav-items.ts
|
|
818
|
+
function useNavItems(service) {
|
|
819
|
+
const navItemsService = service || getNavItemsService();
|
|
820
|
+
const [items, setItems] = useState5(navItemsService.items);
|
|
821
|
+
useEffect3(() => {
|
|
822
|
+
const unsubscribe = navItemsService.subscribe(setItems);
|
|
823
|
+
return unsubscribe;
|
|
824
|
+
}, [navItemsService]);
|
|
825
|
+
return items;
|
|
826
|
+
}
|
|
827
|
+
|
|
655
828
|
// src/components/toast/Toast.tsx
|
|
656
|
-
import { useEffect as
|
|
829
|
+
import { useEffect as useEffect4, useRef as useRef4, useMemo as useMemo4 } from "react";
|
|
657
830
|
import {
|
|
658
831
|
Toaster as ChakraToaster,
|
|
659
832
|
Portal,
|
|
@@ -793,7 +966,7 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
793
966
|
if (!containerKey) return toasts;
|
|
794
967
|
return toasts.filter((toast) => toast.options?.containerKey === containerKey);
|
|
795
968
|
}, [toasts, containerKey]);
|
|
796
|
-
|
|
969
|
+
useEffect4(() => {
|
|
797
970
|
const newToasts = filteredToasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
|
|
798
971
|
newToasts.forEach((toast) => {
|
|
799
972
|
displayedToastsRef.current.add(toast.id);
|
|
@@ -939,7 +1112,7 @@ function ConfirmationDialog({ className }) {
|
|
|
939
1112
|
respond(Confirmation.Status.dismiss);
|
|
940
1113
|
};
|
|
941
1114
|
const handleOpenChange = (details) => {
|
|
942
|
-
if (!details.open && options?.
|
|
1115
|
+
if (!details.open && options?.dismissible !== false) {
|
|
943
1116
|
handleDismiss();
|
|
944
1117
|
}
|
|
945
1118
|
};
|
|
@@ -1032,35 +1205,21 @@ function ErrorComponent({
|
|
|
1032
1205
|
}
|
|
1033
1206
|
|
|
1034
1207
|
// src/components/loader-bar/LoaderBar.tsx
|
|
1035
|
-
import { useEffect as
|
|
1208
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef6, useState as useState6 } from "react";
|
|
1036
1209
|
import { useLoader } from "@abpjs/core";
|
|
1037
1210
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1038
1211
|
function LoaderBar({
|
|
1039
1212
|
containerClass = "abp-loader-bar",
|
|
1040
1213
|
progressClass = "abp-progress",
|
|
1041
|
-
filter,
|
|
1214
|
+
filter: _filter,
|
|
1042
1215
|
intervalPeriod = 300,
|
|
1043
1216
|
stopDelay = 400
|
|
1044
1217
|
}) {
|
|
1045
1218
|
const { loading } = useLoader();
|
|
1046
|
-
const [isLoading, setIsLoading] =
|
|
1047
|
-
const [progressLevel, setProgressLevel] =
|
|
1219
|
+
const [isLoading, setIsLoading] = useState6(false);
|
|
1220
|
+
const [progressLevel, setProgressLevel] = useState6(0);
|
|
1048
1221
|
const intervalRef = useRef6(null);
|
|
1049
|
-
|
|
1050
|
-
if (loading) {
|
|
1051
|
-
startLoading();
|
|
1052
|
-
} else {
|
|
1053
|
-
stopLoading();
|
|
1054
|
-
}
|
|
1055
|
-
}, [loading]);
|
|
1056
|
-
useEffect4(() => {
|
|
1057
|
-
return () => {
|
|
1058
|
-
if (intervalRef.current) {
|
|
1059
|
-
clearInterval(intervalRef.current);
|
|
1060
|
-
}
|
|
1061
|
-
};
|
|
1062
|
-
}, []);
|
|
1063
|
-
const startLoading = () => {
|
|
1222
|
+
const startLoading = useCallback5(() => {
|
|
1064
1223
|
setIsLoading(true);
|
|
1065
1224
|
setProgressLevel(0);
|
|
1066
1225
|
if (intervalRef.current) {
|
|
@@ -1078,8 +1237,8 @@ function LoaderBar({
|
|
|
1078
1237
|
return prev + 10;
|
|
1079
1238
|
});
|
|
1080
1239
|
}, intervalPeriod);
|
|
1081
|
-
};
|
|
1082
|
-
const stopLoading = () => {
|
|
1240
|
+
}, [intervalPeriod]);
|
|
1241
|
+
const stopLoading = useCallback5(() => {
|
|
1083
1242
|
setProgressLevel(100);
|
|
1084
1243
|
if (intervalRef.current) {
|
|
1085
1244
|
clearInterval(intervalRef.current);
|
|
@@ -1089,7 +1248,21 @@ function LoaderBar({
|
|
|
1089
1248
|
setIsLoading(false);
|
|
1090
1249
|
setProgressLevel(0);
|
|
1091
1250
|
}, stopDelay);
|
|
1092
|
-
};
|
|
1251
|
+
}, [stopDelay]);
|
|
1252
|
+
useEffect5(() => {
|
|
1253
|
+
if (loading) {
|
|
1254
|
+
startLoading();
|
|
1255
|
+
} else {
|
|
1256
|
+
stopLoading();
|
|
1257
|
+
}
|
|
1258
|
+
}, [loading, startLoading, stopLoading]);
|
|
1259
|
+
useEffect5(() => {
|
|
1260
|
+
return () => {
|
|
1261
|
+
if (intervalRef.current) {
|
|
1262
|
+
clearInterval(intervalRef.current);
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
}, []);
|
|
1093
1266
|
if (!isLoading && progressLevel === 0) {
|
|
1094
1267
|
return null;
|
|
1095
1268
|
}
|
|
@@ -1124,7 +1297,7 @@ function LoaderBar({
|
|
|
1124
1297
|
}
|
|
1125
1298
|
|
|
1126
1299
|
// src/components/modal/Modal.tsx
|
|
1127
|
-
import
|
|
1300
|
+
import React6 from "react";
|
|
1128
1301
|
import {
|
|
1129
1302
|
Dialog as Dialog2,
|
|
1130
1303
|
Portal as Portal3,
|
|
@@ -1172,12 +1345,12 @@ function Modal({
|
|
|
1172
1345
|
preventScroll = true,
|
|
1173
1346
|
onInit
|
|
1174
1347
|
}) {
|
|
1175
|
-
const prevVisibleRef =
|
|
1176
|
-
const onInitRef =
|
|
1177
|
-
|
|
1348
|
+
const prevVisibleRef = React6.useRef(false);
|
|
1349
|
+
const onInitRef = React6.useRef(onInit);
|
|
1350
|
+
React6.useEffect(() => {
|
|
1178
1351
|
onInitRef.current = onInit;
|
|
1179
1352
|
}, [onInit]);
|
|
1180
|
-
|
|
1353
|
+
React6.useEffect(() => {
|
|
1181
1354
|
if (visible && !prevVisibleRef.current && onInitRef.current) {
|
|
1182
1355
|
onInitRef.current();
|
|
1183
1356
|
}
|
|
@@ -1393,7 +1566,7 @@ function FormField({
|
|
|
1393
1566
|
}
|
|
1394
1567
|
|
|
1395
1568
|
// src/components/change-password/ChangePassword.tsx
|
|
1396
|
-
import { useEffect as
|
|
1569
|
+
import { useEffect as useEffect6 } from "react";
|
|
1397
1570
|
import {
|
|
1398
1571
|
Button as Button5,
|
|
1399
1572
|
VStack as VStack2,
|
|
@@ -1425,7 +1598,7 @@ function ChangePassword({
|
|
|
1425
1598
|
}
|
|
1426
1599
|
});
|
|
1427
1600
|
const newPassword = watch("newPassword");
|
|
1428
|
-
|
|
1601
|
+
useEffect6(() => {
|
|
1429
1602
|
if (visible) {
|
|
1430
1603
|
reset();
|
|
1431
1604
|
}
|
|
@@ -1545,7 +1718,7 @@ function ChangePassword({
|
|
|
1545
1718
|
}
|
|
1546
1719
|
|
|
1547
1720
|
// src/components/profile/Profile.tsx
|
|
1548
|
-
import { useEffect as
|
|
1721
|
+
import { useEffect as useEffect7 } from "react";
|
|
1549
1722
|
import {
|
|
1550
1723
|
Button as Button6,
|
|
1551
1724
|
VStack as VStack3,
|
|
@@ -1579,13 +1752,13 @@ function Profile({
|
|
|
1579
1752
|
}
|
|
1580
1753
|
});
|
|
1581
1754
|
const modalBusy = isSubmitting || loading;
|
|
1582
|
-
|
|
1755
|
+
useEffect7(() => {
|
|
1583
1756
|
if (visible) {
|
|
1584
1757
|
fetchProfile().then(() => {
|
|
1585
1758
|
});
|
|
1586
1759
|
}
|
|
1587
1760
|
}, [visible, fetchProfile]);
|
|
1588
|
-
|
|
1761
|
+
useEffect7(() => {
|
|
1589
1762
|
if (profile) {
|
|
1590
1763
|
reset({
|
|
1591
1764
|
userName: profile.userName || "",
|
|
@@ -1980,7 +2153,7 @@ var abpSystem = createAbpSystem();
|
|
|
1980
2153
|
// src/components/ui/color-mode.tsx
|
|
1981
2154
|
import { ClientOnly, IconButton, Skeleton, Span } from "@chakra-ui/react";
|
|
1982
2155
|
import { ThemeProvider, useTheme } from "next-themes";
|
|
1983
|
-
import * as
|
|
2156
|
+
import * as React11 from "react";
|
|
1984
2157
|
import { Moon, Sun } from "lucide-react";
|
|
1985
2158
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1986
2159
|
function ColorModeProvider(props) {
|
|
@@ -2002,7 +2175,7 @@ function ColorModeIcon() {
|
|
|
2002
2175
|
const { colorMode } = useColorMode();
|
|
2003
2176
|
return colorMode === "dark" ? /* @__PURE__ */ jsx15(Moon, {}) : /* @__PURE__ */ jsx15(Sun, {});
|
|
2004
2177
|
}
|
|
2005
|
-
var ColorModeButton =
|
|
2178
|
+
var ColorModeButton = React11.forwardRef(function ColorModeButton2(props, ref) {
|
|
2006
2179
|
const { toggleColorMode } = useColorMode();
|
|
2007
2180
|
return /* @__PURE__ */ jsx15(ClientOnly, { fallback: /* @__PURE__ */ jsx15(Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ jsx15(
|
|
2008
2181
|
IconButton,
|
|
@@ -2023,7 +2196,7 @@ var ColorModeButton = React12.forwardRef(function ColorModeButton2(props, ref) {
|
|
|
2023
2196
|
}
|
|
2024
2197
|
) });
|
|
2025
2198
|
});
|
|
2026
|
-
var LightMode =
|
|
2199
|
+
var LightMode = React11.forwardRef(
|
|
2027
2200
|
function LightMode2(props, ref) {
|
|
2028
2201
|
return /* @__PURE__ */ jsx15(
|
|
2029
2202
|
Span,
|
|
@@ -2039,7 +2212,7 @@ var LightMode = React12.forwardRef(
|
|
|
2039
2212
|
);
|
|
2040
2213
|
}
|
|
2041
2214
|
);
|
|
2042
|
-
var DarkMode =
|
|
2215
|
+
var DarkMode = React11.forwardRef(
|
|
2043
2216
|
function DarkMode2(props, ref) {
|
|
2044
2217
|
return /* @__PURE__ */ jsx15(
|
|
2045
2218
|
Span,
|
|
@@ -2064,35 +2237,65 @@ function ThemeSharedProvider({
|
|
|
2064
2237
|
renderToasts = true,
|
|
2065
2238
|
renderConfirmation = true,
|
|
2066
2239
|
themeOverrides,
|
|
2067
|
-
toastPosition = "bottom-right",
|
|
2240
|
+
toastPosition: _toastPosition = "bottom-right",
|
|
2068
2241
|
enableColorMode = false,
|
|
2069
2242
|
defaultColorMode = "light",
|
|
2070
2243
|
locale = "en-US"
|
|
2071
2244
|
}) {
|
|
2072
2245
|
const system = themeOverrides ? createAbpSystem(themeOverrides) : abpSystem;
|
|
2073
2246
|
const { endSide } = useDirection();
|
|
2074
|
-
|
|
2247
|
+
const resolvedToastPosition = endSide === "left" ? "bottom-left" : "bottom-right";
|
|
2075
2248
|
const content = /* @__PURE__ */ jsx16(ToasterProvider, { children: /* @__PURE__ */ jsxs11(ConfirmationProvider, { children: [
|
|
2076
2249
|
children,
|
|
2077
|
-
renderToasts && /* @__PURE__ */ jsx16(ToastContainer, { position:
|
|
2250
|
+
renderToasts && /* @__PURE__ */ jsx16(ToastContainer, { position: resolvedToastPosition }),
|
|
2078
2251
|
renderConfirmation && /* @__PURE__ */ jsx16(ConfirmationDialog, {})
|
|
2079
2252
|
] }) });
|
|
2080
2253
|
const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
|
|
2081
2254
|
return /* @__PURE__ */ jsx16(ChakraProvider, { value: system, children: /* @__PURE__ */ jsx16(LocaleProvider, { locale, children: /* @__PURE__ */ jsx16(ColorModeProvider, { ...colorModeProps, children: content }) }) });
|
|
2082
2255
|
}
|
|
2083
2256
|
|
|
2257
|
+
// src/providers/route.provider.ts
|
|
2258
|
+
import { getRoutesService } from "@abpjs/core";
|
|
2259
|
+
|
|
2260
|
+
// src/enums/route-names.ts
|
|
2261
|
+
var eThemeSharedRouteNames = /* @__PURE__ */ ((eThemeSharedRouteNames2) => {
|
|
2262
|
+
eThemeSharedRouteNames2["Administration"] = "AbpUiNavigation::Menu:Administration";
|
|
2263
|
+
return eThemeSharedRouteNames2;
|
|
2264
|
+
})(eThemeSharedRouteNames || {});
|
|
2265
|
+
|
|
2266
|
+
// src/providers/route.provider.ts
|
|
2267
|
+
function configureRoutes(routes) {
|
|
2268
|
+
return () => {
|
|
2269
|
+
routes.add([
|
|
2270
|
+
{
|
|
2271
|
+
name: "AbpUiNavigation::Menu:Administration" /* Administration */,
|
|
2272
|
+
path: "",
|
|
2273
|
+
order: 100,
|
|
2274
|
+
iconClass: "fa fa-wrench"
|
|
2275
|
+
}
|
|
2276
|
+
]);
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
var THEME_SHARED_ROUTE_PROVIDERS = {
|
|
2280
|
+
configureRoutes
|
|
2281
|
+
};
|
|
2282
|
+
function initializeThemeSharedRoutes() {
|
|
2283
|
+
const routesService = getRoutesService();
|
|
2284
|
+
configureRoutes(routesService)();
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2084
2287
|
// src/handlers/lazy-style.handler.ts
|
|
2085
|
-
import { useEffect as
|
|
2288
|
+
import { useEffect as useEffect8, useRef as useRef7, useState as useState7 } from "react";
|
|
2086
2289
|
import { LazyLoadService } from "@abpjs/core";
|
|
2087
2290
|
function createLazyStyleHref(style, dir) {
|
|
2088
2291
|
return style.replace("{{dir}}", dir);
|
|
2089
2292
|
}
|
|
2090
2293
|
function useLazyStyleHandler(options = {}) {
|
|
2091
2294
|
const { styles = [BOOTSTRAP], initialDirection = "ltr" } = options;
|
|
2092
|
-
const [direction, setDirection] =
|
|
2295
|
+
const [direction, setDirection] = useState7(initialDirection);
|
|
2093
2296
|
const lazyLoadRef = useRef7(new LazyLoadService());
|
|
2094
2297
|
const loadedStylesRef = useRef7(/* @__PURE__ */ new Map());
|
|
2095
|
-
|
|
2298
|
+
useEffect8(() => {
|
|
2096
2299
|
document.body.dir = direction;
|
|
2097
2300
|
const switchCSS = async () => {
|
|
2098
2301
|
const lazyLoad = lazyLoadRef.current;
|
|
@@ -2219,44 +2422,6 @@ function injectThemeSharedStyles() {
|
|
|
2219
2422
|
};
|
|
2220
2423
|
}
|
|
2221
2424
|
|
|
2222
|
-
// src/utils/nav-items.ts
|
|
2223
|
-
var navItems = [];
|
|
2224
|
-
var subscribers = /* @__PURE__ */ new Set();
|
|
2225
|
-
function addNavItem(item) {
|
|
2226
|
-
navItems = [...navItems, item].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
2227
|
-
notifySubscribers();
|
|
2228
|
-
}
|
|
2229
|
-
function removeNavItem(item) {
|
|
2230
|
-
navItems = navItems.filter((i) => i !== item);
|
|
2231
|
-
notifySubscribers();
|
|
2232
|
-
}
|
|
2233
|
-
function clearNavItems() {
|
|
2234
|
-
navItems = [];
|
|
2235
|
-
notifySubscribers();
|
|
2236
|
-
}
|
|
2237
|
-
function getNavItemsSync() {
|
|
2238
|
-
return [...navItems];
|
|
2239
|
-
}
|
|
2240
|
-
function subscribeToNavItems(callback) {
|
|
2241
|
-
subscribers.add(callback);
|
|
2242
|
-
callback([...navItems]);
|
|
2243
|
-
return () => {
|
|
2244
|
-
subscribers.delete(callback);
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2247
|
-
function notifySubscribers() {
|
|
2248
|
-
const currentItems = [...navItems];
|
|
2249
|
-
subscribers.forEach((callback) => callback(currentItems));
|
|
2250
|
-
}
|
|
2251
|
-
function getNavItems() {
|
|
2252
|
-
return {
|
|
2253
|
-
subscribe: (callback) => {
|
|
2254
|
-
const unsubscribe = subscribeToNavItems(callback);
|
|
2255
|
-
return { unsubscribe };
|
|
2256
|
-
}
|
|
2257
|
-
};
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
2425
|
// src/utils/validation-utils.ts
|
|
2261
2426
|
var PASSWORD_SETTING_KEYS = {
|
|
2262
2427
|
requiredLength: "Abp.Identity.Password.RequiredLength",
|
|
@@ -2383,6 +2548,8 @@ export {
|
|
|
2383
2548
|
Confirmation,
|
|
2384
2549
|
ConfirmationDialog,
|
|
2385
2550
|
ConfirmationProvider,
|
|
2551
|
+
DEFAULT_ERROR_LOCALIZATIONS,
|
|
2552
|
+
DEFAULT_ERROR_MESSAGES,
|
|
2386
2553
|
DEFAULT_LAZY_STYLES,
|
|
2387
2554
|
DEFAULT_STYLES,
|
|
2388
2555
|
ErrorComponent,
|
|
@@ -2398,26 +2565,27 @@ export {
|
|
|
2398
2565
|
AbpModalFooter as ModalFooter,
|
|
2399
2566
|
AbpModalHeader as ModalHeader,
|
|
2400
2567
|
ModalProvider,
|
|
2568
|
+
NavItem,
|
|
2569
|
+
NavItemsService,
|
|
2401
2570
|
PASSWORD_SETTING_KEYS,
|
|
2402
2571
|
Profile,
|
|
2403
2572
|
THEME_SHARED_APPEND_CONTENT,
|
|
2573
|
+
THEME_SHARED_ROUTE_PROVIDERS,
|
|
2404
2574
|
THEME_SHARED_STYLES,
|
|
2405
2575
|
ThemeSharedAppendContentContext,
|
|
2406
2576
|
ThemeSharedProvider,
|
|
2407
2577
|
ToastContainer,
|
|
2408
|
-
Toaster,
|
|
2409
2578
|
ToasterProvider,
|
|
2410
2579
|
abpSystem,
|
|
2411
|
-
|
|
2412
|
-
clearNavItems,
|
|
2580
|
+
configureRoutes,
|
|
2413
2581
|
createAbpSystem,
|
|
2414
2582
|
createErrorInterceptor,
|
|
2415
2583
|
createLazyStyleHref,
|
|
2416
2584
|
defaultAbpConfig,
|
|
2417
2585
|
defineConfig,
|
|
2586
|
+
eThemeSharedRouteNames,
|
|
2418
2587
|
getLoadedBootstrapDirection,
|
|
2419
|
-
|
|
2420
|
-
getNavItemsSync,
|
|
2588
|
+
getNavItemsService,
|
|
2421
2589
|
getPasswordSettings,
|
|
2422
2590
|
getPasswordValidationRules,
|
|
2423
2591
|
getPasswordValidators,
|
|
@@ -2426,9 +2594,8 @@ export {
|
|
|
2426
2594
|
getSeverityColorPalette as getSeverityColorScheme,
|
|
2427
2595
|
httpErrorConfigFactory,
|
|
2428
2596
|
initLazyStyleHandler,
|
|
2597
|
+
initializeThemeSharedRoutes,
|
|
2429
2598
|
injectThemeSharedStyles,
|
|
2430
|
-
removeNavItem,
|
|
2431
|
-
subscribeToNavItems,
|
|
2432
2599
|
useConfirmation,
|
|
2433
2600
|
useConfirmationContext,
|
|
2434
2601
|
useConfirmationState,
|
|
@@ -2439,6 +2606,7 @@ export {
|
|
|
2439
2606
|
useModal,
|
|
2440
2607
|
useModalContext,
|
|
2441
2608
|
useModalState,
|
|
2609
|
+
useNavItems,
|
|
2442
2610
|
useToaster,
|
|
2443
2611
|
useToasterContext,
|
|
2444
2612
|
useToasts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Confirmation namespace containing types for confirmation dialogs.
|
|
3
|
-
* Translated from @abp/ng.theme.shared/lib/models/confirmation.ts
|
|
3
|
+
* Translated from @abp/ng.theme.shared/lib/models/confirmation.ts v3.0.0
|
|
4
4
|
*
|
|
5
5
|
* @since 2.0.0 - Major changes:
|
|
6
6
|
* - Options no longer extends Toaster.Options
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @since 2.1.0 - Added Status enum (confirmation-specific, replaces Toaster.Status usage)
|
|
12
12
|
* @since 2.9.0 - Added dismissible property, deprecated closable
|
|
13
|
+
* @since 3.0.0 - Removed closable property (use dismissible instead)
|
|
13
14
|
*/
|
|
14
15
|
import type { Config } from '@abpjs/core';
|
|
15
16
|
export declare namespace Confirmation {
|
|
16
17
|
/**
|
|
17
18
|
* Options for configuring a confirmation dialog.
|
|
18
19
|
* @since 2.0.0 - No longer extends Toaster.Options
|
|
19
|
-
* @since
|
|
20
|
+
* @since 3.0.0 - Removed closable (use dismissible instead)
|
|
20
21
|
*/
|
|
21
22
|
interface Options {
|
|
22
23
|
/** Unique identifier for the confirmation */
|
|
@@ -38,11 +39,6 @@ export declare namespace Confirmation {
|
|
|
38
39
|
cancelText?: Config.LocalizationParam;
|
|
39
40
|
/** Custom text for the yes button */
|
|
40
41
|
yesText?: Config.LocalizationParam;
|
|
41
|
-
/**
|
|
42
|
-
* Whether the confirmation can be closed by clicking outside or pressing escape.
|
|
43
|
-
* @deprecated Use dismissible instead. To be deleted in v3.0.
|
|
44
|
-
*/
|
|
45
|
-
closable?: boolean;
|
|
46
42
|
}
|
|
47
43
|
/**
|
|
48
44
|
* Dialog data structure for confirmation dialogs.
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Models barrel export
|
|
3
|
+
* @since 3.0.0 - Removed setting-management (now in @abpjs/core SettingTabsService)
|
|
4
|
+
* @since 3.0.0 - Added nav-item model
|
|
5
|
+
*/
|
|
1
6
|
export * from './common';
|
|
2
|
-
export * from './toaster';
|
|
3
7
|
export * from './confirmation';
|
|
4
|
-
export * from './
|
|
8
|
+
export * from './nav-item';
|
|
5
9
|
export * from './statistics';
|
|
10
|
+
export * from './toaster';
|