@knockout-js/layout 0.1.2 → 0.1.3
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/es2017/components/_util/index.d.ts +8 -7
- package/es2017/components/_util/index.js +31 -13
- package/es2017/components/_util/index.js.map +1 -1
- package/es2017/components/aggregate-menu/index.d.ts +1 -2
- package/es2017/components/aggregate-menu/index.js +56 -39
- package/es2017/components/aggregate-menu/index.js.map +1 -1
- package/es2017/components/aggregate-menu/locale/en_US.js +1 -1
- package/es2017/components/aggregate-menu/locale/en_US.js.map +1 -1
- package/es2017/components/aggregate-menu/locale/zh_CN.js +1 -1
- package/es2017/components/aggregate-menu/locale/zh_CN.js.map +1 -1
- package/es2017/components/avatar-dropdown/index.d.ts +1 -2
- package/es2017/components/avatar-dropdown/index.js +1 -1
- package/es2017/components/avatar-dropdown/index.js.map +1 -1
- package/es2017/components/avatar-dropdown/locale/en_US.js +1 -1
- package/es2017/components/avatar-dropdown/locale/en_US.js.map +1 -1
- package/es2017/components/avatar-dropdown/locale/zh_CN.js +1 -1
- package/es2017/components/avatar-dropdown/locale/zh_CN.js.map +1 -1
- package/es2017/components/collect-providers/index.d.ts +1 -1
- package/es2017/components/collect-providers/index.js +7 -4
- package/es2017/components/collect-providers/index.js.map +1 -1
- package/es2017/components/i18n-dropdown/index.d.ts +1 -2
- package/es2017/components/i18n-dropdown/index.js +1 -1
- package/es2017/components/i18n-dropdown/index.js.map +1 -1
- package/es2017/components/icons/index.d.ts +3 -3
- package/es2017/components/icons/index.js +3 -3
- package/es2017/components/icons/index.js.map +1 -1
- package/es2017/components/index.d.ts +0 -2
- package/es2017/components/index.js +1 -3
- package/es2017/components/index.js.map +1 -1
- package/es2017/components/keep-alive/index.js +8 -4
- package/es2017/components/keep-alive/index.js.map +1 -1
- package/es2017/components/layout/index.d.ts +2 -2
- package/es2017/components/layout/index.js +15 -9
- package/es2017/components/layout/index.js.map +1 -1
- package/es2017/components/layout/logo.js +1 -1
- package/es2017/components/layout/logo.js.map +1 -1
- package/es2017/components/leave-prompt/index.d.ts +1 -1
- package/es2017/components/leave-prompt/index.js +10 -5
- package/es2017/components/leave-prompt/index.js.map +1 -1
- package/es2017/components/leave-prompt/locale/en_US.js +1 -1
- package/es2017/components/leave-prompt/locale/en_US.js.map +1 -1
- package/es2017/components/leave-prompt/locale/zh_CN.js +1 -1
- package/es2017/components/leave-prompt/locale/zh_CN.js.map +1 -1
- package/es2017/components/locale/en_US.js +1 -1
- package/es2017/components/locale/en_US.js.map +1 -1
- package/es2017/components/locale/index.js +5 -3
- package/es2017/components/locale/index.js.map +1 -1
- package/es2017/components/locale/zh_CN.js +1 -1
- package/es2017/components/locale/zh_CN.js.map +1 -1
- package/es2017/components/modal/index.d.ts +1 -1
- package/es2017/components/modal/index.js +10 -6
- package/es2017/components/modal/index.js.map +1 -1
- package/es2017/components/msg-dropdown/index.js +13 -6
- package/es2017/components/msg-dropdown/index.js.map +1 -1
- package/es2017/components/msg-dropdown/locale/en_US.js +1 -1
- package/es2017/components/msg-dropdown/locale/en_US.js.map +1 -1
- package/es2017/components/msg-dropdown/locale/zh_CN.js +1 -1
- package/es2017/components/msg-dropdown/locale/zh_CN.js.map +1 -1
- package/es2017/components/provider/index.d.ts +3 -3
- package/es2017/components/provider/index.js +3 -3
- package/es2017/components/provider/index.js.map +1 -1
- package/es2017/components/tenant-dropdown/index.d.ts +1 -2
- package/es2017/components/tenant-dropdown/index.js +9 -4
- package/es2017/components/tenant-dropdown/index.js.map +1 -1
- package/es2017/components/tenant-dropdown/locale/en_US.js +1 -1
- package/es2017/components/tenant-dropdown/locale/en_US.js.map +1 -1
- package/es2017/components/tenant-dropdown/locale/zh_CN.js +1 -1
- package/es2017/components/tenant-dropdown/locale/zh_CN.js.map +1 -1
- package/es2017/components/theme-switch/index.js +1 -1
- package/es2017/components/theme-switch/index.js.map +1 -1
- package/es2017/components/theme-switch/locale/en_US.js +1 -1
- package/es2017/components/theme-switch/locale/en_US.js.map +1 -1
- package/es2017/components/theme-switch/locale/zh_CN.js +1 -1
- package/es2017/components/theme-switch/locale/zh_CN.js.map +1 -1
- package/es2017/components/upload-file/index.js +1 -1
- package/es2017/components/upload-file/index.js.map +1 -1
- package/es2017/components/upload-file/locale/en_US.js +1 -1
- package/es2017/components/upload-file/locale/en_US.js.map +1 -1
- package/es2017/components/upload-file/locale/zh_CN.js +1 -1
- package/es2017/components/upload-file/locale/zh_CN.js.map +1 -1
- package/es2017/components/upload-file/uploadAvatar.d.ts +1 -2
- package/es2017/components/upload-file/uploadAvatar.js +34 -21
- package/es2017/components/upload-file/uploadAvatar.js.map +1 -1
- package/es2017/components/upload-file/uploadMultiple.d.ts +1 -2
- package/es2017/components/upload-file/uploadMultiple.js +35 -18
- package/es2017/components/upload-file/uploadMultiple.js.map +1 -1
- package/es2017/components/upload-file/uploadTemp.d.ts +1 -2
- package/es2017/components/upload-file/uploadTemp.js +45 -25
- package/es2017/components/upload-file/uploadTemp.js.map +1 -1
- package/es2017/index.js +1 -1
- package/es2017/index.js.map +1 -1
- package/esm/components/_util/index.d.ts +8 -7
- package/esm/components/_util/index.js +35 -17
- package/esm/components/_util/index.js.map +1 -1
- package/esm/components/aggregate-menu/index.d.ts +1 -2
- package/esm/components/aggregate-menu/index.js +66 -49
- package/esm/components/aggregate-menu/index.js.map +1 -1
- package/esm/components/aggregate-menu/locale/en_US.js +1 -1
- package/esm/components/aggregate-menu/locale/en_US.js.map +1 -1
- package/esm/components/aggregate-menu/locale/zh_CN.js +1 -1
- package/esm/components/aggregate-menu/locale/zh_CN.js.map +1 -1
- package/esm/components/avatar-dropdown/index.d.ts +1 -2
- package/esm/components/avatar-dropdown/index.js +1 -1
- package/esm/components/avatar-dropdown/index.js.map +1 -1
- package/esm/components/avatar-dropdown/locale/en_US.js +1 -1
- package/esm/components/avatar-dropdown/locale/en_US.js.map +1 -1
- package/esm/components/avatar-dropdown/locale/zh_CN.js +1 -1
- package/esm/components/avatar-dropdown/locale/zh_CN.js.map +1 -1
- package/esm/components/collect-providers/index.d.ts +1 -1
- package/esm/components/collect-providers/index.js +8 -5
- package/esm/components/collect-providers/index.js.map +1 -1
- package/esm/components/i18n-dropdown/index.d.ts +1 -2
- package/esm/components/i18n-dropdown/index.js +2 -2
- package/esm/components/i18n-dropdown/index.js.map +1 -1
- package/esm/components/icons/index.d.ts +3 -3
- package/esm/components/icons/index.js +3 -3
- package/esm/components/icons/index.js.map +1 -1
- package/esm/components/index.d.ts +0 -2
- package/esm/components/index.js +1 -3
- package/esm/components/index.js.map +1 -1
- package/esm/components/keep-alive/index.js +8 -4
- package/esm/components/keep-alive/index.js.map +1 -1
- package/esm/components/layout/index.d.ts +2 -2
- package/esm/components/layout/index.js +17 -11
- package/esm/components/layout/index.js.map +1 -1
- package/esm/components/layout/logo.js +1 -1
- package/esm/components/layout/logo.js.map +1 -1
- package/esm/components/leave-prompt/index.d.ts +1 -1
- package/esm/components/leave-prompt/index.js +10 -5
- package/esm/components/leave-prompt/index.js.map +1 -1
- package/esm/components/leave-prompt/locale/en_US.js +1 -1
- package/esm/components/leave-prompt/locale/en_US.js.map +1 -1
- package/esm/components/leave-prompt/locale/zh_CN.js +1 -1
- package/esm/components/leave-prompt/locale/zh_CN.js.map +1 -1
- package/esm/components/locale/en_US.js +1 -1
- package/esm/components/locale/en_US.js.map +1 -1
- package/esm/components/locale/index.js +5 -3
- package/esm/components/locale/index.js.map +1 -1
- package/esm/components/locale/zh_CN.js +1 -1
- package/esm/components/locale/zh_CN.js.map +1 -1
- package/esm/components/modal/index.d.ts +1 -1
- package/esm/components/modal/index.js +11 -7
- package/esm/components/modal/index.js.map +1 -1
- package/esm/components/msg-dropdown/index.js +16 -9
- package/esm/components/msg-dropdown/index.js.map +1 -1
- package/esm/components/msg-dropdown/locale/en_US.js +1 -1
- package/esm/components/msg-dropdown/locale/en_US.js.map +1 -1
- package/esm/components/msg-dropdown/locale/zh_CN.js +1 -1
- package/esm/components/msg-dropdown/locale/zh_CN.js.map +1 -1
- package/esm/components/provider/index.d.ts +3 -3
- package/esm/components/provider/index.js +3 -3
- package/esm/components/provider/index.js.map +1 -1
- package/esm/components/tenant-dropdown/index.d.ts +1 -2
- package/esm/components/tenant-dropdown/index.js +12 -7
- package/esm/components/tenant-dropdown/index.js.map +1 -1
- package/esm/components/tenant-dropdown/locale/en_US.js +1 -1
- package/esm/components/tenant-dropdown/locale/en_US.js.map +1 -1
- package/esm/components/tenant-dropdown/locale/zh_CN.js +1 -1
- package/esm/components/tenant-dropdown/locale/zh_CN.js.map +1 -1
- package/esm/components/theme-switch/index.js +1 -1
- package/esm/components/theme-switch/index.js.map +1 -1
- package/esm/components/theme-switch/locale/en_US.js +1 -1
- package/esm/components/theme-switch/locale/en_US.js.map +1 -1
- package/esm/components/theme-switch/locale/zh_CN.js +1 -1
- package/esm/components/theme-switch/locale/zh_CN.js.map +1 -1
- package/esm/components/upload-file/index.js +1 -1
- package/esm/components/upload-file/index.js.map +1 -1
- package/esm/components/upload-file/locale/en_US.js +1 -1
- package/esm/components/upload-file/locale/en_US.js.map +1 -1
- package/esm/components/upload-file/locale/zh_CN.js +1 -1
- package/esm/components/upload-file/locale/zh_CN.js.map +1 -1
- package/esm/components/upload-file/uploadAvatar.d.ts +1 -2
- package/esm/components/upload-file/uploadAvatar.js +20 -11
- package/esm/components/upload-file/uploadAvatar.js.map +1 -1
- package/esm/components/upload-file/uploadMultiple.d.ts +1 -2
- package/esm/components/upload-file/uploadMultiple.js +27 -14
- package/esm/components/upload-file/uploadMultiple.js.map +1 -1
- package/esm/components/upload-file/uploadTemp.d.ts +1 -2
- package/esm/components/upload-file/uploadTemp.js +31 -15
- package/esm/components/upload-file/uploadTemp.js.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/package.json +4 -6
- package/es2017/components/dictionary/index.d.ts +0 -6
- package/es2017/components/dictionary/index.js +0 -71
- package/es2017/components/dictionary/index.js.map +0 -1
- package/es2017/components/dictionary/index.module.css +0 -4
- package/es2017/components/dictionary/select.d.ts +0 -19
- package/es2017/components/dictionary/select.js +0 -51
- package/es2017/components/dictionary/select.js.map +0 -1
- package/es2017/components/dictionary/text.d.ts +0 -23
- package/es2017/components/dictionary/text.js +0 -28
- package/es2017/components/dictionary/text.js.map +0 -1
- package/esm/components/dictionary/index.d.ts +0 -6
- package/esm/components/dictionary/index.js +0 -92
- package/esm/components/dictionary/index.js.map +0 -1
- package/esm/components/dictionary/index.module.css +0 -4
- package/esm/components/dictionary/select.d.ts +0 -19
- package/esm/components/dictionary/select.js +0 -71
- package/esm/components/dictionary/select.js.map +0 -1
- package/esm/components/dictionary/text.d.ts +0 -23
- package/esm/components/dictionary/text.js +0 -31
- package/esm/components/dictionary/text.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
1
2
|
/**
|
|
2
3
|
* 列表数据格式化成树结构
|
|
3
4
|
* @param allList
|
|
@@ -7,18 +8,18 @@
|
|
|
7
8
|
* @returns
|
|
8
9
|
*/
|
|
9
10
|
export declare const listFormatTreeData: <T extends Record<string, any> & {
|
|
10
|
-
children?: T[];
|
|
11
|
-
}>(allList: T[], parentList?: T[], defineKey?: {
|
|
12
|
-
key?: string;
|
|
13
|
-
parentId?: string;
|
|
14
|
-
}, parentId?: string | number) => T[];
|
|
11
|
+
children?: T[] | undefined;
|
|
12
|
+
}>(allList: T[], parentList?: T[] | undefined, defineKey?: {
|
|
13
|
+
key?: string | undefined;
|
|
14
|
+
parentId?: string | undefined;
|
|
15
|
+
} | undefined, parentId?: string | number) => T[];
|
|
15
16
|
/**
|
|
16
17
|
* 解析树结构按树顺序处理成列表
|
|
17
18
|
* @param treeList
|
|
18
19
|
* @returns
|
|
19
20
|
*/
|
|
20
21
|
export declare const treeFormatList: <T extends Record<string, any> & {
|
|
21
|
-
children?: T[];
|
|
22
|
+
children?: T[] | undefined;
|
|
22
23
|
}>(treeList: T[]) => T[];
|
|
23
24
|
/**
|
|
24
25
|
* 字节大小展示处理
|
|
@@ -52,4 +53,4 @@ export declare const parseEnvAppAddress: (evnStr: string) => Record<string, stri
|
|
|
52
53
|
* = "2022-07-07 16:30:00"
|
|
53
54
|
* @returns
|
|
54
55
|
*/
|
|
55
|
-
export declare const getDate: (date: dayjs.ConfigType, format?: string, tz?: string, isTzSet?: boolean) =>
|
|
56
|
+
export declare const getDate: (date: dayjs.ConfigType, format?: string, tz?: string, isTzSet?: boolean) => string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import timezone from "dayjs/plugin/timezone";
|
|
4
4
|
import utc from "dayjs/plugin/utc";
|
|
@@ -16,10 +16,14 @@ dayjs.extend(timezone);
|
|
|
16
16
|
key: 'key',
|
|
17
17
|
parentId: 'parentId'
|
|
18
18
|
}, defineKey), pid = parentId === undefined ? '0' : parentId;
|
|
19
|
-
if (!parentList)
|
|
19
|
+
if (!parentList) {
|
|
20
|
+
parentList = allList.filter((item)=>item[dataKey.parentId] == pid);
|
|
21
|
+
}
|
|
20
22
|
parentList.forEach((pItem)=>{
|
|
21
23
|
const children = allList.filter((allItem)=>allItem[dataKey.parentId] == pItem[dataKey.key]);
|
|
22
|
-
if (children && children.length)
|
|
24
|
+
if (children && children.length) {
|
|
25
|
+
pItem.children = listFormatTreeData(allList, children, dataKey);
|
|
26
|
+
}
|
|
23
27
|
});
|
|
24
28
|
return parentList;
|
|
25
29
|
};
|
|
@@ -33,7 +37,9 @@ dayjs.extend(timezone);
|
|
|
33
37
|
const children = item.children;
|
|
34
38
|
delete item.children;
|
|
35
39
|
allList === null || allList === void 0 ? void 0 : allList.push(item);
|
|
36
|
-
if (children)
|
|
40
|
+
if (children) {
|
|
41
|
+
allList.push(...treeFormatList(children));
|
|
42
|
+
}
|
|
37
43
|
});
|
|
38
44
|
return allList;
|
|
39
45
|
};
|
|
@@ -42,10 +48,15 @@ dayjs.extend(timezone);
|
|
|
42
48
|
* @param fileSize
|
|
43
49
|
* @returns
|
|
44
50
|
*/ export const formatFileSize = (fileSize)=>{
|
|
45
|
-
if (fileSize < 1024)
|
|
46
|
-
|
|
47
|
-
else if (fileSize <
|
|
48
|
-
|
|
51
|
+
if (fileSize < 1024) {
|
|
52
|
+
return fileSize + 'B';
|
|
53
|
+
} else if (fileSize < 1024 * 1024) {
|
|
54
|
+
return (fileSize / 1024).toFixed(2) + 'KB';
|
|
55
|
+
} else if (fileSize < 1024 * 1024 * 1024) {
|
|
56
|
+
return (fileSize / (1024 * 1024)).toFixed(2) + 'MB';
|
|
57
|
+
} else {
|
|
58
|
+
return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + 'GB';
|
|
59
|
+
}
|
|
49
60
|
};
|
|
50
61
|
/**
|
|
51
62
|
* 随机数
|
|
@@ -65,7 +76,9 @@ dayjs.extend(timezone);
|
|
|
65
76
|
evnStr.split(';').forEach((str)=>{
|
|
66
77
|
if (str) {
|
|
67
78
|
const adds = str.split('@');
|
|
68
|
-
if (adds.length === 2)
|
|
79
|
+
if (adds.length === 2) {
|
|
80
|
+
address[adds[0]] = adds[1];
|
|
81
|
+
}
|
|
69
82
|
}
|
|
70
83
|
});
|
|
71
84
|
return address;
|
|
@@ -86,11 +99,16 @@ dayjs.extend(timezone);
|
|
|
86
99
|
*/ export const getDate = (date, format = 'YYYY-MM-DD', tz, isTzSet)=>{
|
|
87
100
|
if (date) {
|
|
88
101
|
if (tz) {
|
|
89
|
-
if (isTzSet)
|
|
90
|
-
|
|
102
|
+
if (isTzSet) {
|
|
103
|
+
return dayjs.tz(date, tz).format(format);
|
|
104
|
+
} else {
|
|
105
|
+
return dayjs(date).tz(tz).format(format);
|
|
106
|
+
}
|
|
91
107
|
}
|
|
92
108
|
return dayjs(date).format(format);
|
|
93
|
-
} else
|
|
109
|
+
} else {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
94
112
|
};
|
|
95
113
|
|
|
96
|
-
//# sourceMappingURL=
|
|
114
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\_util\\index.ts"],"sourcesContent":["import dayjs from 'dayjs';\r\nimport timezone from 'dayjs/plugin/timezone';\r\nimport utc from 'dayjs/plugin/utc';\r\n\r\ndayjs.extend(utc);\r\ndayjs.extend(timezone);\r\n\r\n/**\r\n * 列表数据格式化成树结构\r\n * @param allList\r\n * @param parentList\r\n * @param defineKey\r\n * @param parentId\r\n * @returns\r\n */\r\nexport const listFormatTreeData = <T extends Record<string, any> & { children?: T[] }>(\r\n allList: T[],\r\n parentList?: T[],\r\n defineKey?: {\r\n key?: string;\r\n parentId?: string;\r\n },\r\n parentId?: string | number,\r\n) => {\r\n const dataKey = { key: 'key', parentId: 'parentId', ...defineKey },\r\n pid = parentId === undefined ? '0' : parentId;\r\n\r\n if (!parentList) {\r\n parentList = allList.filter(item => item[dataKey.parentId] == pid);\r\n }\r\n\r\n parentList.forEach((pItem) => {\r\n const children = allList.filter(\r\n (allItem) => allItem[dataKey.parentId] == pItem[dataKey.key],\r\n );\r\n if (children && children.length) {\r\n pItem.children = listFormatTreeData(allList, children, dataKey);\r\n }\r\n });\r\n return parentList;\r\n};\r\n\r\n/**\r\n * 解析树结构按树顺序处理成列表\r\n * @param treeList\r\n * @returns\r\n */\r\nexport const treeFormatList = <T extends Record<string, any> & { children?: T[] }>(treeList: T[]) => {\r\n const allList: T[] = [];\r\n\r\n treeList.forEach(item => {\r\n const children = item.children;\r\n delete item.children;\r\n allList?.push(item);\r\n if (children) {\r\n allList.push(...treeFormatList(children));\r\n }\r\n });\r\n\r\n return allList;\r\n}\r\n\r\n/**\r\n * 字节大小展示处理\r\n * @param fileSize\r\n * @returns\r\n */\r\nexport const formatFileSize = (fileSize: number) => {\r\n if (fileSize < 1024) {\r\n return fileSize + 'B';\r\n } else if (fileSize < (1024 * 1024)) {\r\n return (fileSize / 1024).toFixed(2) + 'KB';\r\n } else if (fileSize < (1024 * 1024 * 1024)) {\r\n return (fileSize / (1024 * 1024)).toFixed(2) + 'MB';\r\n } else {\r\n return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + 'GB';\r\n }\r\n}\r\n\r\n/**\r\n * 随机数\r\n * @param len\r\n * @returns\r\n */\r\nexport const randomId = (len: number) => {\r\n let str = '';\r\n for (; str.length < len; str += Math.random().toString(36).substring(2));\r\n return str.substring(0, len);\r\n}\r\n\r\n\r\n/**\r\n * 解析env配置的app地址字符串\r\n * @param evnStr appCode@deploy_address;\r\n * @returns\r\n */\r\nexport const parseEnvAppAddress = (evnStr: string) => {\r\n const address: Record<string, string> = {};\r\n evnStr.split(';').forEach(str => {\r\n if (str) {\r\n const adds = str.split('@');\r\n if (adds.length === 2) {\r\n address[adds[0]] = adds[1];\r\n }\r\n }\r\n })\r\n return address;\r\n}\r\n\r\n\r\n\r\n/**\r\n * 格式化日期\r\n * @param date\r\n * @param format YYYY-MM-DD HH:mm:ss\r\n * @param tz 时区\r\n * @param isTzSet true将当前时间设置成这个时区,false 将当前时间根据时区转换\r\n * 例子 isTzSet=true\r\n * dayjs.tz(\"2022-07-07 16:30:00\", \"America/New_York\").format(\"YYYY-MM-DDTHH:mm:ssZ\")\r\n * = \"2022-07-07T16:30:00-04:00\"\r\n * 例子 isTzSet=false\r\n * dayjs(\"2022-07-07T20:30:00Z\").tz(\"America/New_York\").format(\"YYYY-MM-DD HH:mm:ss\")\r\n * = \"2022-07-07 16:30:00\"\r\n * @returns\r\n */\r\nexport const getDate = (\r\n date: dayjs.ConfigType,\r\n format = 'YYYY-MM-DD',\r\n tz?: string,\r\n isTzSet?: boolean,\r\n) => {\r\n if (date) {\r\n if (tz) {\r\n if (isTzSet) {\r\n return dayjs.tz(date, tz).format(format);\r\n } else {\r\n return dayjs(date).tz(tz).format(format);\r\n }\r\n }\r\n return dayjs(date).format(format);\r\n } else {\r\n return null\r\n }\r\n};\r\n"],"names":["dayjs","timezone","utc","extend","listFormatTreeData","allList","parentList","defineKey","parentId","dataKey","key","pid","undefined","filter","item","forEach","pItem","children","allItem","length","treeFormatList","treeList","push","formatFileSize","fileSize","toFixed","randomId","len","str","Math","random","toString","substring","parseEnvAppAddress","evnStr","address","split","adds","getDate","date","format","tz","isTzSet"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,cAAc,wBAAwB;AAC7C,OAAOC,SAAS,mBAAmB;AAEnCF,MAAMG,MAAM,CAACD;AACbF,MAAMG,MAAM,CAACF;AAEb;;;;;;;CAOC,GACD,OAAO,MAAMG,qBAAqB,CAChCC,SACAC,YACAC,WAIAC,WACG;IACH,MAAMC,UAAU;QAAEC,KAAK;QAAOF,UAAU;OAAeD,YACrDI,MAAMH,aAAaI,YAAY,MAAMJ,QAAQ;IAE/C,IAAI,CAACF,YAAY;QACfA,aAAaD,QAAQQ,MAAM,CAACC,CAAAA,OAAQA,IAAI,CAACL,QAAQD,QAAQ,CAAC,IAAIG;IAChE,CAAC;IAEDL,WAAWS,OAAO,CAAC,CAACC,QAAU;QAC5B,MAAMC,WAAWZ,QAAQQ,MAAM,CAC7B,CAACK,UAAYA,OAAO,CAACT,QAAQD,QAAQ,CAAC,IAAIQ,KAAK,CAACP,QAAQC,GAAG,CAAC;QAE9D,IAAIO,YAAYA,SAASE,MAAM,EAAE;YAC/BH,MAAMC,QAAQ,GAAGb,mBAAmBC,SAASY,UAAUR;QACzD,CAAC;IACH;IACA,OAAOH;AACT,EAAE;AAEF;;;;CAIC,GACD,OAAO,MAAMc,iBAAiB,CAAqDC,WAAkB;IACnG,MAAMhB,UAAe,EAAE;IAEvBgB,SAASN,OAAO,CAACD,CAAAA,OAAQ;QACvB,MAAMG,WAAWH,KAAKG,QAAQ;QAC9B,OAAOH,KAAKG,QAAQ;QACpBZ,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASiB,IAAI,CAACR;Q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,MAAM;QACR,IAAIE,IAAI;YACN,IAAIC,SAAS;gBACX,OAAO1C,MAAMyC,EAAE,CAACF,MAAME,IAAID,MAAM,CAACA;YACnC,OAAO;gBACL,OAAOxC,MAAMuC,MAAME,EAAE,CAACA,IAAID,MAAM,CAACA;YACnC,CAAC;QACH,CAAC;QACD,OAAOxC,MAAMuC,MAAMC,MAAM,CAACA;IAC5B,OAAO;QACL,OAAO,IAAI;IACb,CAAC;AACH,EAAE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { DrawerProps } from "antd";
|
|
3
2
|
import { App, AppMenu } from "@knockout-js/api/ucenter";
|
|
4
3
|
export type AggregateMenuLocale = {
|
|
@@ -33,5 +32,5 @@ export interface AggregateMenuProps {
|
|
|
33
32
|
*/
|
|
34
33
|
onClick?: (menuItem: AppMenu, app: App, isOpen?: boolean) => void;
|
|
35
34
|
}
|
|
36
|
-
declare const _default: (props: AggregateMenuProps) => JSX.Element;
|
|
35
|
+
declare const _default: (props: AggregateMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
36
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import { CloseOutlined, DragOutlined, SearchOutlined, StarOutlined } from "@ant-design/icons";
|
|
5
5
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -98,9 +98,11 @@ export default ((props)=>{
|
|
|
98
98
|
const appsResult = await paging(userAppsQuery, {}, 1, {
|
|
99
99
|
instanceName: instanceName.UCENTER
|
|
100
100
|
}), apps = [];
|
|
101
|
-
if ((_appsResult_data = appsResult.data) === null || _appsResult_data === void 0 ? void 0 : _appsResult_data.userApps)
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if ((_appsResult_data = appsResult.data) === null || _appsResult_data === void 0 ? void 0 : _appsResult_data.userApps) {
|
|
102
|
+
appsResult.data.userApps.forEach((app)=>{
|
|
103
|
+
apps.push(app);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
104
106
|
const newAll = [];
|
|
105
107
|
for(let i in apps){
|
|
106
108
|
var _menuResult_data;
|
|
@@ -131,24 +133,28 @@ export default ((props)=>{
|
|
|
131
133
|
});
|
|
132
134
|
if ((_preferenceResult_data = preferenceResult.data) === null || _preferenceResult_data === void 0 ? void 0 : (_preferenceResult_data_orgUserPreference = _preferenceResult_data.orgUserPreference) === null || _preferenceResult_data_orgUserPreference === void 0 ? void 0 : _preferenceResult_data_orgUserPreference.id) {
|
|
133
135
|
const menuFavorite = preferenceResult.data.orgUserPreference.menuFavorite, menuRecent = preferenceResult.data.orgUserPreference.menuRecent, collectsList = [], latelyList = [];
|
|
134
|
-
if (menuFavorite)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
if (menuFavorite) {
|
|
137
|
+
menuFavorite.forEach((id)=>{
|
|
138
|
+
for(let i in newAll){
|
|
139
|
+
const menuItem = newAll[i].menu.find((item)=>item.id == id);
|
|
140
|
+
if (menuItem) {
|
|
141
|
+
collectsList.push(menuItem);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (menuRecent)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (menuRecent) {
|
|
148
|
+
menuRecent.forEach((id)=>{
|
|
149
|
+
for(let i in newAll){
|
|
150
|
+
const menuItem = newAll[i].menu.find((item)=>item.id == id);
|
|
151
|
+
if (menuItem) {
|
|
152
|
+
latelyList.push(menuItem);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
149
155
|
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
152
158
|
setCollects(collectsList);
|
|
153
159
|
setLately(latelyList);
|
|
154
160
|
}
|
|
@@ -182,7 +188,9 @@ export default ((props)=>{
|
|
|
182
188
|
...latelys
|
|
183
189
|
];
|
|
184
190
|
const oldIdx = latelyList.findIndex((lately)=>lately.id == menuItem.id);
|
|
185
|
-
if (oldIdx > -1)
|
|
191
|
+
if (oldIdx > -1) {
|
|
192
|
+
latelyList.splice(oldIdx, 1);
|
|
193
|
+
}
|
|
186
194
|
latelyList.unshift(menuItem);
|
|
187
195
|
latelyList.splice(6);
|
|
188
196
|
await requestRecent(latelyList.map((item)=>item.id));
|
|
@@ -220,11 +228,14 @@ export default ((props)=>{
|
|
|
220
228
|
onClick: async (event)=>{
|
|
221
229
|
event.stopPropagation();
|
|
222
230
|
let collectList = [];
|
|
223
|
-
if (checkCollect(menuItem))
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
if (checkCollect(menuItem)) {
|
|
232
|
+
collectList = collects.filter((c)=>!(c.id === menuItem.id && c.appID === menuItem.appID));
|
|
233
|
+
} else {
|
|
234
|
+
collectList = [
|
|
235
|
+
...collects,
|
|
236
|
+
menuItem
|
|
237
|
+
];
|
|
238
|
+
}
|
|
228
239
|
await requestFavorite(collectList);
|
|
229
240
|
setCollects(collectList);
|
|
230
241
|
}
|
|
@@ -239,7 +250,9 @@ export default ((props)=>{
|
|
|
239
250
|
if (props.dataSource) {
|
|
240
251
|
setAll(props.dataSource);
|
|
241
252
|
setFilterList(props.dataSource);
|
|
242
|
-
} else
|
|
253
|
+
} else {
|
|
254
|
+
request();
|
|
255
|
+
}
|
|
243
256
|
}, [
|
|
244
257
|
props.dataSource
|
|
245
258
|
]);
|
|
@@ -269,13 +282,15 @@ export default ((props)=>{
|
|
|
269
282
|
collisionDetection: closestCenter,
|
|
270
283
|
onDragEnd: (event)=>{
|
|
271
284
|
const { active , over } = event;
|
|
272
|
-
if (over && active.id !== over.id)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
285
|
+
if (over && active.id !== over.id) {
|
|
286
|
+
setCollects((items)=>{
|
|
287
|
+
const oldIndex = items.findIndex((oItem)=>`${oItem.id}-${oItem.appID}` == active.id);
|
|
288
|
+
const newIndex = items.findIndex((nItem)=>`${nItem.id}-${nItem.appID}` == over.id);
|
|
289
|
+
const collectList = arrayMove(items, oldIndex, newIndex);
|
|
290
|
+
requestFavorite(collectList);
|
|
291
|
+
return collectList;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
279
294
|
},
|
|
280
295
|
children: /*#__PURE__*/ _jsx(SortableContext, {
|
|
281
296
|
items: collects.map((item)=>`${item.id}-${item.appID}`),
|
|
@@ -320,9 +335,11 @@ export default ((props)=>{
|
|
|
320
335
|
};
|
|
321
336
|
}).filter((f)=>f.menu.length);
|
|
322
337
|
setFilterList(fList);
|
|
323
|
-
} else
|
|
324
|
-
|
|
325
|
-
|
|
338
|
+
} else {
|
|
339
|
+
setFilterList([
|
|
340
|
+
...all
|
|
341
|
+
]);
|
|
342
|
+
}
|
|
326
343
|
}
|
|
327
344
|
})
|
|
328
345
|
}),
|
|
@@ -369,4 +386,4 @@ export default ((props)=>{
|
|
|
369
386
|
});
|
|
370
387
|
});
|
|
371
388
|
|
|
372
|
-
//# sourceMappingURL=
|
|
389
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["D:\\codeing\\git\\github\\knockout-js\\packages\\layout\\src\\components\\aggregate-menu\\index.tsx"],"sourcesContent":["import { CloseOutlined, DragOutlined, SearchOutlined, StarOutlined } from \"@ant-design/icons\"\r\nimport { useCallback, useEffect, useState } from \"react\"\r\nimport styles from \"./index.module.css\"\r\nimport { Drawer, DrawerProps, Empty, Input, Space } from \"antd\";\r\nimport { gql, mutation, paging, query } from \"@knockout-js/ice-urql/request\";\r\nimport { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors, } from \"@dnd-kit/core\";\r\nimport { arrayMove, SortableContext, useSortable, sortableKeyboardCoordinates, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\r\nimport { CSS } from '@dnd-kit/utilities';\r\nimport { useLocale } from \"../locale\";\r\nimport { useDark } from \"../provider\";\r\nimport { listFormatTreeData, treeFormatList } from \"../_util\";\r\nimport { OpenWin } from \"../icons\";\r\nimport { App, AppMenu, AppMenuKind, LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables, LayoutPkgUserAppListQuery, LayoutPkgUserAppListQueryVariables, LayoutPkgUserMenuListQuery, LayoutPkgUserMenuListQueryVariables, LayoutPkgUserPreferenceQuery, LayoutPkgUserPreferenceQueryVariables } from \"@knockout-js/api/ucenter\";\r\nimport { instanceName } from \"@knockout-js/api\";\r\n\r\nconst userMenuListQuery = gql(/* GraphQL */`query layoutPkgUserMenuList($appCode:String!){\r\n userMenus(appCode: $appCode){\r\n id,name,route,appID,parentID,displaySort,kind\r\n }\r\n}`);\r\n\r\nconst userAppsQuery = gql(/* GraphQL */`query layoutPkgUserAppList{\r\n userApps{\r\n id,name,code\r\n }\r\n}`);\r\n\r\nconst userPreferenceQuery = gql(/* GraphQL */`query layoutPkgUserPreference{\r\n orgUserPreference{\r\n id,menuFavorite,menuRecent,\r\n }\r\n}`);\r\n\r\nconst userPreferenceMut = gql(/* GraphQL */`mutation layoutPkgSaveUserPreference($input:OrgUserPreferenceInput!){\r\n saveOrgUserPreference(input: $input){ id }\r\n}`);\r\n\r\nexport type AggregateMenuLocale = {\r\n title: string;\r\n latelyTitle: string;\r\n notText: string;\r\n searchPlaceholder: string;\r\n}\r\n\r\nexport type AggregateMenuDataSource = {\r\n app: App;\r\n menu: AppMenu[];\r\n}[]\r\n\r\nexport interface AggregateMenuProps {\r\n /**\r\n * 弹出开关\r\n */\r\n open?: boolean;\r\n /**\r\n * 数据源\r\n */\r\n dataSource?: AggregateMenuDataSource;\r\n /**\r\n * 弹框设置\r\n */\r\n drawerProps?: DrawerProps;\r\n /**\r\n * 弹出开关变更\r\n */\r\n onChangeOpen?: (open: boolean) => void;\r\n /**\r\n * 选中菜单\r\n */\r\n onClick?: (menuItem: AppMenu, app: App, isOpen?: boolean) => void;\r\n}\r\n\r\n/**\r\n * 排序拖拽使用的控件\r\n * https://docs.dndkit.com/\r\n * @param props\r\n * @returns\r\n */\r\nconst DargItem = (props: {\r\n value: AppMenu;\r\n onDel: () => void;\r\n onClick: (isOpen?: boolean) => void;\r\n}) => {\r\n const id = `${props.value.id}-${props.value.appID}`;\r\n const { setNodeRef, listeners, attributes, transform, transition } = useSortable({ id });\r\n const style = {\r\n transform: CSS.Transform.toString(transform),\r\n transition,\r\n };\r\n\r\n return <div\r\n ref={setNodeRef}\r\n style={style}\r\n {...attributes}\r\n className={styles.aggregateMenuDrawerMenuItem}\r\n onClick={() => {\r\n props.onClick();\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerMenuItemName}>{props.value.name}</div>\r\n <div className={styles.aggregateMenuDrawerMenuItemIcons}>\r\n <Space>\r\n <OpenWin className=\"anticon\" onClick={(event) => {\r\n event.stopPropagation();\r\n props.onClick(true);\r\n }} />\r\n <CloseOutlined rev={undefined} onClick={(event) => {\r\n event.stopPropagation();\r\n props.onDel();\r\n }} />\r\n <DragOutlined rev={undefined} {...listeners} className=\"dragIcon\" />\r\n </Space>\r\n </div>\r\n </div>\r\n}\r\n\r\nexport default (props: AggregateMenuProps) => {\r\n const [all, setAll] = useState<AggregateMenuDataSource>([]),\r\n [filterList, setFilterList] = useState<AggregateMenuDataSource>([]),\r\n [collects, setCollects] = useState<AppMenu[]>([]),\r\n [latelys, setLately] = useState<AppMenu[]>([]),\r\n locale = useLocale('AggregateMenu'),\r\n isDark = useDark(),\r\n sensors = useSensors(\r\n useSensor(PointerSensor),\r\n useSensor(KeyboardSensor, {\r\n coordinateGetter: sortableKeyboardCoordinates,\r\n })\r\n );\r\n\r\n const\r\n request = useCallback(async () => {\r\n const appsResult = await paging<LayoutPkgUserAppListQuery, LayoutPkgUserAppListQueryVariables>(userAppsQuery, {}, 1, {\r\n instanceName: instanceName.UCENTER,\r\n }), apps: App[] = [];\r\n if (appsResult.data?.userApps) {\r\n appsResult.data.userApps.forEach(app => {\r\n apps.push(app as App)\r\n })\r\n }\r\n const newAll: AggregateMenuDataSource = [];\r\n for (let i in apps) {\r\n const menuResult = await query<LayoutPkgUserMenuListQuery, LayoutPkgUserMenuListQueryVariables>(userMenuListQuery, {\r\n appCode: apps[i].code,\r\n }, { instanceName: instanceName.UCENTER });\r\n if (menuResult.data?.userMenus) {\r\n const menu = menuResult.data.userMenus.sort((d1, d2) => {\r\n const d1Sort = d1.displaySort || 0, d2Sort = d2.displaySort || 0;\r\n return d1.parentID < d2.parentID ? -1 : d1.parentID > d2.parentID ? 1 : d1Sort < d2Sort ? -1 : d1Sort > d2Sort ? 1 : 0;\r\n }) as AppMenu[];\r\n newAll.push({\r\n app: apps[i],\r\n menu: treeFormatList(listFormatTreeData(menu, undefined, { key: 'id', parentId: 'parentID' })),\r\n })\r\n }\r\n }\r\n setAll(newAll);\r\n setFilterList(newAll);\r\n // 初始化收藏和初始化最近数据\r\n const preferenceResult = await query<LayoutPkgUserPreferenceQuery, LayoutPkgUserPreferenceQueryVariables>(userPreferenceQuery, {}, {\r\n instanceName: instanceName.UCENTER\r\n });\r\n if (preferenceResult.data?.orgUserPreference?.id) {\r\n const menuFavorite = preferenceResult.data.orgUserPreference.menuFavorite,\r\n menuRecent = preferenceResult.data.orgUserPreference.menuRecent,\r\n collectsList: AppMenu[] = [],\r\n latelyList: AppMenu[] = [];\r\n if (menuFavorite) {\r\n menuFavorite.forEach(id => {\r\n for (let i in newAll) {\r\n const menuItem = newAll[i].menu.find(item => item.id == id);\r\n if (menuItem) {\r\n collectsList.push(menuItem);\r\n break;\r\n }\r\n }\r\n\r\n })\r\n }\r\n if (menuRecent) {\r\n menuRecent.forEach(id => {\r\n for (let i in newAll) {\r\n const menuItem = newAll[i].menu.find(item => item.id == id);\r\n if (menuItem) {\r\n latelyList.push(menuItem);\r\n break;\r\n }\r\n }\r\n\r\n })\r\n }\r\n setCollects(collectsList);\r\n setLately(latelyList);\r\n }\r\n }, []),\r\n requestFavorite = async (list: AppMenu[]) => {\r\n // 异步存储收藏\r\n await mutation<LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables>(userPreferenceMut, {\r\n input: {\r\n menuFavorite: list.map(item => item.id),\r\n }\r\n }, {\r\n instanceName: instanceName.UCENTER,\r\n });\r\n },\r\n requestRecent = async (ids: string[]) => {\r\n // 异步存储访问菜单记录\r\n await mutation<LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables>(userPreferenceMut, {\r\n input: {\r\n menuRecent: ids,\r\n }\r\n }, {\r\n instanceName: instanceName.UCENTER,\r\n });\r\n },\r\n checkCollect = useCallback((menuItem: AppMenu) => {\r\n return !!collects.find(item => item.id === menuItem.id && item.appID === menuItem.appID);\r\n }, [collects]),\r\n onClickItem = async (menuItem: AppMenu, isOpen?: boolean) => {\r\n const allApp = all.find(allItem => allItem.app.id == menuItem.appID);\r\n if (allApp) {\r\n const latelyList = [...latelys];\r\n const oldIdx = latelyList.findIndex(lately => lately.id == menuItem.id);\r\n if (oldIdx > -1) {\r\n latelyList.splice(oldIdx, 1);\r\n }\r\n latelyList.unshift(menuItem);\r\n latelyList.splice(6);\r\n await requestRecent(latelyList.map(item => item.id));\r\n setLately(latelyList);\r\n props.onClick?.(menuItem, allApp.app, isOpen);\r\n }\r\n },\r\n menuItemRender = (menuItem: AppMenu) => {\r\n return <div\r\n key={`${menuItem.id}-${menuItem.appID}`}\r\n className={styles.aggregateMenuDrawerAllMenuItem}\r\n onClick={() => {\r\n onClickItem(menuItem)\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerAllMenuItemName}> {menuItem.name}</div>\r\n <div className={styles.aggregateMenuDrawerAllMenuItemIcons}>\r\n <Space>\r\n <OpenWin className=\"anticon\" onClick={(event) => {\r\n event.stopPropagation();\r\n onClickItem(menuItem, true)\r\n }} />\r\n <StarOutlined rev={undefined} className={checkCollect(menuItem) ? 'collect' : ''} onClick={async (event) => {\r\n event.stopPropagation();\r\n let collectList: AppMenu[] = [];\r\n if (checkCollect(menuItem)) {\r\n collectList = collects.filter(c => !(c.id === menuItem.id && c.appID === menuItem.appID))\r\n } else {\r\n collectList = [...collects, menuItem]\r\n }\r\n await requestFavorite(collectList)\r\n setCollects(collectList);\r\n }} />\r\n </Space>\r\n </div>\r\n </div>\r\n }\r\n\r\n useEffect(() => {\r\n if (props.dataSource) {\r\n setAll(props.dataSource);\r\n setFilterList(props.dataSource);\r\n } else {\r\n request();\r\n }\r\n }, [props.dataSource]);\r\n\r\n return <>\r\n <Drawer\r\n title={locale.title}\r\n maskClosable={false}\r\n placement=\"left\"\r\n width={1060}\r\n {...props.drawerProps}\r\n className={`${styles.aggregateMenuDrawer} ${isDark ? styles.aggregateMenuDark : ''}`}\r\n open={props.open}\r\n onClose={() => {\r\n props.onChangeOpen?.(false);\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerRow}>\r\n <div style={{ width: 240 }} className={styles.aggregateMenuDrawerMenu}>\r\n {/* 收藏 */}\r\n {collects.length ?\r\n <DndContext sensors={sensors}\r\n collisionDetection={closestCenter}\r\n onDragEnd={(event) => {\r\n const { active, over } = event;\r\n if (over && active.id !== over.id) {\r\n setCollects((items) => {\r\n const oldIndex = items.findIndex(oItem => `${oItem.id}-${oItem.appID}` == active.id);\r\n const newIndex = items.findIndex(nItem => `${nItem.id}-${nItem.appID}` == over.id);\r\n const collectList = arrayMove(items, oldIndex, newIndex);\r\n requestFavorite(collectList);\r\n return collectList;\r\n });\r\n }\r\n }}\r\n >\r\n <SortableContext items={collects.map(item => `${item.id}-${item.appID}`)} strategy={verticalListSortingStrategy}>\r\n {\r\n collects.map(item => (<DargItem\r\n key={`c${item.id}-${item.appID}`}\r\n value={item}\r\n onDel={async () => {\r\n const collectList = collects.filter(c => !(c.id === item.id && c.appID === item.appID))\r\n await requestFavorite(collectList);\r\n setCollects(collectList);\r\n }}\r\n onClick={(isOpen) => {\r\n onClickItem(item, isOpen)\r\n }}\r\n />))\r\n }\r\n </SortableContext>\r\n </DndContext>\r\n : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={locale.notText} />\r\n }\r\n </div>\r\n <div style={{ width: 820 }}>\r\n {/* 过滤 */}\r\n <div className={styles.aggregateMenuDrawerAllInput}>\r\n <Input\r\n bordered={false}\r\n prefix={<SearchOutlined rev={undefined} />}\r\n placeholder={locale.searchPlaceholder}\r\n onChange={(event) => {\r\n const keyword = event.target.value;\r\n if (keyword) {\r\n const fList = all.map(f => {\r\n return {\r\n app: f.app,\r\n menu: f.menu.filter(fMenuItem => fMenuItem.name.indexOf(keyword) > -1),\r\n };\r\n }).filter(f => f.menu.length);\r\n setFilterList(fList);\r\n } else {\r\n setFilterList([...all]);\r\n }\r\n }}\r\n />\r\n </div>\r\n {/* 最近访问 */}\r\n {latelys.length ?\r\n <div className={styles.aggregateMenuLatelys}>\r\n <div className={styles.aggregateMenuDrawerAllMenuItemDir}>{locale.latelyTitle}</div>\r\n <div className={styles.aggregateMenuLatelysColumn}>\r\n {latelys.map(menuItem => (\r\n menuItemRender(menuItem)\r\n ))}\r\n </div>\r\n </div> : <></>\r\n }\r\n {/* all应用菜单 */}\r\n <div className={styles.aggregateMenuDrawerAllMenu} style={{ height: latelys.length ? \"calc(100% - 164px)\" : \"calc(100% - 52px)\" }}>\r\n <div className={styles.aggregateMenuDrawerAllMenuColumn}>\r\n {filterList.map(item => (\r\n <div key={item.app.code} className={styles.aggregateMenuDrawerAllMenuColumnItem}>\r\n <div className={styles.aggregateMenuDrawerAllAppTitle}>{item.app.name}</div>\r\n {item.menu.map(menuItem => (menuItem.kind === AppMenuKind.Menu ?\r\n menuItemRender(menuItem)\r\n : <div\r\n key={`${menuItem.appID}-${menuItem.id}`}\r\n className={styles.aggregateMenuDrawerAllMenuItemDir}\r\n >\r\n {menuItem.name}\r\n </div>\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </Drawer>\r\n </>\r\n}\r\n"],"names":["CloseOutlined","DragOutlined","SearchOutlined","StarOutlined","useCallback","useEffect","useState","styles","Drawer","Empty","Input","Space","gql","mutation","paging","query","DndContext","closestCenter","KeyboardSensor","PointerSensor","useSensor","useSensors","arrayMove","SortableContext","useSortable","sortableKeyboardCoordinates","verticalListSortingStrategy","CSS","useLocale","useDark","listFormatTreeData","treeFormatList","OpenWin","AppMenuKind","instanceName","userMenuListQuery","userAppsQuery","userPreferenceQuery","userPreferenceMut","DargItem","props","id","value","appID","setNodeRef","listeners","attributes","transform","transition","style","Transform","toString","div","ref","className","aggregateMenuDrawerMenuItem","onClick","aggregateMenuDrawerMenuItemName","name","aggregateMenuDrawerMenuItemIcons","event","stopPropagation","rev","undefined","onDel","all","setAll","filterList","setFilterList","collects","setCollects","latelys","setLately","locale","isDark","sensors","coordinateGetter","request","appsResult","preferenceResult","UCENTER","apps","data","userApps","forEach","app","push","newAll","i","menuResult","appCode","code","userMenus","menu","sort","d1","d2","d1Sort","displaySort","d2Sort","parentID","key","parentId","orgUserPreference","menuFavorite","menuRecent","collectsList","latelyList","menuItem","find","item","requestFavorite","list","input","map","requestRecent","ids","checkCollect","onClickItem","isOpen","allApp","allItem","oldIdx","findIndex","lately","splice","unshift","menuItemRender","aggregateMenuDrawerAllMenuItem","aggregateMenuDrawerAllMenuItemName","aggregateMenuDrawerAllMenuItemIcons","collectList","filter","c","dataSource","title","maskClosable","placement","width","drawerProps","aggregateMenuDrawer","aggregateMenuDark","open","onClose","onChangeOpen","aggregateMenuDrawerRow","aggregateMenuDrawerMenu","length","collisionDetection","onDragEnd","active","over","items","oldIndex","oItem","newIndex","nItem","strategy","image","PRESENTED_IMAGE_SIMPLE","description","notText","aggregateMenuDrawerAllInput","bordered","prefix","placeholder","searchPlaceholder","onChange","keyword","target","fList","f","fMenuItem","indexOf","aggregateMenuLatelys","aggregateMenuDrawerAllMenuItemDir","latelyTitle","aggregateMenuLatelysColumn","aggregateMenuDrawerAllMenu","height","aggregateMenuDrawerAllMenuColumn","aggregateMenuDrawerAllMenuColumnItem","aggregateMenuDrawerAllAppTitle","kind","Menu"],"mappings":";;;AAAA,SAASA,aAAa,EAAEC,YAAY,EAAEC,cAAc,EAAEC,YAAY,QAAQ,oBAAmB;AAC7F,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AACxD,OAAOC,YAAY,qBAAoB;AACvC,SAASC,MAAM,EAAeC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,OAAO;AAChE,SAASC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gCAAgC;AAC7E,SAASC,UAAU,EAAEC,aAAa,EAAEC,cAAc,EAAEC,aAAa,EAAEC,SAAS,EAAEC,UAAU,QAAS,gBAAgB;AACjH,SAASC,SAAS,EAAEC,eAAe,EAAEC,WAAW,EAAEC,2BAA2B,EAAEC,2BAA2B,QAAQ,oBAAoB;AACtI,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,QAAQ,kBAAY;AACtC,SAASC,OAAO,QAAQ,oBAAc;AACtC,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,iBAAW;AAC9D,SAASC,OAAO,QAAQ,iBAAW;AACnC,SAAuBC,WAAW,QAAgS,2BAA2B;AAC7V,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,MAAMC,oBAAoBvB,IAAI,WAAW,GAAE,CAAC;;;;CAI3C,CAAC;AAEF,MAAMwB,gBAAgBxB,IAAI,WAAW,GAA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AAoB;;kDACzC,KAAC1H;wCAAIE,WAAW/C,OAAOwK,iCAAiC;kDAAGtG,OAAOuG,WAAW;;kDAC7E,KAAC5H;wCAAIE,WAAW/C,OAAO0K,0BAA0B;kDAC9C1G,QAAQ2C,GAAG,CAACN,CAAAA,WACXmB,eAAenB;;;+CAGZ,mBAAK;0CAGhB,KAACxD;gCAAIE,WAAW/C,OAAO2K,0BAA0B;gCAAEjI,OAAO;oCAAEkI,QAAQ5G,QAAQ4E,MAAM,GAAG,uBAAuB,mBAAmB;gCAAC;0CAC9H,cAAA,KAAC/F;oCAAIE,WAAW/C,OAAO6K,gCAAgC;8CACpDjH,WAAW+C,GAAG,CAACJ,CAAAA,qBACd,MAAC1D;4CAAwBE,WAAW/C,OAAO8K,oCAAoC;;8DAC7E,KAACjI;oDAAIE,WAAW/C,OAAO+K,8BAA8B;8DAAGxE,KAAKzB,GAAG,CAAC3B,IAAI;;gDACpEoD,KAAKjB,IAAI,CAACqB,GAAG,CAACN,CAAAA,WAAaA,SAAS2E,IAAI,KAAKtJ,YAAYuJ,IAAI,GAC5DzD,eAAenB,0BACb,KAACxD;wDAEDE,WAAW/C,OAAOwK,iCAAiC;kEAElDnE,SAASlD,IAAI;uDAHT,CAAC,EAAEkD,SAASjE,KAAK,CAAC,CAAC,EAAEiE,SAASnE,EAAE,CAAC,CAAC,CAInC;;2CATAqE,KAAKzB,GAAG,CAACM,IAAI;;;;;;;;;AAmBvC,CAAA,EAAC"}
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\aggregate-menu\\index.tsx"],"sourcesContent":["import { CloseOutlined, DragOutlined, SearchOutlined, StarOutlined } from \"@ant-design/icons\"\r\nimport { useCallback, useEffect, useState } from \"react\"\r\nimport styles from \"./index.module.css\"\r\nimport { Drawer, DrawerProps, Empty, Input, Space } from \"antd\";\r\nimport { gql, mutation, paging, query } from \"@knockout-js/ice-urql/request\";\r\nimport { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors, } from \"@dnd-kit/core\";\r\nimport { arrayMove, SortableContext, useSortable, sortableKeyboardCoordinates, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\r\nimport { CSS } from '@dnd-kit/utilities';\r\nimport { useLocale } from \"../locale\";\r\nimport { useDark } from \"../provider\";\r\nimport { listFormatTreeData, treeFormatList } from \"../_util\";\r\nimport { OpenWin } from \"../icons\";\r\nimport { App, AppMenu, AppMenuKind, LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables, LayoutPkgUserAppListQuery, LayoutPkgUserAppListQueryVariables, LayoutPkgUserMenuListQuery, LayoutPkgUserMenuListQueryVariables, LayoutPkgUserPreferenceQuery, LayoutPkgUserPreferenceQueryVariables } from \"@knockout-js/api/ucenter\";\r\nimport { instanceName } from \"@knockout-js/api\";\r\n\r\nconst userMenuListQuery = gql(/* GraphQL */`query layoutPkgUserMenuList($appCode:String!){\r\n userMenus(appCode: $appCode){\r\n id,name,route,appID,parentID,displaySort,kind\r\n }\r\n}`);\r\n\r\nconst userAppsQuery = gql(/* GraphQL */`query layoutPkgUserAppList{\r\n userApps{\r\n id,name,code\r\n }\r\n}`);\r\n\r\nconst userPreferenceQuery = gql(/* GraphQL */`query layoutPkgUserPreference{\r\n orgUserPreference{\r\n id,menuFavorite,menuRecent,\r\n }\r\n}`);\r\n\r\nconst userPreferenceMut = gql(/* GraphQL */`mutation layoutPkgSaveUserPreference($input:OrgUserPreferenceInput!){\r\n saveOrgUserPreference(input: $input){ id }\r\n}`);\r\n\r\nexport type AggregateMenuLocale = {\r\n title: string;\r\n latelyTitle: string;\r\n notText: string;\r\n searchPlaceholder: string;\r\n}\r\n\r\nexport type AggregateMenuDataSource = {\r\n app: App;\r\n menu: AppMenu[];\r\n}[]\r\n\r\nexport interface AggregateMenuProps {\r\n /**\r\n * 弹出开关\r\n */\r\n open?: boolean;\r\n /**\r\n * 数据源\r\n */\r\n dataSource?: AggregateMenuDataSource;\r\n /**\r\n * 弹框设置\r\n */\r\n drawerProps?: DrawerProps;\r\n /**\r\n * 弹出开关变更\r\n */\r\n onChangeOpen?: (open: boolean) => void;\r\n /**\r\n * 选中菜单\r\n */\r\n onClick?: (menuItem: AppMenu, app: App, isOpen?: boolean) => void;\r\n}\r\n\r\n/**\r\n * 排序拖拽使用的控件\r\n * https://docs.dndkit.com/\r\n * @param props\r\n * @returns\r\n */\r\nconst DargItem = (props: {\r\n value: AppMenu;\r\n onDel: () => void;\r\n onClick: (isOpen?: boolean) => void;\r\n}) => {\r\n const id = `${props.value.id}-${props.value.appID}`;\r\n const { setNodeRef, listeners, attributes, transform, transition } = useSortable({ id });\r\n const style = {\r\n transform: CSS.Transform.toString(transform),\r\n transition,\r\n };\r\n\r\n return <div\r\n ref={setNodeRef}\r\n style={style}\r\n {...attributes}\r\n className={styles.aggregateMenuDrawerMenuItem}\r\n onClick={() => {\r\n props.onClick();\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerMenuItemName}>{props.value.name}</div>\r\n <div className={styles.aggregateMenuDrawerMenuItemIcons}>\r\n <Space>\r\n <OpenWin className=\"anticon\" onClick={(event) => {\r\n event.stopPropagation();\r\n props.onClick(true);\r\n }} />\r\n <CloseOutlined rev={undefined} onClick={(event) => {\r\n event.stopPropagation();\r\n props.onDel();\r\n }} />\r\n <DragOutlined rev={undefined} {...listeners} className=\"dragIcon\" />\r\n </Space>\r\n </div>\r\n </div>\r\n}\r\n\r\nexport default (props: AggregateMenuProps) => {\r\n const [all, setAll] = useState<AggregateMenuDataSource>([]),\r\n [filterList, setFilterList] = useState<AggregateMenuDataSource>([]),\r\n [collects, setCollects] = useState<AppMenu[]>([]),\r\n [latelys, setLately] = useState<AppMenu[]>([]),\r\n locale = useLocale('AggregateMenu'),\r\n isDark = useDark(),\r\n sensors = useSensors(\r\n useSensor(PointerSensor),\r\n useSensor(KeyboardSensor, {\r\n coordinateGetter: sortableKeyboardCoordinates,\r\n })\r\n );\r\n\r\n const\r\n request = useCallback(async () => {\r\n const appsResult = await paging<LayoutPkgUserAppListQuery, LayoutPkgUserAppListQueryVariables>(userAppsQuery, {}, 1, {\r\n instanceName: instanceName.UCENTER,\r\n }), apps: App[] = [];\r\n if (appsResult.data?.userApps) {\r\n appsResult.data.userApps.forEach(app => {\r\n apps.push(app as App)\r\n })\r\n }\r\n const newAll: AggregateMenuDataSource = [];\r\n for (let i in apps) {\r\n const menuResult = await query<LayoutPkgUserMenuListQuery, LayoutPkgUserMenuListQueryVariables>(userMenuListQuery, {\r\n appCode: apps[i].code,\r\n }, { instanceName: instanceName.UCENTER });\r\n if (menuResult.data?.userMenus) {\r\n const menu = menuResult.data.userMenus.sort((d1, d2) => {\r\n const d1Sort = d1.displaySort || 0, d2Sort = d2.displaySort || 0;\r\n return d1.parentID < d2.parentID ? -1 : d1.parentID > d2.parentID ? 1 : d1Sort < d2Sort ? -1 : d1Sort > d2Sort ? 1 : 0;\r\n }) as AppMenu[];\r\n newAll.push({\r\n app: apps[i],\r\n menu: treeFormatList(listFormatTreeData(menu, undefined, { key: 'id', parentId: 'parentID' })),\r\n })\r\n }\r\n }\r\n setAll(newAll);\r\n setFilterList(newAll);\r\n // 初始化收藏和初始化最近数据\r\n const preferenceResult = await query<LayoutPkgUserPreferenceQuery, LayoutPkgUserPreferenceQueryVariables>(userPreferenceQuery, {}, {\r\n instanceName: instanceName.UCENTER\r\n });\r\n if (preferenceResult.data?.orgUserPreference?.id) {\r\n const menuFavorite = preferenceResult.data.orgUserPreference.menuFavorite,\r\n menuRecent = preferenceResult.data.orgUserPreference.menuRecent,\r\n collectsList: AppMenu[] = [],\r\n latelyList: AppMenu[] = [];\r\n if (menuFavorite) {\r\n menuFavorite.forEach(id => {\r\n for (let i in newAll) {\r\n const menuItem = newAll[i].menu.find(item => item.id == id);\r\n if (menuItem) {\r\n collectsList.push(menuItem);\r\n break;\r\n }\r\n }\r\n\r\n })\r\n }\r\n if (menuRecent) {\r\n menuRecent.forEach(id => {\r\n for (let i in newAll) {\r\n const menuItem = newAll[i].menu.find(item => item.id == id);\r\n if (menuItem) {\r\n latelyList.push(menuItem);\r\n break;\r\n }\r\n }\r\n\r\n })\r\n }\r\n setCollects(collectsList);\r\n setLately(latelyList);\r\n }\r\n }, []),\r\n requestFavorite = async (list: AppMenu[]) => {\r\n // 异步存储收藏\r\n await mutation<LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables>(userPreferenceMut, {\r\n input: {\r\n menuFavorite: list.map(item => item.id),\r\n }\r\n }, {\r\n instanceName: instanceName.UCENTER,\r\n });\r\n },\r\n requestRecent = async (ids: string[]) => {\r\n // 异步存储访问菜单记录\r\n await mutation<LayoutPkgSaveUserPreferenceMutation, LayoutPkgSaveUserPreferenceMutationVariables>(userPreferenceMut, {\r\n input: {\r\n menuRecent: ids,\r\n }\r\n }, {\r\n instanceName: instanceName.UCENTER,\r\n });\r\n },\r\n checkCollect = useCallback((menuItem: AppMenu) => {\r\n return !!collects.find(item => item.id === menuItem.id && item.appID === menuItem.appID);\r\n }, [collects]),\r\n onClickItem = async (menuItem: AppMenu, isOpen?: boolean) => {\r\n const allApp = all.find(allItem => allItem.app.id == menuItem.appID);\r\n if (allApp) {\r\n const latelyList = [...latelys];\r\n const oldIdx = latelyList.findIndex(lately => lately.id == menuItem.id);\r\n if (oldIdx > -1) {\r\n latelyList.splice(oldIdx, 1);\r\n }\r\n latelyList.unshift(menuItem);\r\n latelyList.splice(6);\r\n await requestRecent(latelyList.map(item => item.id));\r\n setLately(latelyList);\r\n props.onClick?.(menuItem, allApp.app, isOpen);\r\n }\r\n },\r\n menuItemRender = (menuItem: AppMenu) => {\r\n return <div\r\n key={`${menuItem.id}-${menuItem.appID}`}\r\n className={styles.aggregateMenuDrawerAllMenuItem}\r\n onClick={() => {\r\n onClickItem(menuItem)\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerAllMenuItemName}> {menuItem.name}</div>\r\n <div className={styles.aggregateMenuDrawerAllMenuItemIcons}>\r\n <Space>\r\n <OpenWin className=\"anticon\" onClick={(event) => {\r\n event.stopPropagation();\r\n onClickItem(menuItem, true)\r\n }} />\r\n <StarOutlined rev={undefined} className={checkCollect(menuItem) ? 'collect' : ''} onClick={async (event) => {\r\n event.stopPropagation();\r\n let collectList: AppMenu[] = [];\r\n if (checkCollect(menuItem)) {\r\n collectList = collects.filter(c => !(c.id === menuItem.id && c.appID === menuItem.appID))\r\n } else {\r\n collectList = [...collects, menuItem]\r\n }\r\n await requestFavorite(collectList)\r\n setCollects(collectList);\r\n }} />\r\n </Space>\r\n </div>\r\n </div>\r\n }\r\n\r\n useEffect(() => {\r\n if (props.dataSource) {\r\n setAll(props.dataSource);\r\n setFilterList(props.dataSource);\r\n } else {\r\n request();\r\n }\r\n }, [props.dataSource]);\r\n\r\n return <>\r\n <Drawer\r\n title={locale.title}\r\n maskClosable={false}\r\n placement=\"left\"\r\n width={1060}\r\n {...props.drawerProps}\r\n className={`${styles.aggregateMenuDrawer} ${isDark ? styles.aggregateMenuDark : ''}`}\r\n open={props.open}\r\n onClose={() => {\r\n props.onChangeOpen?.(false);\r\n }}\r\n >\r\n <div className={styles.aggregateMenuDrawerRow}>\r\n <div style={{ width: 240 }} className={styles.aggregateMenuDrawerMenu}>\r\n {/* 收藏 */}\r\n {collects.length ?\r\n <DndContext sensors={sensors}\r\n collisionDetection={closestCenter}\r\n onDragEnd={(event) => {\r\n const { active, over } = event;\r\n if (over && active.id !== over.id) {\r\n setCollects((items) => {\r\n const oldIndex = items.findIndex(oItem => `${oItem.id}-${oItem.appID}` == active.id);\r\n const newIndex = items.findIndex(nItem => `${nItem.id}-${nItem.appID}` == over.id);\r\n const collectList = arrayMove(items, oldIndex, newIndex);\r\n requestFavorite(collectList);\r\n return collectList;\r\n });\r\n }\r\n }}\r\n >\r\n <SortableContext items={collects.map(item => `${item.id}-${item.appID}`)} strategy={verticalListSortingStrategy}>\r\n {\r\n collects.map(item => (<DargItem\r\n key={`c${item.id}-${item.appID}`}\r\n value={item}\r\n onDel={async () => {\r\n const collectList = collects.filter(c => !(c.id === item.id && c.appID === item.appID))\r\n await requestFavorite(collectList);\r\n setCollects(collectList);\r\n }}\r\n onClick={(isOpen) => {\r\n onClickItem(item, isOpen)\r\n }}\r\n />))\r\n }\r\n </SortableContext>\r\n </DndContext>\r\n : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={locale.notText} />\r\n }\r\n </div>\r\n <div style={{ width: 820 }}>\r\n {/* 过滤 */}\r\n <div className={styles.aggregateMenuDrawerAllInput}>\r\n <Input\r\n bordered={false}\r\n prefix={<SearchOutlined rev={undefined} />}\r\n placeholder={locale.searchPlaceholder}\r\n onChange={(event) => {\r\n const keyword = event.target.value;\r\n if (keyword) {\r\n const fList = all.map(f => {\r\n return {\r\n app: f.app,\r\n menu: f.menu.filter(fMenuItem => fMenuItem.name.indexOf(keyword) > -1),\r\n };\r\n }).filter(f => f.menu.length);\r\n setFilterList(fList);\r\n } else {\r\n setFilterList([...all]);\r\n }\r\n }}\r\n />\r\n </div>\r\n {/* 最近访问 */}\r\n {latelys.length ?\r\n <div className={styles.aggregateMenuLatelys}>\r\n <div className={styles.aggregateMenuDrawerAllMenuItemDir}>{locale.latelyTitle}</div>\r\n <div className={styles.aggregateMenuLatelysColumn}>\r\n {latelys.map(menuItem => (\r\n menuItemRender(menuItem)\r\n ))}\r\n </div>\r\n </div> : <></>\r\n }\r\n {/* all应用菜单 */}\r\n <div className={styles.aggregateMenuDrawerAllMenu} style={{ height: latelys.length ? \"calc(100% - 164px)\" : \"calc(100% - 52px)\" }}>\r\n <div className={styles.aggregateMenuDrawerAllMenuColumn}>\r\n {filterList.map(item => (\r\n <div key={item.app.code} className={styles.aggregateMenuDrawerAllMenuColumnItem}>\r\n <div className={styles.aggregateMenuDrawerAllAppTitle}>{item.app.name}</div>\r\n {item.menu.map(menuItem => (menuItem.kind === AppMenuKind.Menu ?\r\n menuItemRender(menuItem)\r\n : <div\r\n key={`${menuItem.appID}-${menuItem.id}`}\r\n className={styles.aggregateMenuDrawerAllMenuItemDir}\r\n >\r\n {menuItem.name}\r\n </div>\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </Drawer>\r\n </>\r\n}\r\n"],"names":["CloseOutlined","DragOutlined","SearchOutlined","StarOutlined","useCallback","useEffect","useState","styles","Drawer","Empty","Input","Space","gql","mutation","paging","query","DndContext","closestCenter","KeyboardSensor","PointerSensor","useSensor","useSensors","arrayMove","SortableContext","useSortable","sortableKeyboardCoordinates","verticalListSortingStrategy","CSS","useLocale","useDark","listFormatTreeData","treeFormatList","OpenWin","AppMenuKind","instanceName","userMenuListQuery","userAppsQuery","userPreferenceQuery","userPreferenceMut","DargItem","props","id","value","appID","setNodeRef","listeners","attributes","transform","transition","style","Transform","toString","div","ref","className","aggregateMenuDrawerMenuItem","onClick","aggregateMenuDrawerMenuItemName","name","aggregateMenuDrawerMenuItemIcons","event","stopPropagation","rev","undefined","onDel","all","setAll","filterList","setFilterList","collects","setCollects","latelys","setLately","locale","isDark","sensors","coordinateGetter","request","appsResult","preferenceResult","UCENTER","apps","data","userApps","forEach","app","push","newAll","i","menuResult","appCode","code","userMenus","menu","sort","d1","d2","d1Sort","displaySort","d2Sort","parentID","key","parentId","orgUserPreference","menuFavorite","menuRecent","collectsList","latelyList","menuItem","find","item","requestFavorite","list","input","map","requestRecent","ids","checkCollect","onClickItem","isOpen","allApp","allItem","oldIdx","findIndex","lately","splice","unshift","menuItemRender","aggregateMenuDrawerAllMenuItem","aggregateMenuDrawerAllMenuItemName","aggregateMenuDrawerAllMenuItemIcons","collectList","filter","c","dataSource","title","maskClosable","placement","width","drawerProps","aggregateMenuDrawer","aggregateMenuDark","open","onClose","onChangeOpen","aggregateMenuDrawerRow","aggregateMenuDrawerMenu","length","collisionDetection","onDragEnd","active","over","items","oldIndex","oItem","newIndex","nItem","strategy","image","PRESENTED_IMAGE_SIMPLE","description","notText","aggregateMenuDrawerAllInput","bordered","prefix","placeholder","searchPlaceholder","onChange","keyword","target","fList","f","fMenuItem","indexOf","aggregateMenuLatelys","aggregateMenuDrawerAllMenuItemDir","latelyTitle","aggregateMenuLatelysColumn","aggregateMenuDrawerAllMenu","height","aggregateMenuDrawerAllMenuColumn","aggregateMenuDrawerAllMenuColumnItem","aggregateMenuDrawerAllAppTitle","kind","Menu"],"mappings":";;;AAAA,SAASA,aAAa,EAAEC,YAAY,EAAEC,cAAc,EAAEC,YAAY,QAAQ,oBAAmB;AAC7F,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AACxD,OAAOC,YAAY,qBAAoB;AACvC,SAASC,MAAM,EAAeC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,OAAO;AAChE,SAASC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gCAAgC;AAC7E,SAASC,UAAU,EAAEC,aAAa,EAAEC,cAAc,EAAEC,aAAa,EAAEC,SAAS,EAAEC,UAAU,QAAS,gBAAgB;AACjH,SAASC,SAAS,EAAEC,eAAe,EAAEC,WAAW,EAAEC,2BAA2B,EAAEC,2BAA2B,QAAQ,oBAAoB;AACtI,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,QAAQ,kBAAY;AACtC,SAASC,OAAO,QAAQ,oBAAc;AACtC,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,iBAAW;AAC9D,SAASC,OAAO,QAAQ,iBAAW;AACnC,SAAuBC,WAAW,QAAgS,2BAA2B;AAC7V,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,MAAMC,oBAAoBvB,IAAI,WAAW,GAAE,CAAC;;;;CAI3C,CAAC;AAEF,MAAMwB,gBAAgBxB,IAAI,WAAW,GAAE,CAAC;;;;CAIvC,CAAC;AAEF,MAAMyB,sBAAsBzB,IAAI,WAAW,GAAE,CAAC;;;;CAI7C,CAAC;AAEF,MAAM0B,oBAAoB1B,IAAI,WAAW,GAAE,CAAC;;CAE3C,CAAC;AAqC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C,OAAOuK,oBAAoB;;kDACzC,KAAC1H;wCAAIE,WAAW/C,OAAOwK,iCAAiC;kDAAGtG,OAAOuG,WAAW;;kDAC7E,KAAC5H;wCAAIE,WAAW/C,OAAO0K,0BAA0B;kDAC9C1G,QAAQ2C,GAAG,CAACN,CAAAA,WACXmB,eAAenB;;;+CAGZ,mBAAK;0CAGhB,KAACxD;gCAAIE,WAAW/C,OAAO2K,0BAA0B;gCAAEjI,OAAO;oCAAEkI,QAAQ5G,QAAQ4E,MAAM,GAAG,uBAAuB,mBAAmB;gCAAC;0CAC9H,cAAA,KAAC/F;oCAAIE,WAAW/C,OAAO6K,gCAAgC;8CACpDjH,WAAW+C,GAAG,CAACJ,CAAAA,qBACd,MAAC1D;4CAAwBE,WAAW/C,OAAO8K,oCAAoC;;8DAC7E,KAACjI;oDAAIE,WAAW/C,OAAO+K,8BAA8B;8DAAGxE,KAAKzB,GAAG,CAAC3B,IAAI;;gDACpEoD,KAAKjB,IAAI,CAACqB,GAAG,CAACN,CAAAA,WAAaA,SAAS2E,IAAI,KAAKtJ,YAAYuJ,IAAI,GAC5DzD,eAAenB,0BACb,KAACxD;wDAEDE,WAAW/C,OAAOwK,iCAAiC;kEAElDnE,SAASlD,IAAI;uDAHT,CAAC,EAAEkD,SAASjE,KAAK,CAAC,CAAC,EAAEiE,SAASnE,EAAE,CAAC,CAAC,CAInC;;2CATAqE,KAAKzB,GAAG,CAACM,IAAI;;;;;;;;;AAmBvC,CAAA,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\aggregate-menu\\locale\\en_US.ts"],"sourcesContent":["import { AggregateMenuLocale } from \"../index\";\r\n\r\nconst locale: AggregateMenuLocale = {\r\n title: 'Application menu',\r\n latelyTitle: \"Recently visited\",\r\n notText: 'The favorites list is empty, you can add your usual addresses to your favorites on the right.',\r\n searchPlaceholder: \"Please enter keyword\",\r\n};\r\n\r\nexport default locale\r\n"],"names":["locale","title","latelyTitle","notText","searchPlaceholder"],"mappings":"AAEA,MAAMA,SAA8B;IAClCC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC,mBAAmB;AACrB;AAEA,eAAeJ,OAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\aggregate-menu\\locale\\zh_CN.ts"],"sourcesContent":["import { AggregateMenuLocale } from \"../index\";\r\n\r\nconst locale: AggregateMenuLocale = {\r\n title: '应用菜单',\r\n latelyTitle: \"最近访问\",\r\n notText: '收藏列表为空,可在右侧将您常用地址添加到收藏。',\r\n searchPlaceholder: \"请输入关键词\",\r\n};\r\n\r\nexport default locale\r\n"],"names":["locale","title","latelyTitle","notText","searchPlaceholder"],"mappings":"AAEA,MAAMA,SAA8B;IAClCC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC,mBAAmB;AACrB;AAEA,eAAeJ,OAAM"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { MenuProps } from 'antd';
|
|
3
2
|
export interface AvatarDropdownLocale {
|
|
4
3
|
logout: string;
|
|
@@ -21,5 +20,5 @@ export interface AvatarDropdownProps {
|
|
|
21
20
|
*/
|
|
22
21
|
onLogoutClick?: () => void;
|
|
23
22
|
}
|
|
24
|
-
declare const AvatarDropdown: (props: AvatarDropdownProps) => JSX.Element;
|
|
23
|
+
declare const AvatarDropdown: (props: AvatarDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
export default AvatarDropdown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\avatar-dropdown\\index.tsx"],"sourcesContent":["import { useCallback } from 'react';\r\nimport { LogoutOutlined, UserOutlined } from '@ant-design/icons';\r\nimport { Dropdown, Avatar, MenuProps } from 'antd';\r\nimport styles from './index.module.css';\r\nimport { useLocale } from '../locale';\r\n\r\nexport interface AvatarDropdownLocale {\r\n logout: string;\r\n}\r\n\r\nexport interface AvatarDropdownProps {\r\n /**\r\n * 用户名\r\n */\r\n name?: string;\r\n /**\r\n * 头像\r\n */\r\n avatar?: string;\r\n /**\r\n * ant的\r\n */\r\n menuProps?: MenuProps;\r\n /**\r\n * 单击退出事件 () => void;\r\n */\r\n onLogoutClick?: () => void;\r\n}\r\n\r\nconst AvatarDropdown = (props: AvatarDropdownProps) => {\r\n const locale = useLocale('AvatarDropdown'),\r\n menu = {\r\n items: [\r\n {\r\n key: 'logout',\r\n label: locale.logout,\r\n icon: <LogoutOutlined rev={undefined} />,\r\n onClick: useCallback(() => {\r\n props.onLogoutClick?.()\r\n }, []),\r\n className: styles.menu,\r\n },\r\n ],\r\n };\r\n\r\n return (\r\n <Dropdown menu={props.menuProps || menu}>\r\n <span className={`${styles.action} ${styles.account}`}>\r\n <Avatar\r\n size=\"small\"\r\n className={styles.avatar}\r\n icon={<UserOutlined rev={undefined} />}\r\n src={props.avatar}\r\n alt=\"avatar\"\r\n />\r\n <span>{props.name}</span>\r\n </span>\r\n </Dropdown>\r\n );\r\n};\r\n\r\nexport default AvatarDropdown;\r\n"],"names":["useCallback","LogoutOutlined","UserOutlined","Dropdown","Avatar","styles","useLocale","AvatarDropdown","props","locale","menu","items","key","label","logout","icon","rev","undefined","onClick","onLogoutClick","className","menuProps","span","action","account","size","avatar","src","alt","name"],"mappings":";AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,cAAc,EAAEC,YAAY,QAAQ,oBAAoB;AACjE,SAASC,QAAQ,EAAEC,MAAM,QAAmB,OAAO;AACnD,OAAOC,YAAY,qBAAqB;AACxC,SAASC,SAAS,QAAQ,kBAAY;AAyBtC,MAAMC,iBAAiB,CAACC,QAA+B;IACrD,MAAMC,SAASH,UAAU,mBACvBI,OAAO;QACLC,OAAO;YACL;gBACEC,KAAK;gBACLC,OAAOJ,OAAOK,MAAM;gBACpBC,oBAAM,KAACd;oBAAee,KAAKC;;gBAC3BC,SAASlB,YAAY,IAAM;wBACzBQ;oBAAAA,CAAAA,uBAAAA,MAAMW,aAAa,cAAnBX,kCAAAA,KAAAA,IAAAA,qBAAAA,KAAAA;gBACF,GAAG,EAAE;gBACLY,WAAWf,OAAOK,IAAI;YACxB;SACD;IACH;IAEF,qBACE,KAACP;QAASO,MAAMF,MAAMa,SAAS,IAAIX;kBACjC,cAAA,MAACY;YAAKF,WAAW,CAAC,EAAEf,OAAOkB,MAAM,CAAC,CAAC,EAAElB,OAAOmB,OAAO,CAAC,CAAC;;8BACnD,KAACpB;oBACCqB,MAAK;oBACLL,WAAWf,OAAOqB,MAAM;oBACxBX,oBAAM,KAACb;wBAAac,KAAKC;;oBACzBU,KAAKnB,MAAMkB,MAAM;oBACjBE,KAAI;;8BAEN,KAACN;8BAAMd,MAAMqB,IAAI;;;;;AAIzB;AAEA,eAAetB,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\avatar-dropdown\\locale\\en_US.ts"],"sourcesContent":["import { AvatarDropdownLocale } from \"../index\";\r\n\r\nconst locale: AvatarDropdownLocale = {\r\n logout: 'logout'\r\n};\r\n\r\nexport default locale\r\n"],"names":["locale","logout"],"mappings":"AAEA,MAAMA,SAA+B;IACnCC,QAAQ;AACV;AAEA,eAAeD,OAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\avatar-dropdown\\locale\\zh_CN.ts"],"sourcesContent":["import { AvatarDropdownLocale } from \"../index\";\r\n\r\nconst locale: AvatarDropdownLocale = {\r\n logout: '退出'\r\n};\r\n\r\nexport default locale\r\n"],"names":["locale","logout"],"mappings":"AAEA,MAAMA,SAA+B;IACnCC,QAAQ;AACV;AAEA,eAAeD,OAAM"}
|
|
@@ -26,5 +26,5 @@ export interface CollectProviderProps {
|
|
|
26
26
|
*/
|
|
27
27
|
children: ReactNode;
|
|
28
28
|
}
|
|
29
|
-
declare const _default: (props: CollectProviderProps) => JSX.Element;
|
|
29
|
+
declare const _default: (props: CollectProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import { ProConfigProvider } from "@ant-design/pro-
|
|
3
|
+
import { ProConfigProvider } from "@ant-design/pro-components";
|
|
4
4
|
import { Provider, LeavePrompt, LocaleType } from "../index";
|
|
5
5
|
import { ConfigProvider } from "antd";
|
|
6
6
|
import { AliveScope } from "react-activation";
|
|
@@ -9,8 +9,11 @@ import enUS from "antd/locale/en_US";
|
|
|
9
9
|
export default ((props)=>{
|
|
10
10
|
const [antLocale, setAntLocale] = useState(zhCN);
|
|
11
11
|
useEffect(()=>{
|
|
12
|
-
if (props.locale === LocaleType.zhCN)
|
|
13
|
-
|
|
12
|
+
if (props.locale === LocaleType.zhCN) {
|
|
13
|
+
setAntLocale(zhCN);
|
|
14
|
+
} else if (props.locale === LocaleType.enUS) {
|
|
15
|
+
setAntLocale(enUS);
|
|
16
|
+
}
|
|
14
17
|
}, [
|
|
15
18
|
props.locale
|
|
16
19
|
]);
|
|
@@ -34,4 +37,4 @@ export default ((props)=>{
|
|
|
34
37
|
});
|
|
35
38
|
});
|
|
36
39
|
|
|
37
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":[".\\src\\components\\collect-providers\\index.tsx"],"sourcesContent":["import { Locale } from \"antd/es/locale\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport { ProConfigProvider } from \"@ant-design/pro-components\";\r\nimport { Provider, LeavePrompt, LocaleType } from \"..\";\r\nimport { ConfigProvider } from \"antd\";\r\nimport { AliveScope } from \"react-activation\";\r\nimport zhCN from 'antd/locale/zh_CN';\r\nimport enUS from 'antd/locale/en_US';\r\nexport interface CollectProviderProps {\r\n /**\r\n * 应用code\r\n */\r\n appCode: string;\r\n /**\r\n * tenantId\r\n */\r\n tenantId: string;\r\n /**\r\n * @knockout-js 的多语言 locale\r\n */\r\n locale: LocaleType;\r\n /**\r\n * ProConfig dark主题\r\n */\r\n dark: boolean;\r\n /**\r\n * 传递动态的 location.pathname\r\n */\r\n pathname: string;\r\n /**\r\n * 默认插槽\r\n */\r\n children: ReactNode;\r\n}\r\n\r\nexport default (props: CollectProviderProps) => {\r\n\r\n const [antLocale, setAntLocale] = useState<Locale>(zhCN);\r\n\r\n useEffect(() => {\r\n if (props.locale === LocaleType.zhCN) {\r\n setAntLocale(zhCN)\r\n } else if (props.locale === LocaleType.enUS) {\r\n setAntLocale(enUS)\r\n }\r\n }, [props.locale]);\r\n\r\n return (\r\n <ProConfigProvider dark={props.dark}>\r\n <Provider locale={props.locale} appCode={props.appCode} tenantId={props.tenantId} dark={props.dark}>\r\n <ConfigProvider locale={antLocale}>\r\n <LeavePrompt pathname={props.pathname}>\r\n <AliveScope>\r\n {props.children}\r\n </AliveScope>\r\n </LeavePrompt>\r\n </ConfigProvider>\r\n </Provider>\r\n </ProConfigProvider >\r\n )\r\n}\r\n"],"names":["useEffect","useState","ProConfigProvider","Provider","LeavePrompt","LocaleType","ConfigProvider","AliveScope","zhCN","enUS","props","antLocale","setAntLocale","locale","dark","appCode","tenantId","pathname","children"],"mappings":";AACA,SAAoBA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AACvD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAASC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ,WAAK;AACvD,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,OAAOC,UAAU,oBAAoB;AACrC,OAAOC,UAAU,oBAAoB;AA4BrC,eAAe,CAAA,CAACC,QAAgC;IAE9C,MAAM,CAACC,WAAWC,aAAa,GAAGX,SAAiBO;IAEnDR,UAAU,IAAM;QACd,IAAIU,MAAMG,MAAM,KAAKR,WAAWG,IAAI,EAAE;YACpCI,aAAaJ;QACf,OAAO,IAAIE,MAAMG,MAAM,KAAKR,WAAWI,IAAI,EAAE;YAC3CG,aAAaH;QACf,CAAC;IACH,GAAG;QAACC,MAAMG,MAAM;KAAC;IAEjB,qBACE,KAACX;QAAkBY,MAAMJ,MAAMI,IAAI;kBACjC,cAAA,KAACX;YAASU,QAAQH,MAAMG,MAAM;YAAEE,SAASL,MAAMK,OAAO;YAAEC,UAAUN,MAAMM,QAAQ;YAAEF,MAAMJ,MAAMI,IAAI;sBAChG,cAAA,KAACR;gBAAeO,QAAQF;0BACtB,cAAA,KAACP;oBAAYa,UAAUP,MAAMO,QAAQ;8BACnC,cAAA,KAACV;kCACEG,MAAMQ,QAAQ;;;;;;AAO7B,CAAA,EAAC"}
|