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.
Files changed (65) hide show
  1. package/DESCRIPTION +1 -1
  2. package/Project.toml +1 -1
  3. package/build/lib/feffery_antd_components/__init__.py +1 -1
  4. package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
  5. package/build/lib/feffery_antd_components/async-antd_upload.js +1 -1
  6. package/build/lib/feffery_antd_components/async-data_entry.js +1 -0
  7. package/build/lib/feffery_antd_components/feffery_antd_components.min.js +1 -1
  8. package/build/lib/feffery_antd_components/package-info.json +1 -1
  9. package/feffery_antd_components/AntdMenu.py +6 -4
  10. package/feffery_antd_components/__init__.py +1 -1
  11. package/feffery_antd_components/async-antd_table.js +1 -1
  12. package/feffery_antd_components/async-antd_upload.js +1 -1
  13. package/feffery_antd_components/async-data_entry.js +1 -0
  14. package/feffery_antd_components/feffery_antd_components.min.js +1 -1
  15. package/feffery_antd_components/metadata.json +10 -0
  16. package/feffery_antd_components/package-info.json +1 -1
  17. package/package.json +1 -1
  18. package/src/jl/'feffery'_antdmenu.jl +2 -1
  19. package/src/lib/components/dataEntry/AntdCascader.react.js +9 -147
  20. package/src/lib/components/dataEntry/AntdCheckbox.react.js +9 -74
  21. package/src/lib/components/dataEntry/AntdCheckboxGroup.react.js +9 -71
  22. package/src/lib/components/dataEntry/AntdDatePicker.react.js +10 -425
  23. package/src/lib/components/dataEntry/AntdDateRangePicker.react.js +9 -446
  24. package/src/lib/components/dataEntry/AntdInput.react.js +11 -325
  25. package/src/lib/components/dataEntry/AntdInputNumber.react.js +9 -134
  26. package/src/lib/components/dataEntry/AntdMentions.react.js +9 -113
  27. package/src/lib/components/dataEntry/AntdRadioGroup.react.js +9 -135
  28. package/src/lib/components/dataEntry/AntdRate.react.js +9 -76
  29. package/src/lib/components/dataEntry/AntdSegmentedColoring.react.js +9 -206
  30. package/src/lib/components/dataEntry/AntdSelect.react.js +10 -288
  31. package/src/lib/components/dataEntry/AntdSlider.react.js +9 -123
  32. package/src/lib/components/dataEntry/AntdSwitch.react.js +9 -84
  33. package/src/lib/components/dataEntry/AntdTimePicker.react.js +9 -125
  34. package/src/lib/components/dataEntry/AntdTimeRangePicker.react.js +9 -141
  35. package/src/lib/components/dataEntry/AntdTransfer.react.js +9 -132
  36. package/src/lib/components/dataEntry/AntdTreeSelect.react.js +11 -207
  37. package/src/lib/components/dataEntry/check-card/AntdCheckCard.react.js +10 -66
  38. package/src/lib/components/dataEntry/check-card/AntdCheckCardGroup.react.js +10 -79
  39. package/src/lib/components/dataEntry/form/AntdForm.react.js +9 -42
  40. package/src/lib/components/dataEntry/form/AntdFormItem.react.js +9 -54
  41. package/src/lib/components/navigation/AntdMenu.react.js +14 -10
  42. package/src/lib/fragments/AntdTable.react.js +29 -12
  43. package/src/lib/fragments/dataEntry/AntdCascader.react.js +157 -0
  44. package/src/lib/fragments/dataEntry/AntdCheckbox.react.js +85 -0
  45. package/src/lib/fragments/dataEntry/AntdCheckboxGroup.react.js +82 -0
  46. package/src/lib/fragments/dataEntry/AntdDatePicker.react.js +436 -0
  47. package/src/lib/fragments/dataEntry/AntdDateRangePicker.react.js +458 -0
  48. package/src/lib/fragments/dataEntry/AntdInput.react.js +333 -0
  49. package/src/lib/fragments/dataEntry/AntdInputNumber.react.js +145 -0
  50. package/src/lib/fragments/dataEntry/AntdMentions.react.js +124 -0
  51. package/src/lib/fragments/dataEntry/AntdRadioGroup.react.js +146 -0
  52. package/src/lib/fragments/dataEntry/AntdRate.react.js +87 -0
  53. package/src/lib/fragments/dataEntry/AntdSegmentedColoring.react.js +219 -0
  54. package/src/lib/fragments/dataEntry/AntdSelect.react.js +298 -0
  55. package/src/lib/fragments/dataEntry/AntdSlider.react.js +134 -0
  56. package/src/lib/fragments/dataEntry/AntdSwitch.react.js +95 -0
  57. package/src/lib/fragments/dataEntry/AntdTimePicker.react.js +136 -0
  58. package/src/lib/fragments/dataEntry/AntdTimeRangePicker.react.js +152 -0
  59. package/src/lib/fragments/dataEntry/AntdTransfer.react.js +143 -0
  60. package/src/lib/fragments/dataEntry/AntdTreeSelect.react.js +216 -0
  61. package/src/lib/fragments/dataEntry/check-card/AntdCheckCard.react.js +77 -0
  62. package/src/lib/fragments/dataEntry/check-card/AntdCheckCardGroup.react.js +89 -0
  63. package/src/lib/fragments/dataEntry/form/AntdForm.react.js +53 -0
  64. package/src/lib/fragments/dataEntry/form/AntdFormItem.react.js +65 -0
  65. package/usage.py +45 -56
