win-chart 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/.eslintrc.json +3 -0
  2. package/.prettierrc.json +5 -0
  3. package/README.md +0 -0
  4. package/localhost-key.pem +28 -0
  5. package/localhost.pem +25 -0
  6. package/package.json +65 -0
  7. package/rsbuild.config.ts +48 -0
  8. package/src/api/README.md +15 -0
  9. package/src/api/index.js +5 -0
  10. package/src/api/layout/index.js +32 -0
  11. package/src/api/request.ts +87 -0
  12. package/src/api/url-map/index.js +10 -0
  13. package/src/api/user/index.js +12 -0
  14. package/src/components/FilterContext.tsx +6 -0
  15. package/src/components/GlobalStyle.tsx +25 -0
  16. package/src/components/HalfScreenBrowser.tsx +95 -0
  17. package/src/components/ImgBox.tsx +19 -0
  18. package/src/components/JumpBtn.tsx +38 -0
  19. package/src/components/MCardWrapper.tsx +33 -0
  20. package/src/components/NoContent/index.tsx +85 -0
  21. package/src/components/ResponsiveReactGridLayout.tsx +218 -0
  22. package/src/components/SliderDecoration.tsx +27 -0
  23. package/src/components/VisionUserConfigContext.ts +6 -0
  24. package/src/components/WinMenu/README.md +11 -0
  25. package/src/components/WinMenu/WinHeader.tsx +5 -0
  26. package/src/components/WinMenu/components/ExtraBox.tsx +61 -0
  27. package/src/components/WinMenu/components/FullMenuBox.tsx +80 -0
  28. package/src/components/WinMenu/components/FullMenuContainer.tsx +50 -0
  29. package/src/components/WinMenu/components/FullMenuItem.tsx +128 -0
  30. package/src/components/WinMenu/components/LangSwitch.tsx +84 -0
  31. package/src/components/WinMenu/components/LogoBox.tsx +29 -0
  32. package/src/components/WinMenu/components/PinDialog.tsx +72 -0
  33. package/src/components/WinMenu/components/PinnedMenuBox.tsx +183 -0
  34. package/src/components/WinMenu/components/UserBox.tsx +83 -0
  35. package/src/components/WinMenu/hooks/useUserInfo.ts +21 -0
  36. package/src/components/WinMenu/hooks/useUserMenu.ts +35 -0
  37. package/src/components/WinMenu/index.tsx +100 -0
  38. package/src/components/WinMenu/services/WinService.ts +79 -0
  39. package/src/components/WinMenu/services/request.ts +53 -0
  40. package/src/components/WinMenu/utils/const.ts +80 -0
  41. package/src/components/WinMenu/utils/enum.ts +19 -0
  42. package/src/components/WinMenu/utils/interface.ts +61 -0
  43. package/src/components/WinMenu/utils/map.ts +39 -0
  44. package/src/components/WinMenu/utils/tool.ts +142 -0
  45. package/src/components/WinMenu/utils/type.ts +1 -0
  46. package/src/components/hover-view.tsx +48 -0
  47. package/src/components/icon.tsx +44 -0
  48. package/src/components/indicator-remark.tsx +25 -0
  49. package/src/components/none-content.tsx +93 -0
  50. package/src/components/panel-tab.tsx +150 -0
  51. package/src/components/panel-title-tab.tsx +60 -0
  52. package/src/components/win-card/components/ChartContent.tsx +47 -0
  53. package/src/components/win-card/components/Indicator.tsx +42 -0
  54. package/src/components/win-card/components/IndicatorArea.tsx +63 -0
  55. package/src/components/win-card/components/IndicatorInfo.tsx +78 -0
  56. package/src/components/win-card/components/MatterContent.tsx +121 -0
  57. package/src/components/win-card/components/MatterList.tsx +141 -0
  58. package/src/components/win-card/components/NoticeContent.tsx +73 -0
  59. package/src/components/win-card/components/NoticeList.tsx +68 -0
  60. package/src/components/win-card/components/SelectDecoration.tsx +34 -0
  61. package/src/components/win-card/components/WinRankContent.tsx +102 -0
  62. package/src/components/win-card/index.tsx +298 -0
  63. package/src/components/win-card/utils/interface.ts +12 -0
  64. package/src/components/win-card/utils/tool.ts +11 -0
  65. package/src/components/win-card-mobile/components/ChartContent.tsx +47 -0
  66. package/src/components/win-card-mobile/components/DualLineBar.tsx +61 -0
  67. package/src/components/win-card-mobile/components/Indicator.tsx +42 -0
  68. package/src/components/win-card-mobile/components/IndicatorArea.tsx +65 -0
  69. package/src/components/win-card-mobile/components/IndicatorInfo.tsx +83 -0
  70. package/src/components/win-card-mobile/components/SelectDecoration.tsx +28 -0
  71. package/src/components/win-card-mobile/index.tsx +235 -0
  72. package/src/components/win-card-mobile/utils/interface.ts +12 -0
  73. package/src/components/win-card-mobile/utils/tool.ts +9 -0
  74. package/src/components/win-chart/components/chart-wrapper.tsx +5 -0
  75. package/src/components/win-chart/index.tsx +59 -0
  76. package/src/components/win-chart/theme/win-dark.json +372 -0
  77. package/src/components/win-chart/theme/win-light.json +372 -0
  78. package/src/components/win-chart/utils/const.ts +37 -0
  79. package/src/components/win-chart/utils/getAreaSpec.ts +150 -0
  80. package/src/components/win-chart/utils/getBarSpec.ts +60 -0
  81. package/src/components/win-chart/utils/getChartOptions.ts +59 -0
  82. package/src/components/win-chart/utils/getColumnSpec.ts +112 -0
  83. package/src/components/win-chart/utils/getDualSpec.ts +79 -0
  84. package/src/components/win-chart/utils/getFunnelSpec.ts +70 -0
  85. package/src/components/win-chart/utils/getLineSpec.ts +53 -0
  86. package/src/components/win-chart/utils/getPieSpec.ts +124 -0
  87. package/src/components/win-chart/utils/getRadarSpec.ts +87 -0
  88. package/src/components/win-chart/utils/tool.ts +163 -0
  89. package/src/components/win-chart/utils/type.ts +96 -0
  90. package/src/components/win-icon/index.tsx +97 -0
  91. package/src/components/win-v/components/EmptyBox.tsx +9 -0
  92. package/src/components/win-v/components/VDialog.tsx +173 -0
  93. package/src/components/win-v/components/VDialogBtn.tsx +119 -0
  94. package/src/components/win-v/components/VDialogMsg.tsx +325 -0
  95. package/src/components/win-v/components/VInput.tsx +15 -0
  96. package/src/components/win-v/components/VRemindMsgList.tsx +303 -0
  97. package/src/components/win-v/components/VRobot.tsx +97 -0
  98. package/src/components/win-v/hooks/useVDialogCore.ts +102 -0
  99. package/src/components/win-v/hooks/useVDialogOperate.ts +132 -0
  100. package/src/components/win-v/hooks/useVDialogState.ts +52 -0
  101. package/src/components/win-v/hooks/useVRemindMsgShow.ts +15 -0
  102. package/src/components/win-v/index.tsx +205 -0
  103. package/src/components/win-wrappers/card-wrapper.tsx +103 -0
  104. package/src/components/win-wrappers/dot-wrapper.tsx +18 -0
  105. package/src/components/win-wrappers/iframe-wrapper.tsx +7 -0
  106. package/src/components/win-wrappers/request-wrapper.tsx +190 -0
  107. package/src/global.d.ts +53 -0
  108. package/src/hooks/useCardOptionList.ts +23 -0
  109. package/src/hooks/useCostFiltersDicList.ts +22 -0
  110. package/src/hooks/useFbiUrl.ts +22 -0
  111. package/src/hooks/useHalfScreenState.ts +50 -0
  112. package/src/hooks/useHasIntersected.ts +36 -0
  113. package/src/hooks/useIndicatorCardInfo.ts +26 -0
  114. package/src/hooks/useIndicatorCardQueryList.ts +22 -0
  115. package/src/hooks/useIndicatorClassifyList.ts +25 -0
  116. package/src/hooks/useIndicatorDetailsDateList.ts +22 -0
  117. package/src/hooks/useIndicatorDetailsInfo.ts +49 -0
  118. package/src/hooks/useIndicatorDetailsTrend.ts +25 -0
  119. package/src/hooks/useIndicatorDicList.ts +22 -0
  120. package/src/hooks/useIndicatorLabelList.ts +20 -0
  121. package/src/hooks/useIndicatorList.ts +24 -0
  122. package/src/hooks/useIndicatorRangeList.ts +20 -0
  123. package/src/hooks/useIndicatorTypeList.ts +20 -0
  124. package/src/hooks/useIndicatorUnitList.ts +21 -0
  125. package/src/hooks/useListenQuery.ts +29 -0
  126. package/src/hooks/useMobile.ts +58 -0
  127. package/src/hooks/useNotice.ts +42 -0
  128. package/src/hooks/useOrgLevelList.ts +23 -0
  129. package/src/hooks/usePageSelection.ts +121 -0
  130. package/src/hooks/usePageState.ts +22 -0
  131. package/src/hooks/usePendingList.ts +27 -0
  132. package/src/hooks/usePortalPageInfo.ts +43 -0
  133. package/src/hooks/useRefreshByLocationChange.ts +16 -0
  134. package/src/hooks/useReportIndicatorList.ts +21 -0
  135. package/src/hooks/useReportInfo.ts +45 -0
  136. package/src/hooks/useReportPersonList.ts +21 -0
  137. package/src/hooks/useScriptLoader.ts +22 -0
  138. package/src/hooks/useUnreadMsgList.ts +26 -0
  139. package/src/hooks/useUserAvatar.ts +23 -0
  140. package/src/hooks/useVReportInfo.ts +50 -0
  141. package/src/hooks/useVisionUserConfig.ts +25 -0
  142. package/src/hooks/useWorkbenchOptions.ts +63 -0
  143. package/src/index.tsx +20 -0
  144. package/src/services/CardService.ts +91 -0
  145. package/src/services/CommonService.ts +23 -0
  146. package/src/services/CostService.ts +56 -0
  147. package/src/services/DialogService.ts +74 -0
  148. package/src/services/IndicatorService.ts +406 -0
  149. package/src/services/PageService.ts +204 -0
  150. package/src/services/ReportService.ts +335 -0
  151. package/src/services/WorkbenchService.ts +411 -0
  152. package/src/styles/README.md +12 -0
  153. package/src/styles/index.scss +9 -0
  154. package/src/styles/mixins/index.scss +25 -0
  155. package/src/styles/next-cover.scss +4 -0
  156. package/src/styles/normalize.scss +27 -0
  157. package/src/styles/utilities/index.scss +5 -0
  158. package/src/styles/vars/index.scss +17 -0
  159. package/src/types/enum-workbench.ts +29 -0
  160. package/src/types/enum.ts +156 -0
  161. package/src/types/index.ts +19 -0
  162. package/src/types/indicator.ts +299 -0
  163. package/src/types/interface.ts +303 -0
  164. package/src/types/portal.ts +211 -0
  165. package/src/types/report.ts +28 -0
  166. package/src/types/type.ts +11 -0
  167. package/src/types/user.ts +28 -0
  168. package/src/utils/README.md +4 -0
  169. package/src/utils/arms.ts +59 -0
  170. package/src/utils/arr.ts +123 -0
  171. package/src/utils/const-workbench.ts +9 -0
  172. package/src/utils/const.ts +18 -0
  173. package/src/utils/index.ts +18 -0
  174. package/src/utils/init.ts +5 -0
  175. package/src/utils/map-workbench.ts +66 -0
  176. package/src/utils/map.ts +377 -0
  177. package/src/utils/number.ts +101 -0
  178. package/src/utils/page.ts +81 -0
  179. package/src/utils/str.ts +26 -0
  180. package/src/utils/tools.ts +44 -0
  181. package/src/utils/tree.ts +145 -0
  182. package/src/utils/url.ts +40 -0
  183. package/src/utils/util.ts +99 -0
  184. package/src/utils/workbench.ts +25 -0
  185. package/tsconfig.json +33 -0
