fix: 添加slave包
This commit is contained in:
parent
57f54b7164
commit
bc5a281a50
@ -6,6 +6,10 @@
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
#root .dumi-default-header-content {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
#root .dumi-default-header {
|
||||
box-shadow: 2px 1px 16px #dfdfdf;
|
||||
}
|
||||
|
23
.dumirc.ts
23
.dumirc.ts
@ -9,15 +9,6 @@ export default defineConfig({
|
||||
socialLinks: {
|
||||
gitlab: 'http://10.0.0.88/web-project/zhst-Lambo',
|
||||
},
|
||||
nav: {
|
||||
mode: 'append',
|
||||
value: [
|
||||
{
|
||||
title: '智能柜物料库→',
|
||||
link: 'http://10.0.0.222:30098',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
alias: {
|
||||
'@zhst/hooks': path.join(__dirname, 'packages/hooks/src'),
|
||||
@ -25,17 +16,21 @@ export default defineConfig({
|
||||
'@zhst/biz': path.join(__dirname, 'packages/biz/src'),
|
||||
'@zhst/meta': path.join(__dirname, 'packages/meta/src'),
|
||||
'@zhst/request': path.join(__dirname, 'packages/request/src'),
|
||||
'@zhst/slave': path.join(__dirname, 'packages/slave/src'),
|
||||
'@zhst/material': path.join(__dirname, 'packages/material/src'),
|
||||
},
|
||||
resolve: {
|
||||
docDirs: ['docs'],
|
||||
atomDirs: [
|
||||
{ type: 'hooks', dir: 'packages/hooks/src' },
|
||||
{ type: 'utils', dir: 'packages/func/src' },
|
||||
{ type: 'biz', dir: 'packages/biz/src' },
|
||||
{ type: 'meta', dir: 'packages/meta/src' },
|
||||
{ type: 'request', dir: 'packages/request/src' },
|
||||
{ type: 'constants', dir: 'packages/constants/src' },
|
||||
{ type: 'types', dir: 'packages/types/src' },
|
||||
{ type: 'module', subType: 'biz', dir: 'packages/biz/src' },
|
||||
{ type: 'module', subType: 'meta', dir: 'packages/meta/src' },
|
||||
{ type: 'other', subType: 'request', dir: 'packages/request/src' },
|
||||
{ type: 'other', subType: 'constants', dir: 'packages/constants/src' },
|
||||
{ type: 'other', subType: 'types', dir: 'packages/types/src' },
|
||||
{ type: 'slave', dir: 'packages/slave/src' },
|
||||
{ type: 'material', dir: 'packages/material/src' },
|
||||
],
|
||||
},
|
||||
monorepoRedirect: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"add": "pnpm changeset add",
|
||||
"build": "pnpm --filter=@zhst/* run build",
|
||||
"build:master": "dumi build",
|
||||
"build:watch": "father dev",
|
||||
"dev": "dumi dev",
|
||||
"docs:build": "dumi build",
|
||||
@ -22,6 +22,7 @@
|
||||
"lint": "npm run lint:es && npm run lint:css",
|
||||
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
||||
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
||||
"pkg:build": "pnpm --filter=@zhst/* run build",
|
||||
"prepare": "husky install && dumi setup",
|
||||
"prepublishOnly": "father doctor && npm run build",
|
||||
"pub": "pnpm changeset publish",
|
||||
@ -50,7 +51,10 @@
|
||||
"prettier --parser=typescript --write"
|
||||
]
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"@zhst/slave": "workspace:^",
|
||||
"antd": "^5.13.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.27.1",
|
||||
"@commitlint/cli": "^17.1.2",
|
||||
|
@ -1,5 +1,43 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.10.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.8
|
||||
- @zhst/func@0.8.3
|
||||
- @zhst/meta@0.9.5
|
||||
|
||||
## 0.10.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料包
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.7
|
||||
- @zhst/func@0.8.2
|
||||
- @zhst/meta@0.9.4
|
||||
|
||||
## 0.10.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.1
|
||||
- @zhst/hooks@0.8.6
|
||||
- @zhst/meta@0.9.3
|
||||
|
||||
## 0.10.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.0
|
||||
- @zhst/hooks@0.8.5
|
||||
- @zhst/meta@0.9.2
|
||||
|
||||
## 0.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/biz",
|
||||
"version": "0.10.1",
|
||||
"version": "0.10.5",
|
||||
"description": "业务库",
|
||||
"keywords": [
|
||||
"business",
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 进阶组件
|
||||
category: Components
|
||||
subtitle: 大图预览组件
|
||||
toc: content
|
||||
title: BigImagePreview 大图预览组件
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
group: 数据展示
|
||||
category: Components
|
||||
toc: content
|
||||
subtitle: 实时监控页面
|
||||
title: RealTimeMonitor 实时监控页面
|
||||
---
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 数据展示
|
||||
category: Components
|
||||
subtitle: 视频播放卡片
|
||||
toc: content
|
||||
title: VideoPlayerCard 视频播放卡片
|
||||
---
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 数据展示
|
||||
category: Components
|
||||
subtitle: 查看大图弹窗
|
||||
toc: content
|
||||
title: ViewLargerImageModal 查看大图弹窗
|
||||
---
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
---
|
||||
category: Components
|
||||
title: BoxSelectTree 盒子树
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
toc: content
|
||||
group:
|
||||
title: 进阶组件
|
||||
order: 2
|
||||
|
@ -1,8 +1,10 @@
|
||||
---
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 版本更新日志
|
||||
order: 99
|
||||
title: 组件库
|
||||
title: 业务组件
|
||||
toc: content
|
||||
---
|
||||
|
||||
<embed src="../../README.md" ></embed>
|
||||
|
||||
<embed src="../../CHANGELOG.md" ></embed>
|
||||
|
@ -1,8 +1,10 @@
|
||||
---
|
||||
category: Components
|
||||
title: Tree 树
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
toc: content
|
||||
group:
|
||||
title: 数据展示
|
||||
order: 2
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
title: TreeTransfer 树穿梭框
|
||||
toc: content
|
||||
group:
|
||||
title: 数据展示
|
||||
order: 2
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
title: TreeTransferModal 树穿梭框弹框
|
||||
toc: content
|
||||
group:
|
||||
title: 数据展示
|
||||
order: 2
|
||||
|
@ -1,5 +1,17 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
|
||||
## 0.6.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料包
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/constants",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.2",
|
||||
"description": "常量库",
|
||||
"keywords": [
|
||||
"constants",
|
||||
|
@ -1,8 +1,11 @@
|
||||
---
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 版本更新日志
|
||||
order: 99
|
||||
title: 其它
|
||||
title: 静态变量库
|
||||
toc: content
|
||||
---
|
||||
|
||||
|
||||
<embed src="../../README.md" ></embed>
|
||||
|
||||
<embed src="../../CHANGELOG.md" ></embed>
|
||||
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
nav:
|
||||
title: 其它
|
||||
order: 1
|
||||
title: 快速上手
|
||||
---
|
||||
|
||||
<embed src="../README.md" ></embed>
|
@ -1,5 +1,38 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.8.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
- Updated dependencies
|
||||
- @zhst/request@0.8.8
|
||||
|
||||
## 0.8.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料包
|
||||
- Updated dependencies
|
||||
- @zhst/request@0.8.7
|
||||
|
||||
## 0.8.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 修改 getValueByUrl 判断逻辑
|
||||
- @zhst/request@0.8.6
|
||||
|
||||
## 0.8.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- func 包添加 getValueByUrl 方法
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @zhst/request@0.8.5
|
||||
|
||||
## 0.7.5
|
||||
|
||||
### Patch Changes
|
||||
|
@ -42,4 +42,33 @@ export var cutStr = function cutstr(str, len) {
|
||||
if (str_length < len) {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 查看字符串是否为可访问链接
|
||||
* @param str 待检查链接
|
||||
* @returns
|
||||
*/
|
||||
export var isUrl = function isUrl(str) {
|
||||
try {
|
||||
new URL(str);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过url获取值
|
||||
* @param key 想要获取的值
|
||||
* @param url 需要截取的链接
|
||||
*/
|
||||
export var getValueByUrl = function getValueByUrl(key, str) {
|
||||
var result = null;
|
||||
if (isUrl(str)) {
|
||||
result = new URL(str).searchParams.get(key);
|
||||
} else {
|
||||
result = new URLSearchParams(str.indexOf('?') > -1 ? str : "?".concat(str)).get(key);
|
||||
}
|
||||
return result;
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/func",
|
||||
"version": "0.7.5",
|
||||
"version": "0.8.3",
|
||||
"description": "函数合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
@ -49,7 +49,6 @@
|
||||
"@types/base-64": "^1.0.2",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/zhst": "workspace:^"
|
||||
"@types/uuid": "^9.0.7"
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 版本更新日志
|
||||
toc: content
|
||||
order: 99
|
||||
---
|
||||
|
||||
|
28
packages/func/src/string/demo/getValueByUrl.tsx
Normal file
28
packages/func/src/string/demo/getValueByUrl.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Created by jiangzhixiong on 2024/03/20
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react'
|
||||
import { getValueByUrl } from '@zhst/func'
|
||||
|
||||
const demo = () => {
|
||||
const [inputVal, setInputVal ] = useState<any>(null)
|
||||
const [outputVal, setOutPutVal ] = useState<any>(null)
|
||||
|
||||
const handleClick = () => {
|
||||
let val = getValueByUrl('to', inputVal)
|
||||
setOutPutVal(val)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<input value={inputVal} onChange={e => setInputVal(e.target.value)} />
|
||||
<button onClick={handleClick} >提交</button>
|
||||
<p>输出:{outputVal}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default demo
|
26
packages/func/src/string/index.md
Normal file
26
packages/func/src/string/index.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
nav:
|
||||
title: func
|
||||
order: 3
|
||||
title: 字符串相关
|
||||
toc: content
|
||||
---
|
||||
|
||||
## 代码演示
|
||||
|
||||
## getValueByUrl
|
||||
|
||||
通过 url 返回想要的参数
|
||||
|
||||
```js
|
||||
import { getValueByUrl } from '@zhst/func'
|
||||
|
||||
const value = getValueByUrl('a', 'http://localhost:30058?a=123&token=asdfasdfsdf')
|
||||
// --> 123
|
||||
const value2 = getValueByUrl('a', '?a=123&token=asdfasdfsdf')
|
||||
// --> 123
|
||||
const value3 = getValueByUrl('a', 'a=123&token=asdfasdfsdf')
|
||||
// --> 123
|
||||
```
|
||||
|
||||
<code src="./demo/getValueByUrl.tsx" debug>调试台</code>
|
@ -47,3 +47,34 @@ export const cutStr = function cutstr(str: string, len: number) {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 查看字符串是否为可访问链接
|
||||
* @param str 待检查链接
|
||||
* @returns
|
||||
*/
|
||||
export const isUrl = (str: string) => {
|
||||
try {
|
||||
new URL(str);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过url获取值
|
||||
* @param key 想要获取的值
|
||||
* @param url 需要截取的链接
|
||||
*/
|
||||
export const getValueByUrl = (key: string, str: string) => {
|
||||
let result = null
|
||||
|
||||
if (isUrl(str)) {
|
||||
result = new URL(str).searchParams.get(key)
|
||||
} else {
|
||||
result = new URLSearchParams(str.indexOf('?') > -1 ? str : `?${str}`).get(key)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
6
packages/func/src/time/index.md
Normal file
6
packages/func/src/time/index.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
nav:
|
||||
title: func
|
||||
title: 时间相关
|
||||
order: 4
|
||||
---
|
@ -1,5 +1,35 @@
|
||||
# @zhst/hooks
|
||||
|
||||
## 0.8.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.3
|
||||
|
||||
## 0.8.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料包
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.2
|
||||
|
||||
## 0.8.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.1
|
||||
|
||||
## 0.8.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.0
|
||||
|
||||
## 0.8.4
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/hooks",
|
||||
"version": "0.8.4",
|
||||
"version": "0.8.8",
|
||||
"description": "hooks合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
@ -36,9 +36,7 @@
|
||||
"access": "public",
|
||||
"registry": "http://10.0.0.77:4874"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/zhst": "workspace:^"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"@zhst/func": "workspace:^",
|
||||
"ahooks": "^3.7.8",
|
||||
|
@ -2,6 +2,7 @@
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 版本更新日志
|
||||
toc: content
|
||||
order: 99
|
||||
---
|
||||
|
||||
|
13
packages/material/.fatherrc.ts
Normal file
13
packages/material/.fatherrc.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { defineConfig } from 'father';
|
||||
|
||||
export default defineConfig({
|
||||
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
|
||||
esm: {
|
||||
output: 'es',
|
||||
ignores: ['**/demo/*', 'src/**/demo/*']
|
||||
},
|
||||
cjs: {
|
||||
output: 'lib',
|
||||
ignores: ['**/demo/*', 'src/**/demo/*']
|
||||
},
|
||||
});
|
52
packages/material/CHANGELOG.md
Normal file
52
packages/material/CHANGELOG.md
Normal file
@ -0,0 +1,52 @@
|
||||
# @zhst/material
|
||||
|
||||
## 0.7.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 初始化物料库
|
||||
|
||||
## 0.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.8
|
||||
- @zhst/func@0.8.3
|
||||
- @zhst/meta@0.9.5
|
||||
- @zhst/biz@0.10.5
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.7
|
||||
- @zhst/func@0.8.2
|
||||
- @zhst/meta@0.9.4
|
||||
- @zhst/biz@0.10.4
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 新增登录与修改密码模块
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 优化单个算法配置绘制方法
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 添加批量算法配置模块
|
16
packages/material/README.md
Normal file
16
packages/material/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
## 介绍
|
||||
|
||||
基于 lambo 的物料库
|
||||
|
||||
## 安装
|
||||
|
||||
> pnpm install @zhst/material
|
||||
|
||||
## 使用
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import { Login } from '@zhst/material'
|
||||
|
||||
export () => <Login />
|
||||
```
|
48
packages/material/package.json
Normal file
48
packages/material/package.json
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@zhst/material",
|
||||
"version": "0.7.0",
|
||||
"description": "物料库",
|
||||
"keywords": [
|
||||
"business",
|
||||
"biz",
|
||||
"zhst"
|
||||
],
|
||||
"license": "ISC",
|
||||
"author": "dev",
|
||||
"sideEffects": [
|
||||
"dist/*",
|
||||
"es/**/style/*",
|
||||
"lib/**/style/*",
|
||||
"*.less"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./es/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"es",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "father build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "http://10.0.0.77:4874"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@ant-design/pro-components": "^2.6.49",
|
||||
"@zhst/biz": "workspace:^",
|
||||
"@zhst/func": "workspace:^",
|
||||
"@zhst/hooks": "workspace:^",
|
||||
"@zhst/meta": "workspace:^",
|
||||
"antd": "^5.14.2",
|
||||
"classnames": "^2.5.1",
|
||||
"rc-util": "^5.38.1"
|
||||
}
|
||||
}
|
176
packages/material/src/algorithmConfig/algorithmConfig.tsx
Normal file
176
packages/material/src/algorithmConfig/algorithmConfig.tsx
Normal file
@ -0,0 +1,176 @@
|
||||
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
||||
import { Flex, Image } from "antd";
|
||||
import theme from 'antd/es/theme'
|
||||
import { BigImagePreview } from '@zhst/meta'
|
||||
import type { ImgViewRef } from '@zhst/meta'
|
||||
import { AlgorithmConfigImg, ErrorImage } from '../utils/base64Images'
|
||||
import AlgorithmTable from './components/algorithmTable'
|
||||
import TimeTemplateTable from './components/timeTemplateTable';
|
||||
import { AlgorithmTableProps } from './components/algorithmTable/AlgorithmTable';
|
||||
import { TimeTemplateTableProps } from './components/timeTemplateTable/TimeTemplateTable';
|
||||
|
||||
const { useToken } = theme
|
||||
|
||||
const Title = (props: any) => <h2 style={{ margin: '18px 16px', fontSize: '14px', color: 'rgba(0, 0, 0, 0.88)' }} >{props.children}</h2>
|
||||
|
||||
export interface AlgorithmConfigProps {
|
||||
onAddAlgorithm?: () => void
|
||||
/**
|
||||
* 单选的图片数据
|
||||
*/
|
||||
drawData?: {
|
||||
imageKey: string
|
||||
odRect?: {
|
||||
x: number
|
||||
y: number
|
||||
w: number
|
||||
h: number
|
||||
}
|
||||
score?: string
|
||||
time?: string
|
||||
}
|
||||
/**
|
||||
* 单选状态圈选后的监听事件
|
||||
*/
|
||||
drawListener?: (data: any) => void;
|
||||
algorithmTableDataSource?: {
|
||||
id: string;
|
||||
// 模板名称
|
||||
templateName: string;
|
||||
// 运行周期
|
||||
operatingCycle: string;
|
||||
// 算力占用
|
||||
algorithmOccupied: number;
|
||||
}[];
|
||||
timeTemplateDataSource?: {
|
||||
id: string;
|
||||
templateName: string;
|
||||
operatingCycle: string;
|
||||
arrangeWeek: string;
|
||||
algorithmOccupied: string;
|
||||
}[]
|
||||
boxList: {
|
||||
id: string;
|
||||
name: string;
|
||||
}[]
|
||||
algorithmTableProps?: AlgorithmTableProps<any>
|
||||
timeTemplateTableProps?: TimeTemplateTableProps<any>
|
||||
selectedKey?: string
|
||||
rowKey?: string
|
||||
type: AlgorithmTableProps<any>['tableType']
|
||||
onSelect?: (key: string, info?: any) => void
|
||||
}
|
||||
|
||||
export interface AlgorithmConfigRef {
|
||||
draw: () => void;
|
||||
cancelDraw: () => void;
|
||||
}
|
||||
|
||||
const AlgorithmConfig = forwardRef<AlgorithmConfigRef, AlgorithmConfigProps>((props, ref) => {
|
||||
const {
|
||||
algorithmTableDataSource = [],
|
||||
timeTemplateDataSource = [],
|
||||
boxList = [],
|
||||
drawData,
|
||||
drawListener,
|
||||
algorithmTableProps,
|
||||
timeTemplateTableProps,
|
||||
selectedKey,
|
||||
type = 'multiple',
|
||||
rowKey = 'id',
|
||||
onSelect
|
||||
} = props
|
||||
const drawImageRef = useRef<ImgViewRef>(null)
|
||||
const { token } = useToken()
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
draw: () => {
|
||||
drawImageRef.current?.setShowCrop(true)
|
||||
},
|
||||
cancelDraw: () => {
|
||||
drawImageRef.current?.setShowCrop(false)
|
||||
},
|
||||
}))
|
||||
|
||||
return (
|
||||
<Flex style={{ border: `1px solid ${token.colorBorder}`, backgroundColor: token.colorBgBase }}>
|
||||
<div title="盒子列表" style={{ width: '13.9%' }}>
|
||||
<Title>盒子列表</Title>
|
||||
<div style={{ borderTop: `1px solid ${token.colorBorder}` }}>
|
||||
{boxList.map(item => {
|
||||
return (
|
||||
<p
|
||||
key={item.id}
|
||||
onClick={() => onSelect?.(item.id, item)}
|
||||
style={{
|
||||
margin: 0,
|
||||
padding: `${token.paddingXXS}px ${token.paddingLG}px`,
|
||||
cursor: 'pointer',
|
||||
// @ts-ignore
|
||||
color: selectedKey === item[rowKey] ? token.colorPrimary : token.colorText,
|
||||
// @ts-ignore
|
||||
backgroundColor: selectedKey === item[rowKey] ? token.blue1 : token.colorBgBase,
|
||||
transition: '0.2s ease'
|
||||
}}
|
||||
>{item.name}</p>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ boxSizing: 'border-box', width: '46.3%', textAlign: 'center', borderLeft: `1px solid ${token.colorBorder}`, borderRight: `1px solid ${token.colorBorder}` }}>
|
||||
{type === 'single' ? (
|
||||
<BigImagePreview
|
||||
ref={drawImageRef}
|
||||
hideTypeBtns
|
||||
type="CUSTOM"
|
||||
screenshotButtonRender={() => <></>}
|
||||
// @ts-ignore
|
||||
data={drawData}
|
||||
onDraw={drawListener}
|
||||
/>
|
||||
) : (
|
||||
<div style={{ padding: '84px' }}>
|
||||
<Image
|
||||
width={'62.5%'}
|
||||
src={AlgorithmConfigImg}
|
||||
preview={false}
|
||||
fallback={ErrorImage}
|
||||
/>
|
||||
<h2>请进行批量配置</h2>
|
||||
<ul style={{ display: 'inline-block', paddingLeft: 0, width: '51.8%', listStyle: 'none', textAlign: 'left', color: token.colorTextLabel }}>
|
||||
<li>· 盒子批量配置仅支持同型号盒子;</li>
|
||||
<li>· 采取覆盖式更新,不保留原有配置,且预警检测框默认全屏范围;</li>
|
||||
<li>· 人流量统计默认检测线为屏幕中央横向线条,且箭头指向下方;</li>
|
||||
<li>· 优先选择拉流正常的摄像头。</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<div style={{ width: '39.8%' }} >
|
||||
<div>
|
||||
<Title>时间模板</Title>
|
||||
<div style={{ padding: `${token.paddingMD}px ${token.paddingSM}px`, borderTop: `1px solid ${token.colorBorder}`, borderBottom: `1px solid ${token.colorBorder}` }}>
|
||||
<TimeTemplateTable
|
||||
dataSource={timeTemplateDataSource}
|
||||
{...timeTemplateTableProps}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Title>算法应用</Title>
|
||||
<div style={{ padding: `${token.paddingMD}px ${token.paddingSM}px`, borderTop: `1px solid ${token.colorBorder}` }}>
|
||||
<AlgorithmTable
|
||||
dataSource={algorithmTableDataSource}
|
||||
tableType={type}
|
||||
{...algorithmTableProps}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Flex>
|
||||
);
|
||||
});
|
||||
|
||||
export default AlgorithmConfig;
|
||||
|
@ -0,0 +1,117 @@
|
||||
import React from 'react';
|
||||
import { DeleteFilled, EditFilled, ImportOutlined, PlusCircleFilled } from '@ant-design/icons';
|
||||
import type { ParamsType, ProColumns, ProTableProps } from '@ant-design/pro-components';
|
||||
import {
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Popconfirm, Select, Space, Switch } from 'antd';
|
||||
import theme from 'antd/es/theme';
|
||||
import { AnyObject } from 'antd/es/_util/type';
|
||||
import { SelectProps } from 'antd/lib';
|
||||
import SchemaFormModal from '../schemaFormModal/schemaFormModal';
|
||||
|
||||
const { useToken } = theme
|
||||
|
||||
export interface AlgorithmTableProps<DataSource, Params extends ParamsType = ParamsType, ValueType = "text"> extends ProTableProps<DataSource, Params, ValueType> {
|
||||
onAddAlgorithm?: (id?: string, record?: any) => void
|
||||
onItemSwitch?: (status?: boolean, id?: string, info?: any) => void
|
||||
onItemEdit?: (values?: any, info?: any) => void
|
||||
onItemDelete?: (id?: string, info?: any) => void
|
||||
onSortSelect?: SelectProps['onChange']
|
||||
onDraw?: (id: any, info?: any) => void
|
||||
selectedKey?: string
|
||||
sortList?: {
|
||||
label: string;
|
||||
value: string;
|
||||
}[]
|
||||
tableType?: 'multiple' | 'single' // 多选/单选
|
||||
}
|
||||
|
||||
const AlgorithmTable= <DataSource extends AnyObject = AnyObject>(
|
||||
props: AlgorithmTableProps<DataSource, ParamsType, 'text'>
|
||||
) => {
|
||||
const {
|
||||
onAddAlgorithm,
|
||||
onItemSwitch,
|
||||
onItemEdit,
|
||||
onItemDelete,
|
||||
onSortSelect,
|
||||
selectedKey,
|
||||
onDraw,
|
||||
tableType = 'multiple',
|
||||
sortList = [],
|
||||
} = props
|
||||
|
||||
const { token } = useToken()
|
||||
|
||||
const columns: ProColumns<DataSource>[] = [
|
||||
{
|
||||
title: '模板名称',
|
||||
dataIndex: 'templateName',
|
||||
},
|
||||
{
|
||||
title: '运行周期',
|
||||
dataIndex: 'runCycle',
|
||||
valueType: 'select',
|
||||
width: 80,
|
||||
valueEnum: {
|
||||
1: { text: '黑夜' },
|
||||
0: { text: '白天' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '算力占用',
|
||||
dataIndex: 'powerOccupy',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'option',
|
||||
valueType: 'option',
|
||||
fixed: true,
|
||||
render: (_DOM, record) => [
|
||||
<Switch value={record.status} onChange={_status => onItemSwitch?.(_status, record.id, record)} />,
|
||||
<a onClick={() => onDraw?.(record.id, record)} style={{ display: tableType === 'single' ? 'block' : 'none' }} href="#"><ImportOutlined /></a>,
|
||||
<SchemaFormModal
|
||||
type={record.templateType}
|
||||
onFinish={async (values) => onItemEdit?.(values, record)}
|
||||
trigger={<a href="#"><EditFilled /></a>}
|
||||
/>
|
||||
,
|
||||
<Popconfirm
|
||||
title="确定删除吗?"
|
||||
onConfirm={() => onItemDelete?.(record.id, record)}
|
||||
>
|
||||
<a href="#"><DeleteFilled /></a>
|
||||
</Popconfirm>,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<ProTable<DataSource>
|
||||
columns={columns}
|
||||
bordered
|
||||
scroll={{ y: 240 }}
|
||||
dataSource={[]}
|
||||
headerTitle={(
|
||||
<Space size={16}>
|
||||
<Select
|
||||
value={selectedKey}
|
||||
style={{ width: 320 }}
|
||||
onChange={onSortSelect}
|
||||
options={sortList}
|
||||
/>
|
||||
<PlusCircleFilled onClick={() => onAddAlgorithm?.()} style={{ fontSize: '24px', color: token.colorPrimary, cursor: 'pointer' }} />
|
||||
</Space>
|
||||
)}
|
||||
toolbar={undefined}
|
||||
rowKey="id"
|
||||
search={false}
|
||||
options={false}
|
||||
pagination={false}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default AlgorithmTable
|
@ -0,0 +1,5 @@
|
||||
import AlgorithmTable from './AlgorithmTable';
|
||||
|
||||
export type { AlgorithmTableProps } from './AlgorithmTable'
|
||||
|
||||
export default AlgorithmTable;
|
@ -0,0 +1,3 @@
|
||||
import SchemaFormModal from './schemaFormModal'
|
||||
|
||||
export default SchemaFormModal
|
@ -0,0 +1,182 @@
|
||||
import React, { FC } from 'react';
|
||||
import type { ModalFormProps } from '@ant-design/pro-components';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { Input, Space } from 'antd';
|
||||
|
||||
export interface SchemaFormModalProps extends ModalFormProps {
|
||||
// fire 火焰、smoke:烟雾、traffic: 人流量、face: 面部遮挡、destroy:人员损坏、wander:人员徘徊、cameraBlock:摄像头遮挡、gather:人员聚集
|
||||
type: 'fire' | 'smoke' | 'traffic' | 'face' | 'destroy' | 'wander' | 'gather' | 'cameraBlock'
|
||||
}
|
||||
|
||||
export const SCHEME_TYPE_LIST = new Map([
|
||||
['fire', '火焰识别'],
|
||||
['smoke', '烟雾识别'],
|
||||
['traffic', '人流量统计'],
|
||||
['face', '面部遮挡识别'],
|
||||
['destroy', '人员破坏识别'],
|
||||
['wander', '人员徘徊识别'],
|
||||
['gather', '人员聚集识别'],
|
||||
['cameraBlock', '摄像头遮挡识别'],
|
||||
])
|
||||
|
||||
const SchemaFormModal: FC<SchemaFormModalProps> = (props) => {
|
||||
const {
|
||||
type = 'fire',
|
||||
onFinish,
|
||||
} = props
|
||||
|
||||
const getColumnsByType = (type: SchemaFormModalProps['type']) => {
|
||||
if (!type) return []
|
||||
|
||||
let arr = []
|
||||
|
||||
if (type === 'gather') {
|
||||
arr.push({
|
||||
title: '预警人数:',
|
||||
dataIndex: 'alarmMember',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
人(3~10)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
}
|
||||
|
||||
if (type === 'cameraBlock') {
|
||||
arr.push({
|
||||
title: '遮挡百分比:',
|
||||
dataIndex: 'blockPercent',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
%(30~80)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
}
|
||||
|
||||
if (type !== 'traffic') {
|
||||
arr.push({
|
||||
title: '最短持续时间:',
|
||||
dataIndex: 'minTime',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
秒(2~10)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
arr.push({
|
||||
title: '报警间隔时间:',
|
||||
dataIndex: 'alarmTime',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
秒(10~600)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
} else if (type === 'traffic') {
|
||||
arr.push({
|
||||
title: '灵敏度:',
|
||||
dataIndex: 'sensitivity',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
(0~100)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
}
|
||||
|
||||
arr.push({
|
||||
title: '灵敏度:',
|
||||
dataIndex: 'sensitivity',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '此项为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
renderFormItem: () => (
|
||||
<Space>
|
||||
<Input />
|
||||
(0~100)
|
||||
</Space>
|
||||
),
|
||||
width: 'm',
|
||||
})
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<BetaSchemaForm
|
||||
width={600}
|
||||
// @ts-ignore
|
||||
title={SCHEME_TYPE_LIST.get(type)}
|
||||
shouldUpdate={false}
|
||||
layoutType="ModalForm"
|
||||
layout='horizontal'
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 18 }}
|
||||
preserve={false}
|
||||
modalProps={{ destroyOnClose: true }}
|
||||
onFinish={onFinish}
|
||||
columns={getColumnsByType(type)}
|
||||
{...props}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default SchemaFormModal
|
@ -0,0 +1,62 @@
|
||||
import React from 'react';
|
||||
import type { ParamsType, ProColumns, ProTableProps } from '@ant-design/pro-components';
|
||||
import {
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { InputNumber } from 'antd';
|
||||
import { AnyObject } from 'antd/es/_util/type';
|
||||
|
||||
export interface TimeTemplateTableProps<DataSource, Params extends ParamsType = ParamsType, ValueType = "text"> extends ProTableProps<DataSource, Params, ValueType> {
|
||||
onItemBlur?: (value?: number | string, id?: any, record?: any) => void,
|
||||
}
|
||||
|
||||
const TimeTemplateTable = <DataSource extends AnyObject = AnyObject>(
|
||||
props: TimeTemplateTableProps<DataSource, ParamsType, 'text'>
|
||||
) => {
|
||||
const {
|
||||
onItemBlur,
|
||||
} = props
|
||||
|
||||
|
||||
const columns: ProColumns<DataSource>[] = [
|
||||
{
|
||||
title: '模板名称',
|
||||
dataIndex: 'templateName',
|
||||
},
|
||||
{
|
||||
title: '运行周期',
|
||||
dataIndex: 'runCycle',
|
||||
},
|
||||
{
|
||||
title: '布控星期',
|
||||
dataIndex: 'arrangeDay',
|
||||
},
|
||||
{
|
||||
title: '算力占用',
|
||||
dataIndex: 'powerOccupy',
|
||||
},
|
||||
{
|
||||
title: '配置路数',
|
||||
key: 'option',
|
||||
valueType: 'option',
|
||||
render: (_, record) => <InputNumber value={record.lineNum} onBlur={e => onItemBlur?.(e.target.value, record.id, record)} min={0} />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<ProTable<DataSource>
|
||||
columns={columns}
|
||||
bordered
|
||||
scroll={{ y: 95 }}
|
||||
toolbar={undefined}
|
||||
rowKey="id"
|
||||
search={false}
|
||||
options={false}
|
||||
pagination={false}
|
||||
dataSource={[]}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default TimeTemplateTable
|
@ -0,0 +1,5 @@
|
||||
import TimeTemplateTable from './TimeTemplateTable';
|
||||
|
||||
export type { TimeTemplateTableProps } from './TimeTemplateTable'
|
||||
|
||||
export default TimeTemplateTable;
|
126
packages/material/src/algorithmConfig/demo/basic.tsx
Normal file
126
packages/material/src/algorithmConfig/demo/basic.tsx
Normal file
@ -0,0 +1,126 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { AlgorithmConfig, AlgorithmConfigRef } from '@zhst/material';
|
||||
import type { AlgorithmConfigProps } from '@zhst/material';
|
||||
import { Button, Space, Switch } from 'antd';
|
||||
|
||||
|
||||
const algorithmTableDataSource: any = []
|
||||
const timeTemplateDataSource: any = []
|
||||
const boxListData: any[] | (() => any[]) = []
|
||||
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
algorithmTableDataSource.push({
|
||||
id: String(i),
|
||||
templateName: '算法模板' + (i + 1),
|
||||
templateType: 'fire', // 用来判断操作的标记弹窗
|
||||
status: i % 2 !== 0,
|
||||
powerOccupy: Math.floor(Math.random() * 20),
|
||||
imageKey: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
||||
odRect:{
|
||||
"x":0.553125,"y":0.29722223,"w":0.048958335,"h":0.2462963
|
||||
},
|
||||
runCycle: i % 2 !== 0 ? '白天' : '黑夜',
|
||||
creator: Math.floor(Math.random() * 20),
|
||||
});
|
||||
timeTemplateDataSource.push({
|
||||
id: String(i),
|
||||
templateName: '时间模板' + (i + 1),
|
||||
lineNum: i + 1,
|
||||
powerOccupy: Math.floor(Math.random() * 20),
|
||||
runCycle: i % 2 !== 0 ? '白天' : '黑夜',
|
||||
arrangeDay: Math.floor(Math.random() * 20),
|
||||
creator: Math.floor(Math.random() * 20),
|
||||
});
|
||||
boxListData.push({
|
||||
id: String(i),
|
||||
name: '盒子' + (i + 1)
|
||||
})
|
||||
}
|
||||
|
||||
const demo = () => {
|
||||
const [algorithmTableList, setAlgorithmTableList] = useState(algorithmTableDataSource)
|
||||
const [timeTemplateData, setTimeTemplateData] = useState(timeTemplateDataSource)
|
||||
const [boxList, setBoxList] = useState(boxListData)
|
||||
const [selectedKey, setSelectedKey] = useState('1')
|
||||
const [algorithmSelectedKey, setAlgorithmSelectedKey] = useState('1')
|
||||
const [tableType, setTableType] = useState<AlgorithmConfigProps['type']>('multiple')
|
||||
const [drawData, setDrawData] = useState<{
|
||||
imageKey: string;
|
||||
odRect?: { x: number; y: number; h: number; w: number }
|
||||
}>({
|
||||
imageKey: '',
|
||||
})
|
||||
|
||||
const algorithmConfigRef = useRef<AlgorithmConfigRef>(null)
|
||||
|
||||
// 绘画事件
|
||||
const handleDraw = (id: any, info: any) => {
|
||||
console.log('箭头圈选事件', id, info)
|
||||
// 先赋值绘画框对象,再打开绘画功能
|
||||
setDrawData({
|
||||
imageKey: info.imageKey,
|
||||
odRect: info.odRect,
|
||||
})
|
||||
algorithmConfigRef.current?.draw()
|
||||
}
|
||||
|
||||
return (
|
||||
<Space direction='vertical'>
|
||||
<Space>
|
||||
<Switch checkedChildren="单选" unCheckedChildren="多选" onChange={_status => setTableType(_status ? 'single': 'multiple')} />
|
||||
<Button onClick={() => {
|
||||
algorithmConfigRef.current?.cancelDraw()
|
||||
setDrawData({ imageKey: '' })
|
||||
}}>取消圈选</Button>
|
||||
</Space>
|
||||
<AlgorithmConfig
|
||||
ref={algorithmConfigRef}
|
||||
boxList={boxList}
|
||||
algorithmTableDataSource={algorithmTableList}
|
||||
timeTemplateDataSource={timeTemplateData}
|
||||
drawData={drawData}
|
||||
drawListener={o => console.log('监听圈选后的事件', o)}
|
||||
selectedKey={selectedKey}
|
||||
onSelect={key => {
|
||||
setSelectedKey(key)
|
||||
// setTimeTemplateData([])
|
||||
// setTableList([])
|
||||
// setBoxList([])
|
||||
}}
|
||||
type={tableType}
|
||||
algorithmTableProps={{
|
||||
onItemSwitch: (status, id) => {
|
||||
console.log('算法状态 switch 变更')
|
||||
setAlgorithmTableList((pre: any[]) => {
|
||||
let arr = pre.map(o => {
|
||||
if (o.id === id) {
|
||||
o.status = status
|
||||
}
|
||||
return o
|
||||
})
|
||||
return arr
|
||||
})
|
||||
},
|
||||
onItemEdit: async (values, itemInfo) => {
|
||||
console.log('算法单项编辑表单提交', values, itemInfo)
|
||||
return true
|
||||
},
|
||||
onDraw: (id, info) => handleDraw(id, info),
|
||||
onItemDelete: (id, itemInfo) => console.log('删除', id, itemInfo),
|
||||
onAddAlgorithm: (id) => console.log('添加模板', id),
|
||||
selectedKey: algorithmSelectedKey,
|
||||
onSortSelect: (value) => setAlgorithmSelectedKey(value),
|
||||
sortList: [
|
||||
{ label: '白天', value: '1' },
|
||||
{ label: '黑夜', value: '2' },
|
||||
]
|
||||
}}
|
||||
timeTemplateTableProps={{
|
||||
onItemBlur: (val, id, itemInfo) => console.log('失焦事件', val, id, itemInfo),
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
export default demo;
|
28
packages/material/src/algorithmConfig/demo/empty.tsx
Normal file
28
packages/material/src/algorithmConfig/demo/empty.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import React, { useState } from 'react';
|
||||
import { AlgorithmConfig, AlgorithmConfigProps } from '@zhst/material';
|
||||
import { Space, Switch } from 'antd';
|
||||
|
||||
|
||||
const algorithmTableDataSource: any = []
|
||||
const timeTemplateDataSource: any = []
|
||||
const boxListData: any[] | (() => any[]) = []
|
||||
|
||||
const demo = () => {
|
||||
const [tableType, setTableType] = useState<AlgorithmConfigProps['type']>('multiple')
|
||||
|
||||
return (
|
||||
<div style={{ width: '1200px' }}>
|
||||
<Space>
|
||||
<Switch checkedChildren="单选" unCheckedChildren="多选" onChange={_status => setTableType(_status ? 'single': 'multiple')} />
|
||||
</Space>
|
||||
<AlgorithmConfig
|
||||
boxList={boxListData}
|
||||
type={tableType}
|
||||
algorithmTableDataSource={algorithmTableDataSource}
|
||||
timeTemplateDataSource={timeTemplateDataSource}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default demo;
|
61
packages/material/src/algorithmConfig/index.md
Normal file
61
packages/material/src/algorithmConfig/index.md
Normal file
@ -0,0 +1,61 @@
|
||||
---
|
||||
category: Components
|
||||
title: 批量算法配置
|
||||
toc: content
|
||||
group:
|
||||
title: 智能柜
|
||||
order: 2
|
||||
---
|
||||
|
||||
批量算法配置
|
||||
|
||||
## 代码演示
|
||||
|
||||
<code src="./demo/basic.tsx">基本用法</code>
|
||||
<code src="./demo/empty.tsx">空数据状态</code>
|
||||
|
||||
## API
|
||||
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| boxList | 盒子列表 | Array[] | [] | - |
|
||||
| algorithmTableDataSource | 算法应用列表 | Array[] | [] | - |
|
||||
| timeTemplateDataSource | 事件模板列表 | Array[] | [] | - |
|
||||
| timeTemplateDataSource | 事件模板列表 | Array[] | [] | - |
|
||||
| selectedKey | 盒子列表选中项 | string | - | - |
|
||||
| onSelect | 盒子列表选中监听事件 | (key) => void | - | - |
|
||||
| drawData | 单选状态绘图数据 | 看 meta 组件的 ImgViewProps -> data | - | - |
|
||||
| drawListener | 单选状态绘图的返回参数 | 看 meta 组件的 ImgViewProps -> onDraw 的回参 | - | - |
|
||||
| algorithmTableProps | 算法应用表单,在 ProTable 组件基础上拓展 | ant-pro -> ProTable | 见下文 | - |
|
||||
| timeTemplateTableProps | 时间模板表单,在ProTable 组件基础上拓展 | ant-pro -> ProTable | 见下文 | - |
|
||||
| ref | algorithmConfigRef | ref| 见下文 | - |
|
||||
|
||||
### algorithmTableProps
|
||||
|
||||
算法应用组件透传,继承 ProTable
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| onItemSwitch | 表单项开关事件监听 | (status?: boolean, id?: string, info?: any) => void | [] | - |
|
||||
| onItemEdit | 表单项编辑事件监听 | (id?: string, info?: any) => void | - | - |
|
||||
| onItemDelete | 表单项删除事件监听 | (id?: string, info?: any) => void | - | - |
|
||||
| onAddAlgorithm | 表单项新增算法规则事件监听 | (id?: string, record?: any) => void | [] | - |
|
||||
| selectedKey | 过滤选中项 | string | - | - |
|
||||
| onSortSelect | 筛选下拉框点击事件 | SelectProps['onChange'] | [] | - |
|
||||
| sortList | 筛选下拉框 | Array[{ label: string; value: string; }] | [] | - |
|
||||
|
||||
### timeTemplateTableProps
|
||||
|
||||
时间模板组件透传,继承 ProTable
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| onItemBlur | 失焦监听事件 | (value?: number | string, id?: any, record?: any) => void | - | - |
|
||||
|
||||
### algorithmConfigRef
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| onDraw | 绘制 | () => void | - | - |
|
||||
| cancelDraw | 取消绘制 | () => void | - | - |
|
8
packages/material/src/algorithmConfig/index.tsx
Normal file
8
packages/material/src/algorithmConfig/index.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
import AlgorithmConfig from './algorithmConfig';
|
||||
|
||||
export type { AlgorithmConfigProps, AlgorithmConfigRef } from './algorithmConfig'
|
||||
|
||||
export type { AlgorithmTableProps } from './components/algorithmTable'
|
||||
export type { TimeTemplateTableProps } from './components/timeTemplateTable'
|
||||
|
||||
export default AlgorithmConfig;
|
@ -0,0 +1,39 @@
|
||||
import React, { FC } from 'react';
|
||||
import { ConfigProvider, Modal, ModalProps } from "antd";
|
||||
import AlgorithmConfig, { AlgorithmConfigProps } from '../algorithmConfig/algorithmConfig';
|
||||
export interface AlgorithmConfigModalProps extends ModalProps {
|
||||
algorithmConfigProps: AlgorithmConfigProps
|
||||
}
|
||||
|
||||
const AlgorithmConfigModal: FC<AlgorithmConfigModalProps> = (props) => {
|
||||
const {
|
||||
algorithmConfigProps
|
||||
} = props
|
||||
|
||||
return (
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
components: {
|
||||
Modal: {
|
||||
headerBg: '#EFF2F4',
|
||||
footerBg: '#EFF2F4',
|
||||
contentBg: '#EFF2F4'
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Modal
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
{...props}
|
||||
>
|
||||
<AlgorithmConfig
|
||||
{...algorithmConfigProps}
|
||||
/>
|
||||
</Modal>
|
||||
</ConfigProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default AlgorithmConfigModal;
|
||||
|
74
packages/material/src/algorithmConfigModal/demo/basic.tsx
Normal file
74
packages/material/src/algorithmConfigModal/demo/basic.tsx
Normal file
@ -0,0 +1,74 @@
|
||||
import React, { useState } from 'react';
|
||||
import { AlgorithmConfigModal } from '@zhst/material';
|
||||
|
||||
const algorithmTableDataSource: any = []
|
||||
const timeTemplateDataSource: any = []
|
||||
const boxListData: any[] | (() => any[]) = []
|
||||
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
algorithmTableDataSource.push({
|
||||
id: i,
|
||||
name: '算法模板' + (i + 1),
|
||||
templateType: 'fire', // 用来判断操作的标记弹窗
|
||||
round: Math.floor(Math.random() * 1),
|
||||
creator: Math.floor(Math.random() * 20),
|
||||
});
|
||||
timeTemplateDataSource.push({
|
||||
id: i,
|
||||
tempName: 'AppName' + (i + 1),
|
||||
count: Math.floor(Math.random() * 1),
|
||||
creator: Math.floor(Math.random() * 20),
|
||||
});
|
||||
boxListData.push({
|
||||
id: i,
|
||||
name: '盒子' + (i + 1)
|
||||
})
|
||||
}
|
||||
|
||||
const demo = () => {
|
||||
const [open, setOpen] = useState(true)
|
||||
const [algorithmTableList, setAlgorithmTableList] = useState(algorithmTableDataSource)
|
||||
const [timeTemplateData, setTimeTemplateData] = useState(timeTemplateDataSource)
|
||||
const [boxList, setBoxList] = useState(boxListData)
|
||||
const [selectedKey, setSelectedKey] = useState('')
|
||||
const [algorithmSelectedKey, setAlgorithmSelectedKey] = useState('1')
|
||||
|
||||
return (
|
||||
<div style={{ border: '1px solid #ccc', width: '340px', minHeight: '900px' }}>
|
||||
<AlgorithmConfigModal
|
||||
title="批量算法设置"
|
||||
width={1500}
|
||||
open={open}
|
||||
destroyOnClose
|
||||
onCancel={() => setOpen(false)}
|
||||
algorithmConfigProps={{
|
||||
boxList,
|
||||
selectedKey,
|
||||
algorithmTableDataSource: algorithmTableList,
|
||||
timeTemplateDataSource: timeTemplateData,
|
||||
onSelect: _key => setSelectedKey(_key),
|
||||
algorithmTableProps: {
|
||||
onItemSwitch: (status, itemInfo) => console.log('修改开关', status, itemInfo),
|
||||
onItemEdit: async (values, itemInfo) => {
|
||||
console.log('算法单项编辑表单提交', values, itemInfo)
|
||||
return true
|
||||
},
|
||||
onItemDelete: (id, itemInfo) => console.log('删除', id, itemInfo),
|
||||
onAddAlgorithm: (id) => console.log('添加模板', id),
|
||||
selectedKey: algorithmSelectedKey,
|
||||
onSortSelect: (value) => setAlgorithmSelectedKey(value),
|
||||
sortList: [
|
||||
{ label: '白天', value: '1' },
|
||||
{ label: '黑夜', value: '2' },
|
||||
]
|
||||
},
|
||||
timeTemplateTableProps: {
|
||||
onItemBlur: (id, itemInfo) => console.log('失焦事件', id, itemInfo),
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default demo;
|
23
packages/material/src/algorithmConfigModal/index.md
Normal file
23
packages/material/src/algorithmConfigModal/index.md
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
category: Components
|
||||
title: 批量算法配置弹框
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
group:
|
||||
title: 智能柜
|
||||
order: 2
|
||||
---
|
||||
|
||||
批量算法配置弹框
|
||||
|
||||
## 代码演示
|
||||
|
||||
<!-- markdownlint-disable MD033 -->
|
||||
<code src="./demo/basic.tsx">基本用法</code>
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| data | 数据源 | Array[] | [] | - |
|
3
packages/material/src/algorithmConfigModal/index.tsx
Normal file
3
packages/material/src/algorithmConfigModal/index.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
import AlgorithmConfigModal from './algorithmConfigModal';
|
||||
|
||||
export default AlgorithmConfigModal;
|
7
packages/material/src/changelog/index.md
Normal file
7
packages/material/src/changelog/index.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
title: 版本更新日志
|
||||
toc: content
|
||||
order: 99
|
||||
---
|
||||
|
||||
<embed src="../../CHANGELOG.md" ></embed>
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav:
|
||||
title: 业务组件
|
||||
title: 物料库
|
||||
order: 1
|
||||
toc: content
|
||||
title: 快速上手
|
||||
---
|
||||
|
6
packages/material/src/index.tsx
Normal file
6
packages/material/src/index.tsx
Normal file
@ -0,0 +1,6 @@
|
||||
export { default as AlgorithmConfigModal } from './algorithmConfigModal';
|
||||
export { default as AlgorithmConfig } from './algorithmConfig';
|
||||
export type { AlgorithmConfigRef, AlgorithmConfigProps } from './algorithmConfig';
|
||||
export { default as Login } from './login';
|
||||
export { default as Password } from './password';
|
||||
export * from 'rc-util'
|
92
packages/material/src/login/Login.tsx
Normal file
92
packages/material/src/login/Login.tsx
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Created by jiangzhixiong on 2024/03/18
|
||||
*/
|
||||
|
||||
import React, { FC } from 'react'
|
||||
import { Button, Checkbox, Flex, Form, FormProps, Image, Input, theme } from 'antd';
|
||||
import { HomeOutlined } from '@ant-design/icons';
|
||||
|
||||
const { useToken } = theme
|
||||
|
||||
interface LoginProps {
|
||||
title: string;
|
||||
onIconClick?: () => void
|
||||
rememberPassword?: boolean
|
||||
imageUrl: string;
|
||||
onFinish: FormProps['onFinish']
|
||||
}
|
||||
|
||||
const Login: FC<LoginProps> = (props) => {
|
||||
const {
|
||||
title,
|
||||
onIconClick,
|
||||
rememberPassword = true,
|
||||
imageUrl,
|
||||
onFinish
|
||||
} = props
|
||||
const [form] = Form.useForm();
|
||||
const { token } = useToken()
|
||||
|
||||
return (
|
||||
<Flex>
|
||||
<Flex align='center' justify='center' style={{ position: 'relative', width: '40%', padding: `30px` }}>
|
||||
<HomeOutlined
|
||||
onClick={onIconClick}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '30px',
|
||||
left: '30px',
|
||||
fontSize: `${token.sizeLG}px`,
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
/>
|
||||
<div style={{ width: '56%' }}>
|
||||
<h2 style={{ margin: '30px 0', fontSize: '30px' }} >{title}</h2>
|
||||
<Form
|
||||
layout="vertical"
|
||||
form={form}
|
||||
onFinish={onFinish}
|
||||
>
|
||||
<Form.Item
|
||||
name="account"
|
||||
label="账号"
|
||||
rules={[
|
||||
{ required: true, message: '请输入账号!' }
|
||||
]}
|
||||
>
|
||||
<Input placeholder="请输入账号" variant="borderless" style={{ border: 'none', borderBottom: '1px solid rgba(0, 0, 0, 0.06)' }} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="password"
|
||||
label="密码"
|
||||
rules={[
|
||||
{ required: true, message: '请输入密码!' }
|
||||
]}
|
||||
>
|
||||
<Input.Password placeholder="请输入密码" variant="borderless" style={{ border: 'none', borderBottom: '1px solid rgba(0, 0, 0, 0.06)' }} />
|
||||
</Form.Item>
|
||||
<Form.Item style={{ display: rememberPassword ? 'block' : 'none' }}>
|
||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||
<Checkbox>记住密码</Checkbox>
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button block type="primary" htmlType="submit">登录</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</Flex>
|
||||
<div style={{ width: '60%' }}>
|
||||
<Image
|
||||
style={{ width: '100%' }}
|
||||
src={imageUrl}
|
||||
width={'100%'}
|
||||
preview={false}
|
||||
fallback="data:image/png;base64,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"
|
||||
/>
|
||||
</div>
|
||||
</Flex>
|
||||
)
|
||||
}
|
||||
|
||||
export default Login
|
19
packages/material/src/login/demo/basic.tsx
Normal file
19
packages/material/src/login/demo/basic.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Login } from '@zhst/material';
|
||||
|
||||
import bg1 from '../images/ai-suanfa.png'
|
||||
|
||||
const demo = () => {
|
||||
|
||||
return (
|
||||
<div style={{ width: '100%', border: '1px solid #ccc' }}>
|
||||
<Login
|
||||
title='AI算法仓平台'
|
||||
imageUrl={bg1}
|
||||
onFinish={val => console.log('val', val)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default demo;
|
BIN
packages/material/src/login/images/ai-suanfa.png
Normal file
BIN
packages/material/src/login/images/ai-suanfa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1024 KiB |
BIN
packages/material/src/login/images/ai-video.png
Normal file
BIN
packages/material/src/login/images/ai-video.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 921 KiB |
BIN
packages/material/src/login/images/box-manage.png
Normal file
BIN
packages/material/src/login/images/box-manage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 845 KiB |
24
packages/material/src/login/index.md
Normal file
24
packages/material/src/login/index.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
category: Components
|
||||
title: Login 登录
|
||||
toc: content
|
||||
group:
|
||||
title: 通用
|
||||
order: 2
|
||||
---
|
||||
|
||||
登录事件
|
||||
|
||||
## 代码演示
|
||||
|
||||
<code src="./demo/basic.tsx">基本用法</code>
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| title | 标题 | string | - | - |
|
||||
| onIconClick | 房子点击触发事件 | () => void | [] | - |
|
||||
| rememberPassword | 是否显示记住密码 | boolean | true | - |
|
||||
| imageUrl | 大图链接 | string | - | - |
|
||||
| onFinish | 登录提交事件 | FormProps['onFinish'] | - | - |
|
3
packages/material/src/login/index.tsx
Normal file
3
packages/material/src/login/index.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
import Login from './Login'
|
||||
|
||||
export default Login
|
76
packages/material/src/password/Password.tsx
Normal file
76
packages/material/src/password/Password.tsx
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Created by jiangzhixiong on 2024/03/18
|
||||
*/
|
||||
|
||||
import React, { FC } from 'react'
|
||||
import { Button, Form, FormProps, Input, Space } from 'antd'
|
||||
|
||||
interface PasswordProps {
|
||||
onFinish: FormProps['onFinish']
|
||||
onCancel: () => void
|
||||
}
|
||||
|
||||
const Password: FC<PasswordProps> = (props) => {
|
||||
const {
|
||||
onFinish,
|
||||
onCancel,
|
||||
} = props
|
||||
const [form] = Form.useForm();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: '0', fontSize: '20px' }} >修改密码</h2>
|
||||
<Form
|
||||
labelCol={{ span: 4 }}
|
||||
wrapperCol={{ span: 20 }}
|
||||
form={form}
|
||||
onFinish={onFinish}
|
||||
>
|
||||
<Form.Item
|
||||
name="password"
|
||||
label="原密码"
|
||||
rules={[
|
||||
{ required: true, message: '请输入密码!' }
|
||||
]}
|
||||
>
|
||||
<Input.Password variant="borderless" style={{ border: 'none', borderBottom: '1px solid rgba(0, 0, 0, 0.06)' }} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[
|
||||
{ required: true, message: '请输入新密码!' }
|
||||
]}
|
||||
>
|
||||
<Input.Password variant="borderless" style={{ border: 'none', borderBottom: '1px solid rgba(0, 0, 0, 0.06)' }} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="rePassword"
|
||||
label="确认密码"
|
||||
dependencies={['password']}
|
||||
rules={[
|
||||
{ required: true, message: '请再次输入密码!' },
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (!value || getFieldValue('password') === value) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('两次输入的密码不一致!'));
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input.Password variant="borderless" style={{ border: 'none', borderBottom: '1px solid rgba(0, 0, 0, 0.06)' }} />
|
||||
</Form.Item>
|
||||
<div style={{ textAlign: 'right' }}>
|
||||
<Space>
|
||||
<Button htmlType="reset" onClick={onCancel} style={{ width: '100px' }}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ width: '100px' }}>确认</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Password
|
16
packages/material/src/password/demo/basic.tsx
Normal file
16
packages/material/src/password/demo/basic.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Password } from '@zhst/material';
|
||||
|
||||
const demo = () => {
|
||||
|
||||
return (
|
||||
<div style={{ padding: '24px', width: '500px', border: '1px solid #eee' }}>
|
||||
<Password
|
||||
onFinish={val => console.log('val', val)}
|
||||
onCancel={() => console.log('cancel')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default demo;
|
21
packages/material/src/password/index.md
Normal file
21
packages/material/src/password/index.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
category: Components
|
||||
title: Password 修改密码
|
||||
toc: content
|
||||
group:
|
||||
title: 通用
|
||||
order: 2
|
||||
---
|
||||
|
||||
盒子树
|
||||
|
||||
## 代码演示
|
||||
|
||||
<code src="./demo/basic.tsx">基本用法</code>
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| onFinish | 提交事件 | FormProps['onFinish'] | - | - |
|
||||
| onCancel | 取消 | () => void | - | - |
|
3
packages/material/src/password/index.tsx
Normal file
3
packages/material/src/password/index.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
import Password from './Password'
|
||||
|
||||
export default Password
|
3
packages/material/src/utils/base64Images.ts
Normal file
3
packages/material/src/utils/base64Images.ts
Normal file
File diff suppressed because one or more lines are too long
1
packages/material/src/utils/types.ts
Normal file
1
packages/material/src/utils/types.ts
Normal file
@ -0,0 +1 @@
|
||||
export type AnyObject = Record<PropertyKey, any>;
|
@ -1,5 +1,43 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.9.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料库
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.8
|
||||
- @zhst/func@0.8.3
|
||||
- @zhst/meta@0.9.5
|
||||
|
||||
## 0.9.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 初始化物料包
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.8.7
|
||||
- @zhst/func@0.8.2
|
||||
- @zhst/meta@0.9.4
|
||||
|
||||
## 0.9.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.1
|
||||
- @zhst/hooks@0.8.6
|
||||
- @zhst/meta@0.9.3
|
||||
|
||||
## 0.9.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.8.0
|
||||
- @zhst/hooks@0.8.5
|
||||
- @zhst/meta@0.9.2
|
||||
|
||||
## 0.9.1
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/meta",
|
||||
"version": "0.9.1",
|
||||
"version": "0.9.5",
|
||||
"description": "原子组件",
|
||||
"keywords": [
|
||||
"meta",
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 媒体
|
||||
category: Components
|
||||
subtitle: 大图预览组件
|
||||
toc: content
|
||||
title: BigImagePreview 大图预览组件
|
||||
---
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 媒体
|
||||
category: Components
|
||||
subtitle: 图片预览
|
||||
toc: content
|
||||
title: CompareImage 图片预览
|
||||
---
|
||||
|
||||
|
@ -3,6 +3,7 @@ group: 媒体
|
||||
category: Components
|
||||
subtitle: 视频播放
|
||||
title: VideoPlayer 视频播放
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
---
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 包裹组件
|
||||
group: 其他
|
||||
toc: content
|
||||
title: App 包裹组件
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -4,6 +4,7 @@ title: Button 按钮
|
||||
subtitle: 按钮
|
||||
demo:
|
||||
cols: 2
|
||||
toc: content
|
||||
group:
|
||||
title: 通用
|
||||
order: 1
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
group: 数据展示
|
||||
title: Card 卡片
|
||||
toc: content
|
||||
subtitle: 卡片
|
||||
---
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
---
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 版本更新日志
|
||||
order: 9999
|
||||
title: 组件库
|
||||
title: 元组件
|
||||
toc: content
|
||||
---
|
||||
|
||||
<embed src="../../README.md" ></embed>
|
||||
|
||||
<embed src="../../CHANGELOG.md" ></embed>
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 多选框
|
||||
group: 数据录入
|
||||
toc: content
|
||||
title: Checkbox 多选框
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 全局化配置
|
||||
group: 其他
|
||||
toc: content
|
||||
title: ConfigProvider 全局化配置
|
||||
---
|
||||
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
group: 数据录入
|
||||
title: DatePicker 日期选择框
|
||||
subtitle: 日期选择框
|
||||
toc: content
|
||||
description: 输入或选择日期的控件。
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 描述列表
|
||||
group: 数据展示
|
||||
toc: content
|
||||
title: Descriptions 描述列表
|
||||
---
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
title: Divider 分割线
|
||||
subtitle: 分割线
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
group:
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 弹性布局
|
||||
group: 布局
|
||||
toc: content
|
||||
title: Flex 弹性布局
|
||||
tag: New
|
||||
---
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
subtitle: 表单
|
||||
toc: content
|
||||
group: 数据录入
|
||||
title: Form 表单
|
||||
---
|
||||
@ -548,10 +549,6 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
|
||||
| form | 指定 Form 实例 | FormInstance | 当前 context 中的 Form | 5.4.0 |
|
||||
| preserve | 是否监视没有对应的 `Form.Item` 的字段 | boolean | false | 5.4.0 |
|
||||
|
||||
## 主题变量(Design Token)
|
||||
|
||||
<ComponentTokenTable component="Form"></ComponentTokenTable>
|
||||
|
||||
## FAQ
|
||||
|
||||
### Switch、Checkbox 为什么不能绑定数据?
|
||||
|
@ -2,7 +2,8 @@
|
||||
category: Components
|
||||
subtitle: 栅格
|
||||
group: 布局
|
||||
title: Grid 栅格
|
||||
titltoc: content
|
||||
: Grid 栅格
|
||||
---
|
||||
|
||||
24 栅格系统。
|
||||
|
@ -1,65 +0,0 @@
|
||||
---
|
||||
nav:
|
||||
title: 元组件
|
||||
title: 快速上手
|
||||
order: 1
|
||||
---
|
||||
|
||||
## 目录结构
|
||||
|
||||
<Tree>
|
||||
<ul>
|
||||
<li>
|
||||
src
|
||||
<small>开发文件夹</small>
|
||||
<ul>
|
||||
<li>
|
||||
Component1
|
||||
<small>组件目录</small>
|
||||
<ul>
|
||||
<li>
|
||||
index.ts
|
||||
<small>入口文件</small>
|
||||
</li>
|
||||
<li>
|
||||
Component1.tsx
|
||||
<small>组件1</small>
|
||||
</li>
|
||||
<li>
|
||||
Component1Helper.ts
|
||||
<small>组件函数</small>
|
||||
</li>
|
||||
<li>
|
||||
index.less
|
||||
<small>样式文件</small>
|
||||
</li>
|
||||
<li>
|
||||
index.md
|
||||
<small>说明文档</small>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
utils
|
||||
<small>公共函数文件夹</small>
|
||||
</li>
|
||||
<li>
|
||||
index.ts
|
||||
<small>总入口文件</small>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
.dumirc.ts
|
||||
<small>文档配置</small>
|
||||
</li>
|
||||
<li>
|
||||
package.json
|
||||
<small>这是 package.json</small>
|
||||
</li>
|
||||
</ul>
|
||||
</Tree>
|
||||
|
||||
<embed src="../README.md" ></embed>
|
||||
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
subtitle: 数字输入框
|
||||
group: 数据录入
|
||||
title: InputNumber 数字输入框
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
---
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 输入框
|
||||
group: 数据录入
|
||||
toc: content
|
||||
title: Input 输入框
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 全局提示
|
||||
group: 反馈
|
||||
toc: content
|
||||
noinstant: true
|
||||
title: Message 全局提示
|
||||
demo:
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 反馈
|
||||
category: Components
|
||||
subtitle: 对话框
|
||||
toc: content
|
||||
title: Modal 对话框
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
group: 反馈
|
||||
noinstant: true
|
||||
title: Notification
|
||||
toc: content
|
||||
subtitle: 通知提醒框
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 气泡卡片
|
||||
group: 数据展示
|
||||
toc: content
|
||||
title: Popover
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
subtitle: 进度条
|
||||
group: 反馈
|
||||
title: Progress 进度条
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
---
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
subtitle: 单选框
|
||||
group: 数据录入
|
||||
title: Radio 单选框
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
---
|
||||
|
@ -2,6 +2,7 @@
|
||||
group: 数据录入
|
||||
category: Components
|
||||
subtitle: 分数
|
||||
toc: content
|
||||
title: Score 分数
|
||||
---
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 分段控制器
|
||||
group: 数据展示
|
||||
toc: content
|
||||
title: Segmented 分段控制器
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
subtitle: 选择器
|
||||
toc: content
|
||||
group: 数据录入
|
||||
title: Select 选择器
|
||||
demo:
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
subtitle: 骨架屏
|
||||
toc: content
|
||||
group: 反馈
|
||||
title: Skeleton 骨架屏
|
||||
---
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
subtitle: 滑动输入条
|
||||
group: 数据录入
|
||||
toc: content
|
||||
title: Slider 滑动输入条
|
||||
demo:
|
||||
cols: 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
category: Components
|
||||
group: 布局
|
||||
subtitle: 间距
|
||||
toc: content
|
||||
title: Space 间距
|
||||
---
|
||||
|
||||
|
@ -3,6 +3,7 @@ category: Components
|
||||
subtitle: 开关
|
||||
group: 数据录入
|
||||
title: Switch 开关
|
||||
toc: content
|
||||
demo:
|
||||
cols: 2
|
||||
---
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user