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,132 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { TimePicker, ConfigProvider } from 'antd';
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import { isString, isUndefined } from 'lodash';
|
|
6
|
-
import { str2Locale } from '../locales.react';
|
|
7
|
-
import useCss from '../../hooks/useCss';
|
|
8
|
-
import PropsContext from '../../contexts/PropsContext';
|
|
9
3
|
|
|
4
|
+
const LazyAntdTimePicker = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdTimePicker.react'));
|
|
10
5
|
|
|
11
|
-
// 定义时间选择组件AntdTimePicker,api参数参考https://ant.design/components/time-picker-cn/
|
|
12
6
|
const AntdTimePicker = (props) => {
|
|
13
|
-
// 取得必要属性或参数
|
|
14
|
-
let {
|
|
15
|
-
id,
|
|
16
|
-
className,
|
|
17
|
-
style,
|
|
18
|
-
key,
|
|
19
|
-
locale,
|
|
20
|
-
setProps,
|
|
21
|
-
disabled,
|
|
22
|
-
hourStep,
|
|
23
|
-
minuteStep,
|
|
24
|
-
secondStep,
|
|
25
|
-
format,
|
|
26
|
-
value,
|
|
27
|
-
defaultValue,
|
|
28
|
-
use12Hours,
|
|
29
|
-
allowClear,
|
|
30
|
-
placeholder,
|
|
31
|
-
placement,
|
|
32
|
-
bordered,
|
|
33
|
-
size,
|
|
34
|
-
status,
|
|
35
|
-
popupContainer,
|
|
36
|
-
readOnly,
|
|
37
|
-
extraFooter,
|
|
38
|
-
showNow,
|
|
39
|
-
persistence,
|
|
40
|
-
persisted_props,
|
|
41
|
-
persistence_type,
|
|
42
|
-
loading_state,
|
|
43
|
-
batchPropsNames
|
|
44
|
-
} = props;
|
|
45
|
-
|
|
46
|
-
// 批属性监听
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
49
|
-
let _batchPropsValues = {};
|
|
50
|
-
for (let propName of batchPropsNames) {
|
|
51
|
-
_batchPropsValues[propName] = props[propName];
|
|
52
|
-
}
|
|
53
|
-
setProps({
|
|
54
|
-
batchPropsValues: _batchPropsValues
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const context = useContext(PropsContext)
|
|
60
|
-
locale = (context && context.locale) || locale
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
// 初始化value
|
|
64
|
-
if (defaultValue && !value) {
|
|
65
|
-
// 当defaultValue不为空且value为空时,为value初始化defaultValue对应值
|
|
66
|
-
setProps({ value: defaultValue })
|
|
67
|
-
}
|
|
68
|
-
}, [])
|
|
69
|
-
|
|
70
|
-
const onChange = (time, timeString) => {
|
|
71
|
-
if (isString(timeString)) {
|
|
72
|
-
setProps({ value: timeString })
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 返回定制化的前端组件
|
|
77
7
|
return (
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
id={id}
|
|
82
|
-
className={
|
|
83
|
-
isString(className) ?
|
|
84
|
-
className :
|
|
85
|
-
(className ? useCss(className) : undefined)
|
|
86
|
-
}
|
|
87
|
-
style={style}
|
|
88
|
-
key={key}
|
|
89
|
-
onChange={onChange}
|
|
90
|
-
placeholder={placeholder}
|
|
91
|
-
placement={placement}
|
|
92
|
-
bordered={bordered}
|
|
93
|
-
size={
|
|
94
|
-
context && !isUndefined(context.componentSize) ?
|
|
95
|
-
context.componentSize :
|
|
96
|
-
size
|
|
97
|
-
}
|
|
98
|
-
disabled={
|
|
99
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
100
|
-
context.componentDisabled :
|
|
101
|
-
disabled
|
|
102
|
-
}
|
|
103
|
-
hourStep={hourStep}
|
|
104
|
-
minuteStep={minuteStep}
|
|
105
|
-
secondStep={secondStep}
|
|
106
|
-
format={format}
|
|
107
|
-
value={value ? moment(value, format) : undefined}
|
|
108
|
-
defaultValue={defaultValue ? moment(defaultValue, format) : undefined}
|
|
109
|
-
use12Hours={use12Hours}
|
|
110
|
-
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
111
|
-
status={status}
|
|
112
|
-
renderExtraFooter={() => extraFooter}
|
|
113
|
-
showNow={showNow}
|
|
114
|
-
persistence={persistence}
|
|
115
|
-
persisted_props={persisted_props}
|
|
116
|
-
persistence_type={persistence_type}
|
|
117
|
-
data-dash-is-loading={
|
|
118
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
119
|
-
}
|
|
120
|
-
getPopupContainer={
|
|
121
|
-
popupContainer === 'parent' ?
|
|
122
|
-
(triggerNode) => triggerNode.parentNode :
|
|
123
|
-
undefined
|
|
124
|
-
}
|
|
125
|
-
open={isUndefined(readOnly) || !readOnly ? undefined : false}
|
|
126
|
-
inputReadOnly={readOnly}
|
|
127
|
-
/>
|
|
128
|
-
</ConfigProvider>
|
|
129
|
-
</div>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdTimePicker {...props} />
|
|
10
|
+
</Suspense>
|
|
130
11
|
);
|
|
131
12
|
}
|
|
132
13
|
|
|
@@ -288,4 +169,7 @@ AntdTimePicker.defaultProps = {
|
|
|
288
169
|
batchPropsNames: []
|
|
289
170
|
}
|
|
290
171
|
|
|
291
|
-
export default AntdTimePicker;
|
|
172
|
+
export default AntdTimePicker;
|
|
173
|
+
|
|
174
|
+
export const propTypes = AntdTimePicker.propTypes;
|
|
175
|
+
export const defaultProps = AntdTimePicker.defaultProps;
|
|
@@ -1,148 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { TimePicker, ConfigProvider } from 'antd';
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import { isUndefined, isString } from 'lodash';
|
|
6
|
-
import { str2Locale } from '../locales.react';
|
|
7
|
-
import useCss from '../../hooks/useCss';
|
|
8
|
-
import PropsContext from '../../contexts/PropsContext';
|
|
9
3
|
|
|
10
|
-
const
|
|
4
|
+
const LazyAntdTimeRangePicker = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdTimeRangePicker.react'));
|
|
11
5
|
|
|
12
|
-
// 定义时间范围选择组件AntdTimeRangePicker,api参数参考https://ant.design/components/time-picker-cn/
|
|
13
6
|
const AntdTimeRangePicker = (props) => {
|
|
14
|
-
// 取得必要属性或参数
|
|
15
|
-
let {
|
|
16
|
-
id,
|
|
17
|
-
className,
|
|
18
|
-
style,
|
|
19
|
-
key,
|
|
20
|
-
locale,
|
|
21
|
-
setProps,
|
|
22
|
-
value,
|
|
23
|
-
defaultValue,
|
|
24
|
-
placeholder,
|
|
25
|
-
placement,
|
|
26
|
-
disabled,
|
|
27
|
-
hourStep,
|
|
28
|
-
minuteStep,
|
|
29
|
-
secondStep,
|
|
30
|
-
format,
|
|
31
|
-
use12Hours,
|
|
32
|
-
allowClear,
|
|
33
|
-
bordered,
|
|
34
|
-
size,
|
|
35
|
-
open,
|
|
36
|
-
status,
|
|
37
|
-
popupContainer,
|
|
38
|
-
readOnly,
|
|
39
|
-
extraFooter,
|
|
40
|
-
persistence,
|
|
41
|
-
persisted_props,
|
|
42
|
-
persistence_type,
|
|
43
|
-
loading_state,
|
|
44
|
-
batchPropsNames
|
|
45
|
-
} = props;
|
|
46
|
-
|
|
47
|
-
// 批属性监听
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
50
|
-
let _batchPropsValues = {};
|
|
51
|
-
for (let propName of batchPropsNames) {
|
|
52
|
-
_batchPropsValues[propName] = props[propName];
|
|
53
|
-
}
|
|
54
|
-
setProps({
|
|
55
|
-
batchPropsValues: _batchPropsValues
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const context = useContext(PropsContext)
|
|
61
|
-
locale = (context && context.locale) || locale
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
// 初始化value
|
|
65
|
-
if (defaultValue && !value) {
|
|
66
|
-
// 当defaultValue不为空且value为空时,为value初始化defaultValue对应值
|
|
67
|
-
setProps({ value: defaultValue })
|
|
68
|
-
}
|
|
69
|
-
}, [])
|
|
70
|
-
|
|
71
|
-
const onChange = (time, timeString) => {
|
|
72
|
-
if (Array.isArray(timeString)) {
|
|
73
|
-
setProps({ value: [timeString[0], timeString[1]] })
|
|
74
|
-
} else {
|
|
75
|
-
setProps({ value: null })
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// 返回定制化的前端组件
|
|
80
7
|
return (
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
id={id}
|
|
85
|
-
className={
|
|
86
|
-
isString(className) ?
|
|
87
|
-
className :
|
|
88
|
-
(className ? useCss(className) : undefined)
|
|
89
|
-
}
|
|
90
|
-
style={style}
|
|
91
|
-
key={key}
|
|
92
|
-
onChange={onChange}
|
|
93
|
-
disabled={
|
|
94
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
95
|
-
[context.componentDisabled, context.componentDisabled] :
|
|
96
|
-
(
|
|
97
|
-
(disabled && disabled.length === 2) ? disabled : undefined
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
allowEmpty={(disabled && disabled.length === 2) ? disabled : undefined}
|
|
101
|
-
placeholder={(placeholder && placeholder.length === 2) ? placeholder : undefined}
|
|
102
|
-
placement={placement}
|
|
103
|
-
bordered={bordered}
|
|
104
|
-
size={
|
|
105
|
-
context && !isUndefined(context.componentSize) ?
|
|
106
|
-
context.componentSize :
|
|
107
|
-
size
|
|
108
|
-
}
|
|
109
|
-
hourStep={hourStep}
|
|
110
|
-
minuteStep={minuteStep}
|
|
111
|
-
secondStep={secondStep}
|
|
112
|
-
format={format}
|
|
113
|
-
use12Hours={use12Hours}
|
|
114
|
-
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
115
|
-
defaultValue={
|
|
116
|
-
(defaultValue && defaultValue.length === 2) ?
|
|
117
|
-
[defaultValue[0] !== '' ? moment(defaultValue[0], format) : undefined,
|
|
118
|
-
defaultValue[1] !== '' ? moment(defaultValue[1], format) : undefined] :
|
|
119
|
-
undefined
|
|
120
|
-
}
|
|
121
|
-
value={
|
|
122
|
-
(value && value.length === 2) ?
|
|
123
|
-
[value[0] !== '' ? moment(value[0], format) : undefined,
|
|
124
|
-
value[1] !== '' ? moment(value[1], format) : undefined] :
|
|
125
|
-
undefined
|
|
126
|
-
}
|
|
127
|
-
status={status}
|
|
128
|
-
renderExtraFooter={() => extraFooter}
|
|
129
|
-
persistence={persistence}
|
|
130
|
-
persisted_props={persisted_props}
|
|
131
|
-
persistence_type={persistence_type}
|
|
132
|
-
data-dash-is-loading={
|
|
133
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
134
|
-
}
|
|
135
|
-
getPopupContainer={
|
|
136
|
-
popupContainer === 'parent' ?
|
|
137
|
-
(triggerNode) => triggerNode.parentNode :
|
|
138
|
-
undefined
|
|
139
|
-
}
|
|
140
|
-
open={isUndefined(readOnly) || !readOnly ? open : false}
|
|
141
|
-
onOpenChange={(e) => setProps({ open: e })}
|
|
142
|
-
inputReadOnly={readOnly}
|
|
143
|
-
/>
|
|
144
|
-
</ConfigProvider>
|
|
145
|
-
</div>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdTimeRangePicker {...props} />
|
|
10
|
+
</Suspense>
|
|
146
11
|
);
|
|
147
12
|
}
|
|
148
13
|
|
|
@@ -302,4 +167,7 @@ AntdTimeRangePicker.defaultProps = {
|
|
|
302
167
|
batchPropsNames: []
|
|
303
168
|
}
|
|
304
169
|
|
|
305
|
-
export default AntdTimeRangePicker;
|
|
170
|
+
export default AntdTimeRangePicker;
|
|
171
|
+
|
|
172
|
+
export const propTypes = AntdTimeRangePicker.propTypes;
|
|
173
|
+
export const defaultProps = AntdTimeRangePicker.defaultProps;
|
|
@@ -1,139 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Transfer, ConfigProvider } from 'antd';
|
|
4
|
-
import { str2Locale, locale2text } from '../locales.react';
|
|
5
|
-
import { isString, isUndefined } from 'lodash';
|
|
6
|
-
import useCss from '../../hooks/useCss';
|
|
7
|
-
import PropsContext from '../../contexts/PropsContext';
|
|
8
3
|
|
|
4
|
+
const LazyAntdTransfer = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdTransfer.react'));
|
|
9
5
|
|
|
10
|
-
// 定义穿梭框组件AntdTransfer,api参数参考https://ant.design/components/transfer-cn/
|
|
11
6
|
const AntdTransfer = (props) => {
|
|
12
|
-
// 取得必要属性或参数
|
|
13
|
-
let {
|
|
14
|
-
id,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
key,
|
|
18
|
-
locale,
|
|
19
|
-
setProps,
|
|
20
|
-
dataSource,
|
|
21
|
-
height,
|
|
22
|
-
pagination,
|
|
23
|
-
operations,
|
|
24
|
-
showSearch,
|
|
25
|
-
optionFilterMode,
|
|
26
|
-
showSelectAll,
|
|
27
|
-
titles,
|
|
28
|
-
disabled,
|
|
29
|
-
targetKeys,
|
|
30
|
-
status,
|
|
31
|
-
readOnly,
|
|
32
|
-
persistence,
|
|
33
|
-
persisted_props,
|
|
34
|
-
persistence_type,
|
|
35
|
-
loading_state,
|
|
36
|
-
batchPropsNames
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
// 批属性监听
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
42
|
-
let _batchPropsValues = {};
|
|
43
|
-
for (let propName of batchPropsNames) {
|
|
44
|
-
_batchPropsValues[propName] = props[propName];
|
|
45
|
-
}
|
|
46
|
-
setProps({
|
|
47
|
-
batchPropsValues: _batchPropsValues
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const context = useContext(PropsContext)
|
|
53
|
-
locale = (context && context.locale) || locale
|
|
54
|
-
|
|
55
|
-
if (!titles) {
|
|
56
|
-
titles = locale2text.AntdTransfer[locale].titles
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// 监听选项移动事件
|
|
60
|
-
const listenMove = (nextTargetKeys, moveDirection, moveKeys) => {
|
|
61
|
-
if (!readOnly) {
|
|
62
|
-
setProps({
|
|
63
|
-
targetKeys: nextTargetKeys,
|
|
64
|
-
moveDirection: moveDirection,
|
|
65
|
-
moveKeys: moveKeys
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// 返回定制化的前端组件
|
|
71
7
|
return (
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
style={style}
|
|
76
|
-
className={
|
|
77
|
-
isString(className) ?
|
|
78
|
-
className :
|
|
79
|
-
(className ? useCss(className) : undefined)
|
|
80
|
-
}
|
|
81
|
-
key={key}
|
|
82
|
-
dataSource={dataSource}
|
|
83
|
-
targetKeys={targetKeys}
|
|
84
|
-
onChange={listenMove}
|
|
85
|
-
render={item => item.title}
|
|
86
|
-
pagination={pagination}
|
|
87
|
-
operations={operations}
|
|
88
|
-
showSearch={showSearch}
|
|
89
|
-
filterOption={
|
|
90
|
-
showSearch ?
|
|
91
|
-
(inputValue, option) => {
|
|
92
|
-
// 处理''特殊情况
|
|
93
|
-
inputValue = inputValue || ''
|
|
94
|
-
if (inputValue !== '') {
|
|
95
|
-
if (optionFilterMode === 'case-insensitive') {
|
|
96
|
-
// 进行大小写不敏感筛选
|
|
97
|
-
return (option.title || '').toLowerCase()
|
|
98
|
-
.includes(inputValue.toLowerCase())
|
|
99
|
-
} else if (optionFilterMode === 'case-sensitive') {
|
|
100
|
-
// 判断输入的内容是否是当前选项筛选依据字段值的子串
|
|
101
|
-
return option.title.includes(inputValue)
|
|
102
|
-
} else if (optionFilterMode === 'regex') {
|
|
103
|
-
// 判断输入的正则规则是否匹配当前选项筛选依据字段值
|
|
104
|
-
try {
|
|
105
|
-
// 尝试进行正则匹配
|
|
106
|
-
return eval(`/${inputValue}/`).test(option.title)
|
|
107
|
-
} catch {
|
|
108
|
-
// 忽略非法的正则表达式
|
|
109
|
-
return false
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return false
|
|
114
|
-
} : undefined
|
|
115
|
-
}
|
|
116
|
-
showSelectAll={showSelectAll}
|
|
117
|
-
titles={titles}
|
|
118
|
-
disabled={
|
|
119
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
120
|
-
context.componentDisabled :
|
|
121
|
-
disabled
|
|
122
|
-
}
|
|
123
|
-
status={status}
|
|
124
|
-
persistence={persistence}
|
|
125
|
-
persisted_props={persisted_props}
|
|
126
|
-
persistence_type={persistence_type}
|
|
127
|
-
listStyle={{
|
|
128
|
-
overflowX: 'auto',
|
|
129
|
-
height: height,
|
|
130
|
-
width: '100%'
|
|
131
|
-
}}
|
|
132
|
-
data-dash-is-loading={
|
|
133
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
134
|
-
}
|
|
135
|
-
/>
|
|
136
|
-
</ConfigProvider>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdTransfer {...props} />
|
|
10
|
+
</Suspense>
|
|
137
11
|
);
|
|
138
12
|
}
|
|
139
13
|
|
|
@@ -308,4 +182,7 @@ AntdTransfer.defaultProps = {
|
|
|
308
182
|
batchPropsNames: []
|
|
309
183
|
}
|
|
310
184
|
|
|
311
|
-
export default AntdTransfer;
|
|
185
|
+
export default AntdTransfer;
|
|
186
|
+
|
|
187
|
+
export const propTypes = AntdTransfer.propTypes;
|
|
188
|
+
export const defaultProps = AntdTransfer.defaultProps;
|
|
@@ -1,212 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { flatToTree } from '../utils';
|
|
7
|
-
import useCss from '../../hooks/useCss';
|
|
8
|
-
import PropsContext from '../../contexts/PropsContext';
|
|
9
|
-
|
|
10
|
-
const { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } = TreeSelect;
|
|
11
|
-
|
|
12
|
-
// 定义勾选项回填策略映射字典
|
|
13
|
-
const str2ShowCheckedStrategy = new Map(
|
|
14
|
-
[
|
|
15
|
-
['show-all', SHOW_ALL],
|
|
16
|
-
['show-child', SHOW_CHILD],
|
|
17
|
-
['show-parent', SHOW_PARENT]
|
|
18
|
-
]
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
// 定义树选择组件AntdTreeSelect,api参数参考https://ant.design/components/tree-select-cn/
|
|
3
|
+
|
|
4
|
+
const LazyAntdTreeSelect = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdTreeSelect.react'));
|
|
5
|
+
|
|
22
6
|
const AntdTreeSelect = (props) => {
|
|
23
|
-
// 取得必要属性或参数
|
|
24
|
-
let {
|
|
25
|
-
id,
|
|
26
|
-
style,
|
|
27
|
-
className,
|
|
28
|
-
key,
|
|
29
|
-
locale,
|
|
30
|
-
treeData,
|
|
31
|
-
treeDataMode,
|
|
32
|
-
allowClear,
|
|
33
|
-
bordered,
|
|
34
|
-
treeLine,
|
|
35
|
-
listHeight,
|
|
36
|
-
placeholder,
|
|
37
|
-
value,
|
|
38
|
-
defaultValue,
|
|
39
|
-
maxTagCount,
|
|
40
|
-
multiple,
|
|
41
|
-
size,
|
|
42
|
-
treeCheckable,
|
|
43
|
-
treeCheckStrictly,
|
|
44
|
-
treeDefaultExpandAll,
|
|
45
|
-
treeDefaultExpandedKeys,
|
|
46
|
-
treeExpandedKeys,
|
|
47
|
-
virtual,
|
|
48
|
-
disabled,
|
|
49
|
-
placement,
|
|
50
|
-
status,
|
|
51
|
-
treeNodeFilterProp,
|
|
52
|
-
treeNodeFilterMode,
|
|
53
|
-
autoClearSearchValue,
|
|
54
|
-
popupContainer,
|
|
55
|
-
setProps,
|
|
56
|
-
readOnly,
|
|
57
|
-
showCheckedStrategy,
|
|
58
|
-
dropdownBefore,
|
|
59
|
-
dropdownAfter,
|
|
60
|
-
persistence,
|
|
61
|
-
persisted_props,
|
|
62
|
-
persistence_type,
|
|
63
|
-
loading_state,
|
|
64
|
-
batchPropsNames
|
|
65
|
-
} = props;
|
|
66
|
-
|
|
67
|
-
// 批属性监听
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
70
|
-
let _batchPropsValues = {};
|
|
71
|
-
for (let propName of batchPropsNames) {
|
|
72
|
-
_batchPropsValues[propName] = props[propName];
|
|
73
|
-
}
|
|
74
|
-
setProps({
|
|
75
|
-
batchPropsValues: _batchPropsValues
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const context = useContext(PropsContext)
|
|
81
|
-
locale = (context && context.locale) || locale
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (!value && defaultValue) {
|
|
85
|
-
setProps({ value: defaultValue })
|
|
86
|
-
}
|
|
87
|
-
if (!treeExpandedKeys && treeDefaultExpandedKeys) {
|
|
88
|
-
setProps({ treeExpandedKeys: treeDefaultExpandedKeys })
|
|
89
|
-
}
|
|
90
|
-
}, [])
|
|
91
|
-
|
|
92
|
-
const flatToTreeData = useMemo(() => {
|
|
93
|
-
return flatToTree(treeData);
|
|
94
|
-
}, [treeData])
|
|
95
|
-
|
|
96
|
-
// 用于获取用户已选择值的回调函数
|
|
97
|
-
const updateSelectedValue = (e) => {
|
|
98
|
-
|
|
99
|
-
if (treeCheckStrictly) {
|
|
100
|
-
setProps({ value: e.map(item => item.value) })
|
|
101
|
-
} else {
|
|
102
|
-
setProps({ value: e })
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 返回定制化的前端组件
|
|
108
7
|
return (
|
|
109
|
-
<
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
className={
|
|
113
|
-
isString(className) ?
|
|
114
|
-
className :
|
|
115
|
-
(className ? useCss(className) : undefined)
|
|
116
|
-
}
|
|
117
|
-
style={{
|
|
118
|
-
width: '100%',
|
|
119
|
-
...style
|
|
120
|
-
}}
|
|
121
|
-
key={key}
|
|
122
|
-
treeData={treeDataMode === 'flat' ? flatToTreeData : treeData}
|
|
123
|
-
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
124
|
-
bordered={bordered}
|
|
125
|
-
treeLine={treeLine}
|
|
126
|
-
listHeight={listHeight}
|
|
127
|
-
placeholder={placeholder}
|
|
128
|
-
value={value}
|
|
129
|
-
defaultValue={defaultValue}
|
|
130
|
-
maxTagCount={maxTagCount}
|
|
131
|
-
multiple={multiple}
|
|
132
|
-
size={
|
|
133
|
-
context && !isUndefined(context.componentSize) ?
|
|
134
|
-
context.componentSize :
|
|
135
|
-
size
|
|
136
|
-
}
|
|
137
|
-
treeCheckable={treeCheckable}
|
|
138
|
-
showCheckedStrategy={str2ShowCheckedStrategy.get(showCheckedStrategy)}
|
|
139
|
-
treeCheckStrictly={treeCheckStrictly}
|
|
140
|
-
treeDefaultExpandAll={treeDefaultExpandAll}
|
|
141
|
-
treeDefaultExpandedKeys={treeDefaultExpandedKeys}
|
|
142
|
-
treeExpandedKeys={treeExpandedKeys}
|
|
143
|
-
onChange={updateSelectedValue}
|
|
144
|
-
showSearch={true}
|
|
145
|
-
virtual={virtual}
|
|
146
|
-
disabled={
|
|
147
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
148
|
-
context.componentDisabled :
|
|
149
|
-
disabled
|
|
150
|
-
}
|
|
151
|
-
placement={placement}
|
|
152
|
-
status={status}
|
|
153
|
-
treeNodeFilterProp={treeNodeFilterProp}
|
|
154
|
-
filterTreeNode={
|
|
155
|
-
(inputValue, treeNode) => {
|
|
156
|
-
// 处理''特殊情况
|
|
157
|
-
inputValue = inputValue || ''
|
|
158
|
-
if (inputValue !== '') {
|
|
159
|
-
if (treeNodeFilterMode === 'case-insensitive') {
|
|
160
|
-
// 进行大小写不敏感筛选
|
|
161
|
-
return (treeNode[treeNodeFilterProp] || '').toLowerCase()
|
|
162
|
-
.includes(inputValue.toLowerCase())
|
|
163
|
-
} else if (treeNodeFilterMode === 'case-sensitive') {
|
|
164
|
-
// 判断输入的内容是否是当前选项筛选依据字段值的子串
|
|
165
|
-
return treeNode[treeNodeFilterProp].includes(inputValue)
|
|
166
|
-
} else if (treeNodeFilterMode === 'regex') {
|
|
167
|
-
// 判断输入的正则规则是否匹配当前选项筛选依据字段值
|
|
168
|
-
try {
|
|
169
|
-
// 尝试进行正则匹配
|
|
170
|
-
return eval(`/${inputValue}/`).test(treeNode[treeNodeFilterProp])
|
|
171
|
-
} catch {
|
|
172
|
-
// 忽略非法的正则表达式
|
|
173
|
-
return false
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return false
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
autoClearSearchValue={autoClearSearchValue}
|
|
181
|
-
dropdownRender={
|
|
182
|
-
(dropdownBefore || dropdownAfter) ?
|
|
183
|
-
(menu) => {
|
|
184
|
-
return (
|
|
185
|
-
<>
|
|
186
|
-
{dropdownBefore}
|
|
187
|
-
{menu}
|
|
188
|
-
{dropdownAfter}
|
|
189
|
-
</>
|
|
190
|
-
);
|
|
191
|
-
} : undefined
|
|
192
|
-
}
|
|
193
|
-
onTreeExpand={(e) => {
|
|
194
|
-
setProps({ treeExpandedKeys: e })
|
|
195
|
-
}}
|
|
196
|
-
persistence={persistence}
|
|
197
|
-
persisted_props={persisted_props}
|
|
198
|
-
persistence_type={persistence_type}
|
|
199
|
-
data-dash-is-loading={
|
|
200
|
-
(loading_state && loading_state.is_loading) || undefined
|
|
201
|
-
}
|
|
202
|
-
getPopupContainer={
|
|
203
|
-
popupContainer === 'parent' ?
|
|
204
|
-
(triggerNode) => triggerNode.parentNode :
|
|
205
|
-
undefined
|
|
206
|
-
}
|
|
207
|
-
open={isUndefined(readOnly) || !readOnly ? undefined : false}
|
|
208
|
-
/>
|
|
209
|
-
</ConfigProvider>
|
|
8
|
+
<Suspense fallback={null}>
|
|
9
|
+
<LazyAntdTreeSelect {...props} />
|
|
10
|
+
</Suspense>
|
|
210
11
|
);
|
|
211
12
|
}
|
|
212
13
|
|
|
@@ -496,4 +297,7 @@ AntdTreeSelect.defaultProps = {
|
|
|
496
297
|
batchPropsNames: []
|
|
497
298
|
}
|
|
498
299
|
|
|
499
|
-
export default AntdTreeSelect;
|
|
300
|
+
export default AntdTreeSelect;
|
|
301
|
+
|
|
302
|
+
export const propTypes = AntdTreeSelect.propTypes;
|
|
303
|
+
export const defaultProps = AntdTreeSelect.defaultProps;
|