@pointcloud/pcloud-components 1.0.2 → 1.0.4
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/dist/esm/AdvancedFilter/index.js +1 -0
- package/dist/esm/AdvancedFilter/styles/index.less +143 -146
- package/dist/esm/AnimatedScrollList/index.js +16 -12
- package/dist/esm/CRUD/index.js +10 -7
- package/dist/esm/CRUD/toolbar.js +7 -7
- package/dist/esm/DForm/DItem/index.d.ts +3 -2
- package/dist/esm/DForm/DItem/index.js +2 -1
- package/dist/esm/DForm/DItem/itemType.d.ts +11 -13
- package/dist/esm/DForm/index.js +8 -5
- package/dist/esm/DInput/index.js +11 -3
- package/dist/esm/DModal/index.js +16 -9
- package/dist/esm/DModal/interface.d.ts +1 -1
- package/dist/esm/DModal/styles/index.less +33 -27
- package/dist/esm/DTable/index.js +15 -13
- package/dist/esm/DynamicFormItem/index.js +3 -1
- package/dist/esm/ModalForm/index.js +40 -45
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +1 -1
|
@@ -94,6 +94,7 @@ var AdvancedFilter = function AdvancedFilter(props) {
|
|
|
94
94
|
onSearch: _inputSearch,
|
|
95
95
|
value: inputValue
|
|
96
96
|
}, otherInputProps)), /*#__PURE__*/_jsxs(Button, {
|
|
97
|
+
type: "primary",
|
|
97
98
|
className: "button",
|
|
98
99
|
onClick: function onClick() {
|
|
99
100
|
return setPanelVisible(!panelVisible);
|
|
@@ -1,146 +1,143 @@
|
|
|
1
|
-
@import '../../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
.@{prefix}-search-filter {
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 100%;
|
|
6
|
-
margin-top: 10px;
|
|
7
|
-
background-color: #fff;
|
|
8
|
-
|
|
9
|
-
span.ant-collapse-header-text {
|
|
10
|
-
display: inline-block;
|
|
11
|
-
width: 100%;
|
|
12
|
-
cursor: auto !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ant-collapse-content-box {
|
|
16
|
-
padding: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.search-header {
|
|
20
|
-
display: flex;
|
|
21
|
-
width: 100%;
|
|
22
|
-
|
|
23
|
-
.left {
|
|
24
|
-
max-width: 100%;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
white-space: no-wrap;
|
|
27
|
-
text-overflow: ellipsis;
|
|
28
|
-
|
|
29
|
-
:global {
|
|
30
|
-
.ant-radio-wrapper:first-child {
|
|
31
|
-
border-left: 1px solid #d9d9d9;
|
|
32
|
-
border-radius: 5px 0 0 5px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.ant-radio-wrapper:last-child {
|
|
36
|
-
border-radius: 0 5px 5px 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.ant-radio-wrapper {
|
|
40
|
-
margin-right: 0;
|
|
41
|
-
padding: 4px 6px;
|
|
42
|
-
border: 1px solid #d9d9d9;
|
|
43
|
-
border-top-width: 1px;
|
|
44
|
-
border-left: 1px solid #fff;
|
|
45
|
-
border-left-width: 1px;
|
|
46
|
-
|
|
47
|
-
.ant-radio {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.ant-radio-wrapper:hover {
|
|
53
|
-
color: #1890ff;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.ant-radio-wrapper-checked {
|
|
57
|
-
z-index: 1;
|
|
58
|
-
color: #1890ff;
|
|
59
|
-
background: #fff;
|
|
60
|
-
border: 1px solid #1890ff;
|
|
61
|
-
border-left: 1px solid #1890ff !important;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.right {
|
|
67
|
-
display: flex;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
|
|
70
|
-
.input {
|
|
71
|
-
width: 200px;
|
|
72
|
-
border-radius: 4px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.button {
|
|
76
|
-
margin-left: 10px;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
1
|
+
@import '../../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-search-filter {
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin-top: 10px;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
|
|
9
|
+
span.ant-collapse-header-text {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
width: 100%;
|
|
12
|
+
cursor: auto !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ant-collapse-content-box {
|
|
16
|
+
padding: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.search-header {
|
|
20
|
+
display: flex;
|
|
21
|
+
width: 100%;
|
|
22
|
+
|
|
23
|
+
.left {
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
white-space: no-wrap;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
|
|
29
|
+
:global {
|
|
30
|
+
.ant-radio-wrapper:first-child {
|
|
31
|
+
border-left: 1px solid #d9d9d9;
|
|
32
|
+
border-radius: 5px 0 0 5px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ant-radio-wrapper:last-child {
|
|
36
|
+
border-radius: 0 5px 5px 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-radio-wrapper {
|
|
40
|
+
margin-right: 0;
|
|
41
|
+
padding: 4px 6px;
|
|
42
|
+
border: 1px solid #d9d9d9;
|
|
43
|
+
border-top-width: 1px;
|
|
44
|
+
border-left: 1px solid #fff;
|
|
45
|
+
border-left-width: 1px;
|
|
46
|
+
|
|
47
|
+
.ant-radio {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ant-radio-wrapper:hover {
|
|
53
|
+
color: #1890ff;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ant-radio-wrapper-checked {
|
|
57
|
+
z-index: 1;
|
|
58
|
+
color: #1890ff;
|
|
59
|
+
background: #fff;
|
|
60
|
+
border: 1px solid #1890ff;
|
|
61
|
+
border-left: 1px solid #1890ff !important;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.right {
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
|
|
70
|
+
.input {
|
|
71
|
+
width: 200px;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.button {
|
|
76
|
+
margin-left: 10px;
|
|
77
|
+
|
|
78
|
+
&:active,
|
|
79
|
+
&:focus,
|
|
80
|
+
&:hover {
|
|
81
|
+
border-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.icon {
|
|
85
|
+
margin-left: 8px;
|
|
86
|
+
transition: transform 0.4s;
|
|
87
|
+
|
|
88
|
+
&.down {
|
|
89
|
+
transform: rotateZ(180deg);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.up {
|
|
93
|
+
transform: rotateZ(0deg);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.title {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
margin: 0 10px;
|
|
104
|
+
padding-bottom: 10px;
|
|
105
|
+
font-weight: bold;
|
|
106
|
+
border-bottom: 1px solid #f0f0f0;
|
|
107
|
+
|
|
108
|
+
span.icon {
|
|
109
|
+
width: 4px;
|
|
110
|
+
height: 16px;
|
|
111
|
+
margin-right: 6px;
|
|
112
|
+
background-color: #1890ff;
|
|
113
|
+
border-radius: 2px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.search-content {
|
|
118
|
+
.filter-row {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-wrap: wrap;
|
|
121
|
+
width: 100%;
|
|
122
|
+
padding: 10px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.filter-col {
|
|
126
|
+
height: 30px;
|
|
127
|
+
margin-bottom: 10px;
|
|
128
|
+
line-height: 30px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.filter-col .ant-picker {
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.search-btn {
|
|
136
|
+
justify-content: center;
|
|
137
|
+
|
|
138
|
+
> button {
|
|
139
|
+
margin: 0 5px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import React, { useRef, useEffect, useCallback, useContext } from 'react';
|
|
3
|
+
import React, { useRef, useEffect, useCallback, useContext, useMemo } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ConfigContext } from "../ConfigProvider";
|
|
6
6
|
import "./styles/index.less";
|
|
@@ -286,19 +286,23 @@ function AnimatedScrollList(props) {
|
|
|
286
286
|
}, [data, renderItem, getItemKey]);
|
|
287
287
|
|
|
288
288
|
// 容器样式
|
|
289
|
-
var containerStyle =
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
289
|
+
var containerStyle = useMemo(function () {
|
|
290
|
+
return _objectSpread({
|
|
291
|
+
height: containerHeight,
|
|
292
|
+
width: containerWidth,
|
|
293
|
+
overflow: showScrollbar ? 'auto' : 'hidden',
|
|
294
|
+
position: 'relative'
|
|
295
|
+
}, style);
|
|
296
|
+
}, [containerHeight, containerWidth, showScrollbar, style]);
|
|
295
297
|
|
|
296
298
|
// 内容容器样式
|
|
297
|
-
var contentStyle = {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
var contentStyle = useMemo(function () {
|
|
300
|
+
return {
|
|
301
|
+
display: 'flex',
|
|
302
|
+
flexDirection: isVertical ? 'column' : 'row',
|
|
303
|
+
willChange: 'transform'
|
|
304
|
+
};
|
|
305
|
+
}, [isVertical]);
|
|
302
306
|
return /*#__PURE__*/_jsxs("div", {
|
|
303
307
|
className: wrapperClass,
|
|
304
308
|
children: [header && /*#__PURE__*/_jsx("div", {
|
package/dist/esm/CRUD/index.js
CHANGED
|
@@ -137,7 +137,7 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
137
137
|
return classNames(_defineProperty({
|
|
138
138
|
fullscreen: fullScreen
|
|
139
139
|
}, "".concat(prefixCls, "-crud"), !!prefixCls), classname, className);
|
|
140
|
-
}, [fullScreen]);
|
|
140
|
+
}, [fullScreen, prefixCls, classname, className]);
|
|
141
141
|
var visible = useMemo(function () {
|
|
142
142
|
return conditionVisible ? 'visible' : 'hidden';
|
|
143
143
|
}, [conditionVisible]);
|
|
@@ -585,6 +585,14 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
585
585
|
}, modalFormProps === null || modalFormProps === void 0 ? void 0 : modalFormProps.formProps)
|
|
586
586
|
};
|
|
587
587
|
}, [modalConfig, detailData, handleCancel, handleModalOk, modalFormProps, classname]);
|
|
588
|
+
var onActions = useMemo(function () {
|
|
589
|
+
return {
|
|
590
|
+
setFullScreen: setFullScreen,
|
|
591
|
+
handleRefresh: handleRefresh,
|
|
592
|
+
onColumnSettingChanged: onColumnSettingChanged,
|
|
593
|
+
setConditionVisible: setConditionVisible
|
|
594
|
+
};
|
|
595
|
+
}, [setFullScreen, handleRefresh, onColumnSettingChanged, setConditionVisible]);
|
|
588
596
|
useImperativeHandle(ref, function () {
|
|
589
597
|
return {
|
|
590
598
|
refresh: function refresh(strategy, refreshOptions) {
|
|
@@ -657,12 +665,7 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
657
665
|
fullScreen: fullScreen,
|
|
658
666
|
conditionVisible: conditionVisible,
|
|
659
667
|
columns: originalColumnsRef.current,
|
|
660
|
-
onActions:
|
|
661
|
-
setFullScreen: setFullScreen,
|
|
662
|
-
handleRefresh: handleRefresh,
|
|
663
|
-
onColumnSettingChanged: onColumnSettingChanged,
|
|
664
|
-
setConditionVisible: setConditionVisible
|
|
665
|
-
}
|
|
668
|
+
onActions: onActions
|
|
666
669
|
})]
|
|
667
670
|
}), /*#__PURE__*/_jsx(DTable, _objectSpread(_objectSpread({
|
|
668
671
|
ref: tableRef
|
package/dist/esm/CRUD/toolbar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import { memo, useState, useRef, useEffect, useMemo } from 'react';
|
|
4
|
+
import { memo, useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { Popover, Checkbox, Button } from 'antd';
|
|
7
7
|
import { ReloadOutlined, FullscreenOutlined, FullscreenExitOutlined, BarsOutlined, HolderOutlined, SearchOutlined } from '@ant-design/icons';
|
|
@@ -67,18 +67,18 @@ function Toolbar(_ref) {
|
|
|
67
67
|
setRotating(false);
|
|
68
68
|
}, 500);
|
|
69
69
|
};
|
|
70
|
-
var handleConfirm = function
|
|
70
|
+
var handleConfirm = useCallback(function () {
|
|
71
71
|
var _onActions$onColumnSe;
|
|
72
72
|
setColumnSettingVisible(false);
|
|
73
73
|
onActions === null || onActions === void 0 || (_onActions$onColumnSe = onActions.onColumnSettingChanged) === null || _onActions$onColumnSe === void 0 || _onActions$onColumnSe.call(onActions, columnSetting.checkedList, columnSetting.sortedColumns);
|
|
74
|
-
};
|
|
75
|
-
var handleReset = function
|
|
74
|
+
}, [columnSetting.checkedList, columnSetting.sortedColumns]);
|
|
75
|
+
var handleReset = useCallback(function () {
|
|
76
76
|
setColumnSetting({
|
|
77
77
|
sortedColumns: columns,
|
|
78
78
|
checkedList: checkedValues
|
|
79
79
|
});
|
|
80
|
-
};
|
|
81
|
-
var onCheckAllChange = function
|
|
80
|
+
}, [columns, checkedValues]);
|
|
81
|
+
var onCheckAllChange = useCallback(function (e) {
|
|
82
82
|
var checked = e.target.checked;
|
|
83
83
|
if (checked) {
|
|
84
84
|
// 全选所有列标题
|
|
@@ -100,7 +100,7 @@ function Toolbar(_ref) {
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
};
|
|
103
|
+
}, [columns]);
|
|
104
104
|
useEffect(function () {
|
|
105
105
|
return function () {
|
|
106
106
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DItemProps } from './itemType';
|
|
3
3
|
export type { DItemProps };
|
|
4
4
|
declare function DItem(props: DItemProps): JSX.Element;
|
|
5
|
-
|
|
5
|
+
declare const _default: React.MemoExoticComponent<typeof DItem>;
|
|
6
|
+
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["formItemProps", "label", "name", "renderType", "render", "children"];
|
|
4
|
+
import React from 'react';
|
|
4
5
|
import itemsRender from "./itemsRender";
|
|
5
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -33,4 +34,4 @@ function DItem(props) {
|
|
|
33
34
|
return /*#__PURE__*/_jsx(_Fragment, {});
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
export default DItem;
|
|
37
|
+
export default /*#__PURE__*/React.memo(DItem);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { InputProps, InputNumberProps, AutoCompleteProps, CascaderProps, SelectProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, CheckboxProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, TransferProps, UploadProps, ButtonProps, DividerProps, FormItemProps, RadioGroupProps, ColProps } from 'antd';
|
|
3
3
|
import { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
4
4
|
import { RangePickerProps } from 'antd/lib/date-picker';
|
|
@@ -10,21 +10,12 @@ import { DTreeSelectProps } from '../../DTreeSelect';
|
|
|
10
10
|
import { DUploadProps } from '../../DUpload';
|
|
11
11
|
import { IPAddressProps } from '../../IPAddress';
|
|
12
12
|
import { DRangePickerProps } from '../../DRangePicker/interface';
|
|
13
|
-
export type RenderType = 'custom' | 'dInput' | 'ipAddress' | 'input' | 'textArea' | 'password' | 'inputNumber' | 'autoComplete' | 'dSelect' | 'select' | 'dCascader' | 'cascader' | 'dTreeSelect' | 'treeSelect' | 'datePicker' | 'dRangePicker' | 'timePicker' | 'rangePicker' | 'mentions' | 'checkbox' | 'checkboxGroup' | 'radio' | 'radioGroup' | 'rate' | 'slider' | 'switch' | 'transfer' | 'upload' | 'dUpload' | 'button' | 'divider';
|
|
13
|
+
export type RenderType = 'custom' | 'other' | 'dInput' | 'ipAddress' | 'input' | 'textArea' | 'password' | 'inputNumber' | 'autoComplete' | 'dSelect' | 'select' | 'dCascader' | 'cascader' | 'dTreeSelect' | 'treeSelect' | 'datePicker' | 'dRangePicker' | 'timePicker' | 'rangePicker' | 'mentions' | 'checkbox' | 'checkboxGroup' | 'radio' | 'radioGroup' | 'rate' | 'slider' | 'switch' | 'transfer' | 'upload' | 'dUpload' | 'button' | 'divider';
|
|
14
14
|
export type DItemBaseProps = Pick<FormItemProps, 'label' | 'name'> & {
|
|
15
15
|
formItemProps?: FormItemProps & {
|
|
16
16
|
grid?: Omit<ColProps, 'prefixCls'>;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
/** 自定义渲染的DItem */
|
|
20
|
-
type CustomItemProps = DItemBaseProps & HTMLAttributes<HTMLElement> & {
|
|
21
|
-
/** 渲染类型 */
|
|
22
|
-
renderType?: 'custom' | 'other';
|
|
23
|
-
/** 自定义渲染函数 */
|
|
24
|
-
render?: (props: any, formItemProps: FormItemProps, allProps?: DItemProps) => ReactNode;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
};
|
|
28
19
|
export type DInputItemProps = {
|
|
29
20
|
renderType?: 'dInput';
|
|
30
21
|
} & DItemBaseProps & DInputProps;
|
|
@@ -115,5 +106,12 @@ export type ButtonItemProps = {
|
|
|
115
106
|
export type DividerItemProps = {
|
|
116
107
|
renderType?: 'divider';
|
|
117
108
|
} & DItemBaseProps & DividerProps;
|
|
118
|
-
export type DItemProps =
|
|
119
|
-
|
|
109
|
+
export type DItemProps = {
|
|
110
|
+
renderType?: RenderType;
|
|
111
|
+
formItemProps?: FormItemProps & {
|
|
112
|
+
grid?: Omit<ColProps, 'prefixCls'>;
|
|
113
|
+
};
|
|
114
|
+
children?: ReactNode;
|
|
115
|
+
render?: any;
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
};
|
package/dist/esm/DForm/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _excluded = ["className", "defaultItemProps", "items", "children", "layout",
|
|
|
10
10
|
* @Description : 基于antd的Form组件
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { forwardRef, useContext, useState, useEffect, useImperativeHandle } from 'react';
|
|
13
|
+
import React, { forwardRef, useContext, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
14
14
|
import { Form, Row, Col } from 'antd';
|
|
15
15
|
import { ConfigContext } from "../ConfigProvider";
|
|
16
16
|
import helper from "./helper";
|
|
@@ -69,13 +69,16 @@ function InternalForm(props, ref) {
|
|
|
69
69
|
getPrefixCls = _useContext.getPrefixCls;
|
|
70
70
|
var _className = "".concat(getPrefixCls('form'), " ").concat(className, " ").concat(['inlineVertical', 'grid'].includes(layout) ? 'inlineVertical' : '');
|
|
71
71
|
var _layout = ['inlineVertical', 'grid'].includes(layout) ? 'inline' : layout;
|
|
72
|
-
var
|
|
72
|
+
var propsDerivedChildren = useMemo(function () {
|
|
73
|
+
return getChildren(items, children, defaultItemProps, layout);
|
|
74
|
+
}, [items, children, defaultItemProps, layout]);
|
|
75
|
+
var _useState = useState(propsDerivedChildren),
|
|
73
76
|
_useState2 = _slicedToArray(_useState, 2),
|
|
74
77
|
itemChildren = _useState2[0],
|
|
75
78
|
setItemChildren = _useState2[1];
|
|
76
79
|
useEffect(function () {
|
|
77
|
-
setItemChildren(
|
|
78
|
-
}, [
|
|
80
|
+
setItemChildren(propsDerivedChildren);
|
|
81
|
+
}, [propsDerivedChildren]);
|
|
79
82
|
useImperativeHandle(ref, function () {
|
|
80
83
|
return {
|
|
81
84
|
setItems: function setItems(value) {
|
|
@@ -93,7 +96,7 @@ function InternalForm(props, ref) {
|
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
};
|
|
96
|
-
}, [items, children, defaultItemProps]);
|
|
99
|
+
}, [items, children, defaultItemProps, layout]);
|
|
97
100
|
return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
98
101
|
className: _className,
|
|
99
102
|
layout: _layout,
|
package/dist/esm/DInput/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _excluded = ["className", "onChange", "onCompositionStart", "onCompositionEn
|
|
|
9
9
|
* @LastEditTime : 2023-08-16 16:48:52
|
|
10
10
|
* @Description : 基于antd的Input组件
|
|
11
11
|
*/
|
|
12
|
-
import React, { useRef, forwardRef, useState, useEffect, useContext } from 'react';
|
|
12
|
+
import React, { useRef, forwardRef, useState, useEffect, useContext, useCallback } from 'react';
|
|
13
13
|
import { Input } from 'antd';
|
|
14
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
15
|
|
|
@@ -53,7 +53,7 @@ function InternalInput(props, ref) {
|
|
|
53
53
|
|
|
54
54
|
// debounce: 默认800ms,false或0表示不开启
|
|
55
55
|
var _debounce = getDebounceTime(debounce);
|
|
56
|
-
var emitChange = function
|
|
56
|
+
var emitChange = useCallback(function (_value, e) {
|
|
57
57
|
if (_debounce > 0) {
|
|
58
58
|
clearTimeout(debounceRef.current);
|
|
59
59
|
debounceRef.current = setTimeout(function () {
|
|
@@ -62,7 +62,7 @@ function InternalInput(props, ref) {
|
|
|
62
62
|
} else {
|
|
63
63
|
onChange === null || onChange === void 0 || onChange(_value, e);
|
|
64
64
|
}
|
|
65
|
-
};
|
|
65
|
+
}, [_debounce, onChange]);
|
|
66
66
|
|
|
67
67
|
// 监听用户onChange事件(如果正在进行合成输入,则不响应用户事件)
|
|
68
68
|
var _onChange = function _onChange(e) {
|
|
@@ -88,6 +88,14 @@ function InternalInput(props, ref) {
|
|
|
88
88
|
useEffect(function () {
|
|
89
89
|
return setValue(initValue);
|
|
90
90
|
}, [initValue]);
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
return function () {
|
|
93
|
+
if (debounceRef.current) {
|
|
94
|
+
clearTimeout(debounceRef.current);
|
|
95
|
+
debounceRef.current = null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}, []);
|
|
91
99
|
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
92
100
|
className: _className,
|
|
93
101
|
ref: ref,
|
package/dist/esm/DModal/index.js
CHANGED
|
@@ -14,16 +14,16 @@ function DModal(props) {
|
|
|
14
14
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
15
15
|
var _useContext = useContext(ConfigContext),
|
|
16
16
|
getPrefixCls = _useContext.getPrefixCls;
|
|
17
|
-
var containerRef = useRef();
|
|
17
|
+
var containerRef = useRef(null);
|
|
18
18
|
var style = useMemo(function () {
|
|
19
19
|
var _otherProps$style;
|
|
20
20
|
return _objectSpread({
|
|
21
|
-
getContainer: containerRef.current,
|
|
21
|
+
getContainer: containerRef.current || document.body,
|
|
22
22
|
width: ((_otherProps$style = otherProps.style) === null || _otherProps$style === void 0 ? void 0 : _otherProps$style.width) || '80%',
|
|
23
23
|
centered: true,
|
|
24
24
|
maskClosable: false
|
|
25
25
|
}, otherProps);
|
|
26
|
-
}, [otherProps]);
|
|
26
|
+
}, [otherProps.open, otherProps.title, otherProps.wrapClassName, otherProps.style, otherProps.centered, otherProps.width, otherProps.zIndex]);
|
|
27
27
|
useEffect(function () {
|
|
28
28
|
if (otherProps.open) {
|
|
29
29
|
document.body.style.overflow = 'hidden';
|
|
@@ -35,17 +35,24 @@ function DModal(props) {
|
|
|
35
35
|
};
|
|
36
36
|
}, [otherProps.open]);
|
|
37
37
|
useEffect(function () {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
var _containerRef$current;
|
|
39
|
+
var parentElement = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentElement;
|
|
40
|
+
if (parentElement) {
|
|
41
|
+
if (mode === 'absolute' || mode === 'fixed' || mode === 'panel') {
|
|
42
|
+
parentElement.style.position = '';
|
|
41
43
|
} else {
|
|
42
|
-
|
|
44
|
+
parentElement.style.position = 'relative';
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
}, [mode
|
|
47
|
+
}, [mode]);
|
|
48
|
+
var getContainerClass = function getContainerClass() {
|
|
49
|
+
if (mode === 'fixed') return 'fixed-modal-container';
|
|
50
|
+
if (mode === 'absolute' || mode === 'panel') return 'absolute-modal-container';
|
|
51
|
+
return 'relative-modal-container';
|
|
52
|
+
};
|
|
46
53
|
return /*#__PURE__*/_jsx("div", {
|
|
47
54
|
ref: containerRef,
|
|
48
|
-
className: "".concat(getPrefixCls('modal-container'), " ").concat(getPrefixCls(
|
|
55
|
+
className: "".concat(getPrefixCls('modal-container'), " ").concat(getPrefixCls(getContainerClass())),
|
|
49
56
|
children: /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({}, style), {}, {
|
|
50
57
|
children: children
|
|
51
58
|
}))
|
|
@@ -3,6 +3,6 @@ import type { ModalProps } from 'antd';
|
|
|
3
3
|
type IModalProps = Omit<ModalProps, 'className'>;
|
|
4
4
|
export interface DModalProps extends IModalProps {
|
|
5
5
|
children?: ReactNode | undefined;
|
|
6
|
-
mode?: 'absolute' | 'relative' | 'panel';
|
|
6
|
+
mode?: 'absolute' | 'relative' | 'panel' | 'fixed';
|
|
7
7
|
}
|
|
8
8
|
export {};
|