feffery_antd_components 0.2.10-rc13 → 0.2.10-rc15

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 (53) hide show
  1. package/DESCRIPTION +1 -1
  2. package/Project.toml +1 -1
  3. package/build/lib/feffery_antd_components/AntdTable.py +5 -3
  4. package/build/lib/feffery_antd_components/AntdTree.py +7 -3
  5. package/build/lib/feffery_antd_components/AntdUpload.py +2 -0
  6. package/build/lib/feffery_antd_components/__init__.py +16 -0
  7. package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
  8. package/build/lib/feffery_antd_components/async-antd_upload.js +1 -1
  9. package/build/lib/feffery_antd_components/feffery_antd_components.min.js +1 -1
  10. package/build/lib/feffery_antd_components/metadata.json +33 -0
  11. package/build/lib/feffery_antd_components/package-info.json +1 -1
  12. package/feffery_antd_components/AntdTable.py +5 -3
  13. package/feffery_antd_components/AntdTree.py +7 -3
  14. package/feffery_antd_components/AntdUpload.py +2 -0
  15. package/feffery_antd_components/__init__.py +16 -0
  16. package/feffery_antd_components/async-antd_table.js +1 -1
  17. package/feffery_antd_components/async-antd_upload.js +1 -1
  18. package/feffery_antd_components/feffery_antd_components.min.js +1 -1
  19. package/feffery_antd_components/metadata.json +33 -0
  20. package/feffery_antd_components/package-info.json +1 -1
  21. package/package.json +1 -1
  22. package/src/jl/'feffery'_antdtable.jl +2 -1
  23. package/src/jl/'feffery'_antdtree.jl +3 -1
  24. package/src/jl/'feffery'_antdupload.jl +2 -1
  25. package/src/lib/components/dataDisplay/AntdComment.react.js +16 -16
  26. package/src/lib/components/dataDisplay/AntdSegmented.react.js +16 -16
  27. package/src/lib/components/dataDisplay/AntdTable.react.js +8 -2
  28. package/src/lib/components/dataDisplay/AntdTree.react.js +81 -19
  29. package/src/lib/components/dataEntry/AntdCascader.react.js +16 -16
  30. package/src/lib/components/dataEntry/AntdCheckbox.react.js +17 -17
  31. package/src/lib/components/dataEntry/AntdCheckboxGroup.react.js +17 -17
  32. package/src/lib/components/dataEntry/AntdDatePicker.react.js +16 -16
  33. package/src/lib/components/dataEntry/AntdDateRangePicker.react.js +16 -16
  34. package/src/lib/components/dataEntry/AntdInput.react.js +16 -16
  35. package/src/lib/components/dataEntry/AntdInputNumber.react.js +16 -16
  36. package/src/lib/components/dataEntry/AntdMentions.react.js +17 -17
  37. package/src/lib/components/dataEntry/AntdRadioGroup.react.js +16 -16
  38. package/src/lib/components/dataEntry/AntdRate.react.js +16 -16
  39. package/src/lib/components/dataEntry/AntdSegmentedColoring.react.js +17 -17
  40. package/src/lib/components/dataEntry/AntdSelect.react.js +16 -16
  41. package/src/lib/components/dataEntry/AntdSlider.react.js +16 -16
  42. package/src/lib/components/dataEntry/AntdSwitch.react.js +16 -16
  43. package/src/lib/components/dataEntry/AntdTimePicker.react.js +16 -16
  44. package/src/lib/components/dataEntry/AntdTimeRangePicker.react.js +16 -16
  45. package/src/lib/components/dataEntry/AntdTransfer.react.js +17 -17
  46. package/src/lib/components/dataEntry/AntdTreeSelect.react.js +16 -16
  47. package/src/lib/components/dataEntry/upload/AntdUpload.react.js +4 -0
  48. package/src/lib/components/navigation/AntdDropdown.react.js +17 -17
  49. package/src/lib/components/navigation/AntdPagination.react.js +16 -16
  50. package/src/lib/components/styles.css +5 -0
  51. package/src/lib/fragments/AntdTable.react.js +3 -3
  52. package/src/lib/fragments/upload/AntdUpload.react.js +3 -249
  53. package/usage.py +60 -89
