cfel-base-components 0.0.25 → 1.0.1

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 (42) hide show
  1. package/config/webpack.base.js +10 -1
  2. package/demo/src/index.jsx +11 -29
  3. package/demo/src/index.module.less +3 -0
  4. package/demo/src/index.scss +2 -59
  5. package/package.json +10 -5
  6. package/src/components/base-component/PageContainer/index.module.less +13 -0
  7. package/src/components/base-component/PageContainer/index.tsx +28 -0
  8. package/src/components/base-component/Pagination/index.tsx +22 -0
  9. package/src/components/base-component/ProTable/index.tsx +29 -0
  10. package/src/components/base-component/QueryFilter/index.tsx +24 -0
  11. package/src/components/layout/index.scss +1 -1
  12. package/src/components/{account → universal-pages/account}/api.ts +1 -1
  13. package/src/components/{account → universal-pages/account}/index.tsx +10 -10
  14. package/src/components/{accountInfo → universal-pages/accountInfo}/api.ts +1 -1
  15. package/src/components/{accountInfo → universal-pages/accountInfo}/index.tsx +7 -7
  16. package/src/components/{role → universal-pages/role}/api.ts +1 -1
  17. package/src/components/{role → universal-pages/role}/index.tsx +8 -8
  18. package/src/components/{roleInfo → universal-pages/roleInfo}/api.ts +1 -1
  19. package/src/components/universal-pages/roleInfo/index.scss +3 -0
  20. package/src/components/{roleInfo → universal-pages/roleInfo}/index.tsx +9 -9
  21. package/src/index.d.ts +8 -1
  22. package/src/index.tsx +11 -8
  23. package/.vscode/settings.json +0 -3
  24. package/src/.umi/core/helmet.ts +0 -10
  25. package/src/.umi/core/helmetContext.ts +0 -4
  26. package/src/components/PageContainer/index.scss +0 -13
  27. package/src/components/PageContainer/index.tsx +0 -22
  28. package/src/components/Pagination/index.tsx +0 -20
  29. package/src/components/ProTable/index.tsx +0 -22
  30. package/src/components/QueryFilter/index.tsx +0 -20
  31. package/src/components/button/index.tsx +0 -16
  32. package/src/components/role/index.scss +0 -0
  33. package/src/components/roleInfo/index.scss +0 -3
  34. package/src/components/widthAutoLabelProps/index.tsx +0 -54
  35. /package/src/components/{Pagination/index.scss → base-component/Pagination/index.module.less} +0 -0
  36. /package/src/components/{ProTable/index.scss → base-component/ProTable/index.module.less} +0 -0
  37. /package/src/components/{QueryFilter/index.scss → base-component/QueryFilter/index.module.less} +0 -0
  38. /package/src/components/{account → universal-pages/account}/index.scss +0 -0
  39. /package/src/components/{accountInfo → universal-pages/accountInfo}/EditAccountDrawer/index.tsx +0 -0
  40. /package/src/components/{accountInfo → universal-pages/accountInfo}/index.scss +0 -0
  41. /package/src/components/{button → universal-pages/role}/index.scss +0 -0
  42. /package/src/components/{roleInfo → universal-pages/roleInfo}/EditAccountDrawer/index.tsx +0 -0
@@ -14,7 +14,16 @@ module.exports = {
14
14
  }
15
15
  ],
16
16
  exclude: /node_modules/, // 只解析 src 目录下的文件
17
- }
17
+ },
18
+ {
19
+ test: /\.module\.less$/, // 匹配以 .module.less 结尾的文件
20
+ use: [
21
+ 'style-loader', // 将样式注入到页面中
22
+ 'css-loader', // 处理 CSS 文件
23
+ 'less-loader', // 处理 LESS 文件
24
+ ],
25
+ exclude: /node_modules/, // 只解析 src 目录下的文件
26
+ },
18
27
  ]
19
28
  }
20
29
  };
@@ -1,37 +1,19 @@
1
1
  import React from "react"
