You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

398 lines
8.2 KiB

11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
9 months ago
12 months ago
11 months ago
  1. import { createStyles } from '@/theme'
  2. import { useScrollStyle } from '@/hooks/useScrollStyle'
  3. export const useStyle = createStyles(({ token, css, cx, prefixCls }, props: any) => {
  4. const prefix = `${prefixCls}-${token?.proPrefix}-layout`
  5. const { scrollbar,darkScrollbar,scrollbarBackground } = useScrollStyle()
  6. const container = {
  7. [prefix]: css`
  8. .ant-pro-layout .ant-pro-layout-bg-list{
  9. background:#f2f2f2;
  10. }
  11. height: 100%;
  12. .ant-pro-global-header-logo,
  13. .ant-pro-layout-bg-list {
  14. user-select: none;
  15. }
  16. .ant-menu-inline-collapsed >.ant-menu-item-group>.ant-menu-item-group-list>.ant-menu-item{
  17. //padding-inline-start: 0;
  18. }
  19. .ant-pro-layout-content{
  20. padding: 20px;
  21. }
  22. .ant-pro-layout .ant-pro-layout-content-has-page-container{
  23. padding: 0;
  24. }
  25. .ant-pro-page-container-children-container{
  26. padding-inline: 20px;
  27. padding-block: 20px;
  28. }
  29. .ant-page-header{
  30. background-color: white;
  31. }
  32. .ant-page-header-no-children {
  33. height: 0px;
  34. }
  35. .ant-pro-card{
  36. height: 100%;
  37. .ant-pro-card-header{
  38. padding-block: 16px;
  39. }
  40. }
  41. .ant-pro-card-body{
  42. padding-block-start: 0;
  43. overflow: auto;
  44. height: calc(100vh - 160px - var(--pageHeader, 0px));
  45. min-height: calc(100vh - 160px - var(--pageHeader, 0px));
  46. ${scrollbarBackground}
  47. }
  48. .ant-tree .ant-tree-checkbox{
  49. margin-top: 12px;
  50. }
  51. .ant-tree .ant-tree-switcher,
  52. .ant-tree .ant-tree-node-content-wrapper{
  53. line-height: 40px;
  54. }
  55. `,
  56. }
  57. const pageCard = css`
  58. .ant-pro-grid-content,
  59. .ant-pro-grid-content-children,
  60. .ant-pro-page-container-children-container,
  61. .layoutkit-flexbox
  62. {
  63. height: 100%;
  64. }
  65. .layoutkit-flexbox{
  66. height: calc(100% - var(--pageHeader, 0px));
  67. }
  68. `
  69. const pageContext = css`
  70. box-shadow: ${token.boxShadowSecondary};
  71. `
  72. const sideMenu = css`
  73. .ant-pro-base-menu-inline-group .ant-menu-item-group-title .anticon {
  74. //margin-inline-end: 0;
  75. }
  76. `
  77. const myLayout = css`
  78. height: 100%;
  79. .ant-pro-layout-content{
  80. flex-direction: row;
  81. }
  82. .ant-pro-sider-light{
  83. //background-color: #222b45!important;
  84. }
  85. .ant-pro-sider .ant-layout-sider-children{
  86. padding-inline: 0;
  87. }
  88. .ant-layout-sider-children > div:nth-child(2){
  89. ${darkScrollbar}
  90. }
  91. .ant-pro-sider-logo{
  92. padding-block-start: 10px;
  93. padding-block-end: 0;
  94. max-height: 50px;
  95. overflow: hidden;
  96. justify-content: center;
  97. }
  98. .ant-pro-layout-content,
  99. .ant-pro-layout-container{
  100. width: calc(100vw - 80px);
  101. overflow: hidden;
  102. height: 100vh;
  103. }
  104. .ant-pro-page-container .ant-pro-page-container-warp-page-header{
  105. padding-inline: 30px;
  106. .black{
  107. cursor: pointer;
  108. background-color: transparent;
  109. outline: none;
  110. transition: color 0.3s;
  111. .anticon {
  112. transition: all 0.2s;
  113. &:hover {
  114. transform: scale(1.3);
  115. }
  116. }
  117. }
  118. }
  119. `
  120. const childMenus = css`
  121. background: #fff;
  122. box-shadow: 2px 0 8px 0 rgba(29, 35, 41, .05);
  123. border-right: 1px solid #e6e6e6;
  124. // transition: width .3s;
  125. overflow: hidden;
  126. height: 100vh;
  127. display: flex;
  128. flex-direction: column;
  129. .i-icon{
  130. display: inline-flex;
  131. }
  132. .ant-menu{
  133. flex: 1;
  134. border-inline-end: 0!important;
  135. overflow: auto;
  136. ${scrollbar}
  137. .ant-menu-item{
  138. border-radius: 0;
  139. margin: 0;
  140. width: 100%;
  141. }
  142. .ant-menu-item-selected{
  143. }
  144. }
  145. .ant-menu-inline-collapsed >.ant-menu-item{
  146. padding-inline: calc(50% - 8px);
  147. height: 52px;
  148. line-height: 52px;
  149. }
  150. .ant-menu-inline >.ant-menu-submenu>.ant-menu-submenu-title,
  151. .ant-menu-inline .ant-menu-item{
  152. height: 52px;
  153. line-height: 52px;
  154. }
  155. .ant-menu .ant-menu-item .ant-menu-item-icon,
  156. .ant-menu .ant-menu-submenu-title .ant-menu-item-icon,
  157. .ant-menu .ant-menu-item .anticon, .ant-menu
  158. .ant-menu-submenu-title .anticon{
  159. font-size: 16px;
  160. }
  161. .ant-menu-inline .ant-menu-submenu-title{
  162. margin-inline: 0;
  163. margin-block: 0;
  164. width: 100%;
  165. border-radius: 0;
  166. }
  167. .ant-menu-light .ant-menu-item-selected,
  168. .ant-menu-light>.ant-menu .ant-menu-item-selected{
  169. background-color: #3f9eff;
  170. color: white;
  171. }
  172. `
  173. const childMenuTop = css`
  174. overflow: hidden;
  175. border-bottom: 1px solid #ebeef5;
  176. height: var(--bodyHeader, 50px);
  177. line-height: var(--bodyHeader, 50px);
  178. h2{
  179. padding: 0 20px;
  180. font-size: 17px;
  181. color: #3c4a54;
  182. margin: 0;
  183. }
  184. `
  185. const childMenuBottom = css `
  186. border-top: 1px solid #ebeef5;
  187. height: 51px;
  188. cursor: pointer;
  189. display: flex;
  190. align-items: center;
  191. justify-content: center;
  192. `
  193. const mySider = css`
  194. .ant-layout-sider-children{
  195. //background-color: #001529;
  196. padding-block-start: 10px!important;
  197. }
  198. .ant-menu-inline-collapsed >.ant-menu-item{
  199. padding-inline: calc(50% - 19px - 4px);
  200. }
  201. `
  202. const mySiderMenu = css`
  203. padding-top: 10px;
  204. .ant-menu-item{
  205. padding-inline: unset;
  206. padding-left: unset!important;
  207. flex-direction: column;
  208. height: 64px;
  209. line-height: 64px;
  210. }
  211. .ant-menu-item-selected{
  212. background-color: rgb(210, 229, 255);
  213. color: rgb(37, 59, 125);
  214. }
  215. .ant-menu-item >.ant-menu-title-content{
  216. text-overflow: unset!important;
  217. overflow: unset!important;
  218. flex: auto!important;
  219. align-content: center;
  220. .menu-link{
  221. display: flex;
  222. flex-direction: column;
  223. line-height: normal;
  224. align-items: center;
  225. }
  226. }
  227. .ant-pro-layout .ant-layout-sider.ant-pro-sider{
  228. background: none;
  229. }
  230. &.ant-menu-inline .ant-menu-item{
  231. margin-inline: 0;
  232. margin-block: 0;
  233. width: 80px;
  234. border-radius: 0;
  235. color: white!important;
  236. }
  237. .ant-menu-title-content{
  238. .anticon{
  239. font-size: 18px;
  240. }
  241. }
  242. .ant-menu-item:not(.ant-menu-item-selected):hover{
  243. background-color: hsla(0,0%,100%,.1) !important;
  244. color: white!important;
  245. }
  246. .ant-menu-item-selected{
  247. background-color: #334068;
  248. color: white;
  249. }
  250. `
  251. const body = css`
  252. overflow: hidden;
  253. --bodyHeader: 50px;
  254. --pageHeader: 0px;
  255. .ant-pro-page-container {
  256. width: 100%;
  257. flex: 1;
  258. overflow: hidden;
  259. height: calc(100vh - var(--bodyHeader, 50px) - var(--pageHeader, 0px));
  260. }
  261. `
  262. const bodyHeader = css`
  263. padding-block-end: 0;
  264. padding-block-start: 0;
  265. border-bottom: 1px solid #ebeef5;
  266. background-color: white;
  267. padding-inline: 15px;
  268. height: var(--bodyHeader, 50px);
  269. line-height: var(--bodyHeader, 50px);
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. width: 100%;
  274. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  275. `
  276. const headerRight = css`
  277. .ant-space-item{
  278. cursor: pointer;
  279. &:hover{
  280. background-color: ${token.colorBgTextHover};
  281. }
  282. }
  283. `
  284. const box = css`
  285. flex: 1;
  286. background: ${token.colorBgContainer};
  287. `
  288. const authHeight = css`
  289. background-color: ${token.colorBgContainer};
  290. .ant-pro-draggable-panel-fixed{
  291. //height: calc(100vh - 100px)!important;
  292. //min-height: calc(100vh - 100px)!important;
  293. }
  294. `
  295. const layoutTable = css`
  296. .ant-pro-table{
  297. .ant-pro-card-body{
  298. height: 100%;
  299. min-height: 100%;
  300. }
  301. }
  302. .page-title{
  303. justify-content: center;
  304. .ant-space-item{
  305. display: inline-flex;
  306. justify-content: center;
  307. }
  308. }
  309. `
  310. return {
  311. container: cx(container[prefix], props?.className),
  312. box,
  313. authHeight,
  314. pageContext,
  315. sideMenu,
  316. mySider,
  317. mySiderMenu,
  318. pageCard,
  319. myLayout,
  320. childMenuTop,
  321. childMenus,
  322. childMenuBottom,
  323. body,
  324. bodyHeader,
  325. headerRight,
  326. layoutTable,
  327. }
  328. })