@@ -36,9 +36,23 @@ const AntdPagination = (props) => {
36
36
  loading_state,
37
37
  persistence,
38
38
  persisted_props,
39
- persistence_type
39
+ persistence_type,
40
+ batchPropsNames
40
41
  } = props;
41
42
 
43
+ // 批属性监听
44
+ useEffect(() => {
45
+ if (batchPropsNames && batchPropsNames.length !== 0) {
46
+ let _batchPropsValues = {};
47
+ for (let propName of batchPropsNames) {
48
+ _batchPropsValues[propName] = props[propName];
49
+ }
50
+ setProps({
51
+ batchPropsValues: _batchPropsValues
52
+ })
53
+ }
54
+ })
55
+
42
56
  const context = useContext(PropsContext)
43
57
  locale = (context && context.locale) || locale
44
58
 
@@ -248,18 +262,4 @@ AntdPagination.defaultProps = {
248
262
  batchPropsNames: []
249
263
  }
250
264
 
251
- export default React.memo(
252
- AntdPagination,
253
- (prevProps, nextProps) => {
254
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
255
- let _batchPropsValues = {};
256
- for (let propName of nextProps.batchPropsNames) {
257
- _batchPropsValues[propName] = nextProps[propName];
258
- }
259
- nextProps.setProps({
260
- batchPropsValues: _batchPropsValues
261
- })
262
- }
263
- return false;
264
- }
265
- );
265
+ export default AntdPagination;
@@ -164,4 +164,9 @@
164
164
 
165
165
  .ant-tree-title .ant-rate {
166
166
  font-size: 16px;
167
+ }
168
+
169
+ /* 针对上传组件允许按钮block模式 */
170
+ .ant-upload-button-block .ant-upload {
171
+ display: block;
167
172
  }
@@ -40,7 +40,7 @@ import {
40
40
  QuestionCircleOutlined,
41
41
  DownOutlined
42
42
  } from '@ant-design/icons';
43
- import { isNumber, isEqual, isString } from 'lodash';
43
+ import { isNumber, isEqual, isString, cloneDeep } from 'lodash';
44
44
  import { str2Locale, locale2text } from '../components/locales.react';
45
45
  import { propTypes, defaultProps } from '../components/dataDisplay/AntdTable.react';
46
46
 
