feffery_antd_components 0.1.6 → 0.1.7

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 (109) hide show
  1. package/DESCRIPTION +1 -1
  2. package/Project.toml +1 -1
  3. package/README.md +2 -2
  4. package/build/lib/feffery_antd_components/AntdAffix.py +54 -0
  5. package/build/lib/feffery_antd_components/AntdAlert.py +58 -0
  6. package/build/lib/feffery_antd_components/AntdAnchor.py +60 -0
  7. package/build/lib/feffery_antd_components/AntdAvatar.py +79 -0
  8. package/build/lib/feffery_antd_components/AntdBackTop.py +52 -0
  9. package/build/lib/feffery_antd_components/AntdBadge.py +70 -0
  10. package/build/lib/feffery_antd_components/AntdBreadcrumb.py +74 -0
  11. package/build/lib/feffery_antd_components/AntdButton.py +68 -0
  12. package/build/lib/feffery_antd_components/AntdCalendar.py +75 -0
  13. package/build/lib/feffery_antd_components/AntdCard.py +86 -0
  14. package/build/lib/feffery_antd_components/AntdCardGrid.py +52 -0
  15. package/build/lib/feffery_antd_components/AntdCarousel.py +56 -0
  16. package/build/lib/feffery_antd_components/AntdCascader.py +93 -0
  17. package/build/lib/feffery_antd_components/AntdCheckbox.py +71 -0
  18. package/build/lib/feffery_antd_components/AntdCheckboxGroup.py +79 -0
  19. package/build/lib/feffery_antd_components/AntdCol.py +146 -0
  20. package/build/lib/feffery_antd_components/AntdCollapse.py +79 -0
  21. package/build/lib/feffery_antd_components/AntdComment.py +88 -0
  22. package/build/lib/feffery_antd_components/AntdContent.py +50 -0
  23. package/build/lib/feffery_antd_components/AntdCountdown.py +72 -0
  24. package/build/lib/feffery_antd_components/AntdDatePicker.py +95 -0
  25. package/build/lib/feffery_antd_components/AntdDateRangePicker.py +91 -0
  26. package/build/lib/feffery_antd_components/AntdDescriptionItem.py +58 -0
  27. package/build/lib/feffery_antd_components/AntdDescriptions.py +76 -0
  28. package/build/lib/feffery_antd_components/AntdDivider.py +62 -0
  29. package/build/lib/feffery_antd_components/AntdDraggerUpload.py +84 -0
  30. package/build/lib/feffery_antd_components/AntdDrawer.py +72 -0
  31. package/build/lib/feffery_antd_components/AntdDropdown.py +84 -0
  32. package/build/lib/feffery_antd_components/AntdEmpty.py +54 -0
  33. package/build/lib/feffery_antd_components/AntdFooter.py +50 -0
  34. package/build/lib/feffery_antd_components/AntdForm.py +72 -0
  35. package/build/lib/feffery_antd_components/AntdFormItem.py +84 -0
  36. package/build/lib/feffery_antd_components/AntdHeader.py +50 -0
  37. package/build/lib/feffery_antd_components/AntdIcon.py +48 -0
  38. package/build/lib/feffery_antd_components/AntdImage.py +62 -0
  39. package/build/lib/feffery_antd_components/AntdInput.py +101 -0
  40. package/build/lib/feffery_antd_components/AntdInputNumber.py +101 -0
  41. package/build/lib/feffery_antd_components/AntdLayout.py +50 -0
  42. package/build/lib/feffery_antd_components/AntdMentions.py +76 -0
  43. package/build/lib/feffery_antd_components/AntdMenu.py +81 -0
  44. package/build/lib/feffery_antd_components/AntdMessage.py +56 -0
  45. package/build/lib/feffery_antd_components/AntdModal.py +88 -0
  46. package/build/lib/feffery_antd_components/AntdNotification.py +60 -0
  47. package/build/lib/feffery_antd_components/AntdPageHeader.py +62 -0
  48. package/build/lib/feffery_antd_components/AntdPagination.py +95 -0
  49. package/build/lib/feffery_antd_components/AntdParagraph.py +70 -0
  50. package/build/lib/feffery_antd_components/AntdPasteImage.py +52 -0
  51. package/build/lib/feffery_antd_components/AntdPopconfirm.py +80 -0
  52. package/build/lib/feffery_antd_components/AntdPopover.py +74 -0
  53. package/build/lib/feffery_antd_components/AntdProgress.py +88 -0
  54. package/build/lib/feffery_antd_components/AntdRadio.py +54 -0
  55. package/build/lib/feffery_antd_components/AntdRadioGroup.py +89 -0
  56. package/build/lib/feffery_antd_components/AntdRate.py +60 -0
  57. package/build/lib/feffery_antd_components/AntdResult.py +52 -0
  58. package/build/lib/feffery_antd_components/AntdRibbon.py +54 -0
  59. package/build/lib/feffery_antd_components/AntdRow.py +72 -0
  60. package/build/lib/feffery_antd_components/AntdSelect.py +121 -0
  61. package/build/lib/feffery_antd_components/AntdSider.py +68 -0
  62. package/build/lib/feffery_antd_components/AntdSkeleton.py +86 -0
  63. package/build/lib/feffery_antd_components/AntdSlider.py +68 -0
  64. package/build/lib/feffery_antd_components/AntdSpace.py +60 -0
  65. package/build/lib/feffery_antd_components/AntdSpin.py +68 -0
  66. package/build/lib/feffery_antd_components/AntdStatistic.py +74 -0
  67. package/build/lib/feffery_antd_components/AntdSteps.py +72 -0
  68. package/build/lib/feffery_antd_components/AntdSwitch.py +75 -0
  69. package/build/lib/feffery_antd_components/AntdTabPane.py +66 -0
  70. package/build/lib/feffery_antd_components/AntdTable.py +264 -0
  71. package/build/lib/feffery_antd_components/AntdTabs.py +81 -0
  72. package/build/lib/feffery_antd_components/AntdTag.py +54 -0
  73. package/build/lib/feffery_antd_components/AntdTestLink.py +58 -0
  74. package/build/lib/feffery_antd_components/AntdText.py +72 -0
  75. package/build/lib/feffery_antd_components/AntdTimePicker.py +95 -0
  76. package/build/lib/feffery_antd_components/AntdTimeRangePicker.py +95 -0
  77. package/build/lib/feffery_antd_components/AntdTimeline.py +68 -0
  78. package/build/lib/feffery_antd_components/AntdTitle.py +74 -0
  79. package/build/lib/feffery_antd_components/AntdTooltip.py +64 -0
  80. package/build/lib/feffery_antd_components/AntdTransfer.py +99 -0
  81. package/build/lib/feffery_antd_components/AntdTree.py +103 -0
  82. package/build/lib/feffery_antd_components/AntdTreeSelect.py +107 -0
  83. package/build/lib/feffery_antd_components/AntdTypography.py +50 -0
  84. package/build/lib/feffery_antd_components/AntdUpload.py +92 -0
  85. package/build/lib/feffery_antd_components/AntdWatermark.py +64 -0
  86. package/build/lib/feffery_antd_components/Link.py +58 -0
  87. package/build/lib/feffery_antd_components/__init__.py +53 -0
  88. package/build/lib/feffery_antd_components/_imports_.py +161 -0
  89. package/build/lib/feffery_antd_components/feffery_antd_components.min.js +344 -0
  90. package/build/lib/feffery_antd_components/metadata.json +15596 -0
  91. package/build/lib/feffery_antd_components/package-info.json +81 -0
  92. package/feffery_antd_components/AntdDraggerUpload.py +6 -4
  93. package/feffery_antd_components/AntdImage.py +2 -2
  94. package/feffery_antd_components/AntdTable.py +8 -2
  95. package/feffery_antd_components/AntdUpload.py +16 -4
  96. package/feffery_antd_components/feffery_antd_components.min.js +13 -13
  97. package/feffery_antd_components/metadata.json +117 -25
  98. package/feffery_antd_components/package-info.json +1 -1
  99. package/package.json +1 -1
  100. package/src/FefferyAntdComponents.jl +3 -3
  101. package/src/jl/'feffery'_antddraggerupload.jl +2 -1
  102. package/src/jl/'feffery'_antdimage.jl +2 -2
  103. package/src/jl/'feffery'_antdtable.jl +6 -2
  104. package/src/jl/'feffery'_antdupload.jl +9 -2
  105. package/src/lib/components/AntdDraggerUpload.react.js +41 -11
  106. package/src/lib/components/AntdImage.react.js +8 -2
  107. package/src/lib/components/AntdTable.react.js +32 -2
  108. package/src/lib/components/AntdUpload.react.js +78 -24
  109. package/usage.py +63 -1203
