feffery_utils_components 0.0.9 → 0.0.13
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 +5 -5
- package/Project.toml +1 -1
- package/feffery_utils_components/FefferyCaptcha.py +5 -3
- package/feffery_utils_components/FefferyCircleColorPicker.py +47 -0
- package/{build/lib/feffery_utils_components/FefferyDashboard.py → feffery_utils_components/FefferyColorPicker.py} +9 -11
- package/feffery_utils_components/FefferyDiv.py +47 -0
- package/feffery_utils_components/FefferyExecuteJs.py +5 -3
- package/feffery_utils_components/FefferyExtraSpinner.py +49 -0
- package/feffery_utils_components/FefferyGuide.py +5 -3
- package/feffery_utils_components/FefferyScroll.py +57 -0
- package/feffery_utils_components/FefferyScrollbars.py +51 -0
- package/feffery_utils_components/FefferyShortcutPanel.py +5 -3
- package/feffery_utils_components/FefferySplit.py +8 -8
- package/feffery_utils_components/FefferySplitPane.py +5 -3
- package/feffery_utils_components/FefferySyntaxHighlighter.py +5 -3
- package/feffery_utils_components/FefferyTopProgress.py +5 -3
- package/feffery_utils_components/_imports_.py +10 -4
- package/feffery_utils_components/feffery_utils_components.min.js +50 -28
- package/feffery_utils_components/metadata.json +457 -202
- package/feffery_utils_components/package-info.json +7 -6
- package/package.json +7 -6
- package/src/FefferyUtilsComponents.jl +8 -5
- package/src/jl/''_fefferycirclecolorpicker.jl +26 -0
- package/src/jl/''_fefferycolorpicker.jl +22 -0
- package/src/jl/''_fefferydiv.jl +32 -0
- package/src/jl/''_fefferyextraspinner.jl +27 -0
- package/src/jl/''_fefferyscroll.jl +31 -0
- package/src/jl/''_fefferyscrollbars.jl +34 -0
- package/src/jl/''_fefferysplit.jl +1 -2
- package/src/lib/components/FefferyCaptcha.react.js +6 -2
- package/src/lib/components/FefferyDiv.react.js +85 -0
- package/src/lib/components/FefferyExecuteJs.react.js +21 -12
- package/src/lib/components/FefferyExtraSpinner.react.js +373 -0
- package/src/lib/components/FefferyGuide.react.js +11 -4
- package/src/lib/components/FefferyScroll.react.js +170 -0
- package/src/lib/components/FefferyScrollbars.react.js +104 -0
- package/src/lib/components/FefferyShortcutPanel.react.js +5 -1
- package/src/lib/components/FefferySyntaxHighlighter.react.js +6 -2
- package/src/lib/components/FefferyTopProgress.react.js +3 -3
- package/src/lib/components/colorPickers/FefferyCircleColorPicker.react.js +88 -0
- package/src/lib/components/nprogress.css +84 -0
- package/src/lib/components/split/FefferySplit.react.js +28 -42
- package/src/lib/components/styles.css +32 -8
- package/src/lib/index.js +11 -6
- package/usage.py +107 -39
- package/build/lib/feffery_utils_components/FefferyCaptcha.py +0 -51
- package/build/lib/feffery_utils_components/FefferyGuide.py +0 -69
- package/build/lib/feffery_utils_components/FefferyPasteImage.py +0 -56
- package/build/lib/feffery_utils_components/FefferyResizable.py +0 -39
- package/build/lib/feffery_utils_components/FefferyShortcutPanel.py +0 -51
- package/build/lib/feffery_utils_components/FefferySplit.py +0 -59
- package/build/lib/feffery_utils_components/FefferySplitPane.py +0 -48
- package/build/lib/feffery_utils_components/FefferySyntaxHighlighter.py +0 -52
- package/build/lib/feffery_utils_components/FefferyTopProgress.py +0 -68
- package/build/lib/feffery_utils_components/FefferyUtilsComponents.py +0 -40
- package/build/lib/feffery_utils_components/FefferyWaterMark.py +0 -64
- package/build/lib/feffery_utils_components/__init__.py +0 -89
- package/build/lib/feffery_utils_components/_imports_.py +0 -21
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +0 -407
- package/build/lib/feffery_utils_components/metadata.json +0 -1053
- package/build/lib/feffery_utils_components/package-info.json +0 -84
- package/src/lib/components/FefferyPasteImage.react.js +0 -168
- package/src/lib/components/FefferyWaterMark.react.js +0 -112
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,23 +22,24 @@
|
|
|
22
22
|
"author": "CNFeffery <fefferypzy@gmail.com>",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ant-design/pro-layout": "^6.24.0",
|
|
26
25
|
"@charliewilco/gluejar": "^1.0.0",
|
|
27
26
|
"byte-guide": "^1.0.7",
|
|
28
27
|
"file-loader": "^6.2.0",
|
|
29
|
-
"github-markdown-css": "^5.0.0",
|
|
30
28
|
"less": "^3.13.1",
|
|
31
29
|
"less-loader": "^5.0.0",
|
|
32
30
|
"ninja-keys": "^1.1.12",
|
|
33
31
|
"nprogress": "^0.2.0",
|
|
34
32
|
"ramda": "^0.26.1",
|
|
35
|
-
"re-resizable": "^6.9.1",
|
|
36
33
|
"react-captcha-code": "^1.0.7",
|
|
37
|
-
"react-
|
|
34
|
+
"react-color": "^2.19.3",
|
|
38
35
|
"react-copy-to-clipboard": "^5.0.4",
|
|
39
36
|
"react-icons": "^4.3.1",
|
|
37
|
+
"react-resize-detector": "^7.1.2",
|
|
38
|
+
"react-scroll": "^1.8.6",
|
|
39
|
+
"react-spinners-kit": "^1.9.1",
|
|
40
40
|
"react-split": "^2.0.14",
|
|
41
|
-
"react-syntax-highlighter": "^15.4.4"
|
|
41
|
+
"react-syntax-highlighter": "^15.4.4",
|
|
42
|
+
"simplebar-react": "^2.3.7"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@babel/core": "^7.5.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.13",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,23 +22,24 @@
|
|
|
22
22
|
"author": "CNFeffery <fefferypzy@gmail.com>",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ant-design/pro-layout": "^6.24.0",
|
|
26
25
|
"@charliewilco/gluejar": "^1.0.0",
|
|
27
26
|
"byte-guide": "^1.0.7",
|
|
28
27
|
"file-loader": "^6.2.0",
|
|
29
|
-
"github-markdown-css": "^5.0.0",
|
|
30
28
|
"less": "^3.13.1",
|
|
31
29
|
"less-loader": "^5.0.0",
|
|
32
30
|
"ninja-keys": "^1.1.12",
|
|
33
31
|
"nprogress": "^0.2.0",
|
|
34
32
|
"ramda": "^0.26.1",
|
|
35
|
-
"re-resizable": "^6.9.1",
|
|
36
33
|
"react-captcha-code": "^1.0.7",
|
|
37
|
-
"react-
|
|
34
|
+
"react-color": "^2.19.3",
|
|
38
35
|
"react-copy-to-clipboard": "^5.0.4",
|
|
39
36
|
"react-icons": "^4.3.1",
|
|
37
|
+
"react-resize-detector": "^7.1.2",
|
|
38
|
+
"react-scroll": "^1.8.6",
|
|
39
|
+
"react-spinners-kit": "^1.9.1",
|
|
40
40
|
"react-split": "^2.0.14",
|
|
41
|
-
"react-syntax-highlighter": "^15.4.4"
|
|
41
|
+
"react-syntax-highlighter": "^15.4.4",
|
|
42
|
+
"simplebar-react": "^2.3.7"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@babel/core": "^7.5.4",
|
|
@@ -3,16 +3,19 @@ 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.13"
|
|
7
7
|
|
|
8
|
+
include("jl/''_fefferycirclecolorpicker.jl")
|
|
8
9
|
include("jl/''_fefferycaptcha.jl")
|
|
10
|
+
include("jl/''_fefferydiv.jl")
|
|
9
11
|
include("jl/''_fefferyexecutejs.jl")
|
|
12
|
+
include("jl/''_fefferyextraspinner.jl")
|
|
10
13
|
include("jl/''_fefferyguide.jl")
|
|
11
|
-
include("jl/''
|
|
14
|
+
include("jl/''_fefferyscroll.jl")
|
|
15
|
+
include("jl/''_fefferyscrollbars.jl")
|
|
12
16
|
include("jl/''_fefferyshortcutpanel.jl")
|
|
13
17
|
include("jl/''_fefferysyntaxhighlighter.jl")
|
|
14
18
|
include("jl/''_fefferytopprogress.jl")
|
|
15
|
-
include("jl/''_fefferywatermark.jl")
|
|
16
19
|
include("jl/''_fefferysplit.jl")
|
|
17
20
|
include("jl/''_fefferysplitpane.jl")
|
|
18
21
|
|
|
@@ -25,14 +28,14 @@ function __init__()
|
|
|
25
28
|
[
|
|
26
29
|
DashBase.Resource(
|
|
27
30
|
relative_package_path = "feffery_utils_components.min.js",
|
|
28
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
31
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.13/feffery_utils_components/feffery_utils_components.min.js",
|
|
29
32
|
dynamic = nothing,
|
|
30
33
|
async = nothing,
|
|
31
34
|
type = :js
|
|
32
35
|
),
|
|
33
36
|
DashBase.Resource(
|
|
34
37
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
35
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
38
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.13/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
36
39
|
dynamic = true,
|
|
37
40
|
async = nothing,
|
|
38
41
|
type = :js
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferycirclecolorpicker
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferycirclecolorpicker(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyCircleColorPicker component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (optional)
|
|
12
|
+
- `circleSize` (optional)
|
|
13
|
+
- `circleSpacing` (optional)
|
|
14
|
+
- `className` (optional)
|
|
15
|
+
- `color` (optional)
|
|
16
|
+
- `colors` (optional)
|
|
17
|
+
- `loading_state` (optional)
|
|
18
|
+
- `style` (optional)
|
|
19
|
+
- `width` (optional)
|
|
20
|
+
"""
|
|
21
|
+
function ''_fefferycirclecolorpicker(; kwargs...)
|
|
22
|
+
available_props = Symbol[:id, :circleSize, :circleSpacing, :className, :color, :colors, :loading_state, :style, :width]
|
|
23
|
+
wild_props = Symbol[]
|
|
24
|
+
return Component("''_fefferycirclecolorpicker", "FefferyCircleColorPicker", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferycolorpicker
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferycolorpicker(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyColorPicker component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (optional)
|
|
12
|
+
- `className` (optional)
|
|
13
|
+
- `loading_state` (optional)
|
|
14
|
+
- `style` (optional)
|
|
15
|
+
- `type` (optional)
|
|
16
|
+
"""
|
|
17
|
+
function ''_fefferycolorpicker(; kwargs...)
|
|
18
|
+
available_props = Symbol[:id, :className, :loading_state, :style, :type]
|
|
19
|
+
wild_props = Symbol[]
|
|
20
|
+
return Component("''_fefferycolorpicker", "FefferyColorPicker", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
21
|
+
end
|
|
22
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferydiv
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferydiv(;kwargs...)
|
|
7
|
+
''_fefferydiv(children::Any;kwargs...)
|
|
8
|
+
''_fefferydiv(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferyDiv component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (optional)
|
|
15
|
+
- `id` (optional)
|
|
16
|
+
- `_height` (optional)
|
|
17
|
+
- `_width` (optional)
|
|
18
|
+
- `className` (optional)
|
|
19
|
+
- `loading_state` (optional)
|
|
20
|
+
- `setProps` (optional): Dash-assigned callback that should be called to report property changes
|
|
21
|
+
to Dash, to make them available for callbacks.
|
|
22
|
+
- `style` (optional)
|
|
23
|
+
"""
|
|
24
|
+
function ''_fefferydiv(; kwargs...)
|
|
25
|
+
available_props = Symbol[:children, :id, :_height, :_width, :className, :loading_state, :style]
|
|
26
|
+
wild_props = Symbol[]
|
|
27
|
+
return Component("''_fefferydiv", "FefferyDiv", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
''_fefferydiv(children::Any; kwargs...) = ''_fefferydiv(;kwargs..., children = children)
|
|
31
|
+
''_fefferydiv(children_maker::Function; kwargs...) = ''_fefferydiv(children_maker(); kwargs...)
|
|
32
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyextraspinner
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyextraspinner(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyExtraSpinner component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (optional)
|
|
12
|
+
- `backColor` (optional)
|
|
13
|
+
- `className` (optional)
|
|
14
|
+
- `color` (optional)
|
|
15
|
+
- `frontColor` (optional)
|
|
16
|
+
- `loading_state` (optional)
|
|
17
|
+
- `size` (optional)
|
|
18
|
+
- `sizeUnit` (optional)
|
|
19
|
+
- `style` (optional)
|
|
20
|
+
- `type` (optional)
|
|
21
|
+
"""
|
|
22
|
+
function ''_fefferyextraspinner(; kwargs...)
|
|
23
|
+
available_props = Symbol[:id, :backColor, :className, :color, :frontColor, :loading_state, :size, :sizeUnit, :style, :type]
|
|
24
|
+
wild_props = Symbol[]
|
|
25
|
+
return Component("''_fefferyextraspinner", "FefferyExtraSpinner", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
26
|
+
end
|
|
27
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyscroll
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyscroll(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyScroll component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (optional)
|
|
12
|
+
- `containerId` (optional)
|
|
13
|
+
- `delay` (optional)
|
|
14
|
+
- `duration` (optional)
|
|
15
|
+
- `executeScroll` (optional)
|
|
16
|
+
- `loading_state` (optional)
|
|
17
|
+
- `offset` (optional)
|
|
18
|
+
- `scrollMode` (optional)
|
|
19
|
+
- `scrollRelativeOffset` (optional)
|
|
20
|
+
- `scrollTargetId` (optional)
|
|
21
|
+
- `scrollTopOffset` (optional)
|
|
22
|
+
- `setProps` (optional): Dash-assigned callback that should be called to report property changes
|
|
23
|
+
to Dash, to make them available for callbacks.
|
|
24
|
+
- `smooth` (optional)
|
|
25
|
+
"""
|
|
26
|
+
function ''_fefferyscroll(; kwargs...)
|
|
27
|
+
available_props = Symbol[:id, :containerId, :delay, :duration, :executeScroll, :loading_state, :offset, :scrollMode, :scrollRelativeOffset, :scrollTargetId, :scrollTopOffset, :smooth]
|
|
28
|
+
wild_props = Symbol[]
|
|
29
|
+
return Component("''_fefferyscroll", "FefferyScroll", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
30
|
+
end
|
|
31
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyscrollbars
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyscrollbars(;kwargs...)
|
|
7
|
+
''_fefferyscrollbars(children::Any;kwargs...)
|
|
8
|
+
''_fefferyscrollbars(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferyScrollbars component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (optional)
|
|
15
|
+
- `id` (optional)
|
|
16
|
+
- `autoHide` (optional)
|
|
17
|
+
- `className` (optional)
|
|
18
|
+
- `classNames` (optional)
|
|
19
|
+
- `forceVisible` (optional)
|
|
20
|
+
- `loading_state` (optional)
|
|
21
|
+
- `scrollbarMaxSize` (optional)
|
|
22
|
+
- `scrollbarMinSize` (optional)
|
|
23
|
+
- `style` (optional)
|
|
24
|
+
- `timeout` (optional)
|
|
25
|
+
"""
|
|
26
|
+
function ''_fefferyscrollbars(; kwargs...)
|
|
27
|
+
available_props = Symbol[:children, :id, :autoHide, :className, :classNames, :forceVisible, :loading_state, :scrollbarMaxSize, :scrollbarMinSize, :style, :timeout]
|
|
28
|
+
wild_props = Symbol[]
|
|
29
|
+
return Component("''_fefferyscrollbars", "FefferyScrollbars", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
''_fefferyscrollbars(children::Any; kwargs...) = ''_fefferyscrollbars(;kwargs..., children = children)
|
|
33
|
+
''_fefferyscrollbars(children_maker::Function; kwargs...) = ''_fefferyscrollbars(children_maker(); kwargs...)
|
|
34
|
+
|
|
@@ -15,7 +15,6 @@ Keyword arguments:
|
|
|
15
15
|
- `id` (optional)
|
|
16
16
|
- `className` (optional)
|
|
17
17
|
- `cursor` (optional)
|
|
18
|
-
- `defaultSizes` (optional)
|
|
19
18
|
- `direction` (optional)
|
|
20
19
|
- `dragInterval` (optional)
|
|
21
20
|
- `expandToMin` (optional)
|
|
@@ -29,7 +28,7 @@ to Dash, to make them available for callbacks.
|
|
|
29
28
|
- `style` (optional)
|
|
30
29
|
"""
|
|
31
30
|
function ''_fefferysplit(; kwargs...)
|
|
32
|
-
available_props = Symbol[:children, :id, :className, :cursor, :
|
|
31
|
+
available_props = Symbol[:children, :id, :className, :cursor, :direction, :dragInterval, :expandToMin, :gutterSize, :loading_state, :maxSize, :minSize, :sizes, :style]
|
|
33
32
|
wild_props = Symbol[]
|
|
34
33
|
return Component("''_fefferysplit", "FefferySplit", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
35
34
|
end
|
|
@@ -14,7 +14,8 @@ const FefferyCaptcha = (props) => {
|
|
|
14
14
|
width,
|
|
15
15
|
bgColor,
|
|
16
16
|
fontSize,
|
|
17
|
-
setProps
|
|
17
|
+
setProps,
|
|
18
|
+
loading_state
|
|
18
19
|
} = props;
|
|
19
20
|
|
|
20
21
|
// 返回定制化的前端部件
|
|
@@ -34,7 +35,10 @@ const FefferyCaptcha = (props) => {
|
|
|
34
35
|
width={width}
|
|
35
36
|
bgColor={bgColor}
|
|
36
37
|
fontSize={fontSize}
|
|
37
|
-
onChange={handleChange}
|
|
38
|
+
onChange={handleChange}
|
|
39
|
+
data-dash-is-loading={
|
|
40
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
41
|
+
} />
|
|
38
42
|
);
|
|
39
43
|
}
|
|
40
44
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect, useCallback } from 'react';
|
|
2
|
+
import { useResizeDetector } from 'react-resize-detector';
|
|
3
|
+
|
|
4
|
+
// 定义进阶div容器组件FefferyDiv
|
|
5
|
+
const FefferyDiv = (props) => {
|
|
6
|
+
// 取得必要属性或参数
|
|
7
|
+
const {
|
|
8
|
+
id,
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
className,
|
|
12
|
+
setProps,
|
|
13
|
+
loading_state
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
const onResize = useCallback(() => {
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
const { width, height, ref } = useResizeDetector({ onResize });
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// 监听div容器尺寸变化从而刷新_width,_height属性值
|
|
23
|
+
setProps({
|
|
24
|
+
_width: width,
|
|
25
|
+
_height: height
|
|
26
|
+
});
|
|
27
|
+
}, [width, height]);
|
|
28
|
+
|
|
29
|
+
return <div
|
|
30
|
+
id={id}
|
|
31
|
+
style={style}
|
|
32
|
+
className={className}
|
|
33
|
+
ref={ref}
|
|
34
|
+
data-dash-is-loading={
|
|
35
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
36
|
+
} >
|
|
37
|
+
{children}
|
|
38
|
+
</ div>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// 定义参数或属性
|
|
43
|
+
FefferyDiv.propTypes = {
|
|
44
|
+
// 部件id
|
|
45
|
+
id: PropTypes.string,
|
|
46
|
+
|
|
47
|
+
children: PropTypes.node,
|
|
48
|
+
|
|
49
|
+
style: PropTypes.object,
|
|
50
|
+
|
|
51
|
+
className: PropTypes.string,
|
|
52
|
+
|
|
53
|
+
// 监听容器像素宽度变化
|
|
54
|
+
_width: PropTypes.number,
|
|
55
|
+
|
|
56
|
+
// 监听容器像素高度变化
|
|
57
|
+
_height: PropTypes.number,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Dash-assigned callback that should be called to report property changes
|
|
61
|
+
* to Dash, to make them available for callbacks.
|
|
62
|
+
*/
|
|
63
|
+
setProps: PropTypes.func,
|
|
64
|
+
|
|
65
|
+
loading_state: PropTypes.shape({
|
|
66
|
+
/**
|
|
67
|
+
* Determines if the component is loading or not
|
|
68
|
+
*/
|
|
69
|
+
is_loading: PropTypes.bool,
|
|
70
|
+
/**
|
|
71
|
+
* Holds which property is loading
|
|
72
|
+
*/
|
|
73
|
+
prop_name: PropTypes.string,
|
|
74
|
+
/**
|
|
75
|
+
* Holds the name of the component that is loading
|
|
76
|
+
*/
|
|
77
|
+
component_name: PropTypes.string
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// 设置默认参数
|
|
82
|
+
FefferyDiv.defaultProps = {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default FefferyDiv;
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
// 定义js直接执行部件FefferyExecuteJs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const FefferyExecuteJs = (props) => {
|
|
6
|
+
// 取得必要属性或参数
|
|
7
|
+
const {
|
|
8
|
+
id,
|
|
9
|
+
jsString,
|
|
10
|
+
loading_state
|
|
11
|
+
} = props;
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
12
14
|
// 执行原生js程序
|
|
13
15
|
if (jsString) {
|
|
14
16
|
eval(jsString)
|
|
15
17
|
}
|
|
18
|
+
}, [jsString])
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
return <div
|
|
21
|
+
id={id}
|
|
22
|
+
data-dash-is-loading={
|
|
23
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
24
|
+
} />;
|
|
20
25
|
}
|
|
26
|
+
|
|
27
|
+
|
|
21
28
|
// 定义参数或属性
|
|
22
29
|
FefferyExecuteJs.propTypes = {
|
|
23
30
|
// 部件id
|
|
@@ -44,4 +51,6 @@ FefferyExecuteJs.propTypes = {
|
|
|
44
51
|
|
|
45
52
|
// 设置默认参数
|
|
46
53
|
FefferyExecuteJs.defaultProps = {
|
|
47
|
-
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default FefferyExecuteJs;
|