@abpjs/theme-shared 2.4.0 → 2.9.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/errors/ErrorComponent.d.ts +27 -1
- package/dist/constants/styles.d.ts +9 -1
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/modal.context.d.ts +139 -0
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/lazy-style.handler.d.ts +96 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +657 -271
- package/dist/index.mjs +554 -189
- package/dist/models/common.d.ts +16 -1
- package/dist/models/confirmation.d.ts +12 -2
- package/dist/tokens/append-content.token.d.ts +7 -0
- package/dist/tokens/http-error.token.d.ts +70 -0
- package/dist/tokens/index.d.ts +10 -0
- package/dist/tokens/lazy-styles.token.d.ts +38 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/nav-items.d.ts +110 -0
- package/dist/utils/validation-utils.d.ts +125 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ var Confirmation;
|
|
|
21
21
|
})(Confirmation || (Confirmation = {}));
|
|
22
22
|
|
|
23
23
|
// src/constants/styles.ts
|
|
24
|
+
var BOOTSTRAP = "bootstrap-{{dir}}.min.css";
|
|
24
25
|
var DEFAULT_STYLES = `
|
|
25
26
|
.is-invalid .form-control {
|
|
26
27
|
border-color: #dc3545;
|
|
@@ -36,6 +37,11 @@ var DEFAULT_STYLES = `
|
|
|
36
37
|
text-align: right;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
/* RTL support - @since 2.9.0 */
|
|
41
|
+
[dir=rtl] .data-tables-filter {
|
|
42
|
+
text-align: left;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
.pointer {
|
|
40
46
|
cursor: pointer;
|
|
41
47
|
}
|
|
@@ -202,10 +208,34 @@ import { createContext } from "react";
|
|
|
202
208
|
var ThemeSharedAppendContentContext = createContext(void 0);
|
|
203
209
|
var THEME_SHARED_APPEND_CONTENT = "THEME_SHARED_APPEND_CONTENT";
|
|
204
210
|
|
|
211
|
+
// src/tokens/http-error.token.ts
|
|
212
|
+
import { createContext as createContext2, useContext } from "react";
|
|
213
|
+
var HTTP_ERROR_CONFIG = "HTTP_ERROR_CONFIG";
|
|
214
|
+
var HttpErrorConfigContext = createContext2(void 0);
|
|
215
|
+
function httpErrorConfigFactory() {
|
|
216
|
+
return {
|
|
217
|
+
skipHandledErrorCodes: [],
|
|
218
|
+
errorScreen: void 0
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function useHttpErrorConfig() {
|
|
222
|
+
const context = useContext(HttpErrorConfigContext);
|
|
223
|
+
return context ?? httpErrorConfigFactory();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/tokens/lazy-styles.token.ts
|
|
227
|
+
import { createContext as createContext3, useContext as useContext2 } from "react";
|
|
228
|
+
var DEFAULT_LAZY_STYLES = [BOOTSTRAP];
|
|
229
|
+
var LazyStylesContext = createContext3(DEFAULT_LAZY_STYLES);
|
|
230
|
+
function useLazyStyles() {
|
|
231
|
+
return useContext2(LazyStylesContext);
|
|
232
|
+
}
|
|
233
|
+
var LAZY_STYLES = DEFAULT_LAZY_STYLES;
|
|
234
|
+
|
|
205
235
|
// src/contexts/toaster.context.tsx
|
|
206
236
|
import {
|
|
207
|
-
createContext as
|
|
208
|
-
useContext,
|
|
237
|
+
createContext as createContext4,
|
|
238
|
+
useContext as useContext3,
|
|
209
239
|
useCallback,
|
|
210
240
|
useState,
|
|
211
241
|
useRef,
|
|
@@ -213,7 +243,7 @@ import {
|
|
|
213
243
|
useEffect
|
|
214
244
|
} from "react";
|
|
215
245
|
import { jsx } from "react/jsx-runtime";
|
|
216
|
-
var ToasterContext =
|
|
246
|
+
var ToasterContext = createContext4(null);
|
|
217
247
|
var toastCounter = 0;
|
|
218
248
|
function generateId() {
|
|
219
249
|
toastCounter += 1;
|
|
@@ -306,21 +336,21 @@ function ToasterProvider({ children }) {
|
|
|
306
336
|
return /* @__PURE__ */ jsx(ToasterContext.Provider, { value, children });
|
|
307
337
|
}
|
|
308
338
|
function useToaster() {
|
|
309
|
-
const context =
|
|
339
|
+
const context = useContext3(ToasterContext);
|
|
310
340
|
if (!context) {
|
|
311
341
|
throw new Error("useToaster must be used within a ToasterProvider");
|
|
312
342
|
}
|
|
313
343
|
return context.service;
|
|
314
344
|
}
|
|
315
345
|
function useToasts() {
|
|
316
|
-
const context =
|
|
346
|
+
const context = useContext3(ToasterContext);
|
|
317
347
|
if (!context) {
|
|
318
348
|
throw new Error("useToasts must be used within a ToasterProvider");
|
|
319
349
|
}
|
|
320
350
|
return context.toasts;
|
|
321
351
|
}
|
|
322
352
|
function useToasterContext() {
|
|
323
|
-
const context =
|
|
353
|
+
const context = useContext3(ToasterContext);
|
|
324
354
|
if (!context) {
|
|
325
355
|
throw new Error("useToasterContext must be used within a ToasterProvider");
|
|
326
356
|
}
|
|
@@ -329,8 +359,8 @@ function useToasterContext() {
|
|
|
329
359
|
|
|
330
360
|
// src/contexts/confirmation.context.tsx
|
|
331
361
|
import {
|
|
332
|
-
createContext as
|
|
333
|
-
useContext as
|
|
362
|
+
createContext as createContext5,
|
|
363
|
+
useContext as useContext4,
|
|
334
364
|
useCallback as useCallback2,
|
|
335
365
|
useState as useState2,
|
|
336
366
|
useRef as useRef2,
|
|
@@ -338,7 +368,7 @@ import {
|
|
|
338
368
|
useEffect as useEffect2
|
|
339
369
|
} from "react";
|
|
340
370
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
341
|
-
var ConfirmationContext =
|
|
371
|
+
var ConfirmationContext = createContext5(null);
|
|
342
372
|
function generateId2() {
|
|
343
373
|
return `confirmation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
344
374
|
}
|
|
@@ -445,29 +475,103 @@ function ConfirmationProvider({ children }) {
|
|
|
445
475
|
return /* @__PURE__ */ jsx2(ConfirmationContext.Provider, { value, children });
|
|
446
476
|
}
|
|
447
477
|
function useConfirmation() {
|
|
448
|
-
const context =
|
|
478
|
+
const context = useContext4(ConfirmationContext);
|
|
449
479
|
if (!context) {
|
|
450
480
|
throw new Error("useConfirmation must be used within a ConfirmationProvider");
|
|
451
481
|
}
|
|
452
482
|
return context.service;
|
|
453
483
|
}
|
|
454
484
|
function useConfirmationState() {
|
|
455
|
-
const context =
|
|
485
|
+
const context = useContext4(ConfirmationContext);
|
|
456
486
|
if (!context) {
|
|
457
487
|
throw new Error("useConfirmationState must be used within a ConfirmationProvider");
|
|
458
488
|
}
|
|
459
489
|
return { confirmation: context.confirmation, respond: context.respond };
|
|
460
490
|
}
|
|
461
491
|
function useConfirmationContext() {
|
|
462
|
-
const context =
|
|
492
|
+
const context = useContext4(ConfirmationContext);
|
|
463
493
|
if (!context) {
|
|
464
494
|
throw new Error("useConfirmationContext must be used within a ConfirmationProvider");
|
|
465
495
|
}
|
|
466
496
|
return context;
|
|
467
497
|
}
|
|
468
498
|
|
|
499
|
+
// src/contexts/modal.context.tsx
|
|
500
|
+
import {
|
|
501
|
+
createContext as createContext6,
|
|
502
|
+
useContext as useContext5,
|
|
503
|
+
useCallback as useCallback3,
|
|
504
|
+
useState as useState3,
|
|
505
|
+
useRef as useRef3,
|
|
506
|
+
useMemo as useMemo3
|
|
507
|
+
} from "react";
|
|
508
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
509
|
+
var ModalContext = createContext6(null);
|
|
510
|
+
function ModalProvider({ children }) {
|
|
511
|
+
const [modalState, setModalState] = useState3(null);
|
|
512
|
+
const [, setUpdateCounter] = useState3(0);
|
|
513
|
+
const containerRef = useRef3(null);
|
|
514
|
+
const renderTemplate = useCallback3((render, context) => {
|
|
515
|
+
setModalState({ render, context });
|
|
516
|
+
}, []);
|
|
517
|
+
const clearModal = useCallback3(() => {
|
|
518
|
+
setModalState(null);
|
|
519
|
+
}, []);
|
|
520
|
+
const getContainer = useCallback3(() => {
|
|
521
|
+
return containerRef;
|
|
522
|
+
}, []);
|
|
523
|
+
const detectChanges = useCallback3(() => {
|
|
524
|
+
setUpdateCounter((prev) => prev + 1);
|
|
525
|
+
}, []);
|
|
526
|
+
const service = useMemo3(
|
|
527
|
+
() => ({
|
|
528
|
+
renderTemplate,
|
|
529
|
+
clearModal,
|
|
530
|
+
getContainer,
|
|
531
|
+
detectChanges
|
|
532
|
+
}),
|
|
533
|
+
[renderTemplate, clearModal, getContainer, detectChanges]
|
|
534
|
+
);
|
|
535
|
+
const value = useMemo3(
|
|
536
|
+
() => ({ service, modalState }),
|
|
537
|
+
[service, modalState]
|
|
538
|
+
);
|
|
539
|
+
return /* @__PURE__ */ jsxs(ModalContext.Provider, { value, children: [
|
|
540
|
+
children,
|
|
541
|
+
/* @__PURE__ */ jsx3("div", { ref: containerRef, id: "modal-container" })
|
|
542
|
+
] });
|
|
543
|
+
}
|
|
544
|
+
function useModal() {
|
|
545
|
+
const context = useContext5(ModalContext);
|
|
546
|
+
if (!context) {
|
|
547
|
+
throw new Error("useModal must be used within a ModalProvider");
|
|
548
|
+
}
|
|
549
|
+
return context.service;
|
|
550
|
+
}
|
|
551
|
+
function useModalState() {
|
|
552
|
+
const context = useContext5(ModalContext);
|
|
553
|
+
if (!context) {
|
|
554
|
+
throw new Error("useModalState must be used within a ModalProvider");
|
|
555
|
+
}
|
|
556
|
+
return context.modalState;
|
|
557
|
+
}
|
|
558
|
+
function useModalContext() {
|
|
559
|
+
const context = useContext5(ModalContext);
|
|
560
|
+
if (!context) {
|
|
561
|
+
throw new Error("useModalContext must be used within a ModalProvider");
|
|
562
|
+
}
|
|
563
|
+
return context;
|
|
564
|
+
}
|
|
565
|
+
function ModalContainer() {
|
|
566
|
+
const modalState = useModalState();
|
|
567
|
+
if (!modalState) {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
return modalState.render(modalState.context);
|
|
571
|
+
}
|
|
572
|
+
|
|
469
573
|
// src/handlers/error.handler.ts
|
|
470
|
-
import { useCallback as
|
|
574
|
+
import { useCallback as useCallback4, useState as useState4 } from "react";
|
|
471
575
|
var DEFAULT_ERROR_MESSAGES = {
|
|
472
576
|
400: "AbpUi::DefaultErrorMessage400",
|
|
473
577
|
401: "AbpUi::DefaultErrorMessage401",
|
|
@@ -479,22 +583,22 @@ var DEFAULT_ERROR_MESSAGES = {
|
|
|
479
583
|
function useErrorHandler(options = {}) {
|
|
480
584
|
const { navigate, loginPath = "/account/login" } = options;
|
|
481
585
|
const confirmation = useConfirmation();
|
|
482
|
-
const [errorComponentProps, setErrorComponentProps] =
|
|
483
|
-
const navigateToLogin =
|
|
586
|
+
const [errorComponentProps, setErrorComponentProps] = useState4(null);
|
|
587
|
+
const navigateToLogin = useCallback4(() => {
|
|
484
588
|
if (navigate) {
|
|
485
589
|
navigate(loginPath);
|
|
486
590
|
}
|
|
487
591
|
}, [navigate, loginPath]);
|
|
488
|
-
const showError =
|
|
592
|
+
const showError = useCallback4(
|
|
489
593
|
async (message, title) => {
|
|
490
594
|
return confirmation.error(message, title || "AbpUi::Error");
|
|
491
595
|
},
|
|
492
596
|
[confirmation]
|
|
493
597
|
);
|
|
494
|
-
const clearErrorComponent =
|
|
598
|
+
const clearErrorComponent = useCallback4(() => {
|
|
495
599
|
setErrorComponentProps(null);
|
|
496
600
|
}, []);
|
|
497
|
-
const createErrorComponent =
|
|
601
|
+
const createErrorComponent = useCallback4(
|
|
498
602
|
(instance) => {
|
|
499
603
|
const props = {
|
|
500
604
|
title: instance.title || "Error",
|
|
@@ -507,7 +611,7 @@ function useErrorHandler(options = {}) {
|
|
|
507
611
|
},
|
|
508
612
|
[clearErrorComponent]
|
|
509
613
|
);
|
|
510
|
-
const handleError =
|
|
614
|
+
const handleError = useCallback4(
|
|
511
615
|
async (error) => {
|
|
512
616
|
if (error.status === 401) {
|
|
513
617
|
navigateToLogin();
|
|
@@ -549,7 +653,7 @@ function isHttpErrorResponse(error) {
|
|
|
549
653
|
}
|
|
550
654
|
|
|
551
655
|
// src/components/toast/Toast.tsx
|
|
552
|
-
import { useEffect as useEffect3, useRef as
|
|
656
|
+
import { useEffect as useEffect3, useRef as useRef4, useMemo as useMemo4 } from "react";
|
|
553
657
|
import {
|
|
554
658
|
Toaster as ChakraToaster,
|
|
555
659
|
Portal,
|
|
@@ -568,7 +672,7 @@ import {
|
|
|
568
672
|
XCircle,
|
|
569
673
|
Circle
|
|
570
674
|
} from "lucide-react";
|
|
571
|
-
import { jsx as
|
|
675
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
572
676
|
function resolveLocalizationParam(param) {
|
|
573
677
|
if (param === void 0) return void 0;
|
|
574
678
|
if (typeof param === "string") return param;
|
|
@@ -578,16 +682,16 @@ function SeverityIcon({ severity }) {
|
|
|
578
682
|
const iconProps = { size: 20 };
|
|
579
683
|
switch (severity) {
|
|
580
684
|
case "success":
|
|
581
|
-
return /* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ jsx4(CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
582
686
|
case "info":
|
|
583
|
-
return /* @__PURE__ */
|
|
687
|
+
return /* @__PURE__ */ jsx4(Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
584
688
|
case "warning":
|
|
585
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ jsx4(AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
586
690
|
case "error":
|
|
587
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsx4(XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
588
692
|
case "neutral":
|
|
589
693
|
default:
|
|
590
|
-
return /* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ jsx4(Circle, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
591
695
|
}
|
|
592
696
|
}
|
|
593
697
|
function getSeverityColorPalette(severity) {
|
|
@@ -682,10 +786,10 @@ function getToaster(placement) {
|
|
|
682
786
|
function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
683
787
|
const { toasts, service } = useToasterContext();
|
|
684
788
|
const { t } = useLocalization();
|
|
685
|
-
const displayedToastsRef =
|
|
686
|
-
const placement =
|
|
687
|
-
const toaster =
|
|
688
|
-
const filteredToasts =
|
|
789
|
+
const displayedToastsRef = useRef4(/* @__PURE__ */ new Set());
|
|
790
|
+
const placement = useMemo4(() => getPlacement(position), [position]);
|
|
791
|
+
const toaster = useMemo4(() => getToaster(placement), [placement]);
|
|
792
|
+
const filteredToasts = useMemo4(() => {
|
|
689
793
|
if (!containerKey) return toasts;
|
|
690
794
|
return toasts.filter((toast) => toast.options?.containerKey === containerKey);
|
|
691
795
|
}, [toasts, containerKey]);
|
|
@@ -722,10 +826,10 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
722
826
|
});
|
|
723
827
|
});
|
|
724
828
|
}, [filteredToasts, t, service, toaster]);
|
|
725
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsx4(Portal, { children: /* @__PURE__ */ jsx4(ChakraToaster, { toaster, insetInline: { mdDown: "4" }, children: (toast) => {
|
|
726
830
|
const severity = toast.meta?.severity || "info";
|
|
727
831
|
const closable = toast.meta?.closable !== false;
|
|
728
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ jsx4(
|
|
729
833
|
Toast.Root,
|
|
730
834
|
{
|
|
731
835
|
bg: getSeverityBg(severity),
|
|
@@ -734,13 +838,13 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
734
838
|
borderRadius: "lg",
|
|
735
839
|
boxShadow: "lg",
|
|
736
840
|
width: { md: "sm" },
|
|
737
|
-
children: /* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
toast.title && /* @__PURE__ */
|
|
741
|
-
toast.description && /* @__PURE__ */
|
|
841
|
+
children: /* @__PURE__ */ jsxs2(Flex, { align: "flex-start", gap: 3, p: 4, children: [
|
|
842
|
+
/* @__PURE__ */ jsx4(Box, { flexShrink: 0, pt: "2px", children: /* @__PURE__ */ jsx4(SeverityIcon, { severity }) }),
|
|
843
|
+
/* @__PURE__ */ jsxs2(Stack, { gap: 1, flex: 1, children: [
|
|
844
|
+
toast.title && /* @__PURE__ */ jsx4(Toast.Title, { fontWeight: "bold", fontSize: "sm", color: "fg", children: toast.title }),
|
|
845
|
+
toast.description && /* @__PURE__ */ jsx4(Toast.Description, { fontSize: "sm", color: "gray.700", children: toast.description })
|
|
742
846
|
] }),
|
|
743
|
-
closable && /* @__PURE__ */
|
|
847
|
+
closable && /* @__PURE__ */ jsx4(Toast.CloseTrigger, { asChild: true, children: /* @__PURE__ */ jsx4(CloseButton, { size: "sm" }) })
|
|
744
848
|
] })
|
|
745
849
|
}
|
|
746
850
|
);
|
|
@@ -748,7 +852,7 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
748
852
|
}
|
|
749
853
|
|
|
750
854
|
// src/components/confirmation/Confirmation.tsx
|
|
751
|
-
import { useRef as
|
|
855
|
+
import { useRef as useRef5 } from "react";
|
|
752
856
|
import {
|
|
753
857
|
Dialog,
|
|
754
858
|
Portal as Portal2,
|
|
@@ -764,7 +868,7 @@ import {
|
|
|
764
868
|
XCircle as XCircle2,
|
|
765
869
|
Circle as Circle2
|
|
766
870
|
} from "lucide-react";
|
|
767
|
-
import { jsx as
|
|
871
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
768
872
|
function resolveLocalizationParam2(param) {
|
|
769
873
|
if (param === void 0) return void 0;
|
|
770
874
|
if (typeof param === "string") return param;
|
|
@@ -779,16 +883,16 @@ function SeverityIcon2({ severity }) {
|
|
|
779
883
|
const iconProps = { size: 24 };
|
|
780
884
|
switch (severity) {
|
|
781
885
|
case "success":
|
|
782
|
-
return /* @__PURE__ */
|
|
886
|
+
return /* @__PURE__ */ jsx5(CheckCircle2, { ...iconProps, color: "var(--chakra-colors-green-500)" });
|
|
783
887
|
case "info":
|
|
784
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ jsx5(Info2, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
|
|
785
889
|
case "warning":
|
|
786
|
-
return /* @__PURE__ */
|
|
890
|
+
return /* @__PURE__ */ jsx5(AlertTriangle2, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
|
|
787
891
|
case "error":
|
|
788
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ jsx5(XCircle2, { ...iconProps, color: "var(--chakra-colors-red-500)" });
|
|
789
893
|
case "neutral":
|
|
790
894
|
default:
|
|
791
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ jsx5(Circle2, { ...iconProps, color: "var(--chakra-colors-gray-500)" });
|
|
792
896
|
}
|
|
793
897
|
}
|
|
794
898
|
function getSeverityColorPalette2(severity) {
|
|
@@ -809,7 +913,7 @@ function getSeverityColorPalette2(severity) {
|
|
|
809
913
|
function ConfirmationDialog({ className }) {
|
|
810
914
|
const { confirmation, respond } = useConfirmationState();
|
|
811
915
|
const { t } = useLocalization2();
|
|
812
|
-
const cancelRef =
|
|
916
|
+
const cancelRef = useRef5(null);
|
|
813
917
|
if (!confirmation) {
|
|
814
918
|
return null;
|
|
815
919
|
}
|
|
@@ -839,7 +943,7 @@ function ConfirmationDialog({ className }) {
|
|
|
839
943
|
handleDismiss();
|
|
840
944
|
}
|
|
841
945
|
};
|
|
842
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ jsx5(
|
|
843
947
|
Dialog.Root,
|
|
844
948
|
{
|
|
845
949
|
open: true,
|
|
@@ -847,16 +951,16 @@ function ConfirmationDialog({ className }) {
|
|
|
847
951
|
role: "alertdialog",
|
|
848
952
|
placement: "center",
|
|
849
953
|
initialFocusEl: () => cancelRef.current,
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
localizedTitle && /* @__PURE__ */
|
|
954
|
+
children: /* @__PURE__ */ jsxs3(Portal2, { children: [
|
|
955
|
+
/* @__PURE__ */ jsx5(Dialog.Backdrop, {}),
|
|
956
|
+
/* @__PURE__ */ jsx5(Dialog.Positioner, { children: /* @__PURE__ */ jsxs3(Dialog.Content, { className, maxWidth: "md", children: [
|
|
957
|
+
/* @__PURE__ */ jsx5(Dialog.Header, { children: /* @__PURE__ */ jsxs3(Flex2, { align: "center", gap: 3, children: [
|
|
958
|
+
/* @__PURE__ */ jsx5(SeverityIcon2, { severity }),
|
|
959
|
+
localizedTitle && /* @__PURE__ */ jsx5(Dialog.Title, { children: /* @__PURE__ */ jsx5(Text, { fontWeight: "bold", fontSize: "lg", children: localizedTitle }) })
|
|
856
960
|
] }) }),
|
|
857
|
-
/* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
!options?.hideCancelBtn && /* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsx5(Dialog.Body, { children: /* @__PURE__ */ jsx5(Text, { color: "gray.600", children: localizedMessage }) }),
|
|
962
|
+
/* @__PURE__ */ jsx5(Dialog.Footer, { children: /* @__PURE__ */ jsxs3(Flex2, { gap: 3, children: [
|
|
963
|
+
!options?.hideCancelBtn && /* @__PURE__ */ jsx5(
|
|
860
964
|
Button,
|
|
861
965
|
{
|
|
862
966
|
ref: cancelRef,
|
|
@@ -865,7 +969,7 @@ function ConfirmationDialog({ className }) {
|
|
|
865
969
|
children: cancelCopy
|
|
866
970
|
}
|
|
867
971
|
),
|
|
868
|
-
!options?.hideYesBtn && /* @__PURE__ */
|
|
972
|
+
!options?.hideYesBtn && /* @__PURE__ */ jsx5(
|
|
869
973
|
Button,
|
|
870
974
|
{
|
|
871
975
|
colorPalette: getSeverityColorPalette2(severity),
|
|
@@ -881,17 +985,20 @@ function ConfirmationDialog({ className }) {
|
|
|
881
985
|
}
|
|
882
986
|
|
|
883
987
|
// src/components/errors/ErrorComponent.tsx
|
|
884
|
-
import { Heading, Text as Text2, VStack, Button as Button2, Container } from "@chakra-ui/react";
|
|
885
|
-
import { jsx as
|
|
988
|
+
import { Box as Box2, Heading, Text as Text2, VStack, Button as Button2, Container } from "@chakra-ui/react";
|
|
989
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
886
990
|
function ErrorComponent({
|
|
887
991
|
title = "Error",
|
|
888
992
|
details = "An error has occurred.",
|
|
889
993
|
onDestroy,
|
|
890
994
|
showCloseButton = true,
|
|
891
|
-
closeButtonText = "Go Back"
|
|
995
|
+
closeButtonText = "Go Back",
|
|
996
|
+
isHomeShow = false,
|
|
997
|
+
onHomeClick,
|
|
998
|
+
homeButtonText = "Go Home"
|
|
892
999
|
}) {
|
|
893
|
-
return /* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ jsx6(Container, { maxW: "container.md", py: 20, children: /* @__PURE__ */ jsxs4(VStack, { gap: 6, textAlign: "center", children: [
|
|
1001
|
+
/* @__PURE__ */ jsx6(
|
|
895
1002
|
Heading,
|
|
896
1003
|
{
|
|
897
1004
|
size: "4xl",
|
|
@@ -900,23 +1007,34 @@ function ErrorComponent({
|
|
|
900
1007
|
children: title
|
|
901
1008
|
}
|
|
902
1009
|
),
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1010
|
+
/* @__PURE__ */ jsx6(Text2, { fontSize: "lg", color: "gray.600", children: details }),
|
|
1011
|
+
/* @__PURE__ */ jsxs4(Box2, { display: "flex", gap: 3, children: [
|
|
1012
|
+
isHomeShow && onHomeClick && /* @__PURE__ */ jsx6(
|
|
1013
|
+
Button2,
|
|
1014
|
+
{
|
|
1015
|
+
colorPalette: "green",
|
|
1016
|
+
size: "lg",
|
|
1017
|
+
onClick: onHomeClick,
|
|
1018
|
+
children: homeButtonText
|
|
1019
|
+
}
|
|
1020
|
+
),
|
|
1021
|
+
showCloseButton && onDestroy && /* @__PURE__ */ jsx6(
|
|
1022
|
+
Button2,
|
|
1023
|
+
{
|
|
1024
|
+
colorPalette: "blue",
|
|
1025
|
+
size: "lg",
|
|
1026
|
+
onClick: onDestroy,
|
|
1027
|
+
children: closeButtonText
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
] })
|
|
913
1031
|
] }) });
|
|
914
1032
|
}
|
|
915
1033
|
|
|
916
1034
|
// src/components/loader-bar/LoaderBar.tsx
|
|
917
|
-
import { useEffect as useEffect4, useRef as
|
|
1035
|
+
import { useEffect as useEffect4, useRef as useRef6, useState as useState5 } from "react";
|
|
918
1036
|
import { useLoader } from "@abpjs/core";
|
|
919
|
-
import { jsx as
|
|
1037
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
920
1038
|
function LoaderBar({
|
|
921
1039
|
containerClass = "abp-loader-bar",
|
|
922
1040
|
progressClass = "abp-progress",
|
|
@@ -925,9 +1043,9 @@ function LoaderBar({
|
|
|
925
1043
|
stopDelay = 400
|
|
926
1044
|
}) {
|
|
927
1045
|
const { loading } = useLoader();
|
|
928
|
-
const [isLoading, setIsLoading] =
|
|
929
|
-
const [progressLevel, setProgressLevel] =
|
|
930
|
-
const intervalRef =
|
|
1046
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
1047
|
+
const [progressLevel, setProgressLevel] = useState5(0);
|
|
1048
|
+
const intervalRef = useRef6(null);
|
|
931
1049
|
useEffect4(() => {
|
|
932
1050
|
if (loading) {
|
|
933
1051
|
startLoading();
|
|
@@ -975,7 +1093,7 @@ function LoaderBar({
|
|
|
975
1093
|
if (!isLoading && progressLevel === 0) {
|
|
976
1094
|
return null;
|
|
977
1095
|
}
|
|
978
|
-
return /* @__PURE__ */
|
|
1096
|
+
return /* @__PURE__ */ jsx7(
|
|
979
1097
|
"div",
|
|
980
1098
|
{
|
|
981
1099
|
className: containerClass,
|
|
@@ -989,7 +1107,7 @@ function LoaderBar({
|
|
|
989
1107
|
backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
990
1108
|
overflow: "hidden"
|
|
991
1109
|
},
|
|
992
|
-
children: /* @__PURE__ */
|
|
1110
|
+
children: /* @__PURE__ */ jsx7(
|
|
993
1111
|
"div",
|
|
994
1112
|
{
|
|
995
1113
|
className: progressClass,
|
|
@@ -1006,7 +1124,7 @@ function LoaderBar({
|
|
|
1006
1124
|
}
|
|
1007
1125
|
|
|
1008
1126
|
// src/components/modal/Modal.tsx
|
|
1009
|
-
import
|
|
1127
|
+
import React7 from "react";
|
|
1010
1128
|
import {
|
|
1011
1129
|
Dialog as Dialog2,
|
|
1012
1130
|
Portal as Portal3,
|
|
@@ -1016,7 +1134,7 @@ import {
|
|
|
1016
1134
|
Separator,
|
|
1017
1135
|
CloseButton as CloseButton2
|
|
1018
1136
|
} from "@chakra-ui/react";
|
|
1019
|
-
import { Fragment, jsx as
|
|
1137
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1020
1138
|
function getSizeWidth(size) {
|
|
1021
1139
|
switch (size) {
|
|
1022
1140
|
case "sm":
|
|
@@ -1054,12 +1172,12 @@ function Modal({
|
|
|
1054
1172
|
preventScroll = true,
|
|
1055
1173
|
onInit
|
|
1056
1174
|
}) {
|
|
1057
|
-
const prevVisibleRef =
|
|
1058
|
-
const onInitRef =
|
|
1059
|
-
|
|
1175
|
+
const prevVisibleRef = React7.useRef(false);
|
|
1176
|
+
const onInitRef = React7.useRef(onInit);
|
|
1177
|
+
React7.useEffect(() => {
|
|
1060
1178
|
onInitRef.current = onInit;
|
|
1061
1179
|
}, [onInit]);
|
|
1062
|
-
|
|
1180
|
+
React7.useEffect(() => {
|
|
1063
1181
|
if (visible && !prevVisibleRef.current && onInitRef.current) {
|
|
1064
1182
|
onInitRef.current();
|
|
1065
1183
|
}
|
|
@@ -1071,7 +1189,7 @@ function Modal({
|
|
|
1071
1189
|
}
|
|
1072
1190
|
onVisibleChange?.(details.open);
|
|
1073
1191
|
};
|
|
1074
|
-
return /* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ jsx8(
|
|
1075
1193
|
Dialog2.Root,
|
|
1076
1194
|
{
|
|
1077
1195
|
open: visible,
|
|
@@ -1083,9 +1201,9 @@ function Modal({
|
|
|
1083
1201
|
motionPreset,
|
|
1084
1202
|
trapFocus,
|
|
1085
1203
|
preventScroll,
|
|
1086
|
-
children: /* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1204
|
+
children: /* @__PURE__ */ jsxs5(Portal3, { children: [
|
|
1205
|
+
/* @__PURE__ */ jsx8(Dialog2.Backdrop, {}),
|
|
1206
|
+
/* @__PURE__ */ jsx8(Dialog2.Positioner, { children: /* @__PURE__ */ jsxs5(
|
|
1089
1207
|
Dialog2.Content,
|
|
1090
1208
|
{
|
|
1091
1209
|
className: modalClass,
|
|
@@ -1095,17 +1213,17 @@ function Modal({
|
|
|
1095
1213
|
height,
|
|
1096
1214
|
minHeight,
|
|
1097
1215
|
children: [
|
|
1098
|
-
(header || showCloseButton) && /* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
header && /* @__PURE__ */
|
|
1101
|
-
showCloseButton && /* @__PURE__ */
|
|
1216
|
+
(header || showCloseButton) && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1217
|
+
/* @__PURE__ */ jsx8(Dialog2.Header, { children: /* @__PURE__ */ jsxs5(Flex3, { justify: "space-between", align: "center", width: "100%", children: [
|
|
1218
|
+
header && /* @__PURE__ */ jsx8(Dialog2.Title, { children: /* @__PURE__ */ jsx8(Text3, { fontWeight: "bold", fontSize: "lg", children: header }) }),
|
|
1219
|
+
showCloseButton && /* @__PURE__ */ jsx8(Dialog2.CloseTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(CloseButton2, { size: "sm" }) })
|
|
1102
1220
|
] }) }),
|
|
1103
|
-
/* @__PURE__ */
|
|
1221
|
+
/* @__PURE__ */ jsx8(Separator, {})
|
|
1104
1222
|
] }),
|
|
1105
|
-
children && /* @__PURE__ */
|
|
1106
|
-
footer && /* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1223
|
+
children && /* @__PURE__ */ jsx8(Dialog2.Body, { py: 4, children }),
|
|
1224
|
+
footer && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx8(Separator, {}),
|
|
1226
|
+
/* @__PURE__ */ jsx8(Dialog2.Footer, { children: /* @__PURE__ */ jsx8(Flex3, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
|
|
1109
1227
|
] })
|
|
1110
1228
|
]
|
|
1111
1229
|
}
|
|
@@ -1115,18 +1233,18 @@ function Modal({
|
|
|
1115
1233
|
);
|
|
1116
1234
|
}
|
|
1117
1235
|
function AbpModalHeader({ children, className }) {
|
|
1118
|
-
return /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsx8(Text3, { fontWeight: "bold", fontSize: "lg", className, children });
|
|
1119
1237
|
}
|
|
1120
1238
|
function AbpModalBody({ children, className }) {
|
|
1121
|
-
return /* @__PURE__ */
|
|
1239
|
+
return /* @__PURE__ */ jsx8(Box3, { color: "gray.600", className, children });
|
|
1122
1240
|
}
|
|
1123
1241
|
function AbpModalFooter({ children, className }) {
|
|
1124
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsx8(Flex3, { gap: 3, justify: "flex-end", className, children });
|
|
1125
1243
|
}
|
|
1126
1244
|
|
|
1127
1245
|
// src/components/ui/Alert.tsx
|
|
1128
1246
|
import { Alert as ChakraAlert } from "@chakra-ui/react";
|
|
1129
|
-
import { Fragment as Fragment2, jsx as
|
|
1247
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1130
1248
|
function Alert({
|
|
1131
1249
|
status = "info",
|
|
1132
1250
|
children,
|
|
@@ -1137,7 +1255,7 @@ function Alert({
|
|
|
1137
1255
|
mb,
|
|
1138
1256
|
borderRadius = "md"
|
|
1139
1257
|
}) {
|
|
1140
|
-
return /* @__PURE__ */
|
|
1258
|
+
return /* @__PURE__ */ jsxs6(
|
|
1141
1259
|
ChakraAlert.Root,
|
|
1142
1260
|
{
|
|
1143
1261
|
status,
|
|
@@ -1145,11 +1263,11 @@ function Alert({
|
|
|
1145
1263
|
mb,
|
|
1146
1264
|
borderRadius,
|
|
1147
1265
|
children: [
|
|
1148
|
-
showIcon && /* @__PURE__ */
|
|
1149
|
-
title ? /* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1151
|
-
(description || children) && /* @__PURE__ */
|
|
1152
|
-
] }) : /* @__PURE__ */
|
|
1266
|
+
showIcon && /* @__PURE__ */ jsx9(ChakraAlert.Indicator, {}),
|
|
1267
|
+
title ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1268
|
+
/* @__PURE__ */ jsx9(ChakraAlert.Title, { children: title }),
|
|
1269
|
+
(description || children) && /* @__PURE__ */ jsx9(ChakraAlert.Description, { children: description || children })
|
|
1270
|
+
] }) : /* @__PURE__ */ jsx9(ChakraAlert.Title, { children })
|
|
1153
1271
|
]
|
|
1154
1272
|
}
|
|
1155
1273
|
);
|
|
@@ -1158,7 +1276,7 @@ function Alert({
|
|
|
1158
1276
|
// src/components/ui/Button.tsx
|
|
1159
1277
|
import { forwardRef } from "react";
|
|
1160
1278
|
import { Button as ChakraButton } from "@chakra-ui/react";
|
|
1161
|
-
import { jsx as
|
|
1279
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1162
1280
|
var Button3 = forwardRef(
|
|
1163
1281
|
function Button4({
|
|
1164
1282
|
children,
|
|
@@ -1175,7 +1293,7 @@ var Button3 = forwardRef(
|
|
|
1175
1293
|
mr,
|
|
1176
1294
|
ml
|
|
1177
1295
|
}, ref) {
|
|
1178
|
-
return /* @__PURE__ */
|
|
1296
|
+
return /* @__PURE__ */ jsx10(
|
|
1179
1297
|
ChakraButton,
|
|
1180
1298
|
{
|
|
1181
1299
|
ref,
|
|
@@ -1200,7 +1318,7 @@ var Button3 = forwardRef(
|
|
|
1200
1318
|
// src/components/ui/Checkbox.tsx
|
|
1201
1319
|
import { forwardRef as forwardRef2 } from "react";
|
|
1202
1320
|
import { Checkbox as ChakraCheckbox } from "@chakra-ui/react";
|
|
1203
|
-
import { jsx as
|
|
1321
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1204
1322
|
var Checkbox = forwardRef2(
|
|
1205
1323
|
function Checkbox2({
|
|
1206
1324
|
children,
|
|
@@ -1218,7 +1336,7 @@ var Checkbox = forwardRef2(
|
|
|
1218
1336
|
onChange,
|
|
1219
1337
|
className
|
|
1220
1338
|
}, ref) {
|
|
1221
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ jsxs7(
|
|
1222
1340
|
ChakraCheckbox.Root,
|
|
1223
1341
|
{
|
|
1224
1342
|
checked,
|
|
@@ -1231,7 +1349,7 @@ var Checkbox = forwardRef2(
|
|
|
1231
1349
|
size,
|
|
1232
1350
|
className,
|
|
1233
1351
|
children: [
|
|
1234
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ jsx11(
|
|
1235
1353
|
ChakraCheckbox.HiddenInput,
|
|
1236
1354
|
{
|
|
1237
1355
|
ref,
|
|
@@ -1241,8 +1359,8 @@ var Checkbox = forwardRef2(
|
|
|
1241
1359
|
onChange
|
|
1242
1360
|
}
|
|
1243
1361
|
),
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
children && /* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ jsx11(ChakraCheckbox.Control, {}),
|
|
1363
|
+
children && /* @__PURE__ */ jsx11(ChakraCheckbox.Label, { children })
|
|
1246
1364
|
]
|
|
1247
1365
|
}
|
|
1248
1366
|
);
|
|
@@ -1251,7 +1369,7 @@ var Checkbox = forwardRef2(
|
|
|
1251
1369
|
|
|
1252
1370
|
// src/components/ui/FormField.tsx
|
|
1253
1371
|
import { Field } from "@chakra-ui/react";
|
|
1254
|
-
import { jsx as
|
|
1372
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1255
1373
|
function FormField({
|
|
1256
1374
|
label,
|
|
1257
1375
|
invalid = false,
|
|
@@ -1263,14 +1381,14 @@ function FormField({
|
|
|
1263
1381
|
htmlFor,
|
|
1264
1382
|
className
|
|
1265
1383
|
}) {
|
|
1266
|
-
return /* @__PURE__ */
|
|
1267
|
-
label && /* @__PURE__ */
|
|
1384
|
+
return /* @__PURE__ */ jsxs8(Field.Root, { invalid, disabled, className, children: [
|
|
1385
|
+
label && /* @__PURE__ */ jsxs8(Field.Label, { htmlFor, children: [
|
|
1268
1386
|
label,
|
|
1269
|
-
required && /* @__PURE__ */
|
|
1387
|
+
required && /* @__PURE__ */ jsx12(Field.RequiredIndicator, {})
|
|
1270
1388
|
] }),
|
|
1271
1389
|
children,
|
|
1272
|
-
helperText && !invalid && /* @__PURE__ */
|
|
1273
|
-
invalid && errorText && /* @__PURE__ */
|
|
1390
|
+
helperText && !invalid && /* @__PURE__ */ jsx12(Field.HelperText, { children: helperText }),
|
|
1391
|
+
invalid && errorText && /* @__PURE__ */ jsx12(Field.ErrorText, { children: errorText })
|
|
1274
1392
|
] });
|
|
1275
1393
|
}
|
|
1276
1394
|
|
|
@@ -1285,7 +1403,7 @@ import {
|
|
|
1285
1403
|
import { useForm } from "react-hook-form";
|
|
1286
1404
|
import { useLocalization as useLocalization3, useProfile } from "@abpjs/core";
|
|
1287
1405
|
import { Check } from "lucide-react";
|
|
1288
|
-
import { Fragment as Fragment3, jsx as
|
|
1406
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1289
1407
|
function ChangePassword({
|
|
1290
1408
|
visible,
|
|
1291
1409
|
onVisibleChange
|
|
@@ -1348,9 +1466,9 @@ function ChangePassword({
|
|
|
1348
1466
|
hasSpecial: (value) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || t("AbpIdentity::PasswordRequiresNonAlphanumeric") || "Password must contain a special character"
|
|
1349
1467
|
}
|
|
1350
1468
|
};
|
|
1351
|
-
const modalFooter = /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1469
|
+
const modalFooter = /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1470
|
+
/* @__PURE__ */ jsx13(Button5, { variant: "ghost", mr: 3, onClick: handleClose, disabled: isSubmitting, children: t("AbpIdentity::Cancel") || "Cancel" }),
|
|
1471
|
+
/* @__PURE__ */ jsxs9(
|
|
1354
1472
|
Button5,
|
|
1355
1473
|
{
|
|
1356
1474
|
colorPalette: "blue",
|
|
@@ -1358,13 +1476,13 @@ function ChangePassword({
|
|
|
1358
1476
|
loading: isSubmitting,
|
|
1359
1477
|
form: "change-password-form",
|
|
1360
1478
|
children: [
|
|
1361
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ jsx13(Check, { size: 16 }),
|
|
1362
1480
|
t("AbpIdentity::Save") || "Save"
|
|
1363
1481
|
]
|
|
1364
1482
|
}
|
|
1365
1483
|
)
|
|
1366
1484
|
] });
|
|
1367
|
-
return /* @__PURE__ */
|
|
1485
|
+
return /* @__PURE__ */ jsx13(
|
|
1368
1486
|
Modal,
|
|
1369
1487
|
{
|
|
1370
1488
|
visible,
|
|
@@ -1373,13 +1491,13 @@ function ChangePassword({
|
|
|
1373
1491
|
header: t("AbpIdentity::ChangePassword") || "Change Password",
|
|
1374
1492
|
footer: modalFooter,
|
|
1375
1493
|
centered: true,
|
|
1376
|
-
children: /* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1494
|
+
children: /* @__PURE__ */ jsx13("form", { id: "change-password-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ jsxs9(VStack2, { gap: 4, children: [
|
|
1495
|
+
/* @__PURE__ */ jsxs9(Field2.Root, { invalid: !!errors.password, children: [
|
|
1496
|
+
/* @__PURE__ */ jsxs9(Field2.Label, { children: [
|
|
1379
1497
|
t("AbpIdentity::DisplayName:CurrentPassword") || "Current Password",
|
|
1380
|
-
/* @__PURE__ */
|
|
1498
|
+
/* @__PURE__ */ jsx13(Field2.RequiredIndicator, {})
|
|
1381
1499
|
] }),
|
|
1382
|
-
/* @__PURE__ */
|
|
1500
|
+
/* @__PURE__ */ jsx13(
|
|
1383
1501
|
Input,
|
|
1384
1502
|
{
|
|
1385
1503
|
type: "password",
|
|
@@ -1388,28 +1506,28 @@ function ChangePassword({
|
|
|
1388
1506
|
})
|
|
1389
1507
|
}
|
|
1390
1508
|
),
|
|
1391
|
-
/* @__PURE__ */
|
|
1509
|
+
/* @__PURE__ */ jsx13(Field2.ErrorText, { children: errors.password?.message })
|
|
1392
1510
|
] }),
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ jsxs9(Field2.Root, { invalid: !!errors.newPassword, children: [
|
|
1512
|
+
/* @__PURE__ */ jsxs9(Field2.Label, { children: [
|
|
1395
1513
|
t("AbpIdentity::DisplayName:NewPassword") || "New Password",
|
|
1396
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ jsx13(Field2.RequiredIndicator, {})
|
|
1397
1515
|
] }),
|
|
1398
|
-
/* @__PURE__ */
|
|
1516
|
+
/* @__PURE__ */ jsx13(
|
|
1399
1517
|
Input,
|
|
1400
1518
|
{
|
|
1401
1519
|
type: "password",
|
|
1402
1520
|
...register("newPassword", passwordValidation)
|
|
1403
1521
|
}
|
|
1404
1522
|
),
|
|
1405
|
-
/* @__PURE__ */
|
|
1523
|
+
/* @__PURE__ */ jsx13(Field2.ErrorText, { children: errors.newPassword?.message })
|
|
1406
1524
|
] }),
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ jsxs9(Field2.Root, { invalid: !!errors.repeatNewPassword, children: [
|
|
1526
|
+
/* @__PURE__ */ jsxs9(Field2.Label, { children: [
|
|
1409
1527
|
t("AbpIdentity::DisplayName:NewPasswordConfirm") || "Confirm New Password",
|
|
1410
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ jsx13(Field2.RequiredIndicator, {})
|
|
1411
1529
|
] }),
|
|
1412
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsx13(
|
|
1413
1531
|
Input,
|
|
1414
1532
|
{
|
|
1415
1533
|
type: "password",
|
|
@@ -1419,7 +1537,7 @@ function ChangePassword({
|
|
|
1419
1537
|
})
|
|
1420
1538
|
}
|
|
1421
1539
|
),
|
|
1422
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx13(Field2.ErrorText, { children: errors.repeatNewPassword?.message })
|
|
1423
1541
|
] })
|
|
1424
1542
|
] }) })
|
|
1425
1543
|
}
|
|
@@ -1438,7 +1556,7 @@ import {
|
|
|
1438
1556
|
import { useForm as useForm2 } from "react-hook-form";
|
|
1439
1557
|
import { useLocalization as useLocalization4, useProfile as useProfile2 } from "@abpjs/core";
|
|
1440
1558
|
import { Check as Check2 } from "lucide-react";
|
|
1441
|
-
import { Fragment as Fragment4, jsx as
|
|
1559
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1442
1560
|
function Profile({
|
|
1443
1561
|
visible,
|
|
1444
1562
|
onVisibleChange
|
|
@@ -1498,9 +1616,9 @@ function Profile({
|
|
|
1498
1616
|
onVisibleChange(false);
|
|
1499
1617
|
}
|
|
1500
1618
|
};
|
|
1501
|
-
const modalFooter = /* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1619
|
+
const modalFooter = /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1620
|
+
/* @__PURE__ */ jsx14(Button6, { variant: "ghost", mr: 3, onClick: handleClose, disabled: modalBusy, children: t("AbpIdentity::Cancel") || "Cancel" }),
|
|
1621
|
+
/* @__PURE__ */ jsxs10(
|
|
1504
1622
|
Button6,
|
|
1505
1623
|
{
|
|
1506
1624
|
colorPalette: "blue",
|
|
@@ -1508,13 +1626,13 @@ function Profile({
|
|
|
1508
1626
|
loading: modalBusy,
|
|
1509
1627
|
form: "profile-form",
|
|
1510
1628
|
children: [
|
|
1511
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ jsx14(Check2, { size: 16 }),
|
|
1512
1630
|
t("AbpIdentity::Save") || "Save"
|
|
1513
1631
|
]
|
|
1514
1632
|
}
|
|
1515
1633
|
)
|
|
1516
1634
|
] });
|
|
1517
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ jsx14(
|
|
1518
1636
|
Modal,
|
|
1519
1637
|
{
|
|
1520
1638
|
visible,
|
|
@@ -1524,13 +1642,13 @@ function Profile({
|
|
|
1524
1642
|
footer: modalFooter,
|
|
1525
1643
|
size: "lg",
|
|
1526
1644
|
centered: true,
|
|
1527
|
-
children: /* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1645
|
+
children: /* @__PURE__ */ jsx14("form", { id: "profile-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ jsxs10(VStack3, { gap: 4, children: [
|
|
1646
|
+
/* @__PURE__ */ jsxs10(Field3.Root, { invalid: !!errors.userName, children: [
|
|
1647
|
+
/* @__PURE__ */ jsxs10(Field3.Label, { children: [
|
|
1530
1648
|
t("AbpIdentity::DisplayName:UserName") || "Username",
|
|
1531
|
-
/* @__PURE__ */
|
|
1649
|
+
/* @__PURE__ */ jsx14(Field3.RequiredIndicator, {})
|
|
1532
1650
|
] }),
|
|
1533
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsx14(
|
|
1534
1652
|
Input2,
|
|
1535
1653
|
{
|
|
1536
1654
|
type: "text",
|
|
@@ -1543,12 +1661,12 @@ function Profile({
|
|
|
1543
1661
|
})
|
|
1544
1662
|
}
|
|
1545
1663
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ jsx14(Field3.ErrorText, { children: errors.userName?.message })
|
|
1547
1665
|
] }),
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ jsxs10(HStack, { gap: 4, w: "full", children: [
|
|
1667
|
+
/* @__PURE__ */ jsxs10(Field3.Root, { invalid: !!errors.name, flex: 1, children: [
|
|
1668
|
+
/* @__PURE__ */ jsx14(Field3.Label, { children: t("AbpIdentity::DisplayName:Name") || "Name" }),
|
|
1669
|
+
/* @__PURE__ */ jsx14(
|
|
1552
1670
|
Input2,
|
|
1553
1671
|
{
|
|
1554
1672
|
type: "text",
|
|
@@ -1560,11 +1678,11 @@ function Profile({
|
|
|
1560
1678
|
})
|
|
1561
1679
|
}
|
|
1562
1680
|
),
|
|
1563
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsx14(Field3.ErrorText, { children: errors.name?.message })
|
|
1564
1682
|
] }),
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ jsxs10(Field3.Root, { invalid: !!errors.surname, flex: 1, children: [
|
|
1684
|
+
/* @__PURE__ */ jsx14(Field3.Label, { children: t("AbpIdentity::DisplayName:Surname") || "Surname" }),
|
|
1685
|
+
/* @__PURE__ */ jsx14(
|
|
1568
1686
|
Input2,
|
|
1569
1687
|
{
|
|
1570
1688
|
type: "text",
|
|
@@ -1576,15 +1694,15 @@ function Profile({
|
|
|
1576
1694
|
})
|
|
1577
1695
|
}
|
|
1578
1696
|
),
|
|
1579
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsx14(Field3.ErrorText, { children: errors.surname?.message })
|
|
1580
1698
|
] })
|
|
1581
1699
|
] }),
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsxs10(Field3.Root, { invalid: !!errors.email, children: [
|
|
1701
|
+
/* @__PURE__ */ jsxs10(Field3.Label, { children: [
|
|
1584
1702
|
t("AbpIdentity::DisplayName:EmailAddress") || "Email Address",
|
|
1585
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ jsx14(Field3.RequiredIndicator, {})
|
|
1586
1704
|
] }),
|
|
1587
|
-
/* @__PURE__ */
|
|
1705
|
+
/* @__PURE__ */ jsx14(
|
|
1588
1706
|
Input2,
|
|
1589
1707
|
{
|
|
1590
1708
|
type: "email",
|
|
@@ -1601,11 +1719,11 @@ function Profile({
|
|
|
1601
1719
|
})
|
|
1602
1720
|
}
|
|
1603
1721
|
),
|
|
1604
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ jsx14(Field3.ErrorText, { children: errors.email?.message })
|
|
1605
1723
|
] }),
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ jsxs10(Field3.Root, { invalid: !!errors.phoneNumber, children: [
|
|
1725
|
+
/* @__PURE__ */ jsx14(Field3.Label, { children: t("AbpIdentity::DisplayName:PhoneNumber") || "Phone Number" }),
|
|
1726
|
+
/* @__PURE__ */ jsx14(
|
|
1609
1727
|
Input2,
|
|
1610
1728
|
{
|
|
1611
1729
|
type: "tel",
|
|
@@ -1617,7 +1735,7 @@ function Profile({
|
|
|
1617
1735
|
})
|
|
1618
1736
|
}
|
|
1619
1737
|
),
|
|
1620
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ jsx14(Field3.ErrorText, { children: errors.phoneNumber?.message })
|
|
1621
1739
|
] })
|
|
1622
1740
|
] }) })
|
|
1623
1741
|
}
|
|
@@ -1862,11 +1980,11 @@ var abpSystem = createAbpSystem();
|
|
|
1862
1980
|
// src/components/ui/color-mode.tsx
|
|
1863
1981
|
import { ClientOnly, IconButton, Skeleton, Span } from "@chakra-ui/react";
|
|
1864
1982
|
import { ThemeProvider, useTheme } from "next-themes";
|
|
1865
|
-
import * as
|
|
1983
|
+
import * as React12 from "react";
|
|
1866
1984
|
import { Moon, Sun } from "lucide-react";
|
|
1867
|
-
import { jsx as
|
|
1985
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1868
1986
|
function ColorModeProvider(props) {
|
|
1869
|
-
return /* @__PURE__ */
|
|
1987
|
+
return /* @__PURE__ */ jsx15(ThemeProvider, { attribute: "class", disableTransitionOnChange: true, ...props });
|
|
1870
1988
|
}
|
|
1871
1989
|
function useColorMode() {
|
|
1872
1990
|
const { resolvedTheme, setTheme, forcedTheme } = useTheme();
|
|
@@ -1882,11 +2000,11 @@ function useColorMode() {
|
|
|
1882
2000
|
}
|
|
1883
2001
|
function ColorModeIcon() {
|
|
1884
2002
|
const { colorMode } = useColorMode();
|
|
1885
|
-
return colorMode === "dark" ? /* @__PURE__ */
|
|
2003
|
+
return colorMode === "dark" ? /* @__PURE__ */ jsx15(Moon, {}) : /* @__PURE__ */ jsx15(Sun, {});
|
|
1886
2004
|
}
|
|
1887
|
-
var ColorModeButton =
|
|
2005
|
+
var ColorModeButton = React12.forwardRef(function ColorModeButton2(props, ref) {
|
|
1888
2006
|
const { toggleColorMode } = useColorMode();
|
|
1889
|
-
return /* @__PURE__ */
|
|
2007
|
+
return /* @__PURE__ */ jsx15(ClientOnly, { fallback: /* @__PURE__ */ jsx15(Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ jsx15(
|
|
1890
2008
|
IconButton,
|
|
1891
2009
|
{
|
|
1892
2010
|
onClick: toggleColorMode,
|
|
@@ -1901,13 +2019,13 @@ var ColorModeButton = React11.forwardRef(function ColorModeButton2(props, ref) {
|
|
|
1901
2019
|
height: "5"
|
|
1902
2020
|
}
|
|
1903
2021
|
},
|
|
1904
|
-
children: /* @__PURE__ */
|
|
2022
|
+
children: /* @__PURE__ */ jsx15(ColorModeIcon, {})
|
|
1905
2023
|
}
|
|
1906
2024
|
) });
|
|
1907
2025
|
});
|
|
1908
|
-
var LightMode =
|
|
2026
|
+
var LightMode = React12.forwardRef(
|
|
1909
2027
|
function LightMode2(props, ref) {
|
|
1910
|
-
return /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsx15(
|
|
1911
2029
|
Span,
|
|
1912
2030
|
{
|
|
1913
2031
|
color: "fg",
|
|
@@ -1921,9 +2039,9 @@ var LightMode = React11.forwardRef(
|
|
|
1921
2039
|
);
|
|
1922
2040
|
}
|
|
1923
2041
|
);
|
|
1924
|
-
var DarkMode =
|
|
2042
|
+
var DarkMode = React12.forwardRef(
|
|
1925
2043
|
function DarkMode2(props, ref) {
|
|
1926
|
-
return /* @__PURE__ */
|
|
2044
|
+
return /* @__PURE__ */ jsx15(
|
|
1927
2045
|
Span,
|
|
1928
2046
|
{
|
|
1929
2047
|
color: "fg",
|
|
@@ -1940,7 +2058,7 @@ var DarkMode = React11.forwardRef(
|
|
|
1940
2058
|
|
|
1941
2059
|
// src/providers/ThemeSharedProvider.tsx
|
|
1942
2060
|
import { useDirection } from "@abpjs/core";
|
|
1943
|
-
import { jsx as
|
|
2061
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1944
2062
|
function ThemeSharedProvider({
|
|
1945
2063
|
children,
|
|
1946
2064
|
renderToasts = true,
|
|
@@ -1954,13 +2072,80 @@ function ThemeSharedProvider({
|
|
|
1954
2072
|
const system = themeOverrides ? createAbpSystem(themeOverrides) : abpSystem;
|
|
1955
2073
|
const { endSide } = useDirection();
|
|
1956
2074
|
toastPosition = `bottom-${endSide}`;
|
|
1957
|
-
const content = /* @__PURE__ */
|
|
2075
|
+
const content = /* @__PURE__ */ jsx16(ToasterProvider, { children: /* @__PURE__ */ jsxs11(ConfirmationProvider, { children: [
|
|
1958
2076
|
children,
|
|
1959
|
-
renderToasts && /* @__PURE__ */
|
|
1960
|
-
renderConfirmation && /* @__PURE__ */
|
|
2077
|
+
renderToasts && /* @__PURE__ */ jsx16(ToastContainer, { position: toastPosition }),
|
|
2078
|
+
renderConfirmation && /* @__PURE__ */ jsx16(ConfirmationDialog, {})
|
|
1961
2079
|
] }) });
|
|
1962
2080
|
const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
|
|
1963
|
-
return /* @__PURE__ */
|
|
2081
|
+
return /* @__PURE__ */ jsx16(ChakraProvider, { value: system, children: /* @__PURE__ */ jsx16(LocaleProvider, { locale, children: /* @__PURE__ */ jsx16(ColorModeProvider, { ...colorModeProps, children: content }) }) });
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
// src/handlers/lazy-style.handler.ts
|
|
2085
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState6 } from "react";
|
|
2086
|
+
import { LazyLoadService } from "@abpjs/core";
|
|
2087
|
+
function createLazyStyleHref(style, dir) {
|
|
2088
|
+
return style.replace("{{dir}}", dir);
|
|
2089
|
+
}
|
|
2090
|
+
function useLazyStyleHandler(options = {}) {
|
|
2091
|
+
const { styles = [BOOTSTRAP], initialDirection = "ltr" } = options;
|
|
2092
|
+
const [direction, setDirection] = useState6(initialDirection);
|
|
2093
|
+
const lazyLoadRef = useRef7(new LazyLoadService());
|
|
2094
|
+
const loadedStylesRef = useRef7(/* @__PURE__ */ new Map());
|
|
2095
|
+
useEffect7(() => {
|
|
2096
|
+
document.body.dir = direction;
|
|
2097
|
+
const switchCSS = async () => {
|
|
2098
|
+
const lazyLoad = lazyLoadRef.current;
|
|
2099
|
+
for (const style of styles) {
|
|
2100
|
+
const href = createLazyStyleHref(style, direction);
|
|
2101
|
+
if (lazyLoad.isLoaded(href)) {
|
|
2102
|
+
continue;
|
|
2103
|
+
}
|
|
2104
|
+
const oldDir = direction === "ltr" ? "rtl" : "ltr";
|
|
2105
|
+
const oldHref = createLazyStyleHref(style, oldDir);
|
|
2106
|
+
const oldLink = loadedStylesRef.current.get(oldHref);
|
|
2107
|
+
if (oldLink && oldLink.parentNode) {
|
|
2108
|
+
oldLink.parentNode.removeChild(oldLink);
|
|
2109
|
+
lazyLoad.remove(oldHref);
|
|
2110
|
+
loadedStylesRef.current.delete(oldHref);
|
|
2111
|
+
}
|
|
2112
|
+
try {
|
|
2113
|
+
const link = document.createElement("link");
|
|
2114
|
+
link.rel = "stylesheet";
|
|
2115
|
+
link.href = href;
|
|
2116
|
+
document.head.appendChild(link);
|
|
2117
|
+
loadedStylesRef.current.set(href, link);
|
|
2118
|
+
} catch (error) {
|
|
2119
|
+
console.warn(`Failed to load style: ${href}`, error);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
switchCSS();
|
|
2124
|
+
}, [direction, styles]);
|
|
2125
|
+
return {
|
|
2126
|
+
direction,
|
|
2127
|
+
setDirection
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
function getLoadedBootstrapDirection(styles = [BOOTSTRAP]) {
|
|
2131
|
+
for (const style of styles) {
|
|
2132
|
+
const ltrHref = createLazyStyleHref(style, "ltr");
|
|
2133
|
+
const rtlHref = createLazyStyleHref(style, "rtl");
|
|
2134
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
2135
|
+
for (const link of links) {
|
|
2136
|
+
const href = link.href;
|
|
2137
|
+
if (href.includes(ltrHref)) return "ltr";
|
|
2138
|
+
if (href.includes(rtlHref)) return "rtl";
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
return void 0;
|
|
2142
|
+
}
|
|
2143
|
+
function initLazyStyleHandler(options = {}) {
|
|
2144
|
+
return () => {
|
|
2145
|
+
const { initialDirection = "ltr" } = options;
|
|
2146
|
+
document.body.dir = initialDirection;
|
|
2147
|
+
return { direction: initialDirection };
|
|
2148
|
+
};
|
|
1964
2149
|
}
|
|
1965
2150
|
|
|
1966
2151
|
// src/utils/styles.ts
|
|
@@ -2033,11 +2218,164 @@ function injectThemeSharedStyles() {
|
|
|
2033
2218
|
}
|
|
2034
2219
|
};
|
|
2035
2220
|
}
|
|
2221
|
+
|
|
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
|
+
// src/utils/validation-utils.ts
|
|
2261
|
+
var PASSWORD_SETTING_KEYS = {
|
|
2262
|
+
requiredLength: "Abp.Identity.Password.RequiredLength",
|
|
2263
|
+
maxLength: "Abp.Identity.Password.MaxLength",
|
|
2264
|
+
requireDigit: "Abp.Identity.Password.RequireDigit",
|
|
2265
|
+
requireLowercase: "Abp.Identity.Password.RequireLowercase",
|
|
2266
|
+
requireUppercase: "Abp.Identity.Password.RequireUppercase",
|
|
2267
|
+
requireNonAlphanumeric: "Abp.Identity.Password.RequireNonAlphanumeric",
|
|
2268
|
+
requiredUniqueChars: "Abp.Identity.Password.RequiredUniqueChars"
|
|
2269
|
+
};
|
|
2270
|
+
function parseBooleanSetting(value) {
|
|
2271
|
+
if (value === void 0) return void 0;
|
|
2272
|
+
return value.toLowerCase() === "true";
|
|
2273
|
+
}
|
|
2274
|
+
function parseIntegerSetting(value) {
|
|
2275
|
+
if (value === void 0) return void 0;
|
|
2276
|
+
const num = parseInt(value, 10);
|
|
2277
|
+
return isNaN(num) ? void 0 : num;
|
|
2278
|
+
}
|
|
2279
|
+
function getPasswordSettings(store) {
|
|
2280
|
+
return {
|
|
2281
|
+
requiredLength: parseIntegerSetting(store.getSetting(PASSWORD_SETTING_KEYS.requiredLength)),
|
|
2282
|
+
maxLength: parseIntegerSetting(store.getSetting(PASSWORD_SETTING_KEYS.maxLength)),
|
|
2283
|
+
requireDigit: parseBooleanSetting(store.getSetting(PASSWORD_SETTING_KEYS.requireDigit)),
|
|
2284
|
+
requireLowercase: parseBooleanSetting(store.getSetting(PASSWORD_SETTING_KEYS.requireLowercase)),
|
|
2285
|
+
requireUppercase: parseBooleanSetting(store.getSetting(PASSWORD_SETTING_KEYS.requireUppercase)),
|
|
2286
|
+
requireNonAlphanumeric: parseBooleanSetting(store.getSetting(PASSWORD_SETTING_KEYS.requireNonAlphanumeric)),
|
|
2287
|
+
requiredUniqueChars: parseIntegerSetting(store.getSetting(PASSWORD_SETTING_KEYS.requiredUniqueChars))
|
|
2288
|
+
};
|
|
2289
|
+
}
|
|
2290
|
+
function getPasswordValidators(store) {
|
|
2291
|
+
const settings = getPasswordSettings(store);
|
|
2292
|
+
const validators = [];
|
|
2293
|
+
if (settings.requiredLength && settings.requiredLength > 0) {
|
|
2294
|
+
validators.push((value) => {
|
|
2295
|
+
if (!value || value.length < settings.requiredLength) {
|
|
2296
|
+
return `Password must be at least ${settings.requiredLength} characters`;
|
|
2297
|
+
}
|
|
2298
|
+
return true;
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
if (settings.maxLength && settings.maxLength > 0) {
|
|
2302
|
+
validators.push((value) => {
|
|
2303
|
+
if (value && value.length > settings.maxLength) {
|
|
2304
|
+
return `Password must be at most ${settings.maxLength} characters`;
|
|
2305
|
+
}
|
|
2306
|
+
return true;
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
if (settings.requireDigit) {
|
|
2310
|
+
validators.push((value) => {
|
|
2311
|
+
if (!value || !/\d/.test(value)) {
|
|
2312
|
+
return "Password must contain at least one digit";
|
|
2313
|
+
}
|
|
2314
|
+
return true;
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
if (settings.requireLowercase) {
|
|
2318
|
+
validators.push((value) => {
|
|
2319
|
+
if (!value || !/[a-z]/.test(value)) {
|
|
2320
|
+
return "Password must contain at least one lowercase letter";
|
|
2321
|
+
}
|
|
2322
|
+
return true;
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
if (settings.requireUppercase) {
|
|
2326
|
+
validators.push((value) => {
|
|
2327
|
+
if (!value || !/[A-Z]/.test(value)) {
|
|
2328
|
+
return "Password must contain at least one uppercase letter";
|
|
2329
|
+
}
|
|
2330
|
+
return true;
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
if (settings.requireNonAlphanumeric) {
|
|
2334
|
+
validators.push((value) => {
|
|
2335
|
+
if (!value || !/[^a-zA-Z0-9]/.test(value)) {
|
|
2336
|
+
return "Password must contain at least one special character";
|
|
2337
|
+
}
|
|
2338
|
+
return true;
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
if (settings.requiredUniqueChars && settings.requiredUniqueChars > 0) {
|
|
2342
|
+
validators.push((value) => {
|
|
2343
|
+
if (!value) return true;
|
|
2344
|
+
const uniqueChars = new Set(value).size;
|
|
2345
|
+
if (uniqueChars < settings.requiredUniqueChars) {
|
|
2346
|
+
return `Password must contain at least ${settings.requiredUniqueChars} unique characters`;
|
|
2347
|
+
}
|
|
2348
|
+
return true;
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
return validators;
|
|
2352
|
+
}
|
|
2353
|
+
function getPasswordValidationRules(store) {
|
|
2354
|
+
const validators = getPasswordValidators(store);
|
|
2355
|
+
const settings = getPasswordSettings(store);
|
|
2356
|
+
const validate = {};
|
|
2357
|
+
validators.forEach((validator, index) => {
|
|
2358
|
+
validate[`passwordRule${index}`] = validator;
|
|
2359
|
+
});
|
|
2360
|
+
return {
|
|
2361
|
+
required: "Password is required",
|
|
2362
|
+
minLength: settings.requiredLength ? {
|
|
2363
|
+
value: settings.requiredLength,
|
|
2364
|
+
message: `Password must be at least ${settings.requiredLength} characters`
|
|
2365
|
+
} : void 0,
|
|
2366
|
+
maxLength: settings.maxLength ? {
|
|
2367
|
+
value: settings.maxLength,
|
|
2368
|
+
message: `Password must be at most ${settings.maxLength} characters`
|
|
2369
|
+
} : void 0,
|
|
2370
|
+
validate
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2036
2373
|
export {
|
|
2037
2374
|
AbpModalBody,
|
|
2038
2375
|
AbpModalFooter,
|
|
2039
2376
|
AbpModalHeader,
|
|
2040
2377
|
Alert,
|
|
2378
|
+
BOOTSTRAP,
|
|
2041
2379
|
Button3 as Button,
|
|
2042
2380
|
Dialog2 as ChakraDialog,
|
|
2043
2381
|
ChangePassword,
|
|
@@ -2045,14 +2383,22 @@ export {
|
|
|
2045
2383
|
Confirmation,
|
|
2046
2384
|
ConfirmationDialog,
|
|
2047
2385
|
ConfirmationProvider,
|
|
2386
|
+
DEFAULT_LAZY_STYLES,
|
|
2048
2387
|
DEFAULT_STYLES,
|
|
2049
2388
|
ErrorComponent,
|
|
2050
2389
|
FormField,
|
|
2390
|
+
HTTP_ERROR_CONFIG,
|
|
2391
|
+
HttpErrorConfigContext,
|
|
2392
|
+
LAZY_STYLES,
|
|
2393
|
+
LazyStylesContext,
|
|
2051
2394
|
LoaderBar,
|
|
2052
2395
|
Modal,
|
|
2053
2396
|
AbpModalBody as ModalBody,
|
|
2397
|
+
ModalContainer,
|
|
2054
2398
|
AbpModalFooter as ModalFooter,
|
|
2055
2399
|
AbpModalHeader as ModalHeader,
|
|
2400
|
+
ModalProvider,
|
|
2401
|
+
PASSWORD_SETTING_KEYS,
|
|
2056
2402
|
Profile,
|
|
2057
2403
|
THEME_SHARED_APPEND_CONTENT,
|
|
2058
2404
|
THEME_SHARED_STYLES,
|
|
@@ -2062,18 +2408,37 @@ export {
|
|
|
2062
2408
|
Toaster,
|
|
2063
2409
|
ToasterProvider,
|
|
2064
2410
|
abpSystem,
|
|
2411
|
+
addNavItem,
|
|
2412
|
+
clearNavItems,
|
|
2065
2413
|
createAbpSystem,
|
|
2066
2414
|
createErrorInterceptor,
|
|
2415
|
+
createLazyStyleHref,
|
|
2067
2416
|
defaultAbpConfig,
|
|
2068
2417
|
defineConfig,
|
|
2418
|
+
getLoadedBootstrapDirection,
|
|
2419
|
+
getNavItems,
|
|
2420
|
+
getNavItemsSync,
|
|
2421
|
+
getPasswordSettings,
|
|
2422
|
+
getPasswordValidationRules,
|
|
2423
|
+
getPasswordValidators,
|
|
2069
2424
|
getSeverityBg,
|
|
2070
2425
|
getSeverityBorderColor,
|
|
2071
2426
|
getSeverityColorPalette as getSeverityColorScheme,
|
|
2427
|
+
httpErrorConfigFactory,
|
|
2428
|
+
initLazyStyleHandler,
|
|
2072
2429
|
injectThemeSharedStyles,
|
|
2430
|
+
removeNavItem,
|
|
2431
|
+
subscribeToNavItems,
|
|
2073
2432
|
useConfirmation,
|
|
2074
2433
|
useConfirmationContext,
|
|
2075
2434
|
useConfirmationState,
|
|
2076
2435
|
useErrorHandler,
|
|
2436
|
+
useHttpErrorConfig,
|
|
2437
|
+
useLazyStyleHandler,
|
|
2438
|
+
useLazyStyles,
|
|
2439
|
+
useModal,
|
|
2440
|
+
useModalContext,
|
|
2441
|
+
useModalState,
|
|
2077
2442
|
useToaster,
|
|
2078
2443
|
useToasterContext,
|
|
2079
2444
|
useToasts
|