feffery_utils_components 0.0.5 → 0.0.6
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/.Rbuildignore +34 -0
- package/DESCRIPTION +1 -1
- package/NAMESPACE +1 -0
- package/Project.toml +1 -1
- package/{feffery_utils_components/FefferyContextMenu.py → build/lib/feffery_utils_components/FefferyCaptcha.py} +20 -8
- package/build/lib/feffery_utils_components/FefferyPasteImage.py +56 -0
- package/build/lib/feffery_utils_components/FefferySyntaxHighlighter.py +52 -0
- package/build/lib/feffery_utils_components/FefferyTopProgress.py +68 -0
- package/build/lib/feffery_utils_components/FefferyUtilsComponents.py +40 -0
- package/{feffery_utils_components/FefferyNprogress.py → build/lib/feffery_utils_components/FefferyWaterMark.py} +21 -9
- package/build/lib/feffery_utils_components/__init__.py +89 -0
- package/build/lib/feffery_utils_components/_imports_.py +13 -0
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +4 -0
- package/build/lib/feffery_utils_components/metadata.json +578 -0
- package/build/lib/feffery_utils_components/package-info.json +79 -0
- package/feffery_utils_components/FefferyTopProgress.py +68 -0
- package/feffery_utils_components/_imports_.py +2 -0
- package/feffery_utils_components/feffery_utils_components.min.js +1 -1
- package/feffery_utils_components/feffery_utils_components.min.js.LICENSE.txt +3 -0
- package/feffery_utils_components/metadata.json +169 -0
- package/feffery_utils_components/package-info.json +3 -4
- package/git-operations.md +23 -0
- package/package.json +3 -2
- package/src/FefferyUtilsComponents.jl +4 -3
- package/src/jl/''_fefferytopprogress.jl +41 -0
- package/src/lib/components/FefferyTopProgress.react.js +180 -0
- package/src/lib/index.js +3 -1
- package/usage.py +42 -37
- package/feffery_utils_components/FefferyFefferySyntaxHighlighter.py +0 -46
- package/feffery_utils_components/__pycache__/FefferyCaptcha.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyPasteImage.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferySyntaxHighlighter.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyWaterMark.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/__init__.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/_imports_.cpython-37.pyc +0 -0
- package/feffery_utils_components/feffery_utils_components.min.js.map +0 -1
|
@@ -291,6 +291,175 @@
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
|
+
"src/lib/components/FefferyTopProgress.react.js": {
|
|
295
|
+
"description": "",
|
|
296
|
+
"displayName": "FefferyTopProgress",
|
|
297
|
+
"methods": [],
|
|
298
|
+
"props": {
|
|
299
|
+
"id": {
|
|
300
|
+
"type": {
|
|
301
|
+
"name": "string"
|
|
302
|
+
},
|
|
303
|
+
"required": false,
|
|
304
|
+
"description": ""
|
|
305
|
+
},
|
|
306
|
+
"children": {
|
|
307
|
+
"type": {
|
|
308
|
+
"name": "node"
|
|
309
|
+
},
|
|
310
|
+
"required": false,
|
|
311
|
+
"description": "The content of the tab - will only be displayed if this tab is selected"
|
|
312
|
+
},
|
|
313
|
+
"className": {
|
|
314
|
+
"type": {
|
|
315
|
+
"name": "string"
|
|
316
|
+
},
|
|
317
|
+
"required": false,
|
|
318
|
+
"description": ""
|
|
319
|
+
},
|
|
320
|
+
"style": {
|
|
321
|
+
"type": {
|
|
322
|
+
"name": "object"
|
|
323
|
+
},
|
|
324
|
+
"required": false,
|
|
325
|
+
"description": ""
|
|
326
|
+
},
|
|
327
|
+
"spinning": {
|
|
328
|
+
"type": {
|
|
329
|
+
"name": "bool"
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"description": "",
|
|
333
|
+
"defaultValue": {
|
|
334
|
+
"value": "false",
|
|
335
|
+
"computed": false
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"minimum": {
|
|
339
|
+
"type": {
|
|
340
|
+
"name": "number"
|
|
341
|
+
},
|
|
342
|
+
"required": false,
|
|
343
|
+
"description": ""
|
|
344
|
+
},
|
|
345
|
+
"easing": {
|
|
346
|
+
"type": {
|
|
347
|
+
"name": "string"
|
|
348
|
+
},
|
|
349
|
+
"required": false,
|
|
350
|
+
"description": ""
|
|
351
|
+
},
|
|
352
|
+
"speed": {
|
|
353
|
+
"type": {
|
|
354
|
+
"name": "number"
|
|
355
|
+
},
|
|
356
|
+
"required": false,
|
|
357
|
+
"description": ""
|
|
358
|
+
},
|
|
359
|
+
"showSpinner": {
|
|
360
|
+
"type": {
|
|
361
|
+
"name": "bool"
|
|
362
|
+
},
|
|
363
|
+
"required": false,
|
|
364
|
+
"description": ""
|
|
365
|
+
},
|
|
366
|
+
"debug": {
|
|
367
|
+
"type": {
|
|
368
|
+
"name": "bool"
|
|
369
|
+
},
|
|
370
|
+
"required": false,
|
|
371
|
+
"description": "",
|
|
372
|
+
"defaultValue": {
|
|
373
|
+
"value": "false",
|
|
374
|
+
"computed": false
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"listenPropsMode": {
|
|
378
|
+
"type": {
|
|
379
|
+
"name": "enum",
|
|
380
|
+
"value": [
|
|
381
|
+
{
|
|
382
|
+
"value": "'default'",
|
|
383
|
+
"computed": false
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"value": "'exclude'",
|
|
387
|
+
"computed": false
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"value": "'include'",
|
|
391
|
+
"computed": false
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
"required": false,
|
|
396
|
+
"description": "",
|
|
397
|
+
"defaultValue": {
|
|
398
|
+
"value": "'default'",
|
|
399
|
+
"computed": false
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"excludeProps": {
|
|
403
|
+
"type": {
|
|
404
|
+
"name": "arrayOf",
|
|
405
|
+
"value": {
|
|
406
|
+
"name": "string"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"required": false,
|
|
410
|
+
"description": "",
|
|
411
|
+
"defaultValue": {
|
|
412
|
+
"value": "[]",
|
|
413
|
+
"computed": false
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"includeProps": {
|
|
417
|
+
"type": {
|
|
418
|
+
"name": "arrayOf",
|
|
419
|
+
"value": {
|
|
420
|
+
"name": "string"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"required": false,
|
|
424
|
+
"description": "",
|
|
425
|
+
"defaultValue": {
|
|
426
|
+
"value": "[]",
|
|
427
|
+
"computed": false
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"loading_state": {
|
|
431
|
+
"type": {
|
|
432
|
+
"name": "shape",
|
|
433
|
+
"value": {
|
|
434
|
+
"is_loading": {
|
|
435
|
+
"name": "bool",
|
|
436
|
+
"description": "Determines if the component is loading or not",
|
|
437
|
+
"required": false
|
|
438
|
+
},
|
|
439
|
+
"prop_name": {
|
|
440
|
+
"name": "string",
|
|
441
|
+
"description": "Holds which property is loading",
|
|
442
|
+
"required": false
|
|
443
|
+
},
|
|
444
|
+
"component_name": {
|
|
445
|
+
"name": "string",
|
|
446
|
+
"description": "Holds the name of the component that is loading",
|
|
447
|
+
"required": false
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
"required": false,
|
|
452
|
+
"description": ""
|
|
453
|
+
},
|
|
454
|
+
"setProps": {
|
|
455
|
+
"type": {
|
|
456
|
+
"name": "func"
|
|
457
|
+
},
|
|
458
|
+
"required": false,
|
|
459
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
294
463
|
"src/lib/components/FefferyWaterMark.react.js": {
|
|
295
464
|
"description": "",
|
|
296
465
|
"displayName": "FefferyWaterMark",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
"main": "build/index.js",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "webpack-serve --config ./webpack.serve.config.js --open",
|
|
16
|
-
"validate-init": "python _validate_init.py",
|
|
17
|
-
"prepublishOnly": "npm run validate-init",
|
|
18
16
|
"build:js": "webpack --mode production",
|
|
19
17
|
"build:backends": "dash-generate-components ./src/lib/components feffery_utils_components -p package-info.json --r-prefix '' --jl-prefix ''",
|
|
20
18
|
"build:backends-activated": "(. venv/bin/activate || venv\\scripts\\activate && npm run build:py_and_r)",
|
|
@@ -29,6 +27,7 @@
|
|
|
29
27
|
"github-markdown-css": "^5.0.0",
|
|
30
28
|
"less": "^3.13.1",
|
|
31
29
|
"less-loader": "^5.0.0",
|
|
30
|
+
"nprogress": "^0.2.0",
|
|
32
31
|
"ramda": "^0.26.1",
|
|
33
32
|
"react-captcha-code": "^1.0.7",
|
|
34
33
|
"react-contexify": "^5.0.0",
|
|
@@ -77,4 +76,4 @@
|
|
|
77
76
|
"node": ">=8.11.0",
|
|
78
77
|
"npm": ">=6.1.0"
|
|
79
78
|
}
|
|
80
|
-
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
### 清除仓库主要文件的历史提交冗余空间
|
|
2
|
+
|
|
3
|
+
- 查看历史大文件
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- 清除指定大文件
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch feffery_utils_components/feffery_utils_components.min.js' --prune-empty --tag-name-filter cat -- --all
|
|
13
|
+
|
|
14
|
+
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch feffery_utils_components/metadata.json' --prune-empty --tag-name-filter cat -- --all
|
|
15
|
+
|
|
16
|
+
git push origin main --force
|
|
17
|
+
|
|
18
|
+
rm -rf .git/refs/original/
|
|
19
|
+
|
|
20
|
+
git reflog expire --expire=now --all
|
|
21
|
+
|
|
22
|
+
git gc --prune=now
|
|
23
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"github-markdown-css": "^5.0.0",
|
|
28
28
|
"less": "^3.13.1",
|
|
29
29
|
"less-loader": "^5.0.0",
|
|
30
|
+
"nprogress": "^0.2.0",
|
|
30
31
|
"ramda": "^0.26.1",
|
|
31
32
|
"react-captcha-code": "^1.0.7",
|
|
32
33
|
"react-contexify": "^5.0.0",
|
|
@@ -75,4 +76,4 @@
|
|
|
75
76
|
"node": ">=8.11.0",
|
|
76
77
|
"npm": ">=6.1.0"
|
|
77
78
|
}
|
|
78
|
-
}
|
|
79
|
+
}
|
|
@@ -3,11 +3,12 @@ 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.6"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferycaptcha.jl")
|
|
9
9
|
include("jl/''_fefferypasteimage.jl")
|
|
10
10
|
include("jl/''_fefferysyntaxhighlighter.jl")
|
|
11
|
+
include("jl/''_fefferytopprogress.jl")
|
|
11
12
|
include("jl/''_fefferywatermark.jl")
|
|
12
13
|
|
|
13
14
|
function __init__()
|
|
@@ -19,14 +20,14 @@ function __init__()
|
|
|
19
20
|
[
|
|
20
21
|
DashBase.Resource(
|
|
21
22
|
relative_package_path = "feffery_utils_components.min.js",
|
|
22
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
23
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.6/feffery_utils_components/feffery_utils_components.min.js",
|
|
23
24
|
dynamic = nothing,
|
|
24
25
|
async = nothing,
|
|
25
26
|
type = :js
|
|
26
27
|
),
|
|
27
28
|
DashBase.Resource(
|
|
28
29
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
29
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
30
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.6/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
30
31
|
dynamic = true,
|
|
31
32
|
async = nothing,
|
|
32
33
|
type = :js
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferytopprogress
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferytopprogress(;kwargs...)
|
|
7
|
+
''_fefferytopprogress(children::Any;kwargs...)
|
|
8
|
+
''_fefferytopprogress(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferyTopProgress component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional): The content of the tab - will only be displayed if this tab is selected
|
|
15
|
+
- `id` (String; optional)
|
|
16
|
+
- `className` (String; optional)
|
|
17
|
+
- `debug` (Bool; optional)
|
|
18
|
+
- `easing` (String; optional)
|
|
19
|
+
- `excludeProps` (Array of Strings; optional)
|
|
20
|
+
- `includeProps` (Array of Strings; optional)
|
|
21
|
+
- `listenPropsMode` (a value equal to: 'default', 'exclude', 'include'; optional)
|
|
22
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
23
|
+
Those elements have the following types:
|
|
24
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
25
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
26
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
27
|
+
- `minimum` (Real; optional)
|
|
28
|
+
- `showSpinner` (Bool; optional)
|
|
29
|
+
- `speed` (Real; optional)
|
|
30
|
+
- `spinning` (Bool; optional)
|
|
31
|
+
- `style` (Dict; optional)
|
|
32
|
+
"""
|
|
33
|
+
function ''_fefferytopprogress(; kwargs...)
|
|
34
|
+
available_props = Symbol[:children, :id, :className, :debug, :easing, :excludeProps, :includeProps, :listenPropsMode, :loading_state, :minimum, :showSpinner, :speed, :spinning, :style]
|
|
35
|
+
wild_props = Symbol[]
|
|
36
|
+
return Component("''_fefferytopprogress", "FefferyTopProgress", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
''_fefferytopprogress(children::Any; kwargs...) = ''_fefferytopprogress(;kwargs..., children = children)
|
|
40
|
+
''_fefferytopprogress(children_maker::Function; kwargs...) = ''_fefferytopprogress(children_maker(); kwargs...)
|
|
41
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import NProgress from 'nprogress';
|
|
4
|
+
import 'nprogress/nprogress.css';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const parseChildrenToArray = children => {
|
|
8
|
+
if (children && !Array.isArray(children)) {
|
|
9
|
+
return [children];
|
|
10
|
+
}
|
|
11
|
+
return children;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// 定义顶部加载进度条组件FefferyTopProgress,api参数参考https://github.com/rstacruz/nprogress
|
|
15
|
+
const FefferyTopProgress = (props) => {
|
|
16
|
+
// 取得必要属性或参数
|
|
17
|
+
let {
|
|
18
|
+
id,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
children,
|
|
22
|
+
minimum,
|
|
23
|
+
easing,
|
|
24
|
+
speed,
|
|
25
|
+
showSpinner,
|
|
26
|
+
spinning,
|
|
27
|
+
loading_state,
|
|
28
|
+
listenPropsMode,
|
|
29
|
+
excludeProps,
|
|
30
|
+
includeProps,
|
|
31
|
+
debug,
|
|
32
|
+
setProps
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
// 配置NProgress参数信息
|
|
36
|
+
NProgress.configure({
|
|
37
|
+
minimum,
|
|
38
|
+
easing,
|
|
39
|
+
speed,
|
|
40
|
+
showSpinner
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
children = parseChildrenToArray(children)
|
|
44
|
+
|
|
45
|
+
const [showSpinning, setShowSpinning] = useState(spinning);
|
|
46
|
+
const timer = useRef();
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (loading_state) {
|
|
50
|
+
if (timer.current) {
|
|
51
|
+
clearTimeout(timer.current);
|
|
52
|
+
}
|
|
53
|
+
if (loading_state.is_loading && !showSpinning) {
|
|
54
|
+
// 当listenPropsMode为'default'时
|
|
55
|
+
if (listenPropsMode === 'default') {
|
|
56
|
+
if (debug) {
|
|
57
|
+
console.log(loading_state.component_name + '.' + loading_state.prop_name)
|
|
58
|
+
}
|
|
59
|
+
setShowSpinning(true);
|
|
60
|
+
NProgress.start();
|
|
61
|
+
} else if (listenPropsMode === 'exclude') {
|
|
62
|
+
// 当listenPropsMode为'exclude'模式时
|
|
63
|
+
// 当前触发loading_state的组件+属性组合不在排除列表中时,激活动画
|
|
64
|
+
if (excludeProps.indexOf(loading_state.component_name + '.' + loading_state.prop_name) === -1) {
|
|
65
|
+
if (debug) {
|
|
66
|
+
console.log(loading_state.component_name + '.' + loading_state.prop_name)
|
|
67
|
+
}
|
|
68
|
+
setShowSpinning(true);
|
|
69
|
+
NProgress.start();
|
|
70
|
+
}
|
|
71
|
+
} else if (listenPropsMode === 'include') {
|
|
72
|
+
// 当listenPropsMode为'include'模式时
|
|
73
|
+
// 当前触发loading_state的组件+属性组合在包含列表中时,激活动画
|
|
74
|
+
if (includeProps.indexOf(loading_state.component_name + '.' + loading_state.prop_name) !== -1) {
|
|
75
|
+
if (debug) {
|
|
76
|
+
console.log(loading_state.component_name + '.' + loading_state.prop_name)
|
|
77
|
+
}
|
|
78
|
+
setShowSpinning(true);
|
|
79
|
+
NProgress.start();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
} else if (!loading_state.is_loading && showSpinning) {
|
|
84
|
+
timer.current = setTimeout(() => {
|
|
85
|
+
setShowSpinning(false);
|
|
86
|
+
NProgress.done();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, [loading_state]);
|
|
91
|
+
|
|
92
|
+
// 返回定制化的前端组件
|
|
93
|
+
return (<div id={id}
|
|
94
|
+
className={className}
|
|
95
|
+
style={style}
|
|
96
|
+
data-dash-is-loading={
|
|
97
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
98
|
+
} > {children} </div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
FefferyTopProgress._dashprivate_isLoadingComponent = true;
|
|
103
|
+
|
|
104
|
+
// 定义参数或属性
|
|
105
|
+
FefferyTopProgress.propTypes = {
|
|
106
|
+
// 组件id
|
|
107
|
+
id: PropTypes.string,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The content of the tab - will only be displayed if this tab is selected
|
|
111
|
+
*/
|
|
112
|
+
children: PropTypes.node,
|
|
113
|
+
|
|
114
|
+
// css类名
|
|
115
|
+
className: PropTypes.string,
|
|
116
|
+
|
|
117
|
+
// 自定义css字典
|
|
118
|
+
style: PropTypes.object,
|
|
119
|
+
|
|
120
|
+
// 设置是否处于加载中状态
|
|
121
|
+
spinning: PropTypes.bool,
|
|
122
|
+
|
|
123
|
+
// 设置顶端进度条的初始进度值,默认为0.08,取值在0到1之间
|
|
124
|
+
minimum: PropTypes.number,
|
|
125
|
+
|
|
126
|
+
// 用于设置同名css动画效果,默认为'ease'
|
|
127
|
+
easing: PropTypes.string,
|
|
128
|
+
|
|
129
|
+
// 设置进度条每步递增耗时(单位:毫秒),默认为200
|
|
130
|
+
speed: PropTypes.number,
|
|
131
|
+
|
|
132
|
+
// 设置是否渲染右上角圆圈加载动画,默认为true
|
|
133
|
+
showSpinner: PropTypes.bool,
|
|
134
|
+
|
|
135
|
+
// 设置是否开启debug模式,开启后,每次动画加载都会在开发者工具的控制台打印prop信息
|
|
136
|
+
debug: PropTypes.bool,
|
|
137
|
+
|
|
138
|
+
// 设置自定义监听组件的模式,可选的有'default'、'exclude'、'include',默认为'default'
|
|
139
|
+
listenPropsMode: PropTypes.oneOf(['default', 'exclude', 'include']),
|
|
140
|
+
|
|
141
|
+
// 设置需要忽略输出监听过程的组件信息列表
|
|
142
|
+
// 仅在listenPropsMode为'exclude'时生效
|
|
143
|
+
excludeProps: PropTypes.arrayOf(PropTypes.string),
|
|
144
|
+
|
|
145
|
+
// 设置需要包含输出监听过程的组件信息列表
|
|
146
|
+
// 仅在listenPropsMode为'include'时生效
|
|
147
|
+
includeProps: PropTypes.arrayOf(PropTypes.string),
|
|
148
|
+
|
|
149
|
+
loading_state: PropTypes.shape({
|
|
150
|
+
/**
|
|
151
|
+
* Determines if the component is loading or not
|
|
152
|
+
*/
|
|
153
|
+
is_loading: PropTypes.bool,
|
|
154
|
+
/**
|
|
155
|
+
* Holds which property is loading
|
|
156
|
+
*/
|
|
157
|
+
prop_name: PropTypes.string,
|
|
158
|
+
/**
|
|
159
|
+
* Holds the name of the component that is loading
|
|
160
|
+
*/
|
|
161
|
+
component_name: PropTypes.string
|
|
162
|
+
}),
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Dash-assigned callback that should be called to report property changes
|
|
166
|
+
* to Dash, to make them available for callbacks.
|
|
167
|
+
*/
|
|
168
|
+
setProps: PropTypes.func
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// 设置默认参数
|
|
172
|
+
FefferyTopProgress.defaultProps = {
|
|
173
|
+
spinning: false,
|
|
174
|
+
listenPropsMode: 'default',
|
|
175
|
+
excludeProps: [],
|
|
176
|
+
includeProps: [],
|
|
177
|
+
debug: false
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export default FefferyTopProgress;
|
package/src/lib/index.js
CHANGED
|
@@ -3,11 +3,13 @@ import FefferyCaptcha from "./components/FefferyCaptcha.react";
|
|
|
3
3
|
import FefferyWaterMark from "./components/FefferyWaterMark.react";
|
|
4
4
|
import FefferySyntaxHighlighter from "./components/FefferySyntaxHighlighter.react";
|
|
5
5
|
import FefferyPasteImage from "./components/FefferyPasteImage.react";
|
|
6
|
+
import FefferyTopProgress from "./components/FefferyTopProgress.react"
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
FefferyCaptcha,
|
|
10
11
|
FefferyWaterMark,
|
|
11
12
|
FefferySyntaxHighlighter,
|
|
12
|
-
FefferyPasteImage
|
|
13
|
+
FefferyPasteImage,
|
|
14
|
+
FefferyTopProgress
|
|
13
15
|
};
|
package/usage.py
CHANGED
|
@@ -6,36 +6,37 @@ from dash import html
|
|
|
6
6
|
app = dash.Dash(__name__)
|
|
7
7
|
|
|
8
8
|
app.layout = html.Div(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
html.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
9
|
+
fuc.FefferyTopProgress(
|
|
10
|
+
[
|
|
11
|
+
fuc.FefferyPasteImage(
|
|
12
|
+
id='test',
|
|
13
|
+
style={
|
|
14
|
+
'height': '500px',
|
|
15
|
+
'width': '800px',
|
|
16
|
+
'marginBottom': '100px'
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
html.Div(id='test-output'),
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
fuc.FefferyCaptcha(id='captcha-demo',
|
|
23
|
+
charNum=10,
|
|
24
|
+
width=300,
|
|
25
|
+
height=100,
|
|
26
|
+
fontSize=60),
|
|
27
|
+
html.Div(
|
|
28
|
+
html.Em(id='output-demo')
|
|
29
|
+
),
|
|
30
|
+
|
|
31
|
+
fuc.FefferyWaterMark(
|
|
32
|
+
content='fuc FefferyWaterMark',
|
|
33
|
+
fontSize=26
|
|
34
|
+
),
|
|
35
|
+
|
|
36
|
+
fuc.FefferySyntaxHighlighter(
|
|
37
|
+
showLineNumbers=True,
|
|
38
|
+
showInlineLineNumbers=True,
|
|
39
|
+
codeString='''html.Div(
|
|
39
40
|
[
|
|
40
41
|
fac.AntdBackTop(
|
|
41
42
|
containerId='back-top-container-demo',
|
|
@@ -62,10 +63,15 @@ app.layout = html.Div(
|
|
|
62
63
|
}
|
|
63
64
|
)
|
|
64
65
|
''',
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
language='python',
|
|
67
|
+
codeStyle='coy-without-shadows'
|
|
68
|
+
)
|
|
69
|
+
],
|
|
70
|
+
# listenPropsMode='exclude',
|
|
71
|
+
# excludeProps=['output-demo.children'],
|
|
72
|
+
debug=True,
|
|
73
|
+
showSpinner=False
|
|
74
|
+
),
|
|
69
75
|
style={
|
|
70
76
|
'padding': '100px'
|
|
71
77
|
}
|
|
@@ -74,14 +80,13 @@ app.layout = html.Div(
|
|
|
74
80
|
|
|
75
81
|
@app.callback(
|
|
76
82
|
Output('output-demo', 'children'),
|
|
77
|
-
Input('captcha-demo', 'captcha')
|
|
78
|
-
prevent_initial_call=True
|
|
83
|
+
Input('captcha-demo', 'captcha')
|
|
79
84
|
)
|
|
80
85
|
def test(captcha):
|
|
81
86
|
|
|
82
87
|
import time
|
|
83
88
|
|
|
84
|
-
time.sleep(3)
|
|
89
|
+
# time.sleep(3)
|
|
85
90
|
|
|
86
91
|
return captcha
|
|
87
92
|
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
-
|
|
3
|
-
from dash.development.base_component import Component, _explicitize_args
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FefferyFefferySyntaxHighlighter(Component):
|
|
7
|
-
"""A FefferyFefferySyntaxHighlighter component.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Keyword arguments:
|
|
11
|
-
|
|
12
|
-
- id (string; optional)
|
|
13
|
-
|
|
14
|
-
- codeString (string; required)
|
|
15
|
-
|
|
16
|
-
- language (string; default 'python')
|
|
17
|
-
|
|
18
|
-
- loading_state (dict; optional)
|
|
19
|
-
|
|
20
|
-
`loading_state` is a dict with keys:
|
|
21
|
-
|
|
22
|
-
- component_name (string; optional):
|
|
23
|
-
Holds the name of the component that is loading.
|
|
24
|
-
|
|
25
|
-
- is_loading (boolean; optional):
|
|
26
|
-
Determines if the component is loading or not.
|
|
27
|
-
|
|
28
|
-
- prop_name (string; optional):
|
|
29
|
-
Holds which property is loading."""
|
|
30
|
-
@_explicitize_args
|
|
31
|
-
def __init__(self, id=Component.UNDEFINED, codeString=Component.REQUIRED, language=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
|
|
32
|
-
self._prop_names = ['id', 'codeString', 'language', 'loading_state']
|
|
33
|
-
self._type = 'FefferyFefferySyntaxHighlighter'
|
|
34
|
-
self._namespace = 'feffery_utils_components'
|
|
35
|
-
self._valid_wildcard_attributes = []
|
|
36
|
-
self.available_properties = ['id', 'codeString', 'language', 'loading_state']
|
|
37
|
-
self.available_wildcard_properties = []
|
|
38
|
-
_explicit_args = kwargs.pop('_explicit_args')
|
|
39
|
-
_locals = locals()
|
|
40
|
-
_locals.update(kwargs) # For wildcard attrs
|
|
41
|
-
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
|
|
42
|
-
for k in ['codeString']:
|
|
43
|
-
if k not in args:
|
|
44
|
-
raise TypeError(
|
|
45
|
-
'Required argument `' + k + '` was not specified.')
|
|
46
|
-
super(FefferyFefferySyntaxHighlighter, self).__init__(**args)
|
|
Binary file
|
|
Binary file
|