2
2
  import { createRoot } from 'react-dom/client';
3
- import './index.scss';
4
- import Layout from '../../src/components/layout';
5
- import Account from '../../src/components/account';
6
- import AccountInfo from '../../src/components/accountinfo';
7
- import Role from '../../src/components/role';
8
- import RoleInfo from '../../src/components/roleinfo';
9
-
10
-
3
+ import style from './index.module.less';
11
4
 
5
+ import './index.scss';
6
+ import PageContainer from '../../src/components/base-component/PageContainer';
7
+ // import Layout from '../../src/components/layout';
8
+ // import Account from '../../src/components/universal-pages/account';
9
+ // import AccountInfo from '../../src/components/universal-pages/accountInfo';
10
+ // import Role from '../../src/components/universal-pages/role';
11
+ // import RoleInfo from '../../src/components/universal-pages/roleInfo';
12
12
 
13
13
  const App = () => {
14
- return (
15
- // < Layout appName="123123" productCode="lios-iot-wifi"
16
- // user={{
17
- // name: "\u5434\u6668\u61CB\uFF08\u592A\u4E00\uFF09",
18
- // avatar: "https:\/\/static-legacy.dingtalk.com\/media\/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
19
- // tenantName: "\u8FDC\u822A\u8DE8\u56FD\u63A7\u80A1\u96C6\u56E2",
20
- // role:["超级管理员","超管","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123超级管理员123超级管理员123超级管理员123","子管理员"]
21
- // // role:["超级管理员"]
22
- // }}
23
- // >
24
- // </Layout >
25
- <>
26
-
27
- {/* <Account></Account> */}
28
-
29
- {/* <AccountInfo /> */}
30
- {/* <Role ></Role> */}
31
-
32
- <RoleInfo/>
33
- </>
34
- );
14
+ return <PageContainer className={"aaa"}>
15
+ 123
16
+ </PageContainer>
35
17
  }
36
18
  const container = document.getElementById('root');
37
19
  const root = createRoot(container);
@@ -0,0 +1,3 @@
1
+ .aaa {
2
+ background: red;
3
+ }
@@ -1,60 +1,3 @@
1
- .container {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
- align-items: center;
6
- margin-top: 30px;
7
- font-size: 14px;
8
- font-weight: bold;
9
- color: #333;
10
- .text {
11
- display: flex;
12
- align-items: center;
13
- p:nth-child(2) {
14
- color: #f00;
15
- }
16
- }
17
- .normal {
18
- display: flex;
19
- align-items: center;
20
- margin-top: 10px;
21
- p:nth-child(2) {
22
- width: 100px;
23
- height: 32px;
24
- overflow: hidden;
25
- text-overflow: ellipsis;
26
- white-space: nowrap;
27
- border: 1px solid #ccc;
28
- }
29
- }
30
- .style1 {
31
- display: flex;
32
- align-items: center;
33
- margin-top: 10px;
34
- p:nth-child(2) {
35
- width: 100px;
36
- height: 32px;
37
- border: 1px solid #ccc;
38
- }
39
- }
40
- .style2 {
41
- display: flex;
42
- align-items: center;
43
- margin-top: 10px;
44
- p:nth-child(2) {
45
- width: 70px;
46
- height: 32px;
47
- border: 1px solid #ccc;
48
- }
49
- }
50
- .style3 {
51
- display: flex;
52
- align-items: center;
53
- margin-top: 10px;
54
- p:nth-child(2) {
55
- width: 40px;
56
- height: 32px;
57
- border: 1px solid #ccc;
58
- }
59
- }
1
+ .bbb {
2
+ background: cyan;
60
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "0.0.25",
3
+ "version": "1.0.1",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -21,10 +21,15 @@
21
21
  "@babel/preset-env": "^7.22.5",
22
22
  "@babel/preset-react": "^7.22.5",
23
23
  "@babel/preset-typescript": "^7.22.5",
24
+ "@types/lodash": "^4.14.195",
24
25
  "@types/react": "^18.2.14",
25
26
  "@types/react-dom": "^18.2.6",
27
+ "axios": "^1.4.0",
26
28
  "babel-loader": "^8.2.5",
29
+ "classnames": "^2.3.2",
27
30
  "css-loader": "^6.8.1",
31
+ "less-loader": "^11.1.3",
32
+ "lodash": "^4.17.21",
28
33
  "mini-css-extract-plugin": "^2.7.6",
29
34
  "node-sass": "^9.0.0",
30
35
  "postcss": "^8.4.24",
@@ -38,14 +43,14 @@
38
43
  "webpack": "^5.88.1",
39
44
  "webpack-cli": "^5.1.4",
40
45
  "webpack-dev-server": "^4.15.1",
41
- "webpack-merge": "^5.9.0",
42
- "axios": "^1.4.0",
43
- "lodash": "^4.17.21",
44
- "@types/lodash": "^4.14.195"
46
+ "webpack-merge": "^5.9.0"
45
47
  },
46
48
  "peerDependencies": {
47
49
  "@ant-design/icons": "^5.1.4",
48
50
  "@ant-design/pro-components": "^2.6.12",
49
51
  "antd": "^5.5.2"
52
+ },
53
+ "dependencies": {
54
+ "dayjs": "^1.11.9"
50
55
  }
51
56
  }