@@ -0,0 +1,218 @@
1
+ import { styled } from 'styled-components';
2
+ import { WidthProvider, Responsive, ResponsiveProps } from 'react-grid-layout';
3
+
4
+ export type { ResponsiveProps };
5
+
6
+ export const ResponsiveReactGridLayout = styled(WidthProvider(Responsive))`
7
+ position: relative;
8
+
9
+ .react-grid-layout {
10
+ position: relative;
11
+ transition: height 200ms ease;
12
+ }
13
+
14
+ .react-grid-item {
15
+ transition: all 200ms ease;
16
+ transition-property: left, top, width, height;
17
+ }
18
+
19
+ .react-grid-item img {
20
+ pointer-events: none;
21
+ user-select: none;
22
+ }
23
+
24
+ .react-grid-item.cssTransforms {
25
+ transition-property: transform, width, height;
26
+ }
27
+
28
+ .react-grid-item.resizing {
29
+ transition: none;
30
+ z-index: 1;
31
+ will-change: width, height;
32
+ }
33
+
34
+ .react-grid-item.react-draggable-dragging {
35
+ transition: none;
36
+ z-index: 3;
37
+ will-change: transform;
38
+ }
39
+
40
+ .react-grid-item.dropping {
41
+ visibility: hidden;
42
+ }
43
+
44
+ .react-grid-item.react-grid-placeholder {
45
+ background: red;
46
+ opacity: 0.2;
47
+ transition-duration: 100ms;
48
+ z-index: 2;
49
+ -webkit-user-select: none;
50
+ -moz-user-select: none;
51
+ -ms-user-select: none;
52
+ -o-user-select: none;
53
+ user-select: none;
54
+ }
55
+
56
+ .react-grid-item.react-grid-placeholder.placeholder-resizing {
57
+ transition: none;
58
+ }
59
+
60
+ .react-grid-item > .react-resizable-handle {
61
+ position: absolute;
62
+ width: 20px;
63
+ height: 20px;
64
+ }
65
+
66
+ .react-grid-item > .react-resizable-handle::after {
67
+ content: '';
68
+ position: absolute;
69
+ right: 3px;
70
+ bottom: 3px;
71
+ width: 5px;
72
+ height: 5px;
73
+ border-right: 2px solid rgba(0, 0, 0, 0.4);
74
+ border-bottom: 2px solid rgba(0, 0, 0, 0.4);
75
+ }
76
+
77
+ .react-resizable-hide > .react-resizable-handle {
78
+ display: none;
79
+ }
80
+
81
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
82
+ bottom: 0;
83
+ left: 0;
84
+ cursor: sw-resize;
85
+ transform: rotate(90deg);
86
+ }
87
+
88
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-se {
89
+ bottom: 0;
90
+ right: 0;
91
+ cursor: se-resize;
92
+ }
93
+
94
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
95
+ top: 0;
96
+ left: 0;
97
+ cursor: nw-resize;
98
+ transform: rotate(180deg);
99
+ }
100
+
101
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
102
+ top: 0;
103
+ right: 0;
104
+ cursor: ne-resize;
105
+ transform: rotate(270deg);
106
+ }
107
+
108
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-w,
109
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
110
+ top: 50%;
111
+ margin-top: -10px;
112
+ cursor: ew-resize;
113
+ }
114
+
115
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-w {
116
+ left: 0;
117
+ transform: rotate(135deg);
118
+ }
119
+
120
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
121
+ right: 0;
122
+ transform: rotate(315deg);
123
+ }
124
+
125
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-n,
126
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
127
+ left: 50%;
128
+ margin-left: -10px;
129
+ cursor: ns-resize;
130
+ }
131
+
132
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-n {
133
+ top: 0;
134
+ transform: rotate(225deg);
135
+ }
136
+
137
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
138
+ bottom: 0;
139
+ transform: rotate(45deg);
140
+ }
141
+
142
+ .react-resizable {
143
+ position: relative;
144
+ }
145
+
146
+ .react-resizable-handle {
147
+ position: absolute;
148
+ width: 20px;
149
+ height: 20px;
150
+ background-repeat: no-repeat;
151
+ background-origin: content-box;
152
+ box-sizing: border-box;
153
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+');
154
+ background-position: bottom right;
155
+ padding: 0 3px 3px 0;
156
+ }
157
+
158
+ .react-resizable-handle-sw {
159
+ bottom: 0;
160
+ left: 0;
161
+ cursor: sw-resize;
162
+ transform: rotate(90deg);
163
+ }
164
+
165
+ .react-resizable-handle-se {
166
+ bottom: 0;
167
+ right: 0;
168
+ cursor: se-resize;
169
+ }
170
+
171
+ .react-resizable-handle-nw {
172
+ top: 0;
173
+ left: 0;
174
+ cursor: nw-resize;
175
+ transform: rotate(180deg);
176
+ }
177
+
178
+ .react-resizable-handle-ne {
179
+ top: 0;
180
+ right: 0;
181
+ cursor: ne-resize;
182
+ transform: rotate(270deg);
183
+ }
184
+
185
+ .react-resizable-handle-w,
186
+ .react-resizable-handle-e {
187
+ top: 50%;
188
+ margin-top: -10px;
189
+ cursor: ew-resize;
190
+ }
191
+
192
+ .react-resizable-handle-w {
193
+ left: 0;
194
+ transform: rotate(135deg);
195
+ }
196
+
197
+ .react-resizable-handle-e {
198
+ right: 0;
199
+ transform: rotate(315deg);
200
+ }
201
+
202
+ .react-resizable-handle-n,
203
+ .react-resizable-handle-s {
204
+ left: 50%;
205
+ margin-left: -10px;
206
+ cursor: ns-resize;
207
+ }
208
+
209
+ .react-resizable-handle-n {
210
+ top: 0;
211
+ transform: rotate(225deg);
212
+ }
213
+
214
+ .react-resizable-handle-s {
215
+ bottom: 0;
216
+ transform: rotate(45deg);
217
+ }
218
+ `;
@@ -0,0 +1,27 @@
1
+ import { Slider } from '@cainiaofe/cn-ui';
2
+ import { rgba } from 'polished';
3
+ import { css, styled } from 'styled-components';
4
+
5
+ export const SliderDecoration = styled(Slider).attrs({
6
+ pauseOnHover: true,
7
+ autoplay: true,
8
+ autoplaySpeed: 5000,
9
+ arrows: false,
10
+ dotsRender: (index, current) => <Dot checked={index === current} />,
11
+ })``;
12
+
13
+ const Dot = styled.span<{ checked?: boolean }>`
14
+ display: inline-block;
15
+ width: 6px;
16
+ height: 6px;
17
+ border-radius: 500px;
18
+ background-color: ${rgba('#828c9e', 0.5)};
19
+ transform: translateY(32px);
20
+
21
+ ${({ checked }) =>
22
+ checked &&
23
+ css`
24
+ width: 18px;
25
+ background-color: #828c9e;
26
+ `}
27
+ `;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { IVisionUserConfig } from 'src/types';
3
+
4
+ export const VisionUserConfigContext = React.createContext<
5
+ IVisionUserConfig | undefined
6
+ >(undefined);
@@ -0,0 +1,11 @@
1
+ # 更新日志
2
+
3
+ ## 231013
4
+
5
+ 1. 根据地址判定请求参数
6
+ 2. 未登入 Query 失效修复
7
+
8
+ ## 231017
9
+
10
+ 1. 幻视获取全路径
11
+ 2. 更改查询菜单统一入参
@@ -0,0 +1,5 @@
1
+ import { IKeyValueItem } from '@/types';
2
+ import Header from '@alife/dwork-cnstr-header';
3
+ import { styled } from 'styled-components';
4
+
5
+ export const WinHeader = styled(Header)<IKeyValueItem>``;
@@ -0,0 +1,61 @@
1
+ import { styled } from 'styled-components';
2
+ import { LangSwitch } from './LangSwitch';
3
+ import { CnBox, CnTooltip } from '@cainiaofe/cn-ui';
4
+ import { IMenuItem } from '../utils/interface';
5
+ import { getHandleOpenLink, menuTreeFind } from '../utils/tool';
6
+ import { RELATED_SYSTEM_LOGO } from '../utils/const';
7
+
8
+ interface IProps {
9
+ data?: IMenuItem[];
10
+ downloadCenterUrl?: string;
11
+ }
12
+
13
+ export const ExtraBox = ({ data = [], downloadCenterUrl }: IProps) => {
14
+ const curItem = menuTreeFind(
15
+ data,
16
+ (item) => !!item.menuUrl && location.href.includes(item.menuUrl),
17
+ );
18
+
19
+ return (
20
+ <CnBox direction='row' spacing={16} align='center'>
21
+ {!!curItem?.docName && (
22
+ <CnTooltip
23
+ trigger={
24
+ <img
25
+ alt=''
26
+ src={RELATED_SYSTEM_LOGO}
27
+ onClick={getHandleOpenLink(curItem.docUrl)}
28
+ style={{
29
+ margin: '0 8px',
30
+ cursor: 'pointer',
31
+ display: 'inline-block',
32
+ width: 20,
33
+ height: 20,
34
+ objectFit: 'contain',
35
+ }}
36
+ />
37
+ }
38
+ align='br'
39
+ popupStyle={{
40
+ marginTop: 20,
41
+ }}
42
+ >
43
+ {curItem.docName}
44
+ </CnTooltip>
45
+ )}
46
+ {downloadCenterUrl && (
47
+ <MainLinkItem onClick={getHandleOpenLink(downloadCenterUrl)}>
48
+ 下载中心
49
+ </MainLinkItem>
50
+ )}
51
+ <LangSwitch />
52
+ </CnBox>
53
+ );
54
+ };
55
+
56
+ const MainLinkItem = styled.div`
57
+ width: 70px;
58
+ font-size: 16px;
59
+ color: #fff;
60
+ cursor: pointer;
61
+ `;
@@ -0,0 +1,80 @@
1
+ import { CnIcon, CnPopup, CnTooltip } from '@cainiaofe/cn-ui';
2
+ import { IWinHeaderProps } from '../utils/interface';
3
+ import { FullMenuContainer } from './FullMenuContainer';
4
+ import { GLOBAL_MENU_TITLE } from '../utils/const';
5
+ import { rgba } from 'polished';
6
+ import { styled } from 'styled-components';
7
+ import { checkEntityArr } from '../utils/tool';
8
+
9
+ export const FullMenuBox = ({ data, onPinned }: IWinHeaderProps) => {
10
+ return (
11
+ <CnPopup
12
+ trigger={
13
+ <div
14
+ style={{
15
+ zIndex: 1000,
16
+ transform: 'translateY(2px)',
17
+ }}
18
+ >
19
+ <CnTooltip
20
+ trigger={
21
+ <CnIcon
22
+ type='hamburger'
23
+ color='#fff'
24
+ size='large'
25
+ style={{
26
+ cursor: 'pointer',
27
+ }}
28
+ />
29
+ }
30
+ align='br'
31
+ popupStyle={{
32
+ marginTop: 20,
33
+ }}
34
+ >
35
+ {GLOBAL_MENU_TITLE}
36
+ </CnTooltip>
37
+ </div>
38
+ }
39
+ triggerType='click'
40
+ align='tl bl'
41
+ followTrigger
42
+ >
43
+ {checkEntityArr(data) && (
44
+ <FullMenuWrapper>
45
+ <div className='menu-title'>
46
+ <h3>{GLOBAL_MENU_TITLE}</h3>
47
+ </div>
48
+ <div className='menu-list'>
49
+ <FullMenuContainer data={data} onPinned={onPinned} />
50
+ </div>
51
+ </FullMenuWrapper>
52
+ )}
53
+ </CnPopup>
54
+ );
55
+ };
56
+
57
+ const FullMenuWrapper = styled.div`
58
+ left: -20px !important;
59
+ top: -40px !important;
60
+ z-index: 998 !important;
61
+ background-color: #fff;
62
+ box-shadow: 0 8px 16px 0 ${rgba('#272e3a', 0.2)};
63
+
64
+ .menu-title {
65
+ padding: 17px 24px 18px;
66
+ font-size: 20px;
67
+ color: #272e3a;
68
+
69
+ h3 {
70
+ margin: 0;
71
+ font-weight: 500;
72
+ }
73
+ }
74
+
75
+ .menu-list {
76
+ box-shadow: 0 -1px 0 0 #e2e5eb;
77
+ max-height: calc(100vh - 130px);
78
+ overflow: auto;
79
+ }
80
+ `;
@@ -0,0 +1,50 @@
1
+ import { useState } from 'react';
2
+ import { Grid } from '@cainiaofe/cn-ui';
3
+ import { FullMenuItem } from './FullMenuItem';
4
+ import { IWinHeaderProps } from '../utils/interface';
5
+ import { checkEntityArr } from '../utils/tool';
6
+
7
+ export function FullMenuContainer({ data = [], onPinned }: IWinHeaderProps) {
8
+ const [active, setActive] = useState<string>();
9
+
10
+ return (
11
+ <Grid.Row>
12
+ <div
13
+ style={{
14
+ boxShadow: '-1px 0 0 0 #e2e5eb',
15
+ }}
16
+ >
17
+ {data.map((item) => {
18
+ return (
19
+ <div
20
+ key={item.menuCode}
21
+ onMouseOver={() => {
22
+ setActive(item.menuCode);
23
+ }}
24
+ >
25
+ <FullMenuItem
26
+ itemInfo={item}
27
+ isSelect={active === item.menuCode}
28
+ onPinned={onPinned}
29
+ />
30
+ </div>
31
+ );
32
+ })}
33
+ </div>
34
+ <Grid.Row>
35
+ {data.map((item) => {
36
+ return (
37
+ active === item.menuCode &&
38
+ checkEntityArr(item.children) && (
39
+ <FullMenuContainer
40
+ key={item.menuCode}
41
+ data={item.children}
42
+ onPinned={onPinned}
43
+ />
44
+ )
45
+ );
46
+ })}
47
+ </Grid.Row>
48
+ </Grid.Row>
49
+ );
50
+ }
@@ -0,0 +1,128 @@
1
+ import { Box } from '@cainiaofe/cn-ui';
2
+ import { styled } from 'styled-components';
3
+ import { noSelectImg, selectImg } from '../utils/const';
4
+ import { IMenuItem, IWinHeaderProps } from '../utils/interface';
5
+ import { checkCurLink, checkEntityArr, getHandleJump } from '../utils/tool';
6
+
7
+ interface IProps extends IWinHeaderProps {
8
+ isSelect: boolean;
9
+ itemInfo: IMenuItem;
10
+ }
11
+
12
+ export function FullMenuItem({ isSelect, itemInfo, onPinned }: IProps) {
13
+ const isCurLink =
14
+ !checkEntityArr(itemInfo.children) && checkCurLink(itemInfo);
15
+
16
+ return (
17
+ <BoxDecoration
18
+ direction='row'
19
+ style={{
20
+ backgroundColor: isSelect ? '#f7f8fa' : 'transparent',
21
+ }}
22
+ >
23
+ <Box justify='center' className='text' onClick={getHandleJump(itemInfo)}>
24
+ <span
25
+ className='menu-item-text'
26
+ style={{
27
+ color: isSelect || isCurLink ? '#3076FC' : '#394252',
28
+ }}
29
+ >
30
+ {itemInfo.menuTitle}
31
+ </span>
32
+ </Box>
33
+ {(checkEntityArr(itemInfo.children) || itemInfo.pinned) && (
34
+ <Box
35
+ className='no-select'
36
+ justify='center'
37
+ style={{
38
+ marginLeft: 20,
39
+ }}
40
+ >
41
+ <div
42
+ style={{
43
+ cursor: 'pointer',
44
+ }}
45
+ onClick={(e) => {
46
+ e.stopPropagation();
47
+ onPinned?.(itemInfo);
48
+ }}
49
+ >
50
+ <img
51
+ src={itemInfo.pinned ? selectImg : noSelectImg}
52
+ alt='tackSelect'
53
+ />
54
+ </div>
55
+ </Box>
56
+ )}
57
+ <Box
58
+ style={{
59
+ marginLeft: 32,
60
+ }}
61
+ justify='center'
62
+ >
63
+ <div
64
+ className='iconRight'
65
+ style={{
66
+ borderColor: isSelect ? '#3076FC' : '#394252',
67
+ opacity: checkEntityArr(itemInfo.children) ? 1 : 0,
68
+ }}
69
+ />
70
+ </Box>
71
+ </BoxDecoration>
72
+ );
73
+ }
74
+
75
+ const BoxDecoration = styled(Box)`
76
+ min-width: 240px;
77
+ height: 44px;
78
+ padding: 0 20px 0 25px;
79
+ transition: all 0.2s;
80
+ cursor: pointer;
81
+
82
+ & > div:first-child {
83
+ max-width: 180px;
84
+ overflow: hidden;
85
+ text-overflow: ellipsis;
86
+ white-space: nowrap;
87
+ }
88
+
89
+ &:hover {
90
+ background-color: #f7f8fa;
91
+ }
92
+
93
+ &:hover .text span {
94
+ color: #3076fc !important;
95
+ }
96
+
97
+ &:hover .iconRight {
98
+ border-color: #3076fc !important;
99
+ }
100
+
101
+ .menu-item-icon {
102
+ span {
103
+ background: rgb(129, 140, 161);
104
+ height: 16px;
105
+ line-height: 16px;
106
+ color: #fff;
107
+ }
108
+ }
109
+
110
+ .menu-item-text {
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ overflow: hidden;
114
+ }
115
+
116
+ .iconRight {
117
+ width: 8px;
118
+ height: 8px;
119
+ transform: rotateZ(45deg);
120
+ border-right: 1px solid;
121
+ border-top: 1px solid;
122
+ }
123
+
124
+ .text {
125
+ flex: 1;
126
+ padding-left: 4px;
127
+ }
128
+ `;
@@ -0,0 +1,84 @@
1
+ import { Box, CnCard, CnIcon, Icon } from '@cainiaofe/cn-ui';
2
+ import { styled } from 'styled-components';
3
+ import $i18n from 'panda-i18n';
4
+ import { langList } from '../utils/map';
5
+ import { THEME } from '../utils/const';
6
+ import { getListLabelByValue } from '../utils/tool';
7
+ import { WinLanguage } from '../utils/type';
8
+
9
+ const lang = $i18n.getLang();
10
+ const handleSetLang = (lang: WinLanguage) => {
11
+ $i18n.setLang(lang);
12
+ location.reload();
13
+ };
14
+
15
+ export const LangSwitch = () => {
16
+ return (
17
+ <Wrapper>
18
+ <Box direction="row" align="center" spacing={4}>
19
+ {/* <IconBox src={LANG_LOGO} size={16} /> */}
20
+ <div>
21
+ <span data-lang-label>{getListLabelByValue(langList, lang)}</span>
22
+ <CnIcon type="arrow-down" size={12} />
23
+ </div>
24
+ </Box>
25
+ <LangCard data-card>
26
+ <Box spacing={16}>
27
+ {langList.map((item, index) => (
28
+ <Box
29
+ key={index}
30
+ data-lang-list-item
31
+ direction="row"
32
+ justify="space-between"
33
+ onClick={() => handleSetLang(item.value)}
34
+ >
35
+ <span>{item.label}</span>
36
+ {item.value === lang && (
37
+ <Icon
38
+ type="select"
39
+ style={{
40
+ color: THEME.mainColor,
41
+ }}
42
+ />
43
+ )}
44
+ </Box>
45
+ ))}
46
+ </Box>
47
+ </LangCard>
48
+ </Wrapper>
49
+ );
50
+ };
51
+
52
+ const Wrapper = styled.div`
53
+ color: #fff;
54
+ position: relative;
55
+ height: 56px;
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+
60
+ &:hover {
61
+ [data-name='CnCard'] {
62
+ transform: scaleY(1);
63
+ }
64
+ }
65
+
66
+ [data-lang-label] {
67
+ margin-right: 2px;
68
+ }
69
+
70
+ [data-lang-list-item] {
71
+ width: 100px;
72
+ cursor: pointer;
73
+ }
74
+ `;
75
+
76
+ const LangCard = styled(CnCard)`
77
+ position: absolute;
78
+ right: -12px;
79
+ top: 64px;
80
+ color: ${THEME.defaultColor};
81
+ transform: scaleY(0);
82
+ transform-origin: 0 0;
83
+ transition: 0.5s;
84
+ `;
@@ -0,0 +1,29 @@
1
+ import { Box, Divider } from '@cainiaofe/cn-ui';
2
+ import { styled } from 'styled-components';
3
+
4
+ export const LogoBox = ({ src = '', text = '' }) => {
5
+ return (
6
+ <Box direction='row' align='center' style={{ width: 'max-content' }}>
7
+ <ImgBox
8
+ src={src}
9
+ alt=''
10
+ onClick={() => {
11
+ location.href = `/`;
12
+ }}
13
+ />
14
+ <Divider direction={'ver'} style={{ height: 20 }} />
15
+ <TextBox>{text}</TextBox>
16
+ </Box>
17
+ );
18
+ };
19
+
20
+ const ImgBox = styled.img({
21
+ objectFit: 'contain',
22
+ height: '24px',
23
+ cursor: 'pointer',
24
+ });
25
+
26
+ const TextBox = styled.span({
27
+ color: '#fff',
28
+ fontSize: '20px',
29
+ });