@@ -1,331 +1,14 @@
1
- import React, { useEffect, useContext } from 'react';
1
+ import React, { Suspense } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Input } from 'antd';
4
- import md5 from 'md5';
5
- import { useRequest } from 'ahooks';
6
- import { isString, isUndefined } from 'lodash';
7
- import useCss from '../../hooks/useCss';
8
- import PropsContext from '../../contexts/PropsContext';
9
3
 
4
+ const LazyAntdInput = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdInput.react'));
10
5
 
11
- const { Search, TextArea } = Input;
12
-
13
- // 定义输入框组件AntdInput,api参数参考https://ant.design/components/input-cn/
14
6
  const AntdInput = (props) => {
15
- // 取得必要属性或参数
16
- let {
17
- id,
18
- className,
19
- style,
20
- key,
21
- mode,
22
- passwordUseMd5,
23
- autoComplete,
24
- placeholder,
25
- value,
26
- size,
27
- addonBefore,
28
- addonAfter,
29
- prefix,
30
- suffix,
31
- allowClear,
32
- bordered,
33
- defaultValue,
34
- disabled,
35
- maxLength,
36
- showCount,
37
- countFormat,
38
- nClicksSearch,
39
- nSubmit,
40
- status,
41
- autoSize,
42
- debounceWait,
43
- readOnly,
44
- emptyAsNone,
45
- setProps,
46
- loading_state,
47
- persistence,
48
- persisted_props,
49
- persistence_type,
50
- batchPropsNames
51
- } = props;
52
-
53
- // 批属性监听
54
- useEffect(() => {
55
- if (batchPropsNames && batchPropsNames.length !== 0) {
56
- let _batchPropsValues = {};
57
- for (let propName of batchPropsNames) {
58
- _batchPropsValues[propName] = props[propName];
59
- }
60
- setProps({
61
- batchPropsValues: _batchPropsValues
62
- })
63
- }
64
- })
65
-
66
- const context = useContext(PropsContext)
67
-
68
- useEffect(() => {
69
- // 初始化value
70
- if (defaultValue && !value) {
71
- // 当defaultValue不为空且value为空时,为value初始化defaultValue对应的value值
72
- setProps({
73
- value: defaultValue,
74
- md5Value: md5(defaultValue)
75
- })
76
- }
77
- // 在value存在时,初始化md5Value
78
- if (value) {
79
- setProps({
80
- md5Value: md5(value)
81
- })
82
- }
83
- }, [])
84
-
85
- // 监听输入内容变化事件
86
- const onChange = e => {
87
- // 若启用md5加密且为密码模式
88
- if (passwordUseMd5 && mode === 'password') {
89
- setProps({
90
- md5Value: md5(e.target.value),
91
- value: (
92
- emptyAsNone ?
93
- (
94
- e.target.value === '' ?
95
- null :
96
- e.target.value
97
- ) :
98
- e.target.value
99
- )
100
- })
101
- } else {
102
- setProps({
103
- value: (
104
- emptyAsNone ?
105
- (
106
- e.target.value === '' ?
107
- null :
108
- e.target.value
109
- ) :
110
- e.target.value
111
- )
112
- })
113
- }
114
- }
115
-
116
- const { run: onDebounceChange } = useRequest(
117
- (e) => {
118
- setProps({
119
- debounceValue: (
120
- emptyAsNone ?
121
- (
122
- e === '' ?
123
- null :
124
- e
125
- ) :
126
- e
127
- )
128
- })
129
- },
130
- {
131
- debounceWait: Math.max(debounceWait, 200),
132
- manual: true
133
- }
134
- )
135
-
136
- // 监听聚焦到输入框时enter键点按次数
137
- const onPressEnter = e => {
138
- setProps({ nSubmit: nSubmit + 1 })
139
- }
140
-
141
- // 监听搜索按钮点按事件
142
- const onSearch = e => {
143
- setProps({ nClicksSearch: nClicksSearch + 1 })
144
- }
145
-
146
- // 不同的mode模式下渲染不同的组件
147
- if (mode === 'default') {
148
- return (
149
- <Input id={id}
150
- className={
151
- isString(className) ?
152
- className :
153
- (className ? useCss(className) : undefined)
154
- }
155
- style={style}
156
- key={key}
157
- placeholder={placeholder}
158
- autoComplete={autoComplete}
159
- value={value}
160
- size={
161
- context && !isUndefined(context.componentSize) ?
162
- context.componentSize :
163
- size
164
- }
165
- addonBefore={addonBefore}
166
- addonAfter={addonAfter}
167
- prefix={prefix}
168
- suffix={suffix}
169
- allowClear={allowClear}
170
- bordered={bordered}
171
- defaultValue={defaultValue}
172
- disabled={
173
- context && !isUndefined(context.componentDisabled) ?
174
- context.componentDisabled :
175
- disabled
176
- }
177
- maxLength={maxLength}
178
- status={status}
179
- readOnly={readOnly}
180
- onChange={(e) => {
181
- onChange(e)
182
- onDebounceChange(e.target.value)
183
- }}
184
- onPressEnter={onPressEnter}
185
- persistence={persistence}
186
- persisted_props={persisted_props}
187
- persistence_type={persistence_type}
188
- data-dash-is-loading={
189
- (loading_state && loading_state.is_loading) || undefined
190
- } />
191
- );
192
- } else if (mode === 'search') {
193
- return (
194
- <Search id={id}
195
- className={
196
- isString(className) ?
197
- className :
198
- (className ? useCss(className) : undefined)
199
- }
200
- style={style}
201
- key={key}
202
- placeholder={placeholder}
203
- autoComplete={autoComplete}
204
- size={
205
- context && !isUndefined(context.componentSize) ?
206
- context.componentSize :
207
- size
208
- }
209
- allowClear={allowClear}
210
- bordered={bordered}
211
- value={value}
212
- defaultValue={defaultValue}
213
- disabled={
214
- context && !isUndefined(context.componentDisabled) ?
215
- context.componentDisabled :
216
- disabled
217
- }
218
- maxLength={maxLength}
219
- status={status}
220
- readOnly={readOnly}
221
- onSearch={onSearch}
222
- onChange={(e) => {
223
- onChange(e)
224
- onDebounceChange(e.target.value)
225
- }}
226
- onPressEnter={onPressEnter}
227
- persistence={persistence}
228
- persisted_props={persisted_props}
229
- persistence_type={persistence_type}
230
- data-dash-is-loading={
231
- (loading_state && loading_state.is_loading) || undefined
232
- } />
233
- );
234
- } else if (mode === 'text-area') {
235
- return (
236
- <TextArea id={id}
237
- className={
238
- isString(className) ?
239
- className :
240
- (className ? useCss(className) : undefined)
241
- }
242
- style={style}
243
- key={key}
244
- placeholder={placeholder}
245
- autoComplete={autoComplete}
246
- size={
247
- context && !isUndefined(context.componentSize) ?
248
- context.componentSize :
249
- size
250
- }
251
- allowClear={allowClear}
252
- bordered={bordered}
253
- value={value}
254
- defaultValue={defaultValue}
255
- disabled={
256
- context && !isUndefined(context.componentDisabled) ?
257
- context.componentDisabled :
258
- disabled
259
- }
260
- maxLength={maxLength}
261
- showCount={
262
- showCount && countFormat && !maxLength ?
263
- {
264
- // 基于countFormat所定义的正则规则来自定义计算字符数
265
- formatter: ({ value }) => {
266
- return value.match(eval(`/${countFormat}/g`))?.length || 0;
267
- }
268
- } :
269
- showCount
270
- }
271
- status={status}
272
- autoSize={autoSize}
273
- readOnly={readOnly}
274
- onChange={(e) => {
275
- onChange(e)
276
- onDebounceChange(e.target.value)
277
- }}
278
- onPressEnter={onPressEnter}
279
- persistence={persistence}
280
- persisted_props={persisted_props}
281
- persistence_type={persistence_type}
282
- data-dash-is-loading={
283
- (loading_state && loading_state.is_loading) || undefined
284
- } />
285
- );
286
- } else if (mode === 'password') {
287
- return (
288
- <Input.Password id={id}
289
- className={
290
- isString(className) ?
291
- className :
292
- (className ? useCss(className) : undefined)
293
- }
294
- style={style}
295
- key={key}
296
- placeholder={placeholder}
297
- autoComplete={autoComplete}
298
- size={
299
- context && !isUndefined(context.componentSize) ?
300
- context.componentSize :
301
- size
302
- }
303
- bordered={bordered}
304
- disabled={
305
- context && !isUndefined(context.componentDisabled) ?
306
- context.componentDisabled :
307
- disabled
308
- }
309
- value={value}
310
- defaultValue={defaultValue}
311
- maxLength={maxLength}
312
- status={status}
313
- prefix={prefix}
314
- suffix={suffix}
315
- readOnly={readOnly}
316
- onChange={(e) => {
317
- onChange(e)
318
- onDebounceChange(e.target.value)
319
- }}
320
- onPressEnter={onPressEnter}
321
- persistence={persistence}
322
- persisted_props={persisted_props}
323
- persistence_type={persistence_type}
324
- data-dash-is-loading={
325
- (loading_state && loading_state.is_loading) || undefined
326
- } />
327
- );
328
- }
7
+ return (
8
+ <Suspense fallback={null}>
9
+ <LazyAntdInput {...props} />
10
+ </Suspense>
11
+ );
329
12
  }
