@pointcloud/pcloud-components 1.0.4 → 1.0.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/AdvancedFilter/styles/index.less +143 -143
  3. package/dist/esm/AnimatedScrollList/styles/index.less +22 -22
  4. package/dist/esm/CRUD/index.less +156 -154
  5. package/dist/esm/CRUD/toolbar.d.ts +3 -3
  6. package/dist/esm/ColorPicker/index.js +4 -4
  7. package/dist/esm/ContextMenu/index.less +61 -61
  8. package/dist/esm/DCascader/index.d.ts +1 -1
  9. package/dist/esm/DForm/DItem/itemsRender.js +6 -6
  10. package/dist/esm/DForm/index.js +6 -6
  11. package/dist/esm/DForm/index.less +50 -50
  12. package/dist/esm/DInput/index.js +6 -6
  13. package/dist/esm/DModal/styles/index.less +33 -33
  14. package/dist/esm/DRangePicker/index.less +30 -30
  15. package/dist/esm/DSelect/index.d.ts +1 -1
  16. package/dist/esm/DTable/index.d.ts +7 -3
  17. package/dist/esm/DTable/index.js +53 -19
  18. package/dist/esm/DTable/index.less +13 -23
  19. package/dist/esm/DUpload/helper.js +47 -47
  20. package/dist/esm/DUpload/index.js +6 -6
  21. package/dist/esm/DynamicFormItem/index.less +28 -28
  22. package/dist/esm/IPAddress/index.less +75 -75
  23. package/dist/esm/InfiniteScrollList/index.d.ts +1 -1
  24. package/dist/esm/InfiniteScrollList/index.js +3 -3
  25. package/dist/esm/InfiniteScrollList/styles/index.less +24 -24
  26. package/dist/esm/Loading/styles/index.less +37 -37
  27. package/dist/esm/LoginForm/index.js +1 -0
  28. package/dist/esm/ModalTable/index.d.ts +3 -0
  29. package/dist/esm/ModalTable/index.js +95 -0
  30. package/dist/esm/ModalTable/interface.d.ts +23 -0
  31. package/dist/esm/ModalTable/interface.js +1 -0
  32. package/dist/esm/OrgTree/index.less +15 -15
  33. package/dist/esm/RCropper/index.js +5 -5
  34. package/dist/esm/RCropper/styles/toolbar.less +25 -25
  35. package/dist/esm/SignaturePad/style/index.less +47 -47
  36. package/dist/esm/TypewriterText/index.less +29 -29
  37. package/dist/esm/index.d.ts +2 -0
  38. package/dist/esm/index.js +1 -0
  39. package/dist/umd/pcloud-components.min.css +1 -1
  40. package/dist/umd/pcloud-components.min.js +1 -1
  41. package/package.json +133 -133
@@ -1,11 +1,11 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _typeof from "@babel/runtime/helpers/esm/typeof";
3
- /*
4
- * @Author : wangfeihu
5
- * @Date : 2023-06-16 11:25:57
6
- * @LastEditors : wangfeihu
7
- * @LastEditTime : 2023-08-30 11:26:22
8
- * @Description : 辅助方法集合
3
+ /*
4
+ * @Author : wangfeihu
5
+ * @Date : 2023-06-16 11:25:57
6
+ * @LastEditors : wangfeihu
7
+ * @LastEditTime : 2023-08-30 11:26:22
8
+ * @Description : 辅助方法集合
9
9
  */
10
10
 
11
11
  /** 转换base64时的参数 */
@@ -41,12 +41,12 @@ function getType(value) {
41
41
  }
42
42
  }
43
43
 
44
- /**
45
- * @description : 将图像文件转换为Base64格式
46
- * @param {Blob} blob 图像文件
47
- * @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
48
- * @return {Promise<string>} 包含Base64字符串的Promise对象
49
- * @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
44
+ /**
45
+ * @description : 将图像文件转换为Base64格式
46
+ * @param {Blob} blob 图像文件
47
+ * @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
48
+ * @return {Promise<string>} 包含Base64字符串的Promise对象
49
+ * @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
50
50
  */
