feffery_antd_components 0.3.0-a0 → 0.3.0-a2

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 (33) hide show
  1. package/DESCRIPTION +1 -1
  2. package/NAMESPACE +1 -0
  3. package/Project.toml +1 -1
  4. package/build/lib/feffery_antd_components/AntdDropdown.py +12 -3
  5. package/build/lib/feffery_antd_components/AntdQRCode.py +88 -0
  6. package/build/lib/feffery_antd_components/_imports_.py +2 -0
  7. package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
  8. package/build/lib/feffery_antd_components/async-data_display.js +4 -4
  9. package/build/lib/feffery_antd_components/async-data_entry.js +25 -13
  10. package/build/lib/feffery_antd_components/async-upload.js +2 -2
  11. package/build/lib/feffery_antd_components/feffery_antd_components.min.js +34 -46
  12. package/build/lib/feffery_antd_components/metadata.json +292 -0
  13. package/build/lib/feffery_antd_components/package-info.json +1 -1
  14. package/feffery_antd_components/AntdDropdown.py +12 -3
  15. package/feffery_antd_components/AntdQRCode.py +88 -0
  16. package/feffery_antd_components/_imports_.py +2 -0
  17. package/feffery_antd_components/async-antd_table.js +1 -1
  18. package/feffery_antd_components/async-data_display.js +4 -4
  19. package/feffery_antd_components/async-data_entry.js +25 -13
  20. package/feffery_antd_components/async-upload.js +2 -2
  21. package/feffery_antd_components/feffery_antd_components.min.js +34 -46
  22. package/feffery_antd_components/metadata.json +292 -0
  23. package/feffery_antd_components/package-info.json +1 -1
  24. package/package.json +1 -1
  25. package/src/jl/'feffery'_antddropdown.jl +6 -1
  26. package/src/jl/'feffery'_antdqrcode.jl +49 -0
  27. package/src/lib/components/dataDisplay/AntdQRCode.react.js +148 -0
  28. package/src/lib/components/dataEntry/AntdColorPicker.react.js +10 -84
  29. package/src/lib/components/navigation/AntdDropdown.react.js +72 -55
  30. package/src/lib/fragments/dataDisplay/AntdQRCode.react.js +80 -0
  31. package/src/lib/fragments/dataEntry/AntdColorPicker.react.js +95 -0
  32. package/src/lib/index.js +3 -1
  33. package/usage.py +37 -14
@@ -2569,6 +2569,274 @@
2569
2569
  }
2570
2570
  }
2571
2571
  },