330
13
 
331
14
  // 定义参数或属性
@@ -507,4 +190,7 @@ AntdInput.defaultProps = {
507
190
  batchPropsNames: []
508
191
  }
509
192
 
510
- export default AntdInput;
193
+ export default AntdInput;
194
+
195
+ export const propTypes = AntdInput.propTypes;
196
+ export const defaultProps = AntdInput.defaultProps;
@@ -1,141 +1,13 @@
1
- import React, { useEffect, useContext } from 'react';
1
+ import React, { Suspense } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { InputNumber } from 'antd';
4
- import { useRequest } from 'ahooks';
5
- import { isString, isUndefined } from 'lodash';
6
- import useCss from '../../hooks/useCss';
7
- import PropsContext from '../../contexts/PropsContext';
8
3
 
4
+ const LazyAntdInputNumber = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdInputNumber.react'));
9
5
 
10
- // 定义数字输入框组件AntdInputNumber,api参数参考https://ant.design/components/input-number-cn/
11
6
  const AntdInputNumber = (props) => {
12
-
13
- // 取得必要属性或参数
14
- let {
15
- id,
16
- className,
17
- style,
18
- key,
19
- size,
20
- addonBefore,
21
- addonAfter,
22
- prefix,
23
- bordered,
24
- controls,
25
- value,
26
- defaultValue,
27
- disabled,
28
- placeholder,
29
- keyboard,
30
- min,
31
- max,
32
- step,
33
- precision,
34
- readOnly,
35
- stringMode,
36
- nSubmit,
37
- status,
38
- debounceWait,
39
- setProps,
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
-
62
- useEffect(() => {
63
- // 初始化value
64
- if (defaultValue && !value) {
65
- // 当defaultValue不为空且value为空时,为value初始化defaultValue对应的value值
66
- setProps({
67
- value: defaultValue,
68
- debounceValue: defaultValue
69
- })
70
- }
71
- }, [])
72
-
73
- // 监听输入内容变化事件
74
- const onChange = e => {
75
- setProps({ value: e })
76
- }
77
-
78
- const { run: onDebounceChange } = useRequest(
79
- (e) => {
80
- setProps({ debounceValue: e })
81
- },
82
- {
83
- debounceWait: Math.max(debounceWait, 200),
84
- manual: true
85
- }
86
- )
87
-
88
- // 监听聚焦到输入框时enter键点按次数
89
- const onPressEnter = e => {
90
- setProps({ nSubmit: nSubmit + 1 })
91
- }
92
-
93
7
  return (
94
- <InputNumber id={id}
95
- className={
96
- isString(className) ?
97
- className :
98
- (className ? useCss(className) : undefined)
99
- }
100
- style={style}
101
- key={key}
102
- size={
103
- context && !isUndefined(context.componentSize) ?
104
- context.componentSize :
105
- size
106
- }
107
- addonBefore={addonBefore}
108
- addonAfter={addonAfter}
109
- prefix={prefix}
110
- placeholder={placeholder}
111
- bordered={bordered}
112
- controls={controls}
113
- value={value}
114
- defaultValue={defaultValue}
115
- disabled={
116
- context && !isUndefined(context.componentDisabled) ?
117
- context.componentDisabled :
118
- disabled
119
- }
120
- keyboard={keyboard}
121
- min={min}
122
- max={max}
123
- step={step}
124
- precision={precision}
125
- readOnly={readOnly}
126
- stringMode={stringMode}
127
- status={status}
128
- onChange={(e) => {
129
- onChange(e)
130
- onDebounceChange(e)
131
- }}
132
- onPressEnter={onPressEnter}
133
- persistence={persistence}
134
- persisted_props={persisted_props}
135
- persistence_type={persistence_type}
136
- data-dash-is-loading={
137
- (loading_state && loading_state.is_loading) || undefined
138
- } />
8
+ <Suspense fallback={null}>
9
+ <LazyAntdInputNumber {...props} />
10
+ </Suspense>
139
11
  );
140
12
  }
141
13
 
@@ -310,4 +182,7 @@ AntdInputNumber.defaultProps = {
310
182
  batchPropsNames: []
311
183
  }
312
184
 
313
- export default AntdInputNumber;
185
+ export default AntdInputNumber;
186
+
187
+ export const propTypes = AntdInputNumber.propTypes;
188
+ export const defaultProps = AntdInputNumber.defaultProps;
@@ -1,120 +1,13 @@
1
- import React, { useContext, useEffect } from 'react';
1
+ import React, { Suspense } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Mentions } from 'antd';
4
- import { isString, isUndefined } from 'lodash';
5
- import useCss from '../../hooks/useCss';
6
- import PropsContext from '../../contexts/PropsContext';
7
3
 
