@hkyhy/marsun-components-core 0.1.17 → 0.1.19
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/Auth/ProtectedRoute.js +20 -14
- package/dist/components/Auth/ProtectedRoute.js.map +1 -1
- package/dist/components/File/index.d.ts +2 -0
- package/dist/components/File/utils/download.d.ts +20 -0
- package/dist/components/File/utils/download.js +30 -0
- package/dist/components/File/utils/download.js.map +1 -0
- package/dist/components/Filter/types.d.ts +1 -0
- package/dist/components/Filter/types.js.map +1 -1
- package/dist/components/Layout/ModulePageShell/index.d.ts +17 -0
- package/dist/components/Layout/ModulePageShell/index.js +42 -0
- package/dist/components/Layout/ModulePageShell/index.js.map +1 -0
- package/dist/components/Layout/ModulePageShell/style.module.scss.js +10 -0
- package/dist/components/Layout/ModulePageShell/style.module.scss.js.map +1 -0
- package/dist/components/Layout/PageHeaderLayout/index.d.ts +3 -1
- package/dist/components/Layout/PageHeaderLayout/index.js +43 -34
- package/dist/components/Layout/PageHeaderLayout/index.js.map +1 -1
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js +5 -4
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js.map +1 -1
- package/dist/components/Layout/PageShell/PageShellContext.d.ts +20 -0
- package/dist/components/Layout/PageShell/PageShellContext.js +39 -0
- package/dist/components/Layout/PageShell/PageShellContext.js.map +1 -0
- package/dist/components/Layout/PageShell/index.d.ts +2 -0
- package/dist/components/Layout/PageSpin/index.d.ts +9 -0
- package/dist/components/Layout/PageSpin/index.js +9 -0
- package/dist/components/Layout/PageSpin/index.js.map +1 -0
- package/dist/components/Layout/PageSpin/style.module.scss.js +7 -0
- package/dist/components/Layout/PageSpin/style.module.scss.js.map +1 -0
- package/dist/components/Layout/index.d.ts +6 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +361 -290
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/axios/index.js +41 -0
- package/dist/node_modules/axios/index.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +66 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +324 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js.map +1 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +86 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js.map +1 -0
- package/dist/node_modules/axios/lib/axios.js +47 -0
- package/dist/node_modules/axios/lib/axios.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +78 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +19 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +7 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
- package/dist/node_modules/axios/lib/core/Axios.js +168 -0
- package/dist/node_modules/axios/lib/core/Axios.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +110 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +193 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +60 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +30 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +43 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +94 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/core/settle.js +15 -0
- package/dist/node_modules/axios/lib/core/settle.js.map +1 -0
- package/dist/node_modules/axios/lib/core/transformData.js +14 -0
- package/dist/node_modules/axios/lib/core/transformData.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/index.js +96 -0
- package/dist/node_modules/axios/lib/defaults/index.js.map +1 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +12 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js.map +1 -0
- package/dist/node_modules/axios/lib/env/data.js +5 -0
- package/dist/node_modules/axios/lib/env/data.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +31 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +78 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +9 -0
- package/dist/node_modules/axios/lib/helpers/bind.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +24 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +7 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +33 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +44 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +43 -0
- package/dist/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +47 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +8 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +9 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/null.js +5 -0
- package/dist/node_modules/axios/lib/helpers/null.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +31 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +8 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +41 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +54 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +34 -0
- package/dist/node_modules/axios/lib/helpers/sanitizeHeaderValue.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +20 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +9 -0
- package/dist/node_modules/axios/lib/helpers/spread.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +16 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +115 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +67 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +58 -0
- package/dist/node_modules/axios/lib/helpers/validator.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +6 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +16 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +10 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js.map +1 -0
- package/dist/node_modules/axios/lib/platform/index.js +10 -0
- package/dist/node_modules/axios/lib/platform/index.js.map +1 -0
- package/dist/node_modules/axios/lib/utils.js +303 -0
- package/dist/node_modules/axios/lib/utils.js.map +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/types/auth.d.ts +18 -0
- package/dist/utils/authRedirect.d.ts +6 -0
- package/dist/utils/authRedirect.js +33 -0
- package/dist/utils/authRedirect.js.map +1 -0
- package/dist/utils/createMarsunRequest.d.ts +26 -0
- package/dist/utils/createMarsunRequest.js +53 -0
- package/dist/utils/createMarsunRequest.js.map +1 -0
- package/dist/utils/date.d.ts +4 -0
- package/dist/utils/date.js +11 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/department/departmentPath.d.ts +18 -0
- package/dist/utils/department/departmentPath.js +63 -0
- package/dist/utils/department/departmentPath.js.map +1 -0
- package/dist/utils/department/departmentScope.d.ts +20 -0
- package/dist/utils/department/departmentScope.js +63 -0
- package/dist/utils/department/departmentScope.js.map +1 -0
- package/dist/utils/department/types.d.ts +12 -0
- package/dist/utils/permissionStorage.d.ts +13 -0
- package/dist/utils/permissionStorage.js +43 -0
- package/dist/utils/permissionStorage.js.map +1 -0
- package/dist/utils/personOption.d.ts +49 -0
- package/dist/utils/personOption.js +90 -0
- package/dist/utils/personOption.js.map +1 -0
- package/dist/utils/sessionActivity.d.ts +5 -0
- package/dist/utils/sessionActivity.js +18 -0
- package/dist/utils/sessionActivity.js.map +1 -0
- package/dist/utils/user/employeeId.d.ts +8 -0
- package/dist/utils/user/employeeId.js +14 -0
- package/dist/utils/user/employeeId.js.map +1 -0
- package/package.json +24 -1
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { jsx as t, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { buildLoginPath as d, buildLocationRedirectUrl as g } from "../../utils/authRedirect.js";
|
|
3
|
+
import { useLocation as h, Navigate as i } from "react-router-dom";
|
|
4
|
+
import { useMarsunAuth as l } from "../../provider/context.js";
|
|
5
|
+
const j = ({
|
|
6
|
+
roles: r,
|
|
7
|
+
permission: n,
|
|
8
|
+
loginPath: c = "/login",
|
|
8
9
|
fallbackPath: a = "/",
|
|
9
|
-
children:
|
|
10
|
+
children: m
|
|
10
11
|
}) => {
|
|
11
|
-
const { isAuthenticated:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const { isAuthenticated: p, hasAnyRole: e, hasPermission: o } = l(), u = h();
|
|
13
|
+
return p ? r && r.length > 0 && !(e != null && e(r)) ? /* @__PURE__ */ t(i, { to: a, replace: !0 }) : n && !(o != null && o(n)) ? /* @__PURE__ */ t(i, { to: a, replace: !0 }) : /* @__PURE__ */ t(f, { children: m }) : /* @__PURE__ */ t(
|
|
14
|
+
i,
|
|
15
|
+
{
|
|
16
|
+
to: d(
|
|
17
|
+
g(u.pathname, u.search, u.hash),
|
|
18
|
+
c
|
|
19
|
+
),
|
|
20
|
+
replace: !0
|
|
21
|
+
}
|
|
22
|
+
);
|
|
17
23
|
};
|
|
18
24
|
export {
|
|
19
|
-
|
|
25
|
+
j as default
|
|
20
26
|
};
|
|
21
27
|
//# sourceMappingURL=ProtectedRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtectedRoute.js","sources":["../../../src/components/Auth/ProtectedRoute.tsx"],"sourcesContent":["import { useMarsunAuth } from '@/provider';\nimport React from 'react';\nimport { Navigate, useLocation } from 'react-router-dom';\n\nexport interface ProtectedRouteProps {\n roles?: string[];\n permission?: string;\n loginPath?: string;\n fallbackPath?: string;\n children: React.ReactNode;\n}\n\nconst ProtectedRoute: React.FC<ProtectedRouteProps> = ({\n roles,\n permission,\n loginPath = '/login',\n fallbackPath = '/',\n children,\n}) => {\n const { isAuthenticated, hasAnyRole, hasPermission } = useMarsunAuth();\n const location = useLocation();\n\n if (!isAuthenticated) {\n
|
|
1
|
+
{"version":3,"file":"ProtectedRoute.js","sources":["../../../src/components/Auth/ProtectedRoute.tsx"],"sourcesContent":["import { useMarsunAuth } from '@/provider';\nimport { buildLocationRedirectUrl, buildLoginPath } from '@/utils/authRedirect';\nimport React from 'react';\nimport { Navigate, useLocation } from 'react-router-dom';\n\nexport interface ProtectedRouteProps {\n roles?: string[];\n permission?: string;\n loginPath?: string;\n fallbackPath?: string;\n children: React.ReactNode;\n}\n\nconst ProtectedRoute: React.FC<ProtectedRouteProps> = ({\n roles,\n permission,\n loginPath = '/login',\n fallbackPath = '/',\n children,\n}) => {\n const { isAuthenticated, hasAnyRole, hasPermission } = useMarsunAuth();\n const location = useLocation();\n\n if (!isAuthenticated) {\n return (\n <Navigate\n to={buildLoginPath(\n buildLocationRedirectUrl(location.pathname, location.search, location.hash),\n loginPath,\n )}\n replace\n />\n );\n }\n\n if (roles && roles.length > 0 && !hasAnyRole?.(roles)) {\n return <Navigate to={fallbackPath} replace />;\n }\n\n if (permission && !hasPermission?.(permission)) {\n return <Navigate to={fallbackPath} replace />;\n }\n\n return <>{children}</>;\n};\n\nexport default ProtectedRoute;\n"],"names":["ProtectedRoute","roles","permission","loginPath","fallbackPath","children","isAuthenticated","hasAnyRole","hasPermission","useMarsunAuth","location","useLocation","jsx","Navigate","buildLoginPath","buildLocationRedirectUrl"],"mappings":";;;;AAaA,MAAMA,IAAgD,CAAC;AAAA,EACrD,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,cAAAC,IAAe;AAAA,EACf,UAAAC;AACF,MAAM;AACJ,QAAM,EAAE,iBAAAC,GAAiB,YAAAC,GAAY,eAAAC,EAAA,IAAkBC,EAAA,GACjDC,IAAWC,EAAA;AAEjB,SAAKL,IAYDL,KAASA,EAAM,SAAS,KAAK,EAACM,KAAA,QAAAA,EAAaN,MACtC,gBAAAW,EAACC,GAAA,EAAS,IAAIT,GAAc,SAAO,IAAC,IAGzCF,KAAc,EAACM,KAAA,QAAAA,EAAgBN,MAC1B,gBAAAU,EAACC,GAAA,EAAS,IAAIT,GAAc,SAAO,IAAC,2BAGnC,UAAAC,GAAS,IAlBf,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,IAAIC;AAAA,QACFC,EAAyBL,EAAS,UAAUA,EAAS,QAAQA,EAAS,IAAI;AAAA,QAC1EP;AAAA,MAAA;AAAA,MAEF,SAAO;AAAA,IAAA;AAAA,EAAA;AAcf;"}
|
|
@@ -10,3 +10,5 @@ export { default as FilePreviewModal } from './FilePreviewModal';
|
|
|
10
10
|
export type { FilePreviewModalProps } from './FilePreviewModal';
|
|
11
11
|
export { default as FilePreviewLink } from './FilePreviewLink';
|
|
12
12
|
export type { FilePreviewLinkProps } from './FilePreviewLink';
|
|
13
|
+
export { downloadFileItem, getFileDownloadAuthHeaders, getFileDownloadUrl } from './utils/download';
|
|
14
|
+
export type { FileDownloadAuthOptions, FileDownloadOptions } from './utils/download';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface FileDownloadOptions {
|
|
2
|
+
preview?: boolean;
|
|
3
|
+
token?: string | null;
|
|
4
|
+
/** API 前缀,默认 /api */
|
|
5
|
+
apiPrefix?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FileDownloadAuthOptions {
|
|
8
|
+
getToken?: () => string | null;
|
|
9
|
+
apiPrefix?: string;
|
|
10
|
+
}
|
|
11
|
+
/** 带鉴权参数的文件下载 URL(用于新窗口打开、iframe 等场景) */
|
|
12
|
+
export declare function getFileDownloadUrl(fileId: string, options?: FileDownloadOptions & {
|
|
13
|
+
getToken?: () => string | null;
|
|
14
|
+
}): string;
|
|
15
|
+
export declare function getFileDownloadAuthHeaders(getToken?: () => string | null): HeadersInit | undefined;
|
|
16
|
+
/** 通过 fetch 鉴权后触发浏览器下载 */
|
|
17
|
+
export declare function downloadFileItem(file: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}, options?: FileDownloadAuthOptions): Promise<boolean>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function t(r, e) {
|
|
2
|
+
var a;
|
|
3
|
+
const f = (e == null ? void 0 : e.apiPrefix) ?? "/api", c = (e == null ? void 0 : e.token) === void 0 ? ((a = e == null ? void 0 : e.getToken) == null ? void 0 : a.call(e)) ?? null : e.token, d = new URLSearchParams();
|
|
4
|
+
c && d.set("token", c), e != null && e.preview && d.set("preview", "1");
|
|
5
|
+
const l = d.toString();
|
|
6
|
+
return `${f}/files/${r}/download${l ? `?${l}` : ""}`;
|
|
7
|
+
}
|
|
8
|
+
function u(r) {
|
|
9
|
+
const e = r == null ? void 0 : r();
|
|
10
|
+
return e ? { Authorization: `Bearer ${e}` } : void 0;
|
|
11
|
+
}
|
|
12
|
+
async function w(r, e) {
|
|
13
|
+
const f = (e == null ? void 0 : e.apiPrefix) ?? "/api";
|
|
14
|
+
try {
|
|
15
|
+
const c = await fetch(`${f}/files/${r.id}/download`, {
|
|
16
|
+
headers: u(e == null ? void 0 : e.getToken)
|
|
17
|
+
});
|
|
18
|
+
if (!c.ok) return !1;
|
|
19
|
+
const d = await c.blob(), l = URL.createObjectURL(d), a = document.createElement("a");
|
|
20
|
+
return a.href = l, a.download = r.name, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(l), !0;
|
|
21
|
+
} catch {
|
|
22
|
+
return !1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
w as downloadFileItem,
|
|
27
|
+
u as getFileDownloadAuthHeaders,
|
|
28
|
+
t as getFileDownloadUrl
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sources":["../../../../src/components/File/utils/download.ts"],"sourcesContent":["export interface FileDownloadOptions {\n preview?: boolean;\n token?: string | null;\n /** API 前缀,默认 /api */\n apiPrefix?: string;\n}\n\nexport interface FileDownloadAuthOptions {\n getToken?: () => string | null;\n apiPrefix?: string;\n}\n\n/** 带鉴权参数的文件下载 URL(用于新窗口打开、iframe 等场景) */\nexport function getFileDownloadUrl(\n fileId: string,\n options?: FileDownloadOptions & { getToken?: () => string | null },\n): string {\n const apiPrefix = options?.apiPrefix ?? '/api';\n const token = options?.token === undefined ? (options?.getToken?.() ?? null) : options.token;\n const params = new URLSearchParams();\n if (token) params.set('token', token);\n if (options?.preview) params.set('preview', '1');\n const qs = params.toString();\n return `${apiPrefix}/files/${fileId}/download${qs ? `?${qs}` : ''}`;\n}\n\nexport function getFileDownloadAuthHeaders(\n getToken?: () => string | null,\n): HeadersInit | undefined {\n const token = getToken?.();\n return token ? { Authorization: `Bearer ${token}` } : undefined;\n}\n\n/** 通过 fetch 鉴权后触发浏览器下载 */\nexport async function downloadFileItem(\n file: { id: string; name: string },\n options?: FileDownloadAuthOptions,\n): Promise<boolean> {\n const apiPrefix = options?.apiPrefix ?? '/api';\n try {\n const res = await fetch(`${apiPrefix}/files/${file.id}/download`, {\n headers: getFileDownloadAuthHeaders(options?.getToken),\n });\n if (!res.ok) return false;\n\n const blob = await res.blob();\n const blobUrl = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = blobUrl;\n anchor.download = file.name;\n document.body.appendChild(anchor);\n anchor.click();\n document.body.removeChild(anchor);\n URL.revokeObjectURL(blobUrl);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["getFileDownloadUrl","fileId","options","_a","apiPrefix","token","params","qs","getFileDownloadAuthHeaders","getToken","downloadFileItem","file","res","blob","blobUrl","anchor"],"mappings":"AAaO,SAASA,EACdC,GACAC,GACQ;AAHH,MAAAC;AAIL,QAAMC,KAAYF,KAAA,gBAAAA,EAAS,cAAa,QAClCG,KAAQH,KAAA,gBAAAA,EAAS,WAAU,WAAaC,IAAAD,KAAA,gBAAAA,EAAS,aAAT,gBAAAC,EAAA,KAAAD,OAAyB,OAAQA,EAAQ,OACjFI,IAAS,IAAI,gBAAA;AACnB,EAAID,KAAOC,EAAO,IAAI,SAASD,CAAK,GAChCH,KAAA,QAAAA,EAAS,WAASI,EAAO,IAAI,WAAW,GAAG;AAC/C,QAAMC,IAAKD,EAAO,SAAA;AAClB,SAAO,GAAGF,CAAS,UAAUH,CAAM,YAAYM,IAAK,IAAIA,CAAE,KAAK,EAAE;AACnE;AAEO,SAASC,EACdC,GACyB;AACzB,QAAMJ,IAAQI,KAAA,gBAAAA;AACd,SAAOJ,IAAQ,EAAE,eAAe,UAAUA,CAAK,OAAO;AACxD;AAGA,eAAsBK,EACpBC,GACAT,GACkB;AAClB,QAAME,KAAYF,KAAA,gBAAAA,EAAS,cAAa;AACxC,MAAI;AACF,UAAMU,IAAM,MAAM,MAAM,GAAGR,CAAS,UAAUO,EAAK,EAAE,aAAa;AAAA,MAChE,SAASH,EAA2BN,KAAA,gBAAAA,EAAS,QAAQ;AAAA,IAAA,CACtD;AACD,QAAI,CAACU,EAAI,GAAI,QAAO;AAEpB,UAAMC,IAAO,MAAMD,EAAI,KAAA,GACjBE,IAAU,IAAI,gBAAgBD,CAAI,GAClCE,IAAS,SAAS,cAAc,GAAG;AACzC,WAAAA,EAAO,OAAOD,GACdC,EAAO,WAAWJ,EAAK,MACvB,SAAS,KAAK,YAAYI,CAAM,GAChCA,EAAO,MAAA,GACP,SAAS,KAAK,YAAYA,CAAM,GAChC,IAAI,gBAAgBD,CAAO,GACpB;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/components/Filter/types.ts"],"sourcesContent":["import type { MaybeFn, Visibility } from '@/utils/resolveMaybeFn';\nimport { resolveMaybeFn } from '@/utils/resolveMaybeFn';\n\n/** 筛选选项基础类型 */\nexport interface FilterOption {\n label: string;\n value: string | number;\n}\n\n/** 人员展示选项(仅 UI 字段,数据由消费方提供) */\nexport interface PersonOption extends FilterOption {\n departmentName?: string;\n email?: string;\n phone?: string;\n employeeId?: string;\n}\n\n/** 已选项 */\nexport interface SelectedItem {\n key: string;\n label: string;\n valueLabel: string;\n onRemove: () => void;\n /** 为 false 时不允许移除(如多选至少保留一项) */\n removable?: boolean;\n}\n\n/** 所有筛选组件共用的 Props */\nexport interface BaseFilterProps {\n filterKey: string;\n label: string;\n active?: boolean;\n /** 隐藏;支持 boolean 或 (ctx) => boolean */\n hidden?: Visibility;\n /** 展示;与 hidden 二选一,display 优先 */\n display?: Visibility;\n}\n\nexport type FilterVisibilityContext = Record<string, unknown>;\n\n/** 解析 hidden(兼容旧 API,支持 MaybeFn) */\nexport function resolveHidden(\n hidden: MaybeFn<boolean, FilterVisibilityContext> | undefined,\n ctx: FilterVisibilityContext = {},\n): boolean {\n if (hidden === undefined) return false;\n return resolveMaybeFn(hidden, ctx, false);\n}\n\n/** 根据 display / hidden 计算筛选项是否可见 */\nexport function resolveFilterVisible(\n props: Pick<BaseFilterProps, 'display' | 'hidden'>,\n ctx: FilterVisibilityContext = {},\n): boolean {\n if (props.display !== undefined) {\n return resolveMaybeFn(props.display, ctx, true);\n }\n return !resolveHidden(props.hidden, ctx);\n}\n"],"names":["resolveHidden","hidden","ctx","resolveMaybeFn","resolveFilterVisible","props"],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/Filter/types.ts"],"sourcesContent":["import type { MaybeFn, Visibility } from '@/utils/resolveMaybeFn';\nimport { resolveMaybeFn } from '@/utils/resolveMaybeFn';\n\n/** 筛选选项基础类型 */\nexport interface FilterOption {\n label: string;\n value: string | number;\n}\n\n/** 人员展示选项(仅 UI 字段,数据由消费方提供) */\nexport interface PersonOption extends FilterOption {\n departmentId?: string;\n departmentName?: string;\n email?: string;\n phone?: string;\n employeeId?: string;\n}\n\n/** 已选项 */\nexport interface SelectedItem {\n key: string;\n label: string;\n valueLabel: string;\n onRemove: () => void;\n /** 为 false 时不允许移除(如多选至少保留一项) */\n removable?: boolean;\n}\n\n/** 所有筛选组件共用的 Props */\nexport interface BaseFilterProps {\n filterKey: string;\n label: string;\n active?: boolean;\n /** 隐藏;支持 boolean 或 (ctx) => boolean */\n hidden?: Visibility;\n /** 展示;与 hidden 二选一,display 优先 */\n display?: Visibility;\n}\n\nexport type FilterVisibilityContext = Record<string, unknown>;\n\n/** 解析 hidden(兼容旧 API,支持 MaybeFn) */\nexport function resolveHidden(\n hidden: MaybeFn<boolean, FilterVisibilityContext> | undefined,\n ctx: FilterVisibilityContext = {},\n): boolean {\n if (hidden === undefined) return false;\n return resolveMaybeFn(hidden, ctx, false);\n}\n\n/** 根据 display / hidden 计算筛选项是否可见 */\nexport function resolveFilterVisible(\n props: Pick<BaseFilterProps, 'display' | 'hidden'>,\n ctx: FilterVisibilityContext = {},\n): boolean {\n if (props.display !== undefined) {\n return resolveMaybeFn(props.display, ctx, true);\n }\n return !resolveHidden(props.hidden, ctx);\n}\n"],"names":["resolveHidden","hidden","ctx","resolveMaybeFn","resolveFilterVisible","props"],"mappings":";AA0CO,SAASA,EACdC,GACAC,IAA+B,IACtB;AACT,SAAID,MAAW,SAAkB,KAC1BE,EAAeF,GAAQC,GAAK,EAAK;AAC1C;AAGO,SAASE,EACdC,GACAH,IAA+B,IACtB;AACT,SAAIG,EAAM,YAAY,SACbF,EAAeE,EAAM,SAASH,GAAK,EAAI,IAEzC,CAACF,EAAcK,EAAM,QAAQH,CAAG;AACzC;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ModulePageShellProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
breadcrumb?: ReactNode;
|
|
6
|
+
toolbar?: ReactNode;
|
|
7
|
+
/** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */
|
|
8
|
+
spinning?: boolean;
|
|
9
|
+
/** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */
|
|
10
|
+
syncPageMeta?: boolean;
|
|
11
|
+
actions?: Record<string, unknown>[];
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
bodyClassName?: string;
|
|
15
|
+
};
|
|
16
|
+
declare const ModulePageShell: React.FC<ModulePageShellProps>;
|
|
17
|
+
export default ModulePageShell;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import l from "classnames";
|
|
3
|
+
import { useEffect as b } from "react";
|
|
4
|
+
import N from "../PageSpin/index.js";
|
|
5
|
+
import o from "./style.module.scss.js";
|
|
6
|
+
import { usePageShell as v } from "../PageShell/PageShellContext.js";
|
|
7
|
+
const w = ({
|
|
8
|
+
title: m,
|
|
9
|
+
description: r,
|
|
10
|
+
breadcrumb: s,
|
|
11
|
+
toolbar: d,
|
|
12
|
+
spinning: u = !1,
|
|
13
|
+
syncPageMeta: n = !0,
|
|
14
|
+
actions: i,
|
|
15
|
+
children: p,
|
|
16
|
+
className: t,
|
|
17
|
+
bodyClassName: g
|
|
18
|
+
}) => {
|
|
19
|
+
const { setPageMeta: a, pageLoading: c } = v(), f = !!(u || c);
|
|
20
|
+
return b(() => {
|
|
21
|
+
if (n)
|
|
22
|
+
return a({
|
|
23
|
+
title: m,
|
|
24
|
+
description: r,
|
|
25
|
+
actionItems: i
|
|
26
|
+
}), () => a({});
|
|
27
|
+
}, [m, r, i, n, a]), /* @__PURE__ */ h("div", { className: l("module-page-shell", o["module-page-shell"], t), children: [
|
|
28
|
+
s ? /* @__PURE__ */ e("div", { className: l("module-page-breadcrumb", o["module-page-breadcrumb"]), children: s }) : null,
|
|
29
|
+
d ? /* @__PURE__ */ e("div", { className: l("module-page-toolbar", o["module-page-toolbar"]), children: d }) : null,
|
|
30
|
+
/* @__PURE__ */ e(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: l("module-page-body", o["module-page-body"], g),
|
|
34
|
+
children: /* @__PURE__ */ e(N, { spinning: f, children: p })
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
w as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/ModulePageShell/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport type ModulePageShellProps = {\n title?: string;\n description?: ReactNode;\n breadcrumb?: ReactNode;\n toolbar?: ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n /** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */\n syncPageMeta?: boolean;\n actions?: Record<string, unknown>[];\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n};\n\nconst ModulePageShell: React.FC<ModulePageShellProps> = ({\n title,\n description,\n breadcrumb,\n toolbar,\n spinning = false,\n syncPageMeta = true,\n actions,\n children,\n className,\n bodyClassName,\n}) => {\n const { setPageMeta, pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n useEffect(() => {\n if (!syncPageMeta) return;\n setPageMeta({\n title,\n description,\n actionItems: actions,\n });\n return () => setPageMeta({});\n }, [title, description, actions, syncPageMeta, setPageMeta]);\n\n return (\n <div className={classNames('module-page-shell', styles['module-page-shell'], className)}>\n {breadcrumb ? (\n <div className={classNames('module-page-breadcrumb', styles['module-page-breadcrumb'])}>\n {breadcrumb}\n </div>\n ) : null}\n\n {toolbar ? (\n <div className={classNames('module-page-toolbar', styles['module-page-toolbar'])}>\n {toolbar}\n </div>\n ) : null}\n\n <div\n className={classNames('module-page-body', styles['module-page-body'], bodyClassName)}\n >\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n </div>\n );\n};\n\nexport default ModulePageShell;\n"],"names":["ModulePageShell","title","description","breadcrumb","toolbar","spinning","syncPageMeta","actions","children","className","bodyClassName","setPageMeta","ctxLoading","usePageShell","showSpinning","useEffect","jsxs","classNames","styles","jsx","PageSpin"],"mappings":";;;;;;AAsBA,MAAMA,IAAkD,CAAC;AAAA,EACvD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAAC,GAAa,aAAaC,EAAA,IAAeC,EAAA,GAC3CC,IAAe,GAAQT,KAAYO;AAEzC,SAAAG,EAAU,MAAM;AACd,QAAKT;AACL,aAAAK,EAAY;AAAA,QACV,OAAAV;AAAA,QACA,aAAAC;AAAA,QACA,aAAaK;AAAA,MAAA,CACd,GACM,MAAMI,EAAY,EAAE;AAAA,EAC7B,GAAG,CAACV,GAAOC,GAAaK,GAASD,GAAcK,CAAW,CAAC,GAGzD,gBAAAK,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,GAAGT,CAAS,GACnF,UAAA;AAAA,IAAAN,IACC,gBAAAgB,EAAC,OAAA,EAAI,WAAWF,EAAW,0BAA0BC,EAAO,wBAAwB,CAAC,GAClF,UAAAf,EAAA,CACH,IACE;AAAA,IAEHC,IACC,gBAAAe,EAAC,OAAA,EAAI,WAAWF,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC,GAC5E,UAAAd,EAAA,CACH,IACE;AAAA,IAEJ,gBAAAe;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAW,oBAAoBC,EAAO,kBAAkB,GAAGR,CAAa;AAAA,QAEnF,UAAA,gBAAAS,EAACC,GAAA,EAAS,UAAUN,GAAe,UAAAN,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9C,GACF;AAEJ;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"module-page-shell": "_module-page-shell_140iw_1",
|
|
3
|
+
"module-page-breadcrumb": "_module-page-breadcrumb_140iw_10",
|
|
4
|
+
"module-page-toolbar": "_module-page-toolbar_140iw_19",
|
|
5
|
+
"module-page-body": "_module-page-body_140iw_26"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
e as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=style.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -5,8 +5,10 @@ export interface PageHeaderLayoutProps {
|
|
|
5
5
|
actions?: React.ReactNode;
|
|
6
6
|
/** 页面说明提示,显示在头部下方、内容区上方 */
|
|
7
7
|
description?: React.ReactNode;
|
|
8
|
+
/** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */
|
|
9
|
+
spinning?: boolean;
|
|
8
10
|
children?: React.ReactNode;
|
|
9
11
|
}
|
|
10
|
-
/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 +
|
|
12
|
+
/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 + 内容(body 内置 PageSpin) */
|
|
11
13
|
declare const PageHeaderLayout: React.FC<PageHeaderLayoutProps>;
|
|
12
14
|
export default PageHeaderLayout;
|
|
@@ -1,41 +1,50 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowLeft as
|
|
3
|
-
import { Button as
|
|
2
|
+
import { ArrowLeft as h } from "../../Icons/index.js";
|
|
3
|
+
import { Button as c } from "antd";
|
|
4
4
|
import a from "classnames";
|
|
5
|
+
import g from "../PageSpin/index.js";
|
|
5
6
|
import r from "./style.module.scss.js";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
import { usePageShell as u } from "../PageShell/PageShellContext.js";
|
|
8
|
+
const P = ({
|
|
9
|
+
title: l,
|
|
8
10
|
onBack: t,
|
|
9
|
-
actions:
|
|
10
|
-
description:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
actions: n,
|
|
12
|
+
description: i,
|
|
13
|
+
spinning: p = !1,
|
|
14
|
+
children: s
|
|
15
|
+
}) => {
|
|
16
|
+
const { pageLoading: d } = u(), m = !!(p || d);
|
|
17
|
+
return /* @__PURE__ */ o("div", { className: a("page-header-layout", r["page-header-layout"]), children: [
|
|
18
|
+
/* @__PURE__ */ o("div", { className: a("page-header-layout-root", r["page-header-layout-root"]), children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: a(
|
|
23
|
+
"page-header-layout-container",
|
|
24
|
+
r["page-header-layout-container"]
|
|
25
|
+
),
|
|
26
|
+
children: [
|
|
27
|
+
t && /* @__PURE__ */ e(c, { type: "text", icon: /* @__PURE__ */ e(h, {}), onClick: t }),
|
|
28
|
+
/* @__PURE__ */ e(
|
|
29
|
+
"h2",
|
|
30
|
+
{
|
|
31
|
+
className: a(
|
|
32
|
+
"page-header-layout-wrapper",
|
|
33
|
+
r["page-header-layout-wrapper"]
|
|
34
|
+
),
|
|
35
|
+
children: l
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ e("div", { children: n })
|
|
42
|
+
] }),
|
|
43
|
+
i && /* @__PURE__ */ e("div", { className: a("page-header-layout-inner", r["page-header-layout-inner"]), children: i }),
|
|
44
|
+
/* @__PURE__ */ e(g, { spinning: m, children: s })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
38
47
|
export {
|
|
39
|
-
|
|
48
|
+
P as default
|
|
40
49
|
};
|
|
41
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageHeaderLayout/index.tsx"],"sourcesContent":["import { ArrowLeft } from '@/components/Icons';\nimport { Button } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './style.module.scss';\n\nexport interface PageHeaderLayoutProps {\n title: string;\n onBack?: () => void;\n actions?: React.ReactNode;\n /** 页面说明提示,显示在头部下方、内容区上方 */\n description?: React.ReactNode;\n children?: React.ReactNode;\n}\n\n/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 +
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageHeaderLayout/index.tsx"],"sourcesContent":["import { ArrowLeft } from '@/components/Icons';\nimport { Button } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport interface PageHeaderLayoutProps {\n title: string;\n onBack?: () => void;\n actions?: React.ReactNode;\n /** 页面说明提示,显示在头部下方、内容区上方 */\n description?: React.ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n children?: React.ReactNode;\n}\n\n/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 + 内容(body 内置 PageSpin) */\nconst PageHeaderLayout: React.FC<PageHeaderLayoutProps> = ({\n title,\n onBack,\n actions,\n description,\n spinning = false,\n children,\n}) => {\n const { pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n return (\n <div className={classNames('page-header-layout', styles['page-header-layout'])}>\n <div className={classNames('page-header-layout-root', styles['page-header-layout-root'])}>\n <div\n className={classNames(\n 'page-header-layout-container',\n styles['page-header-layout-container'],\n )}\n >\n {onBack && <Button type=\"text\" icon={<ArrowLeft />} onClick={onBack} />}\n <h2\n className={classNames(\n 'page-header-layout-wrapper',\n styles['page-header-layout-wrapper'],\n )}\n >\n {title}\n </h2>\n </div>\n <div>{actions}</div>\n </div>\n {description && (\n <div className={classNames('page-header-layout-inner', styles['page-header-layout-inner'])}>\n {description}\n </div>\n )}\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n );\n};\n\nexport default PageHeaderLayout;\n"],"names":["PageHeaderLayout","title","onBack","actions","description","spinning","children","ctxLoading","usePageShell","showSpinning","jsxs","classNames","styles","jsx","Button","ArrowLeft","PageSpin"],"mappings":";;;;;;;AAoBA,MAAMA,IAAoD,CAAC;AAAA,EACzD,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAaC,EAAA,IAAeC,EAAA,GAC9BC,IAAe,GAAQJ,KAAYE;AAEzC,SACE,gBAAAG,EAAC,SAAI,WAAWC,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC,GAC3E,UAAA;AAAA,IAAA,gBAAAF,EAAC,SAAI,WAAWC,EAAW,2BAA2BC,EAAO,yBAAyB,CAAC,GACrF,UAAA;AAAA,MAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC;AAAA,YACT;AAAA,YACAC,EAAO,8BAA8B;AAAA,UAAA;AAAA,UAGtC,UAAA;AAAA,YAAAV,KAAU,gBAAAW,EAACC,KAAO,MAAK,QAAO,MAAM,gBAAAD,EAACE,GAAA,CAAA,CAAU,GAAI,SAASb,EAAA,CAAQ;AAAA,YACrE,gBAAAW;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWF;AAAA,kBACT;AAAA,kBACAC,EAAO,4BAA4B;AAAA,gBAAA;AAAA,gBAGpC,UAAAX;AAAA,cAAA;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAY,EAAC,SAAK,UAAAV,EAAA,CAAQ;AAAA,IAAA,GAChB;AAAA,IACCC,KACC,gBAAAS,EAAC,OAAA,EAAI,WAAWF,EAAW,4BAA4BC,EAAO,0BAA0B,CAAC,GACtF,UAAAR,EAAA,CACH;AAAA,IAEF,gBAAAS,EAACG,GAAA,EAAS,UAAUP,GAAe,UAAAH,EAAA,CAAS;AAAA,EAAA,GAC9C;AAEJ;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const e = {
|
|
2
|
-
"page-header-layout
|
|
3
|
-
"page-header-layout-
|
|
4
|
-
"page-header-layout-
|
|
5
|
-
"page-header-layout-
|
|
2
|
+
"page-header-layout": "_page-header-layout_w8y3l_1",
|
|
3
|
+
"page-header-layout-root": "_page-header-layout-root_w8y3l_8",
|
|
4
|
+
"page-header-layout-container": "_page-header-layout-container_w8y3l_14",
|
|
5
|
+
"page-header-layout-wrapper": "_page-header-layout-wrapper_w8y3l_19",
|
|
6
|
+
"page-header-layout-inner": "_page-header-layout-inner_w8y3l_24"
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
9
|
e as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PageShellMeta = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
actionItems?: Record<string, unknown>[];
|
|
6
|
+
};
|
|
7
|
+
type PageShellContextValue = {
|
|
8
|
+
meta: PageShellMeta;
|
|
9
|
+
setPageMeta: (next: PageShellMeta) => void;
|
|
10
|
+
pageLoading: boolean;
|
|
11
|
+
setPageLoading: (loading: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function usePageShell(): PageShellContextValue;
|
|
14
|
+
/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */
|
|
15
|
+
export declare function usePageShellLoading(spinning: boolean): void;
|
|
16
|
+
export type PageShellProviderProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare function PageShellProvider({ children }: PageShellProviderProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useCallback as r, useMemo as d, useContext as m, useEffect as L, createContext as M } from "react";
|
|
3
|
+
const c = {}, l = M({
|
|
4
|
+
meta: c,
|
|
5
|
+
setPageMeta: () => {
|
|
6
|
+
},
|
|
7
|
+
pageLoading: !1,
|
|
8
|
+
setPageLoading: () => {
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function S() {
|
|
12
|
+
return m(l);
|
|
13
|
+
}
|
|
14
|
+
function p(t) {
|
|
15
|
+
const { setPageLoading: e } = S();
|
|
16
|
+
L(() => (e(t), () => e(!1)), [t, e]);
|
|
17
|
+
}
|
|
18
|
+
function C({ children: t }) {
|
|
19
|
+
const [e, u] = g(c), [o, P] = g(!1), s = r((a) => {
|
|
20
|
+
u(a);
|
|
21
|
+
}, []), n = r((a) => {
|
|
22
|
+
P(a);
|
|
23
|
+
}, []), i = d(
|
|
24
|
+
() => ({
|
|
25
|
+
meta: e,
|
|
26
|
+
setPageMeta: s,
|
|
27
|
+
pageLoading: o,
|
|
28
|
+
setPageLoading: n
|
|
29
|
+
}),
|
|
30
|
+
[e, s, o, n]
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ f(l.Provider, { value: i, children: t });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
C as PageShellProvider,
|
|
36
|
+
S as usePageShell,
|
|
37
|
+
p as usePageShellLoading
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=PageShellContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageShellContext.js","sources":["../../../../src/components/Layout/PageShell/PageShellContext.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\nexport type PageShellMeta = {\n title?: string;\n description?: ReactNode;\n actionItems?: Record<string, unknown>[];\n};\n\ntype PageShellContextValue = {\n meta: PageShellMeta;\n setPageMeta: (next: PageShellMeta) => void;\n pageLoading: boolean;\n setPageLoading: (loading: boolean) => void;\n};\n\nconst EMPTY_META: PageShellMeta = {};\n\nconst PageShellContext = createContext<PageShellContextValue>({\n meta: EMPTY_META,\n setPageMeta: () => {},\n pageLoading: false,\n setPageLoading: () => {},\n});\n\nexport function usePageShell() {\n return useContext(PageShellContext);\n}\n\n/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */\nexport function usePageShellLoading(spinning: boolean) {\n const { setPageLoading } = usePageShell();\n useEffect(() => {\n setPageLoading(spinning);\n return () => setPageLoading(false);\n }, [spinning, setPageLoading]);\n}\n\nexport type PageShellProviderProps = {\n children: ReactNode;\n};\n\nexport function PageShellProvider({ children }: PageShellProviderProps) {\n const [meta, setMeta] = useState<PageShellMeta>(EMPTY_META);\n const [pageLoading, setPageLoadingState] = useState(false);\n\n const setPageMeta = useCallback((next: PageShellMeta) => {\n setMeta(next);\n }, []);\n\n const setPageLoading = useCallback((loading: boolean) => {\n setPageLoadingState(loading);\n }, []);\n\n const value = useMemo(\n () => ({\n meta,\n setPageMeta,\n pageLoading,\n setPageLoading,\n }),\n [meta, setPageMeta, pageLoading, setPageLoading],\n );\n\n return <PageShellContext.Provider value={value}>{children}</PageShellContext.Provider>;\n}\n"],"names":["EMPTY_META","PageShellContext","createContext","usePageShell","useContext","usePageShellLoading","spinning","setPageLoading","useEffect","PageShellProvider","children","meta","setMeta","useState","pageLoading","setPageLoadingState","setPageMeta","useCallback","next","loading","value","useMemo","jsx"],"mappings":";;AAgBA,MAAMA,IAA4B,CAAA,GAE5BC,IAAmBC,EAAqC;AAAA,EAC5D,MAAMF;AAAA,EACN,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AACzB,CAAC;AAEM,SAASG,IAAe;AAC7B,SAAOC,EAAWH,CAAgB;AACpC;AAGO,SAASI,EAAoBC,GAAmB;AACrD,QAAM,EAAE,gBAAAC,EAAA,IAAmBJ,EAAA;AAC3B,EAAAK,EAAU,OACRD,EAAeD,CAAQ,GAChB,MAAMC,EAAe,EAAK,IAChC,CAACD,GAAUC,CAAc,CAAC;AAC/B;AAMO,SAASE,EAAkB,EAAE,UAAAC,KAAoC;AACtE,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwBb,CAAU,GACpD,CAACc,GAAaC,CAAmB,IAAIF,EAAS,EAAK,GAEnDG,IAAcC,EAAY,CAACC,MAAwB;AACvD,IAAAN,EAAQM,CAAI;AAAA,EACd,GAAG,CAAA,CAAE,GAECX,IAAiBU,EAAY,CAACE,MAAqB;AACvD,IAAAJ,EAAoBI,CAAO;AAAA,EAC7B,GAAG,CAAA,CAAE,GAECC,IAAQC;AAAA,IACZ,OAAO;AAAA,MACL,MAAAV;AAAA,MACA,aAAAK;AAAA,MACA,aAAAF;AAAA,MACA,gBAAAP;AAAA,IAAA;AAAA,IAEF,CAACI,GAAMK,GAAaF,GAAaP,CAAc;AAAA,EAAA;AAGjD,SAAO,gBAAAe,EAACrB,EAAiB,UAAjB,EAA0B,OAAAmB,GAAe,UAAAV,EAAA,CAAS;AAC5D;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PageSpinProps = {
|
|
3
|
+
spinning: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
/** 模块页 body 区整页 Spin:参与 flex 高度链,遮罩 Filter + 主工作区 */
|
|
8
|
+
declare const PageSpin: React.FC<PageSpinProps>;
|
|
9
|
+
export default PageSpin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Spin as o } from "antd";
|
|
3
|
+
import a from "classnames";
|
|
4
|
+
import e from "./style.module.scss.js";
|
|
5
|
+
const n = ({ spinning: p, children: r, className: s }) => /* @__PURE__ */ m(o, { spinning: p, wrapperClassName: a(e["page-spin"], s), children: r });
|
|
6
|
+
export {
|
|
7
|
+
n as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageSpin/index.tsx"],"sourcesContent":["import { Spin } from 'antd';\nimport classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport styles from './style.module.scss';\n\nexport type PageSpinProps = {\n spinning: boolean;\n children: ReactNode;\n className?: string;\n};\n\n/** 模块页 body 区整页 Spin:参与 flex 高度链,遮罩 Filter + 主工作区 */\nconst PageSpin: React.FC<PageSpinProps> = ({ spinning, children, className }) => (\n <Spin spinning={spinning} wrapperClassName={classNames(styles['page-spin'], className)}>\n {children}\n </Spin>\n);\n\nexport default PageSpin;\n"],"names":["PageSpin","spinning","children","className","jsx","Spin","classNames","styles"],"mappings":";;;;AAYA,MAAMA,IAAoC,CAAC,EAAE,UAAAC,GAAU,UAAAC,GAAU,WAAAC,QAC/D,gBAAAC,EAACC,GAAA,EAAK,UAAAJ,GAAoB,kBAAkBK,EAAWC,EAAO,WAAW,GAAGJ,CAAS,GAClF,UAAAD,EAAA,CACH;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { default as PageHeaderLayout } from './PageHeaderLayout';
|
|
2
2
|
export type { PageHeaderLayoutProps } from './PageHeaderLayout';
|
|
3
|
+
export { default as PageSpin } from './PageSpin';
|
|
4
|
+
export type { PageSpinProps } from './PageSpin';
|
|
5
|
+
export { PageShellProvider, usePageShell, usePageShellLoading, } from './PageShell';
|
|
6
|
+
export type { PageShellMeta, PageShellProviderProps } from './PageShell';
|
|
7
|
+
export { default as ModulePageShell } from './ModulePageShell';
|
|
8
|
+
export type { ModulePageShellProps } from './ModulePageShell';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,20 @@ export { useFetchData, fetchWithTimeout } from './hooks/useFetchData';
|
|
|
5
5
|
export type { FetchDataOptions, FetchDataResult } from './hooks/useFetchData';
|
|
6
6
|
export { resolveMaybeFn, resolveVisible, type MaybeFn, type Visibility, } from './utils/resolveMaybeFn';
|
|
7
7
|
export { formatFileSize } from './utils/format';
|
|
8
|
+
export { toDateRange, toDateTimeRange } from './utils/date';
|
|
9
|
+
export { REDIRECT_URL_PARAM, resolveRedirectUrl, buildLocationRedirectUrl, buildLoginPath, readRedirectUrlFromSearch, } from './utils/authRedirect';
|
|
10
|
+
export { DEFAULT_LAST_ACTIVITY_STORAGE_KEY, getLastActivityTime, touchLastActivity, clearLastActivity, } from './utils/sessionActivity';
|
|
11
|
+
export { USER_ROLE_PERMISSIONS_KEY, PERMISSION_DEFINITIONS_KEY, PERMISSIONS_STORAGE_KEY, loadUserRolePermissions, saveUserRolePermissions, loadPermissionDefinitions, savePermissionDefinitions, getStoredUserPermissions, getStoredPermissionMap, } from './utils/permissionStorage';
|
|
12
|
+
export { createMarsunRequest } from './utils/createMarsunRequest';
|
|
13
|
+
export type { MarsunApiResponse, CreateMarsunRequestOptions, MarsunRequestClient, } from './utils/createMarsunRequest';
|
|
14
|
+
export type { UserRolePermissions, PermissionDefinition, PermissionDefinitionsResponse, } from './types/auth';
|
|
15
|
+
export { buildDepartmentPathMapFromTree, buildDepartmentPathMapFromFlat, getDepartmentPath, buildLeafDepartmentPathMap, buildDepartmentPathMaps, mergeDepartmentPathMaps, toDepartmentPathMaps, } from './utils/department/departmentPath';
|
|
16
|
+
export type { DepartmentPathMaps } from './utils/department/departmentPath';
|
|
17
|
+
export { flattenDepartments, findDepartmentRootId, collectDepartmentIds, getNormalUserAccessibleDepartmentIds, extractDepartmentSubtree, getNormalUserDepartmentTree, intersectDepartmentIds, } from './utils/department/departmentScope';
|
|
18
|
+
export type { DepartmentTreeNode, FlatDepartment } from './utils/department/types';
|
|
19
|
+
export { EMPLOYEE_ID_SIX_DIGIT_PATTERN, EMPLOYEE_ID_FORMAT_MESSAGE, employeeIdFormatRule, isValidEmployeeIdFormat, } from './utils/user/employeeId';
|
|
20
|
+
export { normalizeRawPersonList, normalizePersonDtos, resolvePersonDepartmentName, toPersonOptions, toReviewerPersonOptions, formatPersonValueLabel, toPersonSelectOptions, buildPersonOptionLookup, resolveSelectPersonOption, createPersonSelectFilter, matchPersonOptionSearch, } from './utils/personOption';
|
|
21
|
+
export type { PersonOptionDto, ReviewerOptionDto, PersonSelectOption } from './utils/personOption';
|
|
8
22
|
export * from './components/Auth';
|
|
9
23
|
export * from './components/Descriptions';
|
|
10
24
|
export * from './components/File';
|