@@ -3546,7 +3546,7 @@
3546
3546
  "required": false,
3547
3547
  "description": "",
3548
3548
  "defaultValue": {
3549
- "value": "3",
3549
+ "value": "null",
3550
3550
  "computed": false
3551
3551
  }
3552
3552
  },
@@ -3599,6 +3599,13 @@
3599
3599
  "required": false,
3600
3600
  "description": ""
3601
3601
  },
3602
+ "showUploadList": {
3603
+ "type": {
3604
+ "name": "bool"
3605
+ },
3606
+ "required": false,
3607
+ "description": ""
3608
+ },
3602
3609
  "lastUploadTaskRecord": {
3603
3610
  "type": {
3604
3611
  "name": "exact",
@@ -4281,14 +4288,30 @@
4281
4288
  },
4282
4289
  "width": {
4283
4290
  "type": {
4284
- "name": "number"
4291
+ "name": "union",
4292
+ "value": [
4293
+ {
4294
+ "name": "number"
4295
+ },
4296
+ {
4297
+ "name": "string"
4298
+ }
4299
+ ]
4285
4300
  },
4286
4301
  "required": false,
4287
4302
  "description": ""
4288
4303
  },
4289
4304
  "height": {
4290
4305
  "type": {
4291
- "name": "number"
4306
+ "name": "union",
4307
+ "value": [
4308
+ {
4309
+ "name": "number"
4310
+ },
4311
+ {
4312
+ "name": "string"
4313
+ }
4314
+ ]
4292
4315
  },
4293
4316
  "required": false,
4294
4317
  "description": ""
@@ -9727,6 +9750,10 @@
9727
9750
  {
9728
9751
  "value": "'status-badge'",
9729
9752
  "computed": false
9753
+ },
9754
+ {
9755
+ "value": "'image'",
9756
+ "computed": false
9730
9757
  }
9731
9758
  ],
9732
9759
  "required": false
@@ -10252,6 +10279,31 @@
10252
10279
  "required": false
10253
10280
  }