8
- const { Option } = Mentions;
4
+ const LazyAntdMentions = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdMentions.react'));
9
5
 
10
- // 定义提及组件AntdMentions,api参数参考https://ant.design/components/mentions-cn/
11
6
  const AntdMentions = (props) => {
12
- // 取得必要属性或参数
13
- let {
14
- id,
15
- className,
16
- style,
17
- key,
18
- autoSize,
19
- prefix,
20
- value,
21
- defaultValue,
22
- placement,
23
- options,
24
- disabled,
25
- status,
26
- popupContainer,
27
- readOnly,
28
- setProps,
29
- loading_state,
30
- batchPropsNames
31
- } = props;
32
-
33
- // 批属性监听
34
- useEffect(() => {
35
- if (batchPropsNames && batchPropsNames.length !== 0) {
36
- let _batchPropsValues = {};
37
- for (let propName of batchPropsNames) {
38
- _batchPropsValues[propName] = props[propName];
39
- }
40
- setProps({
41
- batchPropsValues: _batchPropsValues
42
- })
43
- }
44
- })
45
-
46
- const context = useContext(PropsContext)
47
-
48
- const onChange = (e) => {
49
- if (!readOnly) {
50
- setProps({ value: e })
51
- }
52
- }
53
-
54
- const onSelect = (e) => {
55
- // 获取最新一次被选中的子项value值
56
- let latestSelectedOption = e.value
57
-
58
- // 计算当前options中value值数组
59
- let optionValues = options.map(item => item.value)
60
-
61
- // 抽取已输入内容中的已选择子项内容
62
- let presentSelectedOptions = (
63
- (
64
- (value || '')
65
- .match(eval(`/${prefix || '@'}\\S{1,}\\s/g`))
66
- || []
67
- )
68
- .map(
69
- s => s.slice(1, s.length).trim()
70
- )
71
- .concat([latestSelectedOption])
72
- // 处理latestSelectedOption与options中value值的存在性问题
73
- .filter(s => optionValues.indexOf(s) !== -1)
74
- )
75
-
76
- // 更新输入框中已标记子项value值列表
77
- setProps({
78
- selectedOptions: presentSelectedOptions
79
- })
80
- }
81
-
82
7
  return (
83
- <Mentions id={id}
84
- className={
85
- isString(className) ?
86
- className :
87
- (className ? useCss(className) : undefined)
88
- }
89
- style={style}
90
- key={key}
91
- autoSize={autoSize}
92
- prefix={prefix}
93
- defaultValue={defaultValue}
94
- placement={placement}
95
- disabled={
96
- context && !isUndefined(context.componentDisabled) ?
97
- context.componentDisabled :
98
- disabled
99
- }
100
- status={status}
101
- onChange={onChange}
102
- onSelect={onSelect}
103
- getPopupContainer={
104
- popupContainer === 'parent' ?
105
- (triggerNode) => triggerNode.parentNode :
106
- undefined
107
- }
108
- data-dash-is-loading={
109
- (loading_state && loading_state.is_loading) || undefined
110
- }
111
- >
112
- {
113
- options.map(
114
- (item, idx) => <Option value={item.value} key={idx}>{item.label}</Option>
115
- )
116
- }
117
- </Mentions>
8
+ <Suspense fallback={null}>
9
+ <LazyAntdMentions {...props} />
10
+ </Suspense>
118
11
  );
119
12
  }
120
13
 
@@ -226,4 +119,7 @@ AntdMentions.defaultProps = {
226
119
  batchPropsNames: []
227
120
  }
228
121
 
229
- export default AntdMentions;
122
+ export default AntdMentions;
123
+
124
+ export const propTypes = AntdMentions.propTypes;
125
+ export const defaultProps = AntdMentions.defaultProps;