feffery_utils_components 0.0.28 → 0.0.30
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 -1
- package/Project.toml +1 -1
- package/feffery_utils_components/FefferyDiv.py +27 -5
- package/{build/lib/feffery_utils_components/FefferyTimeout.py → feffery_utils_components/FefferyReload.py} +8 -8
- package/{build/lib/feffery_utils_components/FefferyExecuteJs.py → feffery_utils_components/FefferyStyle.py} +10 -10
- package/feffery_utils_components/_imports_.py +6 -2
- package/feffery_utils_components/feffery_utils_components.min.js +2 -2
- package/feffery_utils_components/metadata.json +378 -212
- package/feffery_utils_components/package-info.json +5 -3
- package/package.json +5 -3
- package/src/FefferyUtilsComponents.jl +6 -4
- package/src/jl/''_fefferydiv.jl +12 -1
- package/src/jl/''_fefferyreload.jl +25 -0
- package/src/jl/''_fefferystyle.jl +24 -0
- package/src/lib/components/{listeners/FefferyDiv.react.js → FefferyDiv.react.js} +73 -3
- package/src/lib/components/FefferyReload.react.js +75 -0
- package/src/lib/components/FefferyStyle.react.js +54 -0
- package/src/lib/index.js +7 -3
- package/tests/FefferyReloadTest/app.py +61 -0
- package/usage.py +14 -20
- package/build/lib/feffery_utils_components/FefferyBlockColorPicker.py +0 -53
- package/build/lib/feffery_utils_components/FefferyCaptcha.py +0 -59
- package/build/lib/feffery_utils_components/FefferyCircleColorPicker.py +0 -55
- package/build/lib/feffery_utils_components/FefferyCountDown.py +0 -47
- package/build/lib/feffery_utils_components/FefferyDiv.py +0 -77
- package/build/lib/feffery_utils_components/FefferyDocumentVisibility.py +0 -43
- package/build/lib/feffery_utils_components/FefferyExternalCss.py +0 -45
- package/build/lib/feffery_utils_components/FefferyExternalJs.py +0 -45
- package/build/lib/feffery_utils_components/FefferyExtraSpinner.py +0 -57
- package/build/lib/feffery_utils_components/FefferyFancyNotification.py +0 -85
- package/build/lib/feffery_utils_components/FefferyGeolocation.py +0 -43
- package/build/lib/feffery_utils_components/FefferyGithubColorPicker.py +0 -53
- package/build/lib/feffery_utils_components/FefferyGuide.py +0 -110
- package/build/lib/feffery_utils_components/FefferyHexColorPicker.py +0 -49
- package/build/lib/feffery_utils_components/FefferyHighlightWords.py +0 -61
- package/build/lib/feffery_utils_components/FefferyIdle.py +0 -45
- package/build/lib/feffery_utils_components/FefferyInViewport.py +0 -47
- package/build/lib/feffery_utils_components/FefferyKeyPress.py +0 -50
- package/build/lib/feffery_utils_components/FefferyLazyLoad.py +0 -57
- package/build/lib/feffery_utils_components/FefferyLocation.py +0 -54
- package/build/lib/feffery_utils_components/FefferyQRCode.py +0 -72
- package/build/lib/feffery_utils_components/FefferyRawHTML.py +0 -43
- package/build/lib/feffery_utils_components/FefferyResponsive.py +0 -43
- package/build/lib/feffery_utils_components/FefferyRgbColorPicker.py +0 -49
- package/build/lib/feffery_utils_components/FefferyScroll.py +0 -61
- package/build/lib/feffery_utils_components/FefferyScrollbars.py +0 -69
- package/build/lib/feffery_utils_components/FefferySetTitle.py +0 -43
- package/build/lib/feffery_utils_components/FefferyShortcutPanel.py +0 -75
- package/build/lib/feffery_utils_components/FefferySliderColorPicker.py +0 -50
- package/build/lib/feffery_utils_components/FefferySortableContainer.py +0 -51
- package/build/lib/feffery_utils_components/FefferySortableItem.py +0 -47
- package/build/lib/feffery_utils_components/FefferySplit.py +0 -63
- package/build/lib/feffery_utils_components/FefferySplitPane.py +0 -47
- package/build/lib/feffery_utils_components/FefferySyntaxHighlighter.py +0 -58
- package/build/lib/feffery_utils_components/FefferyTopProgress.py +0 -67
- package/build/lib/feffery_utils_components/FefferyTwitterColorPicker.py +0 -53
- package/build/lib/feffery_utils_components/FefferyVirtualList.py +0 -56
- package/build/lib/feffery_utils_components/FefferyWheelColorPicker.py +0 -47
- package/build/lib/feffery_utils_components/FefferyWindowSize.py +0 -45
- package/build/lib/feffery_utils_components/__init__.py +0 -89
- package/build/lib/feffery_utils_components/_imports_.py +0 -83
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +0 -429
- package/build/lib/feffery_utils_components/metadata.json +0 -4510
- package/build/lib/feffery_utils_components/package-info.json +0 -98
|
@@ -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.30"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferyblockcolorpicker.jl")
|
|
9
9
|
include("jl/''_fefferycirclecolorpicker.jl")
|
|
@@ -18,6 +18,7 @@ include("jl/''_fefferyrawhtml.jl")
|
|
|
18
18
|
include("jl/''_fefferysettitle.jl")
|
|
19
19
|
include("jl/''_fefferycaptcha.jl")
|
|
20
20
|
include("jl/''_fefferycountdown.jl")
|
|
21
|
+
include("jl/''_fefferydiv.jl")
|
|
21
22
|
include("jl/''_fefferyexecutejs.jl")
|
|
22
23
|
include("jl/''_fefferyextraspinner.jl")
|
|
23
24
|
include("jl/''_fefferyfancymessage.jl")
|
|
@@ -27,14 +28,15 @@ include("jl/''_fefferyhighlightwords.jl")
|
|
|
27
28
|
include("jl/''_fefferylazyload.jl")
|
|
28
29
|
include("jl/''_fefferylocation.jl")
|
|
29
30
|
include("jl/''_fefferyqrcode.jl")
|
|
31
|
+
include("jl/''_fefferyreload.jl")
|
|
30
32
|
include("jl/''_fefferyscroll.jl")
|
|
31
33
|
include("jl/''_fefferyscrollbars.jl")
|
|
32
34
|
include("jl/''_fefferyshortcutpanel.jl")
|
|
35
|
+
include("jl/''_fefferystyle.jl")
|
|
33
36
|
include("jl/''_fefferysyntaxhighlighter.jl")
|
|
34
37
|
include("jl/''_fefferytimeout.jl")
|
|
35
38
|
include("jl/''_fefferytopprogress.jl")
|
|
36
39
|
include("jl/''_fefferyvirtuallist.jl")
|
|
37
|
-
include("jl/''_fefferydiv.jl")
|
|
38
40
|
include("jl/''_fefferydocumentvisibility.jl")
|
|
39
41
|
include("jl/''_fefferygeolocation.jl")
|
|
40
42
|
include("jl/''_fefferyidle.jl")
|
|
@@ -56,14 +58,14 @@ function __init__()
|
|
|
56
58
|
[
|
|
57
59
|
DashBase.Resource(
|
|
58
60
|
relative_package_path = "feffery_utils_components.min.js",
|
|
59
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
61
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.30/feffery_utils_components/feffery_utils_components.min.js",
|
|
60
62
|
dynamic = nothing,
|
|
61
63
|
async = nothing,
|
|
62
64
|
type = :js
|
|
63
65
|
),
|
|
64
66
|
DashBase.Resource(
|
|
65
67
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
66
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
68
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.30/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
67
69
|
dynamic = true,
|
|
68
70
|
async = nothing,
|
|
69
71
|
type = :js
|
package/src/jl/''_fefferydiv.jl
CHANGED
|
@@ -15,6 +15,7 @@ Keyword arguments:
|
|
|
15
15
|
- `id` (String; optional)
|
|
16
16
|
- `_height` (Real; optional)
|
|
17
17
|
- `_width` (Real; optional)
|
|
18
|
+
- `appendChild` (a list of or a singular dash component, string or number; optional)
|
|
18
19
|
- `className` (String | Dict; optional)
|
|
19
20
|
- `clickAwayCount` (Real; optional)
|
|
20
21
|
- `contextMenuEvent` (optional): . contextMenuEvent has the following type: lists containing elements 'pageX', 'pageY', 'timestamp'.
|
|
@@ -23,8 +24,14 @@ Those elements have the following types:
|
|
|
23
24
|
- `pageY` (Real; optional)
|
|
24
25
|
- `timestamp` (Real; optional)
|
|
25
26
|
- `debounceWait` (Real; optional)
|
|
27
|
+
- `deleteChildIndex` (Real; optional)
|
|
26
28
|
- `enableListenContextMenu` (Bool; optional)
|
|
29
|
+
- `insertChild` (optional): . insertChild has the following type: lists containing elements 'index', 'element'.
|
|
30
|
+
Those elements have the following types:
|
|
31
|
+
- `index` (Real; optional)
|
|
32
|
+
- `element` (a list of or a singular dash component, string or number; optional)
|
|
27
33
|
- `isHovering` (Bool; optional)
|
|
34
|
+
- `key` (String; optional)
|
|
28
35
|
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
29
36
|
Those elements have the following types:
|
|
30
37
|
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
@@ -34,10 +41,14 @@ Those elements have the following types:
|
|
|
34
41
|
- `mouseLeaveCount` (Real; optional)
|
|
35
42
|
- `nClicks` (Real; optional)
|
|
36
43
|
- `nDoubleClicks` (Real; optional)
|
|
44
|
+
- `replaceChild` (optional): . replaceChild has the following type: lists containing elements 'index', 'element'.
|
|
45
|
+
Those elements have the following types:
|
|
46
|
+
- `index` (Real; optional)
|
|
47
|
+
- `element` (a list of or a singular dash component, string or number; optional)
|
|
37
48
|
- `style` (Dict; optional)
|
|
38
49
|
"""
|
|
39
50
|
function ''_fefferydiv(; kwargs...)
|
|
40
|
-
available_props = Symbol[:children, :id, :_height, :_width, :className, :clickAwayCount, :contextMenuEvent, :debounceWait, :enableListenContextMenu, :isHovering, :loading_state, :mouseEnterCount, :mouseLeaveCount, :nClicks, :nDoubleClicks, :style]
|
|
51
|
+
available_props = Symbol[:children, :id, :_height, :_width, :appendChild, :className, :clickAwayCount, :contextMenuEvent, :debounceWait, :deleteChildIndex, :enableListenContextMenu, :insertChild, :isHovering, :key, :loading_state, :mouseEnterCount, :mouseLeaveCount, :nClicks, :nDoubleClicks, :replaceChild, :style]
|
|
41
52
|
wild_props = Symbol[]
|
|
42
53
|
return Component("''_fefferydiv", "FefferyDiv", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
43
54
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyreload
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyreload(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyReload component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (String; optional)
|
|
12
|
+
- `delay` (Real; 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
|
+
- `reload` (Bool; optional)
|
|
19
|
+
"""
|
|
20
|
+
function ''_fefferyreload(; kwargs...)
|
|
21
|
+
available_props = Symbol[:id, :delay, :loading_state, :reload]
|
|
22
|
+
wild_props = Symbol[]
|
|
23
|
+
return Component("''_fefferyreload", "FefferyReload", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
24
|
+
end
|
|
25
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferystyle
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferystyle(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyStyle component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (String; optional)
|
|
12
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
13
|
+
Those elements have the following types:
|
|
14
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
15
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
16
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
17
|
+
- `rawStyle` (String; optional)
|
|
18
|
+
"""
|
|
19
|
+
function ''_fefferystyle(; kwargs...)
|
|
20
|
+
available_props = Symbol[:id, :loading_state, :rawStyle]
|
|
21
|
+
wild_props = Symbol[]
|
|
22
|
+
return Component("''_fefferystyle", "FefferyStyle", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -9,6 +9,7 @@ const FefferyDiv = (props) => {
|
|
|
9
9
|
// 取得必要属性或参数
|
|
10
10
|
const {
|
|
11
11
|
id,
|
|
12
|
+
key,
|
|
12
13
|
children,
|
|
13
14
|
style,
|
|
14
15
|
className,
|
|
@@ -19,6 +20,10 @@ const FefferyDiv = (props) => {
|
|
|
19
20
|
enableListenContextMenu,
|
|
20
21
|
debounceWait,
|
|
21
22
|
clickAwayCount,
|
|
23
|
+
appendChild,
|
|
24
|
+
insertChild,
|
|
25
|
+
replaceChild,
|
|
26
|
+
deleteChildIndex,
|
|
22
27
|
setProps,
|
|
23
28
|
loading_state
|
|
24
29
|
} = props;
|
|
@@ -27,6 +32,46 @@ const FefferyDiv = (props) => {
|
|
|
27
32
|
const size = useSize(ref);
|
|
28
33
|
const _isHovering = useHover(ref);
|
|
29
34
|
|
|
35
|
+
// 快捷children数组增删操作
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (children && appendChild) {
|
|
38
|
+
setProps({
|
|
39
|
+
children: children.concat(appendChild),
|
|
40
|
+
appendChild: null // 重置
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}, [appendChild])
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (children && insertChild && insertChild.index && insertChild.element) {
|
|
47
|
+
setProps({
|
|
48
|
+
children: children.slice(0, insertChild.index)
|
|
49
|
+
.concat([insertChild.element])
|
|
50
|
+
.concat(children.slice(insertChild.index)),
|
|
51
|
+
insertChild: null // 重置
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}, [insertChild])
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (children && replaceChild && replaceChild.index && replaceChild.element) {
|
|
58
|
+
children[replaceChild.index] = replaceChild.element
|
|
59
|
+
setProps({
|
|
60
|
+
children: children,
|
|
61
|
+
replaceChild: undefined // 重置
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}, [replaceChild])
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (children && deleteChildIndex) {
|
|
68
|
+
setProps({
|
|
69
|
+
children: children.filter((_, i) => i !== deleteChildIndex),
|
|
70
|
+
deleteChildIndex: undefined // 重置
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}, [deleteChildIndex])
|
|
74
|
+
|
|
30
75
|
// 防抖更新容器尺寸
|
|
31
76
|
const { run: updateWidthHeight } = useRequest(
|
|
32
77
|
(e) => {
|
|
@@ -63,11 +108,12 @@ const FefferyDiv = (props) => {
|
|
|
63
108
|
|
|
64
109
|
return <div
|
|
65
110
|
id={id}
|
|
111
|
+
key={key}
|
|
66
112
|
style={style}
|
|
67
113
|
className={
|
|
68
114
|
isString(className) ?
|
|
69
115
|
className :
|
|
70
|
-
useCss(className)
|
|
116
|
+
(className ? useCss(className) : undefined)
|
|
71
117
|
}
|
|
72
118
|
ref={ref}
|
|
73
119
|
onClick={() => setProps({ nClicks: nClicks + 1 })}
|
|
@@ -93,14 +139,38 @@ const FefferyDiv = (props) => {
|
|
|
93
139
|
</ div>;
|
|
94
140
|
}
|
|
95
141
|
|
|
96
|
-
|
|
97
142
|
// 定义参数或属性
|
|
98
143
|
FefferyDiv.propTypes = {
|
|
99
144
|
// 部件id
|
|
100
145
|
id: PropTypes.string,
|
|
101
146
|
|
|
147
|
+
key: PropTypes.string,
|
|
148
|
+
|
|
102
149
|
children: PropTypes.node,
|
|
103
150
|
|
|
151
|
+
// 快捷children数组增删参数,在有效值传入促使组件更新后会自动重置为undefined
|
|
152
|
+
// 用于快捷向children数组末尾追加新元素
|
|
153
|
+
appendChild: PropTypes.node,
|
|
154
|
+
|
|
155
|
+
// 用于快捷在原children数组第index个位置插入新元素
|
|
156
|
+
insertChild: PropTypes.exact({
|
|
157
|
+
// 要插入的位序
|
|
158
|
+
index: PropTypes.number,
|
|
159
|
+
// 要插入的元素
|
|
160
|
+
element: PropTypes.node
|
|
161
|
+
}),
|
|
162
|
+
|
|
163
|
+
// 用于快捷对children数组第index个位置的元素进行替换
|
|
164
|
+
replaceChild: PropTypes.exact({
|
|
165
|
+
// 要替换元素的位序
|
|
166
|
+
index: PropTypes.number,
|
|
167
|
+
// 要替换的新元素
|
|
168
|
+
element: PropTypes.node
|
|
169
|
+
}),
|
|
170
|
+
|
|
171
|
+
// 用于快捷删除原children第index个位置的元素
|
|
172
|
+
deleteChildIndex: PropTypes.number,
|
|
173
|
+
|
|
104
174
|
style: PropTypes.object,
|
|
105
175
|
|
|
106
176
|
className: PropTypes.oneOfType([
|
|
@@ -182,4 +252,4 @@ FefferyDiv.defaultProps = {
|
|
|
182
252
|
clickAwayCount: 0
|
|
183
253
|
}
|
|
184
254
|
|
|
185
|
-
export default FefferyDiv;
|
|
255
|
+
export default React.memo(FefferyDiv);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
// 定义页面重载组件FefferyReload
|
|
5
|
+
const FefferyReload = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
id,
|
|
8
|
+
reload,
|
|
9
|
+
delay,
|
|
10
|
+
setProps,
|
|
11
|
+
loading_state
|
|
12
|
+
} = props;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
// 执行页面重载操作
|
|
16
|
+
if (reload) {
|
|
17
|
+
if (delay) {
|
|
18
|
+
// 延时重载
|
|
19
|
+
setTimeout(
|
|
20
|
+
() => window.location.reload(),
|
|
21
|
+
delay
|
|
22
|
+
)
|
|
23
|
+
} else {
|
|
24
|
+
// 立即重载
|
|
25
|
+
window.location.reload()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [reload])
|
|
29
|
+
|
|
30
|
+
return <div
|
|
31
|
+
id={id}
|
|
32
|
+
data-dash-is-loading={
|
|
33
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
34
|
+
} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// 定义参数或属性
|
|
39
|
+
FefferyReload.propTypes = {
|
|
40
|
+
// 部件id
|
|
41
|
+
id: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
// 执行页面重载操作的标志,当设置为true时会进行页面重载
|
|
44
|
+
reload: PropTypes.bool,
|
|
45
|
+
|
|
46
|
+
// 设置重载执行的延时时长(单位:毫秒)
|
|
47
|
+
delay: PropTypes.number,
|
|
48
|
+
|
|
49
|
+
loading_state: PropTypes.shape({
|
|
50
|
+
/**
|
|
51
|
+
* Determines if the component is loading or not
|
|
52
|
+
*/
|
|
53
|
+
is_loading: PropTypes.bool,
|
|
54
|
+
/**
|
|
55
|
+
* Holds which property is loading
|
|
56
|
+
*/
|
|
57
|
+
prop_name: PropTypes.string,
|
|
58
|
+
/**
|
|
59
|
+
* Holds the name of the component that is loading
|
|
60
|
+
*/
|
|
61
|
+
component_name: PropTypes.string
|
|
62
|
+
}),
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Dash-assigned callback that should be called to report property changes
|
|
66
|
+
* to Dash, to make them available for callbacks.
|
|
67
|
+
*/
|
|
68
|
+
setProps: PropTypes.func,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// 设置默认参数
|
|
72
|
+
FefferyReload.defaultProps = {
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default FefferyReload;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
// 定义动态样式组件FefferyStyle
|
|
4
|
+
const FefferyStyle = (props) => {
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
id,
|
|
8
|
+
rawStyle,
|
|
9
|
+
setProps,
|
|
10
|
+
loading_state
|
|
11
|
+
} = props;
|
|
12
|
+
|
|
13
|
+
return (<style
|
|
14
|
+
jsx
|
|
15
|
+
id={id}
|
|
16
|
+
data-dash-is-loading={
|
|
17
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
18
|
+
} >{rawStyle}</style>);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 定义参数或属性
|
|
22
|
+
FefferyStyle.propTypes = {
|
|
23
|
+
// 部件id
|
|
24
|
+
id: PropTypes.string,
|
|
25
|
+
|
|
26
|
+
rawStyle: PropTypes.string,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Dash-assigned callback that should be called to report property changes
|
|
30
|
+
* to Dash, to make them available for callbacks.
|
|
31
|
+
*/
|
|
32
|
+
setProps: PropTypes.func,
|
|
33
|
+
|
|
34
|
+
loading_state: PropTypes.shape({
|
|
35
|
+
/**
|
|
36
|
+
* Determines if the component is loading or not
|
|
37
|
+
*/
|
|
38
|
+
is_loading: PropTypes.bool,
|
|
39
|
+
/**
|
|
40
|
+
* Holds which property is loading
|
|
41
|
+
*/
|
|
42
|
+
prop_name: PropTypes.string,
|
|
43
|
+
/**
|
|
44
|
+
* Holds the name of the component that is loading
|
|
45
|
+
*/
|
|
46
|
+
component_name: PropTypes.string
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// 设置默认参数
|
|
51
|
+
FefferyStyle.defaultProps = {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default React.memo(FefferyStyle);
|
package/src/lib/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import FefferyExtraSpinner from "./components/FefferyExtraSpinner.react";
|
|
|
13
13
|
import FefferyLazyLoad from "./components/FefferyLazyLoad.react";
|
|
14
14
|
import FefferyVirtualList from "./components/FefferyVirtualList.react";
|
|
15
15
|
import FefferyLocation from "./components/FefferyLocation.react";
|
|
16
|
-
import FefferyDiv from "./components/listeners/FefferyDiv.react";
|
|
17
16
|
import FefferyInViewport from "./components/listeners/FefferyInViewport.react";
|
|
18
17
|
import FefferyHexColorPicker from "./components/colorPickers/FefferyHexColorPicker.react";
|
|
19
18
|
import FefferyRgbColorPicker from "./components/colorPickers/FefferyRgbColorPicker.react";
|
|
@@ -40,6 +39,9 @@ import FefferyRawHTML from "./components/dom/FefferyRawHTML.react";
|
|
|
40
39
|
import FefferyFancyNotification from "./components/FefferyFancyNotification";
|
|
41
40
|
import FefferyQRCode from "./components/FefferyQrcode.react";
|
|
42
41
|
import FefferyFancyMessage from "./components/FefferyFancyMessage";
|
|
42
|
+
import FefferyStyle from "./components/FefferyStyle.react";
|
|
43
|
+
import FefferyDiv from "./components/FefferyDiv.react";
|
|
44
|
+
import FefferyReload from "./components/FefferyReload.react";
|
|
43
45
|
|
|
44
46
|
/*
|
|
45
47
|
忽略部分设计React中规范的console警告信息
|
|
@@ -75,7 +77,6 @@ export {
|
|
|
75
77
|
FefferyScroll,
|
|
76
78
|
FefferyScrollbars,
|
|
77
79
|
FefferyExtraSpinner,
|
|
78
|
-
FefferyDiv,
|
|
79
80
|
FefferyLazyLoad,
|
|
80
81
|
FefferyVirtualList,
|
|
81
82
|
FefferyLocation,
|
|
@@ -104,5 +105,8 @@ export {
|
|
|
104
105
|
FefferyRawHTML,
|
|
105
106
|
FefferyFancyNotification,
|
|
106
107
|
FefferyQRCode,
|
|
107
|
-
FefferyFancyMessage
|
|
108
|
+
FefferyFancyMessage,
|
|
109
|
+
FefferyStyle,
|
|
110
|
+
FefferyDiv,
|
|
111
|
+
FefferyReload
|
|
108
112
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
if True:
|
|
2
|
+
import sys
|
|
3
|
+
sys.path.append('../..')
|
|
4
|
+
import dash
|
|
5
|
+
import json
|
|
6
|
+
from dash import html
|
|
7
|
+
import feffery_utils_components as fuc
|
|
8
|
+
from dash.dependencies import Input, Output
|
|
9
|
+
|
|
10
|
+
app = dash.Dash(__name__)
|
|
11
|
+
|
|
12
|
+
app.layout = html.Div(
|
|
13
|
+
[
|
|
14
|
+
html.Button(
|
|
15
|
+
'立即重载',
|
|
16
|
+
id='reload'
|
|
17
|
+
),
|
|
18
|
+
|
|
19
|
+
html.Button(
|
|
20
|
+
'延时3秒重载',
|
|
21
|
+
id='reload-delay'
|
|
22
|
+
),
|
|
23
|
+
|
|
24
|
+
fuc.FefferyReload(
|
|
25
|
+
id='reload-demo'
|
|
26
|
+
),
|
|
27
|
+
|
|
28
|
+
fuc.FefferyReload(
|
|
29
|
+
id='reload-delay-demo',
|
|
30
|
+
delay=3000
|
|
31
|
+
)
|
|
32
|
+
],
|
|
33
|
+
style={
|
|
34
|
+
'padding': '20px',
|
|
35
|
+
'height': '100vh'
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.callback(
|
|
41
|
+
Output('reload-demo', 'reload'),
|
|
42
|
+
Input('reload', 'n_clicks'),
|
|
43
|
+
prevent_initial_call=True
|
|
44
|
+
)
|
|
45
|
+
def reload(n_clicks):
|
|
46
|
+
|
|
47
|
+
return True
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@app.callback(
|
|
51
|
+
Output('reload-delay-demo', 'reload'),
|
|
52
|
+
Input('reload-delay', 'n_clicks'),
|
|
53
|
+
prevent_initial_call=True
|
|
54
|
+
)
|
|
55
|
+
def reload_delay(n_clicks):
|
|
56
|
+
|
|
57
|
+
return True
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == '__main__':
|
|
61
|
+
app.run(debug=True)
|
package/usage.py
CHANGED
|
@@ -6,27 +6,21 @@ app = dash.Dash(__name__)
|
|
|
6
6
|
|
|
7
7
|
app.layout = html.Div(
|
|
8
8
|
[
|
|
9
|
-
fuc.
|
|
10
|
-
showLineNumbers=True,
|
|
11
|
-
language='python',
|
|
12
|
-
codeString="""
|
|
13
|
-
fac.AntdDivider(
|
|
14
|
-
'默认linkTarget="_blank"',
|
|
15
|
-
innerTextOrientation='left'
|
|
16
|
-
),
|
|
17
|
-
fmc.FefferyMarkdown(
|
|
18
|
-
markdownStr='''[fac官网](http://fac.feffery.tech/)'''
|
|
19
|
-
),
|
|
9
|
+
fuc.FefferyDiv(),
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
html.Div(
|
|
12
|
+
className='demo-div'
|
|
13
|
+
),
|
|
14
|
+
|
|
15
|
+
fuc.FefferyStyle(
|
|
16
|
+
rawStyle='''
|
|
17
|
+
.demo-div {
|
|
18
|
+
width: 200px;
|
|
19
|
+
height: 200px;
|
|
20
|
+
background: green;
|
|
21
|
+
border: 5px dashed red;
|
|
22
|
+
}
|
|
23
|
+
'''
|
|
30
24
|
)
|
|
31
25
|
]
|
|
32
26
|
)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
-
|
|
3
|
-
from dash.development.base_component import Component, _explicitize_args
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FefferyBlockColorPicker(Component):
|
|
7
|
-
"""A FefferyBlockColorPicker component.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Keyword arguments:
|
|
11
|
-
|
|
12
|
-
- id (string; optional)
|
|
13
|
-
|
|
14
|
-
- className (string; optional)
|
|
15
|
-
|
|
16
|
-
- color (string; optional)
|
|
17
|
-
|
|
18
|
-
- colors (list of strings; default ['#D9E3F0', '#F47373', '#697689', '#37D67A', '#2CCCE4', '#555555', '#dce775', '#ff8a65', '#ba68c8'])
|
|
19
|
-
|
|
20
|
-
- loading_state (dict; optional)
|
|
21
|
-
|
|
22
|
-
`loading_state` is a dict with keys:
|
|
23
|
-
|
|
24
|
-
- component_name (string; optional):
|
|
25
|
-
Holds the name of the component that is loading.
|
|
26
|
-
|
|
27
|
-
- is_loading (boolean; optional):
|
|
28
|
-
Determines if the component is loading or not.
|
|
29
|
-
|
|
30
|
-
- prop_name (string; optional):
|
|
31
|
-
Holds which property is loading.
|
|
32
|
-
|
|
33
|
-
- style (dict; optional)
|
|
34
|
-
|
|
35
|
-
- triangle (a value equal to: 'hide', 'top'; default 'top')
|
|
36
|
-
|
|
37
|
-
- width (string; default '170px')"""
|
|
38
|
-
_children_props = []
|
|
39
|
-
_base_nodes = ['children']
|
|
40
|
-
_namespace = 'feffery_utils_components'
|
|
41
|
-
_type = 'FefferyBlockColorPicker'
|
|
42
|
-
@_explicitize_args
|
|
43
|
-
def __init__(self, id=Component.UNDEFINED, className=Component.UNDEFINED, style=Component.UNDEFINED, width=Component.UNDEFINED, color=Component.UNDEFINED, colors=Component.UNDEFINED, triangle=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
|
|
44
|
-
self._prop_names = ['id', 'className', 'color', 'colors', 'loading_state', 'style', 'triangle', 'width']
|
|
45
|
-
self._valid_wildcard_attributes = []
|
|
46
|
-
self.available_properties = ['id', 'className', 'color', 'colors', 'loading_state', 'style', 'triangle', 'width']
|
|
47
|
-
self.available_wildcard_properties = []
|
|
48
|
-
_explicit_args = kwargs.pop('_explicit_args')
|
|
49
|
-
_locals = locals()
|
|
50
|
-
_locals.update(kwargs) # For wildcard attrs and excess named props
|
|
51
|
-
args = {k: _locals[k] for k in _explicit_args}
|
|
52
|
-
|
|
53
|
-
super(FefferyBlockColorPicker, self).__init__(**args)
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
-
|
|
3
|
-
from dash.development.base_component import Component, _explicitize_args
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FefferyCaptcha(Component):
|
|
7
|
-
"""A FefferyCaptcha component.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Keyword arguments:
|
|
11
|
-
|
|
12
|
-
- id (string; optional)
|
|
13
|
-
|
|
14
|
-
- bgColor (string; optional)
|
|
15
|
-
|
|
16
|
-
- captcha (string; optional)
|
|
17
|
-
|
|
18
|
-
- charNum (number; default 4)
|
|
19
|
-
|
|
20
|
-
- className (string; optional)
|
|
21
|
-
|
|
22
|
-
- fontSize (number; optional)
|
|
23
|
-
|
|
24
|
-
- height (number; optional)
|
|
25
|
-
|
|
26
|
-
- loading_state (dict; optional)
|
|
27
|
-
|
|
28
|
-
`loading_state` is a dict with keys:
|
|
29
|
-
|
|
30
|
-
- component_name (string; optional):
|
|
31
|
-
Holds the name of the component that is loading.
|
|
32
|
-
|
|
33
|
-
- is_loading (boolean; optional):
|
|
34
|
-
Determines if the component is loading or not.
|
|
35
|
-
|
|
36
|
-
- prop_name (string; optional):
|
|
37
|
-
Holds which property is loading.
|
|
38
|
-
|
|
39
|
-
- refresh (boolean; optional)
|
|
40
|
-
|
|
41
|
-
- style (dict; optional)
|
|
42
|
-
|
|
43
|
-
- width (number; optional)"""
|
|
44
|
-
_children_props = []
|
|
45
|
-
_base_nodes = ['children']
|
|
46
|
-
_namespace = 'feffery_utils_components'
|
|
47
|
-
_type = 'FefferyCaptcha'
|
|
48
|
-
@_explicitize_args
|
|
49
|
-
def __init__(self, id=Component.UNDEFINED, className=Component.UNDEFINED, style=Component.UNDEFINED, captcha=Component.UNDEFINED, charNum=Component.UNDEFINED, height=Component.UNDEFINED, width=Component.UNDEFINED, bgColor=Component.UNDEFINED, fontSize=Component.UNDEFINED, refresh=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
|
|
50
|
-
self._prop_names = ['id', 'bgColor', 'captcha', 'charNum', 'className', 'fontSize', 'height', 'loading_state', 'refresh', 'style', 'width']
|
|
51
|
-
self._valid_wildcard_attributes = []
|
|
52
|
-
self.available_properties = ['id', 'bgColor', 'captcha', 'charNum', 'className', 'fontSize', 'height', 'loading_state', 'refresh', 'style', 'width']
|
|
53
|
-
self.available_wildcard_properties = []
|
|
54
|
-
_explicit_args = kwargs.pop('_explicit_args')
|
|
55
|
-
_locals = locals()
|
|
56
|
-
_locals.update(kwargs) # For wildcard attrs and excess named props
|
|
57
|
-
args = {k: _locals[k] for k in _explicit_args}
|
|
58
|
-
|
|
59
|
-
super(FefferyCaptcha, self).__init__(**args)
|