2572
+ "src/lib/components/dataDisplay/AntdQRCode.react.js": {
2573
+ "description": "",
2574
+ "displayName": "AntdQRCode",
2575
+ "methods": [],
2576
+ "props": {
2577
+ "id": {
2578
+ "type": {
2579
+ "name": "string"
2580
+ },
2581
+ "required": false,
2582
+ "description": ""
2583
+ },
2584
+ "className": {
2585
+ "type": {
2586
+ "name": "union",
2587
+ "value": [
2588
+ {
2589
+ "name": "string"
2590
+ },
2591
+ {
2592
+ "name": "object"
2593
+ }
2594
+ ]
2595
+ },
2596
+ "required": false,
2597
+ "description": ""
2598
+ },
2599
+ "style": {
2600
+ "type": {
2601
+ "name": "object"
2602
+ },
2603
+ "required": false,
2604
+ "description": ""
2605
+ },
2606
+ "key": {
2607
+ "type": {
2608
+ "name": "string"
2609
+ },
2610
+ "required": false,
2611
+ "description": ""
2612
+ },
2613
+ "locale": {
2614
+ "type": {
2615
+ "name": "enum",
2616
+ "value": [
2617
+ {
2618
+ "value": "'zh-cn'",
2619
+ "computed": false
2620
+ },
2621
+ {
2622
+ "value": "'en-us'",
2623
+ "computed": false
2624
+ }
2625
+ ]
2626
+ },
2627
+ "required": false,
2628
+ "description": "",
2629
+ "defaultValue": {
2630
+ "value": "'zh-cn'",
2631
+ "computed": false
2632
+ }
2633
+ },
2634
+ "value": {
2635
+ "type": {
2636
+ "name": "string"
2637
+ },
2638
+ "required": false,
2639
+ "description": "\u7528\u4e8e\u8bbe\u7f6e\u626b\u63cf\u540e\u7684\u6587\u672c"
2640
+ },
2641
+ "type": {
2642
+ "type": {
2643
+ "name": "enum",
2644
+ "value": [
2645
+ {
2646
+ "value": "'canvas'",
2647
+ "computed": false
2648
+ },
2649
+ {
2650
+ "value": "'svg'",
2651
+ "computed": false
2652
+ }
2653
+ ]
2654
+ },
2655
+ "required": false,
2656
+ "description": "\u8bbe\u7f6e\u6e32\u67d3\u7c7b\u578b\uff0c\u53ef\u9009\u7684\u6709'canvas'\u3001'primary'\r\n\u9ed8\u8ba4\uff1a'canvas'",
2657
+ "defaultValue": {
2658
+ "value": "'canvas'",
2659
+ "computed": false
2660
+ }
2661
+ },
2662
+ "icon": {
2663
+ "type": {
2664
+ "name": "string"
2665
+ },
2666
+ "required": false,
2667
+ "description": "\u7528\u4e8e\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u4e2d\u56fe\u7247\u7684\u5730\u5740\uff08\u76ee\u524d\u53ea\u652f\u6301\u56fe\u7247\u5730\u5740\uff09"
2668
+ },
2669
+ "size": {
2670
+ "type": {
2671
+ "name": "number"
2672
+ },
2673
+ "required": false,
2674
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u50cf\u7d20\u5c3a\u5bf8\r\n\u9ed8\u8ba4\uff1a160",
2675
+ "defaultValue": {
2676
+ "value": "160",
2677
+ "computed": false
2678
+ }
2679
+ },
2680
+ "iconSize": {
2681
+ "type": {
2682
+ "name": "number"
2683
+ },
2684
+ "required": false,
2685
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u4e2d\u56fe\u7247\u7684\u5927\u5c0f\r\n\u9ed8\u8ba4\uff1a40",
2686
+ "defaultValue": {
2687
+ "value": "40",
2688
+ "computed": false
2689
+ }
2690
+ },
2691
+ "color": {
2692
+ "type": {
2693
+ "name": "string"
2694
+ },
2695
+ "required": false,
2696
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u989c\u8272\r\n\u9ed8\u8ba4\uff1a'#000'",
2697
+ "defaultValue": {
2698
+ "value": "'#000'",
2699
+ "computed": false
2700
+ }
2701
+ },
2702
+ "bgColor": {
2703
+ "type": {
2704
+ "name": "string"
2705
+ },
2706
+ "required": false,
2707
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u80cc\u666f\u989c\u8272\r\n\u9ed8\u8ba4\uff1a'transparent'",
2708
+ "defaultValue": {
2709
+ "value": "'transparent'",
2710
+ "computed": false
2711
+ }
2712
+ },
2713
+ "bordered": {
2714
+ "type": {
2715
+ "name": "bool"
2716
+ },
2717
+ "required": false,
2718
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u662f\u5426\u6709\u8fb9\u6846\r\n\u9ed8\u8ba4\uff1atrue",
2719
+ "defaultValue": {
2720
+ "value": "true",
2721
+ "computed": false
2722
+ }
2723
+ },
2724
+ "errorLevel": {
2725
+ "type": {
2726
+ "name": "enum",
2727
+ "value": [
2728
+ {
2729
+ "value": "'L'",
2730
+ "computed": false
2731
+ },
2732
+ {
2733
+ "value": "'M'",
2734
+ "computed": false
2735
+ },
2736
+ {
2737
+ "value": "'Q'",
2738
+ "computed": false
2739
+ },
2740
+ {
2741
+ "value": "'H'",
2742
+ "computed": false
2743
+ }
2744
+ ]
2745
+ },
2746
+ "required": false,
2747
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u7ea0\u9519\u7b49\u7ea7\uff0c\u53ef\u9009\u7684\u6709'L'\u3001'M'\u3001'Q'\u3001'H'\r\n\u9ed8\u8ba4\uff1a'M'",
2748
+ "defaultValue": {
2749
+ "value": "'M'",
2750
+ "computed": false
2751
+ }
2752
+ },
2753
+ "status": {
2754
+ "type": {
2755
+ "name": "enum",
2756
+ "value": [
2757
+ {
2758
+ "value": "'active'",
2759
+ "computed": false
2760
+ },
2761
+ {
2762
+ "value": "'expired'",
2763
+ "computed": false
2764
+ },
2765
+ {
2766
+ "value": "'loading'",
2767
+ "computed": false
2768
+ }
2769
+ ]
2770
+ },
2771
+ "required": false,
2772
+ "description": "\u8bbe\u7f6e\u4e8c\u7ef4\u7801\u72b6\u6001\uff0c\u53ef\u9009\u7684\u6709'active'\u3001'expired'\u3001'loading'\r\n\u9ed8\u8ba4\uff1a'active'",
2773
+ "defaultValue": {
2774
+ "value": "'active'",
2775
+ "computed": false
2776
+ }
2777
+ },
2778
+ "expires": {
2779
+ "type": {
2780
+ "name": "number"
2781
+ },
2782
+ "required": false,
2783
+ "description": "\u8bbe\u7f6e\u5f53\u524d\u4e8c\u7ef4\u7801\u8fc7\u671f\u65f6\u95f4\uff0c\u5355\u4f4d\uff1a\u79d2\uff0c\u5230\u671f\u540e\u4e8c\u7ef4\u7801\u72b6\u6001\u5c06\u4f1a\u88ab\u5f3a\u5236\u66f4\u65b0\u4e3a'expired'"
2784
+ },
2785
+ "autoSpin": {
2786
+ "type": {
2787
+ "name": "bool"
2788
+ },
2789
+ "required": false,
2790
+ "description": "\u662f\u5426\u5728value\u5904\u4e8e\u56de\u8c03\u66f4\u65b0\u4e2d\u65f6\uff0c\u81ea\u52a8\u5207\u6362\u5230loading\u72b6\u6001\r\n\u9ed8\u8ba4\uff1afalse",
2791
+ "defaultValue": {
2792
+ "value": "false",
2793
+ "computed": false
2794
+ }
2795
+ },
2796
+ "refreshClicks": {
2797
+ "type": {
2798
+ "name": "number"
2799
+ },
2800
+ "required": false,
2801
+ "description": "\u76d1\u542c\u5f53\u524d\"\u70b9\u51fb\u5237\u65b0\"\u6309\u94ae\u7d2f\u8ba1\u70b9\u51fb\u6b21\u6570\uff0c\u4ec5\u5728status\u4e3a'expired'\u65f6\u6709\u610f\u4e49",
2802
+ "defaultValue": {
2803
+ "value": "0",
2804
+ "computed": false
2805
+ }
2806
+ },
2807
+ "loading_state": {
2808
+ "type": {
2809
+ "name": "shape",
2810
+ "value": {
2811
+ "is_loading": {
2812
+ "name": "bool",
2813
+ "description": "Determines if the component is loading or not",
2814
+ "required": false
2815
+ },
2816
+ "prop_name": {
2817
+ "name": "string",
2818
+ "description": "Holds which property is loading",
2819
+ "required": false
2820
+ },
2821
+ "component_name": {
2822
+ "name": "string",
2823
+ "description": "Holds the name of the component that is loading",
2824
+ "required": false
2825
+ }
2826
+ }
2827
+ },
2828
+ "required": false,
2829
+ "description": ""
2830
+ },
2831
+ "setProps": {
2832
+ "type": {
2833
+ "name": "func"
2834
+ },
2835
+ "required": false,
2836
+ "description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
2837
+ }
2838
+ }
2839
+ },
2572
2840
  "src/lib/components/dataDisplay/AntdRibbon.react.js": {
2573
2841
  "description": "",
2574
2842
  "displayName": "AntdRibbon",
@@ -26553,6 +26821,30 @@
26553
26821
  "required": false,
26554
26822
  "description": ""
26555
26823
  },
