feffery_utils_components 0.0.22 → 0.0.24
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/NAMESPACE +3 -0
- package/Project.toml +1 -1
- package/build/lib/feffery_utils_components/FefferyCountDown.py +50 -0
- package/build/lib/feffery_utils_components/FefferyDiv.py +1 -1
- package/build/lib/feffery_utils_components/_imports_.py +2 -0
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +1 -1
- package/build/lib/feffery_utils_components/metadata.json +79 -1
- package/build/lib/feffery_utils_components/package-info.json +2 -1
- package/feffery_utils_components/FefferyDiv.py +1 -1
- package/feffery_utils_components/FefferyExternalJs.py +48 -0
- package/feffery_utils_components/FefferySortableContainer.py +54 -0
- package/feffery_utils_components/FefferySortableItem.py +50 -0
- package/feffery_utils_components/_imports_.py +6 -0
- package/feffery_utils_components/feffery_utils_components.min.js +3 -3
- package/feffery_utils_components/metadata.json +255 -1
- package/feffery_utils_components/package-info.json +4 -1
- package/package.json +4 -1
- package/src/FefferyUtilsComponents.jl +6 -3
- package/src/jl/''_fefferydiv.jl +1 -1
- package/src/jl/''_fefferyexternaljs.jl +25 -0
- package/src/jl/''_fefferysortablecontainer.jl +34 -0
- package/src/jl/''_fefferysortableitem.jl +32 -0
- package/src/lib/components/dom/FefferyExternalJs.react.js +75 -0
- package/src/lib/components/listeners/FefferyDiv.react.js +11 -2
- package/src/lib/components/sortable/FefferySortableContainer.react.js +100 -0
- package/src/lib/components/sortable/FefferySortableItem.react.js +61 -0
- package/src/lib/components/styles.css +4 -0
- package/src/lib/index.js +7 -1
- package/tests/FefferyDivHoverTest/app.py +5 -1
- package/tests/SortableTest/app.py +46 -0
|
@@ -720,6 +720,87 @@
|
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
},
|
|
723
|
+
"src/lib/components/dom/FefferyExternalJs.react.js": {
|
|
724
|
+
"description": "",
|
|
725
|
+
"displayName": "FefferyExternalJs",
|
|
726
|
+
"methods": [],
|
|
727
|
+
"props": {
|
|
728
|
+
"id": {
|
|
729
|
+
"type": {
|
|
730
|
+
"name": "string"
|
|
731
|
+
},
|
|
732
|
+
"required": false,
|
|
733
|
+
"description": ""
|
|
734
|
+
},
|
|
735
|
+
"jsUrl": {
|
|
736
|
+
"type": {
|
|
737
|
+
"name": "string"
|
|
738
|
+
},
|
|
739
|
+
"required": false,
|
|
740
|
+
"description": "",
|
|
741
|
+
"defaultValue": {
|
|
742
|
+
"value": "''",
|
|
743
|
+
"computed": false
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
"recentlyStatus": {
|
|
747
|
+
"type": {
|
|
748
|
+
"name": "enum",
|
|
749
|
+
"value": [
|
|
750
|
+
{
|
|
751
|
+
"value": "'unset'",
|
|
752
|
+
"computed": false
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
"value": "'loading'",
|
|
756
|
+
"computed": false
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"value": "'ready'",
|
|
760
|
+
"computed": false
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
"value": "'error'",
|
|
764
|
+
"computed": false
|
|
765
|
+
}
|
|
766
|
+
]
|
|
767
|
+
},
|
|
768
|
+
"required": false,
|
|
769
|
+
"description": ""
|
|
770
|
+
},
|
|
771
|
+
"setProps": {
|
|
772
|
+
"type": {
|
|
773
|
+
"name": "func"
|
|
774
|
+
},
|
|
775
|
+
"required": false,
|
|
776
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
777
|
+
},
|
|
778
|
+
"loading_state": {
|
|
779
|
+
"type": {
|
|
780
|
+
"name": "shape",
|
|
781
|
+
"value": {
|
|
782
|
+
"is_loading": {
|
|
783
|
+
"name": "bool",
|
|
784
|
+
"description": "Determines if the component is loading or not",
|
|
785
|
+
"required": false
|
|
786
|
+
},
|
|
787
|
+
"prop_name": {
|
|
788
|
+
"name": "string",
|
|
789
|
+
"description": "Holds which property is loading",
|
|
790
|
+
"required": false
|
|
791
|
+
},
|
|
792
|
+
"component_name": {
|
|
793
|
+
"name": "string",
|
|
794
|
+
"description": "Holds the name of the component that is loading",
|
|
795
|
+
"required": false
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
"required": false,
|
|
800
|
+
"description": ""
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
},
|
|
723
804
|
"src/lib/components/dom/FefferySetTitle.react.js": {
|
|
724
805
|
"description": "",
|
|
725
806
|
"displayName": "FefferySetTitle",
|
|
@@ -2956,7 +3037,15 @@
|
|
|
2956
3037
|
},
|
|
2957
3038
|
"className": {
|
|
2958
3039
|
"type": {
|
|
2959
|
-
"name": "
|
|
3040
|
+
"name": "union",
|
|
3041
|
+
"value": [
|
|
3042
|
+
{
|
|
3043
|
+
"name": "string"
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
"name": "object"
|
|
3047
|
+
}
|
|
3048
|
+
]
|
|
2960
3049
|
},
|
|
2961
3050
|
"required": false,
|
|
2962
3051
|
"description": ""
|
|
@@ -3530,6 +3619,171 @@
|
|
|
3530
3619
|
}
|
|
3531
3620
|
}
|
|
3532
3621
|
},
|
|
3622
|
+
"src/lib/components/sortable/FefferySortableContainer.react.js": {
|
|
3623
|
+
"description": "",
|
|
3624
|
+
"displayName": "FefferySortableContainer",
|
|
3625
|
+
"methods": [],
|
|
3626
|
+
"props": {
|
|
3627
|
+
"children": {
|
|
3628
|
+
"type": {
|
|
3629
|
+
"name": "node"
|
|
3630
|
+
},
|
|
3631
|
+
"required": false,
|
|
3632
|
+
"description": ""
|
|
3633
|
+
},
|
|
3634
|
+
"id": {
|
|
3635
|
+
"type": {
|
|
3636
|
+
"name": "string"
|
|
3637
|
+
},
|
|
3638
|
+
"required": false,
|
|
3639
|
+
"description": ""
|
|
3640
|
+
},
|
|
3641
|
+
"style": {
|
|
3642
|
+
"type": {
|
|
3643
|
+
"name": "object"
|
|
3644
|
+
},
|
|
3645
|
+
"required": false,
|
|
3646
|
+
"description": ""
|
|
3647
|
+
},
|
|
3648
|
+
"className": {
|
|
3649
|
+
"type": {
|
|
3650
|
+
"name": "string"
|
|
3651
|
+
},
|
|
3652
|
+
"required": false,
|
|
3653
|
+
"description": ""
|
|
3654
|
+
},
|
|
3655
|
+
"helperClassName": {
|
|
3656
|
+
"type": {
|
|
3657
|
+
"name": "union",
|
|
3658
|
+
"value": [
|
|
3659
|
+
{
|
|
3660
|
+
"name": "string"
|
|
3661
|
+
},
|
|
3662
|
+
{
|
|
3663
|
+
"name": "object"
|
|
3664
|
+
}
|
|
3665
|
+
]
|
|
3666
|
+
},
|
|
3667
|
+
"required": false,
|
|
3668
|
+
"description": "",
|
|
3669
|
+
"defaultValue": {
|
|
3670
|
+
"value": "'sortable-helper'",
|
|
3671
|
+
"computed": false
|
|
3672
|
+
}
|
|
3673
|
+
},
|
|
3674
|
+
"orders": {
|
|
3675
|
+
"type": {
|
|
3676
|
+
"name": "arrayOf",
|
|
3677
|
+
"value": {
|
|
3678
|
+
"name": "number"
|
|
3679
|
+
}
|
|
3680
|
+
},
|
|
3681
|
+
"required": false,
|
|
3682
|
+
"description": "",
|
|
3683
|
+
"defaultValue": {
|
|
3684
|
+
"value": "[]",
|
|
3685
|
+
"computed": false
|
|
3686
|
+
}
|
|
3687
|
+
},
|
|
3688
|
+
"setProps": {
|
|
3689
|
+
"type": {
|
|
3690
|
+
"name": "func"
|
|
3691
|
+
},
|
|
3692
|
+
"required": false,
|
|
3693
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
3694
|
+
},
|
|
3695
|
+
"loading_state": {
|
|
3696
|
+
"type": {
|
|
3697
|
+
"name": "shape",
|
|
3698
|
+
"value": {
|
|
3699
|
+
"is_loading": {
|
|
3700
|
+
"name": "bool",
|
|
3701
|
+
"description": "Determines if the component is loading or not",
|
|
3702
|
+
"required": false
|
|
3703
|
+
},
|
|
3704
|
+
"prop_name": {
|
|
3705
|
+
"name": "string",
|
|
3706
|
+
"description": "Holds which property is loading",
|
|
3707
|
+
"required": false
|
|
3708
|
+
},
|
|
3709
|
+
"component_name": {
|
|
3710
|
+
"name": "string",
|
|
3711
|
+
"description": "Holds the name of the component that is loading",
|
|
3712
|
+
"required": false
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
"required": false,
|
|
3717
|
+
"description": ""
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
},
|
|
3721
|
+
"src/lib/components/sortable/FefferySortableItem.react.js": {
|
|
3722
|
+
"description": "",
|
|
3723
|
+
"displayName": "FefferySortableItem",
|
|
3724
|
+
"methods": [],
|
|
3725
|
+
"props": {
|
|
3726
|
+
"children": {
|
|
3727
|
+
"type": {
|
|
3728
|
+
"name": "node"
|
|
3729
|
+
},
|
|
3730
|
+
"required": false,
|
|
3731
|
+
"description": ""
|
|
3732
|
+
},
|
|
3733
|
+
"id": {
|
|
3734
|
+
"type": {
|
|
3735
|
+
"name": "string"
|
|
3736
|
+
},
|
|
3737
|
+
"required": false,
|
|
3738
|
+
"description": ""
|
|
3739
|
+
},
|
|
3740
|
+
"style": {
|
|
3741
|
+
"type": {
|
|
3742
|
+
"name": "object"
|
|
3743
|
+
},
|
|
3744
|
+
"required": false,
|
|
3745
|
+
"description": ""
|
|
3746
|
+
},
|
|
3747
|
+
"className": {
|
|
3748
|
+
"type": {
|
|
3749
|
+
"name": "string"
|
|
3750
|
+
},
|
|
3751
|
+
"required": false,
|
|
3752
|
+
"description": ""
|
|
3753
|
+
},
|
|
3754
|
+
"setProps": {
|
|
3755
|
+
"type": {
|
|
3756
|
+
"name": "func"
|
|
3757
|
+
},
|
|
3758
|
+
"required": false,
|
|
3759
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
3760
|
+
},
|
|
3761
|
+
"loading_state": {
|
|
3762
|
+
"type": {
|
|
3763
|
+
"name": "shape",
|
|
3764
|
+
"value": {
|
|
3765
|
+
"is_loading": {
|
|
3766
|
+
"name": "bool",
|
|
3767
|
+
"description": "Determines if the component is loading or not",
|
|
3768
|
+
"required": false
|
|
3769
|
+
},
|
|
3770
|
+
"prop_name": {
|
|
3771
|
+
"name": "string",
|
|
3772
|
+
"description": "Holds which property is loading",
|
|
3773
|
+
"required": false
|
|
3774
|
+
},
|
|
3775
|
+
"component_name": {
|
|
3776
|
+
"name": "string",
|
|
3777
|
+
"description": "Holds the name of the component that is loading",
|
|
3778
|
+
"required": false
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
},
|
|
3782
|
+
"required": false,
|
|
3783
|
+
"description": ""
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
},
|
|
3533
3787
|
"src/lib/components/split/FefferySplit.react.js": {
|
|
3534
3788
|
"description": "",
|
|
3535
3789
|
"displayName": "FefferySplit",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"@uiw/color-convert": "^1.1.0",
|
|
27
27
|
"@uiw/react-color-wheel": "^1.1.0",
|
|
28
28
|
"ahooks": "^3.7.0",
|
|
29
|
+
"array-move": "^4.0.0",
|
|
29
30
|
"byte-guide": "^1.0.7",
|
|
31
|
+
"lodash": "^4.17.21",
|
|
30
32
|
"ninja-keys": "^1.1.12",
|
|
31
33
|
"nprogress": "^0.2.0",
|
|
32
34
|
"ramda": "^0.26.1",
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
"react-lazy-load": "^3.1.14",
|
|
40
42
|
"react-resize-detector": "^7.1.2",
|
|
41
43
|
"react-scroll": "^1.8.6",
|
|
44
|
+
"react-sortable-hoc": "^2.0.0",
|
|
42
45
|
"react-spinners-kit": "^1.9.1",
|
|
43
46
|
"react-split": "^2.0.14",
|
|
44
47
|
"react-syntax-highlighter": "^15.4.4",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"@uiw/color-convert": "^1.1.0",
|
|
27
27
|
"@uiw/react-color-wheel": "^1.1.0",
|
|
28
28
|
"ahooks": "^3.7.0",
|
|
29
|
+
"array-move": "^4.0.0",
|
|
29
30
|
"byte-guide": "^1.0.7",
|
|
31
|
+
"lodash": "^4.17.21",
|
|
30
32
|
"ninja-keys": "^1.1.12",
|
|
31
33
|
"nprogress": "^0.2.0",
|
|
32
34
|
"ramda": "^0.26.1",
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
"react-lazy-load": "^3.1.14",
|
|
40
42
|
"react-resize-detector": "^7.1.2",
|
|
41
43
|
"react-scroll": "^1.8.6",
|
|
44
|
+
"react-sortable-hoc": "^2.0.0",
|
|
42
45
|
"react-spinners-kit": "^1.9.1",
|
|
43
46
|
"react-split": "^2.0.14",
|
|
44
47
|
"react-syntax-highlighter": "^15.4.4",
|
|
@@ -3,7 +3,7 @@ module FefferyUtilsComponents
|
|
|
3
3
|
using Dash
|
|
4
4
|
|
|
5
5
|
const resources_path = realpath(joinpath( @__DIR__, "..", "deps"))
|
|
6
|
-
const version = "0.0.
|
|
6
|
+
const version = "0.0.24"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferyblockcolorpicker.jl")
|
|
9
9
|
include("jl/''_fefferycirclecolorpicker.jl")
|
|
@@ -13,6 +13,7 @@ include("jl/''_fefferyrgbcolorpicker.jl")
|
|
|
13
13
|
include("jl/''_fefferytwittercolorpicker.jl")
|
|
14
14
|
include("jl/''_fefferywheelcolorpicker.jl")
|
|
15
15
|
include("jl/''_fefferyexternalcss.jl")
|
|
16
|
+
include("jl/''_fefferyexternaljs.jl")
|
|
16
17
|
include("jl/''_fefferysettitle.jl")
|
|
17
18
|
include("jl/''_fefferycaptcha.jl")
|
|
18
19
|
include("jl/''_fefferycountdown.jl")
|
|
@@ -37,6 +38,8 @@ include("jl/''_fefferyinviewport.jl")
|
|
|
37
38
|
include("jl/''_fefferykeypress.jl")
|
|
38
39
|
include("jl/''_fefferyresponsive.jl")
|
|
39
40
|
include("jl/''_fefferywindowsize.jl")
|
|
41
|
+
include("jl/''_fefferysortablecontainer.jl")
|
|
42
|
+
include("jl/''_fefferysortableitem.jl")
|
|
40
43
|
include("jl/''_fefferysplit.jl")
|
|
41
44
|
include("jl/''_fefferysplitpane.jl")
|
|
42
45
|
|
|
@@ -49,14 +52,14 @@ function __init__()
|
|
|
49
52
|
[
|
|
50
53
|
DashBase.Resource(
|
|
51
54
|
relative_package_path = "feffery_utils_components.min.js",
|
|
52
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
55
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.24/feffery_utils_components/feffery_utils_components.min.js",
|
|
53
56
|
dynamic = nothing,
|
|
54
57
|
async = nothing,
|
|
55
58
|
type = :js
|
|
56
59
|
),
|
|
57
60
|
DashBase.Resource(
|
|
58
61
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
59
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
62
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.24/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
60
63
|
dynamic = true,
|
|
61
64
|
async = nothing,
|
|
62
65
|
type = :js
|
package/src/jl/''_fefferydiv.jl
CHANGED
|
@@ -15,7 +15,7 @@ Keyword arguments:
|
|
|
15
15
|
- `id` (String; optional)
|
|
16
16
|
- `_height` (Real; optional)
|
|
17
17
|
- `_width` (Real; optional)
|
|
18
|
-
- `className` (String; optional)
|
|
18
|
+
- `className` (String | Dict; optional)
|
|
19
19
|
- `clickAwayCount` (Real; optional)
|
|
20
20
|
- `contextMenuEvent` (optional): . contextMenuEvent has the following type: lists containing elements 'pageX', 'pageY', 'timestamp'.
|
|
21
21
|
Those elements have the following types:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyexternaljs
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyexternaljs(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyExternalJs component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (String; optional)
|
|
12
|
+
- `jsUrl` (String; optional)
|
|
13
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
14
|
+
Those elements have the following types:
|
|
15
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
16
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
17
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
18
|
+
- `recentlyStatus` (a value equal to: 'unset', 'loading', 'ready', 'error'; optional)
|
|
19
|
+
"""
|
|
20
|
+
function ''_fefferyexternaljs(; kwargs...)
|
|
21
|
+
available_props = Symbol[:id, :jsUrl, :loading_state, :recentlyStatus]
|
|
22
|
+
wild_props = Symbol[]
|
|
23
|
+
return Component("''_fefferyexternaljs", "FefferyExternalJs", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
24
|
+
end
|
|
25
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferysortablecontainer
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferysortablecontainer(;kwargs...)
|
|
7
|
+
''_fefferysortablecontainer(children::Any;kwargs...)
|
|
8
|
+
''_fefferysortablecontainer(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferySortableContainer component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional)
|
|
15
|
+
- `id` (String; optional)
|
|
16
|
+
- `className` (String; optional)
|
|
17
|
+
- `helperClassName` (String | Dict; optional)
|
|
18
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
19
|
+
Those elements have the following types:
|
|
20
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
21
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
22
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
23
|
+
- `orders` (Array of Reals; optional)
|
|
24
|
+
- `style` (Dict; optional)
|
|
25
|
+
"""
|
|
26
|
+
function ''_fefferysortablecontainer(; kwargs...)
|
|
27
|
+
available_props = Symbol[:children, :id, :className, :helperClassName, :loading_state, :orders, :style]
|
|
28
|
+
wild_props = Symbol[]
|
|
29
|
+
return Component("''_fefferysortablecontainer", "FefferySortableContainer", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
''_fefferysortablecontainer(children::Any; kwargs...) = ''_fefferysortablecontainer(;kwargs..., children = children)
|
|
33
|
+
''_fefferysortablecontainer(children_maker::Function; kwargs...) = ''_fefferysortablecontainer(children_maker(); kwargs...)
|
|
34
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferysortableitem
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferysortableitem(;kwargs...)
|
|
7
|
+
''_fefferysortableitem(children::Any;kwargs...)
|
|
8
|
+
''_fefferysortableitem(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferySortableItem component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional)
|
|
15
|
+
- `id` (String; optional)
|
|
16
|
+
- `className` (String; optional)
|
|
17
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
18
|
+
Those elements have the following types:
|
|
19
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
20
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
21
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
22
|
+
- `style` (Dict; optional)
|
|
23
|
+
"""
|
|
24
|
+
function ''_fefferysortableitem(; kwargs...)
|
|
25
|
+
available_props = Symbol[:children, :id, :className, :loading_state, :style]
|
|
26
|
+
wild_props = Symbol[]
|
|
27
|
+
return Component("''_fefferysortableitem", "FefferySortableItem", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
''_fefferysortableitem(children::Any; kwargs...) = ''_fefferysortableitem(;kwargs..., children = children)
|
|
31
|
+
''_fefferysortableitem(children_maker::Function; kwargs...) = ''_fefferysortableitem(children_maker(); kwargs...)
|
|
32
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useExternal } from 'ahooks';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
// 定义外部js资源动态注入组件FefferyExternalJs
|
|
6
|
+
const FefferyExternalJs = (props) => {
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
jsUrl,
|
|
11
|
+
setProps,
|
|
12
|
+
loading_state
|
|
13
|
+
} = props;
|
|
14
|
+
|
|
15
|
+
const status = useExternal(jsUrl, {
|
|
16
|
+
type: 'js'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
// 更新最近一次资源变更状态
|
|
21
|
+
if (status) {
|
|
22
|
+
setProps({
|
|
23
|
+
recentlyStatus: status
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}, [status])
|
|
27
|
+
|
|
28
|
+
return (<div
|
|
29
|
+
id={id}
|
|
30
|
+
data-dash-is-loading={
|
|
31
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
32
|
+
} />);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 定义参数或属性
|
|
36
|
+
FefferyExternalJs.propTypes = {
|
|
37
|
+
// 部件id
|
|
38
|
+
id: PropTypes.string,
|
|
39
|
+
|
|
40
|
+
// 设置对应绑定的js静态文件资源url,默认为''
|
|
41
|
+
jsUrl: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
// 监听最近一次资源变更操作后对应的状态
|
|
44
|
+
recentlyStatus: PropTypes.oneOf([
|
|
45
|
+
'unset', 'loading', 'ready', 'error'
|
|
46
|
+
]),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Dash-assigned callback that should be called to report property changes
|
|
50
|
+
* to Dash, to make them available for callbacks.
|
|
51
|
+
*/
|
|
52
|
+
setProps: PropTypes.func,
|
|
53
|
+
|
|
54
|
+
loading_state: PropTypes.shape({
|
|
55
|
+
/**
|
|
56
|
+
* Determines if the component is loading or not
|
|
57
|
+
*/
|
|
58
|
+
is_loading: PropTypes.bool,
|
|
59
|
+
/**
|
|
60
|
+
* Holds which property is loading
|
|
61
|
+
*/
|
|
62
|
+
prop_name: PropTypes.string,
|
|
63
|
+
/**
|
|
64
|
+
* Holds the name of the component that is loading
|
|
65
|
+
*/
|
|
66
|
+
component_name: PropTypes.string
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// 设置默认参数
|
|
71
|
+
FefferyExternalJs.defaultProps = {
|
|
72
|
+
jsUrl: ''
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default React.memo(FefferyExternalJs);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { useCss } from 'react-use';
|
|
3
|
+
import { isString } from 'lodash';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import { useSize, useRequest, useHover, useClickAway } from 'ahooks';
|
|
4
6
|
|
|
@@ -62,7 +64,11 @@ const FefferyDiv = (props) => {
|
|
|
62
64
|
return <div
|
|
63
65
|
id={id}
|
|
64
66
|
style={style}
|
|
65
|
-
className={
|
|
67
|
+
className={
|
|
68
|
+
isString(className) ?
|
|
69
|
+
className :
|
|
70
|
+
useCss(className)
|
|
71
|
+
}
|
|
66
72
|
ref={ref}
|
|
67
73
|
onClick={() => setProps({ nClicks: nClicks + 1 })}
|
|
68
74
|
onDoubleClick={() => setProps({ nDoubleClicks: nDoubleClicks + 1 })}
|
|
@@ -97,7 +103,10 @@ FefferyDiv.propTypes = {
|
|
|
97
103
|
|
|
98
104
|
style: PropTypes.object,
|
|
99
105
|
|
|
100
|
-
className: PropTypes.
|
|
106
|
+
className: PropTypes.oneOfType([
|
|
107
|
+
PropTypes.string,
|
|
108
|
+
PropTypes.object
|
|
109
|
+
]),
|
|
101
110
|
|
|
102
111
|
// 监听容器像素宽度变化
|
|
103
112
|
_width: PropTypes.number,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { sortableContainer, sortableElement } from 'react-sortable-hoc';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { arrayMoveImmutable } from 'array-move';
|
|
5
|
+
import { useCss } from 'react-use';
|
|
6
|
+
import { isString } from 'lodash';
|
|
7
|
+
|
|
8
|
+
const SortableContainer = sortableContainer((props) => {
|
|
9
|
+
return <div {...props} />;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const SortableItem = sortableElement((props) => <div {...props} />);
|
|
13
|
+
|
|
14
|
+
// 定义排序容器组件FefferySortableContainer
|
|
15
|
+
const FefferySortableContainer = (props) => {
|
|
16
|
+
let {
|
|
17
|
+
id,
|
|
18
|
+
children,
|
|
19
|
+
style,
|
|
20
|
+
className,
|
|
21
|
+
helperClassName,
|
|
22
|
+
orders,
|
|
23
|
+
setProps,
|
|
24
|
+
loading_state
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (children) {
|
|
29
|
+
setProps({
|
|
30
|
+
orders: children.map((_, index) => index)
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}, [])
|
|
34
|
+
|
|
35
|
+
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
36
|
+
setProps({
|
|
37
|
+
orders: arrayMoveImmutable(orders, oldIndex, newIndex)
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (<SortableContainer
|
|
42
|
+
id={id}
|
|
43
|
+
style={style}
|
|
44
|
+
className={className}
|
|
45
|
+
helperClass={isString(helperClassName) ? helperClassName : useCss(helperClassName)}
|
|
46
|
+
onSortEnd={onSortEnd}
|
|
47
|
+
data-dash-is-loading={
|
|
48
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
49
|
+
} >
|
|
50
|
+
{orders.map((order, index) => <SortableItem index={index} children={children[order]} />)}
|
|
51
|
+
</SortableContainer>);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// 定义参数或属性
|
|
55
|
+
FefferySortableContainer.propTypes = {
|
|
56
|
+
|
|
57
|
+
children: PropTypes.node,
|
|
58
|
+
|
|
59
|
+
id: PropTypes.string,
|
|
60
|
+
|
|
61
|
+
style: PropTypes.object,
|
|
62
|
+
|
|
63
|
+
className: PropTypes.string,
|
|
64
|
+
|
|
65
|
+
helperClassName: PropTypes.oneOfType([
|
|
66
|
+
PropTypes.string,
|
|
67
|
+
PropTypes.object
|
|
68
|
+
]),
|
|
69
|
+
|
|
70
|
+
orders: PropTypes.arrayOf(PropTypes.number),
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Dash-assigned callback that should be called to report property changes
|
|
74
|
+
* to Dash, to make them available for callbacks.
|
|
75
|
+
*/
|
|
76
|
+
setProps: PropTypes.func,
|
|
77
|
+
|
|
78
|
+
loading_state: PropTypes.shape({
|
|
79
|
+
/**
|
|
80
|
+
* Determines if the component is loading or not
|
|
81
|
+
*/
|
|
82
|
+
is_loading: PropTypes.bool,
|
|
83
|
+
/**
|
|
84
|
+
* Holds which property is loading
|
|
85
|
+
*/
|
|
86
|
+
prop_name: PropTypes.string,
|
|
87
|
+
/**
|
|
88
|
+
* Holds the name of the component that is loading
|
|
89
|
+
*/
|
|
90
|
+
component_name: PropTypes.string
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// 设置默认参数
|
|
95
|
+
FefferySortableContainer.defaultProps = {
|
|
96
|
+
orders: [],
|
|
97
|
+
helperClassName: 'sortable-helper'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default React.memo(FefferySortableContainer);
|