10254
10281
  }
10282
+ },
10283
+ {
10284
+ "name": "exact",
10285
+ "value": {
10286
+ "src": {
10287
+ "name": "string",
10288
+ "required": false
10289
+ },
10290
+ "height": {
10291
+ "name": "union",
10292
+ "value": [
10293
+ {
10294
+ "name": "string"
10295
+ },
10296
+ {
10297
+ "name": "number"
10298
+ }
10299
+ ],
10300
+ "required": false
10301
+ },
10302
+ "preview": {
10303
+ "name": "bool",
10304
+ "required": false
10305
+ }
10306
+ }
10255
10307
  }
10256
10308
  ]
10257
10309
  }
@@ -12618,7 +12670,7 @@
12618
12670
  "required": false,
12619
12671
  "description": "",
12620
12672
  "defaultValue": {
12621
- "value": "3",
12673
+ "value": "null",
12622
12674
  "computed": false
12623
12675
  }
12624
12676
  },
@@ -12678,31 +12730,71 @@
12678
12730
  "required": false,
12679
12731
  "description": ""
12680
12732
  },
12733
+ "showUploadList": {
12734
+ "type": {
12735
+ "name": "bool"
12736
+ },
12737
+ "required": false,
12738
+ "description": ""
12739
+ },
12681
12740
  "lastUploadTaskRecord": {
12682
12741
  "type": {
12683
- "name": "exact",
12684
- "value": {
12685
- "fileName": {
12686
- "name": "string",
12687
- "required": false
12688
- },
12689
- "fileSize": {
12690
- "name": "number",
12691
- "required": false
12692
- },
12693
- "completeTimestamp": {
12694
- "name": "number",
12695
- "required": false
12696
- },
12697
- "taskStatus": {
12698
- "name": "string",
12699
- "required": false
12742
+ "name": "union",
12743
+ "value": [
12744
+ {
12745
+ "name": "exact",
12746
+ "value": {
12747
+ "fileName": {
12748
+ "name": "string",
12749
+ "required": false
12750
+ },
12751
+ "fileSize": {
12752
+ "name": "number",
12753
+ "required": false
12754
+ },
12755
+ "completeTimestamp": {
12756
+ "name": "number",
12757
+ "required": false
12758
+ },
12759
+ "taskStatus": {
12760
+ "name": "string",
12761
+ "required": false
12762
+ },
12763
+ "taskId": {
12764
+ "name": "string",
12765
+ "required": false
12766
+ }
12767
+ }
12700
12768
  },
12701
- "taskId": {
12702
- "name": "string",
12703
- "required": false
12769
+ {
12770
+ "name": "arrayOf",
12771
+ "value": {
12772
+ "name": "exact",
12773
+ "value": {
12774
+ "fileName": {
12775
+ "name": "string",
12776
+ "required": false
12777
+ },
12778
+ "fileSize": {
12779
+ "name": "number",
12780
+ "required": false
12781
+ },
12782
+ "completeTimestamp": {
12783
+ "name": "number",
12784
+ "required": false
12785
+ },
12786
+ "taskStatus": {
12787
+ "name": "string",
12788
+ "required": false
12789
+ },
12790
+ "taskId": {
12791
+ "name": "string",
12792
+ "required": false
12793
+ }
12794
+ }
12795
+ }
12704
12796
  }
12705
- }
12797
+ ]
12706
12798
  },
12707
12799
  "required": false,
12708
12800
  "description": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_antd_components",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Best implementation of Antd components in Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_antd_components",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Best implementation of Antd components in Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -3,7 +3,7 @@ module FefferyAntdComponents
3
3
  using Dash
4
4
 
5
5
  const resources_path = realpath(joinpath( @__DIR__, "..", "deps"))
6
- const version = "0.1.6"
6
+ const version = "0.1.7"
7
7
 
8
8
  include("jl/'feffery'_antdaffix.jl")
9
9
  include("jl/'feffery'_antdalert.jl")
@@ -94,14 +94,14 @@ function __init__()
94
94
  [
95
95
  DashBase.Resource(
96
96
  relative_package_path = "feffery_antd_components.min.js",
97
- external_url = "https://unpkg.com/feffery_antd_components@0.1.6/feffery_antd_components/feffery_antd_components.min.js",
97
+ external_url = "https://unpkg.com/feffery_antd_components@0.1.7/feffery_antd_components/feffery_antd_components.min.js",
98
98
  dynamic = nothing,
99
99
  async = nothing,
100
100
  type = :js
101
101
  ),
102
102
  DashBase.Resource(
103
103
  relative_package_path = "feffery_antd_components.min.js.map",
104
- external_url = "https://unpkg.com/feffery_antd_components@0.1.6/feffery_antd_components/feffery_antd_components.min.js.map",
104
+ external_url = "https://unpkg.com/feffery_antd_components@0.1.7/feffery_antd_components/feffery_antd_components.min.js.map",
105
105
  dynamic = true,
106
106
  async = nothing,
107
107
  type = :js
@@ -31,12 +31,13 @@ Those elements have the following types:
31
31
  - `component_name` (String; optional): Holds the name of the component that is loading
32
32
  - `locale` (a value equal to: 'zh-cn', 'en-us'; optional)
33
33
  - `multiple` (Bool; optional)
34
+ - `showUploadList` (Bool; optional)
34
35
  - `style` (Dict; optional)
35
36
  - `text` (String; optional)
36
37
  - `uploadId` (String; optional)
37
38
  """
38
39
  function 'feffery'_antddraggerupload(; kwargs...)
39
- available_props = Symbol[:id, :apiUrl, :className, :directory, :failedTooltipInfo, :fileListMaxLength, :fileMaxSize, :fileTypes, :hint, :lastUploadTaskRecord, :loading_state, :locale, :multiple, :style, :text, :uploadId]
40
+ available_props = Symbol[:id, :apiUrl, :className, :directory, :failedTooltipInfo, :fileListMaxLength, :fileMaxSize, :fileTypes, :hint, :lastUploadTaskRecord, :loading_state, :locale, :multiple, :showUploadList, :style, :text, :uploadId]
40
41
  wild_props = Symbol[]
41
42
  return Component("'feffery'_antddraggerupload", "AntdDraggerUpload", "feffery_antd_components", available_props, wild_props; kwargs...)
42
43
  end
@@ -12,7 +12,7 @@ Keyword arguments:
12
12
  - `alt` (String; optional)
13
13
  - `className` (String; optional)
14
14
  - `fallback` (String; optional)
15
- - `height` (Real; optional)
15
+ - `height` (Real | String; optional)
16
16
  - `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
17
17
  Those elements have the following types:
18
18
  - `is_loading` (Bool; optional): Determines if the component is loading or not
@@ -23,7 +23,7 @@ Those elements have the following types:
23
23
  - `preview` (Bool; optional)
24
24
  - `src` (String | Array of Strings; optional)
25
25
  - `style` (Dict; optional)
26
- - `width` (Real; optional)
26
+ - `width` (Real | String; optional)
27
27
  """
28
28
  function 'feffery'_antdimage(; kwargs...)
29
29
  available_props = Symbol[:id, :alt, :className, :fallback, :height, :loading_state, :locale, :multiImageMode, :preview, :src, :style, :width]
@@ -18,7 +18,7 @@ Those elements have the following types:
18
18
  - `dataIndex` (String; required)
19
19
  - `renderOptions` (optional): . renderOptions has the following type: lists containing elements 'renderType', 'renderLinkText', 'renderButtonPopConfirmProps'.
20
20
  Those elements have the following types:
21
- - `renderType` (a value equal to: 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress', 'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable', 'status-badge'; optional)
21
+ - `renderType` (a value equal to: 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress', 'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable', 'status-badge', 'image'; optional)
22
22
  - `renderLinkText` (String; optional)
23
23
  - `renderButtonPopConfirmProps` (optional): . renderButtonPopConfirmProps has the following type: lists containing elements 'title', 'okText', 'cancelText'.
24
24
  Those elements have the following types:
@@ -63,7 +63,11 @@ Those elements have the following types:
63
63
  - `content` (String | Real; optional)s | lists containing elements 'status', 'text'.
64
64
  Those elements have the following types:
65
65
  - `status` (a value equal to: 'success', 'processing', 'default', 'error', 'warning'; optional)
66
- - `text` (String | Real; optional)s
66
+ - `text` (String | Real; optional) | lists containing elements 'src', 'height', 'preview'.
67
+ Those elements have the following types:
68
+ - `src` (String; optional)
69
+ - `height` (String | Real; optional)
70
+ - `preview` (Bool; optional)s
67
71
  - `enableHoverListen` (Bool; optional)
68
72
  - `filter` (Dict; optional)
69
73
  - `filterOptions` (Dict; optional)
@@ -23,7 +23,13 @@ Those elements have the following types:
23
23
  - `fileSize` (Real; optional)
24
24
  - `completeTimestamp` (Real; optional)
25
25
  - `taskStatus` (String; optional)
26
- - `taskId` (String; optional)
26
+ - `taskId` (String; optional) | Array of lists containing elements 'fileName', 'fileSize', 'completeTimestamp', 'taskStatus', 'taskId'.
27
+ Those elements have the following types:
28
+ - `fileName` (String; optional)
29
+ - `fileSize` (Real; optional)
30
+ - `completeTimestamp` (Real; optional)
31
+ - `taskStatus` (String; optional)
32
+ - `taskId` (String; optional)s
27
33
  - `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
28
34
  Those elements have the following types:
29
35
  - `is_loading` (Bool; optional): Determines if the component is loading or not
@@ -31,11 +37,12 @@ Those elements have the following types:
31
37
  - `component_name` (String; optional): Holds the name of the component that is loading
32
38
  - `locale` (a value equal to: 'zh-cn', 'en-us'; optional)
33
39
  - `multiple` (Bool; optional)
40
+ - `showUploadList` (Bool; optional)
34
41
  - `style` (Dict; optional)
35
42
  - `uploadId` (String; optional)
36
43
  """
37
44
  function 'feffery'_antdupload(; kwargs...)
38
- available_props = Symbol[:id, :apiUrl, :buttonContent, :className, :directory, :failedTooltipInfo, :fileListMaxLength, :fileMaxSize, :fileTypes, :lastUploadTaskRecord, :loading_state, :locale, :multiple, :style, :uploadId]
45
+ available_props = Symbol[:id, :apiUrl, :buttonContent, :className, :directory, :failedTooltipInfo, :fileListMaxLength, :fileMaxSize, :fileTypes, :lastUploadTaskRecord, :loading_state, :locale, :multiple, :showUploadList, :style, :uploadId]
39
46
  wild_props = Symbol[]
40
47
  return Component("'feffery'_antdupload", "AntdUpload", "feffery_antd_components", available_props, wild_props; kwargs...)
41
48
  end
@@ -26,6 +26,7 @@ const AntdDraggerUpload = (props) => {
26
26
  fileListMaxLength,
27
27
  fileTypes,
28
28
  fileMaxSize,
29
+ showUploadList,
29
30
  multiple,
30
31
  directory,
31
32
  failedTooltipInfo,
@@ -65,16 +66,38 @@ const AntdDraggerUpload = (props) => {
65
66
 
66
67
  if (info.file.status === 'done') {
67
68
 
68
- // 更新任务记录
69
- setProps({
70
- lastUploadTaskRecord: {
71
- fileName: info.file.name,
72
- fileSize: info.file.size,
73
- completeTimestamp: new Date().getTime(),
74
- taskStatus: 'success',
75
- taskId: uploadId
69
+ // 检查是否为多文件上传模式
70
+ if (multiple || directory) {
71
+ // 检查上传列表中是否全部文件都已完成上传
72
+ if (info.fileList.every(file => file.status === 'done')) {
73
+ console.log(info.fileList)
74
+ // 更新任务记录
75
+ setProps({
76
+ lastUploadTaskRecord: info.fileList.map(
77
+ (file) => {
78
+ return {
79
+ fileName: file.name,
80
+ fileSize: file.size,
81
+ completeTimestamp: new Date().getTime(),
82
+ taskStatus: 'success',
83
+ taskId: uploadId
84
+ }
85
+ }
86
+ )
87
+ })
76
88
  }
77
- })
89
+ } else {
90
+ // 更新任务记录
91
+ setProps({
92
+ lastUploadTaskRecord: {
93
+ fileName: info.file.name,
94
+ fileSize: info.file.size,
95
+ completeTimestamp: new Date().getTime(),
96
+ taskStatus: 'success',
97
+ taskId: uploadId
98
+ }
99
+ })
100
+ }
78
101
  message.success(`${info.file.name} 上传成功!`);
79
102
  } else if (info.file.status === 'error') {
80
103
 
@@ -106,7 +129,11 @@ const AntdDraggerUpload = (props) => {
106
129
  )
107
130
 
108
131
  // 基于fileListMaxLength参数设置,对fileList状态进行更新
109
- updateFileList(info.fileList.slice(-fileListMaxLength))
132
+ if (fileListMaxLength) {
133
+ updateFileList(info.fileList.slice(-fileListMaxLength))
134
+ } else {
135
+ updateFileList(info.fileList)
136
+ }
110
137
  },
111
138
  };
112
139
 
@@ -187,6 +214,9 @@ AntdDraggerUpload.propTypes = {
187
214
  // 自定义上传失败文件鼠标悬浮tooltip文字内容,默认为'上传失败'
188
215
  failedTooltipInfo: PropTypes.string,
189
216
 
217
+ // 设置是否显示已上传文件列表,默认为true
218
+ showUploadList: PropTypes.bool,
219
+
190
220
  // 用于在每次文件上传动作完成后,记录相关的信息
191
221
  lastUploadTaskRecord: PropTypes.exact({
192
222
  // 记录文件名称
@@ -230,7 +260,7 @@ AntdDraggerUpload.propTypes = {
230
260
 
231
261
  // 设置默认参数
232
262
  AntdDraggerUpload.defaultProps = {
233
- fileListMaxLength: 3,
263
+ fileListMaxLength: null,
234
264
  fileMaxSize: 500,
235
265
  lastUploadTaskRecord: {},
236
266
  locale: 'zh-cn'
@@ -96,10 +96,16 @@ AntdImage.propTypes = {
96
96
  alt: PropTypes.string,
97
97
 
98
98
  // 设置像素宽度
99
- width: PropTypes.number,
99
+ width: PropTypes.oneOfType([
100
+ PropTypes.number,
101
+ PropTypes.string
102
+ ]),
100
103
 
101
104
  // 设置图像高度
102
- height: PropTypes.number,
105
+ height: PropTypes.oneOfType([
106
+ PropTypes.number,
107
+ PropTypes.string
108
+ ]),
103
109
 
104
110
  // 设置图片源地址,单个字符串传入时为单图片模式
105
111
  // 多个字符串数组传入时为多图片切换模式
@@ -1,6 +1,6 @@
1
1
  import React, { Component, useContext, useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Table, Tooltip, Popover, Popconfirm, ConfigProvider, Typography, Input, Form, Tag, Button, Badge, Space, message } from 'antd';
3
+ import { Table, Tooltip, Popover, Popconfirm, ConfigProvider, Typography, Input, Form, Tag, Button, Badge, Space, Image, message } from 'antd';
4
4
  import { TinyLine, TinyArea, TinyColumn, Progress, RingProgress } from '@ant-design/charts';
5
5
  import Highlighter from 'react-highlight-words';
6
6
  import { SearchOutlined, QuestionCircleOutlined } from '@ant-design/icons';
@@ -607,6 +607,21 @@ export default class AntdTable extends Component {
607
607
  }
608
608
  }
609
609
 
610
+ // 配置字段渲染模式为image的相关参数
611
+ for (let i = 0; i < columns.length; i++) {
612
+ // 当前字段具有renderOptions参数时且renderOptions参数是字典时
613
+ if (columns[i]['renderOptions']) {
614
+ if (columns[i]['renderOptions'].hasOwnProperty('renderType')) {
615
+ // 当renderOptions参数的renderType值设置为image时
616
+ if (columns[i]['renderOptions']['renderType'] == 'image') {
617
+ columns[i]['render'] = content => (
618
+ <Image src={content.src} height={content.height} preview={content.preview} />
619
+ )
620
+ }
621
+ }
622
+ }
623
+ }
624
+
610
625
  // 配置字段渲染模式为button的相关参数
611
626
  for (let i = 0; i < columns.length; i++) {
612
627
  // 当前字段具有renderOptions参数时且renderOptions参数是字典时
@@ -961,7 +976,7 @@ AntdTable.propTypes = {
961
976
  renderType: PropTypes.oneOf([
962
977
  'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress',
963
978
  'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable',
964
- 'status-badge'
979
+ 'status-badge', 'image'
965
980
  ]),
966
981
 
967
982
  // 当renderType='link'时,此参数会将传入的字符串作为渲染link的显示文字内容
@@ -1164,6 +1179,21 @@ AntdTable.propTypes = {
1164
1179
  PropTypes.string,
1165
1180
  PropTypes.number
1166
1181
  ])
1182
+ }),
1183
+
1184
+ // image模式
1185
+ PropTypes.exact({
1186
+ // 设置图片的src属性
1187
+ src: PropTypes.string,
1188
+
1189
+ // 设置图片的高度
1190
+ height: PropTypes.oneOfType([
1191
+ PropTypes.string,
1192
+ PropTypes.number
1193
+ ]),
1194
+
1195
+ // 设置是否允许预览,默认为true
1196
+ preview: PropTypes.bool
1167
1197
  })
1168
1198
  ])
1169
1199
  )
@@ -23,6 +23,7 @@ const AntdUpload = (props) => {
23
23
  buttonContent,
24
24
  fileTypes,
25
25
  fileMaxSize,
26
+ showUploadList,
26
27
  multiple,
27
28
  directory,
28
29
  failedTooltipInfo,
@@ -59,20 +60,42 @@ const AntdUpload = (props) => {
59
60
  return sizeCheck;
60
61
  },
61
62
  onChange(info) {
62
- console.log(info)
63
63
 
64
64
  if (info.file.status === 'done') {
65
65
 
66
- // 更新任务记录
67
- setProps({
68
- lastUploadTaskRecord: {
69
- fileName: info.file.name,
70
- fileSize: info.file.size,
71
- completeTimestamp: new Date().getTime(),
72
- taskStatus: 'success',
73
- taskId: uploadId
66
+ // 检查是否为多文件上传模式
67
+ if (multiple || directory) {
68
+ // 检查上传列表中是否全部文件都已完成上传
69
+ if (info.fileList.every(file => file.status === 'done')) {
70
+ console.log(info.fileList)
71
+ // 更新任务记录
72
+ setProps({
73
+ lastUploadTaskRecord: info.fileList.map(
74
+ (file) => {
75
+ return {
76
+ fileName: file.name,
77
+ fileSize: file.size,
78
+ completeTimestamp: new Date().getTime(),
79
+ taskStatus: 'success',
80
+ taskId: uploadId
81
+ }
82
+ }
83
+ )
84
+ })
74
85
  }
75
- })
86
+ } else {
87
+ // 更新任务记录
88
+ setProps({
89
+ lastUploadTaskRecord: {
90
+ fileName: info.file.name,
91
+ fileSize: info.file.size,
92
+ completeTimestamp: new Date().getTime(),
93
+ taskStatus: 'success',
94
+ taskId: uploadId
95
+ }
96
+ })
97
+ }
98
+
76
99
  message.success(`${info.file.name} 上传成功!`);
77
100
  } else if (info.file.status === 'error') {
78
101
 
@@ -104,7 +127,11 @@ const AntdUpload = (props) => {
104
127
  )
105
128
 
106
129
  // 基于fileListMaxLength参数设置,对fileList状态进行更新
107
- updateFileList(info.fileList.slice(-fileListMaxLength))
130
+ if (fileListMaxLength) {
131
+ updateFileList(info.fileList.slice(-fileListMaxLength))
132
+ } else {
133
+ updateFileList(info.fileList)
134
+ }
108
135
  },
109
136
  };
110
137
 
@@ -123,6 +150,7 @@ const AntdUpload = (props) => {
123
150
  style={style}
124
151
  fileList={fileList}
125
152
  multiple={multiple}
153
+ showUploadList={showUploadList}
126
154
  directory={directory}
127
155
  data-dash-is-loading={
128
156
  (loading_state && loading_state.is_loading) || undefined
@@ -175,24 +203,50 @@ AntdUpload.propTypes = {
175
203
  // 自定义上传失败文件鼠标悬浮tooltip文字内容,默认为'上传失败'
176
204
  failedTooltipInfo: PropTypes.string,
177
205
 
206
+ // 设置是否显示已上传文件列表,默认为true
207
+ showUploadList: PropTypes.bool,
208
+
178
209
  // 用于在每次文件上传动作完成后,记录相关的信息
179
- lastUploadTaskRecord: PropTypes.exact({
180
- // 记录文件名称
181
- fileName: PropTypes.string,
210
+ lastUploadTaskRecord: PropTypes.oneOfType([
211
+ // 单文件
212
+ PropTypes.exact({
213
+ // 记录文件名称
214
+ fileName: PropTypes.string,
182
215
 
183
- // 记录文件大小
184
- fileSize: PropTypes.number,
216
+ // 记录文件大小
217
+ fileSize: PropTypes.number,
185
218
 
186
- // 记录完成时间戳信息
187
- completeTimestamp: PropTypes.number,
219
+ // 记录完成时间戳信息
220
+ completeTimestamp: PropTypes.number,
188
221
 
189
- // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
190
- taskStatus: PropTypes.string,
222
+ // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
223
+ taskStatus: PropTypes.string,
191
224
 
192
- // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
193
- taskId: PropTypes.string
225
+ // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
226
+ taskId: PropTypes.string
194
227
 
195
- }),
228
+ }),
229
+ // 文件夹或多文件上传
230
+ PropTypes.arrayOf(
231
+ PropTypes.exact({
232
+ // 记录文件名称
233
+ fileName: PropTypes.string,
234
+
235
+ // 记录文件大小
236
+ fileSize: PropTypes.number,
237
+
238
+ // 记录完成时间戳信息
239
+ completeTimestamp: PropTypes.number,
240
+
241
+ // 记录此次上传任务的状态信息,'success'表示成功,'failed'表示失败
242
+ taskStatus: PropTypes.string,
243
+
244
+ // 记录本次任务的id信息,若最近一次任务状态为'failed',则不会携带此信息
245
+ taskId: PropTypes.string
246
+
247
+ })
248
+ )
249
+ ]),
196
250
 
197
251
  loading_state: PropTypes.shape({
198
252
  /**
@@ -218,7 +272,7 @@ AntdUpload.propTypes = {
218
272
 
219
273
  // 设置默认参数
220
274
  AntdUpload.defaultProps = {
221
- fileListMaxLength: 3,
275
+ fileListMaxLength: null,
222
276
  fileMaxSize: 500,
223
277
  lastUploadTaskRecord: {},
224
278
  locale: 'zh-cn'