@@ -0,0 +1,13 @@
1
+ .page-container {
2
+ position: relative;
3
+ background: white;
4
+ border-radius: 8px;
5
+ flex: 1;
6
+
7
+ .foot-empower {
8
+ text-align: center;
9
+ color: #ccc;
10
+ font-size: 12px;
11
+ padding: 4px;
12
+ }
13
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames/bind';
3
+ import styles from "./index.module.less"
4
+ const cx = classnames.bind(styles);
5
+
6
+ export default function PageContainer({
7
+ className,
8
+ children,
9
+ ...restFileds
10
+ }: any) {
11
+ return (
12
+ <div
13
+ className={cx({
14
+ "page-container": true,
15
+ [className]: true,
16
+ })}
17
+ {...restFileds}
18
+ >
19
+ <div>
20
+ {children}
21
+ </div>
22
+
23
+ <div className={cx("foot-empower")}>
24
+ ©{new Date().getFullYear() || ''} 橙蜂而来{' '}
25
+ </div>
26
+ </div>
27
+ )
28
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Pagination, PaginationProps } from 'antd';
3
+ import classnames from 'classnames/bind';
4
+ import styles from "./index.module.less"
5
+ const cx = classnames.bind(styles);
6
+
7
+ export default function PaginationComponent({
8
+ className,
9
+ ...restFileds
10
+ }: PaginationProps | any) {
11
+ return (<Pagination
12
+ className={cx({
13
+ pagination: true,
14
+ [className]: true
15
+ })}
16
+ showQuickJumper
17
+ showSizeChanger
18
+ showTotal={(total) => `共 ${total} 条`}
19
+ {...restFileds}
20
+ />
21
+ )
22
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import {
3
+ ProTable,
4
+ ProTableProps
5
+ } from '@ant-design/pro-components';
6
+ import classnames from 'classnames/bind';
7
+ import styles from "./index.module.less"
8
+ const cx = classnames.bind(styles);
9
+
10
+ export default function ProTableComponent({
11
+ className,
12
+ ...restFileds
13
+ }: ProTableProps<any, any> | any) {
14
+ return (
15
+ <ProTable
16
+ className={cx({
17
+ "pro-table": true,
18
+ [className]: true
19
+ })}
20
+ search={false}
21
+ pagination={false}
22
+ scroll={{
23
+ x: 'max-content'
24
+ }}
25
+ {...restFileds}
26
+ />
27
+ )
28
+
29
+ }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import {
3
+ QueryFilter,
4
+ QueryFilterProps
5
+ } from '@ant-design/pro-components';
6
+ import classnames from 'classnames/bind';
7
+ import styles from "./index.module.less"
8
+ const cx = classnames.bind(styles);
9
+
10
+ export default function PaginationComponent({
11
+ className,
12
+ ...restFileds
13
+ }: QueryFilterProps<any> | any) {
14
+ return (
15
+ <QueryFilter
16
+ className={cx({
17
+ "query-filter": true,
18
+ [className]: true,
19
+ })}
20
+ layout="vertical"
21
+ {...restFileds}
22
+ />
23
+ )
24
+ }
@@ -162,7 +162,7 @@ body {
162
162
  width: 100%;
163
163
  height: calc(100vh - 48px);
164
164
  overflow-y: auto;
165
- padding: 16px 16px 5px;
165
+ padding: 16px 16px 0;
166
166
  display: flex;
167
167
  flex-direction: column;
168
168
  }
@@ -1,4 +1,4 @@
1
- import request from "../../apiRequest/config"
1
+ import request from "../../../apiRequest/config"
2
2
 
3
3
  //分页查询账号
4
4
  export const accountPage= (data?: any) => {
@@ -1,13 +1,13 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import useTableHooks from "../../hooks/useTableHooks"
3
- import PageContainer from '../PageContainer';
4
- import QueryFilter from '../QueryFilter';
5
- import ProTable from '../ProTable';
6
- import Pagination from '../Pagination';
7
- import { ProFormText,} from '@ant-design/pro-components';
2
+ import PageContainer from '../../base-component/PageContainer';
3
+ import QueryFilter from '../../base-component/QueryFilter';
4
+ import ProTable from '../../base-component/ProTable';
5
+ import Pagination from '../../base-component/Pagination';
6
+ import { ProFormText, } from '@ant-design/pro-components';
8
7
  import { Space, } from 'antd';
9
8
  import { get } from 'lodash';
10
- import { timeFormatter } from '../../utils';
9
+ import { timeFormatter } from '../../../utils';
10
+ import useTableHooks from "../../../hooks/useTableHooks"
11
11
  import { accountPage } from "./api"
12
12
 
13
13
  import "./index.scss"
@@ -18,7 +18,7 @@ export interface AccountProps {
18
18
 
19
19
  export default function Account({
20
20
  historyAction
21
- }:AccountProps) {
21
+ }: AccountProps) {
22
22
  const searchFormRef: any = useRef()
23
23
 
24
24
  useEffect(() => {
@@ -89,8 +89,8 @@ export default function Account({
89
89
  fixed: 'right',
90
90
  width: 80,
91
91
  render: (rowdata: any) => (
92
-
93
- <Space>
92
+
93
+ <Space>
94
94
  <a
95
95
  onClick={() => {
96
96
  historyAction?.push({
@@ -1,4 +1,4 @@
1
- import request from "../../apiRequest/config"
1
+ import request from "../../../apiRequest/config"
2
2
 
3
3
  //按账号id查询账号信息
4
4
  export const getAccount= (data?: any) => {
@@ -1,13 +1,13 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import useTableHooks from "../../hooks/useTableHooks"
3
- import Pagecontainer from '../PageContainer';
4
- import ProTable from '../ProTable';
5
- import Pagination from '../Pagination';
2
+ import PageContainer from '../../base-component/PageContainer';
3
+ import QueryFilter from '../../base-component/QueryFilter';
4
+ import ProTable from '../../base-component/ProTable';
5
+ import Pagination from '../../base-component/Pagination';
6
6
  import { get } from 'lodash';
7
7
  import { Modal, Button, Divider, Descriptions, Space, message, Avatar } from 'antd';
8
8
  import { UserOutlined } from '@ant-design/icons';
9
9
  import EditAccountDrawer from './EditAccountDrawer/index'
10
- import { timeFormatter, getUrlParams } from '../../utils';
10
+ import { timeFormatter, getUrlParams } from '../../../utils';
11
11
  import {
12
12
  getAccount,
13
13
  pageBoundRoles,
@@ -175,7 +175,7 @@ export default function AccountInfo() {
175
175
  })
176
176
  }
177
177
  return (
178
- <Pagecontainer>
178
+ <PageContainer>
179
179
  <Divider orientation="left">
180
180
  <Avatar
181
181
  style={{ backgroundColor: '#1677ff', marginRight: '8px' }}
@@ -222,7 +222,7 @@ export default function AccountInfo() {
222
222
  roleCheckData={roleCheckData} //当前角色选中数据
223
223
  isBoundRolesFunc={isBoundRolesFunc}
224
224
  ></EditAccountDrawer>
225
- </Pagecontainer>
225
+ </PageContainer>
226
226
  )
227
227
 
228
228
  }
@@ -1,4 +1,4 @@
1
- import request from "../../apiRequest/config"
1
+ import request from "../../../apiRequest/config"
2
2
 
3
3
  export const pageRequest = (data?: any) => {
4
4
  return request.post("/api/permission/role/page.json", { ...data })
@@ -1,16 +1,16 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import useTableHooks from "../../hooks/useTableHooks"
2
+ import useTableHooks from "../../../hooks/useTableHooks"
3
3
 
4
- import PageContainer from '../PageContainer';
5
- import QueryFilter from '../QueryFilter';
6
- import ProTable from '../ProTable';
7
- import Pagination from '../Pagination';
4
+ import PageContainer from '../../base-component/PageContainer';
5
+ import QueryFilter from '../../base-component/QueryFilter';
6
+ import ProTable from '../../base-component/ProTable';
7
+ import Pagination from '../../base-component/Pagination';
8
8
  import { get } from 'lodash';
9
9
  import { Space, } from 'antd';
10
10
  import { pageRequest, } from "./api"
11
11
 
12
12
  import { ProFormText, } from '@ant-design/pro-components';
13
- import { timeFormatter } from '../../utils';
13
+ import { timeFormatter } from '../../../utils';
14
14
 
15
15
  import "./index.scss"
16
16
  export interface RoleProps {
@@ -19,7 +19,7 @@ export interface RoleProps {
19
19
 
20
20
  export default function Role({
21
21
  historyAction
22
- }:RoleProps) {
22
+ }: RoleProps) {
23
23
  const searchFormRef: any = useRef()
24
24
 
25
25
  useEffect(() => {
@@ -67,7 +67,7 @@ export default function Role({
67
67
  width: 80,
68
68
  fixed: "right",
69
69
  render: (rowdata: any,) => <Space>
70
- <a onClick={() => {
70
+ <a onClick={() => {
71
71
  historyAction?.push({
72
72
  pathname: `/role-info`,
73
73
  search: `?roleCode=${rowdata.roleCode}`,
@@ -1,4 +1,4 @@
1
- import request from "../../apiRequest/config"
1
+ import request from "../../../apiRequest/config"
2
2
 
3
3
  //根据角色分页查询绑定的账号
4
4
  export const pageBoundAccounts= (data?: any) => {
@@ -0,0 +1,3 @@
1
+ .basicInfoWrap {
2
+ padding: 0 24px
3
+ }
@@ -1,15 +1,15 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import useTableHooks from "../../hooks/useTableHooks"
2
+ import useTableHooks from "../../../hooks/useTableHooks"
3
3
 
4
- import PageContainer from '../PageContainer';
5
- import QueryFilter from '../QueryFilter';
6
- import ProTable from '../ProTable';
7
- import Pagination from '../Pagination';
4
+ import PageContainer from '../../base-component/PageContainer';
5
+ import QueryFilter from '../../base-component/QueryFilter';
6
+ import ProTable from '../../base-component/ProTable';
7
+ import Pagination from '../../base-component/Pagination';
8
8
  import { get } from 'lodash';
9
9
  import { ProFormText, } from '@ant-design/pro-components';
10
10
  import { Button, Divider, Modal, Descriptions, Space, message } from 'antd';
11
11
  import EditAccountDrawer from './EditAccountDrawer/index'
12
- import { timeFormatter, getUrlParams } from '../../utils';
12
+ import { timeFormatter, getUrlParams } from '../../../utils';
13
13
  import {
14
14
  pageBoundAccounts,
15
15
  roleBoundAccounts,
@@ -19,7 +19,7 @@ import {
19
19
  } from './api'
20
20
  import "./index.scss"
21
21
 
22
- export default function RoleInfo(){
22
+ export default function RoleInfo() {
23
23
  const searchFormRef: any = useRef()
24
24
  const [roleCode, setRoleCode] = useState('')
25
25
  const [roleInfo, setRoleInfo]: any = useState({})
@@ -190,8 +190,8 @@ export default function RoleInfo(){
190
190
  searchFormRef.current = { ...values }
191
191
  execute({ "roleCode": roleCode })
192
192
  }
193
- return(
194
- <PageContainer>
193
+ return (
194
+ <PageContainer>
195
195
  <Divider orientation="left">{roleInfo?.roleName || "-"}</Divider>
196
196
  <Descriptions className="basicInfoWrap">
197
197
  <Descriptions.Item label="角色名称">{roleInfo?.roleName || ''}</Descriptions.Item>
package/src/index.d.ts CHANGED
@@ -3,4 +3,11 @@ declare module '*.scss' {
3
3
  export default content;
4
4
  }
5
5
 
6
- export * from './index';
6
+ declare module '*.module.less' {
7
+ const content: any;
8
+ export default content;
9
+ }
10
+
11
+ declare module '*.less'
12
+
13
+ // export * from './index';
package/src/index.tsx CHANGED
@@ -1,12 +1,13 @@
1
1
  import LiosLayout, { LiosLayoutlProps } from './components/layout'
2
- import PageContainer from './components/PageContainer'
3
- import QueryFilter from './components/QueryFilter'
4
- import ProTable from './components/ProTable'
5
- import Pagination from './components/Pagination'
6
- import Account from './components/account'
7
- import AccountInfo from './components/accountInfo'
8
- import Role from './components/role'
9
- import RoleInfo from './components/roleInfo'
2
+
3
+ import PageContainer from './components/base-component/PageContainer'
4
+ import QueryFilter from './components/base-component/QueryFilter'
5
+ import ProTable from './components/base-component/ProTable'
6
+ import Pagination from './components/base-component/Pagination'
7
+ import Account from './components/universal-pages/account'
8
+ import AccountInfo from './components/universal-pages/accountInfo'
9
+ import Role from './components/universal-pages/role'
10
+ import RoleInfo from './components/universal-pages/roleInfo'
10
11
  import request from './apiRequest/config'
11
12
  import iotRequest from './apiRequest/iotConfig'
12
13
  import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
@@ -17,10 +18,12 @@ export {
17
18
  QueryFilter,
18
19
  ProTable,
19
20
  Pagination,
21
+
20
22
  Account,
21
23
  AccountInfo,
22
24
  Role,
23
25
  RoleInfo,
26
+
24
27
  request,
25
28
  iotRequest,
26
29
  getUrlParams,
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib"
3
- }
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- import React from 'react';
5
- import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
6
- import { context } from './helmetContext';
7
-
8
- export const innerProvider = (container) => {
9
- return React.createElement(HelmetProvider, { context }, container);
10
- }
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- export const context = {};
@@ -1,13 +0,0 @@
1
- .page-container {
2
- background: white;
3
- border-radius: 8px;
4
- flex: 1;
5
- position: relative;
6
- }
7
- .page-footEmpower {
8
- text-align: center;
9
- color: #b6b6b6;
10
- font-size: 10px;
11
- padding: 4px 0px;
12
- }
13
-
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import "./index.scss"
3
-
4
-
5
- export default function PageContainer({
6
- className,
7
- children,
8
- ...restFileds
9
- }: any) {
10
- return (
11
- <>
12
- <div
13
- className={`page-container ${className}`}
14
- {...restFileds}
15
- >
16
- {children}
17
- </div>
18
- <div className="page-footEmpower">
19
- ©{new Date().getFullYear() || ''} 橙蜂而来{' '}
20
- </div>
21
- </>)
22
- }
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { Pagination, PaginationProps } from 'antd';
3
- import "./index.scss"
4
-
5
- export default function PaginationComponent (props: PaginationProps){
6
- const { className } = props
7
- return (
8
- <div
9
- className={`pagination ${className}`}
10
- >
11
- <Pagination
12
- showQuickJumper
13
- showSizeChanger
14
- showTotal={(total) => `共 ${total} 条`}
15
- {...props}
16
- />
17
- </div>
18
- )
19
-
20
- }
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import {
3
- ProTable,
4
- ProTableProps
5
- } from '@ant-design/pro-components';
6
- import "./index.scss"
7
-
8
- export default function ProTableComponent (props: ProTableProps<any,any>){
9
- const { className } = props
10
- return (
11
- <ProTable
12
- className={`protable ${className}`}
13
- search={false}
14
- pagination={false}
15
- scroll={{
16
- x: 'max-content'
17
- }}
18
- {...props}
19
- />
20
- )
21
-
22
- }
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import {
3
- QueryFilter,
4
- QueryFilterProps
5
- } from '@ant-design/pro-components';
6
- import "./index.scss"
7
-
8
-
9
-
10
- export default function PaginationComponent (props: QueryFilterProps<any>){
11
- const { className } = props
12
- return (
13
- <QueryFilter
14
- className={`queryfilter ${className}`}
15
- layout="vertical"
16
- {...props}
17
- />
18
- )
19
-
20
- }
@@ -1,16 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import "./index.scss"
3
- interface WidthAutoLabelProps {
4
- children: string; // 要绘制的文本
5
- }
6
-
7
- /**
8
- * 文本宽度自适应标签组件
9
- * @param props
10
- * @constructor
11
- */
12
- const Button = (props: WidthAutoLabelProps) => {
13
- return <div className='aaa-button'>123</div>
14
- }
15
-
16
- export default Button;
File without changes
@@ -1,3 +0,0 @@
1
- .basicInfoWrap{
2
- padding:0 24px
3
- }
@@ -1,54 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
-
3
- interface WidthAutoLabelProps {
4
- children: string; // 要绘制的文本
5
- }
6
-
7
- /**
8
- * 文本宽度自适应标签组件
9
- * @param props
10
- * @constructor
11
- */
12
- const WidthAutoLabel = (props: WidthAutoLabelProps) => {
13
- const { children = '' } = props;
14
- const ref = useRef<any>(null);
15
-
16
- useEffect(() => {
17
- drawText();
18
- }, [children]);
19
-
20
-
21
- const drawText = () => {
22
- let canvas = ref.current;
23
- if (!canvas) {
24
- return;
25
- }
26
- let parentNode = canvas.parentNode;
27
- if (!parentNode) {
28
- return;
29
- }
30
- const { fontSize, fontStyle, fontWeight, fontFamily } = getComputedStyle(parentNode, null);
31
- const { clientWidth, clientHeight } = parentNode;
32
- canvas.width = clientWidth;
33
- canvas.height = clientHeight;
34
- let ctx = canvas.getContext("2d");
35
- // 设置文本样式
36
- ctx.font = `${fontStyle} ${fontWeight} ${fontSize} ${fontFamily}`;
37
- ctx.textBaseline = 'top';
38
- let y = Math.ceil((clientHeight - Number(fontSize.replace('px', ''))) / 2);
39
- let x = 0;
40
- // 居中显示
41
- const { width: textWidth } = ctx.measureText(children);
42
- if (textWidth < clientWidth) {
43
- x = (clientWidth - textWidth) / 2;
44
- }
45
- // 绘制文本
46
- ctx.fillText(children, x, y, clientWidth);
47
- }
48
-
49
- return (
50
- <canvas ref={ref}></canvas>
51
- )
52
- }
53
-
54
- export default WidthAutoLabel;