Commit 9b31d5c5 authored by 邓晓峰's avatar 邓晓峰

merge dev branch

parents cd0765ef abdebee3
Pipeline #27360 failed with stages
in 7 seconds
...@@ -3,18 +3,28 @@ import { join } from 'path'; ...@@ -3,18 +3,28 @@ import { join } from 'path';
// utils must build before core // utils must build before core
const headPkgs = [ const headPkgs = [
'DeviceTree', // 'DeviceTree',
'Empty', // 'Empty',
'HistoryInfo', // 'HistoryInfo',
'ImageSelect', // 'ImageSelect',
'MqttView', // 'MqttView',
'QuotaSelect', // 'QuotaSelect',
'RealTimeInfo', // 'RealTimeInfo',
'TimeRangePicker', // 'TimeRangePicker',
]; ];
const tailPkgs = readdirSync(join(__dirname, 'packages')).filter( const pkgList = ['base-components', 'extend-components']
(pkg) => pkg.charAt(0) !== '.' && !headPkgs.includes(pkg), .map((dir) => {
); const list = readdirSync(join(__dirname, 'packages', dir)).map((item) => `${item}!${dir}`);
return list;
})
.flat();
const tailPkgs = pkgList
.filter((pkg) => pkg.charAt(0) !== '.' && !headPkgs.includes(pkg))
.map((item) => {
const [name, path] = item.split('!');
return `${path}/${name}`;
});
export default { export default {
cjs: { type: 'babel', lazy: true }, cjs: { type: 'babel', lazy: true },
......
...@@ -16,7 +16,7 @@ before_script: ...@@ -16,7 +16,7 @@ before_script:
init: init:
stage: init stage: init
script: script:
- cd /d %DEPLOY_PATH%/src/wisdom-components - cd /d %DEPLOY_PATH%/src/wisdom-extend-components
- dir - dir
- git pull - git pull
- echo 开始安装依赖... - echo 开始安装依赖...
...@@ -25,13 +25,13 @@ init: ...@@ -25,13 +25,13 @@ init:
bootstrap: bootstrap:
stage: bootstrap stage: bootstrap
script: script:
- cd /d %DEPLOY_PATH%/src/wisdom-components - cd /d %DEPLOY_PATH%/src/wisdom-extend-components
- dir - dir
build: build:
stage: build stage: build
script: script:
- cd /d %DEPLOY_PATH%/src/wisdom-components - cd /d %DEPLOY_PATH%/src/wisdom-extend-components
- echo 开始打包... - echo 开始打包...
- npm run site - npm run site
- echo 打包完成 - echo 打包完成
...@@ -39,7 +39,7 @@ build: ...@@ -39,7 +39,7 @@ build:
release: release:
stage: release stage: release
script: script:
- cd /d %DEPLOY_PATH%/src/wisdom-components - cd /d %DEPLOY_PATH%/src/wisdom-extend-components
- echo 开始拷贝发布包... - echo 开始拷贝发布包...
- robocopy dist %DEPLOY_PATH%/dist /e || cmd /c "exit /b 0" - robocopy dist %DEPLOY_PATH%/dist /e || cmd /c "exit /b 0"
- echo 发布完成. - echo 发布完成.
...@@ -3,12 +3,17 @@ import { readdirSync } from 'fs'; ...@@ -3,12 +3,17 @@ import { readdirSync } from 'fs';
import { join } from 'path'; import { join } from 'path';
const headPkgList = []; const headPkgList = [];
const pkgList = readdirSync(join(__dirname, 'packages')).filter(
(pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg), const pkgList = ['base-components', 'extend-components']
); .map((dir) => {
const list = readdirSync(join(__dirname, 'packages', dir)).map((item) => item + `!${dir}`);
return list.filter((pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg));
})
.flat();
const alias = pkgList.reduce((pre, pkg) => { const alias = pkgList.reduce((pre, pkg) => {
pre[`@wisdom-components/pro-${pkg}`] = join(__dirname, 'packages', pkg, 'src'); const path = pkg.split('!');
pre[`@wisdom-components/pro-${path[0]}`] = join(__dirname, 'packages', path[1], path[0], 'src');
return { return {
...pre, ...pre,
}; };
...@@ -17,11 +22,15 @@ const alias = pkgList.reduce((pre, pkg) => { ...@@ -17,11 +22,15 @@ const alias = pkgList.reduce((pre, pkg) => {
console.log(`🌼 alias list \n${chalk.blue(Object.keys(alias).join('\n'))}`); console.log(`🌼 alias list \n${chalk.blue(Object.keys(alias).join('\n'))}`);
const tailPkgList = pkgList const tailPkgList = pkgList
.map((path) => [join('packages', path, 'src'), join('packages', path, 'src', 'components')]) .map((pkg) => {
const path = pkg.split('!');
return [
join('packages', path[1], path[0], 'src'),
join('packages', path[0], 'src', 'components'),
];
})
.reduce((acc, val) => acc.concat(val), []); .reduce((acc, val) => acc.concat(val), []);
const isProduction = process.env.NODE_ENV === 'production';
export default { export default {
title: 'panda-components', title: 'panda-components',
mode: 'site', mode: 'site',
...@@ -90,5 +99,11 @@ export default { ...@@ -90,5 +99,11 @@ export default {
children: ['DeviceTree', 'RealTimeInfo', 'HistoryInfo'], children: ['DeviceTree', 'RealTimeInfo', 'HistoryInfo'],
}, },
], ],
'/extend-components': [
{
title: 'base',
children: ['EC-DeviceTree', 'EC-QuotaSelect'],
},
],
}, },
}; };
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"version": "independent", "version": "independent",
"npmClient": "npm", "npmClient": "npm",
"useWorkspaces": true, "useWorkspaces": true,
"packages": ["packages/*"],
"changelog": { "changelog": {
"repo": "wisdom-components", "repo": "wisdom-components",
"cacheDir": ".changelog" "cacheDir": ".changelog"
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"workspaces": [ "workspaces": [
"packages/*" "packages/base-components/*",
"packages/extend-components/*"
], ],
"scripts": { "scripts": {
"bootstrap": "node ./scripts/bootstrap.js", "bootstrap": "node ./scripts/bootstrap.js",
"build": "father-build && webpack", "build": "cross-env BUILD_TYPE=lib father-build && cross-env BUILD_TYPE=es father-build && webpack && node ./scripts/gen_less_entry.js",
"changelog": "pro-changelog", "changelog": "pro-changelog",
"createRelease": "node ./scripts/createRelease.js", "createRelease": "node ./scripts/createRelease.js",
"deploy": "npm run site && gh-pages -d ./dist", "deploy": "npm run site && gh-pages -d ./dist",
...@@ -137,9 +138,10 @@ ...@@ -137,9 +138,10 @@
"registry": "https://g.civnet.cn:4873" "registry": "https://g.civnet.cn:4873"
}, },
"dependencies": { "dependencies": {
"@wisdom-components/Empty": "^1.3.3", "@wisdom-components/basictable": "^1.4.5",
"@wisdom-components/basictable": "^1.2.0", "@wisdom-components/empty": "^1.3.9",
"@wisdom-components/timerangepicker": "^1.3.4", "@wisdom-components/timerangepicker": "^1.3.4",
"@wisdom-utils/utils": "0.0.46",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"form-render": "^0.9.12", "form-render": "^0.9.12",
...@@ -152,97 +154,145 @@ ...@@ -152,97 +154,145 @@
}, },
"size-limit": [ "size-limit": [
{ {
"path": "packages/DeviceTree/lib/**/*.js", "path": "packages/base-components/BasicTable/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/DeviceTree/es/**/*.js", "path": "packages/base-components/BasicTable/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/Empty/lib/**/*.js", "path": "packages/base-components/BasicTools/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/Empty/es/**/*.js", "path": "packages/base-components/BasicTools/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/HistoryInfo/lib/**/*.js", "path": "packages/base-components/DeviceTree/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/HistoryInfo/es/**/*.js", "path": "packages/base-components/DeviceTree/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/ImageSelect/lib/**/*.js", "path": "packages/base-components/Empty/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/ImageSelect/es/**/*.js", "path": "packages/base-components/Empty/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/MqttView/lib/**/*.js", "path": "packages/base-components/ExportExcel/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/MqttView/es/**/*.js", "path": "packages/base-components/ExportExcel/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/QuotaSelect/lib/**/*.js", "path": "packages/base-components/HistoryInfo/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/QuotaSelect/es/**/*.js", "path": "packages/base-components/HistoryInfo/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/RealTimeInfo/lib/**/*.js", "path": "packages/base-components/ImageSelect/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/RealTimeInfo/es/**/*.js", "path": "packages/base-components/ImageSelect/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/TimeRangePicker/lib/**/*.js", "path": "packages/base-components/MqttView/lib/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
}, },
{ {
"path": "packages/TimeRangePicker/es/**/*.js", "path": "packages/base-components/MqttView/es/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/ParseForm/lib/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/ParseForm/es/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/QuotaSelect/lib/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/QuotaSelect/es/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/RealTimeInfo/lib/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/RealTimeInfo/es/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/TimeRangePicker/lib/**/*.js",
"limit": "2 s",
"webpack": false,
"running": false
},
{
"path": "packages/base-components/TimeRangePicker/es/**/*.js",
"limit": "2 s", "limit": "2 s",
"webpack": false, "webpack": false,
"running": false "running": false
......
# `@wisdom-components/ImageSelect`
> TODO: description
## Usage
```
const imageselect = require('@wisdom-components/ImageSelect');
// TODO: DEMONSTRATE API
```
# `@wisdom-components/QuotaSelect`
> TODO: description
## Usage
```
const quotaselect = require('@wisdom-components/QuotaSelect');
// TODO: DEMONSTRATE API
```
...@@ -2,6 +2,27 @@ ...@@ -2,6 +2,27 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.5](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.4.2...@wisdom-components/basictable@1.4.5) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.4](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.4.2...@wisdom-components/basictable@1.4.4) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.3](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.4.2...@wisdom-components/basictable@1.4.3) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.3.0...@wisdom-components/basictable@1.4.2) (2021-04-20) ## [1.4.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.3.0...@wisdom-components/basictable@1.4.2) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/BasicTools` # `@wisdom-components/basictable`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const basicTools = require('@wisdom-components/BasicTools'); const basicTable = require('@wisdom-components/basictable');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
{ {
"name": "@wisdom-components/basictable", "name": "@wisdom-components/basictable",
"version": "1.4.2", "version": "1.4.5",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: BasicTable - 标准表格 title: BasicTable - 标准表格
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
...@@ -20,8 +20,14 @@ group: ...@@ -20,8 +20,14 @@ group:
## 代码演示 ## 代码演示
### 常规使用
<code src="./demos/Basic.tsx"> <code src="./demos/Basic.tsx">
### 合计
<code src="./demos/Summary.tsx">
## API ## API
api 参考 Antd Table 组件 https://ant.design/components/table-cn/#API api 参考 Antd Table 组件 https://ant.design/components/table-cn/#API
// @ts-ignore
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import Empty from '@wisdom-components/empty'; import Empty from '@wisdom-components/empty';
import BasicTable from '../index'; import BasicTable from '../index';
...@@ -42,11 +43,10 @@ const Demo = () => { ...@@ -42,11 +43,10 @@ const Demo = () => {
}); });
}; };
// @ts-ignore
return ( return (
<div style={{ height: '400px' }}> <div style={{ height: '400px' }}>
{!!dataSource.length && ( {!!dataSource.length && <BasicTable dataSource={dataSource} columns={columns} bordered />}
<BasicTable dataSource={dataSource} columns={columns} bordered={true} />
)}
{!dataSource.length && <Empty description={'暂无数据'} />} {!dataSource.length && <Empty description={'暂无数据'} />}
</div> </div>
); );
......
// @ts-ignore
import React, { useEffect, useState } from 'react';
import Empty from '@wisdom-components/empty';
import { Table } from 'antd';
import BasicTable from '../index';
import request from 'umi-request';
const Demo = () => {
const [columns, setColumns] = useState([]);
const [dataSource, setDataSource] = useState([]);
useEffect(() => {
fetchData();
}, []);
const fetchData = (params = {}) => {
request(`${baseUrl}/AcrossTable/GetEquipmentDataReport`, {
method: 'get',
params: {},
}).then(function (response) {
const data = response.data;
let column = data.map((item, index) => {
return {
title: `${item.DName + item.DType}(${item.Unit})`,
dataIndex: `name${index}`,
key: `name${index}`,
width: 300,
};
});
column.unshift({
title: '时间',
dataIndex: 'time',
key: 'time',
fixed: true,
width: 200,
});
let dataSource = data[0].NameDate.map((item, index) => ({ key: index, time: item.Time }));
data.forEach((item, index) => {
item.NameDate.forEach((child) => {
dataSource.forEach((v) => {
if (child.Time === v.time) v[`name${index}`] = child.Value;
});
});
});
setColumns(column);
setDataSource(dataSource);
});
};
const Summary = (currentData) => (
<Table.Summary.Row>
{columns.map((item, index) => {
let sum = 0;
currentData.reduce((prev, next) => {
sum += next[item.key];
}, 0);
return (
<Table.Summary.Cell key={index} index={index}>
{index === 0 ? '总计' : sum}
</Table.Summary.Cell>
);
})}
</Table.Summary.Row>
);
// @ts-ignore
return (
<div style={{ height: '400px' }}>
{!!dataSource.length && (
<BasicTable dataSource={dataSource} columns={columns} bordered summary={Summary} />
)}
{!dataSource.length && <Empty description={'暂无数据'} />}
</div>
);
};
export default Demo;
const baseUrl = 'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api';
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from 'prop-types';
import { Table, ConfigProvider } from 'antd'; import { Table, ConfigProvider } from 'antd';
import './index.less'; import './index.less';
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@basic-table-prefix-cls: ~'@{ant-prefix}-basic-table'; @basic-table-prefix-cls: ~'@{ant-prefix}-basic-table';
.@{basic-table-prefix-cls} { .@{basic-table-prefix-cls} {
...@@ -19,12 +19,9 @@ ...@@ -19,12 +19,9 @@
overflow: hidden; overflow: hidden;
} }
.ant-table-tbody > tr { .ant-table-tbody > tr,
background: rgba(255, 255, 255, 0);
}
.ant-table-tbody > tr > td { .ant-table-tbody > tr > td {
background: rgba(255, 255, 255, 0); background: white;
} }
.ant-table-thead > tr > th { .ant-table-thead > tr > th {
...@@ -41,10 +38,11 @@ ...@@ -41,10 +38,11 @@
} }
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td { .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td {
background: rgba(255, 255, 255, 0); background: white;
} }
.ant-table-tbody > tr:nth-child(2n-1) { .ant-table-tbody > tr:nth-child(2n-1),
.ant-table-tbody > tr:nth-child(2n-1) td {
background: #f6f9fe; background: #f6f9fe;
} }
...@@ -124,4 +122,13 @@ ...@@ -124,4 +122,13 @@
border-right: 0; border-right: 0;
border-bottom: 0; border-bottom: 0;
} }
.ant-table-summary {
tr td {
position: sticky;
bottom: 0;
background: white;
border-top: 1px solid #dbe7fb;
}
}
} }
...@@ -2,6 +2,27 @@ ...@@ -2,6 +2,27 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictools@1.2.7...@wisdom-components/basictools@1.2.10) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.2.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictools@1.2.7...@wisdom-components/basictools@1.2.9) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.2.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictools@1.2.7...@wisdom-components/basictools@1.2.8) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.2.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictools@1.2.5...@wisdom-components/basictools@1.2.7) (2021-04-20) ## [1.2.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictools@1.2.5...@wisdom-components/basictools@1.2.7) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/BasicTable` # `@wisdom-components/basictools`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const basicTable = require('@wisdom-components/BasicTable'); const basicTools = require('@wisdom-components/basictools');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
{ {
"name": "@wisdom-components/basictools", "name": "@wisdom-components/basictools",
"version": "1.2.7", "version": "1.2.10",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: BasicTools - 通用工具库 title: BasicTools - 通用工具库
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
...@@ -16,7 +16,7 @@ group: ...@@ -16,7 +16,7 @@ group:
## 使用说明 ## 使用说明
```javascript ```javascript
import { getTimeRange, getRange } from '@wisdom-components/BasicTools'; import { getTimeRange, getRange } from 'packages/base-components/BasicTools/lib/index';
let result1 = getTimeRange('lastYear'); let result1 = getTimeRange('lastYear');
let result2 = getTimeRange('nextWeek'); let result2 = getTimeRange('nextWeek');
......
...@@ -2,8 +2,8 @@ import moment from 'moment'; ...@@ -2,8 +2,8 @@ import moment from 'moment';
// 根据设定查询条件 返回时间范围 // 根据设定查询条件 返回时间范围
const getTimeRange = (type) => { const getTimeRange = (type) => {
let start = '', let start = '';
end = ''; let end = '';
switch (type) { switch (type) {
case 'thisYear': // 今年 case 'thisYear': // 今年
start = moment().startOf('year'); start = moment().startOf('year');
...@@ -102,8 +102,8 @@ const getTimeRange = (type) => { ...@@ -102,8 +102,8 @@ const getTimeRange = (type) => {
}; };
const getRange = (date, type) => { const getRange = (date, type) => {
let start = '', let start = '';
end = ''; let end = '';
switch (type) { switch (type) {
case 'day': case 'day':
start = moment(date); start = moment(date);
......
...@@ -2,6 +2,46 @@ ...@@ -2,6 +2,46 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.14](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.8...@wisdom-components/devicetree@1.3.14) (2021-04-26)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.13](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.12...@wisdom-components/devicetree@1.3.13) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.3.12](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.8...@wisdom-components/devicetree@1.3.12) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.11](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.8...@wisdom-components/devicetree@1.3.11) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.8...@wisdom-components/devicetree@1.3.10) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
## [1.3.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.8...@wisdom-components/devicetree@1.3.9) (2021-04-21)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
## [1.3.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.5...@wisdom-components/devicetree@1.3.8) (2021-04-20) ## [1.3.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/devicetree@1.3.5...@wisdom-components/devicetree@1.3.8) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/DeviceTree` # `@wisdom-components/devicetree`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const devicetree = require('@wisdom-components/DeviceTree'); const devicetree = require('@wisdom-components/devicetree');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
......
{ {
"name": "@wisdom-components/devicetree", "name": "@wisdom-components/devicetree",
"version": "1.3.8", "version": "1.3.14",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: DeviceTree - 设备树 title: DeviceTree - 设备树
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
...@@ -79,7 +79,7 @@ const Demo = () => { ...@@ -79,7 +79,7 @@ const Demo = () => {
}; };
return ( return (
<div style={{ width: '300px', height: '400px', border: '1px solid #eee' }}> <div style={{ width: '200px', height: '400px', border: '1px solid #eee' }}>
<PandaDeviceTree <PandaDeviceTree
onSearch={onSearch} onSearch={onSearch}
checkable checkable
......
...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; ...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Input, Tree, Divider, ConfigProvider } from 'antd'; import { Input, Tree, Divider, ConfigProvider } from 'antd';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import Empty from '@wisdom-components/Empty'; import Empty from '@wisdom-components/empty';
import './index.less'; import './index.less';
const DeviceTree = (props) => { const DeviceTree = (props) => {
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@device-tree-prefix-cls: ~'@{ant-prefix}-device-tree'; @device-tree-prefix-cls: ~'@{ant-prefix}-device-tree';
.@{device-tree-prefix-cls} { .@{device-tree-prefix-cls} {
...@@ -12,6 +12,14 @@ ...@@ -12,6 +12,14 @@
margin: 6px 0 12px 0; margin: 6px 0 12px 0;
} }
.ant-tree-checkbox {
margin: 4px 2px 0 0;
}
.ant-tree-title {
white-space: nowrap;
}
&-content { &-content {
flex: 1; flex: 1;
overflow-y: scroll; overflow-y: scroll;
......
...@@ -2,6 +2,27 @@ ...@@ -2,6 +2,27 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.12](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/empty@1.3.9...@wisdom-components/empty@1.3.12) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([9948af1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9948af1f0749243cf866c228fc67b8f8e0d0c41f))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.11](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/empty@1.3.10...@wisdom-components/empty@1.3.11) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.3.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/empty@1.3.9...@wisdom-components/empty@1.3.10) (2021-04-22)
### Bug Fixes
- update package ([9948af1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9948af1f0749243cf866c228fc67b8f8e0d0c41f))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/empty@1.3.5...@wisdom-components/empty@1.3.9) (2021-04-20) ## [1.3.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/empty@1.3.5...@wisdom-components/empty@1.3.9) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/Empty` # `@wisdom-components/empty`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const empty = require('@wisdom-components/Empty'); const empty = require('@wisdom-components/empty');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
{ {
"name": "@wisdom-components/empty", "name": "@wisdom-components/empty",
"version": "1.3.9", "version": "1.3.12",
"description": "@wisdom-components/empty", "description": "@wisdom-components/empty",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: Empty - 空状态 title: Empty - 空状态
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from 'prop-types';
import { ConfigProvider } from 'antd'; import { ConfigProvider } from 'antd';
import noDataLight from './assets/noDataLight.png'; import noDataLight from './assets/noDataLight.png';
import noDataDark from './assets/noDataDark.png'; import noDataDark from './assets/noDataDark.png';
import errorLight from './assets/errorLight.png'; import errorLight from './assets/errorLight.png';
import errorDark from './assets/errorDark.png'; import errorDark from './assets/errorDark.png';
import './index.less'; import './index.less';
const Empty = ({ description, image, theme, size, statusCode, imageStyle, children }) => { const Empty = ({ description, image, theme, size, statusCode, imageStyle, children }) => {
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@panda-empty-prefix-cls: ~'@{ant-prefix}-panda-empty'; @panda-empty-prefix-cls: ~'@{ant-prefix}-panda-empty';
.@{panda-empty-prefix-cls} { .@{panda-empty-prefix-cls} {
......
...@@ -2,6 +2,24 @@ ...@@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.0.7...@wisdom-components/exportexcel@1.0.10) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.0.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.0.7...@wisdom-components/exportexcel@1.0.9) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.0.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.0.7...@wisdom-components/exportexcel@1.0.8) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.0.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.0.5...@wisdom-components/exportexcel@1.0.7) (2021-04-20) ## [1.0.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.0.5...@wisdom-components/exportexcel@1.0.7) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
{ {
"name": "@wisdom-components/exportexcel", "name": "@wisdom-components/exportexcel",
"version": "1.0.7", "version": "1.0.10",
"description": "> TODO: description", "description": "> TODO: description",
"author": "lijiwen <961370825@qq.com>", "author": "lijiwen <961370825@qq.com>",
"homepage": "", "homepage": "",
......
--- ---
title: ExportExcel - Excel表格导出 title: ExportExcel - Excel表格导出
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
import React, { useEffect } from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ExportJsonExcel from 'js-export-excel'; import ExportJsonExcel from 'js-export-excel';
import JSZip from 'jszip'; import JSZip from 'jszip';
......
...@@ -2,6 +2,35 @@ ...@@ -2,6 +2,35 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.13](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.8...@wisdom-components/historyinfo@1.4.13) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.12](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.11...@wisdom-components/historyinfo@1.4.12) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
## [1.4.11](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.8...@wisdom-components/historyinfo@1.4.11) (2021-04-22)
### Bug Fixes
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.8...@wisdom-components/historyinfo@1.4.10) (2021-04-22)
### Bug Fixes
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.4.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.8...@wisdom-components/historyinfo@1.4.9) (2021-04-22)
**Note:** Version bump only for package @wisdom-components/historyinfo
## [1.4.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.5...@wisdom-components/historyinfo@1.4.8) (2021-04-20) ## [1.4.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/historyinfo@1.4.5...@wisdom-components/historyinfo@1.4.8) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/HistoryInfo` # `@wisdom-components/historyinfo`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const historyinfo = require('@wisdom-components/HistoryInfo'); const historyinfo = require('@wisdom-components/historyinfo');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
{ {
"name": "@wisdom-components/historyinfo", "name": "@wisdom-components/historyinfo",
"version": "1.4.8", "version": "1.4.13",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: HistoryInfo - 历史数据查看 title: HistoryInfo - 历史数据查看
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
...@@ -28,12 +28,12 @@ group: ...@@ -28,12 +28,12 @@ group:
api 参考 Antd Table 组件 https://ant.design/components/table-cn/#API api 参考 Antd Table 组件 https://ant.design/components/table-cn/#API
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 | 可选值 |
| -------------- | ---------------------------------------------- | ------------------ | -------- | | --- | --- | --- | --- | --- |
| title | 标题 | string | 指标曲线 | | title | 标题 | string | 指标曲线 | - |
| defaultChecked | 默认选中自定义时间 key | string | oneHour | | defaultChecked | 默认选中自定义时间 key | string | oneHour | oneHour/fourHour/twelveHours/roundClock/yesterday |
| columns | 表格列的配置描述 | array | [ ] | | columns | 表格列的配置描述 | array | [ ] | - |
| dataSource | 表格数据源 | array | [ ] | | dataSource | 表格数据源 | array | [ ] | - |
| tableProps | 表格其他 props | object | { } | | tableProps | 表格其他 props | object | { } | - |
| chartOptions | 曲线的 options | object | { } | | chartOptions | 曲线的 options | object | { } | - |
| onChange | 选择时间设置或曲线设置的回调,会返回修改后的值 | function(value){ } | - | | onChange | 选择时间设置或曲线设置的回调,会返回修改后的值 | function(value){ } | - | - |
...@@ -43,7 +43,7 @@ const Demo = () => { ...@@ -43,7 +43,7 @@ const Demo = () => {
}); });
}); });
setData(tableData); setData(tableData);
setColumns([...columns, ...columnsData]); setColumns(columnsData);
handleSeries(resData); handleSeries(resData);
}); });
}; };
...@@ -92,15 +92,17 @@ const Demo = () => { ...@@ -92,15 +92,17 @@ const Demo = () => {
}; };
return ( return (
<div style={{ height: '800px' }}>
<HistoryInfo <HistoryInfo
title={'指标曲线'} title={'指标曲线'}
columns={columns} columns={columns}
dataSource={data} dataSource={data}
chartOptions={{ series }} chartOptions={{ series }}
tableProps={{ bordered: true }} tableProps={{ bordered: true, pagination: { pageSize: 20 } }}
onChange={onChangeParams} onChange={onChangeParams}
defaultChecked={'roundClock'} // defaultChecked={'fourHour'}
/> />
</div>
); );
}; };
......
import React, { useContext, useState, useReducer, useEffect } from 'react'; import React, { useContext, useState, useReducer, useEffect, useRef } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import Highcharts from 'highcharts/highstock'; import Highcharts from 'highcharts/highstock';
...@@ -7,7 +7,7 @@ import { Tabs, Select, Radio, Checkbox, ConfigProvider, DatePicker } from 'antd' ...@@ -7,7 +7,7 @@ import { Tabs, Select, Radio, Checkbox, ConfigProvider, DatePicker } from 'antd'
import { PlusCircleOutlined } from '@ant-design/icons'; import { PlusCircleOutlined } from '@ant-design/icons';
import TimeRangePicker from '@wisdom-components/timerangepicker'; import TimeRangePicker from '@wisdom-components/timerangepicker';
import BasicTable from '@wisdom-components/basictable'; import BasicTable from '@wisdom-components/basictable';
import Empty from '@wisdom-components/Empty'; import Empty from '@wisdom-components/empty';
import moment from 'moment'; import moment from 'moment';
import './index.less'; import './index.less';
...@@ -99,12 +99,16 @@ const unique = (arr) => { ...@@ -99,12 +99,16 @@ const unique = (arr) => {
return arr; return arr;
}; };
let chartWidth = 0; // chart width
let chartHeight = 0; // chart height
const HistoryInfo = (props) => { const HistoryInfo = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('history-info'); const prefixCls = getPrefixCls('history-info');
const { title, columns, dataSource, tableProps, chartOptions, onChange } = props; const { title, columns, dataSource, tableProps, chartOptions, onChange } = props;
const [activeTabKey, setActiveTabKey] = useState('curve');
const [timeValue, setTimeValue] = useState('customer'); const [timeValue, setTimeValue] = useState('customer');
const [contrastOption, setContrastOption] = useState('day'); const [contrastOption, setContrastOption] = useState('day');
const [customerChecked, setCustomerChecked] = useState(props.defaultChecked || 'oneHour'); const [customerChecked, setCustomerChecked] = useState(props.defaultChecked || 'oneHour');
...@@ -112,13 +116,24 @@ const HistoryInfo = (props) => { ...@@ -112,13 +116,24 @@ const HistoryInfo = (props) => {
const [datePickerArr, setDatePickerArr] = useState(DataPickerArr); const [datePickerArr, setDatePickerArr] = useState(DataPickerArr);
const [checkboxData, setCheckboxData] = useState(CheckboxData); const [checkboxData, setCheckboxData] = useState(CheckboxData);
const [dataThinKey, setDataThinKey] = useState(timeIntervalList[0].key); const [dataThinKey, setDataThinKey] = useState(timeIntervalList[0].key);
const [options, setOptions] = useState({});
const [state, dispatch] = useReducer(reducer, initialState); const [state, dispatch] = useReducer(reducer, initialState);
const container = useRef(null);
useEffect(() => { useEffect(() => {
onChange(state); onChange(state);
}, [state]); }, [state]);
useEffect(() => {
dispatch({ type: UPDATE_TIME.UPDATE_TIME, payload: props.defaultChecked });
}, [props.defaultChecked]);
useEffect(() => {
setOptions({ ...handleChartOptions() });
}, [chartOptions]);
// 时间设置切换(自定义/同期对比) // 时间设置切换(自定义/同期对比)
const onTimeSetChange = (e) => { const onTimeSetChange = (e) => {
setTimeValue(e.target.value); setTimeValue(e.target.value);
...@@ -194,6 +209,9 @@ const HistoryInfo = (props) => { ...@@ -194,6 +209,9 @@ const HistoryInfo = (props) => {
if (key === 'ignoreOutliers') { if (key === 'ignoreOutliers') {
dispatch({ type: item.type, payload: e.target.checked }); dispatch({ type: item.type, payload: e.target.checked });
} }
if (key === 'curveCenter') {
setOptions({ ...handleChartOptions() });
}
} }
}); });
setCheckboxData(data); setCheckboxData(data);
...@@ -244,11 +262,7 @@ const HistoryInfo = (props) => { ...@@ -244,11 +262,7 @@ const HistoryInfo = (props) => {
)} )}
{timeValue === 'contrast' && ( // 同期对比 {timeValue === 'contrast' && ( // 同期对比
<> <>
<Select <Select value={contrastOption} style={{ width: 60 }} onChange={onContrastChange}>
defaultValue={contrastOption}
style={{ width: 60 }}
onChange={onContrastChange}
>
<Option value="day"></Option> <Option value="day"></Option>
<Option value="month"></Option> <Option value="month"></Option>
</Select> </Select>
...@@ -390,6 +404,38 @@ const HistoryInfo = (props) => { ...@@ -390,6 +404,38 @@ const HistoryInfo = (props) => {
}; };
} }
options.tooltip.formatter = function formatter() {
let _html = `<b>${Highcharts.dateFormat(
contrastOption === 'day' ? '%H:%M' : '%d %H:%M',
this.x,
)}</b><br/>`;
this.points.forEach((item) => {
_html += `<span style={{color: ${item.series.color}}}>${item.series.name}</span>:
<b>${
item.point.y.toFixed(
item.series.userOptions.decimalPoint ? item.series.userOptions.decimalPoint : 2,
) * 1
}${item.series.userOptions.tooltip.valueSuffix}</b>
<br/>`;
});
return _html;
};
if (container.current) {
if (container.current.offsetWidth !== 0) {
chartWidth = container.current.offsetWidth;
chartHeight = container.current.offsetHeight;
}
Highcharts.setOptions({
// 处理 chart 高度坍塌
chart: {
width: container.current.offsetWidth === 0 ? chartWidth : container.current.offsetWidth,
height:
container.current.offsetHeight === 0 ? chartHeight : container.current.offsetHeight,
},
});
}
return options; return options;
}; };
...@@ -450,11 +496,12 @@ const HistoryInfo = (props) => { ...@@ -450,11 +496,12 @@ const HistoryInfo = (props) => {
return ( return (
<div className={classNames(prefixCls)}> <div className={classNames(prefixCls)}>
<Tabs <Tabs
defaultActiveKey={TabPaneData[0].key} activeKey={activeTabKey}
centered centered
tabBarExtraContent={{ tabBarExtraContent={{
left: <h3 className="tabs-extra-demo-button">{title}</h3>, left: <h3 className="tabs-extra-demo-button">{title}</h3>,
}} }}
onChange={(key) => setActiveTabKey(key)}
> >
{TabPaneData.map((item) => ( {TabPaneData.map((item) => (
<TabPane tab={item.tab} key={item.key}> <TabPane tab={item.tab} key={item.key}>
...@@ -462,19 +509,24 @@ const HistoryInfo = (props) => { ...@@ -462,19 +509,24 @@ const HistoryInfo = (props) => {
{renderOptions(item)} {renderOptions(item)}
{!dataSource.length && <Empty />} {!dataSource.length && <Empty />}
{!!dataSource.length && ( {!!dataSource.length && (
<div> <div className={classNames(`${prefixCls}-wrap`)}>
<div className={classNames(`${prefixCls}-main`)}>
{item.key === 'curve' && ( {item.key === 'curve' && (
<div className={classNames(`${prefixCls}-chart`)} ref={container}>
<HighchartsReact <HighchartsReact
immutable={true} immutable={true}
highcharts={Highcharts} highcharts={Highcharts}
constructorType={'stockChart'} constructorType={'stockChart'}
options={handleChartOptions()} options={options}
allowChartUpdate={true}
/> />
</div>
)} )}
{item.key === 'table' && ( {item.key === 'table' && (
<BasicTable dataSource={dataSource} columns={columns} {...tableProps} /> <BasicTable dataSource={dataSource} columns={columns} {...tableProps} />
)} )}
</div> </div>
</div>
)} )}
</div> </div>
</TabPane> </TabPane>
...@@ -509,7 +561,7 @@ export default HistoryInfo; ...@@ -509,7 +561,7 @@ export default HistoryInfo;
const startFormat = 'YYYY-MM-DD 00:00:00'; const startFormat = 'YYYY-MM-DD 00:00:00';
const endFormat = 'YYYY-MM-DD 23:59:59'; const endFormat = 'YYYY-MM-DD 23:59:59';
const timeFormat = 'YYYY-MM-DD kk:mm:ss'; const timeFormat = 'YYYY-MM-DD HH:mm:ss';
const colors = [ const colors = [
'#1884EC', '#1884EC',
...@@ -564,21 +616,6 @@ const defaultOptions = { ...@@ -564,21 +616,6 @@ const defaultOptions = {
shared: true, shared: true,
split: false, split: false,
valueDecimals: 3, valueDecimals: 3,
formatter: function () {
let _html = `<b>${Highcharts.dateFormat('%Y/%m/%d %H:%M', this.x)}</b><br/>`;
this.points.forEach((item) => {
_html += `<span style={{color: ${item.series.color}}}>${item.series.name}</span>:
<b>${
item.point.y.toFixed(
item.series.userOptions.decimalPoint
? item.series.userOptions.decimalPoint
: 2,
) * 1
}${item.series.userOptions.tooltip.valueSuffix}</b>
<br/>`;
});
return _html;
},
}, },
plotOptions: { plotOptions: {
series: { series: {
...@@ -707,10 +744,10 @@ const timeIntervalList = [ ...@@ -707,10 +744,10 @@ const timeIntervalList = [
const DataPickerArr = [ const DataPickerArr = [
{ {
key: 1, key: 1,
value: '', value: moment(),
}, },
{ {
key: 2, key: 2,
value: '', value: moment().subtract(1, 'days'),
}, },
]; ];
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@history-info-prefix-cls: ~'@{ant-prefix}-history-info'; @history-info-prefix-cls: ~'@{ant-prefix}-history-info';
.@{history-info-prefix-cls} { .@{history-info-prefix-cls} {
height: 100%;
.ant-tabs,
.ant-tabs-content {
height: 100%;
}
&-content { &-content {
display: flex;
flex-direction: column;
height: 100%;
padding: 10px 0 0 0; padding: 10px 0 0 0;
} }
&-wrap {
flex: 1;
overflow: hidden;
}
&-main {
width: 100%;
max-width: 100%;
height: 100%;
max-height: 100%;
}
&-chart {
width: 100%;
height: 100%;
}
&-time { &-time {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -2,6 +2,33 @@ ...@@ -2,6 +2,33 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.12](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.8...@wisdom-components/imageselect@1.3.12) (2021-04-26)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
- update quotaselect ([2bdb602](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/2bdb602dc2349b12aad76d3561dd90adfb71e9f6))
## [1.3.11](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.10...@wisdom-components/imageselect@1.3.11) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update quotaselect ([2bdb602](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/2bdb602dc2349b12aad76d3561dd90adfb71e9f6))
## [1.3.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.8...@wisdom-components/imageselect@1.3.10) (2021-04-22)
### Bug Fixes
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.8...@wisdom-components/imageselect@1.3.9) (2021-04-22)
### Bug Fixes
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.3.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.5...@wisdom-components/imageselect@1.3.8) (2021-04-20) ## [1.3.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/imageselect@1.3.5...@wisdom-components/imageselect@1.3.8) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/imageselect`
> TODO: description
## Usage
```
const imageselect = require('@wisdom-components/imageselect');
// TODO: DEMONSTRATE API
```
{ {
"name": "@wisdom-components/imageselect", "name": "@wisdom-components/imageselect",
"version": "1.3.8", "version": "1.3.12",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: ImageSelect - 图片选择 title: ImageSelect - 图片选择
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
...@@ -2,7 +2,7 @@ import React, { useContext, useState } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useContext, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Input, Image, Modal, Row, Col, ConfigProvider } from 'antd'; import { Input, Image, Modal, Row, Col, ConfigProvider } from 'antd';
import Empty from '@wisdom-components/Empty'; import Empty from '@wisdom-components/empty';
import { PlusOutlined, SearchOutlined } from '@ant-design/icons'; import { PlusOutlined, SearchOutlined } from '@ant-design/icons';
import './index.less'; import './index.less';
...@@ -50,7 +50,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect }) ...@@ -50,7 +50,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect })
const renderImageList = (data = []) => { const renderImageList = (data = []) => {
return ( return (
<Row gutter={[0, 24]}> <Row gutter={[0, 12]}>
{!!data && {!!data &&
data.map((item, index) => ( data.map((item, index) => (
<Col <Col
...@@ -93,6 +93,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect }) ...@@ -93,6 +93,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect })
</div> </div>
)} )}
</div> </div>
{visible && (
<Modal <Modal
width={width} width={width}
centered centered
...@@ -111,7 +112,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect }) ...@@ -111,7 +112,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect })
</div> </div>
} }
footer={null} footer={null}
visible={visible} visible={true}
onCancel={handleCancel} onCancel={handleCancel}
className={classNames(`${prefixCls}-modal`)} className={classNames(`${prefixCls}-modal`)}
> >
...@@ -126,6 +127,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect }) ...@@ -126,6 +127,7 @@ const ImageSelect = ({ src, url, width, title, dataSource, onSearch, onSelect })
})} })}
{!imgList.length && <Empty />} {!imgList.length && <Empty />}
</Modal> </Modal>
)}
</div> </div>
); );
}; };
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@image-select-prefix-cls: ~'@{ant-prefix}-image-select'; @image-select-prefix-cls: ~'@{ant-prefix}-image-select';
.@{image-select-prefix-cls} { .@{image-select-prefix-cls} {
...@@ -80,8 +80,15 @@ ...@@ -80,8 +80,15 @@
} }
&-item-wrap { &-item-wrap {
padding: 10px 0;
text-align: center; text-align: center;
border: 1px solid transparent; border: 1px solid transparent;
&.selected {
background: linear-gradient(0deg, #f1f4fb 0%, #ffffff 100%);
border: 1px solid #b8d6fb;
border-radius: 2px;
}
} }
&-item-wrap:hover { &-item-wrap:hover {
...@@ -96,12 +103,6 @@ ...@@ -96,12 +103,6 @@
height: 40px; height: 40px;
} }
&.selected {
background: linear-gradient(0deg, #f1f4fb 0%, #ffffff 100%);
border: 1px solid #b8d6fb;
border-radius: 2px;
}
&-item-text { &-item-text {
font-size: 12px; font-size: 12px;
white-space: nowrap; white-space: nowrap;
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/mqttview@1.2.9...@wisdom-components/mqttview@1.2.10) (2021-04-26)
### Bug Fixes
- 修改 mqtt 连接配置 ([6c886a0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/6c886a0d148ff89c915ab48e4adf2afbc7dd455c))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.2.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/mqttview@1.2.7...@wisdom-components/mqttview@1.2.9) (2021-04-20) ## [1.2.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/mqttview@1.2.7...@wisdom-components/mqttview@1.2.9) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/MqttView` # `@wisdom-components/mqttview`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const mqttView = require('@wisdom-components/MqttView'); const mqttView = require('@wisdom-components/mqttview');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
'use strict'; 'use strict';
const mqttView = require('..'); const mqttView = require('../lib');
describe('@wisdom-components/MqttView', () => { describe('@wisdom-extend-components/MqttView', () => {
it('needs tests'); it('needs tests');
}); });
{ {
"name": "@wisdom-components/mqttview", "name": "@wisdom-components/mqttview",
"version": "1.2.9", "version": "1.2.10",
"description": "> TODO: description", "description": "> TODO: description",
"author": "lijiwen <961370825@qq.com>", "author": "lijiwen <961370825@qq.com>",
"homepage": "", "homepage": "",
"license": "ISC", "license": "ISC",
"main": "lib/MqttView.js", "main": "lib/index.js",
"directories": { "directories": {
"lib": "lib", "lib": "lib",
"test": "__tests__" "test": "__tests__"
......
--- ---
title: MqttView - Mqtt连接 title: MqttView - Mqtt连接
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
...@@ -47,7 +47,6 @@ class MqttView { ...@@ -47,7 +47,6 @@ class MqttView {
}; };
//注册连接断开处理事件 //注册连接断开处理事件
this.saveWaClient.onConnectionLost = this.onSaveWaConnectionLost.bind(this); this.saveWaClient.onConnectionLost = this.onSaveWaConnectionLost.bind(this);
//注册消息接收处理事件 //注册消息接收处理事件
this.saveWaClient.onMessageArrived = this.onSaveWaMessageArrived.bind(this); this.saveWaClient.onMessageArrived = this.onSaveWaMessageArrived.bind(this);
this.saveWaClient.connect(this.saveWaOptions); this.saveWaClient.connect(this.saveWaOptions);
......
--- ---
title: ParseForm - 台账解析 title: ParseForm - 台账解析
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
...@@ -2,6 +2,48 @@ ...@@ -2,6 +2,48 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.2...@wisdom-components/quotaselect@1.7.8) (2021-04-26)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
- update quotaselect ([2bdb602](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/2bdb602dc2349b12aad76d3561dd90adfb71e9f6))
## [1.7.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.6...@wisdom-components/quotaselect@1.7.7) (2021-04-22)
### Bug Fixes
- update package ([403ae9d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/403ae9d9e5cec67084343cdbfc06370ee07b1681))
- update quotaselect ([2bdb602](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/2bdb602dc2349b12aad76d3561dd90adfb71e9f6))
## [1.7.6](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.2...@wisdom-components/quotaselect@1.7.6) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.7.5](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.2...@wisdom-components/quotaselect@1.7.5) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
- update package ([f0b3401](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f0b34012654a1a9af9d20f72589b78671cb231a0))
## [1.7.4](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.2...@wisdom-components/quotaselect@1.7.4) (2021-04-22)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
## [1.7.3](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.7.2...@wisdom-components/quotaselect@1.7.3) (2021-04-21)
### Bug Fixes
- bug ([9f4ef61](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9f4ef61f7016acbc1992e37ba1ffeda66517022d))
## [1.7.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.6.0...@wisdom-components/quotaselect@1.7.2) (2021-04-20) ## [1.7.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/quotaselect@1.6.0...@wisdom-components/quotaselect@1.7.2) (2021-04-20)
### Bug Fixes ### Bug Fixes
......
# `@wisdom-components/quotaselect`
> TODO: description
## Usage
```
const quotaselect = require('@wisdom-components/quotaselect');
// TODO: DEMONSTRATE API
```
{ {
"name": "@wisdom-components/quotaselect", "name": "@wisdom-components/quotaselect",
"version": "1.7.2", "version": "1.7.8",
"description": "> TODO: description", "description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>", "author": "tuqian <webtuqian@163.com>",
"homepage": "", "homepage": "",
......
--- ---
title: QuotaSelect - 指标选择 title: QuotaSelect - 指标选择
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
...@@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Button, Input, Radio, Modal, Checkbox, Row, Col, Tree, ConfigProvider } from 'antd'; import { Button, Input, Radio, Modal, Checkbox, Row, Col, Tree, ConfigProvider } from 'antd';
import Empty from '@wisdom-components/Empty'; import Empty from '@wisdom-components/empty';
import { ExclamationCircleFilled, SearchOutlined, CloseOutlined } from '@ant-design/icons'; import { ExclamationCircleFilled, SearchOutlined, CloseOutlined } from '@ant-design/icons';
import './index.less'; import './index.less';
...@@ -40,8 +40,8 @@ const QuotaSelect = ({ ...@@ -40,8 +40,8 @@ const QuotaSelect = ({
let data = dataSource.map((item) => ({ let data = dataSource.map((item) => ({
...item, ...item,
checked: false, checked: false,
title: item.Name, title: item.name,
key: item.Name, key: item.name,
})); }));
setAllQuotaList(data); setAllQuotaList(data);
} }
...@@ -71,7 +71,7 @@ const QuotaSelect = ({ ...@@ -71,7 +71,7 @@ const QuotaSelect = ({
// 过滤重点指标 // 过滤重点指标
const filterEmphasisQuota = () => { const filterEmphasisQuota = () => {
let newQuotaList = [...allQuotaList]; let newQuotaList = [...allQuotaList];
newQuotaList = newQuotaList.filter((item) => item.IsShow === '1'); newQuotaList = newQuotaList.filter((item) => item.isShow === '1');
setQuotaList(newQuotaList); setQuotaList(newQuotaList);
}; };
...@@ -111,7 +111,7 @@ const QuotaSelect = ({ ...@@ -111,7 +111,7 @@ const QuotaSelect = ({
if (e.target.value !== '') { if (e.target.value !== '') {
let newQuotaList = []; let newQuotaList = [];
quotaList.forEach((item) => { quotaList.forEach((item) => {
if (item.Name.indexOf(e.target.value) > -1) newQuotaList.push(item); if (item.name.indexOf(e.target.value) > -1) newQuotaList.push(item);
}); });
setQuotaList(newQuotaList); setQuotaList(newQuotaList);
} else { } else {
...@@ -221,13 +221,14 @@ const QuotaSelect = ({ ...@@ -221,13 +221,14 @@ const QuotaSelect = ({
return ( return (
<div className={classNames(prefixCls)}> <div className={classNames(prefixCls)}>
<Button {...buttonProps} onClick={showModal} /> <Button {...buttonProps} onClick={showModal} />
{visible && (
<Modal <Modal
centered centered
width={width} width={width}
title={title} title={title}
cancelText={cancelText} cancelText={cancelText}
okText={okText} okText={okText}
visible={visible} visible={true}
onCancel={handleCancel} onCancel={handleCancel}
onOk={onOk} onOk={onOk}
className={classNames(`${prefixCls}-modal`)} className={classNames(`${prefixCls}-modal`)}
...@@ -312,6 +313,7 @@ const QuotaSelect = ({ ...@@ -312,6 +313,7 @@ const QuotaSelect = ({
</div> </div>
</div> </div>
</Modal> </Modal>
)}
</div> </div>
); );
}; };
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@quota-select-prefix-cls: ~'@{ant-prefix}-quota-select'; @quota-select-prefix-cls: ~'@{ant-prefix}-quota-select';
.@{quota-select-prefix-cls} { .@{quota-select-prefix-cls} {
......
# `@wisdom-components/RealTimeInfo` # `@wisdom-components/realtimeinfo`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const realtimeinfo = require('@wisdom-components/RealTimeInfo'); const realtimeinfo = require('@wisdom-components/realtimeinfo');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
--- ---
title: RealTimeInfo - 实时数据查看 title: RealTimeInfo - 实时数据查看
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@realtime-info-prefix-cls: ~'@{ant-prefix}-realtime-info'; @realtime-info-prefix-cls: ~'@{ant-prefix}-realtime-info';
.@{realtime-info-prefix-cls} { .@{realtime-info-prefix-cls} {
......
# `@wisdom-components/TimeRangePicker` # `@wisdom-components/timerangepicker`
> TODO: description > TODO: description
## Usage ## Usage
``` ```
const timeRangePicker = require('@wisdom-components/TimeRangePicker'); const timeRangePicker = require('@wisdom-components/timerangepicker');
// TODO: DEMONSTRATE API // TODO: DEMONSTRATE API
``` ```
--- ---
title: TimeRangePicker - 自定义类型时间选择 title: TimeRangePicker - 自定义类型时间选择
nav: nav:
title: 组件 title: 基础组件
path: /components path: /components
group: group:
path: / path: /
......
@import (reference) '~antd/es/style/themes/default'; @import (reference) '../../../../node_modules/antd/es/style/themes/default';
@time-range-picker-prefix-cls: ~'@{ant-prefix}-time-range-picker'; @time-range-picker-prefix-cls: ~'@{ant-prefix}-time-range-picker';
.@{time-range-picker-prefix-cls} { .@{time-range-picker-prefix-cls} {
......
# `@wisdom-components/ec-devicetree`
> TODO: description
## Usage
```
const ECDeviceTree = require('@wisdom-components/ec-devicetree');
// TODO: DEMONSTRATE API
```
{
"name": "@wisdom-components/ec-devicetree",
"version": "1.0.0",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
"license": "ISC",
"main": "lib/index.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"publishConfig": {
"registry": "https://g.civnet.cn:4873/"
},
"repository": {
"type": "git",
"url": "https://g.civnet.cn:8443/ReactWeb5/wisdom-components.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
}
}
---
title: EC-DeviceTree - 设备树
nav:
title: 业务组件
path: /extend-components
group:
path: /
---
# EC-DeviceTree 设备树
基础业务组件
- 允许单设备选择
- 允许多设备选择
- 允许搜索设备树
## 何时使用
- 在设备树选择时。
## 代码演示
<code src="./demos/Basic.tsx">
## API
api 参考 Antd Tree 组件 https://ant.design/components/tree-cn/
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| prefix | 搜索框的前置图标 | ReactNode | 搜索 icon |
| placeholder | 搜索框占位符 | string | 搜索设备名称 |
| checkable | 节点前添加 Checkbox 复选框 | boolean | false |
| serviceParams | 服务参数 | object | { pageIndex: 1, pageSize: 500, deviceTypes: '二供泵房,二供机组', getChild: true, userID: 1, queryInfo: '', sortFields: '', direction: '', isTop: true } |
| deviceTreeService `必需` | 设备树服务 | promise | - |
| onTreeCheck | 点击复选框触发 | function(checkedNodes){ } | - |
| onTreeSelect | 点击树节点触发 | function(selectedNodes){ } | - |
import React from 'react';
import PandaDeviceTree from '../index';
import { service } from '@wisdom-utils/utils';
const REQUEST_HTTP = 'http';
const REQUEST_METHOD_POST = 'post';
const GET_DEVICE_LIST =
'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/Monitor/Device/DeviceTree'; //获取设备树列表
const deviceTreeService = {
getDeviceList: {
url: GET_DEVICE_LIST,
method: REQUEST_METHOD_POST,
type: REQUEST_HTTP,
},
};
const dtService = service(deviceTreeService);
const getDeviceList = dtService.getDeviceList;
const Demo = () => {
const onTreeCheck = (checkedKeysValue) => {
console.log('onTreeCheck', checkedKeysValue);
};
const onTreeSelect = (selectedKeysValue) => {
console.log('onTreeSelect', selectedKeysValue);
};
return (
<div style={{ width: '200px', height: '400px', border: '1px solid #eee' }}>
<PandaDeviceTree
checkable
onTreeCheck={onTreeCheck}
onTreeSelect={onTreeSelect}
deviceTreeService={getDeviceList}
serviceParams={
{
// pageIndex: 1,
// pageSize: 20,
// deviceTypes: '二供泵房,二供机组',
// getChild: true,
// userID: 1,
// queryInfo: '',
// sortFields: '',
// direction: '',
// isTop: true,
}
}
/>
</div>
);
};
export default Demo;
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Input, Tree, Divider, message, ConfigProvider } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import Empty from '@wisdom-components/empty';
import './index.less';
const DeviceTree = (props) => {
const {
prefix,
placeholder,
deviceTreeService,
serviceParams,
onTreeCheck,
onTreeSelect,
} = props;
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('ec-device-tree');
const [treeData, setTreeData] = useState([]);
const [params, setParams] = useState({});
useEffect(() => {
const param = {
pageIndex: serviceParams.pageIndex || 1,
pageSize: serviceParams.pageSize || 500,
deviceTypes: serviceParams.deviceTypes || '二供泵房,二供机组',
getChild: serviceParams.getChild || true,
userID: serviceParams.userID || 1,
queryInfo: serviceParams.queryInfo || '',
sortFields: serviceParams.sortFields || '',
direction: serviceParams.direction || '',
isTop: serviceParams.isTop || true,
};
setParams(param);
}, []);
const handleData = (data) => {
data.forEach((item) => {
item.title = item.DeviceName;
item.key = item.StationID;
item.children = handleData(item.children);
});
return data;
};
const fetchData = (param = {}) => {
deviceTreeService(param).then((response) => {
if (response.code === 0) {
const data = response.data
? response.data.list && response.data.list.length > 0
? response.data.list[0].DeviceList
: []
: [];
setTreeData(handleData(data));
} else {
message.error(response.msg);
}
});
};
useEffect(() => {
if (JSON.stringify(params) !== '{}') {
fetchData(params);
}
}, [params]);
const onSearch = (e) => {
if (e.type === 'keydown' || e.target.value === '') {
const param = { ...params, queryInfo: e.target.value };
setParams(param);
}
};
// 选中复选框
const onCheck = (checkedKeysValue) => {
const checkedTree = [];
treeData.forEach((item) => {
if (checkedKeysValue.includes(item.key)) {
checkedTree.push(item);
}
if (item.children.length > 0) {
item.children.forEach((child) => {
if (checkedKeysValue.includes(child.key)) {
checkedTree.push(child);
}
});
}
});
onTreeCheck(checkedTree);
};
const onSelect = (selectedKeysValue, info) => {
onTreeSelect(info.selectedNodes);
};
return (
<div className={classNames(prefixCls)}>
<Input
prefix={prefix}
placeholder={placeholder}
bordered={false}
onChange={onSearch}
onPressEnter={onSearch}
/>
<Divider />
<div className={classNames(`${prefixCls}-content`)}>
{!!treeData.length && (
<Tree treeData={treeData} onCheck={onCheck} onSelect={onSelect} {...props} />
)}
{!treeData.length && <Empty />}
</div>
</div>
);
};
DeviceTree.defaultProps = {
prefix: <SearchOutlined />,
placeholder: '搜索设备名称',
serviceParams: {},
onTreeCheck: () => {},
onTreeSelect: () => {},
deviceTreeService: () => {},
};
DeviceTree.propTypes = {
prefix: PropTypes.node,
placeholder: PropTypes.string,
serviceParams: PropTypes.object,
onTreeCheck: PropTypes.func,
onTreeSelect: PropTypes.func,
deviceTreeService: PropTypes.func,
};
export default DeviceTree;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment