feffery_antd_components 0.2.10-rc15 → 0.2.10-rc16
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/DESCRIPTION +1 -1
- package/Project.toml +1 -1
- package/build/lib/feffery_antd_components/__init__.py +1 -1
- package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
- package/build/lib/feffery_antd_components/async-antd_upload.js +1 -1
- package/build/lib/feffery_antd_components/async-data_entry.js +1 -0
- package/build/lib/feffery_antd_components/feffery_antd_components.min.js +1 -1
- package/build/lib/feffery_antd_components/package-info.json +1 -1
- package/feffery_antd_components/__init__.py +1 -1
- package/feffery_antd_components/async-antd_table.js +1 -1
- package/feffery_antd_components/async-antd_upload.js +1 -1
- package/feffery_antd_components/async-data_entry.js +1 -0
- package/feffery_antd_components/feffery_antd_components.min.js +1 -1
- package/feffery_antd_components/package-info.json +1 -1
- package/package.json +1 -1
- package/src/lib/components/dataEntry/AntdCascader.react.js +9 -147
- package/src/lib/components/dataEntry/AntdCheckbox.react.js +9 -74
- package/src/lib/components/dataEntry/AntdCheckboxGroup.react.js +9 -71
- package/src/lib/components/dataEntry/AntdDatePicker.react.js +10 -425
- package/src/lib/components/dataEntry/AntdDateRangePicker.react.js +9 -446
- package/src/lib/components/dataEntry/AntdInput.react.js +11 -325
- package/src/lib/components/dataEntry/AntdInputNumber.react.js +9 -134
- package/src/lib/components/dataEntry/AntdMentions.react.js +9 -113
- package/src/lib/components/dataEntry/AntdRadioGroup.react.js +9 -135
- package/src/lib/components/dataEntry/AntdRate.react.js +9 -76
- package/src/lib/components/dataEntry/AntdSegmentedColoring.react.js +9 -206
- package/src/lib/components/dataEntry/AntdSelect.react.js +10 -288
- package/src/lib/components/dataEntry/AntdSlider.react.js +9 -123
- package/src/lib/components/dataEntry/AntdSwitch.react.js +9 -84
- package/src/lib/components/dataEntry/AntdTimePicker.react.js +9 -125
- package/src/lib/components/dataEntry/AntdTimeRangePicker.react.js +9 -141
- package/src/lib/components/dataEntry/AntdTransfer.react.js +9 -132
- package/src/lib/components/dataEntry/AntdTreeSelect.react.js +11 -207
- package/src/lib/components/dataEntry/check-card/AntdCheckCard.react.js +10 -66
- package/src/lib/components/dataEntry/check-card/AntdCheckCardGroup.react.js +10 -79
- package/src/lib/components/dataEntry/form/AntdForm.react.js +9 -42
- package/src/lib/components/dataEntry/form/AntdFormItem.react.js +9 -54
- package/src/lib/fragments/AntdTable.react.js +29 -12
- package/src/lib/fragments/dataEntry/AntdCascader.react.js +157 -0
- package/src/lib/fragments/dataEntry/AntdCheckbox.react.js +85 -0
- package/src/lib/fragments/dataEntry/AntdCheckboxGroup.react.js +82 -0
- package/src/lib/fragments/dataEntry/AntdDatePicker.react.js +436 -0
- package/src/lib/fragments/dataEntry/AntdDateRangePicker.react.js +458 -0
- package/src/lib/fragments/dataEntry/AntdInput.react.js +333 -0
- package/src/lib/fragments/dataEntry/AntdInputNumber.react.js +145 -0
- package/src/lib/fragments/dataEntry/AntdMentions.react.js +124 -0
- package/src/lib/fragments/dataEntry/AntdRadioGroup.react.js +146 -0
- package/src/lib/fragments/dataEntry/AntdRate.react.js +87 -0
- package/src/lib/fragments/dataEntry/AntdSegmentedColoring.react.js +219 -0
- package/src/lib/fragments/dataEntry/AntdSelect.react.js +298 -0
- package/src/lib/fragments/dataEntry/AntdSlider.react.js +134 -0
- package/src/lib/fragments/dataEntry/AntdSwitch.react.js +95 -0
- package/src/lib/fragments/dataEntry/AntdTimePicker.react.js +136 -0
- package/src/lib/fragments/dataEntry/AntdTimeRangePicker.react.js +152 -0
- package/src/lib/fragments/dataEntry/AntdTransfer.react.js +143 -0
- package/src/lib/fragments/dataEntry/AntdTreeSelect.react.js +216 -0
- package/src/lib/fragments/dataEntry/check-card/AntdCheckCard.react.js +77 -0
- package/src/lib/fragments/dataEntry/check-card/AntdCheckCardGroup.react.js +89 -0
- package/src/lib/fragments/dataEntry/form/AntdForm.react.js +53 -0
- package/src/lib/fragments/dataEntry/form/AntdFormItem.react.js +65 -0
- package/usage.py +94 -51
|
@@ -1,72 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { CheckCard } from '@ant-design/pro-card';
|
|
4
|
-
import { isUndefined, isString } from 'lodash';
|
|
5
|
-
import useCss from '../../../hooks/useCss';
|
|
6
|
-
import PropsContext from '../../../contexts/PropsContext';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
const AntdCheckCard = (props) => {
|
|
10
|
-
// 取得必要属性或参数
|
|
11
|
-
let {
|
|
12
|
-
id,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
style,
|
|
16
|
-
key,
|
|
17
|
-
checked,
|
|
18
|
-
bordered,
|
|
19
|
-
value,
|
|
20
|
-
defaultChecked,
|
|
21
|
-
disabled,
|
|
22
|
-
size,
|
|
23
|
-
readOnly,
|
|
24
|
-
setProps,
|
|
25
|
-
loading_state,
|
|
26
|
-
persistence,
|
|
27
|
-
persisted_props,
|
|
28
|
-
persistence_type
|
|
29
|
-
} = props;
|
|
30
|
-
|
|
31
|
-
const context = useContext(PropsContext)
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (!isUndefined(defaultChecked) && isUndefined(checked)) {
|
|
35
|
-
setProps({ checked: defaultChecked })
|
|
36
|
-
}
|
|
37
|
-
}, [])
|
|
4
|
+
const LazyAntdCheckCard = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../../fragments/dataEntry/check-card/AntdCheckCard.react'));
|
|
38
5
|
|
|
6
|
+
const AntdCheckCard = (props) => {
|
|
39
7
|
return (
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className :
|
|
44
|
-
(className ? useCss(className) : undefined)
|
|
45
|
-
}
|
|
46
|
-
style={style}
|
|
47
|
-
key={key}
|
|
48
|
-
description={children}
|
|
49
|
-
checked={checked}
|
|
50
|
-
bordered={bordered}
|
|
51
|
-
value={value}
|
|
52
|
-
defaultChecked={defaultChecked}
|
|
53
|
-
disabled={
|
|
54
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
55
|
-
context.componentDisabled :
|
|
56
|
-
disabled
|
|
57
|
-
}
|
|
58
|
-
size={size}
|
|
59
|
-
onChange={e => {
|
|
60
|
-
if (!readOnly) {
|
|
61
|
-
setProps({ checked: e })
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
persistence={persistence}
|
|
65
|
-
persisted_props={persisted_props}
|
|
66
|
-
persistence_type={persistence_type}
|
|
67
|
-
data-dash-is-loading={
|
|
68
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
69
|
-
} />
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdCheckCard {...props} />
|
|
10
|
+
</Suspense>
|
|
70
11
|
);
|
|
71
12
|
}
|
|
72
13
|
|
|
@@ -175,4 +116,7 @@ AntdCheckCard.defaultProps = {
|
|
|
175
116
|
persistence_type: 'local'
|
|
176
117
|
}
|
|
177
118
|
|
|
178
|
-
export default AntdCheckCard;
|
|
119
|
+
export default AntdCheckCard;
|
|
120
|
+
|
|
121
|
+
export const propTypes = AntdCheckCard.propTypes;
|
|
122
|
+
export const defaultProps = AntdCheckCard.defaultProps;
|
|
@@ -1,85 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { CheckCard } from '@ant-design/pro-card';
|
|
4
|
-
import { parseChildrenToArray } from '../../utils';
|
|
5
|
-
import { isString, isUndefined } from 'lodash';
|
|
6
|
-
import useCss from '../../../hooks/useCss';
|
|
7
|
-
import PropsContext from '../../../contexts/PropsContext';
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
const AntdCheckCardGroup = (props) => {
|
|
11
|
-
|
|
12
|
-
// 取得必要属性或参数
|
|
13
|
-
let {
|
|
14
|
-
id,
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
style,
|
|
18
|
-
key,
|
|
19
|
-
multiple,
|
|
20
|
-
allowNoValue,
|
|
21
|
-
bordered,
|
|
22
|
-
value,
|
|
23
|
-
defaultValue,
|
|
24
|
-
disabled,
|
|
25
|
-
size,
|
|
26
|
-
readOnly,
|
|
27
|
-
setProps,
|
|
28
|
-
loading_state,
|
|
29
|
-
persistence,
|
|
30
|
-
persisted_props,
|
|
31
|
-
persistence_type
|
|
32
|
-
} = props;
|
|
33
|
-
|
|
34
|
-
const context = useContext(PropsContext)
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (defaultValue && !value) {
|
|
38
|
-
setProps({ value: defaultValue })
|
|
39
|
-
}
|
|
40
|
-
}, [])
|
|
41
|
-
|
|
42
|
-
children = parseChildrenToArray(children)
|
|
4
|
+
const LazyAntdCheckCardGroup = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../../fragments/dataEntry/check-card/AntdCheckCardGroup.react'));
|
|
43
5
|
|
|
6
|
+
const AntdCheckCardGroup = (props) => {
|
|
44
7
|
return (
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
className :
|
|
49
|
-
(className ? useCss(className) : undefined)
|
|
50
|
-
}
|
|
51
|
-
style={style}
|
|
52
|
-
key={key}
|
|
53
|
-
multiple={multiple}
|
|
54
|
-
bordered={bordered}
|
|
55
|
-
value={value}
|
|
56
|
-
defaultValue={defaultValue}
|
|
57
|
-
disabled={
|
|
58
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
59
|
-
context.componentDisabled :
|
|
60
|
-
disabled
|
|
61
|
-
}
|
|
62
|
-
size={size}
|
|
63
|
-
onChange={(e) => {
|
|
64
|
-
// 只读模式下不进行值更新
|
|
65
|
-
if (!readOnly) {
|
|
66
|
-
if (allowNoValue) {
|
|
67
|
-
setProps({ value: e })
|
|
68
|
-
} else {
|
|
69
|
-
if (e && e.length !== 0) {
|
|
70
|
-
setProps({ value: e })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}}
|
|
75
|
-
persistence={persistence}
|
|
76
|
-
persisted_props={persisted_props}
|
|
77
|
-
persistence_type={persistence_type}
|
|
78
|
-
data-dash-is-loading={
|
|
79
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
80
|
-
} >
|
|
81
|
-
{children}
|
|
82
|
-
</ CheckCard.Group>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdCheckCardGroup {...props} />
|
|
10
|
+
</Suspense>
|
|
83
11
|
);
|
|
84
12
|
}
|
|
85
13
|
|
|
@@ -214,4 +142,7 @@ AntdCheckCardGroup.defaultProps = {
|
|
|
214
142
|
persistence_type: 'local'
|
|
215
143
|
}
|
|
216
144
|
|
|
217
|
-
export default AntdCheckCardGroup;
|
|
145
|
+
export default AntdCheckCardGroup;
|
|
146
|
+
|
|
147
|
+
export const propTypes = AntdCheckCardGroup.propTypes;
|
|
148
|
+
export const defaultProps = AntdCheckCardGroup.defaultProps;
|
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Form } from 'antd';
|
|
4
|
-
import { isString } from 'lodash';
|
|
5
|
-
import useCss from '../../../hooks/useCss';
|
|
6
3
|
|
|
4
|
+
const LazyAntdForm = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../../fragments/dataEntry/form/AntdForm.react'));
|
|
7
5
|
|
|
8
|
-
// 定义表单组件AntdForm,api参数参考https://ant.design/components/form-cn/
|
|
9
6
|
const AntdForm = (props) => {
|
|
10
|
-
// 取得必要属性或参数
|
|
11
|
-
let {
|
|
12
|
-
id,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
style,
|
|
16
|
-
key,
|
|
17
|
-
labelCol,
|
|
18
|
-
wrapperCol,
|
|
19
|
-
colon,
|
|
20
|
-
labelAlign,
|
|
21
|
-
labelWrap,
|
|
22
|
-
layout,
|
|
23
|
-
setProps,
|
|
24
|
-
loading_state
|
|
25
|
-
} = props;
|
|
26
|
-
|
|
27
7
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className :
|
|
32
|
-
(className ? useCss(className) : undefined)
|
|
33
|
-
}
|
|
34
|
-
style={style}
|
|
35
|
-
key={key}
|
|
36
|
-
labelCol={labelCol}
|
|
37
|
-
wrapperCol={wrapperCol}
|
|
38
|
-
colon={colon}
|
|
39
|
-
labelAlign={labelAlign}
|
|
40
|
-
labelWrap={labelWrap}
|
|
41
|
-
layout={layout}
|
|
42
|
-
data-dash-is-loading={
|
|
43
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
44
|
-
}>
|
|
45
|
-
{children}
|
|
46
|
-
</Form>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdForm {...props} />
|
|
10
|
+
</Suspense>
|
|
47
11
|
);
|
|
48
12
|
}
|
|
49
13
|
|
|
@@ -142,4 +106,7 @@ AntdForm.defaultProps = {
|
|
|
142
106
|
labelWrap: false
|
|
143
107
|
}
|
|
144
108
|
|
|
145
|
-
export default AntdForm;
|
|
109
|
+
export default AntdForm;
|
|
110
|
+
|
|
111
|
+
export const propTypes = AntdForm.propTypes;
|
|
112
|
+
export const defaultProps = AntdForm.defaultProps;
|
|
@@ -1,61 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Form } from 'antd';
|
|
4
|
-
import { isString } from 'lodash';
|
|
5
|
-
import useCss from '../../../hooks/useCss';
|
|
6
3
|
|
|
7
|
-
const
|
|
4
|
+
const LazyAntdFormItem = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../../fragments/dataEntry/form/AntdFormItem.react'));
|
|
8
5
|
|
|
9
|
-
// 定义表单项组件AntdFormItem,api参数参考https://ant.design/components/form-cn/
|
|
10
6
|
const AntdFormItem = (props) => {
|
|
11
|
-
// 取得必要属性或参数
|
|
12
|
-
let {
|
|
13
|
-
id,
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
key,
|
|
18
|
-
labelCol,
|
|
19
|
-
colon,
|
|
20
|
-
wrapperCol,
|
|
21
|
-
label,
|
|
22
|
-
labelAlign,
|
|
23
|
-
tooltip,
|
|
24
|
-
extra,
|
|
25
|
-
help,
|
|
26
|
-
hidden,
|
|
27
|
-
required,
|
|
28
|
-
validateStatus,
|
|
29
|
-
setProps,
|
|
30
|
-
loading_state
|
|
31
|
-
} = props;
|
|
32
|
-
|
|
33
7
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className :
|
|
38
|
-
(className ? useCss(className) : undefined)
|
|
39
|
-
}
|
|
40
|
-
style={style}
|
|
41
|
-
key={key}
|
|
42
|
-
labelCol={labelCol}
|
|
43
|
-
colon={colon}
|
|
44
|
-
wrapperCol={wrapperCol}
|
|
45
|
-
label={label}
|
|
46
|
-
labelAlign={labelAlign}
|
|
47
|
-
tooltip={tooltip}
|
|
48
|
-
extra={extra}
|
|
49
|
-
help={help}
|
|
50
|
-
hasFeedback={true}
|
|
51
|
-
hidden={hidden}
|
|
52
|
-
required={required}
|
|
53
|
-
validateStatus={validateStatus}
|
|
54
|
-
data-dash-is-loading={
|
|
55
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
56
|
-
}>
|
|
57
|
-
{children}
|
|
58
|
-
</Item>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdFormItem {...props} />
|
|
10
|
+
</Suspense>
|
|
59
11
|
);
|
|
60
12
|
}
|
|
61
13
|
|
|
@@ -168,4 +120,7 @@ AntdFormItem.defaultProps = {
|
|
|
168
120
|
hidden: false
|
|
169
121
|
}
|
|
170
122
|
|
|
171
|
-
export default AntdFormItem;
|
|
123
|
+
export default AntdFormItem;
|
|
124
|
+
|
|
125
|
+
export const propTypes = AntdFormItem.propTypes;
|
|
126
|
+
export const defaultProps = AntdFormItem.defaultProps;
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
QuestionCircleOutlined,
|
|
41
41
|
DownOutlined
|
|
42
42
|
} from '@ant-design/icons';
|
|
43
|
-
import { isNumber, isEqual, isString,
|
|
43
|
+
import { isNumber, isEqual, isString, omitBy } from 'lodash';
|
|
44
44
|
import { str2Locale, locale2text } from '../components/locales.react';
|
|
45
45
|
import { propTypes, defaultProps } from '../components/dataDisplay/AntdTable.react';
|
|
46
46
|
|
|
@@ -275,7 +275,11 @@ class AntdTable extends Component {
|
|
|
275
275
|
) {
|
|
276
276
|
// 同步更新selectedRows的值
|
|
277
277
|
nextProps.setProps({
|
|
278
|
+
// 忽略组件型字段键值对
|
|
278
279
|
selectedRows: nextProps['data'].filter(item => nextProps['selectedRowKeys'].includes(item.key))
|
|
280
|
+
.map(
|
|
281
|
+
record => omitBy(record, value => value.$$typeof)
|
|
282
|
+
)
|
|
279
283
|
})
|
|
280
284
|
}
|
|
281
285
|
|
|
@@ -456,7 +460,8 @@ class AntdTable extends Component {
|
|
|
456
460
|
|
|
457
461
|
setProps({
|
|
458
462
|
currentData: newData,
|
|
459
|
-
|
|
463
|
+
// 忽略组件型字段键值对
|
|
464
|
+
recentlyChangedRow: omitBy(row, value => value.$$typeof),
|
|
460
465
|
recentlyChangedColumn: _changedColumn,
|
|
461
466
|
data: newData
|
|
462
467
|
})
|
|
@@ -938,7 +943,8 @@ class AntdTable extends Component {
|
|
|
938
943
|
nClicksDropdownItem: nClicksDropdownItem + 1,
|
|
939
944
|
recentlyClickedDropdownItemTitle: item.key,
|
|
940
945
|
recentlyDropdownItemClickedDataIndex: columns[i].dataIndex,
|
|
941
|
-
|
|
946
|
+
// 忽略组件型字段键值对
|
|
947
|
+
recentlyDropdownItemClickedRow: omitBy(record, value => value.$$typeof)
|
|
942
948
|
})
|
|
943
949
|
}, 200);
|
|
944
950
|
}}>
|
|
@@ -1133,7 +1139,8 @@ class AntdTable extends Component {
|
|
|
1133
1139
|
setTimeout(function () {
|
|
1134
1140
|
setProps({
|
|
1135
1141
|
data: data,
|
|
1136
|
-
|
|
1142
|
+
// 忽略组件型字段键值对
|
|
1143
|
+
recentlyCheckedRow: omitBy(record, value => value.$$typeof),
|
|
1137
1144
|
recentlyCheckedLabel: content.label,
|
|
1138
1145
|
recentlyCheckedDataIndex: columns[i]['dataIndex'],
|
|
1139
1146
|
recentlyCheckedStatus: e.target.checked
|
|
@@ -1173,7 +1180,8 @@ class AntdTable extends Component {
|
|
|
1173
1180
|
setTimeout(function () {
|
|
1174
1181
|
setProps({
|
|
1175
1182
|
data: data,
|
|
1176
|
-
|
|
1183
|
+
// 忽略组件型字段键值对
|
|
1184
|
+
recentlySwitchRow: omitBy(record, value => value.$$typeof),
|
|
1177
1185
|
recentlySwitchDataIndex: columns[i]['dataIndex'],
|
|
1178
1186
|
recentlySwitchStatus: checked
|
|
1179
1187
|
})
|
|
@@ -1230,7 +1238,8 @@ class AntdTable extends Component {
|
|
|
1230
1238
|
() => {
|
|
1231
1239
|
setProps({
|
|
1232
1240
|
data: data,
|
|
1233
|
-
|
|
1241
|
+
// 忽略组件型字段键值对
|
|
1242
|
+
recentlySelectRow: omitBy(record, value => value.$$typeof),
|
|
1234
1243
|
recentlySelectDataIndex: columns[i]['dataIndex'],
|
|
1235
1244
|
recentlySelectValue: value
|
|
1236
1245
|
})
|
|
@@ -1265,7 +1274,8 @@ class AntdTable extends Component {
|
|
|
1265
1274
|
// 阻止事件冒泡
|
|
1266
1275
|
e.stopPropagation();
|
|
1267
1276
|
setProps({
|
|
1268
|
-
|
|
1277
|
+
// 忽略组件型字段键值对
|
|
1278
|
+
recentlyButtonClickedRow: omitBy(record, value => value.$$typeof),
|
|
1269
1279
|
nClicksButton: nClicksButton + 1,
|
|
1270
1280
|
clickedContent: content_.content,
|
|
1271
1281
|
clickedCustom: content_.custom,
|
|
@@ -1319,7 +1329,8 @@ class AntdTable extends Component {
|
|
|
1319
1329
|
// 阻止事件冒泡
|
|
1320
1330
|
e.stopPropagation();
|
|
1321
1331
|
setProps({
|
|
1322
|
-
|
|
1332
|
+
// 忽略组件型字段键值对
|
|
1333
|
+
recentlyButtonClickedRow: omitBy(record, value => value.$$typeof),
|
|
1323
1334
|
nClicksButton: nClicksButton + 1,
|
|
1324
1335
|
clickedContent: content.content,
|
|
1325
1336
|
clickedCustom: content.custom,
|
|
@@ -1375,7 +1386,8 @@ class AntdTable extends Component {
|
|
|
1375
1386
|
// 阻止事件冒泡
|
|
1376
1387
|
e.stopPropagation();
|
|
1377
1388
|
setProps({
|
|
1378
|
-
|
|
1389
|
+
// 忽略组件型字段键值对
|
|
1390
|
+
recentlyButtonClickedRow: omitBy(record, value => value.$$typeof),
|
|
1379
1391
|
nClicksButton: nClicksButton + 1,
|
|
1380
1392
|
clickedContent: content_.content,
|
|
1381
1393
|
clickedCustom: content_.custom,
|
|
@@ -1415,7 +1427,8 @@ class AntdTable extends Component {
|
|
|
1415
1427
|
// 阻止事件冒泡
|
|
1416
1428
|
e.stopPropagation();
|
|
1417
1429
|
setProps({
|
|
1418
|
-
|
|
1430
|
+
// 忽略组件型字段键值对
|
|
1431
|
+
recentlyButtonClickedRow: omitBy(record, value => value.$$typeof),
|
|
1419
1432
|
nClicksButton: nClicksButton + 1,
|
|
1420
1433
|
clickedContent: content.content,
|
|
1421
1434
|
clickedCustom: content.custom,
|
|
@@ -1660,7 +1673,10 @@ class AntdTable extends Component {
|
|
|
1660
1673
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
1661
1674
|
setProps({
|
|
1662
1675
|
selectedRowKeys: selectedRowKeys,
|
|
1663
|
-
|
|
1676
|
+
// 忽略组件型字段键值对
|
|
1677
|
+
selectedRows: selectedRows.map(
|
|
1678
|
+
record => omitBy(record, value => value.$$typeof)
|
|
1679
|
+
)
|
|
1664
1680
|
})
|
|
1665
1681
|
}
|
|
1666
1682
|
}
|
|
@@ -1830,7 +1846,8 @@ class AntdTable extends Component {
|
|
|
1830
1846
|
onMouseEnter: event => {
|
|
1831
1847
|
setProps({
|
|
1832
1848
|
recentlyMouseEnterRowKey: record.key,
|
|
1833
|
-
|
|
1849
|
+
// 忽略组件型字段键值对
|
|
1850
|
+
recentlyMouseEnterRow: omitBy(record, value => value.$$typeof)
|
|
1834
1851
|
})
|
|
1835
1852
|
}, // 鼠标移入行
|
|
1836
1853
|
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useContext } from 'react';
|
|
2
|
+
import { Cascader, ConfigProvider } from 'antd';
|
|
3
|
+
import { str2Locale } from '../../components/locales.react';
|
|
4
|
+
import { isUndefined, isString } from 'lodash';
|
|
5
|
+
import { flatToTree } from '../../components/utils';
|
|
6
|
+
import useCss from '../../hooks/useCss';
|
|
7
|
+
import PropsContext from '../../contexts/PropsContext';
|
|
8
|
+
import { propTypes, defaultProps } from '../../components/dataEntry/AntdCascader.react';
|
|
9
|
+
|
|
10
|
+
const { SHOW_CHILD, SHOW_PARENT } = Cascader;
|
|
11
|
+
|
|
12
|
+
const str2ShowCheckedStrategy = new Map([
|
|
13
|
+
['show-child', SHOW_CHILD],
|
|
14
|
+
['show-parent', SHOW_PARENT]
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
// 定义级联选择组件AntdCascader,api参数参考https://ant.design/components/cascader-cn/
|
|
18
|
+
const AntdCascader = (props) => {
|
|
19
|
+
// 取得必要属性或参数
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
style,
|
|
23
|
+
className,
|
|
24
|
+
key,
|
|
25
|
+
locale,
|
|
26
|
+
options,
|
|
27
|
+
optionsMode,
|
|
28
|
+
changeOnSelect,
|
|
29
|
+
size,
|
|
30
|
+
bordered,
|
|
31
|
+
disabled,
|
|
32
|
+
placeholder,
|
|
33
|
+
defaultValue,
|
|
34
|
+
value,
|
|
35
|
+
placement,
|
|
36
|
+
maxTagCount,
|
|
37
|
+
multiple,
|
|
38
|
+
expandTrigger,
|
|
39
|
+
status,
|
|
40
|
+
allowClear,
|
|
41
|
+
showCheckedStrategy,
|
|
42
|
+
popupContainer,
|
|
43
|
+
readOnly,
|
|
44
|
+
setProps,
|
|
45
|
+
persistence,
|
|
46
|
+
persisted_props,
|
|
47
|
+
persistence_type,
|
|
48
|
+
loading_state,
|
|
49
|
+
batchPropsNames
|
|
50
|
+
} = props;
|
|
51
|
+
|
|
52
|
+
// 批属性监听
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
55
|
+
let _batchPropsValues = {};
|
|
56
|
+
for (let propName of batchPropsNames) {
|
|
57
|
+
_batchPropsValues[propName] = props[propName];
|
|
58
|
+
}
|
|
59
|
+
setProps({
|
|
60
|
+
batchPropsValues: _batchPropsValues
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const context = useContext(PropsContext)
|
|
66
|
+
locale = (context && context.locale) || locale
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (defaultValue && !value) {
|
|
70
|
+
setProps({ value: defaultValue })
|
|
71
|
+
}
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
74
|
+
const flatToTreeOptions = useMemo(() => {
|
|
75
|
+
return flatToTree(options);
|
|
76
|
+
}, [options])
|
|
77
|
+
|
|
78
|
+
// 根据optionsMode对options进行预处理
|
|
79
|
+
if (optionsMode === 'flat') {
|
|
80
|
+
options = flatToTreeOptions
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const filter = (inputValue, path) => {
|
|
84
|
+
return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const onSelect = (e) => {
|
|
88
|
+
setProps({ value: e })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 返回定制化的前端组件
|
|
92
|
+
return (
|
|
93
|
+
<ConfigProvider locale={str2Locale.get(locale)}>
|
|
94
|
+
<Cascader
|
|
95
|
+
id={id}
|
|
96
|
+
className={
|
|
97
|
+
isString(className) ?
|
|
98
|
+
className :
|
|
99
|
+
(className ? useCss(className) : undefined)
|
|
100
|
+
}
|
|
101
|
+
style={style}
|
|
102
|
+
key={key}
|
|
103
|
+
options={options}
|
|
104
|
+
changeOnSelect={changeOnSelect}
|
|
105
|
+
size={
|
|
106
|
+
context && !isUndefined(context.componentSize) ?
|
|
107
|
+
context.componentSize :
|
|
108
|
+
size
|
|
109
|
+
}
|
|
110
|
+
bordered={bordered}
|
|
111
|
+
disabled={
|
|
112
|
+
context && !isUndefined(context.componentDisabled) ?
|
|
113
|
+
context.componentDisabled :
|
|
114
|
+
disabled
|
|
115
|
+
}
|
|
116
|
+
placeholder={placeholder}
|
|
117
|
+
defaultValue={defaultValue}
|
|
118
|
+
value={value}
|
|
119
|
+
placement={placement}
|
|
120
|
+
maxTagCount={maxTagCount}
|
|
121
|
+
multiple={multiple}
|
|
122
|
+
persistence={persistence}
|
|
123
|
+
persisted_props={persisted_props}
|
|
124
|
+
persistence_type={persistence_type}
|
|
125
|
+
expandTrigger={expandTrigger}
|
|
126
|
+
status={status}
|
|
127
|
+
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
128
|
+
showCheckedStrategy={str2ShowCheckedStrategy.get(showCheckedStrategy)}
|
|
129
|
+
displayRender={
|
|
130
|
+
multiple ?
|
|
131
|
+
undefined :
|
|
132
|
+
(
|
|
133
|
+
showCheckedStrategy === 'show-child' ?
|
|
134
|
+
(label) => label[label.length - 1] :
|
|
135
|
+
(label) => label[0]
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
showSearch={filter}
|
|
139
|
+
onChange={onSelect}
|
|
140
|
+
data-dash-is-loading={
|
|
141
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
142
|
+
}
|
|
143
|
+
getPopupContainer={
|
|
144
|
+
popupContainer === 'parent' ?
|
|
145
|
+
(triggerNode) => triggerNode.parentNode :
|
|
146
|
+
undefined
|
|
147
|
+
}
|
|
148
|
+
open={isUndefined(readOnly) || !readOnly ? undefined : false}
|
|
149
|
+
/>
|
|
150
|
+
</ConfigProvider>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default AntdCascader;
|
|
155
|
+
|
|
156
|
+
AntdCascader.defaultProps = defaultProps;
|
|
157
|
+
AntdCascader.propTypes = propTypes;
|