@hkyhy/marsun-components-core 0.1.18 → 0.1.21
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/AgentHub/Chat/Detail/ChatAgentFab/index.d.ts +24 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/index.js +95 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/style.module.scss.js +15 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFab/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.d.ts +16 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.js +37 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/style.module.scss.js +9 -0
- package/dist/components/AgentHub/Chat/Detail/ChatAgentFabLayout/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.d.ts +14 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.js +79 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/style.module.scss.js +18 -0
- package/dist/components/AgentHub/Chat/Detail/ChatFollowUpSuggestions/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js +60 -49
- package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js +7 -6
- package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.d.ts +17 -4
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js +104 -68
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js +13 -8
- package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js +5 -4
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/style.module.scss.js +2 -2
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.d.ts +7 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.js +55 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/ChatWidgetSparkline.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.d.ts +10 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.js +120 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/index.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/style.module.scss.js +32 -0
- package/dist/components/AgentHub/Chat/Detail/ChatWidgetBlock/style.module.scss.js.map +1 -0
- package/dist/components/AgentHub/Chat/Detail/CitationContent/style.module.scss.js +2 -2
- package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js +130 -114
- package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js +20 -18
- package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js.map +1 -1
- package/dist/components/AgentHub/Chat/Detail/index.d.ts +8 -0
- package/dist/components/AgentHub/Chat/hooks/index.d.ts +2 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.d.ts +11 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.js +22 -0
- package/dist/components/AgentHub/Chat/hooks/useCitationPanel.js.map +1 -0
- package/dist/components/AgentHub/types.d.ts +21 -0
- 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/FilterDateRange/index.d.ts +6 -1
- package/dist/components/Filter/FilterDateRange/index.js +84 -62
- package/dist/components/Filter/FilterDateRange/index.js.map +1 -1
- package/dist/components/Filter/types.d.ts +1 -0
- package/dist/components/Filter/types.js.map +1 -1
- package/dist/components/Icons/index.d.ts +3 -1
- package/dist/components/Icons/index.js +157 -151
- package/dist/components/Icons/index.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +377 -298
- 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 +16 -0
- package/dist/utils/date.js +36 -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 +26 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function p(e, n = "") {
|
|
2
|
+
var o;
|
|
3
|
+
const a = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const r of e) {
|
|
5
|
+
const t = n ? `${n}/${r.name}` : r.name;
|
|
6
|
+
if (a.set(r.id, t), (o = r.children) != null && o.length) {
|
|
7
|
+
const c = p(r.children, t);
|
|
8
|
+
for (const [s, u] of c) a.set(s, u);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return a;
|
|
12
|
+
}
|
|
13
|
+
function m(e) {
|
|
14
|
+
const n = new Map(e.map((t) => [t.id, t.name])), a = new Map(e.map((t) => [t.id, t.parentId])), o = /* @__PURE__ */ new Map(), r = (t) => {
|
|
15
|
+
const c = o.get(t);
|
|
16
|
+
if (c) return c;
|
|
17
|
+
const s = n.get(t) ?? "", u = a.get(t);
|
|
18
|
+
if (!u)
|
|
19
|
+
return o.set(t, s), s;
|
|
20
|
+
const f = `${r(u)}/${s}`;
|
|
21
|
+
return o.set(t, f), f;
|
|
22
|
+
};
|
|
23
|
+
for (const t of e)
|
|
24
|
+
r(t.id);
|
|
25
|
+
return o;
|
|
26
|
+
}
|
|
27
|
+
function d(e, n, a = "-") {
|
|
28
|
+
return n && e.get(n) || a;
|
|
29
|
+
}
|
|
30
|
+
function i(e) {
|
|
31
|
+
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
32
|
+
for (const o of e.values()) {
|
|
33
|
+
const r = o.includes("/") ? o.slice(o.lastIndexOf("/") + 1) : o;
|
|
34
|
+
if (a.has(r)) continue;
|
|
35
|
+
const t = n.get(r);
|
|
36
|
+
t !== void 0 && t !== o ? (a.add(r), n.delete(r)) : n.set(r, o);
|
|
37
|
+
}
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
function l(e) {
|
|
41
|
+
const n = m(e);
|
|
42
|
+
return { byId: n, byUniqueLeaf: i(n) };
|
|
43
|
+
}
|
|
44
|
+
function h(...e) {
|
|
45
|
+
const n = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const a of e)
|
|
47
|
+
for (const [o, r] of a) n.set(o, r);
|
|
48
|
+
return n;
|
|
49
|
+
}
|
|
50
|
+
function M(e) {
|
|
51
|
+
if (!(!e || e.size === 0))
|
|
52
|
+
return { byId: e, byUniqueLeaf: i(e) };
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
m as buildDepartmentPathMapFromFlat,
|
|
56
|
+
p as buildDepartmentPathMapFromTree,
|
|
57
|
+
l as buildDepartmentPathMaps,
|
|
58
|
+
i as buildLeafDepartmentPathMap,
|
|
59
|
+
d as getDepartmentPath,
|
|
60
|
+
h as mergeDepartmentPathMaps,
|
|
61
|
+
M as toDepartmentPathMaps
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=departmentPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departmentPath.js","sources":["../../../src/utils/department/departmentPath.ts"],"sourcesContent":["import type { DepartmentTreeNode, FlatDepartment } from './types';\n\n/** 从部门树构建 id → 完整路径(父/子)映射 */\nexport function buildDepartmentPathMapFromTree(\n tree: DepartmentTreeNode[],\n parentPath = '',\n): Map<string, string> {\n const map = new Map<string, string>();\n for (const dept of tree) {\n const path = parentPath ? `${parentPath}/${dept.name}` : dept.name;\n map.set(dept.id, path);\n if (dept.children?.length) {\n const childMap = buildDepartmentPathMapFromTree(dept.children, path);\n for (const [k, v] of childMap) map.set(k, v);\n }\n }\n return map;\n}\n\n/** 从扁平部门列表构建 id → 完整路径映射 */\nexport function buildDepartmentPathMapFromFlat(departments: FlatDepartment[]): Map<string, string> {\n const nameMap = new Map(departments.map((d) => [d.id, d.name]));\n const parentMap = new Map(departments.map((d) => [d.id, d.parentId]));\n const pathMap = new Map<string, string>();\n\n const resolve = (id: string): string => {\n const cached = pathMap.get(id);\n if (cached) return cached;\n\n const name = nameMap.get(id) ?? '';\n const parentId = parentMap.get(id);\n if (!parentId) {\n pathMap.set(id, name);\n return name;\n }\n\n const path = `${resolve(parentId)}/${name}`;\n pathMap.set(id, path);\n return path;\n };\n\n for (const dept of departments) {\n resolve(dept.id);\n }\n return pathMap;\n}\n\n/** 根据路径映射解析部门完整路径 */\nexport function getDepartmentPath(\n pathMap: Map<string, string>,\n departmentId?: string | null,\n fallback = '-',\n): string {\n if (!departmentId) return fallback;\n return pathMap.get(departmentId) || fallback;\n}\n\n/** 部门路径映射(id → 全路径,以及唯一叶子名 → 全路径) */\nexport interface DepartmentPathMaps {\n byId: Map<string, string>;\n byUniqueLeaf: Map<string, string>;\n}\n\n/** 从 id 路径映射构建「唯一叶子部门名 → 全路径」索引(无 departmentId 时的兜底) */\nexport function buildLeafDepartmentPathMap(pathMap: Map<string, string>): Map<string, string> {\n const result = new Map<string, string>();\n const ambiguous = new Set<string>();\n\n for (const path of pathMap.values()) {\n const leaf = path.includes('/') ? path.slice(path.lastIndexOf('/') + 1) : path;\n if (ambiguous.has(leaf)) continue;\n\n const prev = result.get(leaf);\n if (prev !== undefined && prev !== path) {\n ambiguous.add(leaf);\n result.delete(leaf);\n } else {\n result.set(leaf, path);\n }\n }\n return result;\n}\n\nexport function buildDepartmentPathMaps(departments: FlatDepartment[]): DepartmentPathMaps {\n const byId = buildDepartmentPathMapFromFlat(departments);\n return { byId, byUniqueLeaf: buildLeafDepartmentPathMap(byId) };\n}\n\nexport function mergeDepartmentPathMaps(...maps: Map<string, string>[]): Map<string, string> {\n const merged = new Map<string, string>();\n for (const map of maps) {\n for (const [k, v] of map) merged.set(k, v);\n }\n return merged;\n}\n\n/** 将 useDepartmentPath 的 pathMap 包装为完整解析结构 */\nexport function toDepartmentPathMaps(\n pathMap?: Map<string, string>,\n): DepartmentPathMaps | undefined {\n if (!pathMap || pathMap.size === 0) return undefined;\n return { byId: pathMap, byUniqueLeaf: buildLeafDepartmentPathMap(pathMap) };\n}\n"],"names":["buildDepartmentPathMapFromTree","tree","parentPath","_a","map","dept","path","childMap","k","v","buildDepartmentPathMapFromFlat","departments","nameMap","d","parentMap","pathMap","resolve","id","cached","name","parentId","getDepartmentPath","departmentId","fallback","buildLeafDepartmentPathMap","result","ambiguous","leaf","prev","buildDepartmentPathMaps","byId","mergeDepartmentPathMaps","maps","merged","toDepartmentPathMaps"],"mappings":"AAGO,SAASA,EACdC,GACAC,IAAa,IACQ;AAHhB,MAAAC;AAIL,QAAMC,wBAAU,IAAA;AAChB,aAAWC,KAAQJ,GAAM;AACvB,UAAMK,IAAOJ,IAAa,GAAGA,CAAU,IAAIG,EAAK,IAAI,KAAKA,EAAK;AAE9D,QADAD,EAAI,IAAIC,EAAK,IAAIC,CAAI,IACjBH,IAAAE,EAAK,aAAL,QAAAF,EAAe,QAAQ;AACzB,YAAMI,IAAWP,EAA+BK,EAAK,UAAUC,CAAI;AACnE,iBAAW,CAACE,GAAGC,CAAC,KAAKF,EAAU,CAAAH,EAAI,IAAII,GAAGC,CAAC;AAAA,IAC7C;AAAA,EACF;AACA,SAAOL;AACT;AAGO,SAASM,EAA+BC,GAAoD;AACjG,QAAMC,IAAU,IAAI,IAAID,EAAY,IAAI,CAACE,MAAM,CAACA,EAAE,IAAIA,EAAE,IAAI,CAAC,CAAC,GACxDC,IAAY,IAAI,IAAIH,EAAY,IAAI,CAACE,MAAM,CAACA,EAAE,IAAIA,EAAE,QAAQ,CAAC,CAAC,GAC9DE,wBAAc,IAAA,GAEdC,IAAU,CAACC,MAAuB;AACtC,UAAMC,IAASH,EAAQ,IAAIE,CAAE;AAC7B,QAAIC,EAAQ,QAAOA;AAEnB,UAAMC,IAAOP,EAAQ,IAAIK,CAAE,KAAK,IAC1BG,IAAWN,EAAU,IAAIG,CAAE;AACjC,QAAI,CAACG;AACH,aAAAL,EAAQ,IAAIE,GAAIE,CAAI,GACbA;AAGT,UAAMb,IAAO,GAAGU,EAAQI,CAAQ,CAAC,IAAID,CAAI;AACzC,WAAAJ,EAAQ,IAAIE,GAAIX,CAAI,GACbA;AAAA,EACT;AAEA,aAAWD,KAAQM;AACjB,IAAAK,EAAQX,EAAK,EAAE;AAEjB,SAAOU;AACT;AAGO,SAASM,EACdN,GACAO,GACAC,IAAW,KACH;AACR,SAAKD,KACEP,EAAQ,IAAIO,CAAY,KAAKC;AACtC;AASO,SAASC,EAA2BT,GAAmD;AAC5F,QAAMU,wBAAa,IAAA,GACbC,wBAAgB,IAAA;AAEtB,aAAWpB,KAAQS,EAAQ,UAAU;AACnC,UAAMY,IAAOrB,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAMA,EAAK,YAAY,GAAG,IAAI,CAAC,IAAIA;AAC1E,QAAIoB,EAAU,IAAIC,CAAI,EAAG;AAEzB,UAAMC,IAAOH,EAAO,IAAIE,CAAI;AAC5B,IAAIC,MAAS,UAAaA,MAAStB,KACjCoB,EAAU,IAAIC,CAAI,GAClBF,EAAO,OAAOE,CAAI,KAElBF,EAAO,IAAIE,GAAMrB,CAAI;AAAA,EAEzB;AACA,SAAOmB;AACT;AAEO,SAASI,EAAwBlB,GAAmD;AACzF,QAAMmB,IAAOpB,EAA+BC,CAAW;AACvD,SAAO,EAAE,MAAAmB,GAAM,cAAcN,EAA2BM,CAAI,EAAA;AAC9D;AAEO,SAASC,KAA2BC,GAAkD;AAC3F,QAAMC,wBAAa,IAAA;AACnB,aAAW7B,KAAO4B;AAChB,eAAW,CAACxB,GAAGC,CAAC,KAAKL,EAAK,CAAA6B,EAAO,IAAIzB,GAAGC,CAAC;AAE3C,SAAOwB;AACT;AAGO,SAASC,EACdnB,GACgC;AAChC,MAAI,GAACA,KAAWA,EAAQ,SAAS;AACjC,WAAO,EAAE,MAAMA,GAAS,cAAcS,EAA2BT,CAAO,EAAA;AAC1E;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DepartmentTreeNode } from './types';
|
|
2
|
+
interface DeptNode {
|
|
3
|
+
id: string;
|
|
4
|
+
parentId: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** 将树形部门展平 */
|
|
7
|
+
export declare function flattenDepartments(tree: DepartmentTreeNode[]): DeptNode[];
|
|
8
|
+
/** 查找部门所属组织链的根节点 ID */
|
|
9
|
+
export declare function findDepartmentRootId(departmentId: string, departments: DeptNode[]): string;
|
|
10
|
+
/** 收集部门及其所有子部门 ID */
|
|
11
|
+
export declare function collectDepartmentIds(rootId: string, departments: DeptNode[]): string[];
|
|
12
|
+
/** 普通用户可访问的部门 ID(所属组织链根节点及其子树) */
|
|
13
|
+
export declare function getNormalUserAccessibleDepartmentIds(userDepartmentId: string, departments: DeptNode[]): string[];
|
|
14
|
+
/** 从完整部门树中提取指定根节点的子树 */
|
|
15
|
+
export declare function extractDepartmentSubtree(rootId: string, tree: DepartmentTreeNode[]): DepartmentTreeNode[];
|
|
16
|
+
/** 普通用户部门筛选树:仅保留所属组织链 */
|
|
17
|
+
export declare function getNormalUserDepartmentTree(userDepartmentId: string, tree: DepartmentTreeNode[]): DepartmentTreeNode[];
|
|
18
|
+
/** 在权限范围内应用部门筛选(scopeRoot 为当前用户可管理的部门根) */
|
|
19
|
+
export declare function intersectDepartmentIds(scopeRootId: string, filterDepartmentId: string | undefined, departments: DeptNode[]): string[];
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function a(o) {
|
|
2
|
+
const e = [], t = (r) => {
|
|
3
|
+
var n;
|
|
4
|
+
for (const c of r)
|
|
5
|
+
e.push({ id: c.id, parentId: c.parentId }), (n = c.children) != null && n.length && t(c.children);
|
|
6
|
+
};
|
|
7
|
+
return t(o), e;
|
|
8
|
+
}
|
|
9
|
+
function f(o, e) {
|
|
10
|
+
const t = new Map(e.map((n) => [n.id, n]));
|
|
11
|
+
let r = o;
|
|
12
|
+
for (; ; ) {
|
|
13
|
+
const n = t.get(r);
|
|
14
|
+
if (!(n != null && n.parentId)) return r;
|
|
15
|
+
r = n.parentId;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function d(o, e) {
|
|
19
|
+
const t = /* @__PURE__ */ new Set([o]);
|
|
20
|
+
let r = !0;
|
|
21
|
+
for (; r; ) {
|
|
22
|
+
r = !1;
|
|
23
|
+
for (const n of e)
|
|
24
|
+
n.parentId && t.has(n.parentId) && !t.has(n.id) && (t.add(n.id), r = !0);
|
|
25
|
+
}
|
|
26
|
+
return Array.from(t);
|
|
27
|
+
}
|
|
28
|
+
function l(o, e) {
|
|
29
|
+
const t = f(o, e);
|
|
30
|
+
return d(t, e);
|
|
31
|
+
}
|
|
32
|
+
function u(o, e) {
|
|
33
|
+
const t = (n) => {
|
|
34
|
+
var c;
|
|
35
|
+
for (const i of n) {
|
|
36
|
+
if (i.id === o) return i;
|
|
37
|
+
if ((c = i.children) != null && c.length) {
|
|
38
|
+
const s = t(i.children);
|
|
39
|
+
if (s) return s;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, r = t(e);
|
|
43
|
+
return r ? [r] : [];
|
|
44
|
+
}
|
|
45
|
+
function p(o, e) {
|
|
46
|
+
if (!e.length) return [];
|
|
47
|
+
const t = a(e), r = f(o, t);
|
|
48
|
+
return u(r, e);
|
|
49
|
+
}
|
|
50
|
+
function h(o, e, t) {
|
|
51
|
+
const r = new Set(d(o, t));
|
|
52
|
+
return e ? d(e, t).filter((n) => r.has(n)) : Array.from(r);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
d as collectDepartmentIds,
|
|
56
|
+
u as extractDepartmentSubtree,
|
|
57
|
+
f as findDepartmentRootId,
|
|
58
|
+
a as flattenDepartments,
|
|
59
|
+
l as getNormalUserAccessibleDepartmentIds,
|
|
60
|
+
p as getNormalUserDepartmentTree,
|
|
61
|
+
h as intersectDepartmentIds
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=departmentScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departmentScope.js","sources":["../../../src/utils/department/departmentScope.ts"],"sourcesContent":["import type { DepartmentTreeNode } from './types';\n\ninterface DeptNode {\n id: string;\n parentId: string | null;\n}\n\n/** 将树形部门展平 */\nexport function flattenDepartments(tree: DepartmentTreeNode[]): DeptNode[] {\n const result: DeptNode[] = [];\n const walk = (nodes: DepartmentTreeNode[]) => {\n for (const node of nodes) {\n result.push({ id: node.id, parentId: node.parentId });\n if (node.children?.length) walk(node.children);\n }\n };\n walk(tree);\n return result;\n}\n\n/** 查找部门所属组织链的根节点 ID */\nexport function findDepartmentRootId(departmentId: string, departments: DeptNode[]): string {\n const map = new Map(departments.map((d) => [d.id, d]));\n let current = departmentId;\n while (true) {\n const dept = map.get(current);\n if (!dept?.parentId) return current;\n current = dept.parentId;\n }\n}\n\n/** 收集部门及其所有子部门 ID */\nexport function collectDepartmentIds(rootId: string, departments: DeptNode[]): string[] {\n const ids = new Set<string>([rootId]);\n let changed = true;\n while (changed) {\n changed = false;\n for (const dept of departments) {\n if (dept.parentId && ids.has(dept.parentId) && !ids.has(dept.id)) {\n ids.add(dept.id);\n changed = true;\n }\n }\n }\n return Array.from(ids);\n}\n\n/** 普通用户可访问的部门 ID(所属组织链根节点及其子树) */\nexport function getNormalUserAccessibleDepartmentIds(\n userDepartmentId: string,\n departments: DeptNode[],\n): string[] {\n const rootId = findDepartmentRootId(userDepartmentId, departments);\n return collectDepartmentIds(rootId, departments);\n}\n\n/** 从完整部门树中提取指定根节点的子树 */\nexport function extractDepartmentSubtree(\n rootId: string,\n tree: DepartmentTreeNode[],\n): DepartmentTreeNode[] {\n const findNode = (nodes: DepartmentTreeNode[]): DepartmentTreeNode | undefined => {\n for (const node of nodes) {\n if (node.id === rootId) return node;\n if (node.children?.length) {\n const found = findNode(node.children);\n if (found) return found;\n }\n }\n return undefined;\n };\n\n const node = findNode(tree);\n return node ? [node] : [];\n}\n\n/** 普通用户部门筛选树:仅保留所属组织链 */\nexport function getNormalUserDepartmentTree(\n userDepartmentId: string,\n tree: DepartmentTreeNode[],\n): DepartmentTreeNode[] {\n if (!tree.length) return [];\n const flat = flattenDepartments(tree);\n const rootId = findDepartmentRootId(userDepartmentId, flat);\n return extractDepartmentSubtree(rootId, tree);\n}\n\n/** 在权限范围内应用部门筛选(scopeRoot 为当前用户可管理的部门根) */\nexport function intersectDepartmentIds(\n scopeRootId: string,\n filterDepartmentId: string | undefined,\n departments: DeptNode[],\n): string[] {\n const scopeIds = new Set(collectDepartmentIds(scopeRootId, departments));\n if (!filterDepartmentId) return Array.from(scopeIds);\n return collectDepartmentIds(filterDepartmentId, departments).filter((id) => scopeIds.has(id));\n}\n"],"names":["flattenDepartments","tree","result","walk","nodes","_a","node","findDepartmentRootId","departmentId","departments","map","d","current","dept","collectDepartmentIds","rootId","ids","changed","getNormalUserAccessibleDepartmentIds","userDepartmentId","extractDepartmentSubtree","findNode","found","getNormalUserDepartmentTree","flat","intersectDepartmentIds","scopeRootId","filterDepartmentId","scopeIds","id"],"mappings":"AAQO,SAASA,EAAmBC,GAAwC;AACzE,QAAMC,IAAqB,CAAA,GACrBC,IAAO,CAACC,MAAgC;AAFzC,QAAAC;AAGH,eAAWC,KAAQF;AACjB,MAAAF,EAAO,KAAK,EAAE,IAAII,EAAK,IAAI,UAAUA,EAAK,UAAU,IAChDD,IAAAC,EAAK,aAAL,QAAAD,EAAe,UAAQF,EAAKG,EAAK,QAAQ;AAAA,EAEjD;AACA,SAAAH,EAAKF,CAAI,GACFC;AACT;AAGO,SAASK,EAAqBC,GAAsBC,GAAiC;AAC1F,QAAMC,IAAM,IAAI,IAAID,EAAY,IAAI,CAACE,MAAM,CAACA,EAAE,IAAIA,CAAC,CAAC,CAAC;AACrD,MAAIC,IAAUJ;AACd,aAAa;AACX,UAAMK,IAAOH,EAAI,IAAIE,CAAO;AAC5B,QAAI,EAACC,KAAA,QAAAA,EAAM,UAAU,QAAOD;AAC5B,IAAAA,IAAUC,EAAK;AAAA,EACjB;AACF;AAGO,SAASC,EAAqBC,GAAgBN,GAAmC;AACtF,QAAMO,IAAM,oBAAI,IAAY,CAACD,CAAM,CAAC;AACpC,MAAIE,IAAU;AACd,SAAOA,KAAS;AACd,IAAAA,IAAU;AACV,eAAWJ,KAAQJ;AACjB,MAAII,EAAK,YAAYG,EAAI,IAAIH,EAAK,QAAQ,KAAK,CAACG,EAAI,IAAIH,EAAK,EAAE,MAC7DG,EAAI,IAAIH,EAAK,EAAE,GACfI,IAAU;AAAA,EAGhB;AACA,SAAO,MAAM,KAAKD,CAAG;AACvB;AAGO,SAASE,EACdC,GACAV,GACU;AACV,QAAMM,IAASR,EAAqBY,GAAkBV,CAAW;AACjE,SAAOK,EAAqBC,GAAQN,CAAW;AACjD;AAGO,SAASW,EACdL,GACAd,GACsB;AACtB,QAAMoB,IAAW,CAACjB,MAAgE;AArD7E,QAAAC;AAsDH,eAAWC,KAAQF,GAAO;AACxB,UAAIE,EAAK,OAAOS,EAAQ,QAAOT;AAC/B,WAAIA,IAAAA,EAAK,aAALA,QAAAA,EAAe,QAAQ;AACzB,cAAMgB,IAAQD,EAASf,EAAK,QAAQ;AACpC,YAAIgB,EAAO,QAAOA;AAAA,MACpB;AAAA,IACF;AAAA,EAEF,GAEMhB,IAAOe,EAASpB,CAAI;AAC1B,SAAOK,IAAO,CAACA,CAAI,IAAI,CAAA;AACzB;AAGO,SAASiB,EACdJ,GACAlB,GACsB;AACtB,MAAI,CAACA,EAAK,OAAQ,QAAO,CAAA;AACzB,QAAMuB,IAAOxB,EAAmBC,CAAI,GAC9Bc,IAASR,EAAqBY,GAAkBK,CAAI;AAC1D,SAAOJ,EAAyBL,GAAQd,CAAI;AAC9C;AAGO,SAASwB,EACdC,GACAC,GACAlB,GACU;AACV,QAAMmB,IAAW,IAAI,IAAId,EAAqBY,GAAajB,CAAW,CAAC;AACvE,SAAKkB,IACEb,EAAqBa,GAAoBlB,CAAW,EAAE,OAAO,CAACoB,MAAOD,EAAS,IAAIC,CAAE,CAAC,IAD5D,MAAM,KAAKD,CAAQ;AAErD;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 部门树节点最小字段(纯算法用) */
|
|
2
|
+
export interface DepartmentTreeNode {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
parentId: string | null;
|
|
6
|
+
children?: DepartmentTreeNode[];
|
|
7
|
+
}
|
|
8
|
+
export interface FlatDepartment {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
parentId: string | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PermissionDefinitionsResponse, UserRolePermissions } from '../types/auth';
|
|
2
|
+
export declare const USER_ROLE_PERMISSIONS_KEY = "maoyang_user_role_permissions";
|
|
3
|
+
export declare const PERMISSION_DEFINITIONS_KEY = "maoyang_permission_definitions";
|
|
4
|
+
/** @deprecated 使用 USER_ROLE_PERMISSIONS_KEY */
|
|
5
|
+
export declare const PERMISSIONS_STORAGE_KEY = "maoyang_user_role_permissions";
|
|
6
|
+
export declare function loadUserRolePermissions(): UserRolePermissions | null;
|
|
7
|
+
export declare function saveUserRolePermissions(data: UserRolePermissions | null): void;
|
|
8
|
+
export declare function loadPermissionDefinitions(): PermissionDefinitionsResponse | null;
|
|
9
|
+
export declare function savePermissionDefinitions(data: PermissionDefinitionsResponse | null): void;
|
|
10
|
+
/** 当前用户拥有的权限 key 列表 */
|
|
11
|
+
export declare function getStoredUserPermissions(): string[] | null;
|
|
12
|
+
/** 全量权限 key → name 映射(来自 /permissions/permissions) */
|
|
13
|
+
export declare function getStoredPermissionMap(): Record<string, string> | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const n = "maoyang_user_role_permissions", o = "maoyang_permission_definitions", t = n;
|
|
2
|
+
function s() {
|
|
3
|
+
try {
|
|
4
|
+
const e = localStorage.getItem(n);
|
|
5
|
+
return e ? JSON.parse(e) : null;
|
|
6
|
+
} catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function i(e) {
|
|
11
|
+
e ? localStorage.setItem(n, JSON.stringify(e)) : localStorage.removeItem(n);
|
|
12
|
+
}
|
|
13
|
+
function r() {
|
|
14
|
+
try {
|
|
15
|
+
const e = localStorage.getItem(o);
|
|
16
|
+
return e ? JSON.parse(e) : null;
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function l(e) {
|
|
22
|
+
e ? localStorage.setItem(o, JSON.stringify(e)) : localStorage.removeItem(o);
|
|
23
|
+
}
|
|
24
|
+
function a() {
|
|
25
|
+
var e;
|
|
26
|
+
return ((e = s()) == null ? void 0 : e.permissions) ?? null;
|
|
27
|
+
}
|
|
28
|
+
function S() {
|
|
29
|
+
var e;
|
|
30
|
+
return ((e = r()) == null ? void 0 : e.permissionMap) ?? null;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
t as PERMISSIONS_STORAGE_KEY,
|
|
34
|
+
o as PERMISSION_DEFINITIONS_KEY,
|
|
35
|
+
n as USER_ROLE_PERMISSIONS_KEY,
|
|
36
|
+
S as getStoredPermissionMap,
|
|
37
|
+
a as getStoredUserPermissions,
|
|
38
|
+
r as loadPermissionDefinitions,
|
|
39
|
+
s as loadUserRolePermissions,
|
|
40
|
+
l as savePermissionDefinitions,
|
|
41
|
+
i as saveUserRolePermissions
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=permissionStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissionStorage.js","sources":["../../src/utils/permissionStorage.ts"],"sourcesContent":["import type { PermissionDefinitionsResponse, UserRolePermissions } from '@/types/auth';\n\nexport const USER_ROLE_PERMISSIONS_KEY = 'maoyang_user_role_permissions';\nexport const PERMISSION_DEFINITIONS_KEY = 'maoyang_permission_definitions';\n\n/** @deprecated 使用 USER_ROLE_PERMISSIONS_KEY */\nexport const PERMISSIONS_STORAGE_KEY = USER_ROLE_PERMISSIONS_KEY;\n\nexport function loadUserRolePermissions(): UserRolePermissions | null {\n try {\n const raw = localStorage.getItem(USER_ROLE_PERMISSIONS_KEY);\n return raw ? JSON.parse(raw) : null;\n } catch {\n return null;\n }\n}\n\nexport function saveUserRolePermissions(data: UserRolePermissions | null) {\n if (data) {\n localStorage.setItem(USER_ROLE_PERMISSIONS_KEY, JSON.stringify(data));\n } else {\n localStorage.removeItem(USER_ROLE_PERMISSIONS_KEY);\n }\n}\n\nexport function loadPermissionDefinitions(): PermissionDefinitionsResponse | null {\n try {\n const raw = localStorage.getItem(PERMISSION_DEFINITIONS_KEY);\n return raw ? JSON.parse(raw) : null;\n } catch {\n return null;\n }\n}\n\nexport function savePermissionDefinitions(data: PermissionDefinitionsResponse | null) {\n if (data) {\n localStorage.setItem(PERMISSION_DEFINITIONS_KEY, JSON.stringify(data));\n } else {\n localStorage.removeItem(PERMISSION_DEFINITIONS_KEY);\n }\n}\n\n/** 当前用户拥有的权限 key 列表 */\nexport function getStoredUserPermissions(): string[] | null {\n return loadUserRolePermissions()?.permissions ?? null;\n}\n\n/** 全量权限 key → name 映射(来自 /permissions/permissions) */\nexport function getStoredPermissionMap(): Record<string, string> | null {\n return loadPermissionDefinitions()?.permissionMap ?? null;\n}\n"],"names":["USER_ROLE_PERMISSIONS_KEY","PERMISSION_DEFINITIONS_KEY","PERMISSIONS_STORAGE_KEY","loadUserRolePermissions","raw","saveUserRolePermissions","data","loadPermissionDefinitions","savePermissionDefinitions","getStoredUserPermissions","_a","getStoredPermissionMap"],"mappings":"AAEO,MAAMA,IAA4B,iCAC5BC,IAA6B,kCAG7BC,IAA0BF;AAEhC,SAASG,IAAsD;AACpE,MAAI;AACF,UAAMC,IAAM,aAAa,QAAQJ,CAAyB;AAC1D,WAAOI,IAAM,KAAK,MAAMA,CAAG,IAAI;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAASC,EAAwBC,GAAkC;AACxE,EAAIA,IACF,aAAa,QAAQN,GAA2B,KAAK,UAAUM,CAAI,CAAC,IAEpE,aAAa,WAAWN,CAAyB;AAErD;AAEO,SAASO,IAAkE;AAChF,MAAI;AACF,UAAMH,IAAM,aAAa,QAAQH,CAA0B;AAC3D,WAAOG,IAAM,KAAK,MAAMA,CAAG,IAAI;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAASI,EAA0BF,GAA4C;AACpF,EAAIA,IACF,aAAa,QAAQL,GAA4B,KAAK,UAAUK,CAAI,CAAC,IAErE,aAAa,WAAWL,CAA0B;AAEtD;AAGO,SAASQ,IAA4C;AAzCrD,MAAAC;AA0CL,WAAOA,IAAAP,EAAA,MAAA,gBAAAO,EAA2B,gBAAe;AACnD;AAGO,SAASC,IAAwD;AA9CjE,MAAAD;AA+CL,WAAOA,IAAAH,EAAA,MAAA,gBAAAG,EAA6B,kBAAiB;AACvD;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PersonOption } from '../components/Filter/types';
|
|
2
|
+
import { DepartmentPathMaps } from './department/departmentPath';
|
|
3
|
+
/** 人员选项 API 返回结构(uploaders / assignee-options 等统一形态) */
|
|
4
|
+
export interface PersonOptionDto {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
departmentId?: string;
|
|
8
|
+
departmentName?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
phone?: string;
|
|
11
|
+
employeeId?: string;
|
|
12
|
+
}
|
|
13
|
+
/** @deprecated 使用 PersonOptionDto,保留兼容 reviewers 旧字段 */
|
|
14
|
+
export interface ReviewerOptionDto {
|
|
15
|
+
id: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
departmentId?: string;
|
|
18
|
+
departmentName?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
phone?: string;
|
|
21
|
+
employeeId?: string;
|
|
22
|
+
}
|
|
23
|
+
/** 从接口返回值中取出人员数组 */
|
|
24
|
+
export declare function normalizeRawPersonList(raw: unknown): unknown[];
|
|
25
|
+
/** 统一 uploaders(value/label)与 assignee-options / reviewers(id/displayName) */
|
|
26
|
+
export declare function normalizePersonDtos(raw: unknown[]): PersonOptionDto[];
|
|
27
|
+
/** 解析人员选项中的部门完整路径(父/子) */
|
|
28
|
+
export declare function resolvePersonDepartmentName(maps: DepartmentPathMaps | undefined, departmentId?: string, departmentName?: string): string | undefined;
|
|
29
|
+
export declare function toPersonOptions(data: PersonOptionDto[] | undefined, maps?: DepartmentPathMaps): PersonOption[];
|
|
30
|
+
/** @deprecated 使用 normalizePersonDtos + toPersonOptions */
|
|
31
|
+
export declare function toReviewerPersonOptions(data: ReviewerOptionDto[] | undefined, maps?: DepartmentPathMaps): PersonOption[];
|
|
32
|
+
export declare function formatPersonValueLabel(opt: PersonOption): string;
|
|
33
|
+
/** antd Select 人员选项(含选中后展示的 optionLabel) */
|
|
34
|
+
export type PersonSelectOption = PersonOption & {
|
|
35
|
+
optionLabel: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function toPersonSelectOptions(options: PersonOption[]): PersonSelectOption[];
|
|
38
|
+
/** 按 value 索引人员选项,供 antd Select filterOption 反查完整数据 */
|
|
39
|
+
export declare function buildPersonOptionLookup(options: PersonOption[]): Map<string, PersonOption>;
|
|
40
|
+
/** 从 antd Select 内部 option 还原完整人员数据 */
|
|
41
|
+
export declare function resolveSelectPersonOption(oriOption: {
|
|
42
|
+
value?: string | number;
|
|
43
|
+
data?: unknown;
|
|
44
|
+
} | undefined, lookup: Map<string, PersonOption>): PersonOption | undefined;
|
|
45
|
+
export declare function createPersonSelectFilter(lookup: Map<string, PersonOption>): (input: string, option?: {
|
|
46
|
+
value?: string | number;
|
|
47
|
+
data?: unknown;
|
|
48
|
+
}) => boolean;
|
|
49
|
+
export declare function matchPersonOptionSearch(opt: PersonOption, text: string): boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function d(n) {
|
|
2
|
+
return Array.isArray(n) ? n : n && typeof n == "object" && Array.isArray(n.data) ? n.data : [];
|
|
3
|
+
}
|
|
4
|
+
function o(n) {
|
|
5
|
+
return n.map((r) => {
|
|
6
|
+
const e = r;
|
|
7
|
+
return {
|
|
8
|
+
value: String(e.value ?? e.id ?? ""),
|
|
9
|
+
label: String(e.label ?? e.displayName ?? ""),
|
|
10
|
+
departmentId: e.departmentId != null ? String(e.departmentId) : void 0,
|
|
11
|
+
departmentName: e.departmentName != null ? String(e.departmentName) : void 0,
|
|
12
|
+
email: e.email != null ? String(e.email) : void 0,
|
|
13
|
+
phone: e.phone != null ? String(e.phone) : void 0,
|
|
14
|
+
employeeId: e.employeeId != null ? String(e.employeeId) : void 0
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function l(n, r, e) {
|
|
19
|
+
if (!(!r && !e)) {
|
|
20
|
+
if (e != null && e.includes("/")) return e;
|
|
21
|
+
if (n) {
|
|
22
|
+
if (r) {
|
|
23
|
+
const t = n.byId.get(r);
|
|
24
|
+
if (t) return t;
|
|
25
|
+
}
|
|
26
|
+
if (e) {
|
|
27
|
+
const t = n.byUniqueLeaf.get(e);
|
|
28
|
+
if (t) return t;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function a(n, r) {
|
|
35
|
+
return (n || []).map((e) => ({
|
|
36
|
+
value: e.value,
|
|
37
|
+
label: e.label,
|
|
38
|
+
departmentId: e.departmentId,
|
|
39
|
+
departmentName: l(r, e.departmentId, e.departmentName),
|
|
40
|
+
email: e.email,
|
|
41
|
+
phone: e.phone,
|
|
42
|
+
employeeId: e.employeeId
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
function c(n, r) {
|
|
46
|
+
return a(o(n ?? []), r);
|
|
47
|
+
}
|
|
48
|
+
function u(n) {
|
|
49
|
+
return n.departmentName ? `${n.label} · ${n.departmentName}` : n.label;
|
|
50
|
+
}
|
|
51
|
+
function f(n) {
|
|
52
|
+
return n.map((r) => ({
|
|
53
|
+
...r,
|
|
54
|
+
optionLabel: u(r)
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
function m(n) {
|
|
58
|
+
return new Map(n.map((r) => [String(r.value), r]));
|
|
59
|
+
}
|
|
60
|
+
function i(n, r) {
|
|
61
|
+
if (!n) return;
|
|
62
|
+
const e = String(n.value ?? "");
|
|
63
|
+
return e && r.has(e) ? r.get(e) : n.data ?? n;
|
|
64
|
+
}
|
|
65
|
+
function p(n) {
|
|
66
|
+
return (r, e) => {
|
|
67
|
+
const t = i(e, n);
|
|
68
|
+
return t ? s(t, r) : !1;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function s(n, r) {
|
|
72
|
+
const e = r.trim().toLowerCase();
|
|
73
|
+
return e ? [n.label, n.departmentName, n.email, n.phone, n.employeeId].some(
|
|
74
|
+
(t) => t == null ? void 0 : t.toLowerCase().includes(e)
|
|
75
|
+
) : !0;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
m as buildPersonOptionLookup,
|
|
79
|
+
p as createPersonSelectFilter,
|
|
80
|
+
u as formatPersonValueLabel,
|
|
81
|
+
s as matchPersonOptionSearch,
|
|
82
|
+
o as normalizePersonDtos,
|
|
83
|
+
d as normalizeRawPersonList,
|
|
84
|
+
l as resolvePersonDepartmentName,
|
|
85
|
+
i as resolveSelectPersonOption,
|
|
86
|
+
a as toPersonOptions,
|
|
87
|
+
f as toPersonSelectOptions,
|
|
88
|
+
c as toReviewerPersonOptions
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=personOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personOption.js","sources":["../../src/utils/personOption.ts"],"sourcesContent":["import type { PersonOption } from '@/components/Filter/types';\nimport type { DepartmentPathMaps } from '@/utils/department/departmentPath';\n\n/** 人员选项 API 返回结构(uploaders / assignee-options 等统一形态) */\nexport interface PersonOptionDto {\n value: string;\n label: string;\n departmentId?: string;\n departmentName?: string;\n email?: string;\n phone?: string;\n employeeId?: string;\n}\n\n/** @deprecated 使用 PersonOptionDto,保留兼容 reviewers 旧字段 */\nexport interface ReviewerOptionDto {\n id: string;\n displayName: string;\n departmentId?: string;\n departmentName?: string;\n email?: string;\n phone?: string;\n employeeId?: string;\n}\n\n/** 从接口返回值中取出人员数组 */\nexport function normalizeRawPersonList(raw: unknown): unknown[] {\n if (Array.isArray(raw)) return raw;\n if (raw && typeof raw === 'object' && Array.isArray((raw as { data?: unknown }).data)) {\n return (raw as { data: unknown[] }).data;\n }\n return [];\n}\n\n/** 统一 uploaders(value/label)与 assignee-options / reviewers(id/displayName) */\nexport function normalizePersonDtos(raw: unknown[]): PersonOptionDto[] {\n return raw.map((item) => {\n const r = item as Record<string, unknown>;\n return {\n value: String(r.value ?? r.id ?? ''),\n label: String(r.label ?? r.displayName ?? ''),\n departmentId: r.departmentId != null ? String(r.departmentId) : undefined,\n departmentName: r.departmentName != null ? String(r.departmentName) : undefined,\n email: r.email != null ? String(r.email) : undefined,\n phone: r.phone != null ? String(r.phone) : undefined,\n employeeId: r.employeeId != null ? String(r.employeeId) : undefined,\n };\n });\n}\n\n/** 解析人员选项中的部门完整路径(父/子) */\nexport function resolvePersonDepartmentName(\n maps: DepartmentPathMaps | undefined,\n departmentId?: string,\n departmentName?: string,\n): string | undefined {\n if (!departmentId && !departmentName) return undefined;\n if (departmentName?.includes('/')) return departmentName;\n\n if (maps) {\n if (departmentId) {\n const byId = maps.byId.get(departmentId);\n if (byId) return byId;\n }\n if (departmentName) {\n const byLeaf = maps.byUniqueLeaf.get(departmentName);\n if (byLeaf) return byLeaf;\n }\n }\n return departmentName;\n}\n\nexport function toPersonOptions(\n data: PersonOptionDto[] | undefined,\n maps?: DepartmentPathMaps,\n): PersonOption[] {\n return (data || []).map((item) => ({\n value: item.value,\n label: item.label,\n departmentId: item.departmentId,\n departmentName: resolvePersonDepartmentName(maps, item.departmentId, item.departmentName),\n email: item.email,\n phone: item.phone,\n employeeId: item.employeeId,\n }));\n}\n\n/** @deprecated 使用 normalizePersonDtos + toPersonOptions */\nexport function toReviewerPersonOptions(\n data: ReviewerOptionDto[] | undefined,\n maps?: DepartmentPathMaps,\n): PersonOption[] {\n return toPersonOptions(normalizePersonDtos(data ?? []), maps);\n}\n\nexport function formatPersonValueLabel(opt: PersonOption): string {\n return opt.departmentName ? `${opt.label} · ${opt.departmentName}` : opt.label;\n}\n\n/** antd Select 人员选项(含选中后展示的 optionLabel) */\nexport type PersonSelectOption = PersonOption & { optionLabel: string };\n\nexport function toPersonSelectOptions(options: PersonOption[]): PersonSelectOption[] {\n return options.map((opt) => ({\n ...opt,\n optionLabel: formatPersonValueLabel(opt),\n }));\n}\n\n/** 按 value 索引人员选项,供 antd Select filterOption 反查完整数据 */\nexport function buildPersonOptionLookup(options: PersonOption[]): Map<string, PersonOption> {\n return new Map(options.map((opt) => [String(opt.value), opt]));\n}\n\n/** 从 antd Select 内部 option 还原完整人员数据 */\nexport function resolveSelectPersonOption(\n oriOption: { value?: string | number; data?: unknown } | undefined,\n lookup: Map<string, PersonOption>,\n): PersonOption | undefined {\n if (!oriOption) return undefined;\n const value = String(oriOption.value ?? '');\n if (value && lookup.has(value)) return lookup.get(value);\n return (oriOption.data ?? oriOption) as PersonOption;\n}\n\nexport function createPersonSelectFilter(lookup: Map<string, PersonOption>) {\n return (input: string, option?: { value?: string | number; data?: unknown }) => {\n const data = resolveSelectPersonOption(option, lookup);\n return data ? matchPersonOptionSearch(data, input) : false;\n };\n}\n\nexport function matchPersonOptionSearch(opt: PersonOption, text: string): boolean {\n const q = text.trim().toLowerCase();\n if (!q) return true;\n return [opt.label, opt.departmentName, opt.email, opt.phone, opt.employeeId].some((field) =>\n field?.toLowerCase().includes(q),\n );\n}\n"],"names":["normalizeRawPersonList","raw","normalizePersonDtos","item","r","resolvePersonDepartmentName","maps","departmentId","departmentName","byId","byLeaf","toPersonOptions","data","toReviewerPersonOptions","formatPersonValueLabel","opt","toPersonSelectOptions","options","buildPersonOptionLookup","resolveSelectPersonOption","oriOption","lookup","value","createPersonSelectFilter","input","option","matchPersonOptionSearch","text","q","field"],"mappings":"AA0BO,SAASA,EAAuBC,GAAyB;AAC9D,SAAI,MAAM,QAAQA,CAAG,IAAUA,IAC3BA,KAAO,OAAOA,KAAQ,YAAY,MAAM,QAASA,EAA2B,IAAI,IAC1EA,EAA4B,OAE/B,CAAA;AACT;AAGO,SAASC,EAAoBD,GAAmC;AACrE,SAAOA,EAAI,IAAI,CAACE,MAAS;AACvB,UAAMC,IAAID;AACV,WAAO;AAAA,MACL,OAAO,OAAOC,EAAE,SAASA,EAAE,MAAM,EAAE;AAAA,MACnC,OAAO,OAAOA,EAAE,SAASA,EAAE,eAAe,EAAE;AAAA,MAC5C,cAAcA,EAAE,gBAAgB,OAAO,OAAOA,EAAE,YAAY,IAAI;AAAA,MAChE,gBAAgBA,EAAE,kBAAkB,OAAO,OAAOA,EAAE,cAAc,IAAI;AAAA,MACtE,OAAOA,EAAE,SAAS,OAAO,OAAOA,EAAE,KAAK,IAAI;AAAA,MAC3C,OAAOA,EAAE,SAAS,OAAO,OAAOA,EAAE,KAAK,IAAI;AAAA,MAC3C,YAAYA,EAAE,cAAc,OAAO,OAAOA,EAAE,UAAU,IAAI;AAAA,IAAA;AAAA,EAE9D,CAAC;AACH;AAGO,SAASC,EACdC,GACAC,GACAC,GACoB;AACpB,MAAI,GAACD,KAAgB,CAACC,IACtB;AAAA,QAAIA,KAAA,QAAAA,EAAgB,SAAS,KAAM,QAAOA;AAE1C,QAAIF,GAAM;AACR,UAAIC,GAAc;AAChB,cAAME,IAAOH,EAAK,KAAK,IAAIC,CAAY;AACvC,YAAIE,EAAM,QAAOA;AAAA,MACnB;AACA,UAAID,GAAgB;AAClB,cAAME,IAASJ,EAAK,aAAa,IAAIE,CAAc;AACnD,YAAIE,EAAQ,QAAOA;AAAA,MACrB;AAAA,IACF;AACA,WAAOF;AAAA;AACT;AAEO,SAASG,EACdC,GACAN,GACgB;AAChB,UAAQM,KAAQ,CAAA,GAAI,IAAI,CAACT,OAAU;AAAA,IACjC,OAAOA,EAAK;AAAA,IACZ,OAAOA,EAAK;AAAA,IACZ,cAAcA,EAAK;AAAA,IACnB,gBAAgBE,EAA4BC,GAAMH,EAAK,cAAcA,EAAK,cAAc;AAAA,IACxF,OAAOA,EAAK;AAAA,IACZ,OAAOA,EAAK;AAAA,IACZ,YAAYA,EAAK;AAAA,EAAA,EACjB;AACJ;AAGO,SAASU,EACdD,GACAN,GACgB;AAChB,SAAOK,EAAgBT,EAAoBU,KAAQ,CAAA,CAAE,GAAGN,CAAI;AAC9D;AAEO,SAASQ,EAAuBC,GAA2B;AAChE,SAAOA,EAAI,iBAAiB,GAAGA,EAAI,KAAK,MAAMA,EAAI,cAAc,KAAKA,EAAI;AAC3E;AAKO,SAASC,EAAsBC,GAA+C;AACnF,SAAOA,EAAQ,IAAI,CAACF,OAAS;AAAA,IAC3B,GAAGA;AAAA,IACH,aAAaD,EAAuBC,CAAG;AAAA,EAAA,EACvC;AACJ;AAGO,SAASG,EAAwBD,GAAoD;AAC1F,SAAO,IAAI,IAAIA,EAAQ,IAAI,CAACF,MAAQ,CAAC,OAAOA,EAAI,KAAK,GAAGA,CAAG,CAAC,CAAC;AAC/D;AAGO,SAASI,EACdC,GACAC,GAC0B;AAC1B,MAAI,CAACD,EAAW;AAChB,QAAME,IAAQ,OAAOF,EAAU,SAAS,EAAE;AAC1C,SAAIE,KAASD,EAAO,IAAIC,CAAK,IAAUD,EAAO,IAAIC,CAAK,IAC/CF,EAAU,QAAQA;AAC5B;AAEO,SAASG,EAAyBF,GAAmC;AAC1E,SAAO,CAACG,GAAeC,MAAyD;AAC9E,UAAMb,IAAOO,EAA0BM,GAAQJ,CAAM;AACrD,WAAOT,IAAOc,EAAwBd,GAAMY,CAAK,IAAI;AAAA,EACvD;AACF;AAEO,SAASE,EAAwBX,GAAmBY,GAAuB;AAChF,QAAMC,IAAID,EAAK,KAAA,EAAO,YAAA;AACtB,SAAKC,IACE,CAACb,EAAI,OAAOA,EAAI,gBAAgBA,EAAI,OAAOA,EAAI,OAAOA,EAAI,UAAU,EAAE;AAAA,IAAK,CAACc,MACjFA,KAAA,gBAAAA,EAAO,cAAc,SAASD;AAAA,EAAC,IAFlB;AAIjB;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** localStorage 中记录最后一次用户操作时间的默认 key */
|
|
2
|
+
export declare const DEFAULT_LAST_ACTIVITY_STORAGE_KEY = "maoyang_last_activity";
|
|
3
|
+
export declare function getLastActivityTime(storageKey?: string): number;
|
|
4
|
+
export declare function touchLastActivity(storageKey?: string): void;
|
|
5
|
+
export declare function clearLastActivity(storageKey?: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = "maoyang_last_activity";
|
|
2
|
+
function i(t = e) {
|
|
3
|
+
const a = localStorage.getItem(t), o = a ? Number(a) : NaN;
|
|
4
|
+
return Number.isFinite(o) ? o : Date.now();
|
|
5
|
+
}
|
|
6
|
+
function c(t = e) {
|
|
7
|
+
localStorage.setItem(t, String(Date.now()));
|
|
8
|
+
}
|
|
9
|
+
function n(t = e) {
|
|
10
|
+
localStorage.removeItem(t);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
e as DEFAULT_LAST_ACTIVITY_STORAGE_KEY,
|
|
14
|
+
n as clearLastActivity,
|
|
15
|
+
i as getLastActivityTime,
|
|
16
|
+
c as touchLastActivity
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=sessionActivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionActivity.js","sources":["../../src/utils/sessionActivity.ts"],"sourcesContent":["/** localStorage 中记录最后一次用户操作时间的默认 key */\nexport const DEFAULT_LAST_ACTIVITY_STORAGE_KEY = 'maoyang_last_activity';\n\nexport function getLastActivityTime(storageKey = DEFAULT_LAST_ACTIVITY_STORAGE_KEY): number {\n const raw = localStorage.getItem(storageKey);\n const parsed = raw ? Number(raw) : NaN;\n return Number.isFinite(parsed) ? parsed : Date.now();\n}\n\nexport function touchLastActivity(storageKey = DEFAULT_LAST_ACTIVITY_STORAGE_KEY): void {\n localStorage.setItem(storageKey, String(Date.now()));\n}\n\nexport function clearLastActivity(storageKey = DEFAULT_LAST_ACTIVITY_STORAGE_KEY): void {\n localStorage.removeItem(storageKey);\n}\n"],"names":["DEFAULT_LAST_ACTIVITY_STORAGE_KEY","getLastActivityTime","storageKey","raw","parsed","touchLastActivity","clearLastActivity"],"mappings":"AACO,MAAMA,IAAoC;AAE1C,SAASC,EAAoBC,IAAaF,GAA2C;AAC1F,QAAMG,IAAM,aAAa,QAAQD,CAAU,GACrCE,IAASD,IAAM,OAAOA,CAAG,IAAI;AACnC,SAAO,OAAO,SAASC,CAAM,IAAIA,IAAS,KAAK,IAAA;AACjD;AAEO,SAASC,EAAkBH,IAAaF,GAAyC;AACtF,eAAa,QAAQE,GAAY,OAAO,KAAK,IAAA,CAAK,CAAC;AACrD;AAEO,SAASI,EAAkBJ,IAAaF,GAAyC;AACtF,eAAa,WAAWE,CAAU;AACpC;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const EMPLOYEE_ID_SIX_DIGIT_PATTERN: RegExp;
|
|
2
|
+
export declare const EMPLOYEE_ID_FORMAT_MESSAGE = "\u5DE5\u53F7\u5FC5\u987B\u4E3A6\u4F4D\u6570\u5B57";
|
|
3
|
+
export declare const employeeIdFormatRule: {
|
|
4
|
+
pattern: RegExp;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
/** 校验工号是否为 6 位数字(不含种子账号豁免,用于用户创建/注册) */
|
|
8
|
+
export declare function isValidEmployeeIdFormat(employeeId: string): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const t = /^\d{6}$/, E = "工号必须为6位数字", o = {
|
|
2
|
+
pattern: t,
|
|
3
|
+
message: E
|
|
4
|
+
};
|
|
5
|
+
function n(e) {
|
|
6
|
+
return t.test(String(e ?? "").trim());
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
E as EMPLOYEE_ID_FORMAT_MESSAGE,
|
|
10
|
+
t as EMPLOYEE_ID_SIX_DIGIT_PATTERN,
|
|
11
|
+
o as employeeIdFormatRule,
|
|
12
|
+
n as isValidEmployeeIdFormat
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=employeeId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employeeId.js","sources":["../../../src/utils/user/employeeId.ts"],"sourcesContent":["export const EMPLOYEE_ID_SIX_DIGIT_PATTERN = /^\\d{6}$/;\n\nexport const EMPLOYEE_ID_FORMAT_MESSAGE = '工号必须为6位数字';\n\nexport const employeeIdFormatRule = {\n pattern: EMPLOYEE_ID_SIX_DIGIT_PATTERN,\n message: EMPLOYEE_ID_FORMAT_MESSAGE,\n};\n\n/** 校验工号是否为 6 位数字(不含种子账号豁免,用于用户创建/注册) */\nexport function isValidEmployeeIdFormat(employeeId: string): boolean {\n return EMPLOYEE_ID_SIX_DIGIT_PATTERN.test(String(employeeId ?? '').trim());\n}\n"],"names":["EMPLOYEE_ID_SIX_DIGIT_PATTERN","EMPLOYEE_ID_FORMAT_MESSAGE","employeeIdFormatRule","isValidEmployeeIdFormat","employeeId"],"mappings":"AAAO,MAAMA,IAAgC,WAEhCC,IAA6B,aAE7BC,IAAuB;AAAA,EAClC,SAASF;AAAA,EACT,SAASC;AACX;AAGO,SAASE,EAAwBC,GAA6B;AACnE,SAAOJ,EAA8B,KAAK,OAAOI,KAAc,EAAE,EAAE,MAAM;AAC3E;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hkyhy/marsun-components-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Marsun pure UI component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -49,14 +49,26 @@
|
|
|
49
49
|
"build:showcase": "vite build --config vite.config.dev.ts",
|
|
50
50
|
"postbuild:showcase": "node dev/scripts/postbuild-showcase.mjs",
|
|
51
51
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"format": "prettier --write \"{src,dev}/**/*.{ts,tsx,scss,css,json}\"",
|
|
55
|
+
"lint-staged": "lint-staged",
|
|
56
|
+
"prepare": "husky",
|
|
52
57
|
"preview": "vite preview --config vite.config.dev.ts",
|
|
53
58
|
"preview:showcase": "vite preview --config vite.config.dev.ts --outDir dist-showcase",
|
|
54
59
|
"collect-examples": "node dev/scripts/collect-examples.mjs",
|
|
55
60
|
"test": "vitest run",
|
|
56
61
|
"test:watch": "vitest"
|
|
57
62
|
},
|
|
63
|
+
"lint-staged": {
|
|
64
|
+
"*.{js,ts,css,less,scss,vue,jsx,tsx,md,json}": [
|
|
65
|
+
"prettier --write"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
58
68
|
"peerDependencies": {
|
|
59
69
|
"antd": "^6.0.0",
|
|
70
|
+
"axios": "^1.7.0",
|
|
71
|
+
"dayjs": "^1.11.0",
|
|
60
72
|
"react": "^19.0.0",
|
|
61
73
|
"react-dom": "^19.0.0",
|
|
62
74
|
"react-router-dom": "^6.28.0 || ^7.0.0"
|
|
@@ -76,18 +88,31 @@
|
|
|
76
88
|
"remark-gfm": "^4.0.1"
|
|
77
89
|
},
|
|
78
90
|
"devDependencies": {
|
|
91
|
+
"@eslint/js": "^9.14.0",
|
|
79
92
|
"@testing-library/jest-dom": "^6.9.1",
|
|
80
93
|
"@testing-library/react": "^16.3.2",
|
|
81
94
|
"@types/react": "^19.0.0",
|
|
82
95
|
"@types/react-dom": "^19.0.0",
|
|
83
96
|
"@vitejs/plugin-react": "^4.3.4",
|
|
84
97
|
"antd": "^6.0.0",
|
|
98
|
+
"axios": "^1.7.7",
|
|
99
|
+
"dayjs": "^1.11.13",
|
|
100
|
+
"eslint": "^9.39.4",
|
|
101
|
+
"eslint-config-prettier": "^9.1.2",
|
|
102
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
103
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
104
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
105
|
+
"globals": "^15.12.0",
|
|
85
106
|
"happy-dom": "^20.9.0",
|
|
107
|
+
"husky": "^9.1.7",
|
|
108
|
+
"lint-staged": "^17.0.5",
|
|
109
|
+
"prettier": "^3.8.3",
|
|
86
110
|
"react": "^19.0.0",
|
|
87
111
|
"react-dom": "^19.0.0",
|
|
88
112
|
"react-router-dom": "^7.0.0",
|
|
89
113
|
"sass": "^1.101.0",
|
|
90
114
|
"typescript": "~5.6.2",
|
|
115
|
+
"typescript-eslint": "^8.14.0",
|
|
91
116
|
"vite": "^6.0.1",
|
|
92
117
|
"vite-plugin-dts": "^4.5.0",
|
|
93
118
|
"vitest": "^4.1.7"
|