feffery_utils_components 0.0.31 → 0.0.32
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 +6 -4
- package/Project.toml +1 -1
- package/build/lib/feffery_utils_components/FefferyCssVar.py +43 -0
- package/build/lib/feffery_utils_components/FefferyEyeDropper.py +45 -0
- package/build/lib/feffery_utils_components/_imports_.py +4 -0
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +2 -2
- package/build/lib/feffery_utils_components/metadata.json +115 -0
- package/build/lib/feffery_utils_components/package-info.json +3 -2
- package/feffery_utils_components/FefferyDiv.py +5 -3
- package/feffery_utils_components/FefferyLazyLoadImage.py +53 -0
- package/feffery_utils_components/FefferySticky.py +51 -0
- package/feffery_utils_components/_imports_.py +12 -8
- package/feffery_utils_components/feffery_utils_components.min.js +8 -8
- package/feffery_utils_components/metadata.json +573 -333
- package/feffery_utils_components/package-info.json +3 -1
- package/package.json +3 -1
- package/src/FefferyUtilsComponents.jl +9 -7
- package/src/jl/''_fefferydiv.jl +2 -1
- package/src/jl/''_fefferylazyloadimage.jl +29 -0
- package/src/jl/''_fefferysticky.jl +34 -0
- package/src/lib/components/FefferyDiv.react.js +16 -2
- package/src/lib/components/{dom/FefferyExternalCss.react.js → FefferyExternalCss.react.js} +0 -0
- package/src/lib/components/{dom/FefferyExternalJs.react.js → FefferyExternalJs.react.js} +0 -0
- package/src/lib/components/FefferyLazyLoadImage.react.js +92 -0
- package/src/lib/components/{dom/FefferyRawHTML.react.js → FefferyRawHTML.react.js} +0 -0
- package/src/lib/components/{dom/FefferySetTitle.react.js → FefferySetTitle.react.js} +0 -0
- package/src/lib/components/FefferySticky.react.js +93 -0
- package/src/lib/components/styles.css +13 -0
- package/src/lib/index.js +9 -5
- package/tests/FefferyLazyLoadImageTest/app.py +33 -0
- package/tests/FefferyStickyTest/app.py +41 -0
- package/usage.py +0 -47
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
"react-highlight-words": "^0.18.0",
|
|
43
43
|
"react-hot-toast": "^2.4.0",
|
|
44
44
|
"react-lazy-load": "^3.1.14",
|
|
45
|
+
"react-lazy-load-image-component": "^1.5.5",
|
|
45
46
|
"react-resize-detector": "^7.1.2",
|
|
46
47
|
"react-scroll": "^1.8.6",
|
|
47
48
|
"react-sortable-hoc": "^2.0.0",
|
|
48
49
|
"react-spinners-kit": "^1.9.1",
|
|
49
50
|
"react-split": "^2.0.14",
|
|
51
|
+
"react-stickynode": "^4.1.0",
|
|
50
52
|
"react-syntax-highlighter": "^15.4.4",
|
|
51
53
|
"react-toastify": "9.0.3",
|
|
52
54
|
"react-use": "^17.4.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
"react-highlight-words": "^0.18.0",
|
|
43
43
|
"react-hot-toast": "^2.4.0",
|
|
44
44
|
"react-lazy-load": "^3.1.14",
|
|
45
|
+
"react-lazy-load-image-component": "^1.5.5",
|
|
45
46
|
"react-resize-detector": "^7.1.2",
|
|
46
47
|
"react-scroll": "^1.8.6",
|
|
47
48
|
"react-sortable-hoc": "^2.0.0",
|
|
48
49
|
"react-spinners-kit": "^1.9.1",
|
|
49
50
|
"react-split": "^2.0.14",
|
|
51
|
+
"react-stickynode": "^4.1.0",
|
|
50
52
|
"react-syntax-highlighter": "^15.4.4",
|
|
51
53
|
"react-toastify": "9.0.3",
|
|
52
54
|
"react-use": "^17.4.0",
|
|
@@ -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.32"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferyblockcolorpicker.jl")
|
|
9
9
|
include("jl/''_fefferycirclecolorpicker.jl")
|
|
@@ -12,15 +12,13 @@ include("jl/''_fefferyhexcolorpicker.jl")
|
|
|
12
12
|
include("jl/''_fefferyrgbcolorpicker.jl")
|
|
13
13
|
include("jl/''_fefferytwittercolorpicker.jl")
|
|
14
14
|
include("jl/''_fefferywheelcolorpicker.jl")
|
|
15
|
-
include("jl/''_fefferyexternalcss.jl")
|
|
16
|
-
include("jl/''_fefferyexternaljs.jl")
|
|
17
|
-
include("jl/''_fefferyrawhtml.jl")
|
|
18
|
-
include("jl/''_fefferysettitle.jl")
|
|
19
15
|
include("jl/''_fefferycaptcha.jl")
|
|
20
16
|
include("jl/''_fefferycountdown.jl")
|
|
21
17
|
include("jl/''_fefferycssvar.jl")
|
|
22
18
|
include("jl/''_fefferydiv.jl")
|
|
23
19
|
include("jl/''_fefferyexecutejs.jl")
|
|
20
|
+
include("jl/''_fefferyexternalcss.jl")
|
|
21
|
+
include("jl/''_fefferyexternaljs.jl")
|
|
24
22
|
include("jl/''_fefferyextraspinner.jl")
|
|
25
23
|
include("jl/''_fefferyeyedropper.jl")
|
|
26
24
|
include("jl/''_fefferyfancymessage.jl")
|
|
@@ -28,12 +26,16 @@ include("jl/''_fefferyfancynotification.jl")
|
|
|
28
26
|
include("jl/''_fefferyguide.jl")
|
|
29
27
|
include("jl/''_fefferyhighlightwords.jl")
|
|
30
28
|
include("jl/''_fefferylazyload.jl")
|
|
29
|
+
include("jl/''_fefferylazyloadimage.jl")
|
|
31
30
|
include("jl/''_fefferylocation.jl")
|
|
32
31
|
include("jl/''_fefferyqrcode.jl")
|
|
32
|
+
include("jl/''_fefferyrawhtml.jl")
|
|
33
33
|
include("jl/''_fefferyreload.jl")
|
|
34
34
|
include("jl/''_fefferyscroll.jl")
|
|
35
35
|
include("jl/''_fefferyscrollbars.jl")
|
|
36
|
+
include("jl/''_fefferysettitle.jl")
|
|
36
37
|
include("jl/''_fefferyshortcutpanel.jl")
|
|
38
|
+
include("jl/''_fefferysticky.jl")
|
|
37
39
|
include("jl/''_fefferystyle.jl")
|
|
38
40
|
include("jl/''_fefferysyntaxhighlighter.jl")
|
|
39
41
|
include("jl/''_fefferytimeout.jl")
|
|
@@ -60,14 +62,14 @@ function __init__()
|
|
|
60
62
|
[
|
|
61
63
|
DashBase.Resource(
|
|
62
64
|
relative_package_path = "feffery_utils_components.min.js",
|
|
63
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
65
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.32/feffery_utils_components/feffery_utils_components.min.js",
|
|
64
66
|
dynamic = nothing,
|
|
65
67
|
async = nothing,
|
|
66
68
|
type = :js
|
|
67
69
|
),
|
|
68
70
|
DashBase.Resource(
|
|
69
71
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
70
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
72
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.32/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
71
73
|
dynamic = true,
|
|
72
74
|
async = nothing,
|
|
73
75
|
type = :js
|
package/src/jl/''_fefferydiv.jl
CHANGED
|
@@ -45,10 +45,11 @@ Those elements have the following types:
|
|
|
45
45
|
Those elements have the following types:
|
|
46
46
|
- `index` (Real; optional)
|
|
47
47
|
- `element` (a list of or a singular dash component, string or number; optional)
|
|
48
|
+
- `shadow` (a value equal to: 'no-shadow', 'hover-shadow', 'always-shadow'; optional)
|
|
48
49
|
- `style` (Dict; optional)
|
|
49
50
|
"""
|
|
50
51
|
function ''_fefferydiv(; kwargs...)
|
|
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]
|
|
52
|
+
available_props = Symbol[:children, :id, :_height, :_width, :appendChild, :className, :clickAwayCount, :contextMenuEvent, :debounceWait, :deleteChildIndex, :enableListenContextMenu, :insertChild, :isHovering, :key, :loading_state, :mouseEnterCount, :mouseLeaveCount, :nClicks, :nDoubleClicks, :replaceChild, :shadow, :style]
|
|
52
53
|
wild_props = Symbol[]
|
|
53
54
|
return Component("''_fefferydiv", "FefferyDiv", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
54
55
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferylazyloadimage
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferylazyloadimage(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyLazyLoadImage component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (String; optional)
|
|
12
|
+
- `alt` (String; optional)
|
|
13
|
+
- `height` (String | Real; optional)
|
|
14
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
15
|
+
Those elements have the following types:
|
|
16
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
17
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
18
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
19
|
+
- `placeholderSrc` (String; optional)
|
|
20
|
+
- `src` (String; optional)
|
|
21
|
+
- `threshold` (Real; optional)
|
|
22
|
+
- `width` (String | Real; optional)
|
|
23
|
+
"""
|
|
24
|
+
function ''_fefferylazyloadimage(; kwargs...)
|
|
25
|
+
available_props = Symbol[:id, :alt, :height, :loading_state, :placeholderSrc, :src, :threshold, :width]
|
|
26
|
+
wild_props = Symbol[]
|
|
27
|
+
return Component("''_fefferylazyloadimage", "FefferyLazyLoadImage", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferysticky
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferysticky(;kwargs...)
|
|
7
|
+
''_fefferysticky(children::Any;kwargs...)
|
|
8
|
+
''_fefferysticky(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferySticky component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional)
|
|
15
|
+
- `id` (String; optional)
|
|
16
|
+
- `bottomBoundary` (Real | String; optional)
|
|
17
|
+
- `enabled` (Bool; 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
|
+
- `top` (Real | String; optional)
|
|
24
|
+
- `zIndex` (Real | String; optional)
|
|
25
|
+
"""
|
|
26
|
+
function ''_fefferysticky(; kwargs...)
|
|
27
|
+
available_props = Symbol[:children, :id, :bottomBoundary, :enabled, :loading_state, :top, :zIndex]
|
|
28
|
+
wild_props = Symbol[]
|
|
29
|
+
return Component("''_fefferysticky", "FefferySticky", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
''_fefferysticky(children::Any; kwargs...) = ''_fefferysticky(;kwargs..., children = children)
|
|
33
|
+
''_fefferysticky(children_maker::Function; kwargs...) = ''_fefferysticky(children_maker(); kwargs...)
|
|
34
|
+
|
|
@@ -3,11 +3,12 @@ import { useCss } from 'react-use';
|
|
|
3
3
|
import { isString } from 'lodash';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useSize, useRequest, useHover, useClickAway } from 'ahooks';
|
|
6
|
+
import './styles.css'
|
|
6
7
|
|
|
7
8
|
// 定义进阶div容器组件FefferyDiv
|
|
8
9
|
const FefferyDiv = (props) => {
|
|
9
10
|
// 取得必要属性或参数
|
|
10
|
-
|
|
11
|
+
let {
|
|
11
12
|
id,
|
|
12
13
|
key,
|
|
13
14
|
children,
|
|
@@ -24,6 +25,7 @@ const FefferyDiv = (props) => {
|
|
|
24
25
|
insertChild,
|
|
25
26
|
replaceChild,
|
|
26
27
|
deleteChildIndex,
|
|
28
|
+
shadow,
|
|
27
29
|
setProps,
|
|
28
30
|
loading_state
|
|
29
31
|
} = props;
|
|
@@ -106,6 +108,13 @@ const FefferyDiv = (props) => {
|
|
|
106
108
|
setProps({ clickAwayCount: clickAwayCount + 1 })
|
|
107
109
|
}, ref);
|
|
108
110
|
|
|
111
|
+
// 根据shadow参数预处理className
|
|
112
|
+
if (shadow === 'hover-shadow') {
|
|
113
|
+
className = className ? `${className} feffery-div-hover-shadow` : 'feffery-div-hover-shadow'
|
|
114
|
+
} else if (shadow === 'always-shadow') {
|
|
115
|
+
className = className ? `${className} feffery-div-always-shadow` : 'feffery-div-always-shadow'
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
return <div
|
|
110
119
|
id={id}
|
|
111
120
|
key={key}
|
|
@@ -219,6 +228,10 @@ FefferyDiv.propTypes = {
|
|
|
219
228
|
// 监听元素外点击事件发生次数,默认为0
|
|
220
229
|
clickAwayCount: PropTypes.number,
|
|
221
230
|
|
|
231
|
+
// 设置当前容器的快捷阴影效果,可选的有'no-shadow'、'hover-shadow'、'always-shadow'
|
|
232
|
+
// 默认为'no-shadow'
|
|
233
|
+
shadow: PropTypes.oneOf(['no-shadow', 'hover-shadow', 'always-shadow']),
|
|
234
|
+
|
|
222
235
|
/**
|
|
223
236
|
* Dash-assigned callback that should be called to report property changes
|
|
224
237
|
* to Dash, to make them available for callbacks.
|
|
@@ -249,7 +262,8 @@ FefferyDiv.defaultProps = {
|
|
|
249
262
|
nDoubleClicks: 0,
|
|
250
263
|
enableListenContextMenu: false,
|
|
251
264
|
debounceWait: 150,
|
|
252
|
-
clickAwayCount: 0
|
|
265
|
+
clickAwayCount: 0,
|
|
266
|
+
shadow: 'no-shadow'
|
|
253
267
|
}
|
|
254
268
|
|
|
255
269
|
export default React.memo(FefferyDiv);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LazyLoadImage } from 'react-lazy-load-image-component';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import 'react-lazy-load-image-component/src/effects/opacity.css';
|
|
5
|
+
|
|
6
|
+
// 定义图片懒加载组件FefferyLazyLoadImage
|
|
7
|
+
const FefferyLazyLoadImage = (props) => {
|
|
8
|
+
// 取得必要属性或参数
|
|
9
|
+
const {
|
|
10
|
+
id,
|
|
11
|
+
alt,
|
|
12
|
+
height,
|
|
13
|
+
width,
|
|
14
|
+
src,
|
|
15
|
+
placeholderSrc,
|
|
16
|
+
threshold,
|
|
17
|
+
setProps,
|
|
18
|
+
loading_state
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
return <LazyLoadImage
|
|
22
|
+
id={id}
|
|
23
|
+
alt={alt}
|
|
24
|
+
height={height}
|
|
25
|
+
width={width}
|
|
26
|
+
src={src}
|
|
27
|
+
placeholderSrc={placeholderSrc}
|
|
28
|
+
threshold={threshold}
|
|
29
|
+
effect={'opacity'}
|
|
30
|
+
data-dash-is-loading={
|
|
31
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
32
|
+
} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 定义参数或属性
|
|
36
|
+
FefferyLazyLoadImage.propTypes = {
|
|
37
|
+
// 部件id
|
|
38
|
+
id: PropTypes.string,
|
|
39
|
+
|
|
40
|
+
// 设置图片alt信息
|
|
41
|
+
alt: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
// 设置图片高度
|
|
44
|
+
height: PropTypes.oneOfType([
|
|
45
|
+
PropTypes.string,
|
|
46
|
+
PropTypes.number
|
|
47
|
+
]),
|
|
48
|
+
|
|
49
|
+
// 设置图片宽度
|
|
50
|
+
width: PropTypes.oneOfType([
|
|
51
|
+
PropTypes.string,
|
|
52
|
+
PropTypes.number
|
|
53
|
+
]),
|
|
54
|
+
|
|
55
|
+
// 设置图片url地址
|
|
56
|
+
src: PropTypes.string,
|
|
57
|
+
|
|
58
|
+
// 图片未显示或加载失败时的占位图地址
|
|
59
|
+
placeholderSrc: PropTypes.string,
|
|
60
|
+
|
|
61
|
+
// 设置触发加载像素距离阈值,当图片未划入视口但距离视口低于此阈值时
|
|
62
|
+
// 开始触发加载延时倒计时,默认为100
|
|
63
|
+
threshold: PropTypes.number,
|
|
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
|
+
* Dash-assigned callback that should be called to report property changes
|
|
82
|
+
* to Dash, to make them available for callbacks.
|
|
83
|
+
*/
|
|
84
|
+
setProps: PropTypes.func,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// 设置默认参数
|
|
88
|
+
FefferyLazyLoadImage.defaultProps = {
|
|
89
|
+
threshold: 100
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default React.memo(FefferyLazyLoadImage);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import Sticky from 'react-stickynode';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
// 定义粘性布局组件FefferySticky
|
|
6
|
+
const FefferySticky = (props) => {
|
|
7
|
+
// 取得必要属性或参数
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
children,
|
|
11
|
+
enabled,
|
|
12
|
+
top,
|
|
13
|
+
bottomBoundary,
|
|
14
|
+
zIndex,
|
|
15
|
+
setProps,
|
|
16
|
+
loading_state
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
return <Sticky
|
|
20
|
+
id={id}
|
|
21
|
+
enabled={enabled}
|
|
22
|
+
top={top}
|
|
23
|
+
bottomBoundary={bottomBoundary}
|
|
24
|
+
innerZ={zIndex}
|
|
25
|
+
data-dash-is-loading={
|
|
26
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
27
|
+
} >
|
|
28
|
+
{children}
|
|
29
|
+
</ Sticky>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// 定义参数或属性
|
|
34
|
+
FefferySticky.propTypes = {
|
|
35
|
+
// 部件id
|
|
36
|
+
id: PropTypes.string,
|
|
37
|
+
|
|
38
|
+
children: PropTypes.node,
|
|
39
|
+
|
|
40
|
+
// 设置是否启用粘性布局效果,默认为true
|
|
41
|
+
enabled: PropTypes.bool,
|
|
42
|
+
|
|
43
|
+
// 用于设置触发粘性布局效果对应的顶部距离阈值
|
|
44
|
+
// 当传入字符型时,字符应为css选择器规则,则此时的顶部距离阈值
|
|
45
|
+
// 为选择器对应目标元素的高度
|
|
46
|
+
top: PropTypes.oneOfType([
|
|
47
|
+
PropTypes.number,
|
|
48
|
+
PropTypes.string
|
|
49
|
+
]),
|
|
50
|
+
|
|
51
|
+
// 设置粘性布局元素底部距离文档顶部的像素距离阈值,
|
|
52
|
+
// 当超出这个阈值范围时,粘性状态会被解除
|
|
53
|
+
// 当传入字符型时,字符应为css选择器规则,则此时当目标元素底部
|
|
54
|
+
// 到达粘性布局元素底部时,粘性状态会被解除
|
|
55
|
+
bottomBoundary: PropTypes.oneOfType([
|
|
56
|
+
PropTypes.number,
|
|
57
|
+
PropTypes.string
|
|
58
|
+
]),
|
|
59
|
+
|
|
60
|
+
// 设置粘性布局元素的z-index属性
|
|
61
|
+
zIndex: PropTypes.oneOfType([
|
|
62
|
+
PropTypes.number,
|
|
63
|
+
PropTypes.string
|
|
64
|
+
]),
|
|
65
|
+
|
|
66
|
+
loading_state: PropTypes.shape({
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the component is loading or not
|
|
69
|
+
*/
|
|
70
|
+
is_loading: PropTypes.bool,
|
|
71
|
+
/**
|
|
72
|
+
* Holds which property is loading
|
|
73
|
+
*/
|
|
74
|
+
prop_name: PropTypes.string,
|
|
75
|
+
/**
|
|
76
|
+
* Holds the name of the component that is loading
|
|
77
|
+
*/
|
|
78
|
+
component_name: PropTypes.string
|
|
79
|
+
}),
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Dash-assigned callback that should be called to report property changes
|
|
83
|
+
* to Dash, to make them available for callbacks.
|
|
84
|
+
*/
|
|
85
|
+
setProps: PropTypes.func,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// 设置默认参数
|
|
89
|
+
FefferySticky.defaultProps = {
|
|
90
|
+
enabled: true
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default React.memo(FefferySticky);
|
|
@@ -98,3 +98,16 @@
|
|
|
98
98
|
.sortable-helper {
|
|
99
99
|
box-shadow: 0 0 7px rgba(0, 0, 0, 0.15);
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
.feffery-div-always-shadow {
|
|
103
|
+
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.feffery-div-hover-shadow {
|
|
107
|
+
transition: box-shadow 0.3s ease-in-out;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.feffery-div-hover-shadow:hover {
|
|
111
|
+
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
|
112
|
+
transition: box-shadow 0.3s ease-in-out;
|
|
113
|
+
}
|
package/src/lib/index.js
CHANGED
|
@@ -23,9 +23,9 @@ import FefferyCircleColorPicker from "./components/colorPickers/FefferyCircleCol
|
|
|
23
23
|
import FefferyWheelColorPicker from "./components/colorPickers/FefferyWheelColorPicker.react";
|
|
24
24
|
import FefferyHighlightWords from "./components/FefferyHighlightWords.react";
|
|
25
25
|
import FefferyDocumentVisibility from "./components/listeners/FefferyDocumentVisibility.react";
|
|
26
|
-
import FefferyExternalCss from "./components/
|
|
27
|
-
import FefferyExternalJs from "./components/
|
|
28
|
-
import FefferySetTitle from "./components/
|
|
26
|
+
import FefferyExternalCss from "./components/FefferyExternalCss.react";
|
|
27
|
+
import FefferyExternalJs from "./components/FefferyExternalJs.react";
|
|
28
|
+
import FefferySetTitle from "./components/FefferySetTitle.react";
|
|
29
29
|
import FefferyResponsive from "./components/listeners/FefferyResponsive.react";
|
|
30
30
|
import FefferyGeolocation from "./components/listeners/FefferyGeolocation.react";
|
|
31
31
|
import FefferyIdle from "./components/listeners/FefferyIdle.react";
|
|
@@ -35,7 +35,7 @@ import FefferyTimeout from "./components/FefferyTimeout.react";
|
|
|
35
35
|
import FefferyCountDown from "./components/FefferyCountDown.react";
|
|
36
36
|
import FefferySortableItem from "./components/sortable/FefferySortableItem.react";
|
|
37
37
|
import FefferySortableContainer from "./components/sortable/FefferySortableContainer.react";
|
|
38
|
-
import FefferyRawHTML from "./components/
|
|
38
|
+
import FefferyRawHTML from "./components/FefferyRawHTML.react";
|
|
39
39
|
import FefferyFancyNotification from "./components/FefferyFancyNotification";
|
|
40
40
|
import FefferyQRCode from "./components/FefferyQrcode.react";
|
|
41
41
|
import FefferyFancyMessage from "./components/FefferyFancyMessage";
|
|
@@ -44,6 +44,8 @@ import FefferyDiv from "./components/FefferyDiv.react";
|
|
|
44
44
|
import FefferyReload from "./components/FefferyReload.react";
|
|
45
45
|
import FefferyCssVar from "./components/FefferyCssVar.react";
|
|
46
46
|
import FefferyEyeDropper from "./components/FefferyEyeDropper.react";
|
|
47
|
+
import FefferySticky from "./components/FefferySticky.react";
|
|
48
|
+
import FefferyLazyLoadImage from "./components/FefferyLazyLoadImage.react";
|
|
47
49
|
|
|
48
50
|
/*
|
|
49
51
|
忽略部分设计React中规范的console警告信息
|
|
@@ -112,5 +114,7 @@ export {
|
|
|
112
114
|
FefferyDiv,
|
|
113
115
|
FefferyReload,
|
|
114
116
|
FefferyCssVar,
|
|
115
|
-
FefferyEyeDropper
|
|
117
|
+
FefferyEyeDropper,
|
|
118
|
+
FefferySticky,
|
|
119
|
+
FefferyLazyLoadImage
|
|
116
120
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
if True:
|
|
2
|
+
import sys
|
|
3
|
+
import time
|
|
4
|
+
sys.path.append('../..')
|
|
5
|
+
import dash
|
|
6
|
+
from dash import html, dcc
|
|
7
|
+
import feffery_utils_components as fuc
|
|
8
|
+
from dash.dependencies import Input, Output, State
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
app = dash.Dash(__name__)
|
|
12
|
+
|
|
13
|
+
app.layout = html.Div(
|
|
14
|
+
[
|
|
15
|
+
html.Div(
|
|
16
|
+
[
|
|
17
|
+
i,
|
|
18
|
+
fuc.FefferyLazyLoadImage(
|
|
19
|
+
src=f'https://joeschmoe.io/api/v1/random?index={i}',
|
|
20
|
+
height=200,
|
|
21
|
+
threshold=200
|
|
22
|
+
)
|
|
23
|
+
],
|
|
24
|
+
)
|
|
25
|
+
for i in range(100)
|
|
26
|
+
],
|
|
27
|
+
style={
|
|
28
|
+
'height': '2000px'
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if __name__ == '__main__':
|
|
33
|
+
app.run(debug=True)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
if True:
|
|
2
|
+
import sys
|
|
3
|
+
sys.path.append('../..')
|
|
4
|
+
import dash
|
|
5
|
+
from dash import html
|
|
6
|
+
import feffery_utils_components as fuc
|
|
7
|
+
from dash.dependencies import Input, Output
|
|
8
|
+
|
|
9
|
+
app = dash.Dash(__name__)
|
|
10
|
+
|
|
11
|
+
app.layout = html.Div(
|
|
12
|
+
[
|
|
13
|
+
html.Div(
|
|
14
|
+
fuc.FefferySticky(
|
|
15
|
+
fuc.FefferyDiv(
|
|
16
|
+
shadow='always-shadow',
|
|
17
|
+
style={
|
|
18
|
+
'height': '100px',
|
|
19
|
+
'width': '100px',
|
|
20
|
+
'background': 'white'
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
top=100,
|
|
24
|
+
bottomBoundary='#sticky-boundary-target'
|
|
25
|
+
),
|
|
26
|
+
id='sticky-boundary-target',
|
|
27
|
+
style={
|
|
28
|
+
'height': '2000px',
|
|
29
|
+
'background': 'lightgrey',
|
|
30
|
+
'padding': '200px 25px'
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
],
|
|
34
|
+
style={
|
|
35
|
+
'padding': '100px',
|
|
36
|
+
'height': '10000px'
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
app.run(debug=True)
|
package/usage.py
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import dash
|
|
2
|
-
from dash import html
|
|
3
|
-
import feffery_utils_components as fuc
|
|
4
|
-
from dash.dependencies import Input, Output
|
|
5
|
-
|
|
6
|
-
app = dash.Dash(__name__)
|
|
7
|
-
|
|
8
|
-
app.layout = html.Div(
|
|
9
|
-
[
|
|
10
|
-
html.Button(
|
|
11
|
-
'开启色彩拾取',
|
|
12
|
-
id='enable-eye-dropper'
|
|
13
|
-
),
|
|
14
|
-
fuc.FefferyDiv(
|
|
15
|
-
fuc.FefferyEyeDropper(
|
|
16
|
-
id='eye-dropper'
|
|
17
|
-
)
|
|
18
|
-
),
|
|
19
|
-
|
|
20
|
-
html.Div(
|
|
21
|
-
className='demo-div'
|
|
22
|
-
),
|
|
23
|
-
|
|
24
|
-
fuc.FefferyStyle(
|
|
25
|
-
rawStyle='''
|
|
26
|
-
.demo-div {
|
|
27
|
-
width: 200px;
|
|
28
|
-
height: 200px;
|
|
29
|
-
background: green;
|
|
30
|
-
border: 5px dashed red;
|
|
31
|
-
}
|
|
32
|
-
'''
|
|
33
|
-
)
|
|
34
|
-
]
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
app.clientside_callback(
|
|
39
|
-
'''(n_clicks) => true''',
|
|
40
|
-
Output('eye-dropper', 'enable'),
|
|
41
|
-
Input('enable-eye-dropper', 'n_clicks'),
|
|
42
|
-
prevent_initial_call=True
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if __name__ == '__main__':
|
|
47
|
-
app.run(debug=True)
|