feffery_antd_components 0.2.10-rc15 → 0.2.10-rc17
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/AntdMenu.py +6 -4
- 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/metadata.json +10 -0
- package/feffery_antd_components/package-info.json +1 -1
- package/package.json +1 -1
- package/src/jl/'feffery'_antdmenu.jl +2 -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/components/navigation/AntdMenu.react.js +14 -10
- 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 +45 -56
|
@@ -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;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import { Checkbox } from 'antd';
|
|
3
|
+
import { isString, isUndefined } from 'lodash';
|
|
4
|
+
import useCss from '../../hooks/useCss';
|
|
5
|
+
import PropsContext from '../../contexts/PropsContext';
|
|
6
|
+
import { propTypes, defaultProps } from '../../components/dataEntry/AntdCheckbox.react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// 定义选择框组件AntdCheckbox,api参数参考https://ant.design/components/checkbox-cn/
|
|
10
|
+
const AntdCheckbox = (props) => {
|
|
11
|
+
// 取得必要属性或参数
|
|
12
|
+
let {
|
|
13
|
+
id,
|
|
14
|
+
style,
|
|
15
|
+
className,
|
|
16
|
+
key,
|
|
17
|
+
label,
|
|
18
|
+
disabled,
|
|
19
|
+
checked,
|
|
20
|
+
indeterminate,
|
|
21
|
+
readOnly,
|
|
22
|
+
setProps,
|
|
23
|
+
persistence,
|
|
24
|
+
persisted_props,
|
|
25
|
+
persistence_type,
|
|
26
|
+
loading_state,
|
|
27
|
+
batchPropsNames
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
// 批属性监听
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
33
|
+
let _batchPropsValues = {};
|
|
34
|
+
for (let propName of batchPropsNames) {
|
|
35
|
+
_batchPropsValues[propName] = props[propName];
|
|
36
|
+
}
|
|
37
|
+
setProps({
|
|
38
|
+
batchPropsValues: _batchPropsValues
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const context = useContext(PropsContext)
|
|
44
|
+
|
|
45
|
+
const onChange = e => {
|
|
46
|
+
if (!readOnly) {
|
|
47
|
+
setProps({ checked: e.target.checked })
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 返回定制化的前端组件
|
|
52
|
+
return (
|
|
53
|
+
<Checkbox
|
|
54
|
+
id={id}
|
|
55
|
+
className={
|
|
56
|
+
isString(className) ?
|
|
57
|
+
className :
|
|
58
|
+
(className ? useCss(className) : undefined)
|
|
59
|
+
}
|
|
60
|
+
style={style}
|
|
61
|
+
key={key}
|
|
62
|
+
onChange={onChange}
|
|
63
|
+
disabled={
|
|
64
|
+
context && !isUndefined(context.componentDisabled) ?
|
|
65
|
+
context.componentDisabled :
|
|
66
|
+
disabled
|
|
67
|
+
}
|
|
68
|
+
checked={checked}
|
|
69
|
+
indeterminate={indeterminate}
|
|
70
|
+
persistence={persistence}
|
|
71
|
+
persisted_props={persisted_props}
|
|
72
|
+
persistence_type={persistence_type}
|
|
73
|
+
data-dash-is-loading={
|
|
74
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
{label}
|
|
78
|
+
</Checkbox>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default AntdCheckbox;
|
|
83
|
+
|
|
84
|
+
AntdCheckbox.defaultProps = defaultProps;
|
|
85
|
+
AntdCheckbox.propTypes = propTypes;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import { Checkbox } from 'antd';
|
|
3
|
+
import { isString, isUndefined } from 'lodash';
|
|
4
|
+
import useCss from '../../hooks/useCss';
|
|
5
|
+
import PropsContext from '../../contexts/PropsContext';
|
|
6
|
+
import { propTypes, defaultProps } from '../../components/dataEntry/AntdCheckboxGroup.react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// 定义组合选择框组件AntdCheckboxGroup,api参数参考https://ant.design/components/checkbox-cn/
|
|
10
|
+
const AntdCheckboxGroup = (props) => {
|
|
11
|
+
// 取得必要属性或参数
|
|
12
|
+
let {
|
|
13
|
+
id,
|
|
14
|
+
style,
|
|
15
|
+
className,
|
|
16
|
+
key,
|
|
17
|
+
options,
|
|
18
|
+
value,
|
|
19
|
+
disabled,
|
|
20
|
+
readOnly,
|
|
21
|
+
setProps,
|
|
22
|
+
persistence,
|
|
23
|
+
persisted_props,
|
|
24
|
+
persistence_type,
|
|
25
|
+
loading_state,
|
|
26
|
+
batchPropsNames
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
// 批属性监听
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
32
|
+
let _batchPropsValues = {};
|
|
33
|
+
for (let propName of batchPropsNames) {
|
|
34
|
+
_batchPropsValues[propName] = props[propName];
|
|
35
|
+
}
|
|
36
|
+
setProps({
|
|
37
|
+
batchPropsValues: _batchPropsValues
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const context = useContext(PropsContext)
|
|
43
|
+
|
|
44
|
+
const onChange = e => {
|
|
45
|
+
if (!readOnly) {
|
|
46
|
+
setProps({ value: e })
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 返回定制化的前端组件
|
|
51
|
+
return (
|
|
52
|
+
<Checkbox.Group
|
|
53
|
+
id={id}
|
|
54
|
+
className={
|
|
55
|
+
isString(className) ?
|
|
56
|
+
className :
|
|
57
|
+
(className ? useCss(className) : undefined)
|
|
58
|
+
}
|
|
59
|
+
style={style}
|
|
60
|
+
key={key}
|
|
61
|
+
options={options}
|
|
62
|
+
value={value}
|
|
63
|
+
disabled={
|
|
64
|
+
context && !isUndefined(context.componentDisabled) ?
|
|
65
|
+
context.componentDisabled :
|
|
66
|
+
disabled
|
|
67
|
+
}
|
|
68
|
+
onChange={onChange}
|
|
69
|
+
persistence={persistence}
|
|
70
|
+
persisted_props={persisted_props}
|
|
71
|
+
persistence_type={persistence_type}
|
|
72
|
+
data-dash-is-loading={
|
|
73
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default AntdCheckboxGroup;
|
|
80
|
+
|
|
81
|
+
AntdCheckboxGroup.defaultProps = defaultProps;
|
|
82
|
+
AntdCheckboxGroup.propTypes = propTypes;
|