26824
+ "selectable": {
26825
+ "type": {
26826
+ "name": "bool"
26827
+ },
26828
+ "required": false,
26829
+ "description": "\u8bbe\u7f6e\u83dc\u5355\u9879\u662f\u5426\u53ef\u9009\u4e2d\r\n\u9ed8\u8ba4\uff1afalse"
26830
+ },
26831
+ "multiple": {
26832
+ "type": {
26833
+ "name": "bool"
26834
+ },
26835
+ "required": false,
26836
+ "description": "\u8bbe\u7f6e\u83dc\u5355\u662f\u5426\u5141\u8bb8\u591a\u9009\r\n\u9ed8\u8ba4\uff1afalse"
26837
+ },
26838
+ "selectedKeys": {
26839
+ "type": {
26840
+ "name": "arrayOf",
26841
+ "value": {
26842
+ "name": "string"
26843
+ }
26844
+ },
26845
+ "required": false,
26846
+ "description": "\u8bbe\u7f6e\u6216\u76d1\u542c\u5f53\u524d\u5df2\u9009\u4e2d\u83dc\u5355\u9879key\u503c\u6570\u7ec4"
26847
+ },
26556
26848
  "arrow": {
26557
26849
  "type": {
26558
26850
  "name": "bool"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_antd_components",
3
- "version": "0.3.0-a0",
3
+ "version": "0.3.0-a2",
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.3.0-a0",
3
+ "version": "0.3.0-a2",
4
4
  "description": "Best implementation of Antd components in Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,18 +43,23 @@ Those elements have the following types:
43
43
  - `iconRenderer` (a value equal to: 'AntdIcon', 'fontawesome'; optional)
44
44
  - `key` (String; optional)
45
45
  - `isDivider` (Bool; optional)s
46
+ - `multiple` (Bool; optional): 设置菜单是否允许多选
47
+ 默认:false
46
48
  - `nClicks` (Real; optional)
47
49
  - `overlayClassName` (String | Dict; optional)
48
50
  - `overlayStyle` (Dict; optional)
49
51
  - `placement` (a value equal to: 'bottomLeft', 'bottomCenter', 'bottomRight', 'topLeft', 'topCenter', 'topRight'; optional)
50
52
  - `popupContainer` (a value equal to: 'parent', 'body'; optional)
53
+ - `selectable` (Bool; optional): 设置菜单项是否可选中
54
+ 默认:false
55
+ - `selectedKeys` (Array of Strings; optional): 设置或监听当前已选中菜单项key值数组
51
56
  - `style` (Dict; optional)
52
57
  - `title` (String; optional)
53
58
  - `trigger` (a value equal to: 'click', 'hover'; optional)
54
59
  - `visible` (Bool; optional)
55
60
  """
56
61
  function 'feffery'_antddropdown(; kwargs...)
57
- available_props = Symbol[:id, :arrow, :autoAdjustOverflow, :batchPropsNames, :batchPropsValues, :buttonMode, :buttonProps, :className, :clickedKey, :disabled, :freePosition, :freePositionClassName, :freePositionStyle, :key, :loading_state, :menuItems, :nClicks, :overlayClassName, :overlayStyle, :placement, :popupContainer, :style, :title, :trigger, :visible]
62
+ available_props = Symbol[:id, :arrow, :autoAdjustOverflow, :batchPropsNames, :batchPropsValues, :buttonMode, :buttonProps, :className, :clickedKey, :disabled, :freePosition, :freePositionClassName, :freePositionStyle, :key, :loading_state, :menuItems, :multiple, :nClicks, :overlayClassName, :overlayStyle, :placement, :popupContainer, :selectable, :selectedKeys, :style, :title, :trigger, :visible]
58
63
  wild_props = Symbol[]
59
64
  return Component("'feffery'_antddropdown", "AntdDropdown", "feffery_antd_components", available_props, wild_props; kwargs...)
60
65
  end
@@ -0,0 +1,49 @@
1
+ # AUTO GENERATED FILE - DO NOT EDIT
2
+
3
+ export 'feffery'_antdqrcode
4
+
5
+ """
6
+ 'feffery'_antdqrcode(;kwargs...)
7
+
8
+ An AntdQRCode component.
9
+
10
+ Keyword arguments:
11
+ - `id` (String; optional)
12
+ - `autoSpin` (Bool; optional): 是否在value处于回调更新中时,自动切换到loading状态
13
+ 默认:false
14
+ - `bgColor` (String; optional): 设置二维码背景颜色
15
+ 默认:'transparent'
16
+ - `bordered` (Bool; optional): 设置二维码是否有边框
17
+ 默认:true
18
+ - `className` (String | Dict; optional)
19
+ - `color` (String; optional): 设置二维码颜色
20
+ 默认:'#000'
21
+ - `errorLevel` (a value equal to: 'L', 'M', 'Q', 'H'; optional): 设置二维码纠错等级,可选的有'L'、'M'、'Q'、'H'
22
+ 默认:'M'
23
+ - `expires` (Real; optional): 设置当前二维码过期时间,单位:秒,到期后二维码状态将会被强制更新为'expired'
24
+ - `icon` (String; optional): 用于设置二维码中图片的地址(目前只支持图片地址)
25
+ - `iconSize` (Real; optional): 设置二维码中图片的大小
26
+ 默认:40
27
+ - `key` (String; optional)
28
+ - `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
29
+ Those elements have the following types:
30
+ - `is_loading` (Bool; optional): Determines if the component is loading or not
31
+ - `prop_name` (String; optional): Holds which property is loading
32
+ - `component_name` (String; optional): Holds the name of the component that is loading
33
+ - `locale` (a value equal to: 'zh-cn', 'en-us'; optional)
34
+ - `refreshClicks` (Real; optional): 监听当前"点击刷新"按钮累计点击次数,仅在status为'expired'时有意义
35
+ - `size` (Real; optional): 设置二维码像素尺寸
36
+ 默认:160
37
+ - `status` (a value equal to: 'active', 'expired', 'loading'; optional): 设置二维码状态,可选的有'active'、'expired'、'loading'
38
+ 默认:'active'
39
+ - `style` (Dict; optional)
40
+ - `type` (a value equal to: 'canvas', 'svg'; optional): 设置渲染类型,可选的有'canvas'、'primary'
41
+ 默认:'canvas'
42
+ - `value` (String; optional): 用于设置扫描后的文本
43
+ """
44
+ function 'feffery'_antdqrcode(; kwargs...)
45
+ available_props = Symbol[:id, :autoSpin, :bgColor, :bordered, :className, :color, :errorLevel, :expires, :icon, :iconSize, :key, :loading_state, :locale, :refreshClicks, :size, :status, :style, :type, :value]
46
+ wild_props = Symbol[]
47
+ return Component("'feffery'_antdqrcode", "AntdQRCode", "feffery_antd_components", available_props, wild_props; kwargs...)
48
+ end
49
+
@@ -0,0 +1,148 @@
1
+ import React, { Suspense } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const LazyAntdQRCode = React.lazy(() => import(/* webpackChunkName: "data_display" */ '../../fragments/dataDisplay/AntdQRCode.react'));
5
+
6
+ const AntdQRCode = (props) => {
7
+ return (
8
+ <Suspense fallback={null}>
9
+ <LazyAntdQRCode {...props} />
10
+ </Suspense>
11
+ );
12
+ }
13
+
14
+ // 定义参数或属性
15
+ AntdQRCode.propTypes = {
16
+ // 组件id
17
+ id: PropTypes.string,
18
+
19
+ // css类名
20
+ className: PropTypes.oneOfType([
21
+ PropTypes.string,
22
+ PropTypes.object
23
+ ]),
24
+
25
+ // 自定义css字典
26
+ style: PropTypes.object,
27
+
28
+ // 辅助刷新用唯一标识key值
29
+ key: PropTypes.string,
30
+
31
+ // 设置语言环境,可选的有'zh-cn'、'en-us'
32
+ locale: PropTypes.oneOf(['zh-cn', 'en-us']),
33
+
34
+ /**
35
+ * 用于设置扫描后的文本
36
+ */
37
+ value: PropTypes.string,
38
+
39
+ /**
40
+ * 设置渲染类型,可选的有'canvas'、'primary'
41
+ * 默认:'canvas'
42
+ */
43
+ type: PropTypes.oneOf(['canvas', 'svg']),
44
+
45
+ /**
46
+ * 用于设置二维码中图片的地址(目前只支持图片地址)
47
+ */
48
+ icon: PropTypes.string,
49
+
50
+ /**
51
+ * 设置二维码像素尺寸
52
+ * 默认:160
53
+ */
54
+ size: PropTypes.number,
55
+
56
+ /**
57
+ * 设置二维码中图片的大小
58
+ * 默认:40
59
+ */
60
+ iconSize: PropTypes.number,
61
+
62
+ /**
63
+ * 设置二维码颜色
64
+ * 默认:'#000'
65
+ */
66
+ color: PropTypes.string,
67
+
68
+ /**
69
+ * 设置二维码背景颜色
70
+ * 默认:'transparent'
71
+ */
72
+ bgColor: PropTypes.string,
73
+
74
+ /**
75
+ * 设置二维码是否有边框
76
+ * 默认:true
77
+ */
78
+ bordered: PropTypes.bool,
79
+
80
+ /**
81
+ * 设置二维码纠错等级,可选的有'L'、'M'、'Q'、'H'
82
+ * 默认:'M'
83
+ */
84
+ errorLevel: PropTypes.oneOf(['L', 'M', 'Q', 'H']),
85
+
86
+ /**
87
+ * 设置二维码状态,可选的有'active'、'expired'、'loading'
88
+ * 默认:'active'
89
+ */
90
+ status: PropTypes.oneOf(['active', 'expired', 'loading']),
91
+
92
+ /**
93
+ * 设置当前二维码过期时间,单位:秒,到期后二维码状态将会被强制更新为'expired'
94
+ */
95
+ expires: PropTypes.number,
96
+
97
+ /**
98
+ * 是否在value处于回调更新中时,自动切换到loading状态
99
+ * 默认:false
100
+ */
101
+ autoSpin: PropTypes.bool,
102
+
103
+ /**
104
+ * 监听当前"点击刷新"按钮累计点击次数,仅在status为'expired'时有意义
105
+ */
106
+ refreshClicks: PropTypes.number,
107
+
108
+ loading_state: PropTypes.shape({
109
+ /**
110
+ * Determines if the component is loading or not
111
+ */
112
+ is_loading: PropTypes.bool,
113
+ /**
114
+ * Holds which property is loading
115
+ */
116
+ prop_name: PropTypes.string,
117
+ /**
118
+ * Holds the name of the component that is loading
119
+ */
120
+ component_name: PropTypes.string
121
+ }),
122
+
123
+ /**
124
+ * Dash-assigned callback that should be called to report property changes
125
+ * to Dash, to make them available for callbacks.
126
+ */
127
+ setProps: PropTypes.func
128
+ };
129
+
130
+ // 设置默认参数
131
+ AntdQRCode.defaultProps = {
132
+ locale: 'zh-cn',
133
+ type: 'canvas',
134
+ size: 160,
135
+ iconSize: 40,
136
+ color: '#000',
137
+ bgColor: 'transparent',
138
+ bordered: true,
139
+ errorLevel: 'M',
140
+ status: 'active',
141
+ autoSpin: false,
142
+ refreshClicks: 0
143
+ }
144
+
145
+ export default AntdQRCode;
146
+
147
+ export const propTypes = AntdQRCode.propTypes;
148
+ export const defaultProps = AntdQRCode.defaultProps;
@@ -1,90 +1,13 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { Suspense } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ColorPicker } from 'antd';
4
- import { Color } from '@rc-component/color-picker';
5
- import useCss from '../../hooks/useCss';
6
- import { isString } from 'lodash';
7
3
 
8
- // 定义颜色选择器组件AntdColorPicker
9
- const AntdColorPicker = (props) => {
10
- // 取得必要属性或参数
11
- let {
12
- id,
13
- className,
14
- style,
15
- key,
16
- allowClear,
17
- arrow,
18
- value,
19
- format,
20
- disabled,
21
- disabledAlpha,
22
- open,
23
- presets,
24
- placement,
25
- showText,
26
- size,
27
- trigger,
28
- setProps,
29
- loading_state
30
- } = props;
31
-
32
- // 每次format发生变更时,同步更新value值
33
- useEffect(() => {
34
- if (value) {
35
- let _color = new Color(value)
36
- setProps({
37
- value: (
38
- format === 'hex' ?
39
- _color.toHexString() :
40
- (
41
- format === 'rgb' ?
42
- _color.toRgbString() :
43
- _color.toHsbString()
44
- )
45
- )
46
- })
47
- }
48
- }, [format])
4
+ const LazyAntdColorPicker = React.lazy(() => import(/* webpackChunkName: "data_entry" */ '../../fragments/dataEntry/AntdColorPicker.react'));
49
5
 
6
+ const AntdColorPicker = (props) => {
50
7
  return (
51
- <ColorPicker id={id}
52
- className={
53
- isString(className) ?
54
- className :
55
- (className ? useCss(className) : undefined)
56
- }
57
- style={style}
58
- key={key}
59
- allowClear={allowClear}
60
- arrow={arrow}
61
- value={value}
62
- format={format}
63
- disabled={disabled}
64
- disabledAlpha={disabledAlpha}
65
- open={open}
66
- presets={presets}
67
- placement={placement}
68
- showText={showText}
69
- size={size}
70
- trigger={trigger}
71
- onFormatChange={(e) => setProps({ format: e })}
72
- onOpenChange={(e) => setProps({ open: e })}
73
- onChangeComplete={(e) => setProps({
74
- value: (
75
- format === 'hex' ?
76
- e.toHexString() :
77
- (
78
- format === 'rgb' ?
79
- e.toRgbString() :
80
- e.toHsbString()
81
- )
82
- )
83
- })}
84
- onClear={() => setProps({ value: null })}
85
- data-dash-is-loading={
86
- (loading_state && loading_state.is_loading) || undefined
87
- } />
8
+ <Suspense fallback={null}>
9
+ <LazyAntdColorPicker {...props} />
10
+ </Suspense>
88
11
  );
89
12
  }
90
13
 
@@ -242,4 +165,7 @@ AntdColorPicker.defaultProps = {
242
165
  value: '#1677FF'
243
166
  }
244
167
 
245
- export default AntdColorPicker;
168
+ export default AntdColorPicker;
169
+
170
+ export const propTypes = AntdColorPicker.propTypes;
171
+ export const defaultProps = AntdColorPicker.defaultProps;