@@ -1112,7 +1112,7 @@ class AntdTable extends Component {
1112
1112
  columns[i]['render'] = (content, record) => {
1113
1113
  const currentDataIndex = columns[i]['dataIndex']
1114
1114
  return (
1115
- <Checkbox defaultChecked={content.checked}
1115
+ <Checkbox checked={content.checked}
1116
1116
  disabled={content.disabled}
1117
1117
  onChange={(e) => {
1118
1118
  // 修改对应行对应字段item.checked值
@@ -1150,7 +1150,7 @@ class AntdTable extends Component {
1150
1150
  columns[i]['render'] = (content, record) => {
1151
1151
  const currentDataIndex = columns[i]['dataIndex']
1152
1152
  return (
1153
- <Switch defaultChecked={content.checked}
1153
+ <Switch checked={content.checked}
1154
1154
  disabled={content.disabled}
1155
1155
  checkedChildren={content.checkedChildren}
1156
1156
  unCheckedChildren={content.unCheckedChildren}
@@ -325,7 +325,9 @@ const AntdUpload = (props) => {
325
325
  ...style
326
326
  }}
327
327
  key={key}>
328
- <Upload {...uploadProps}
328
+ <Upload
329
+ {...uploadProps}
330
+ className={buttonProps?.block ? 'ant-upload-button-block' : undefined}
329
331
  fileList={fileList}
330
332
  multiple={multiple}
331
333
  showUploadList={showUploadList}
@@ -385,254 +387,6 @@ const AntdUpload = (props) => {
385
387
  );
386
388
  }
387
389
 
388
- // 定义参数或属性
389
- AntdUpload.propTypes = {
390
- // 组件id
391
- id: PropTypes.string,
392
-
393
- // css类名
394
- className: PropTypes.oneOfType([
395
- PropTypes.string,
396
- PropTypes.object
397
- ]),
398
-
399
- // 自定义css字典
400
- style: PropTypes.object,
401
-
402
- // 辅助刷新用唯一标识key值
403
- key: PropTypes.string,
404
-
405
- // 设置语言环境,可选的有'zh-cn'、'en-us'
406
- locale: PropTypes.oneOf(['zh-cn', 'en-us']),
407
-
408
- // 设置文件上传服务的接口url
409
- apiUrl: PropTypes.string,
410
-
411
- // 设置文件上传服务额外的headers信息
412
- headers: PropTypes.object,
413
-
414
- // 可选,用于设置已上传完成文件的下载接口,get接口,具有参数taskId、filename
415
- downloadUrl: PropTypes.string,
416
-
417
- // 设置已上传文件列表的最大显示长度,默认为3
418
- fileListMaxLength: PropTypes.number,
419
-
420
- // 设置允许上传的文件后缀名数组
421
- fileTypes: PropTypes.arrayOf(PropTypes.string),
422
-
423
- // 按钮模式下设置按钮内的文字内容
424
- buttonContent: PropTypes.node,
425
-
426
- // 配置上传按钮常用参数
427
- buttonProps: PropTypes.exact({
428
- // 设置按钮尺寸规格,可选的有'default'/'small'/'large'
429
- size: PropTypes.oneOf(['default', 'small', 'large']),
430
-
431
- // 设置按钮整体风格(可选项有primary、ghost、dashed、link、text、default)
432
- type: PropTypes.oneOf(['primary', 'ghost', 'dashed', 'link', 'text', 'default']),
433
-
434
- // 设置按钮是否显示为危险状态
435
- danger: PropTypes.bool,
436
-
437
- // 设置按钮的css样式
438
- style: PropTypes.object,
439
-
440
- // 设置按钮的css类名
441
- className: PropTypes.string
442
- }),
443
-
444
- // 设置当前组件生命周期内的上传路径id信息,若未传入则会自动生成uuid
445
- uploadId: PropTypes.string,
446
-
447
- // 设置 文件上传尺寸上限,单位:兆
448
- fileMaxSize: PropTypes.number,
449
-
450
- // 设置是否开启多文件上传模式,默认为false
451
- multiple: PropTypes.bool,
452
-
453
- // 设置是否开启文件夹上传模式,默认为false
454
- directory: PropTypes.bool,
455
-
456
- // 自定义上传失败文件鼠标悬浮tooltip文字内容,默认为'上传失败'
457
- failedTooltipInfo: PropTypes.string,
458
-
459
- // 设置是否显示已上传文件列表,默认为true
460
- showUploadList: PropTypes.bool,
461
-
462
- // 设置是否为删除操作添加二次确认模态框,默认为false
463
- confirmBeforeDelete: PropTypes.bool,
464
-
465
- // 用于设置是否启用进度百分比显示,配合progressProps.format实现更多配置功能
466
- // 默认为false
467
- showPercent: PropTypes.bool,
468
-
469
- // 用于配置进度条相关参数
470
- progressProps: PropTypes.exact({
471
- // 设置进度条的颜色,与css接受的颜色值格式相同
472
- strokeColor: PropTypes.oneOfType([
473
- PropTypes.string,
474
- // 配置渐变色
475
- PropTypes.exact({
476
- // 配置开始颜色
477
- from: PropTypes.string,
478
-
479
- // 配置结束颜色
480
- to: PropTypes.string
481
- })
482
- ]),
483
-
484
- // 配置进度条线像素宽度
485
- strokeWidth: PropTypes.number,
486
-
487
- // 自定义提示格式
488
- format: PropTypes.exact({
489
- // 设置前缀文字,默认为''
490
- prefix: PropTypes.string,
491
-
492
- // 设置后缀文字,默认为'%'
493
- suffix: PropTypes.string
494
- })
495
- }),
496
-
497
- // 设置是否在每次文件上传成功后,弹出提示消息,默认为true
498
- showSuccessMessage: PropTypes.bool,
499
-
500
- // 设置是否在每次文件上传失败后,弹出提示消息,默认为true
501
- showErrorMessage: PropTypes.bool,
502
-
503
- // 用于在每次文件上传动作完成后,记录相关的信息
504
- lastUploadTaskRecord: PropTypes.oneOfType([
505
- // 单文件
506
- PropTypes.exact({
507
- // 记录文件名称
508
- fileName: PropTypes.string,
509
-
510
- // 记录文件大小
511
- fileSize: PropTypes.number,
512
-
513
- // 记录完成时间戳信息
514
- completeTimestamp: PropTypes.number,
515
-
516
- // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
517
- taskStatus: PropTypes.string,
518
-
519
- // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
520
- taskId: PropTypes.string
521
- }),
522
- // 文件夹或多文件上传
523
- PropTypes.arrayOf(
524
- PropTypes.exact({
525
- // 记录文件名称
526
- fileName: PropTypes.string,
527
-
528
- // 记录文件大小
529
- fileSize: PropTypes.number,
530
-
531
- // 记录完成时间戳信息
532
- completeTimestamp: PropTypes.number,
533
-
534
- // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
535
- taskStatus: PropTypes.string,
536
-
537
- // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
538
- taskId: PropTypes.string
539
- })
540
- )
541
- ]),
542
-
543
- // 用于在每次的上传任务完成后,更新当前文件列表中全部文件的上传信息
544
- listUploadTaskRecord: PropTypes.arrayOf(
545
- PropTypes.exact({
546
- // 记录文件名称
547
- fileName: PropTypes.string,
548
-
549
- // 记录文件大小
550
- fileSize: PropTypes.number,
551
-
552
- // 记录完成时间戳信息
553
- completeTimestamp: PropTypes.number,
554
-
555
- // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
556
- taskStatus: PropTypes.string,
557
-
558
- // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
559
- taskId: PropTypes.string,
560
-
561
- // 唯一标识当前任务的uuid信息,前端生成与后端无关
562
- uid: PropTypes.string,
563
-
564
- url: PropTypes.string
565
- })
566
- ),
567
-
568
- // 仅作初始化展示用,用于定义组件初始化时已存在在上传列表中的附件信息
569
- defaultFileList: PropTypes.arrayOf(
570
- PropTypes.exact({
571
- // 文件名称
572
- name: PropTypes.string,
573
-
574
- // 文件状态,可选的有'done'、'error'、'removed'
575
- status: PropTypes.oneOf(['done', 'error', 'removed']),
576
-
577
- // 唯一标识当前任务的uuid信息
578
- uid: PropTypes.any,
579
-
580
- // 可选,用于渲染当前文件的下载链接
581
- url: PropTypes.string,
582
-
583
- // 标识当前任务的taskId,若设置,则默认会被作为当前组件的uploadId使用
584
- taskId: PropTypes.string,
585
-
586
- // 可选,记录文件大小
587
- fileSize: PropTypes.number
588
- })
589
- ),
590
-
591
- // 设置是否禁用当前组件,默认为false
592
- disabled: PropTypes.bool,
593
-
594
- // 设置校验状态,可选的有'error'、'warning'
595
- status: PropTypes.oneOf(['error', 'warning']),
596
-
597
- loading_state: PropTypes.shape({
598
- /**
599
- * Determines if the component is loading or not
600
- */
601
- is_loading: PropTypes.bool,
602
- /**
603
- * Holds which property is loading
604
- */
605
- prop_name: PropTypes.string,
606
- /**
607
- * Holds the name of the component that is loading
608
- */
609
- component_name: PropTypes.string
610
- }),
611
-
612
- /**
613
- * Dash-assigned callback that should be called to report property changes
614
- * to Dash, to make them available for callbacks.
615
- */
616
- setProps: PropTypes.func
617
- };
618
-
619
- // 设置默认参数
620
- AntdUpload.defaultProps = {
621
- disabled: false,
622
- multiple: false,
623
- directory: false,
624
- showUploadList: true,
625
- fileListMaxLength: null,
626
- fileMaxSize: 500,
627
- confirmBeforeDelete: false,
628
- showPercent: false,
629
- showSuccessMessage: true,
630
- showErrorMessage: true,
631
- lastUploadTaskRecord: null,
632
- listUploadTaskRecord: [],
633
- locale: 'zh-cn'
634
- }
635
-
636
390
  export default AntdUpload;
637
391
 
638
392
  AntdUpload.defaultProps = defaultProps;
package/usage.py CHANGED
@@ -1,33 +1,65 @@
1
1
  import dash
2
- from dash import html, dcc
3
2
  import feffery_antd_components as fac
4
- from dash.dependencies import Input, Output, State
3
+ from dash.dependencies import Input, Output
5
4
 
6
- app = dash.Dash(__name__)
5
+ app = dash.Dash(__name__, compress=True)
7
6
 
8
- app.layout = html.Div(
7
+ app.layout = dash.html.Div(
9
8
  [
10
- dcc.Store(id='clicked-row-key'),
11
- fac.AntdTable(
12
- id='demo-table',
13
- columns=[
14
- {
15
- 'title': f'示例字段{i}',
16
- 'dataIndex': f'示例字段{i}'
17
- }
18
- for i in range(1, 9)
19
- ],
20
- data=[
21
- {
22
- f'示例字段{j}': i
23
- for j in range(1, 9)
24
- }
25
- for i in range(10)
9
+ fac.AntdSpace(
10
+ [
11
+ fac.AntdInput(
12
+ id='search-keyword',
13
+ placeholder='请输入搜索关键词',
14
+ style={
15
+ 'width': 250
16
+ }
17
+ ),
18
+ fac.AntdTree(
19
+ id='demo-tree',
20
+ treeData=[
21
+ {
22
+ 'title': '四川省',
23
+ 'key': '四川省',
24
+ 'children': [
25
+ {
26
+ 'title': '成都市',
27
+ 'key': '成都市'
28
+ },
29
+ {
30
+ 'title': '广安市',
31
+ 'key': '广安市'
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ 'title': '重庆市',
37
+ 'key': '重庆市',
38
+ 'children': [
39
+ {
40
+ 'title': '渝中区',
41
+ 'key': '渝中区',
42
+ 'children': [
43
+ {
44
+ 'title': '解放碑街道',
45
+ 'key': '解放碑街道'
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ 'title': '渝北区',
51
+ 'key': '渝北区'
52
+ }
53
+ ]
54
+ }
55
+ ],
56
+ defaultExpandAll=True
57
+ )
26
58
  ],
27
- bordered=True,
28
- enableCellClickListenColumns=[
29
- f'示例字段{i}' for i in range(1, 9)
30
- ]
59
+ direction='vertical',
60
+ style={
61
+ 'width': '100%'
62
+ }
31
63
  )
32
64
  ],
33
65
  style={
@@ -37,73 +69,12 @@ app.layout = html.Div(
37
69
 
38
70
 
39
71
  @app.callback(
40
- [Output('clicked-row-key', 'data'),
41
- Output('demo-table', 'conditionalStyleFuncs')],
42
- Input('demo-table', 'nClicksCell'),
43
- [State('demo-table', 'recentlyCellClickColumn'),
44
- State('demo-table', 'recentlyCellClickRecord'),
45
- State('clicked-row-key', 'data')],
46
- prevent_initial_call=True
72
+ Output('demo-tree', 'searchKeyword'),
73
+ Input('search-keyword', 'value')
47
74
  )
48
- def highlight_clicked_cell(nClicksCell,
49
- recentlyCellClickColumn,
50
- recentlyCellClickRecord,
51
- clicked_row_key):
52
-
53
- if clicked_row_key:
54
- # 若为同一单元格反复点击
55
- if (
56
- clicked_row_key['key'] == recentlyCellClickRecord['key'] and
57
- clicked_row_key['column'] == recentlyCellClickColumn
58
- ):
59
- return [
60
- None,
61
- {}
62
- ]
63
-
64
- return [
65
- {
66
- 'key': recentlyCellClickRecord['key'],
67
- 'column': recentlyCellClickColumn
68
- },
69
- {
70
- recentlyCellClickColumn: '''
71
- (record, index) => {
72
- if ( record.key === "%s" ) {
73
- return {
74
- style: {
75
- backgroundColor: "#e6f7ff",
76
- border: "1px solid #1890ff",
77
- boxSizing: "content-box"
78
- }
79
- }
80
- }
81
- }
82
- ''' % recentlyCellClickRecord['key']
83
- }
84
- ]
75
+ def filter_tree(keyword):
85
76
 
86
- return [
87
- {
88
- 'key': recentlyCellClickRecord['key'],
89
- 'column': recentlyCellClickColumn
90
- },
91
- {
92
- recentlyCellClickColumn: '''
93
- (record, index) => {
94
- if ( record.key === "%s" ) {
95
- return {
96
- style: {
97
- backgroundColor: "#e6f7ff",
98
- border: "1px solid #1890ff",
99
- boxSizing: "content-box"
100
- }
101
- }
102
- }
103
- }
104
- ''' % recentlyCellClickRecord['key']
105
- }
106
- ]
77
+ return keyword
107
78
 
108
79
 
109
80
  if __name__ == '__main__':