51
51
  function imageToBase64(blob, options) {
52
52
  return new Promise(function (resolve, reject) {
@@ -97,11 +97,11 @@ function imageToBase64(blob, options) {
97
97
  });
98
98
  }
99
99
 
100
- /**
101
- * @description : 将传入的文件转换为UploadFile数组
102
- * @param {any} files 目标文件对象
103
- * @return {UploadFile[]} UploadFile数组
104
- * @example :
100
+ /**
101
+ * @description : 将传入的文件转换为UploadFile数组
102
+ * @param {any} files 目标文件对象
103
+ * @return {UploadFile[]} UploadFile数组
104
+ * @example :
105
105
  */
106
106
  function getUploadFile(files, maxCount) {
107
107
  if (files) {
@@ -114,11 +114,11 @@ function getUploadFile(files, maxCount) {
114
114
  return [];
115
115
  }
116
116
 
117
- /**
118
- * @description : 根据传入的option对象获取缩略图参数
119
- * @param {ThumbOptionProps} option 缩略图参数对象
120
- * @return {ThumbOptionProps} ThumbOption对象
121
- * @example :
117
+ /**
118
+ * @description : 根据传入的option对象获取缩略图参数
119
+ * @param {ThumbOptionProps} option 缩略图参数对象
120
+ * @return {ThumbOptionProps} ThumbOption对象
121
+ * @example :
122
122
  */
123
123
  function getThumbOption(option) {
124
124
  var _ref2 = option || {},
@@ -152,12 +152,12 @@ function getThumbOption(option) {
152
152
  return _option;
153
153
  }
154
154
 
155
- /**
156
- * @description : a标签下载文件
157
- * @param {Blob | string} url a标签的下载url或文件流
158
- * @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
159
- * @return {*}
160
- * @example :
155
+ /**
156
+ * @description : a标签下载文件
157
+ * @param {Blob | string} url a标签的下载url或文件流
158
+ * @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
159
+ * @return {*}
160
+ * @example :
161
161
  */
162
162
  function downloadFile(url, fileName) {
163
163
  var eLink = document.createElement('a');
@@ -170,11 +170,11 @@ function downloadFile(url, fileName) {
170
170
  document.body.removeChild(eLink);
171
171
  }
172
172
 
173
- /**
174
- * @description : a标签预览文件
175
- * @param {Blob | string} url a标签的预览url或文件流
176
- * @return {*}
177
- * @example :
173
+ /**
174
+ * @description : a标签预览文件
175
+ * @param {Blob | string} url a标签的预览url或文件流
176
+ * @return {*}
177
+ * @example :
178
178
  */
179
179
  function previewFile(url) {
180
180
  var eLink = document.createElement('a');
@@ -187,13 +187,13 @@ function previewFile(url) {
187
187
  document.body.removeChild(eLink);
188
188
  }
189
189
 
190
- /**
191
- * @description : 以递归方式深度查找一个对象
192
- * @param {Record} object 待查找的对象
193
- * @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
194
- * @param {number} maxDepth 递归的最大深度,默认10
195
- * @return {*} 查找到的对象,未查找到则返回undefined
196
- * @example :
190
+ /**
191
+ * @description : 以递归方式深度查找一个对象
192
+ * @param {Record} object 待查找的对象
193
+ * @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
194
+ * @param {number} maxDepth 递归的最大深度,默认10
195
+ * @return {*} 查找到的对象,未查找到则返回undefined
196
+ * @example :
197
197
  */
198
198
  // eslint-disable-next-line no-unused-vars
199
199
  function deepFindObject(object, fn) {
@@ -223,13 +223,13 @@ function deepFindObject(object, fn) {
223
223
  return recursive(object, undefined, '', fn, {});
224
224
  }
225
225
 
226
- /**
227
- * @description : 以递归方式深度查找一个Jsx对象
228
- * @param {Record} object 待查找的Jsx对象
229
- * @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
230
- * @param {number} maxDepth 递归的最大深度,默认10
231
- * @return {*} 查找到的对象,未查找到则返回undefined
232
- * @example :
226
+ /**
227
+ * @description : 以递归方式深度查找一个Jsx对象
228
+ * @param {Record} object 待查找的Jsx对象
229
+ * @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
230
+ * @param {number} maxDepth 递归的最大深度,默认10
231
+ * @return {*} 查找到的对象,未查找到则返回undefined
232
+ * @example :
233
233
  */
234
234
  // eslint-disable-next-line no-unused-vars
235
235
  function deepFindJsx(object, fn) {
@@ -6,12 +6,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
7
  import _typeof from "@babel/runtime/helpers/esm/typeof";
8
8
  var _excluded = ["value", "thumbOption", "uploadButton", "itemClassName", "enablePreview", "className", "maxCount", "children", "itemRender", "customRequest", "onRemove", "onDownload", "onPreview", "onChange", "defaultFileList", "showUploadList", "fileList"];
9
- /*
10
- * @Author : wangfeihu
11
- * @Date : 2023-06-16 09:37:07
12
- * @LastEditors : wangfeihu
13
- * @LastEditTime : 2023-09-07 16:33:53
14
- * @Description : 基于antd的Upload组件
9
+ /*
10
+ * @Author : wangfeihu
11
+ * @Date : 2023-06-16 09:37:07
12
+ * @LastEditors : wangfeihu
13
+ * @LastEditTime : 2023-09-07 16:33:53
14
+ * @Description : 基于antd的Upload组件
15
15
  */
16
16
 
17
17
  import React, { forwardRef, useEffect, useMemo, useState, useContext } from 'react';
@@ -1,28 +1,28 @@
1
- .dynamic-form-item {
2
- width: 100%;
3
- display: flex;
4
- align-items: flex-start;
5
- gap: 8px;
6
- margin-bottom: 8px;
7
-
8
- .ant-form-item {
9
- flex: 1;
10
- margin-bottom: 0;
11
- }
12
-
13
- .ant-btn-link {
14
- flex-shrink: 0;
15
- }
16
-
17
- &.single {
18
- .ant-space-item:first-of-type {
19
- display: flex;
20
- flex: 1;
21
- }
22
- }
23
- }
24
-
25
- // 隐藏其他label,只显示第一个但占位
26
- .dynamic-form-item ~ .dynamic-form-item .ant-col.ant-form-item-label {
27
- visibility: hidden;
28
- }
1
+ .dynamic-form-item {
2
+ width: 100%;
3
+ display: flex;
4
+ align-items: flex-start;
5
+ gap: 8px;
6
+ margin-bottom: 8px;
7
+
8
+ .ant-form-item {
9
+ flex: 1;
10
+ margin-bottom: 0;
11
+ }
12
+
13
+ .ant-btn-link {
14
+ flex-shrink: 0;
15
+ }
16
+
17
+ &.single {
18
+ .ant-space-item:first-of-type {
19
+ display: flex;
20
+ flex: 1;
21
+ }
22
+ }
23
+ }
24
+
25
+ // 隐藏其他label,只显示第一个但占位
26
+ .dynamic-form-item ~ .dynamic-form-item .ant-col.ant-form-item-label {
27
+ visibility: hidden;
28
+ }
@@ -1,75 +1,75 @@
1
- @import '../commonStyle/index.less';
2
-
3
- .@{prefix}-ip-address {
4
- border: 1px solid #d9d9d9;
5
- border-radius: 2px;
6
- transition: all 0.3s;
7
- display: inline-block;
8
-
9
- &.small {
10
- height: 24px;
11
- }
12
-
13
- &.large {
14
- padding: 6.5px 10px;
15
- }
16
-
17
- &.middle {
18
- padding: 4px 10px;
19
- }
20
-
21
- &.disabled {
22
- color: rgba(0, 0, 0, 25%);
23
- background-color: #f5f5f5;
24
- border-color: #d9d9d9;
25
- box-shadow: none;
26
- cursor: not-allowed;
27
- opacity: 1;
28
-
29
- &:hover {
30
- border-color: #d9d9d9;
31
- }
32
- }
33
-
34
- &:hover {
35
- border-color: #4d90ff;
36
- }
37
-
38
- &:focus-within {
39
- border-color: #40a9ff;
40
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 20%);
41
- }
42
-
43
- input {
44
- border: none;
45
- background: none;
46
- text-align: center;
47
- outline: 0;
48
- padding: 0;
49
- margin: 0;
50
- box-sizing: border-box;
51
- font-variant: tabular-nums;
52
- font-feature-settings: 'tnum';
53
- position: relative;
54
- display: inline-block;
55
- color: #000000d9;
56
- font-size: 14px;
57
- line-height: 1.5715;
58
- }
59
-
60
- input[disabled] {
61
- cursor: not-allowed;
62
- color: inherit;
63
- }
64
-
65
- input[type='number'] {
66
- appearance: textfield; /* 移除Firefox的特殊样式 */
67
- }
68
-
69
- /* 移除上下箭头 */
70
- input[type='number']::-webkit-outer-spin-button,
71
- input[type='number']::-webkit-inner-spin-button {
72
- appearance: none;
73
- margin: 0;
74
- }
75
- }
1
+ @import '../commonStyle/index.less';
2
+
3
+ .@{prefix}-ip-address {
4
+ border: 1px solid #d9d9d9;
5
+ border-radius: 2px;
6
+ transition: all 0.3s;
7
+ display: inline-block;
8
+
9
+ &.small {
10
+ height: 24px;
11
+ }
12
+
13
+ &.large {
14
+ padding: 6.5px 10px;
15
+ }
16
+
17
+ &.middle {
18
+ padding: 4px 10px;
19
+ }
20
+
21
+ &.disabled {
22
+ color: rgba(0, 0, 0, 25%);
23
+ background-color: #f5f5f5;
24
+ border-color: #d9d9d9;
25
+ box-shadow: none;
26
+ cursor: not-allowed;
27
+ opacity: 1;
28
+
29
+ &:hover {
30
+ border-color: #d9d9d9;
31
+ }
32
+ }
33
+
34
+ &:hover {
35
+ border-color: #4d90ff;
36
+ }
37
+
38
+ &:focus-within {
39
+ border-color: #40a9ff;
40
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 20%);
41
+ }
42
+
43
+ input {
44
+ border: none;
45
+ background: none;
46
+ text-align: center;
47
+ outline: 0;
48
+ padding: 0;
49
+ margin: 0;
50
+ box-sizing: border-box;
51
+ font-variant: tabular-nums;
52
+ font-feature-settings: 'tnum';
53
+ position: relative;
54
+ display: inline-block;
55
+ color: #000000d9;
56
+ font-size: 14px;
57
+ line-height: 1.5715;
58
+ }
59
+
60
+ input[disabled] {
61
+ cursor: not-allowed;
62
+ color: inherit;
63
+ }
64
+
65
+ input[type='number'] {
66
+ appearance: textfield; /* 移除Firefox的特殊样式 */
67
+ }
68
+
69
+ /* 移除上下箭头 */
70
+ input[type='number']::-webkit-outer-spin-button,
71
+ input[type='number']::-webkit-inner-spin-button {
72
+ appearance: none;
73
+ margin: 0;
74
+ }
75
+ }
@@ -60,7 +60,7 @@ interface ISLProps<T, P> {
60
60
  /**
61
61
  * @description 列表项点击事件
62
62
  */
63
- onItemClick?: (item: P, index: number) => void;
63
+ onItemClick?: (_item: P, _index: number) => void;
64
64
  }
65
65
  export type InfiniteScrollListProps<T, P> = ISLProps<T, P>;
66
66
  declare const _default: React.MemoExoticComponent<(<T, P>(props: ISLProps<T, P>) => import("react/jsx-runtime").JSX.Element)>;
@@ -115,11 +115,11 @@ var InfiniteScrollList = function InfiniteScrollList(props) {
115
115
  var key = itemElement === null || itemElement === void 0 || (_itemElement$dataset = itemElement.dataset) === null || _itemElement$dataset === void 0 ? void 0 : _itemElement$dataset.key;
116
116
  if (key && ((_listDataRef$current = listDataRef.current) === null || _listDataRef$current === void 0 || (_listDataRef$current = _listDataRef$current.data) === null || _listDataRef$current === void 0 ? void 0 : _listDataRef$current.length) > 0) {
117
117
  var _listDataRef$current$;
118
- var _index = listDataRef.current.data.findIndex(function (item, index) {
118
+ var _index2 = listDataRef.current.data.findIndex(function (item, index) {
119
119
  return item[itemKey] === key || index === Number(key);
120
120
  });
121
- if (_index >= 0 && _index < ((_listDataRef$current$ = listDataRef.current.data) === null || _listDataRef$current$ === void 0 ? void 0 : _listDataRef$current$.length)) {
122
- onItemClick === null || onItemClick === void 0 || onItemClick(listDataRef.current.data[_index], _index);
121
+ if (_index2 >= 0 && _index2 < ((_listDataRef$current$ = listDataRef.current.data) === null || _listDataRef$current$ === void 0 ? void 0 : _listDataRef$current$.length)) {
122
+ onItemClick === null || onItemClick === void 0 || onItemClick(listDataRef.current.data[_index2], _index2);
123
123
  }
124
124
  }
125
125
  }, [itemKey, onItemClick]);
@@ -1,24 +1,24 @@
1
- @import '../../commonStyle/index.less';
2
-
3
- .@{prefix}-infinite-scroll-wrapper {
4
- .ant-list .ant-row {
5
- margin-right: 0 !important;
6
- }
7
- }
8
-
9
- .scroll-container {
10
- position: relative;
11
- overflow-y: auto;
12
- overflow-x: hidden;
13
-
14
- .backtop {
15
- right: 50px;
16
- }
17
-
18
- .up {
19
- background: #007aff;
20
- color: #fff;
21
- text-align: center;
22
- border-radius: 3px;
23
- }
24
- }
1
+ @import '../../commonStyle/index.less';
2
+
3
+ .@{prefix}-infinite-scroll-wrapper {
4
+ .ant-list .ant-row {
5
+ margin-right: 0 !important;
6
+ }
7
+ }
8
+
9
+ .scroll-container {
10
+ position: relative;
11
+ overflow-y: auto;
12
+ overflow-x: hidden;
13
+
14
+ .backtop {
15
+ right: 50px;
16
+ }
17
+
18
+ .up {
19
+ background: #007aff;
20
+ color: #fff;
21
+ text-align: center;
22
+ border-radius: 3px;
23
+ }
24
+ }
@@ -1,37 +1,37 @@
1
- @import '../../commonStyle/index.less';
2
-
3
- .@{prefix}-loading {
4
- .mask {
5
- position: absolute;
6
- top: 0;
7
- left: 0;
8
- z-index: 100000;
9
- width: 100%;
10
- height: 100%;
11
- overflow: hidden;
12
- background: rgba(0, 0, 0, 30%); // 添加半透明背景色
13
- }
14
-
15
- .loading {
16
- position: absolute;
17
- top: 50%;
18
- left: 50%;
19
- z-index: 100001;
20
- padding: 20px;
21
- background: rgba(255, 255, 255, 90%); // 调整背景透明度
22
- border-radius: 10px;
23
- box-shadow: 3px 3px 3px rgba(0, 0, 0, 20%); // 调整阴影
24
- transform: translate(-50%, -50%);
25
- }
26
-
27
- /* 当挂载到body时使用fixed定位 */
28
- &.body-container {
29
- .mask {
30
- position: fixed;
31
- }
32
-
33
- .loading {
34
- position: fixed;
35
- }
36
- }
37
- }
1
+ @import '../../commonStyle/index.less';
2
+
3
+ .@{prefix}-loading {
4
+ .mask {
5
+ position: absolute;
6
+ top: 0;
7
+ left: 0;
8
+ z-index: 100000;
9
+ width: 100%;
10
+ height: 100%;
11
+ overflow: hidden;
12
+ background: rgba(0, 0, 0, 30%); // 添加半透明背景色
13
+ }
14
+
15
+ .loading {
16
+ position: absolute;
17
+ top: 50%;
18
+ left: 50%;
19
+ z-index: 100001;
20
+ padding: 20px;
21
+ background: rgba(255, 255, 255, 90%); // 调整背景透明度
22
+ border-radius: 10px;
23
+ box-shadow: 3px 3px 3px rgba(0, 0, 0, 20%); // 调整阴影
24
+ transform: translate(-50%, -50%);
25
+ }
26
+
27
+ /* 当挂载到body时使用fixed定位 */
28
+ &.body-container {
29
+ .mask {
30
+ position: fixed;
31
+ }
32
+
33
+ .loading {
34
+ position: fixed;
35
+ }
36
+ }
37
+ }
@@ -115,6 +115,7 @@ var LoginForm = /*#__PURE__*/forwardRef(function (props, ref) {
115
115
  }();
116
116
 
117
117
  // 将 restProps 中可能与 items 冲突的属性排除
118
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
118
119
  var children = restProps.children,
119
120
  formPropsWithoutChildren = _objectWithoutProperties(restProps, _excluded2);
120
121
  return /*#__PURE__*/_jsx(DForm, _objectSpread({
@@ -0,0 +1,3 @@
1
+ import type { ModalTableProps } from './interface';
2
+ declare const _default: (props: ModalTableProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default _default;
@@ -0,0 +1,95 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import { useRef, useCallback, useMemo } from 'react';
4
+ import DForm from "../DForm";
5
+ import DModal from "../DModal";
6
+ import DTable from "../DTable";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ export default (function (props) {
10
+ var _props$modalProps = props.modalProps,
11
+ modalProps = _props$modalProps === void 0 ? {} : _props$modalProps,
12
+ formProps = props.formProps,
13
+ tableProps = props.tableProps,
14
+ _props$showSearchForm = props.showSearchForm,
15
+ showSearchForm = _props$showSearchForm === void 0 ? true : _props$showSearchForm,
16
+ _props$searchMode = props.searchMode,
17
+ searchMode = _props$searchMode === void 0 ? 'immediate' : _props$searchMode;
18
+ var tableRef = useRef(null);
19
+ var handleSearch = useCallback(function (values) {
20
+ if (tableRef.current) {
21
+ tableRef.current.refresh(_objectSpread({}, values));
22
+ }
23
+ }, []);
24
+ var defaultFormItems = useMemo(function () {
25
+ if (searchMode === 'submit') {
26
+ return [{
27
+ renderType: 'button',
28
+ htmlType: 'submit',
29
+ label: '查询',
30
+ type: 'primary',
31
+ className: 'search-button',
32
+ style: {
33
+ marginBottom: '24px'
34
+ }
35
+ }, {
36
+ renderType: 'button',
37
+ htmlType: 'reset',
38
+ label: '重置',
39
+ className: 'reset-button',
40
+ style: {
41
+ marginLeft: '10px',
42
+ marginBottom: '24px'
43
+ }
44
+ }];
45
+ }
46
+ return [];
47
+ }, [searchMode]);
48
+ var mergedItems = useMemo(function () {
49
+ if (!(formProps !== null && formProps !== void 0 && formProps.items) || formProps.items.length === 0) {
50
+ return defaultFormItems;
51
+ }
52
+ return [].concat(_toConsumableArray(formProps.items), _toConsumableArray(defaultFormItems));
53
+ }, [formProps === null || formProps === void 0 ? void 0 : formProps.items, defaultFormItems]);
54
+ var searchFormProps = _objectSpread(_objectSpread({
55
+ layout: 'inline',
56
+ onFinish: searchMode === 'submit' ? handleSearch : undefined,
57
+ onReset: searchMode === 'submit' ? function () {
58
+ var _formProps$items;
59
+ var resetValues = {
60
+ current: 1
61
+ };
62
+ formProps === null || formProps === void 0 || (_formProps$items = formProps.items) === null || _formProps$items === void 0 || _formProps$items.forEach(function (item) {
63
+ if (item.name) {
64
+ resetValues[item.name] = undefined;
65
+ }
66
+ });
67
+ handleSearch(resetValues);
68
+ } : undefined,
69
+ onValuesChange: searchMode === 'immediate' ? function (_, allValues) {
70
+ return handleSearch(_objectSpread(_objectSpread({}, allValues), {}, {
71
+ current: 1
72
+ }));
73
+ } : undefined
74
+ }, formProps), {}, {
75
+ items: mergedItems
76
+ });
77
+ var tableElement = /*#__PURE__*/_jsx(DTable, _objectSpread(_objectSpread({}, tableProps), {}, {
78
+ ref: tableRef
79
+ }));
80
+ return /*#__PURE__*/_jsxs(DModal, _objectSpread(_objectSpread({
81
+ open: modalProps.open,
82
+ style: {
83
+ height: 'auto'
84
+ },
85
+ centered: true,
86
+ destroyOnClose: true,
87
+ bodyStyle: {
88
+ maxHeight: '600px',
89
+ overflowY: 'auto'
90
+ },
91
+ title: modalProps.title || '数据列表'
92
+ }, modalProps), {}, {
93
+ children: [showSearchForm && /*#__PURE__*/_jsx(DForm, _objectSpread({}, searchFormProps)), tableElement]
94
+ }));
95
+ });
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import type { DModalProps } from '../DModal/interface';
3
+ import type { DFormProps } from '../DForm';
4
+ import type { DTableProps, DTableRef } from '../DTable';
5
+ export interface ModalTableProps {
6
+ /** DModal props */
7
+ modalProps?: DModalProps;
8
+ /** DForm props for search form */
9
+ formProps?: DFormProps;
10
+ /** DTable props */
11
+ tableProps?: DTableProps & {
12
+ ref?: React.Ref<DTableRef>;
13
+ };
14
+ /** Whether to show search form, default true */
15
+ showSearchForm?: boolean;
16
+ /**
17
+ * 搜索模式
18
+ * - `immediate`: 表单值变化时立即请求数据刷新
19
+ * - `submit`: 表单提交时请求数据刷新,表单会自动补充查询和重置按钮
20
+ * @default 'immediate'
21
+ */
22
+ searchMode?: 'immediate' | 'submit';
23
+ }
@@ -0,0 +1 @@
1
+ export {};