@hkyhy/marsun-components-core 0.1.2
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/README.md +99 -0
- package/dist/components/AgentHub/AgentHubAccessGuard.js +12 -0
- package/dist/components/AgentHub/AgentHubAccessGuard.js.map +1 -0
- package/dist/components/AgentHub/AgentHubIndexRedirect.js +11 -0
- package/dist/components/AgentHub/AgentHubIndexRedirect.js.map +1 -0
- package/dist/components/AgentHub/ChatSessionAccessGuard.js +11 -0
- package/dist/components/AgentHub/ChatSessionAccessGuard.js.map +1 -0
- package/dist/components/Auth/PermissionGuard.js +18 -0
- package/dist/components/Auth/PermissionGuard.js.map +1 -0
- package/dist/components/Auth/ProtectedRoute.js +21 -0
- package/dist/components/Auth/ProtectedRoute.js.map +1 -0
- package/dist/components/Auth/hasPermission.js +7 -0
- package/dist/components/Auth/hasPermission.js.map +1 -0
- package/dist/components/Descriptions/CommonDescriptions.js +14 -0
- package/dist/components/Descriptions/CommonDescriptions.js.map +1 -0
- package/dist/components/File/FileItem/index.js +82 -0
- package/dist/components/File/FileItem/index.js.map +1 -0
- package/dist/components/File/FileItem/style.module.scss.js +18 -0
- package/dist/components/File/FileItem/style.module.scss.js.map +1 -0
- package/dist/components/File/FileLink/index.js +27 -0
- package/dist/components/File/FileLink/index.js.map +1 -0
- package/dist/components/File/FileLink/style.module.scss.js +10 -0
- package/dist/components/File/FileLink/style.module.scss.js.map +1 -0
- package/dist/components/File/FilePreview/index.js +49 -0
- package/dist/components/File/FilePreview/index.js.map +1 -0
- package/dist/components/File/FilePreview/style.module.scss.js +5 -0
- package/dist/components/File/FilePreview/style.module.scss.js.map +1 -0
- package/dist/components/File/FilePreviewModal/index.js +12 -0
- package/dist/components/File/FilePreviewModal/index.js.map +1 -0
- package/dist/components/File/fileDisplay.js +67 -0
- package/dist/components/File/fileDisplay.js.map +1 -0
- package/dist/components/Filter/CommonFilter/index.js +81 -0
- package/dist/components/Filter/CommonFilter/index.js.map +1 -0
- package/dist/components/Filter/CommonFilter/style.module.scss.js +20 -0
- package/dist/components/Filter/CommonFilter/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterDateRange/index.js +97 -0
- package/dist/components/Filter/FilterDateRange/index.js.map +1 -0
- package/dist/components/Filter/FilterDateRange/style.module.scss.js +10 -0
- package/dist/components/Filter/FilterDateRange/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterInput/index.js +56 -0
- package/dist/components/Filter/FilterInput/index.js.map +1 -0
- package/dist/components/Filter/FilterNumberRange/index.js +81 -0
- package/dist/components/Filter/FilterNumberRange/index.js.map +1 -0
- package/dist/components/Filter/FilterNumberRange/style.module.scss.js +9 -0
- package/dist/components/Filter/FilterNumberRange/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterPanel/index.js +21 -0
- package/dist/components/Filter/FilterPanel/index.js.map +1 -0
- package/dist/components/Filter/FilterPanel/style.module.scss.js +8 -0
- package/dist/components/Filter/FilterPanel/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterPopover/index.js +52 -0
- package/dist/components/Filter/FilterPopover/index.js.map +1 -0
- package/dist/components/Filter/FilterSelect/index.js +160 -0
- package/dist/components/Filter/FilterSelect/index.js.map +1 -0
- package/dist/components/Filter/FilterSelect/style.module.scss.js +16 -0
- package/dist/components/Filter/FilterSelect/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterTreeSelect/index.js +249 -0
- package/dist/components/Filter/FilterTreeSelect/index.js.map +1 -0
- package/dist/components/Filter/FilterTreeSelect/style.module.scss.js +19 -0
- package/dist/components/Filter/FilterTreeSelect/style.module.scss.js.map +1 -0
- package/dist/components/Filter/FilterTrigger/index.js +31 -0
- package/dist/components/Filter/FilterTrigger/index.js.map +1 -0
- package/dist/components/Filter/FilterTrigger/style.module.scss.js +10 -0
- package/dist/components/Filter/FilterTrigger/style.module.scss.js.map +1 -0
- package/dist/components/Filter/types.js +12 -0
- package/dist/components/Filter/types.js.map +1 -0
- package/dist/components/Filter/useFilterState.js +35 -0
- package/dist/components/Filter/useFilterState.js.map +1 -0
- package/dist/components/Form/FetchSelect.js +37 -0
- package/dist/components/Form/FetchSelect.js.map +1 -0
- package/dist/components/Form/FetchTreeSelect.js +28 -0
- package/dist/components/Form/FetchTreeSelect.js.map +1 -0
- package/dist/components/Form/PersonOptionRow/index.js +37 -0
- package/dist/components/Form/PersonOptionRow/index.js.map +1 -0
- package/dist/components/Form/PersonOptionRow/style.module.scss.js +11 -0
- package/dist/components/Form/PersonOptionRow/style.module.scss.js.map +1 -0
- package/dist/components/Form/StepForm.js +34 -0
- package/dist/components/Form/StepForm.js.map +1 -0
- package/dist/components/Icons/index.js +245 -0
- package/dist/components/Icons/index.js.map +1 -0
- package/dist/components/Layout/PageHeaderLayout/index.js +41 -0
- package/dist/components/Layout/PageHeaderLayout/index.js.map +1 -0
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js +10 -0
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js.map +1 -0
- package/dist/components/Modal/StepModal/index.js +64 -0
- package/dist/components/Modal/StepModal/index.js.map +1 -0
- package/dist/components/Modal/StepModal/style.module.scss.js +9 -0
- package/dist/components/Modal/StepModal/style.module.scss.js.map +1 -0
- package/dist/components/Stat/StatCard/index.js +34 -0
- package/dist/components/Stat/StatCard/index.js.map +1 -0
- package/dist/components/Stat/StatCard/style.module.scss.js +7 -0
- package/dist/components/Stat/StatCard/style.module.scss.js.map +1 -0
- package/dist/components/Stat/StatCardList.js +20 -0
- package/dist/components/Stat/StatCardList.js.map +1 -0
- package/dist/components/Stat/StatPendingBreakdown/index.js +38 -0
- package/dist/components/Stat/StatPendingBreakdown/index.js.map +1 -0
- package/dist/components/Stat/StatPendingBreakdown/style.module.scss.js +9 -0
- package/dist/components/Stat/StatPendingBreakdown/style.module.scss.js.map +1 -0
- package/dist/components/Tag/FileTags.js +8 -0
- package/dist/components/Tag/FileTags.js.map +1 -0
- package/dist/components/Tag/SemanticTag.js +92 -0
- package/dist/components/Tag/SemanticTag.js.map +1 -0
- package/dist/components/Tag/Tags/index.js +32 -0
- package/dist/components/Tag/Tags/index.js.map +1 -0
- package/dist/components/Tag/Tags/style.module.scss.js +9 -0
- package/dist/components/Tag/Tags/style.module.scss.js.map +1 -0
- package/dist/components/TooltipInfo/TooltipInfo.js +31 -0
- package/dist/components/TooltipInfo/TooltipInfo.js.map +1 -0
- package/dist/components/Tour/AppTour/index.js +40 -0
- package/dist/components/Tour/AppTour/index.js.map +1 -0
- package/dist/components/Tour/AppTour/style.module.scss.js +7 -0
- package/dist/components/Tour/AppTour/style.module.scss.js.map +1 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.js +97 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.js.map +1 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/style.module.scss.js +12 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/style.module.scss.js.map +1 -0
- package/dist/components/VirtualScrollbar/useVirtualScrollbar.js +97 -0
- package/dist/components/VirtualScrollbar/useVirtualScrollbar.js.map +1 -0
- package/dist/hooks/useFetchData.js +69 -0
- package/dist/hooks/useFetchData.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +1 -0
- package/dist/marsun-components-core.css +1 -0
- package/dist/provider/MarsunCoreProvider.js +51 -0
- package/dist/provider/MarsunCoreProvider.js.map +1 -0
- package/dist/provider/context.js +27 -0
- package/dist/provider/context.js.map +1 -0
- package/dist/theme/constants.js +15 -0
- package/dist/theme/constants.js.map +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +9 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme.js +286 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/utils/format.js +9 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/resolveMaybeFn.js +11 -0
- package/dist/utils/resolveMaybeFn.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useState as D, useRef as O, useCallback as a, useEffect as E } from "react";
|
|
2
|
+
const _ = 24, I = 1e3, L = {
|
|
3
|
+
vertical: { size: 0, offset: 0, visible: !1 },
|
|
4
|
+
horizontal: { size: 0, offset: 0, visible: !1 }
|
|
5
|
+
};
|
|
6
|
+
function W(c, n, d) {
|
|
7
|
+
if (c <= n)
|
|
8
|
+
return { size: 0, offset: 0, visible: !1 };
|
|
9
|
+
const l = n, z = Math.max(_, n / c * l), T = c - n, b = l - z, u = T > 0 ? d / T * b : 0;
|
|
10
|
+
return { size: z, offset: u, visible: !0 };
|
|
11
|
+
}
|
|
12
|
+
function X(c, n = "vertical", d = !0) {
|
|
13
|
+
const [l, z] = D(L), [T, b] = D(!d), u = O(null), g = O(null), h = a(() => {
|
|
14
|
+
u.current !== null && (window.clearTimeout(u.current), u.current = null);
|
|
15
|
+
}, []), f = a(() => {
|
|
16
|
+
d && (h(), u.current = window.setTimeout(() => b(!1), I));
|
|
17
|
+
}, [d, h]), m = a(() => {
|
|
18
|
+
b(!0), f();
|
|
19
|
+
}, [f]), o = a(() => {
|
|
20
|
+
const e = c.current;
|
|
21
|
+
if (!e) {
|
|
22
|
+
z(L);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const r = n === "vertical" || n === "both", t = n === "horizontal" || n === "both";
|
|
26
|
+
z({
|
|
27
|
+
vertical: r ? W(e.scrollHeight, e.clientHeight, e.scrollTop) : L.vertical,
|
|
28
|
+
horizontal: t ? W(e.scrollWidth, e.clientWidth, e.scrollLeft) : L.horizontal
|
|
29
|
+
});
|
|
30
|
+
}, [n, c]);
|
|
31
|
+
E(() => {
|
|
32
|
+
o();
|
|
33
|
+
}, [o]), E(() => {
|
|
34
|
+
const e = c.current;
|
|
35
|
+
if (!e) return;
|
|
36
|
+
const r = new ResizeObserver(() => o());
|
|
37
|
+
return r.observe(e), e.firstElementChild && r.observe(e.firstElementChild), () => r.disconnect();
|
|
38
|
+
}, [o, c]), E(() => {
|
|
39
|
+
const e = (t) => {
|
|
40
|
+
const s = g.current, i = c.current;
|
|
41
|
+
if (!s || !i) return;
|
|
42
|
+
t.preventDefault();
|
|
43
|
+
const p = s.axis === "vertical" ? t.clientY - s.startPointer : t.clientX - s.startPointer, v = s.scrollSize - s.clientSize, S = s.clientSize - s.thumbSize, M = S > 0 ? p / S * v : 0, x = s.startScroll + M;
|
|
44
|
+
s.axis === "vertical" ? i.scrollTop = x : i.scrollLeft = x, o();
|
|
45
|
+
}, r = () => {
|
|
46
|
+
g.current && (g.current = null, f());
|
|
47
|
+
};
|
|
48
|
+
return window.addEventListener("mousemove", e), window.addEventListener("mouseup", r), () => {
|
|
49
|
+
window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", r);
|
|
50
|
+
};
|
|
51
|
+
}, [f, o, c]), E(() => () => h(), [h]);
|
|
52
|
+
const C = a(() => {
|
|
53
|
+
o(), m();
|
|
54
|
+
}, [m, o]), k = a(() => {
|
|
55
|
+
b(!0), h();
|
|
56
|
+
}, [h]), A = a(() => {
|
|
57
|
+
g.current || f();
|
|
58
|
+
}, [f]), P = a(
|
|
59
|
+
(e, r) => {
|
|
60
|
+
const t = c.current;
|
|
61
|
+
if (!t) return;
|
|
62
|
+
r.preventDefault(), r.stopPropagation(), m();
|
|
63
|
+
const s = e === "vertical";
|
|
64
|
+
g.current = {
|
|
65
|
+
axis: e,
|
|
66
|
+
startPointer: s ? r.clientY : r.clientX,
|
|
67
|
+
startScroll: s ? t.scrollTop : t.scrollLeft,
|
|
68
|
+
thumbSize: s ? l.vertical.size : l.horizontal.size,
|
|
69
|
+
clientSize: s ? t.clientHeight : t.clientWidth,
|
|
70
|
+
scrollSize: s ? t.scrollHeight : t.scrollWidth
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
[l.horizontal.size, l.vertical.size, m, c]
|
|
74
|
+
), V = a(
|
|
75
|
+
(e, r) => {
|
|
76
|
+
const t = c.current;
|
|
77
|
+
if (!t || r.target !== r.currentTarget) return;
|
|
78
|
+
m();
|
|
79
|
+
const s = r.currentTarget.getBoundingClientRect(), i = e === "vertical", p = i ? r.clientY - s.top : r.clientX - s.left, v = i ? t.clientHeight : t.clientWidth, S = i ? t.scrollHeight : t.scrollWidth, M = i ? l.vertical.size : l.horizontal.size, x = S - v, H = v - M, Y = Math.max(0, Math.min(p - M / 2, H)), w = H > 0 ? Y / H * x : 0;
|
|
80
|
+
i ? t.scrollTop = w : t.scrollLeft = w, o();
|
|
81
|
+
},
|
|
82
|
+
[l.horizontal.size, l.vertical.size, m, o, c]
|
|
83
|
+
);
|
|
84
|
+
return {
|
|
85
|
+
metrics: l,
|
|
86
|
+
active: T,
|
|
87
|
+
handleScroll: C,
|
|
88
|
+
handleMouseEnter: k,
|
|
89
|
+
handleMouseLeave: A,
|
|
90
|
+
startDrag: P,
|
|
91
|
+
handleTrackClick: V
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
X as useVirtualScrollbar
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=useVirtualScrollbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVirtualScrollbar.js","sources":["../../../src/components/VirtualScrollbar/useVirtualScrollbar.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type RefObject } from 'react';\n\nexport type ScrollDirection = 'vertical' | 'horizontal' | 'both';\n\nexport interface ThumbMetrics {\n vertical: { size: number; offset: number; visible: boolean };\n horizontal: { size: number; offset: number; visible: boolean };\n}\n\nconst MIN_THUMB_SIZE = 24;\nconst AUTO_HIDE_DELAY = 1000;\n\nconst emptyMetrics: ThumbMetrics = {\n vertical: { size: 0, offset: 0, visible: false },\n horizontal: { size: 0, offset: 0, visible: false },\n};\n\nfunction computeAxisMetrics(\n scrollSize: number,\n clientSize: number,\n scrollOffset: number,\n): { size: number; offset: number; visible: boolean } {\n if (scrollSize <= clientSize) {\n return { size: 0, offset: 0, visible: false };\n }\n\n const trackSize = clientSize;\n const size = Math.max(MIN_THUMB_SIZE, (clientSize / scrollSize) * trackSize);\n const maxScroll = scrollSize - clientSize;\n const maxThumbOffset = trackSize - size;\n const offset = maxScroll > 0 ? (scrollOffset / maxScroll) * maxThumbOffset : 0;\n\n return { size, offset, visible: true };\n}\n\nexport function useVirtualScrollbar(\n viewportRef: RefObject<HTMLDivElement | null>,\n direction: ScrollDirection = 'vertical',\n autoHide = true,\n) {\n const [metrics, setMetrics] = useState<ThumbMetrics>(emptyMetrics);\n const [active, setActive] = useState(!autoHide);\n const hideTimerRef = useRef<number | null>(null);\n const draggingRef = useRef<{\n axis: 'vertical' | 'horizontal';\n startPointer: number;\n startScroll: number;\n thumbSize: number;\n clientSize: number;\n scrollSize: number;\n } | null>(null);\n\n const clearHideTimer = useCallback(() => {\n if (hideTimerRef.current !== null) {\n window.clearTimeout(hideTimerRef.current);\n hideTimerRef.current = null;\n }\n }, []);\n\n const scheduleHide = useCallback(() => {\n if (!autoHide) return;\n clearHideTimer();\n hideTimerRef.current = window.setTimeout(() => setActive(false), AUTO_HIDE_DELAY);\n }, [autoHide, clearHideTimer]);\n\n const showThumb = useCallback(() => {\n setActive(true);\n scheduleHide();\n }, [scheduleHide]);\n\n const updateMetrics = useCallback(() => {\n const el = viewportRef.current;\n if (!el) {\n setMetrics(emptyMetrics);\n return;\n }\n\n const showVertical = direction === 'vertical' || direction === 'both';\n const showHorizontal = direction === 'horizontal' || direction === 'both';\n\n setMetrics({\n vertical: showVertical\n ? computeAxisMetrics(el.scrollHeight, el.clientHeight, el.scrollTop)\n : emptyMetrics.vertical,\n horizontal: showHorizontal\n ? computeAxisMetrics(el.scrollWidth, el.clientWidth, el.scrollLeft)\n : emptyMetrics.horizontal,\n });\n }, [direction, viewportRef]);\n\n useEffect(() => {\n updateMetrics();\n }, [updateMetrics]);\n\n useEffect(() => {\n const el = viewportRef.current;\n if (!el) return;\n\n const observer = new ResizeObserver(() => updateMetrics());\n observer.observe(el);\n if (el.firstElementChild) {\n observer.observe(el.firstElementChild);\n }\n\n return () => observer.disconnect();\n }, [updateMetrics, viewportRef]);\n\n useEffect(() => {\n const handleMouseMove = (event: MouseEvent) => {\n const drag = draggingRef.current;\n const el = viewportRef.current;\n if (!drag || !el) return;\n\n event.preventDefault();\n const delta =\n drag.axis === 'vertical'\n ? event.clientY - drag.startPointer\n : event.clientX - drag.startPointer;\n const maxScroll = drag.scrollSize - drag.clientSize;\n const maxThumbOffset = drag.clientSize - drag.thumbSize;\n const scrollDelta = maxThumbOffset > 0 ? (delta / maxThumbOffset) * maxScroll : 0;\n const nextScroll = drag.startScroll + scrollDelta;\n\n if (drag.axis === 'vertical') {\n el.scrollTop = nextScroll;\n } else {\n el.scrollLeft = nextScroll;\n }\n updateMetrics();\n };\n\n const handleMouseUp = () => {\n if (!draggingRef.current) return;\n draggingRef.current = null;\n scheduleHide();\n };\n\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n return () => {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n };\n }, [scheduleHide, updateMetrics, viewportRef]);\n\n useEffect(() => () => clearHideTimer(), [clearHideTimer]);\n\n const handleScroll = useCallback(() => {\n updateMetrics();\n showThumb();\n }, [showThumb, updateMetrics]);\n\n const handleMouseEnter = useCallback(() => {\n setActive(true);\n clearHideTimer();\n }, [clearHideTimer]);\n\n const handleMouseLeave = useCallback(() => {\n if (!draggingRef.current) {\n scheduleHide();\n }\n }, [scheduleHide]);\n\n const startDrag = useCallback(\n (axis: 'vertical' | 'horizontal', event: React.MouseEvent) => {\n const el = viewportRef.current;\n if (!el) return;\n\n event.preventDefault();\n event.stopPropagation();\n showThumb();\n\n const isVertical = axis === 'vertical';\n draggingRef.current = {\n axis,\n startPointer: isVertical ? event.clientY : event.clientX,\n startScroll: isVertical ? el.scrollTop : el.scrollLeft,\n thumbSize: isVertical ? metrics.vertical.size : metrics.horizontal.size,\n clientSize: isVertical ? el.clientHeight : el.clientWidth,\n scrollSize: isVertical ? el.scrollHeight : el.scrollWidth,\n };\n },\n [metrics.horizontal.size, metrics.vertical.size, showThumb, viewportRef],\n );\n\n const handleTrackClick = useCallback(\n (axis: 'vertical' | 'horizontal', event: React.MouseEvent<HTMLDivElement>) => {\n const el = viewportRef.current;\n if (!el || event.target !== event.currentTarget) return;\n\n showThumb();\n const rect = event.currentTarget.getBoundingClientRect();\n const isVertical = axis === 'vertical';\n const pointer = isVertical ? event.clientY - rect.top : event.clientX - rect.left;\n const clientSize = isVertical ? el.clientHeight : el.clientWidth;\n const scrollSize = isVertical ? el.scrollHeight : el.scrollWidth;\n const thumbSize = isVertical ? metrics.vertical.size : metrics.horizontal.size;\n const maxScroll = scrollSize - clientSize;\n const maxThumbOffset = clientSize - thumbSize;\n const targetThumbOffset = Math.max(0, Math.min(pointer - thumbSize / 2, maxThumbOffset));\n const nextScroll = maxThumbOffset > 0 ? (targetThumbOffset / maxThumbOffset) * maxScroll : 0;\n\n if (isVertical) {\n el.scrollTop = nextScroll;\n } else {\n el.scrollLeft = nextScroll;\n }\n updateMetrics();\n },\n [metrics.horizontal.size, metrics.vertical.size, showThumb, updateMetrics, viewportRef],\n );\n\n return {\n metrics,\n active,\n handleScroll,\n handleMouseEnter,\n handleMouseLeave,\n startDrag,\n handleTrackClick,\n };\n}\n"],"names":["MIN_THUMB_SIZE","AUTO_HIDE_DELAY","emptyMetrics","computeAxisMetrics","scrollSize","clientSize","scrollOffset","trackSize","size","maxScroll","maxThumbOffset","offset","useVirtualScrollbar","viewportRef","direction","autoHide","metrics","setMetrics","useState","active","setActive","hideTimerRef","useRef","draggingRef","clearHideTimer","useCallback","scheduleHide","showThumb","updateMetrics","el","showVertical","showHorizontal","useEffect","observer","handleMouseMove","event","drag","delta","scrollDelta","nextScroll","handleMouseUp","handleScroll","handleMouseEnter","handleMouseLeave","startDrag","axis","isVertical","handleTrackClick","rect","pointer","thumbSize","targetThumbOffset"],"m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IAAmBtB;AAAA,IACvB,CAACoB,GAAiCV,MAA4C;AAC5E,YAAMN,IAAKhB,EAAY;AACvB,UAAI,CAACgB,KAAMM,EAAM,WAAWA,EAAM,cAAe;AAEjD,MAAAR,EAAA;AACA,YAAMqB,IAAOb,EAAM,cAAc,sBAAA,GAC3BW,IAAaD,MAAS,YACtBI,IAAUH,IAAaX,EAAM,UAAUa,EAAK,MAAMb,EAAM,UAAUa,EAAK,MACvE3C,IAAayC,IAAajB,EAAG,eAAeA,EAAG,aAC/CzB,IAAa0C,IAAajB,EAAG,eAAeA,EAAG,aAC/CqB,IAAYJ,IAAa9B,EAAQ,SAAS,OAAOA,EAAQ,WAAW,MACpEP,IAAYL,IAAaC,GACzBK,IAAiBL,IAAa6C,GAC9BC,IAAoB,KAAK,IAAI,GAAG,KAAK,IAAIF,IAAUC,IAAY,GAAGxC,CAAc,CAAC,GACjF6B,IAAa7B,IAAiB,IAAKyC,IAAoBzC,IAAkBD,IAAY;AAE3F,MAAIqC,IACFjB,EAAG,YAAYU,IAEfV,EAAG,aAAaU,GAElBX,EAAA;AAAA,IACF;AAAA,IACA,CAACZ,EAAQ,WAAW,MAAMA,EAAQ,SAAS,MAAMW,GAAWC,GAAef,CAAW;AAAA,EAAA;AAGxF,SAAO;AAAA,IACL,SAAAG;AAAA,IACA,QAAAG;AAAA,IACA,cAAAsB;AAAA,IACA,kBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,kBAAAG;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useState as c, useCallback as k, useEffect as W } from "react";
|
|
2
|
+
const m = 3e4;
|
|
3
|
+
function x(o, t) {
|
|
4
|
+
if (t.startsWith("http://") || t.startsWith("https://"))
|
|
5
|
+
return t;
|
|
6
|
+
const n = (o ?? "").replace(/\/$/, ""), e = t.startsWith("/") ? t : `/${t}`;
|
|
7
|
+
return `${n}${e}`;
|
|
8
|
+
}
|
|
9
|
+
async function F(o, t = {}, n = m) {
|
|
10
|
+
const e = new AbortController(), s = setTimeout(() => e.abort(), n);
|
|
11
|
+
try {
|
|
12
|
+
const r = await fetch(o, { ...t, signal: e.signal });
|
|
13
|
+
if (!r.ok)
|
|
14
|
+
throw new Error(`HTTP ${r.status}: ${r.statusText}`);
|
|
15
|
+
return (r.headers.get("content-type") ?? "").includes("application/json") ? r.json() : r.text();
|
|
16
|
+
} finally {
|
|
17
|
+
clearTimeout(s);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function j(o) {
|
|
21
|
+
const {
|
|
22
|
+
data: t,
|
|
23
|
+
fetchUrl: n,
|
|
24
|
+
fetchOptions: e,
|
|
25
|
+
transformData: s,
|
|
26
|
+
enabled: r = !0,
|
|
27
|
+
timeoutMs: l = m,
|
|
28
|
+
baseUrl: d,
|
|
29
|
+
defaultHeaders: f
|
|
30
|
+
} = o, [b, p] = c(void 0), [g, T] = c(!1), [w, u] = c(null), [E, D] = c(0), h = k(() => {
|
|
31
|
+
D((a) => a + 1), p(void 0), u(null);
|
|
32
|
+
}, []);
|
|
33
|
+
return W(() => {
|
|
34
|
+
if (t !== void 0 || !n || !r)
|
|
35
|
+
return;
|
|
36
|
+
let a = !1;
|
|
37
|
+
return (async () => {
|
|
38
|
+
T(!0), u(null);
|
|
39
|
+
try {
|
|
40
|
+
const i = x(d, n), $ = { ...f, ...e == null ? void 0 : e.headers }, y = await F(i, { ...e, headers: $ }, l);
|
|
41
|
+
if (a) return;
|
|
42
|
+
const v = s ? s(y) : y;
|
|
43
|
+
p(v);
|
|
44
|
+
} catch (i) {
|
|
45
|
+
if (a) return;
|
|
46
|
+
u(i instanceof Error ? i : new Error(String(i)));
|
|
47
|
+
} finally {
|
|
48
|
+
a || T(!1);
|
|
49
|
+
}
|
|
50
|
+
})(), () => {
|
|
51
|
+
a = !0;
|
|
52
|
+
};
|
|
53
|
+
}, [
|
|
54
|
+
t,
|
|
55
|
+
n,
|
|
56
|
+
r,
|
|
57
|
+
l,
|
|
58
|
+
d,
|
|
59
|
+
f,
|
|
60
|
+
e,
|
|
61
|
+
s,
|
|
62
|
+
E
|
|
63
|
+
]), t !== void 0 ? { data: t, loading: !1, error: null, reload: h } : { data: b, loading: g, error: w, reload: h };
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
F as fetchWithTimeout,
|
|
67
|
+
j as useFetchData
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=useFetchData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchData.js","sources":["../../src/hooks/useFetchData.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport type FetchDataOptions<T> = {\n /** props 模式数据(优先于 fetch) */\n data?: T;\n fetchUrl?: string;\n fetchOptions?: RequestInit;\n transformData?: (raw: unknown) => T;\n enabled?: boolean;\n /** 默认 30s */\n timeoutMs?: number;\n /** Provider 注入的 baseUrl */\n baseUrl?: string;\n /** Provider 注入的默认 headers */\n defaultHeaders?: Record<string, string>;\n};\n\nexport type FetchDataResult<T> = {\n data: T | undefined;\n loading: boolean;\n error: Error | null;\n reload: () => void;\n};\n\nfunction buildUrl(baseUrl: string | undefined, fetchUrl: string): string {\n if (fetchUrl.startsWith('http://') || fetchUrl.startsWith('https://')) {\n return fetchUrl;\n }\n const base = (baseUrl ?? '').replace(/\\/$/, '');\n const path = fetchUrl.startsWith('/') ? fetchUrl : `/${fetchUrl}`;\n return `${base}${path}`;\n}\n\nexport async function fetchWithTimeout(\n url: string,\n options: RequestInit = {},\n timeoutMs = DEFAULT_TIMEOUT_MS,\n): Promise<unknown> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n const response = await fetch(url, { ...options, signal: controller.signal });\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.includes('application/json')) {\n return response.json();\n }\n return response.text();\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport function useFetchData<T>(options: FetchDataOptions<T>): FetchDataResult<T> {\n const {\n data: propsData,\n fetchUrl,\n fetchOptions,\n transformData,\n enabled = true,\n timeoutMs = DEFAULT_TIMEOUT_MS,\n baseUrl,\n defaultHeaders,\n } = options;\n\n const [fetchedData, setFetchedData] = useState<T | undefined>(undefined);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [reloadTick, setReloadTick] = useState(0);\n\n const reload = useCallback(() => {\n setReloadTick((n) => n + 1);\n setFetchedData(undefined);\n setError(null);\n }, []);\n\n useEffect(() => {\n if (propsData !== undefined || !fetchUrl || !enabled) {\n return;\n }\n\n let cancelled = false;\n\n const run = async () => {\n setLoading(true);\n setError(null);\n try {\n const url = buildUrl(baseUrl, fetchUrl);\n const headers = { ...defaultHeaders, ...fetchOptions?.headers };\n const raw = await fetchWithTimeout(url, { ...fetchOptions, headers }, timeoutMs);\n if (cancelled) return;\n const result = transformData ? transformData(raw) : (raw as T);\n setFetchedData(result);\n } catch (err) {\n if (cancelled) return;\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n if (!cancelled) setLoading(false);\n }\n };\n\n void run();\n return () => {\n cancelled = true;\n };\n }, [\n propsData,\n fetchUrl,\n enabled,\n timeoutMs,\n baseUrl,\n defaultHeaders,\n fetchOptions,\n transformData,\n reloadTick,\n ]);\n\n if (propsData !== undefined) {\n return { data: propsData, loading: false, error: null, reload };\n }\n\n return { data: fetchedData, loading, error, reload };\n}\n"],"names":["DEFAULT_TIMEOUT_MS","buildUrl","baseUrl","fetchUrl","base","path","fetchWithTimeout","url","options","timeoutMs","controller","timer","response","useFetchData","propsData","fetchOptions","transformData","enabled","defaultHeaders","fetchedData","setFetchedData","useState","loading","setLoading","error","setError","reloadTick","setReloadTick","reload","useCallback","n","useEffect","cancelled","headers","raw","result","err"],"mappings":";AAEA,MAAMA,IAAqB;AAwB3B,SA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,GACxBK,EAAS,IAAI;AAAA,EACf,GAAG,CAAA,CAAE;AA2CL,SAzCAM,EAAU,MAAM;AACd,QAAIjB,MAAc,UAAa,CAACX,KAAY,CAACc;AAC3C;AAGF,QAAIe,IAAY;AAoBhB,YAlBY,YAAY;AACtB,MAAAT,EAAW,EAAI,GACfE,EAAS,IAAI;AACb,UAAI;AACF,cAAMlB,IAAMN,EAASC,GAASC,CAAQ,GAChC8B,IAAU,EAAE,GAAGf,GAAgB,GAAGH,KAAA,gBAAAA,EAAc,QAAA,GAChDmB,IAAM,MAAM5B,EAAiBC,GAAK,EAAE,GAAGQ,GAAc,SAAAkB,EAAA,GAAWxB,CAAS;AAC/E,YAAIuB,EAAW;AACf,cAAMG,IAASnB,IAAgBA,EAAckB,CAAG,IAAKA;AACrD,QAAAd,EAAee,CAAM;AAAA,MACvB,SAASC,GAAK;AACZ,YAAIJ,EAAW;AACf,QAAAP,EAASW,aAAe,QAAQA,IAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC;AAAA,MAC9D,UAAA;AACE,QAAKJ,KAAWT,EAAW,EAAK;AAAA,MAClC;AAAA,IACF,GAEK,GACE,MAAM;AACX,MAAAS,IAAY;AAAA,IACd;AAAA,EACF,GAAG;AAAA,IACDlB;AAAA,IACAX;AAAA,IACAc;AAAA,IACAR;AAAA,IACAP;AAAA,IACAgB;AAAA,IACAH;AAAA,IACAC;AAAA,IACAU;AAAA,EAAA,CACD,GAEGZ,MAAc,SACT,EAAE,MAAMA,GAAW,SAAS,IAAO,OAAO,MAAM,QAAAc,EAAA,IAGlD,EAAE,MAAMT,GAAa,SAAAG,GAAS,OAAAE,GAAO,QAAAI,EAAA;AAC9C;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ThemeConfig } from 'antd';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 将 antd 主题色同步到 CSS 变量
|
|
5
|
+
* 用于 SCSS 和非 antd 组件的样式引用
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyThemeToCssVariables(primaryColor: string): void;
|
|
8
|
+
|
|
9
|
+
export declare const DEFAULT_PRIMARY_COLOR = "#1677ff";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 根据主色生成完整的 Ant Design 主题配置
|
|
13
|
+
* @param primaryColor - 主题主色,来自系统设置
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateTheme(primaryColor: string): ThemeConfig;
|
|
16
|
+
|
|
17
|
+
export declare const PALETTE: {
|
|
18
|
+
readonly primary: "#1677ff";
|
|
19
|
+
readonly success: "#027A48";
|
|
20
|
+
readonly info: "#155ACF";
|
|
21
|
+
readonly error: "#D14343";
|
|
22
|
+
readonly warning: "#F09700";
|
|
23
|
+
readonly textBase: "#222222";
|
|
24
|
+
readonly textSecondary: "#666666";
|
|
25
|
+
readonly textTertiary: "#999999";
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { applyThemeToCssVariables as o, generateTheme as t } from "./theme/theme.js";
|
|
2
|
+
import { DEFAULT_PRIMARY_COLOR as l, PALETTE as s } from "./theme/constants.js";
|
|
3
|
+
import { fetchWithTimeout as i, useFetchData as p } from "./hooks/useFetchData.js";
|
|
4
|
+
import { resolveMaybeFn as d, resolveVisible as m } from "./utils/resolveMaybeFn.js";
|
|
5
|
+
import { formatFileSize as x } from "./utils/format.js";
|
|
6
|
+
import { ArrowLeft as C, ArrowLeftRight as c, BarChart3 as h, BookOpen as S, Bot as g, Check as T, ChevronDown as P, ChevronLeft as I, ChevronRight as L, ChevronUp as R, CircleAlert as A, CircleCheck as b, CircleHelp as w, CirclePlay as v, CircleX as M, ClipboardCheck as y, Clock as D, CloudDownload as O, CloudUpload as U, Code as k, Copy as H, Crown as E, Database as N, Download as G, Eye as _, File as B, FileArchive as V, FileImage as z, FileSpreadsheet as q, FileText as X, Flag as Y, Flame as W, Folder as j, FolderOpen as J, Hash as K, House as Q, ICON_NAMES as Z, ICON_REGISTRY as $, Import as ee, Inbox as re, Info as oe, LayoutDashboard as te, LayoutGrid as ae, Loader2 as le, Lock as se, LogOut as fe, MessageCircle as ie, MessageSquare as pe, PanelLeftClose as ue, PanelLeftOpen as de, Pause as me, Pencil as ne, Plus as xe, Presentation as Fe, RefreshCw as Ce, RotateCw as ce, Send as he, Settings as Se, Shield as ge, ShieldCheck as Te, SlidersHorizontal as Pe, Square as Ie, Star as Le, ThumbsDown as Re, ThumbsUp as Ae, Trash2 as be, Trophy as we, Undo2 as ve, Upload as Me, User as ye, UserPlus as De, UserRoundCog as Oe, Users as Ue, X as ke, createIcon as He } from "./components/Icons/index.js";
|
|
7
|
+
import { default as Ne } from "./components/AgentHub/AgentHubAccessGuard.js";
|
|
8
|
+
import { default as _e } from "./components/AgentHub/AgentHubIndexRedirect.js";
|
|
9
|
+
import { default as Ve } from "./components/AgentHub/ChatSessionAccessGuard.js";
|
|
10
|
+
import { default as qe } from "./components/Tour/AppTour/index.js";
|
|
11
|
+
import { default as Ye } from "./components/Descriptions/CommonDescriptions.js";
|
|
12
|
+
import { default as je } from "./components/Filter/CommonFilter/index.js";
|
|
13
|
+
import { default as Ke } from "./components/Form/FetchSelect.js";
|
|
14
|
+
import { default as Ze } from "./components/Form/FetchTreeSelect.js";
|
|
15
|
+
import { default as er } from "./components/File/FileLink/index.js";
|
|
16
|
+
import { default as or } from "./components/File/FilePreview/index.js";
|
|
17
|
+
import { default as ar } from "./components/File/FilePreviewModal/index.js";
|
|
18
|
+
import { default as sr } from "./components/Tag/FileTags.js";
|
|
19
|
+
import { default as ir } from "./components/Filter/FilterDateRange/index.js";
|
|
20
|
+
import { default as ur } from "./components/Filter/FilterInput/index.js";
|
|
21
|
+
import { default as mr } from "./components/Filter/FilterNumberRange/index.js";
|
|
22
|
+
import { default as xr } from "./components/Filter/FilterPanel/index.js";
|
|
23
|
+
import { default as Cr } from "./components/Filter/FilterPopover/index.js";
|
|
24
|
+
import { default as hr } from "./components/Filter/FilterSelect/index.js";
|
|
25
|
+
import { default as gr } from "./components/Filter/FilterTreeSelect/index.js";
|
|
26
|
+
import { default as Pr } from "./components/Filter/FilterTrigger/index.js";
|
|
27
|
+
import { default as Lr } from "./provider/MarsunCoreProvider.js";
|
|
28
|
+
import { default as Ar } from "./components/Layout/PageHeaderLayout/index.js";
|
|
29
|
+
import { default as wr } from "./components/Auth/PermissionGuard.js";
|
|
30
|
+
import { default as Mr } from "./components/Form/PersonOptionRow/index.js";
|
|
31
|
+
import { default as Dr } from "./components/Auth/ProtectedRoute.js";
|
|
32
|
+
import { SEMANTIC_COLORS as Ur, default as kr } from "./components/Tag/SemanticTag.js";
|
|
33
|
+
import { default as Er } from "./components/Stat/StatCard/index.js";
|
|
34
|
+
import { default as Gr } from "./components/Stat/StatCardList.js";
|
|
35
|
+
import { default as Br } from "./components/Stat/StatPendingBreakdown/index.js";
|
|
36
|
+
import { default as zr } from "./components/Form/StepForm.js";
|
|
37
|
+
import { default as Xr } from "./components/Modal/StepModal/index.js";
|
|
38
|
+
import { default as Wr } from "./components/Tag/Tags/index.js";
|
|
39
|
+
import { default as Jr } from "./components/TooltipInfo/TooltipInfo.js";
|
|
40
|
+
import { default as Qr } from "./components/VirtualScrollbar/VirtualScrollbar/index.js";
|
|
41
|
+
import { FileItem as $r } from "./components/File/FileItem/index.js";
|
|
42
|
+
import { FilterProvider as ro, useFilterRegister as oo, useFilterState as to } from "./components/Filter/useFilterState.js";
|
|
43
|
+
import { getFileExtension as lo, getFileIcon as so, getFileTypeName as fo, normalizeFileDisplayItem as io, parseFileNameFromUrl as po } from "./components/File/fileDisplay.js";
|
|
44
|
+
import { hasPermission as mo } from "./components/Auth/hasPermission.js";
|
|
45
|
+
import { resolveHidden as xo } from "./components/Filter/types.js";
|
|
46
|
+
import { useMarsunAuth as Co, useMarsunCore as co, useMarsunFetch as ho } from "./provider/context.js";
|
|
47
|
+
export {
|
|
48
|
+
Ne as AgentHubAccessGuard,
|
|
49
|
+
_e as AgentHubIndexRedirect,
|
|
50
|
+
Ve as AgentHubSessionAccessGuard,
|
|
51
|
+
qe as AppTour,
|
|
52
|
+
C as ArrowLeft,
|
|
53
|
+
c as ArrowLeftRight,
|
|
54
|
+
h as BarChart3,
|
|
55
|
+
S as BookOpen,
|
|
56
|
+
g as Bot,
|
|
57
|
+
T as Check,
|
|
58
|
+
P as ChevronDown,
|
|
59
|
+
I as ChevronLeft,
|
|
60
|
+
L as ChevronRight,
|
|
61
|
+
R as ChevronUp,
|
|
62
|
+
A as CircleAlert,
|
|
63
|
+
b as CircleCheck,
|
|
64
|
+
w as CircleHelp,
|
|
65
|
+
v as CirclePlay,
|
|
66
|
+
M as CircleX,
|
|
67
|
+
y as ClipboardCheck,
|
|
68
|
+
D as Clock,
|
|
69
|
+
O as CloudDownload,
|
|
70
|
+
U as CloudUpload,
|
|
71
|
+
k as Code,
|
|
72
|
+
Ye as CommonDescriptions,
|
|
73
|
+
je as CommonFilter,
|
|
74
|
+
H as Copy,
|
|
75
|
+
E as Crown,
|
|
76
|
+
l as DEFAULT_PRIMARY_COLOR,
|
|
77
|
+
N as Database,
|
|
78
|
+
G as Download,
|
|
79
|
+
_ as Eye,
|
|
80
|
+
Ke as FetchSelect,
|
|
81
|
+
Ze as FetchTreeSelect,
|
|
82
|
+
B as File,
|
|
83
|
+
V as FileArchive,
|
|
84
|
+
z as FileImage,
|
|
85
|
+
$r as FileItemView,
|
|
86
|
+
er as FileLink,
|
|
87
|
+
or as FilePreview,
|
|
88
|
+
ar as FilePreviewModal,
|
|
89
|
+
q as FileSpreadsheet,
|
|
90
|
+
sr as FileTags,
|
|
91
|
+
X as FileText,
|
|
92
|
+
ir as FilterDateRange,
|
|
93
|
+
ur as FilterInput,
|
|
94
|
+
mr as FilterNumberRange,
|
|
95
|
+
xr as FilterPanel,
|
|
96
|
+
Cr as FilterPopover,
|
|
97
|
+
ro as FilterProvider,
|
|
98
|
+
hr as FilterSelect,
|
|
99
|
+
gr as FilterTreeSelect,
|
|
100
|
+
Pr as FilterTrigger,
|
|
101
|
+
Y as Flag,
|
|
102
|
+
W as Flame,
|
|
103
|
+
j as Folder,
|
|
104
|
+
J as FolderOpen,
|
|
105
|
+
K as Hash,
|
|
106
|
+
Q as House,
|
|
107
|
+
Z as ICON_NAMES,
|
|
108
|
+
$ as ICON_REGISTRY,
|
|
109
|
+
ee as Import,
|
|
110
|
+
re as Inbox,
|
|
111
|
+
oe as Info,
|
|
112
|
+
te as LayoutDashboard,
|
|
113
|
+
ae as LayoutGrid,
|
|
114
|
+
le as Loader2,
|
|
115
|
+
se as Lock,
|
|
116
|
+
fe as LogOut,
|
|
117
|
+
Lr as MarsunCoreProvider,
|
|
118
|
+
ie as MessageCircle,
|
|
119
|
+
pe as MessageSquare,
|
|
120
|
+
s as PALETTE,
|
|
121
|
+
Ar as PageHeaderLayout,
|
|
122
|
+
ue as PanelLeftClose,
|
|
123
|
+
de as PanelLeftOpen,
|
|
124
|
+
me as Pause,
|
|
125
|
+
ne as Pencil,
|
|
126
|
+
wr as PermissionGuard,
|
|
127
|
+
Mr as PersonOptionRow,
|
|
128
|
+
xe as Plus,
|
|
129
|
+
Fe as Presentation,
|
|
130
|
+
Dr as ProtectedRoute,
|
|
131
|
+
Ce as RefreshCw,
|
|
132
|
+
ce as RotateCw,
|
|
133
|
+
Ur as SEMANTIC_COLORS,
|
|
134
|
+
kr as SemanticTag,
|
|
135
|
+
he as Send,
|
|
136
|
+
Se as Settings,
|
|
137
|
+
ge as Shield,
|
|
138
|
+
Te as ShieldCheck,
|
|
139
|
+
Pe as SlidersHorizontal,
|
|
140
|
+
Ie as Square,
|
|
141
|
+
Le as Star,
|
|
142
|
+
Er as StatCard,
|
|
143
|
+
Gr as StatCardList,
|
|
144
|
+
Br as StatPendingBreakdown,
|
|
145
|
+
zr as StepForm,
|
|
146
|
+
Xr as StepModal,
|
|
147
|
+
Wr as Tags,
|
|
148
|
+
Re as ThumbsDown,
|
|
149
|
+
Ae as ThumbsUp,
|
|
150
|
+
Jr as TooltipInfo,
|
|
151
|
+
be as Trash2,
|
|
152
|
+
we as Trophy,
|
|
153
|
+
ve as Undo2,
|
|
154
|
+
Me as Upload,
|
|
155
|
+
ye as User,
|
|
156
|
+
De as UserPlus,
|
|
157
|
+
Oe as UserRoundCog,
|
|
158
|
+
Ue as Users,
|
|
159
|
+
Qr as VirtualScrollbar,
|
|
160
|
+
ke as X,
|
|
161
|
+
o as applyThemeToCssVariables,
|
|
162
|
+
He as createIcon,
|
|
163
|
+
i as fetchWithTimeout,
|
|
164
|
+
x as formatFileSize,
|
|
165
|
+
t as generateTheme,
|
|
166
|
+
lo as getFileExtension,
|
|
167
|
+
so as getFileIcon,
|
|
168
|
+
fo as getFileTypeName,
|
|
169
|
+
mo as hasPermission,
|
|
170
|
+
io as normalizeFileDisplayItem,
|
|
171
|
+
po as parseFileNameFromUrl,
|
|
172
|
+
xo as resolveHidden,
|
|
173
|
+
d as resolveMaybeFn,
|
|
174
|
+
m as resolveVisible,
|
|
175
|
+
p as useFetchData,
|
|
176
|
+
oo as useFilterRegister,
|
|
177
|
+
to as useFilterState,
|
|
178
|
+
Co as useMarsunAuth,
|
|
179
|
+
co as useMarsunCore,
|
|
180
|
+
ho as useMarsunFetch
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._app-tour-root_ybirw_1{font-size:12px;color:var(--font-color-grey-1)}._common-filter-root_kdoz3_1{background-color:var(--bg-color-white);margin-bottom:16px}._common-filter-container_kdoz3_6{display:flex;align-items:center;gap:12px}._common-filter-label_kdoz3_12{flex-shrink:0;font-size:var(--font-size-default);font-weight:500;color:#374151}._common-filter-content_kdoz3_19{display:flex;flex:1;align-items:flex-start;justify-content:space-between}._common-filter-items_kdoz3_26{display:flex;flex-wrap:wrap;align-items:center;column-gap:6px;row-gap:8px}._common-filter-extra_kdoz3_34{flex-shrink:0;margin-left:16px}._common-filter-selected_kdoz3_39{display:flex;align-items:center;justify-content:space-between;padding-top:12px}._common-filter-selected-main_kdoz3_46{display:flex;align-items:baseline;gap:8px}._common-filter-selected-title_kdoz3_52{font-size:12px;font-weight:500;color:var(--font-color-grey)}._common-filter-selected-tags_kdoz3_58{flex:1}._common-filter-tag_kdoz3_62{display:flex;align-items:center;gap:4px}._common-filter-tag-label_kdoz3_68{font-size:12px}._common-filter-tag-close_kdoz3_72{font-size:12px;cursor:pointer;margin-left:2px;opacity:.6}._common-filter-tag-close_kdoz3_72:hover{opacity:1}._common-filter-clear-btn_kdoz3_82{padding:0!important;height:auto!important;font-size:12px}._file-link-inner_uetzp_1{flex-shrink:0}._file-link-row_uetzp_5{flex-shrink:0;font-size:12px;color:var(--font-color-grey-1)}._file-link-actions_uetzp_11{display:inline-flex;align-items:center;gap:6px;font-size:var(--font-size-small);transition:color .2s ease,background-color .2s ease}._file-link-actions_uetzp_11:hover{color:var(--primary-color)}._file-link-toolbar_uetzp_22{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._file-preview-list_1yfht_1{position:relative}._file-preview-empty_1yfht_5{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10;display:flex;align-items:center;justify-content:center;background-color:var(--bg-color-white)}._file-preview-loading_1yfht_15{width:100%;padding-top:80px;padding-bottom:80px}._file-preview-content_1yfht_21{padding:16px;font-size:var(--font-size-small);white-space:pre-wrap;overflow:auto;max-height:70vh;background-color:var(--bg-color-grey)}._file-preview-aside_1yfht_30{padding:24px;overflow:auto;max-height:70vh;background-color:var(--bg-color-white)}._file-preview-main_1yfht_37{display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto;max-height:70vh}._file-preview-section_1yfht_46{max-width:100%;max-height:65vh;object-fit:contain}._file-preview-group_1yfht_52{width:100%}._file-preview-cell_1yfht_56{overflow:auto;max-height:70vh;background-color:var(--bg-color-white)}._file-preview-overlay_1yfht_62{position:relative;display:flex;align-items:center;justify-content:center}._file-preview-badge_1yfht_69{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:48px;padding-bottom:48px;gap:16px}._file-preview-tag_1yfht_79{position:relative;display:flex;align-items:center;justify-content:center;padding:16px}._file-preview-hint_1yfht_87{max-width:100%;max-height:65vh}._file-preview-sider_1yfht_92{font-size:48px}._file-preview-nav_1yfht_96{text-align:center}._file-preview-menu_1yfht_100{color:var(--font-color-grey);margin-bottom:4px}._file-preview-user-menu_1yfht_105{font-size:12px;color:var(--font-color-grey-1)}._file-preview-avatar_1yfht_110{display:flex;align-items:center;justify-content:center;padding:32px}._file-preview-upload_1yfht_117{width:100%;max-width:1024px}._file-preview-filter_1yfht_122{display:flex;align-items:center;justify-content:space-between;padding-top:12px;padding-bottom:12px;border-bottom-width:1px;border-bottom-style:solid;border-color:var(--font-color-grey-4)}._file-preview-table_1yfht_133{font-weight:500}._tags-tag-list_d5l57_1{display:flex;align-items:center;gap:4px;flex-wrap:wrap}._tags-tag-list-nowrap_d5l57_8{flex-wrap:nowrap}._tags-tag-list-tooltip_d5l57_12{max-width:320px}._filter-panel-body_tjvgz_1{margin-bottom:12px}._filter-panel-actions_tjvgz_5{display:flex;justify-content:flex-end;gap:8px}._filter-trigger-root_115kh_1{display:inline-flex;align-items:center;gap:4px;cursor:pointer;border-radius:4px;padding:2px 6px;font-size:12px;transition:color .2s ease,background-color .2s ease}._filter-trigger-active_115kh_12{background-color:var(--primary-color);color:var(--bg-color-white)}._filter-trigger-inactive_115kh_17{color:#374151}._filter-trigger-inactive_115kh_17:hover{color:var(--primary-color);background-color:var(--primary-color-bg)}._filter-trigger-chevron_115kh_25{font-size:10px}._filter-date-range-quick-options_ctl7u_1{margin-bottom:12px;display:flex;flex-wrap:wrap;gap:8px}._filter-date-range-quick-option_ctl7u_1{cursor:pointer;border-radius:4px;padding:4px 8px;font-size:var(--font-size-small)}._filter-date-range-quick-option_ctl7u_1:hover{background-color:var(--primary-color-bg)}._filter-date-range-quick-option-active_ctl7u_18{background-color:var(--primary-color);color:var(--bg-color-white);font-weight:500}._filter-date-range-picker_ctl7u_24{width:100%}._filter-number-range-inputs_y3pfu_1{display:flex;align-items:center;gap:8px}._filter-number-range-separator_y3pfu_7{color:var(--font-color-grey-1)}._filter-number-range-unit_y3pfu_11{font-size:var(--font-size-small);color:var(--font-color-grey)}._person-option-row-root_lf6i9_1{font-size:var(--font-size-small)}._person-option-row-container_lf6i9_5{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._person-option-row-wrapper_lf6i9_11{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--font-color-grey-1);font-size:12px}._person-option-row-inner_lf6i9_19{margin-left:auto;flex-shrink:0;color:var(--font-color-grey-1)}._person-option-row-inner_lf6i9_19:hover{color:var(--primary-color)}._person-option-row-person-row_lf6i9_28{display:flex;align-items:center;gap:8px;min-width:0;flex:1}._filter-select-search_1esgk_1{margin-bottom:12px}._filter-select-options_1esgk_5{max-height:300px;overflow:auto}._filter-select-option_1esgk_5{display:flex;align-items:center;gap:8px;cursor:pointer;border-radius:4px;padding:6px 8px;font-size:var(--font-size-small)}._filter-select-option_1esgk_5:hover{background-color:var(--bg-color-grey)}._filter-select-option-selected_1esgk_23{color:var(--primary-color);font-weight:500}._filter-select-option-check_1esgk_28{margin-left:auto;font-size:12px;color:var(--primary-color)}._filter-select-empty_1esgk_34{padding-top:16px;padding-bottom:16px;text-align:center;font-size:var(--font-size-small);color:var(--font-color-grey-1)}._filter-select-selected-bar_1esgk_42{margin-top:8px;border-top-width:1px;border-top-style:solid;padding-top:8px}._filter-select-selected-label_1esgk_49{margin-bottom:4px;font-size:12px;color:var(--font-color-grey-1)}._filter-select-selected-tag_1esgk_55{display:inline-flex;cursor:pointer;align-items:center;gap:4px;background-color:var(--bg-color-grey-1);padding:2px 6px;font-size:12px}._filter-select-selected-remove_1esgk_68{font-size:10px}._filter-tree-select-search_he1ck_1{margin-bottom:12px}._filter-tree-select-options_he1ck_5{max-height:300px;overflow:auto}._filter-tree-select-option_he1ck_5{display:flex;align-items:center;gap:8px;cursor:pointer;border-radius:4px;padding:6px 8px;font-size:var(--font-size-small)}._filter-tree-select-option_he1ck_5:hover{background-color:var(--bg-color-grey)}._filter-tree-select-option-selected_he1ck_23{color:var(--primary-color);font-weight:500}._filter-tree-select-option-check_he1ck_28{margin-left:auto;font-size:12px;color:var(--primary-color)}._filter-tree-select-expand-icon_he1ck_34{display:inline-flex;width:16px;flex-shrink:0;cursor:pointer;align-items:center;justify-content:center;color:var(--font-color-grey-1)}._filter-tree-select-expand-placeholder_he1ck_44{display:inline-flex;width:16px;flex-shrink:0}._filter-tree-select-node-label_he1ck_50{flex:1}._filter-tree-select-empty_he1ck_54{padding-top:16px;padding-bottom:16px;text-align:center;font-size:var(--font-size-small);color:var(--font-color-grey-1)}._filter-tree-select-selected-bar_he1ck_62{margin-top:8px;border-top-width:1px;border-top-style:solid;padding-top:8px}._filter-tree-select-selected-label_he1ck_69{margin-bottom:4px;font-size:12px;color:var(--font-color-grey-1)}._filter-tree-select-selected-tag_he1ck_75{display:inline-flex;cursor:pointer;align-items:center;gap:4px;background-color:var(--bg-color-grey-1);padding:2px 6px;font-size:12px}._filter-tree-select-selected-remove_he1ck_88{font-size:10px}._page-header-layout-root_13o9c_1{display:flex;align-items:center;justify-content:space-between}._page-header-layout-container_13o9c_7{display:flex;align-items:center}._page-header-layout-wrapper_13o9c_12{font-size:var(--font-size-18);font-weight:600}._page-header-layout-inner_13o9c_17{margin-bottom:16px;padding:8px 12px;background-color:var(--primary-color-bg);border:1px solid var(--primary-color-border);border-radius:4px;font-size:var(--font-size-small);color:var(--primary-color)}._stat-card-clickable_xovsh_1{cursor:pointer}._stat-card-clickable_xovsh_1 .ant-statistic-content,._stat-card-clickable_xovsh_1 .ant-statistic-content .ant-statistic-content-prefix{display:flex!important;align-items:center}._stat-pending-breakdown-root_85di3_1{font-size:12px;color:var(--font-color-grey-1);margin-bottom:8px}._stat-pending-breakdown-container_85di3_7{font-size:12px;font-weight:400;color:var(--font-color-grey-1);margin-top:4px;line-height:var(--line-height-default)}._stat-pending-breakdown-detail-divider_85di3_15{margin-top:12px;padding-top:12px;border-top:1px solid var(--font-color-grey-4)}._step-modal-root_1ccyj_1{display:flex;align-items:center;gap:8px}._step-modal-container_1ccyj_7{flex:1}._step-modal-wrapper_1ccyj_11{margin-bottom:24px}._virtual-scrollbar-root_hy6p8_1{position:relative;display:flex;flex-direction:column;overflow:hidden;min-height:0;min-width:0}._virtual-scrollbar-viewport_hy6p8_14{flex:1 1 auto;width:100%;height:100%;min-height:0;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}._virtual-scrollbar-viewport_hy6p8_14::-webkit-scrollbar{display:none}._virtual-scrollbar-track_hy6p8_27{opacity:1;pointer-events:auto}._virtual-scrollbar-track-vertical_hy6p8_32{position:absolute;z-index:2;opacity:0;pointer-events:none;transition:opacity .2s ease;top:2px;right:2px;bottom:2px;width:6px}._virtual-scrollbar-track-horizontal_hy6p8_44{opacity:1;pointer-events:auto}._virtual-scrollbar-thumb_hy6p8_49{top:0;bottom:0;min-width:24px}._file-item-root_lmij6_1{transition:color .2s ease,background-color .2s ease}._file-item-root_lmij6_1:hover{background-color:var(--bg-color-grey)}._file-item-container_lmij6_8{display:flex;align-items:center;justify-content:space-between;padding:6px 8px}._file-item-wrapper_lmij6_18{display:flex;gap:8px;min-width:0;flex:1}._file-item-inner_lmij6_25{flex-shrink:0}._file-item-header_lmij6_29{min-width:0;flex:1}._file-item-body_lmij6_34{display:flex;align-items:center;gap:8px}._file-item-footer_lmij6_40{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-size-small)}._file-item-row_lmij6_47{flex-shrink:0;font-size:12px;color:var(--font-color-grey-1)}._file-item-col_lmij6_53{margin-top:2px;gap:2px}._file-item-wrap_lmij6_18{display:flex;align-items:center;gap:8px;flex-shrink:0;margin-left:8px}._file-item-panel_lmij6_66{display:flex;align-items:center}._file-item-action-group_lmij6_71{display:flex;align-items:center;gap:4px}._file-item-action-group-disabled_lmij6_77{opacity:.45;pointer-events:none}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as a } from "antd";
|
|
3
|
+
import { useMemo as o, useEffect as g } from "react";
|
|
4
|
+
import { generateTheme as t, applyThemeToCssVariables as A } from "../theme/theme.js";
|
|
5
|
+
import { DEFAULT_PRIMARY_COLOR as M } from "../theme/constants.js";
|
|
6
|
+
import { MarsunCoreContext as y } from "./context.js";
|
|
7
|
+
import { useMarsunAuth as L, useMarsunCore as O, useMarsunFetch as V } from "./context.js";
|
|
8
|
+
const b = ({
|
|
9
|
+
children: i,
|
|
10
|
+
theme: n,
|
|
11
|
+
auth: s,
|
|
12
|
+
fetch: f,
|
|
13
|
+
withConfigProvider: C = !0
|
|
14
|
+
}) => {
|
|
15
|
+
const e = (n == null ? void 0 : n.primaryColor) ?? M, c = o(
|
|
16
|
+
() => ({
|
|
17
|
+
auth: {
|
|
18
|
+
isAuthenticated: (s == null ? void 0 : s.isAuthenticated) ?? !1,
|
|
19
|
+
user: (s == null ? void 0 : s.user) ?? null,
|
|
20
|
+
hasAnyRole: (s == null ? void 0 : s.hasAnyRole) ?? (() => !1),
|
|
21
|
+
hasPermission: (s == null ? void 0 : s.hasPermission) ?? (() => !1)
|
|
22
|
+
},
|
|
23
|
+
fetch: f ?? {},
|
|
24
|
+
theme: {
|
|
25
|
+
primaryColor: e,
|
|
26
|
+
themeConfig: n == null ? void 0 : n.themeConfig
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
[s, f, e, n == null ? void 0 : n.themeConfig]
|
|
30
|
+
), m = (n == null ? void 0 : n.themeConfig) ?? t(e);
|
|
31
|
+
g(() => {
|
|
32
|
+
A(e);
|
|
33
|
+
}, [e]);
|
|
34
|
+
const d = C ? /* @__PURE__ */ l(
|
|
35
|
+
a,
|
|
36
|
+
{
|
|
37
|
+
theme: m,
|
|
38
|
+
getPopupContainer: () => document.body,
|
|
39
|
+
children: i
|
|
40
|
+
}
|
|
41
|
+
) : i;
|
|
42
|
+
return /* @__PURE__ */ l(y.Provider, { value: c, children: d });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
y as MarsunCoreContext,
|
|
46
|
+
b as default,
|
|
47
|
+
L as useMarsunAuth,
|
|
48
|
+
O as useMarsunCore,
|
|
49
|
+
V as useMarsunFetch
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=MarsunCoreProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarsunCoreProvider.js","sources":["../../src/provider/MarsunCoreProvider.tsx"],"sourcesContent":["import { ConfigProvider } from 'antd';\nimport type { ThemeConfig } from 'antd';\nimport React, { useEffect, useMemo } from 'react';\nimport { DEFAULT_PRIMARY_COLOR, applyThemeToCssVariables, generateTheme } from '@/theme';\nimport {\n MarsunCoreContext,\n type MarsunAuthContext,\n type MarsunFetchContext,\n} from './context';\n\nexport type MarsunCoreProviderProps = {\n children: React.ReactNode;\n /** 主题覆盖;外层已有 ConfigProvider 时 token 自然优先 */\n theme?: {\n primaryColor?: string;\n themeConfig?: ThemeConfig;\n };\n /** 鉴权注入(Auth / AgentHub guards 使用) */\n auth?: Partial<MarsunAuthContext>;\n /** fetch 模式默认配置 */\n fetch?: MarsunFetchContext;\n /** 设为 false 时不渲染内部 ConfigProvider(消费方已包裹时) */\n withConfigProvider?: boolean;\n};\n\nconst MarsunCoreProvider: React.FC<MarsunCoreProviderProps> = ({\n children,\n theme: themeProp,\n auth: authProp,\n fetch: fetchProp,\n withConfigProvider = true,\n}) => {\n const primaryColor = themeProp?.primaryColor ?? DEFAULT_PRIMARY_COLOR;\n\n const contextValue = useMemo(\n () => ({\n auth: {\n isAuthenticated: authProp?.isAuthenticated ?? false,\n user: authProp?.user ?? null,\n hasAnyRole: authProp?.hasAnyRole ?? (() => false),\n hasPermission: authProp?.hasPermission ?? (() => false),\n },\n fetch: fetchProp ?? {},\n theme: {\n primaryColor,\n themeConfig: themeProp?.themeConfig,\n },\n }),\n [authProp, fetchProp, primaryColor, themeProp?.themeConfig],\n );\n\n const antdTheme = themeProp?.themeConfig ?? generateTheme(primaryColor);\n\n useEffect(() => {\n applyThemeToCssVariables(primaryColor);\n }, [primaryColor]);\n\n const content = withConfigProvider ? (\n <ConfigProvider\n theme={antdTheme}\n getPopupContainer={() => document.body}\n >\n {children}\n </ConfigProvider>\n ) : (\n children\n );\n\n return (\n <MarsunCoreContext.Provider value={contextValue}>{content}</MarsunCoreContext.Provider>\n );\n};\n\nexport default MarsunCoreProvider;\nexport { MarsunCoreContext, useMarsunAuth, useMarsunCore, useMarsunFetch } from './context';\n"],"names":["MarsunCoreProvider","children","themeProp","authProp","fetchProp","withConfigProvider","primaryColor","DEFAULT_PRIMARY_COLOR","contextValue","useMemo","antdTheme","generateTheme","useEffect","applyThemeToCssVariables","content","jsx","ConfigProvider","MarsunCoreContext"],"mappings":";;;;;;;AAyBA,MAAMA,IAAwD,CAAC;AAAA,EAC7D,UAAAC;AAAA,EACA,OAAOC;AAAA,EACP,MAAMC;AAAA,EACN,OAAOC;AAAA,EACP,oBAAAC,IAAqB;AACvB,MAAM;AACJ,QAAMC,KAAeJ,KAAA,gBAAAA,EAAW,iBAAgBK,GAE1CC,IAAeC;AAAA,IACnB,OAAO;AAAA,MACL,MAAM;AAAA,QACJ,kBAAiBN,KAAA,gBAAAA,EAAU,oBAAmB;AAAA,QAC9C,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,QACxB,aAAYA,KAAA,gBAAAA,EAAU,gBAAe,MAAM;AAAA,QAC3C,gBAAeA,KAAA,gBAAAA,EAAU,mBAAkB,MAAM;AAAA,MAAA;AAAA,MAEnD,OAAOC,KAAa,CAAA;AAAA,MACpB,OAAO;AAAA,QACL,cAAAE;AAAA,QACA,aAAaJ,KAAA,gBAAAA,EAAW;AAAA,MAAA;AAAA,IAC1B;AAAA,IAEF,CAACC,GAAUC,GAAWE,GAAcJ,KAAA,gBAAAA,EAAW,WAAW;AAAA,EAAA,GAGtDQ,KAAYR,KAAA,gBAAAA,EAAW,gBAAeS,EAAcL,CAAY;AAEtE,EAAAM,EAAU,MAAM;AACd,IAAAC,EAAyBP,CAAY;AAAA,EACvC,GAAG,CAACA,CAAY,CAAC;AAEjB,QAAMQ,IAAUT,IACd,gBAAAU;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAON;AAAA,MACP,mBAAmB,MAAM,SAAS;AAAA,MAEjC,UAAAT;AAAA,IAAA;AAAA,EAAA,IAGHA;AAGF,2BACGgB,EAAkB,UAAlB,EAA2B,OAAOT,GAAe,UAAAM,GAAQ;AAE9D;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useContext as e, createContext as n } from "react";
|
|
2
|
+
const u = {
|
|
3
|
+
isAuthenticated: !1,
|
|
4
|
+
user: null,
|
|
5
|
+
hasAnyRole: () => !1,
|
|
6
|
+
hasPermission: () => !1
|
|
7
|
+
}, t = n({
|
|
8
|
+
auth: u,
|
|
9
|
+
fetch: {},
|
|
10
|
+
theme: { primaryColor: "#1677ff" }
|
|
11
|
+
});
|
|
12
|
+
function s() {
|
|
13
|
+
return e(t);
|
|
14
|
+
}
|
|
15
|
+
function o() {
|
|
16
|
+
return e(t).auth;
|
|
17
|
+
}
|
|
18
|
+
function a() {
|
|
19
|
+
return e(t).fetch;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
t as MarsunCoreContext,
|
|
23
|
+
o as useMarsunAuth,
|
|
24
|
+
s as useMarsunCore,
|
|
25
|
+
a as useMarsunFetch
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../src/provider/context.ts"],"sourcesContent":["import type { ThemeConfig } from 'antd';\nimport { createContext, useContext } from 'react';\n\nexport type MarsunAuthContext = {\n isAuthenticated: boolean;\n user: Record<string, unknown> | null;\n hasAnyRole?: (roles: string[]) => boolean;\n hasPermission?: (permission: string) => boolean;\n};\n\nexport type MarsunFetchContext = {\n baseUrl?: string;\n timeoutMs?: number;\n headers?: Record<string, string>;\n};\n\nexport type MarsunCoreContextValue = {\n auth: MarsunAuthContext;\n fetch: MarsunFetchContext;\n theme: {\n primaryColor: string;\n themeConfig?: ThemeConfig;\n };\n};\n\nconst defaultAuth: MarsunAuthContext = {\n isAuthenticated: false,\n user: null,\n hasAnyRole: () => false,\n hasPermission: () => false,\n};\n\nexport const MarsunCoreContext = createContext<MarsunCoreContextValue>({\n auth: defaultAuth,\n fetch: {},\n theme: { primaryColor: '#1677ff' },\n});\n\nexport function useMarsunCore(): MarsunCoreContextValue {\n return useContext(MarsunCoreContext);\n}\n\nexport function useMarsunAuth(): MarsunAuthContext {\n return useContext(MarsunCoreContext).auth;\n}\n\nexport function useMarsunFetch(): MarsunFetchContext {\n return useContext(MarsunCoreContext).fetch;\n}\n"],"names":["defaultAuth","MarsunCoreContext","createContext","useMarsunCore","useContext","useMarsunAuth","useMarsunFetch"],"mappings":";AAyBA,MAAMA,IAAiC;AAAA,EACrC,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AACvB,GAEaC,IAAoBC,EAAsC;AAAA,EACrE,MAAMF;AAAA,EACN,OAAO,CAAA;AAAA,EACP,OAAO,EAAE,cAAc,UAAA;AACzB,CAAC;AAEM,SAASG,IAAwC;AACtD,SAAOC,EAAWH,CAAiB;AACrC;AAEO,SAASI,IAAmC;AACjD,SAAOD,EAAWH,CAAiB,EAAE;AACvC;AAEO,SAASK,IAAqC;AACnD,SAAOF,EAAWH,CAAiB,EAAE;AACvC;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const r = "#1677ff", t = {
|
|
2
|
+
primary: "#1677ff",
|
|
3
|
+
success: "#027A48",
|
|
4
|
+
info: "#155ACF",
|
|
5
|
+
error: "#D14343",
|
|
6
|
+
warning: "#F09700",
|
|
7
|
+
textBase: "#222222",
|
|
8
|
+
textSecondary: "#666666",
|
|
9
|
+
textTertiary: "#999999"
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
r as DEFAULT_PRIMARY_COLOR,
|
|
13
|
+
t as PALETTE
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/theme/constants.ts"],"sourcesContent":["export { generateTheme, applyThemeToCssVariables } from './theme';\n\nexport const DEFAULT_PRIMARY_COLOR = '#1677ff';\n\nexport const PALETTE = {\n primary: '#1677ff',\n success: '#027A48',\n info: '#155ACF',\n error: '#D14343',\n warning: '#F09700',\n textBase: '#222222',\n textSecondary: '#666666',\n textTertiary: '#999999',\n} as const;\n"],"names":["DEFAULT_PRIMARY_COLOR","PALETTE"],"mappings":"AAEO,MAAMA,IAAwB,WAExBC,IAAU;AAAA,EACrB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,eAAe;AAAA,EACf,cAAc;AAChB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { applyThemeToCssVariables as T, generateTheme as o } from "./theme.js";
|
|
2
|
+
import { DEFAULT_PRIMARY_COLOR as m, PALETTE as p } from "./constants.js";
|
|
3
|
+
export {
|
|
4
|
+
m as DEFAULT_PRIMARY_COLOR,
|
|
5
|
+
p as PALETTE,
|
|
6
|
+
T as applyThemeToCssVariables,
|
|
7
|
+
o as generateTheme
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|