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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form } from 'antd';
|
|
3
|
+
import { isString } from 'lodash';
|
|
4
|
+
import useCss from '../../../hooks/useCss';
|
|
5
|
+
import { propTypes, defaultProps } from '../../../components/dataEntry/form/AntdForm.react';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// 定义表单组件AntdForm,api参数参考https://ant.design/components/form-cn/
|
|
9
|
+
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
|
+
return (
|
|
28
|
+
<Form id={id}
|
|
29
|
+
className={
|
|
30
|
+
isString(className) ?
|
|
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>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default AntdForm;
|
|
51
|
+
|
|
52
|
+
AntdForm.defaultProps = defaultProps;
|
|
53
|
+
AntdForm.propTypes = propTypes;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form } from 'antd';
|
|
3
|
+
import { isString } from 'lodash';
|
|
4
|
+
import useCss from '../../../hooks/useCss';
|
|
5
|
+
import { propTypes, defaultProps } from '../../../components/dataEntry/form/AntdFormItem.react';
|
|
6
|
+
|
|
7
|
+
const { Item } = Form;
|
|
8
|
+
|
|
9
|
+
// 定义表单项组件AntdFormItem,api参数参考https://ant.design/components/form-cn/
|
|
10
|
+
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
|
+
return (
|
|
34
|
+
<Item id={id}
|
|
35
|
+
className={
|
|
36
|
+
isString(className) ?
|
|
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>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default AntdFormItem;
|
|
63
|
+
|
|
64
|
+
AntdFormItem.defaultProps = defaultProps;
|
|
65
|
+
AntdFormItem.propTypes = propTypes;
|
package/usage.py
CHANGED
|
@@ -1,61 +1,87 @@
|
|
|
1
1
|
import dash
|
|
2
|
+
import json
|
|
3
|
+
from dash import html
|
|
2
4
|
import feffery_antd_components as fac
|
|
3
|
-
from dash.dependencies import Input, Output
|
|
5
|
+
from dash.dependencies import Input, Output, State
|
|
4
6
|
|
|
5
7
|
app = dash.Dash(__name__, compress=True)
|
|
6
8
|
|
|
7
9
|
app.layout = dash.html.Div(
|
|
8
10
|
[
|
|
9
|
-
fac.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
fac.AntdDivider(
|
|
12
|
+
'单选示例',
|
|
13
|
+
innerTextOrientation='left'
|
|
14
|
+
),
|
|
15
|
+
fac.AntdTreeSelect(
|
|
16
|
+
id='tree-select-demo',
|
|
17
|
+
treeData=[
|
|
18
|
+
{
|
|
19
|
+
'key': '节点1',
|
|
20
|
+
'value': '1',
|
|
21
|
+
'title': '节点1',
|
|
22
|
+
'children': [
|
|
21
23
|
{
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
'key': f'节点1-{i}',
|
|
25
|
+
'value': f'1-{i}',
|
|
26
|
+
'title': f'节点1-{i}'
|
|
27
|
+
}
|
|
28
|
+
for i in range(1, 5)
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
'key': '节点2',
|
|
33
|
+
'value': '2',
|
|
34
|
+
'title': '节点2'
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
placeholder='请选择',
|
|
38
|
+
style={
|
|
39
|
+
'width': 256
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
fac.AntdSpace(
|
|
43
|
+
id='tree-select-demo-output',
|
|
44
|
+
direction='vertical',
|
|
45
|
+
style={
|
|
46
|
+
'width': '100%'
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
|
|
50
|
+
fac.AntdDivider(
|
|
51
|
+
'多选示例',
|
|
52
|
+
innerTextOrientation='left'
|
|
53
|
+
),
|
|
54
|
+
fac.AntdTreeSelect(
|
|
55
|
+
id='tree-select-multiple-demo',
|
|
56
|
+
treeData=[
|
|
57
|
+
{
|
|
58
|
+
'key': '节点1',
|
|
59
|
+
'value': '1',
|
|
60
|
+
'title': '节点1',
|
|
61
|
+
'children': [
|
|
35
62
|
{
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
{
|
|
40
|
-
'title': '渝中区',
|
|
41
|
-
'key': '渝中区',
|
|
42
|
-
'children': [
|
|
43
|
-
{
|
|
44
|
-
'title': '解放碑街道',
|
|
45
|
-
'key': '解放碑街道'
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
'title': '渝北区',
|
|
51
|
-
'key': '渝北区'
|
|
52
|
-
}
|
|
53
|
-
]
|
|
63
|
+
'key': f'节点1-{i}',
|
|
64
|
+
'value': f'1-{i}',
|
|
65
|
+
'title': f'节点1-{i}'
|
|
54
66
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
for i in range(1, 5)
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
'key': '节点2',
|
|
72
|
+
'value': '2',
|
|
73
|
+
'title': '节点2'
|
|
74
|
+
}
|
|
58
75
|
],
|
|
76
|
+
placeholder='请选择',
|
|
77
|
+
multiple=True,
|
|
78
|
+
treeCheckable=True,
|
|
79
|
+
style={
|
|
80
|
+
'width': 256
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
fac.AntdSpace(
|
|
84
|
+
id='tree-select-multiple-demo-output',
|
|
59
85
|
direction='vertical',
|
|
60
86
|
style={
|
|
61
87
|
'width': '100%'
|
|
@@ -69,12 +95,29 @@ app.layout = dash.html.Div(
|
|
|
69
95
|
|
|
70
96
|
|
|
71
97
|
@app.callback(
|
|
72
|
-
Output('demo-
|
|
73
|
-
Input('
|
|
98
|
+
Output('tree-select-demo-output', 'children'),
|
|
99
|
+
[Input('tree-select-demo', 'value'),
|
|
100
|
+
Input('tree-select-demo', 'treeExpandedKeys')]
|
|
101
|
+
)
|
|
102
|
+
def tree_select_demo(value, treeExpandedKeys):
|
|
103
|
+
|
|
104
|
+
return [
|
|
105
|
+
fac.AntdText(f'value: {value}'),
|
|
106
|
+
fac.AntdText(f'treeExpandedKeys: {treeExpandedKeys}')
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@app.callback(
|
|
111
|
+
Output('tree-select-multiple-demo-output', 'children'),
|
|
112
|
+
[Input('tree-select-multiple-demo', 'value'),
|
|
113
|
+
Input('tree-select-multiple-demo', 'treeExpandedKeys')]
|
|
74
114
|
)
|
|
75
|
-
def
|
|
115
|
+
def tree_select_multiple_demo(value, treeExpandedKeys):
|
|
76
116
|
|
|
77
|
-
return
|
|
117
|
+
return [
|
|
118
|
+
fac.AntdText(f'value: {value}'),
|
|
119
|
+
fac.AntdText(f'treeExpandedKeys: {treeExpandedKeys}')
|
|
120
|
+
]
|
|
78
121
|
|
|
79
122
|
|
|
80
123
|
if __name__ == '__main__':
|