@pointcloud/pcloud-components 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +16 -29
- package/dist/esm/DCascader/index.js +6 -6
- package/dist/esm/DCascader/index.less +24 -24
- package/dist/esm/DForm/DItem/index.js +4 -1
- package/dist/esm/DForm/DItem/itemsRender.d.ts +4 -3
- package/dist/esm/DForm/DItem/itemsRender.js +8 -3
- package/dist/esm/DForm/helper.js +6 -6
- package/dist/esm/DForm/index.d.ts +7 -3
- package/dist/esm/DForm/index.js +40 -7
- package/dist/esm/DForm/index.less +32 -32
- package/dist/esm/DInput/index.js +5 -2
- package/dist/esm/DSelect/index.js +6 -6
- package/dist/esm/DTable/index.d.ts +15 -8
- package/dist/esm/DTable/index.js +39 -29
- package/dist/esm/DTable/index.less +3 -2
- package/dist/esm/DTreeSelect/index.js +6 -6
- package/dist/esm/DTreeSelect/index.less +11 -11
- package/dist/esm/DUpload/helper.js +47 -47
- package/dist/esm/DUpload/index.js +45 -44
- package/dist/esm/DUpload/index.less +19 -19
- package/dist/esm/ErrorBoundary/index.less +44 -44
- package/dist/esm/LModal/styles/index.less +27 -27
- package/dist/esm/LabelValue/styles/index.less +23 -23
- package/dist/esm/Loading/styles/index.less +25 -25
- package/dist/esm/NoData/styles/index.less +24 -24
- package/dist/esm/index.d.ts +2 -2
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +4 -1
- package/dist/umd/images/favicon.png +0 -0
- package/dist/umd/mock/dcascader/china_region_city.json +0 -2962
- package/dist/umd/mock/dcascader/china_region_county.json +0 -9991
- package/dist/umd/mock/dcascader/china_region_province.json +0 -36
- package/dist/umd/mock/dupload/other/ZJ-TZ-001_/346/212/244/345/233/275/345/272/231/346/210/217/345/217/260/345/216/206/345/217/262/345/273/272/347/255/221/346/241/243/346/241/210/350/241/250.pdf +0 -0
- package/dist/umd/mock/dupload/other//346/234/210/347/211/231/346/271/276 - /351/243/236/345/204/277/344/271/220/345/233/242.mp3 +0 -0
- package/dist/umd/mock/dupload/picture/110500-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110500.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110504.png +0 -0
- package/dist/umd/mock/dupload/picture/default.png +0 -0
- package/dist/umd/mock/dupload/picture//346/255/243/351/227/250/345/205/250/346/231/257.jpg +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## [0.1.6](https://192.168.101.96:8092/pointcloud_frontend/basiclibrary/pcloud-components/compare/v0.1.5...v0.1.6) (2023-08-16)
|
|
2
|
+
|
|
3
|
+
### 📚 文档变更
|
|
4
|
+
|
|
5
|
+
- 更新组件文档 ([35e18a8](https://192.168.101.96:8092/pointcloud_frontend/basiclibrary/pcloud-components/commit/35e18a8e75fe331e2609ab25b964805b36aeef5c))
|
|
6
|
+
|
|
7
|
+
### 🐛 修复 bug
|
|
8
|
+
|
|
9
|
+
- 临时修复 bug ([f250f36](https://192.168.101.96:8092/pointcloud_frontend/basiclibrary/pcloud-components/commit/f250f362886b2e18ffa3fd0f012ef9a3d66ca4c6))
|
|
10
|
+
- 修复 DForm 组件 bug ([cc68b1b](https://192.168.101.96:8092/pointcloud_frontend/basiclibrary/pcloud-components/commit/cc68b1b0fc6ec45f18a0d5cc96a892c62ecaafba))
|
package/README.md
CHANGED
|
@@ -253,19 +253,19 @@ npm run doctor // 执行依赖检查
|
|
|
253
253
|
|
|
254
254
|
本项目使用 husky 方案来规范 代码的提交,提交代码时请尽量遵循以下约定
|
|
255
255
|
|
|
256
|
-
| 提交类型 | 类型说明
|
|
257
|
-
| -------- |
|
|
258
|
-
| feat | 新增功能
|
|
259
|
-
| fix | bug 修复
|
|
260
|
-
| docs | 文档更新
|
|
261
|
-
| style | 不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等)
|
|
262
|
-
| refactor | 重构代码(既没有新增功能,也没有修复 bug)
|
|
263
|
-
| perf | 性能优化
|
|
264
|
-
| test | 新增测试用例或是更新现有测试
|
|
265
|
-
| build | 主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
|
|
266
|
-
| ci |
|
|
267
|
-
| chore | 不属于以上类型的其他类型(日常事务)
|
|
268
|
-
| revert | 回滚某个更早之前的提交
|
|
256
|
+
| 提交类型 | 类型说明 |
|
|
257
|
+
| -------- | ---------------------------------------------------------------------------- |
|
|
258
|
+
| feat | 新增功能 |
|
|
259
|
+
| fix | bug 修复 |
|
|
260
|
+
| docs | 文档更新 |
|
|
261
|
+
| style | 不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) |
|
|
262
|
+
| refactor | 重构代码(既没有新增功能,也没有修复 bug) |
|
|
263
|
+
| perf | 性能优化 |
|
|
264
|
+
| test | 新增测试用例或是更新现有测试 |
|
|
265
|
+
| build | 主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 |
|
|
266
|
+
| ci | 主要目的是修改项目集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 |
|
|
267
|
+
| chore | 不属于以上类型的其他类型(日常事务) |
|
|
268
|
+
| revert | 回滚某个更早之前的提交 |
|
|
269
269
|
|
|
270
270
|
```
|
|
271
271
|
git commit -m <type>[optional scope]: <description> // 提交格式
|
|
@@ -303,23 +303,10 @@ git commit -m "fix: 修复bug" // type后的冒号和空格不可省略,descri
|
|
|
303
303
|
|
|
304
304
|
- 检查 `package.json` 中的 NPM 包名及 `publishConfig` 是否符合预期
|
|
305
305
|
|
|
306
|
-
2.
|
|
306
|
+
2. release 发布
|
|
307
307
|
|
|
308
|
-
使用
|
|
308
|
+
使用 release-it 可以根据 [release-it 配置](https://github.com/release-it/release-it/blob/main/config/release-it.json) 自动完成发布前的准备工作,包括:更新版本号、生成 tag 、更新 changelog、git 提交及推送远程仓库、npm 发布等
|
|
309
309
|
|
|
310
310
|
```
|
|
311
|
-
|
|
312
|
-
npm version patch -m "build: 发布%s版本" // 0.0.1->0.0.2
|
|
313
|
-
|
|
314
|
-
// 升级次版本号
|
|
315
|
-
npm version minor -m "build: 发布%s版本" // 0.0.1->0.1.0
|
|
316
|
-
|
|
317
|
-
// 升级主版本号
|
|
318
|
-
npm version minor -m "build: 发布%s版本" // 0.0.1->1.0.0
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
3. 发布
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
npm publish
|
|
311
|
+
npm run release
|
|
325
312
|
```
|
|
@@ -3,12 +3,12 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["className", "popupClassName", "fieldNames", "options", "onChange", "loadData", "onLoadData", "loading"];
|
|
6
|
-
/*
|
|
7
|
-
* @Author : wangfeihu
|
|
8
|
-
* @Date : 2023-05-18 13:35:38
|
|
9
|
-
* @LastEditors : wangfeihu
|
|
10
|
-
* @LastEditTime : 2023-07-12 09:44:01
|
|
11
|
-
* @Description : 基于antd的Cascader组件
|
|
6
|
+
/*
|
|
7
|
+
* @Author : wangfeihu
|
|
8
|
+
* @Date : 2023-05-18 13:35:38
|
|
9
|
+
* @LastEditors : wangfeihu
|
|
10
|
+
* @LastEditTime : 2023-07-12 09:44:01
|
|
11
|
+
* @Description : 基于antd的Cascader组件
|
|
12
12
|
*/
|
|
13
13
|
import React, { useRef, forwardRef, useState, useEffect, useMemo, useContext } from 'react';
|
|
14
14
|
import { Cascader } from 'antd';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
@import '../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
.@{prefix}-cascader-dropdown .ant-cascader-menu {
|
|
4
|
-
&::-webkit-scrollbar {
|
|
5
|
-
width: 8px;
|
|
6
|
-
height: 8px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// 轨道拖动部分的背景颜色
|
|
10
|
-
&::-webkit-scrollbar-thumb {
|
|
11
|
-
background-color: rgba(0, 0, 0, 50%);
|
|
12
|
-
border-radius: 8px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// 轨道背景颜色
|
|
16
|
-
&::-webkit-scrollbar-track {
|
|
17
|
-
border-radius: 2px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// x、y两条轨道的交叉处
|
|
21
|
-
&::-webkit-scrollbar-corner {
|
|
22
|
-
background-color: #f1f1f1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-cascader-dropdown .ant-cascader-menu {
|
|
4
|
+
&::-webkit-scrollbar {
|
|
5
|
+
width: 8px;
|
|
6
|
+
height: 8px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 轨道拖动部分的背景颜色
|
|
10
|
+
&::-webkit-scrollbar-thumb {
|
|
11
|
+
background-color: rgba(0, 0, 0, 50%);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 轨道背景颜色
|
|
16
|
+
&::-webkit-scrollbar-track {
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// x、y两条轨道的交叉处
|
|
21
|
+
&::-webkit-scrollbar-corner {
|
|
22
|
+
background-color: #f1f1f1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -18,12 +18,15 @@ function DItem(props) {
|
|
|
18
18
|
label: label,
|
|
19
19
|
name: name
|
|
20
20
|
}, formItemProps);
|
|
21
|
-
if (renderType === 'custom'
|
|
21
|
+
if (renderType === 'custom') {
|
|
22
22
|
return render ? /*#__PURE__*/_jsx(_Fragment, {
|
|
23
23
|
children: render(otherProps, _formItemProps, props)
|
|
24
24
|
}) : /*#__PURE__*/_jsx(_Fragment, {
|
|
25
25
|
children: children
|
|
26
26
|
});
|
|
27
|
+
} else if (renderType === 'other') {
|
|
28
|
+
var _children = render ? render(otherProps, _formItemProps, props) : children;
|
|
29
|
+
return itemsRender.other(_formItemProps, _children);
|
|
27
30
|
} else if (renderType) {
|
|
28
31
|
return itemsRender[renderType](otherProps, _formItemProps, label, render, children);
|
|
29
32
|
} else {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { AutoCompleteProps, ButtonProps, CascaderProps, CheckboxProps, DatePickerProps, DividerProps, FormItemProps, InputNumberProps, InputProps, MentionProps, RadioProps, RateProps, SelectProps, SliderSingleProps, SwitchProps, TimePickerProps, TransferProps, TreeSelectProps, UploadProps } from 'antd';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
|
-
import { FormItemProps, SelectProps, AutoCompleteProps, UploadProps, TransferProps, InputProps, InputNumberProps, CascaderProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, DividerProps, CheckboxProps, ButtonProps } from 'antd';
|
|
3
|
-
import { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
4
3
|
import { RangePickerProps } from 'antd/lib/date-picker';
|
|
4
|
+
import { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
5
|
+
import { DCascaderProps } from '../../DCascader';
|
|
5
6
|
import { DInputProps } from '../../DInput';
|
|
6
7
|
import { DSelectProps } from '../../DSelect';
|
|
7
8
|
import { DTreeSelectProps } from '../../DTreeSelect';
|
|
8
|
-
import { DCascaderProps } from '../../DCascader';
|
|
9
9
|
import { DUploadProps } from '../../DUpload';
|
|
10
10
|
import { DItemProps } from './itemType';
|
|
11
11
|
declare const renderMap: {
|
|
@@ -35,5 +35,6 @@ declare const renderMap: {
|
|
|
35
35
|
dUpload: (props: DUploadProps, formItemProps: FormItemProps, label: DItemProps['label'], render: (props: any) => ReactNode, children: DUploadProps['children']) => JSX.Element;
|
|
36
36
|
button: (props: ButtonProps, formItemProps: FormItemProps, label: DItemProps['label']) => JSX.Element;
|
|
37
37
|
divider: (props: DividerProps, formItemProps: FormItemProps, label: DItemProps['label']) => JSX.Element;
|
|
38
|
+
other: (formItemProps: FormItemProps, children: DUploadProps['children']) => JSX.Element;
|
|
38
39
|
};
|
|
39
40
|
export default renderMap;
|
|
@@ -3,15 +3,15 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
3
3
|
* @Author : wangfeihu
|
|
4
4
|
* @Date : 2023-06-12 17:35:10
|
|
5
5
|
* @LastEditors : wangfeihu
|
|
6
|
-
* @LastEditTime : 2023-
|
|
6
|
+
* @LastEditTime : 2023-08-16 16:54:13
|
|
7
7
|
* @Description : 根据renderType渲染对应的表单项组件
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { AutoComplete, Button, Cascader, Checkbox, DatePicker, Divider, Form, Input, InputNumber, Mentions, Radio, Rate, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload } from 'antd';
|
|
11
|
+
import DCascader from "../../DCascader";
|
|
11
12
|
import DInput from "../../DInput";
|
|
12
13
|
import DSelect from "../../DSelect";
|
|
13
14
|
import DTreeSelect from "../../DTreeSelect";
|
|
14
|
-
import DCascader from "../../DCascader";
|
|
15
15
|
import DUpload from "../../DUpload";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
var renderMap = {
|
|
@@ -188,6 +188,11 @@ var renderMap = {
|
|
|
188
188
|
}, props), {}, {
|
|
189
189
|
children: label
|
|
190
190
|
}));
|
|
191
|
+
},
|
|
192
|
+
other: function other(formItemProps, children) {
|
|
193
|
+
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
194
|
+
children: children
|
|
195
|
+
}));
|
|
191
196
|
}
|
|
192
197
|
};
|
|
193
198
|
export default renderMap;
|
package/dist/esm/DForm/helper.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
/*
|
|
3
|
-
* @Author : wangfeihu
|
|
4
|
-
* @Date : 2023-06-07 15:08:06
|
|
5
|
-
* @LastEditors : wangfeihu
|
|
6
|
-
* @LastEditTime : 2023-06-12 17:35:15
|
|
7
|
-
* @Description : 合并两个对象中的所有字段
|
|
2
|
+
/*
|
|
3
|
+
* @Author : wangfeihu
|
|
4
|
+
* @Date : 2023-06-07 15:08:06
|
|
5
|
+
* @LastEditors : wangfeihu
|
|
6
|
+
* @LastEditTime : 2023-06-12 17:35:15
|
|
7
|
+
* @Description : 合并两个对象中的所有字段
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import mergeWith from 'lodash/mergeWith';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { FormProps
|
|
2
|
+
import { FormProps } from 'antd';
|
|
3
3
|
import DItem, { DItemProps } from './DItem';
|
|
4
4
|
import './index.less';
|
|
5
5
|
declare type InternalFormProps = {
|
|
@@ -12,9 +12,13 @@ declare type InternalFormProps = {
|
|
|
12
12
|
/** 布局方式 新增了行内垂直布局方式inlineVertical */
|
|
13
13
|
layout?: 'inline' | 'horizontal' | 'vertical' | 'inlineVertical';
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
declare
|
|
15
|
+
declare type DFormProps = Omit<FormProps, 'children' | 'layout'> & InternalFormProps;
|
|
16
|
+
declare type DFormRefProps = {
|
|
17
|
+
setItems: (items: DItemProps[] | ((values: DItemProps[]) => DItemProps[] | Promise<DItemProps[]>)) => void;
|
|
18
|
+
} | undefined;
|
|
19
|
+
declare function InternalForm(props: DFormProps, ref: React.Ref<DFormRefProps>): JSX.Element;
|
|
17
20
|
declare const DForm: typeof InternalForm & {
|
|
18
21
|
Item: typeof DItem;
|
|
19
22
|
};
|
|
23
|
+
export { type DFormProps, type DFormRefProps, type DItemProps };
|
|
20
24
|
export default DForm;
|
package/dist/esm/DForm/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
var _excluded = ["className", "defaultItemProps", "items", "children", "layout"];
|
|
4
|
+
var _excluded = ["className", "defaultItemProps", "items", "children", "layout", "autoComplete"];
|
|
4
5
|
/*
|
|
5
6
|
* @Author : wangfeihu
|
|
6
7
|
* @Date : 2023-06-02 09:29:11
|
|
7
8
|
* @LastEditors : wangfeihu
|
|
8
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-08-16 16:35:27
|
|
9
10
|
* @Description : 基于antd的Form组件
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
import React, { forwardRef,
|
|
13
|
+
import React, { forwardRef, useContext, useState, useEffect, useImperativeHandle } from 'react';
|
|
13
14
|
import { Form } from 'antd';
|
|
14
15
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
16
|
import helper from "./helper";
|
|
16
17
|
import DItem from "./DItem";
|
|
17
18
|
import "./index.less";
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
22
|
function getChildren(items, children, _defaultItemProps) {
|
|
20
23
|
var list = [];
|
|
@@ -26,7 +29,12 @@ function getChildren(items, children, _defaultItemProps) {
|
|
|
26
29
|
}
|
|
27
30
|
if (children) {
|
|
28
31
|
var childrenList = children instanceof Array ? children : [children];
|
|
29
|
-
|
|
32
|
+
var _childrenList = childrenList.map(function (item) {
|
|
33
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
34
|
+
props: helper.merge(_defaultItemProps, item.props)
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
list = list.concat(_childrenList);
|
|
30
38
|
}
|
|
31
39
|
return list;
|
|
32
40
|
}
|
|
@@ -37,18 +45,42 @@ function InternalForm(props, ref) {
|
|
|
37
45
|
items = props.items,
|
|
38
46
|
children = props.children,
|
|
39
47
|
layout = props.layout,
|
|
48
|
+
_props$autoComplete = props.autoComplete,
|
|
49
|
+
autoComplete = _props$autoComplete === void 0 ? 'off' : _props$autoComplete,
|
|
40
50
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
41
51
|
var _useContext = useContext(ConfigContext),
|
|
42
52
|
getPrefixCls = _useContext.getPrefixCls;
|
|
43
53
|
var _className = "".concat(getPrefixCls('form'), " ").concat(className, " ").concat(layout === 'inlineVertical' ? 'inlineVertical' : '');
|
|
44
54
|
var _layout = layout === 'inlineVertical' ? 'inline' : layout;
|
|
45
|
-
var
|
|
46
|
-
|
|
55
|
+
var _useState = useState(getChildren(items, children, defaultItemProps)),
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
itemChildren = _useState2[0],
|
|
58
|
+
setItemChildren = _useState2[1];
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
setItemChildren(getChildren(items, children, defaultItemProps));
|
|
61
|
+
}, [items, children, defaultItemProps]);
|
|
62
|
+
useImperativeHandle(ref, function () {
|
|
63
|
+
return {
|
|
64
|
+
setItems: function setItems(value) {
|
|
65
|
+
if (value instanceof Array) {
|
|
66
|
+
setItemChildren(getChildren(value, null, defaultItemProps));
|
|
67
|
+
} else if (typeof value === 'function') {
|
|
68
|
+
var result = value(items || []);
|
|
69
|
+
if ('then' in result) {
|
|
70
|
+
result.then(function (list) {
|
|
71
|
+
setItemChildren(getChildren(list, null, defaultItemProps));
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
setItemChildren(getChildren(result, null, defaultItemProps));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
47
79
|
}, [items, children, defaultItemProps]);
|
|
48
80
|
return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
49
81
|
className: _className,
|
|
50
82
|
layout: _layout,
|
|
51
|
-
|
|
83
|
+
autoComplete: autoComplete,
|
|
52
84
|
children: /*#__PURE__*/_jsx("div", {
|
|
53
85
|
className: "form-wrapper",
|
|
54
86
|
children: itemChildren
|
|
@@ -57,4 +89,5 @@ function InternalForm(props, ref) {
|
|
|
57
89
|
}
|
|
58
90
|
var DForm = /*#__PURE__*/forwardRef(InternalForm);
|
|
59
91
|
DForm.Item = DItem;
|
|
92
|
+
export {};
|
|
60
93
|
export default DForm;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
@import '../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
.@{prefix}-form {
|
|
4
|
-
.form-wrapper > * {
|
|
5
|
-
min-height: 32px;
|
|
6
|
-
margin-right: 0;
|
|
7
|
-
margin-bottom: 24px;
|
|
8
|
-
padding-right: 16px;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.@{prefix}-form.ant-form-horizontal .ant-form-item-label {
|
|
13
|
-
min-width: 80px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.@{prefix}-form.ant-form-inline .form-wrapper,
|
|
17
|
-
.@{prefix}-form.ant-form-inline.inlineVertical .form-wrapper {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-wrap: wrap;
|
|
20
|
-
align-items: flex-end;
|
|
21
|
-
height: min-content;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.@{prefix}-form.ant-form-inline.inlineVertical {
|
|
25
|
-
.ant-form-item-row {
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
|
|
28
|
-
.ant-form-item-label {
|
|
29
|
-
text-align: left;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-form {
|
|
4
|
+
.form-wrapper > * {
|
|
5
|
+
min-height: 32px;
|
|
6
|
+
margin-right: 0;
|
|
7
|
+
margin-bottom: 24px;
|
|
8
|
+
padding-right: 16px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.@{prefix}-form.ant-form-horizontal .ant-form-item-label {
|
|
13
|
+
min-width: 80px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.@{prefix}-form.ant-form-inline .form-wrapper,
|
|
17
|
+
.@{prefix}-form.ant-form-inline.inlineVertical .form-wrapper {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
align-items: flex-end;
|
|
21
|
+
height: min-content;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.@{prefix}-form.ant-form-inline.inlineVertical {
|
|
25
|
+
.ant-form-item-row {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
.ant-form-item-label {
|
|
29
|
+
text-align: left;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/esm/DInput/index.js
CHANGED
|
@@ -6,10 +6,10 @@ var _excluded = ["className", "onChange", "onCompositionStart", "onCompositionEn
|
|
|
6
6
|
* @Author : wangfeihu
|
|
7
7
|
* @Date : 2023-05-16 10:08:26
|
|
8
8
|
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-08-16 16:48:52
|
|
10
10
|
* @Description : 基于antd的Input组件
|
|
11
11
|
*/
|
|
12
|
-
import React, { useRef, forwardRef, useState, useContext } from 'react';
|
|
12
|
+
import React, { useRef, forwardRef, useState, useEffect, useContext } from 'react';
|
|
13
13
|
import { Input } from 'antd';
|
|
14
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -72,6 +72,9 @@ function InternalInput(props, ref) {
|
|
|
72
72
|
emitChange(e.target.value, e);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
return setValue(initValue);
|
|
77
|
+
}, [initValue]);
|
|
75
78
|
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
76
79
|
className: _className,
|
|
77
80
|
ref: ref,
|
|
@@ -2,12 +2,12 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["className", "popupClassName", "fieldNames", "searchValue", "filterOption", "options", "onSearch", "loading", "debounce"];
|
|
5
|
-
/*
|
|
6
|
-
* @Author : wangfeihu
|
|
7
|
-
* @Date : 2023-05-17 08:41:25
|
|
8
|
-
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-07-11 15:44:04
|
|
10
|
-
* @Description : 基于antd的Select组件
|
|
5
|
+
/*
|
|
6
|
+
* @Author : wangfeihu
|
|
7
|
+
* @Date : 2023-05-17 08:41:25
|
|
8
|
+
* @LastEditors : wangfeihu
|
|
9
|
+
* @LastEditTime : 2023-07-11 15:44:04
|
|
10
|
+
* @Description : 基于antd的Select组件
|
|
11
11
|
*/
|
|
12
12
|
import React, { forwardRef, useEffect, useRef, useState, useMemo, useContext } from 'react';
|
|
13
13
|
import { Select } from 'antd';
|
|
@@ -2,6 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { TableProps } from 'antd';
|
|
3
3
|
import { ColumnType } from 'antd/lib/table';
|
|
4
4
|
import './index.less';
|
|
5
|
+
export declare type DColumnType = ColumnType<any> & {
|
|
6
|
+
cellEllipsis?: boolean;
|
|
7
|
+
};
|
|
5
8
|
export declare type DTableSourceProps = {
|
|
6
9
|
records: TableProps<any>['dataSource'];
|
|
7
10
|
total: number;
|
|
@@ -12,28 +15,32 @@ export declare type TableParamsProps = {
|
|
|
12
15
|
size?: number;
|
|
13
16
|
[key: string]: any;
|
|
14
17
|
};
|
|
15
|
-
export declare type DTableProps = TableProps<any> & {
|
|
18
|
+
export declare type DTableProps = Omit<TableProps<any>, 'columns'> & {
|
|
16
19
|
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
17
|
-
|
|
20
|
+
defaultColumnProps?: DColumnType;
|
|
18
21
|
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
19
|
-
actionColumn?:
|
|
22
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
20
23
|
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
21
|
-
loadMore?: (params?: TableParamsProps) => Promise<DTableSourceProps>;
|
|
24
|
+
loadMore?: (params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>;
|
|
22
25
|
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
23
26
|
showErrorMsg?: boolean | ((err: any) => string);
|
|
24
27
|
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
25
28
|
extraParams?: TableParamsProps;
|
|
29
|
+
/** 表格列配置 */
|
|
30
|
+
columns?: DColumnType[];
|
|
26
31
|
};
|
|
27
|
-
declare const DTable: React.ForwardRefExoticComponent<TableProps<any> & {
|
|
32
|
+
declare const DTable: React.ForwardRefExoticComponent<Omit<TableProps<any>, "columns"> & {
|
|
28
33
|
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
29
|
-
|
|
34
|
+
defaultColumnProps?: DColumnType | undefined;
|
|
30
35
|
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
31
|
-
actionColumn?:
|
|
36
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
32
37
|
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
33
|
-
loadMore?: ((params?: TableParamsProps) => Promise<DTableSourceProps>) | undefined;
|
|
38
|
+
loadMore?: ((params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>) | undefined;
|
|
34
39
|
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
35
40
|
showErrorMsg?: boolean | ((err: any) => string) | undefined;
|
|
36
41
|
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
37
42
|
extraParams?: TableParamsProps | undefined;
|
|
43
|
+
/** 表格列配置 */
|
|
44
|
+
columns?: DColumnType[] | undefined;
|
|
38
45
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
39
46
|
export default DTable;
|
package/dist/esm/DTable/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
var _excluded = ["loadMore", "
|
|
4
|
+
var _excluded = ["loadMore", "defaultColumnProps", "actionColumn", "showErrorMsg", "extraParams", "dataSource", "rowKey", "scroll", "className", "pagination", "columns", "loading"];
|
|
5
5
|
/*
|
|
6
6
|
* @Author : wangfeihu
|
|
7
7
|
* @Date : 2023-05-09 15:04:48
|
|
8
8
|
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-08-16 16:45:15
|
|
10
10
|
* @Description : 基于antd的Table组件
|
|
11
11
|
*/
|
|
12
12
|
import React, { forwardRef, useEffect, useRef, useState, useContext } from 'react';
|
|
@@ -31,20 +31,33 @@ var defaultPagination = {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// 数据列
|
|
35
|
+
function getColumns(columns, defaultColumnProps) {
|
|
36
|
+
return columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
37
|
+
var _item = _objectSpread(_objectSpread({
|
|
38
|
+
align: 'center',
|
|
39
|
+
ellipsis: {
|
|
40
|
+
showTitle: false
|
|
41
|
+
},
|
|
42
|
+
cellEllipsis: true
|
|
43
|
+
}, defaultColumnProps), item);
|
|
44
|
+
if (_item.cellEllipsis === false) {
|
|
45
|
+
_item.className = _item !== null && _item !== void 0 && _item.className ? 'd-table-cell-wrap ' + _item.className : 'd-table-cell-wrap';
|
|
46
|
+
}
|
|
47
|
+
return _item;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
// 操作列
|
|
35
|
-
function getActionColumnProps(props,
|
|
52
|
+
function getActionColumnProps(props, defaultColumnProps) {
|
|
36
53
|
var defaultProps = {
|
|
37
54
|
width: 140,
|
|
38
55
|
title: '操作',
|
|
39
56
|
dataIndex: 'action'
|
|
40
57
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
return _objectSpread(_objectSpread(_objectSpread({}, columnsProp), defaultProps), props);
|
|
47
|
-
}
|
|
58
|
+
return typeof props === 'function' ? _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), {}, {
|
|
59
|
+
render: props
|
|
60
|
+
}) : _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), props);
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
// 分页配置
|
|
@@ -61,7 +74,7 @@ function getTablePage(_pagination) {
|
|
|
61
74
|
}
|
|
62
75
|
function InternalTable(props, ref) {
|
|
63
76
|
var loadMore = props.loadMore,
|
|
64
|
-
|
|
77
|
+
defaultColumnProps = props.defaultColumnProps,
|
|
65
78
|
actionColumn = props.actionColumn,
|
|
66
79
|
_props$showErrorMsg = props.showErrorMsg,
|
|
67
80
|
showErrorMsg = _props$showErrorMsg === void 0 ? true : _props$showErrorMsg,
|
|
@@ -100,17 +113,13 @@ function InternalTable(props, ref) {
|
|
|
100
113
|
y: 'calc(100% - 56px)'
|
|
101
114
|
};
|
|
102
115
|
|
|
103
|
-
//
|
|
104
|
-
var _columns = columns
|
|
105
|
-
return _objectSpread(_objectSpread({
|
|
106
|
-
align: 'center',
|
|
107
|
-
ellipsis: true
|
|
108
|
-
}, columnsProp), item);
|
|
109
|
-
});
|
|
116
|
+
// 合并列属性
|
|
117
|
+
var _columns = getColumns(columns, defaultColumnProps);
|
|
110
118
|
|
|
111
119
|
// 加入操作列
|
|
112
|
-
|
|
113
|
-
_actionColumn
|
|
120
|
+
// 加入操作列
|
|
121
|
+
var _actionColumn = actionColumn ? getActionColumnProps(actionColumn, defaultColumnProps) : undefined;
|
|
122
|
+
if (_actionColumn && _columns instanceof Array) _columns.push(_actionColumn);
|
|
114
123
|
|
|
115
124
|
// pcf-table 样式中已经包含对_scroll的支持
|
|
116
125
|
var _className = "".concat(getPrefixCls('table'), " ").concat(className || '', " ").concat(_pagination ? 'height-on-page' : '');
|
|
@@ -134,15 +143,15 @@ function InternalTable(props, ref) {
|
|
|
134
143
|
var paramsString = JSON.stringify(_tableQuery);
|
|
135
144
|
loadingParamsRef.current = paramsString;
|
|
136
145
|
setTableParams(_tableQuery);
|
|
137
|
-
loadMore(_tableQuery).then(function (response) {
|
|
146
|
+
loadMore(_tableQuery, tableSource.records).then(function (response) {
|
|
138
147
|
if (loadingParamsRef.current === paramsString) {
|
|
139
148
|
var _response$total = response.total,
|
|
140
149
|
total = _response$total === void 0 ? 0 : _response$total,
|
|
141
150
|
_response$records = response.records,
|
|
142
|
-
|
|
151
|
+
_records = _response$records === void 0 ? [] : _response$records;
|
|
143
152
|
setTableSource({
|
|
144
153
|
total: total,
|
|
145
|
-
records:
|
|
154
|
+
records: _records,
|
|
146
155
|
loading: false
|
|
147
156
|
});
|
|
148
157
|
}
|
|
@@ -184,6 +193,12 @@ function InternalTable(props, ref) {
|
|
|
184
193
|
}));
|
|
185
194
|
}
|
|
186
195
|
};
|
|
196
|
+
var _tablePagination = _pagination ? _objectSpread(_objectSpread({}, _pagination), {}, {
|
|
197
|
+
total: tableSource.total,
|
|
198
|
+
current: tableParams.current,
|
|
199
|
+
pageSize: tableParams.size,
|
|
200
|
+
onChange: onChange
|
|
201
|
+
}) : _pagination;
|
|
187
202
|
|
|
188
203
|
// 数据初始加载
|
|
189
204
|
useEffect(function () {
|
|
@@ -195,12 +210,7 @@ function InternalTable(props, ref) {
|
|
|
195
210
|
className: _className,
|
|
196
211
|
columns: _columns,
|
|
197
212
|
dataSource: tableSource.records,
|
|
198
|
-
pagination:
|
|
199
|
-
total: tableSource.total,
|
|
200
|
-
current: tableParams.current,
|
|
201
|
-
pageSize: tableParams.size,
|
|
202
|
-
onChange: onChange
|
|
203
|
-
}),
|
|
213
|
+
pagination: _tablePagination,
|
|
204
214
|
scroll: _scroll,
|
|
205
215
|
loading: _objectSpread(_objectSpread({}, _loading), {}, {
|
|
206
216
|
spinning: tableSource.loading
|