feffery_utils_components 0.0.26 → 0.0.27
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 +1 -0
- package/Project.toml +1 -1
- package/build/lib/feffery_utils_components/FefferyFancyNotification.py +85 -0
- package/build/lib/feffery_utils_components/_imports_.py +2 -0
- package/build/lib/feffery_utils_components/feffery_utils_components.min.js +1 -1
- package/build/lib/feffery_utils_components/metadata.json +273 -0
- package/build/lib/feffery_utils_components/package-info.json +2 -1
- package/feffery_utils_components/FefferyQRCode.py +72 -0
- package/feffery_utils_components/_imports_.py +2 -0
- package/feffery_utils_components/feffery_utils_components.min.js +2 -2
- package/feffery_utils_components/metadata.json +171 -0
- package/feffery_utils_components/package-info.json +2 -1
- package/package.json +2 -1
- package/src/FefferyUtilsComponents.jl +4 -3
- package/src/jl/''_fefferyqrcode.jl +36 -0
- package/src/lib/components/FefferyQRCode.react.js +132 -0
- package/src/lib/index.js +3 -1
- package/tests/QRCodeTest/app.py +41 -0
|
@@ -2287,6 +2287,177 @@
|
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
2289
|
},
|
|
2290
|
+
"src/lib/components/FefferyQRCode.react.js": {
|
|
2291
|
+
"description": "",
|
|
2292
|
+
"displayName": "FefferyQRCode",
|
|
2293
|
+
"methods": [],
|
|
2294
|
+
"props": {
|
|
2295
|
+
"id": {
|
|
2296
|
+
"type": {
|
|
2297
|
+
"name": "string"
|
|
2298
|
+
},
|
|
2299
|
+
"required": false,
|
|
2300
|
+
"description": ""
|
|
2301
|
+
},
|
|
2302
|
+
"value": {
|
|
2303
|
+
"type": {
|
|
2304
|
+
"name": "string"
|
|
2305
|
+
},
|
|
2306
|
+
"required": true,
|
|
2307
|
+
"description": ""
|
|
2308
|
+
},
|
|
2309
|
+
"size": {
|
|
2310
|
+
"type": {
|
|
2311
|
+
"name": "number"
|
|
2312
|
+
},
|
|
2313
|
+
"required": false,
|
|
2314
|
+
"description": "",
|
|
2315
|
+
"defaultValue": {
|
|
2316
|
+
"value": "128",
|
|
2317
|
+
"computed": false
|
|
2318
|
+
}
|
|
2319
|
+
},
|
|
2320
|
+
"bgColor": {
|
|
2321
|
+
"type": {
|
|
2322
|
+
"name": "string"
|
|
2323
|
+
},
|
|
2324
|
+
"required": false,
|
|
2325
|
+
"description": "",
|
|
2326
|
+
"defaultValue": {
|
|
2327
|
+
"value": "'#FFFFFF'",
|
|
2328
|
+
"computed": false
|
|
2329
|
+
}
|
|
2330
|
+
},
|
|
2331
|
+
"fgColor": {
|
|
2332
|
+
"type": {
|
|
2333
|
+
"name": "string"
|
|
2334
|
+
},
|
|
2335
|
+
"required": false,
|
|
2336
|
+
"description": "",
|
|
2337
|
+
"defaultValue": {
|
|
2338
|
+
"value": "'#000000'",
|
|
2339
|
+
"computed": false
|
|
2340
|
+
}
|
|
2341
|
+
},
|
|
2342
|
+
"level": {
|
|
2343
|
+
"type": {
|
|
2344
|
+
"name": "enum",
|
|
2345
|
+
"value": [
|
|
2346
|
+
{
|
|
2347
|
+
"value": "'L'",
|
|
2348
|
+
"computed": false
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
"value": "'M'",
|
|
2352
|
+
"computed": false
|
|
2353
|
+
},
|
|
2354
|
+
{
|
|
2355
|
+
"value": "'Q'",
|
|
2356
|
+
"computed": false
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
"value": "'H'",
|
|
2360
|
+
"computed": false
|
|
2361
|
+
}
|
|
2362
|
+
]
|
|
2363
|
+
},
|
|
2364
|
+
"required": false,
|
|
2365
|
+
"description": "",
|
|
2366
|
+
"defaultValue": {
|
|
2367
|
+
"value": "'L'",
|
|
2368
|
+
"computed": false
|
|
2369
|
+
}
|
|
2370
|
+
},
|
|
2371
|
+
"includeMargin": {
|
|
2372
|
+
"type": {
|
|
2373
|
+
"name": "bool"
|
|
2374
|
+
},
|
|
2375
|
+
"required": false,
|
|
2376
|
+
"description": "",
|
|
2377
|
+
"defaultValue": {
|
|
2378
|
+
"value": "false",
|
|
2379
|
+
"computed": false
|
|
2380
|
+
}
|
|
2381
|
+
},
|
|
2382
|
+
"imageSettings": {
|
|
2383
|
+
"type": {
|
|
2384
|
+
"name": "exact",
|
|
2385
|
+
"value": {
|
|
2386
|
+
"src": {
|
|
2387
|
+
"name": "string",
|
|
2388
|
+
"required": false
|
|
2389
|
+
},
|
|
2390
|
+
"height": {
|
|
2391
|
+
"name": "number",
|
|
2392
|
+
"required": false
|
|
2393
|
+
},
|
|
2394
|
+
"width": {
|
|
2395
|
+
"name": "number",
|
|
2396
|
+
"required": false
|
|
2397
|
+
},
|
|
2398
|
+
"excavate": {
|
|
2399
|
+
"name": "bool",
|
|
2400
|
+
"required": false
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
"required": false,
|
|
2405
|
+
"description": ""
|
|
2406
|
+
},
|
|
2407
|
+
"renderer": {
|
|
2408
|
+
"type": {
|
|
2409
|
+
"name": "enum",
|
|
2410
|
+
"value": [
|
|
2411
|
+
{
|
|
2412
|
+
"value": "'svg'",
|
|
2413
|
+
"computed": false
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
"value": "'canvas'",
|
|
2417
|
+
"computed": false
|
|
2418
|
+
}
|
|
2419
|
+
]
|
|
2420
|
+
},
|
|
2421
|
+
"required": false,
|
|
2422
|
+
"description": "",
|
|
2423
|
+
"defaultValue": {
|
|
2424
|
+
"value": "'svg'",
|
|
2425
|
+
"computed": false
|
|
2426
|
+
}
|
|
2427
|
+
},
|
|
2428
|
+
"loading_state": {
|
|
2429
|
+
"type": {
|
|
2430
|
+
"name": "shape",
|
|
2431
|
+
"value": {
|
|
2432
|
+
"is_loading": {
|
|
2433
|
+
"name": "bool",
|
|
2434
|
+
"description": "Determines if the component is loading or not",
|
|
2435
|
+
"required": false
|
|
2436
|
+
},
|
|
2437
|
+
"prop_name": {
|
|
2438
|
+
"name": "string",
|
|
2439
|
+
"description": "Holds which property is loading",
|
|
2440
|
+
"required": false
|
|
2441
|
+
},
|
|
2442
|
+
"component_name": {
|
|
2443
|
+
"name": "string",
|
|
2444
|
+
"description": "Holds the name of the component that is loading",
|
|
2445
|
+
"required": false
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
},
|
|
2449
|
+
"required": false,
|
|
2450
|
+
"description": ""
|
|
2451
|
+
},
|
|
2452
|
+
"setProps": {
|
|
2453
|
+
"type": {
|
|
2454
|
+
"name": "func"
|
|
2455
|
+
},
|
|
2456
|
+
"required": false,
|
|
2457
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
},
|
|
2290
2461
|
"src/lib/components/FefferyScroll.react.js": {
|
|
2291
2462
|
"description": "",
|
|
2292
2463
|
"displayName": "FefferyScroll",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
33
|
"ninja-keys": "^1.1.12",
|
|
34
34
|
"nprogress": "^0.2.0",
|
|
35
|
+
"qrcode.react": "^3.1.0",
|
|
35
36
|
"ramda": "^0.26.1",
|
|
36
37
|
"rc-virtual-list": "^3.4.8",
|
|
37
38
|
"react-captcha-code": "^1.0.7",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
33
|
"ninja-keys": "^1.1.12",
|
|
34
34
|
"nprogress": "^0.2.0",
|
|
35
|
+
"qrcode.react": "^3.1.0",
|
|
35
36
|
"ramda": "^0.26.1",
|
|
36
37
|
"rc-virtual-list": "^3.4.8",
|
|
37
38
|
"react-captcha-code": "^1.0.7",
|
|
@@ -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.27"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferyblockcolorpicker.jl")
|
|
9
9
|
include("jl/''_fefferycirclecolorpicker.jl")
|
|
@@ -25,6 +25,7 @@ include("jl/''_fefferyguide.jl")
|
|
|
25
25
|
include("jl/''_fefferyhighlightwords.jl")
|
|
26
26
|
include("jl/''_fefferylazyload.jl")
|
|
27
27
|
include("jl/''_fefferylocation.jl")
|
|
28
|
+
include("jl/''_fefferyqrcode.jl")
|
|
28
29
|
include("jl/''_fefferyscroll.jl")
|
|
29
30
|
include("jl/''_fefferyscrollbars.jl")
|
|
30
31
|
include("jl/''_fefferyshortcutpanel.jl")
|
|
@@ -54,14 +55,14 @@ function __init__()
|
|
|
54
55
|
[
|
|
55
56
|
DashBase.Resource(
|
|
56
57
|
relative_package_path = "feffery_utils_components.min.js",
|
|
57
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
58
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.27/feffery_utils_components/feffery_utils_components.min.js",
|
|
58
59
|
dynamic = nothing,
|
|
59
60
|
async = nothing,
|
|
60
61
|
type = :js
|
|
61
62
|
),
|
|
62
63
|
DashBase.Resource(
|
|
63
64
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
64
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
65
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.27/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
65
66
|
dynamic = true,
|
|
66
67
|
async = nothing,
|
|
67
68
|
type = :js
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyqrcode
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyqrcode(;kwargs...)
|
|
7
|
+
|
|
8
|
+
A FefferyQRCode component.
|
|
9
|
+
|
|
10
|
+
Keyword arguments:
|
|
11
|
+
- `id` (String; optional)
|
|
12
|
+
- `bgColor` (String; optional)
|
|
13
|
+
- `fgColor` (String; optional)
|
|
14
|
+
- `imageSettings` (optional): . imageSettings has the following type: lists containing elements 'src', 'height', 'width', 'excavate'.
|
|
15
|
+
Those elements have the following types:
|
|
16
|
+
- `src` (String; optional)
|
|
17
|
+
- `height` (Real; optional)
|
|
18
|
+
- `width` (Real; optional)
|
|
19
|
+
- `excavate` (Bool; optional)
|
|
20
|
+
- `includeMargin` (Bool; optional)
|
|
21
|
+
- `level` (a value equal to: 'L', 'M', 'Q', 'H'; 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
|
+
- `renderer` (a value equal to: 'svg', 'canvas'; optional)
|
|
28
|
+
- `size` (Real; optional)
|
|
29
|
+
- `value` (String; required)
|
|
30
|
+
"""
|
|
31
|
+
function ''_fefferyqrcode(; kwargs...)
|
|
32
|
+
available_props = Symbol[:id, :bgColor, :fgColor, :imageSettings, :includeMargin, :level, :loading_state, :renderer, :size, :value]
|
|
33
|
+
wild_props = Symbol[]
|
|
34
|
+
return Component("''_fefferyqrcode", "FefferyQRCode", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
35
|
+
end
|
|
36
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { QRCodeSVG, QRCodeCanvas } from 'qrcode.react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
// 定义二维码生成组件FefferyQRCode
|
|
6
|
+
const FefferyQRCode = (props) => {
|
|
7
|
+
// 取得必要属性或参数
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
renderer,
|
|
11
|
+
value,
|
|
12
|
+
size,
|
|
13
|
+
bgColor,
|
|
14
|
+
fgColor,
|
|
15
|
+
level,
|
|
16
|
+
includeMargin,
|
|
17
|
+
imageSettings,
|
|
18
|
+
setProps,
|
|
19
|
+
loading_state
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
if (renderer === 'canvas') {
|
|
23
|
+
return (<QRCodeCanvas
|
|
24
|
+
id={id}
|
|
25
|
+
value={value}
|
|
26
|
+
size={size}
|
|
27
|
+
bgColor={bgColor}
|
|
28
|
+
fgColor={fgColor}
|
|
29
|
+
level={level}
|
|
30
|
+
includeMargin={includeMargin}
|
|
31
|
+
imageSettings={{
|
|
32
|
+
excavate: true,
|
|
33
|
+
...imageSettings
|
|
34
|
+
}}
|
|
35
|
+
data-dash-is-loading={
|
|
36
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
37
|
+
}
|
|
38
|
+
/>);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return <QRCodeSVG
|
|
42
|
+
id={id}
|
|
43
|
+
value={value}
|
|
44
|
+
size={size}
|
|
45
|
+
bgColor={bgColor}
|
|
46
|
+
fgColor={fgColor}
|
|
47
|
+
level={level}
|
|
48
|
+
includeMargin={includeMargin}
|
|
49
|
+
imageSettings={{
|
|
50
|
+
excavate: true,
|
|
51
|
+
...imageSettings
|
|
52
|
+
}}
|
|
53
|
+
data-dash-is-loading={
|
|
54
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
55
|
+
} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 定义参数或属性
|
|
59
|
+
FefferyQRCode.propTypes = {
|
|
60
|
+
// 部件id
|
|
61
|
+
id: PropTypes.string,
|
|
62
|
+
|
|
63
|
+
// 设置二维码所表达的信息值
|
|
64
|
+
value: PropTypes.string.isRequired,
|
|
65
|
+
|
|
66
|
+
// 设置像素边长,默认为128
|
|
67
|
+
size: PropTypes.number,
|
|
68
|
+
|
|
69
|
+
// 设置背景色,默认为'#FFFFFF'
|
|
70
|
+
bgColor: PropTypes.string,
|
|
71
|
+
|
|
72
|
+
// 设置前景色,默认为'#000000'
|
|
73
|
+
fgColor: PropTypes.string,
|
|
74
|
+
|
|
75
|
+
// 设置解析精度,可选的有'L'、'M'、'Q'、'H'
|
|
76
|
+
// 默认为'L'
|
|
77
|
+
level: PropTypes.oneOf(['L', 'M', 'Q', 'H']),
|
|
78
|
+
|
|
79
|
+
// 设置是否添加外边距,默认为false
|
|
80
|
+
includeMargin: PropTypes.bool,
|
|
81
|
+
|
|
82
|
+
// 配置二维码中心图片信息
|
|
83
|
+
imageSettings: PropTypes.exact({
|
|
84
|
+
// 设置图片src
|
|
85
|
+
src: PropTypes.string,
|
|
86
|
+
|
|
87
|
+
// 设置图片像素高度,默认为二维码size的10%
|
|
88
|
+
height: PropTypes.number,
|
|
89
|
+
|
|
90
|
+
// 设置图片像素宽度,默认为二维码size的10%
|
|
91
|
+
width: PropTypes.number,
|
|
92
|
+
|
|
93
|
+
// 设置图片四周是否添加环绕白边,默认为true
|
|
94
|
+
excavate: PropTypes.bool
|
|
95
|
+
}),
|
|
96
|
+
|
|
97
|
+
// 指定渲染引擎,可选的有'svg'、'canvas',默认为'svg'
|
|
98
|
+
renderer: PropTypes.oneOf(['svg', 'canvas']),
|
|
99
|
+
|
|
100
|
+
loading_state: PropTypes.shape({
|
|
101
|
+
/**
|
|
102
|
+
* Determines if the component is loading or not
|
|
103
|
+
*/
|
|
104
|
+
is_loading: PropTypes.bool,
|
|
105
|
+
/**
|
|
106
|
+
* Holds which property is loading
|
|
107
|
+
*/
|
|
108
|
+
prop_name: PropTypes.string,
|
|
109
|
+
/**
|
|
110
|
+
* Holds the name of the component that is loading
|
|
111
|
+
*/
|
|
112
|
+
component_name: PropTypes.string
|
|
113
|
+
}),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Dash-assigned callback that should be called to report property changes
|
|
117
|
+
* to Dash, to make them available for callbacks.
|
|
118
|
+
*/
|
|
119
|
+
setProps: PropTypes.func,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// 设置默认参数
|
|
123
|
+
FefferyQRCode.defaultProps = {
|
|
124
|
+
renderer: 'svg',
|
|
125
|
+
size: 128,
|
|
126
|
+
bgColor: '#FFFFFF',
|
|
127
|
+
fgColor: '#000000',
|
|
128
|
+
level: 'L',
|
|
129
|
+
includeMargin: false
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default React.memo(FefferyQRCode);
|
package/src/lib/index.js
CHANGED
|
@@ -38,6 +38,7 @@ import FefferySortableItem from "./components/sortable/FefferySortableItem.react
|
|
|
38
38
|
import FefferySortableContainer from "./components/sortable/FefferySortableContainer.react";
|
|
39
39
|
import FefferyRawHTML from "./components/dom/FefferyRawHTML.react";
|
|
40
40
|
import FefferyFancyNotification from "./components/FefferyFancyNotification";
|
|
41
|
+
import FefferyQRCode from "./components/FefferyQrcode.react";
|
|
41
42
|
|
|
42
43
|
/*
|
|
43
44
|
忽略部分设计React中规范的console警告信息
|
|
@@ -100,5 +101,6 @@ export {
|
|
|
100
101
|
FefferySortableItem,
|
|
101
102
|
FefferySortableContainer,
|
|
102
103
|
FefferyRawHTML,
|
|
103
|
-
FefferyFancyNotification
|
|
104
|
+
FefferyFancyNotification,
|
|
105
|
+
FefferyQRCode
|
|
104
106
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
9
|
+
app = dash.Dash(__name__)
|
|
10
|
+
|
|
11
|
+
app.layout = html.Div(
|
|
12
|
+
[
|
|
13
|
+
fuc.FefferyQRCode(
|
|
14
|
+
size=256,
|
|
15
|
+
value='https://fac.feffery.tech/'
|
|
16
|
+
),
|
|
17
|
+
|
|
18
|
+
fuc.FefferyQRCode(
|
|
19
|
+
size=256,
|
|
20
|
+
value='https://fac.feffery.tech/',
|
|
21
|
+
imageSettings={
|
|
22
|
+
'src': 'https://fac.feffery.tech/assets/imgs/fac-logo.svg',
|
|
23
|
+
'height': 60,
|
|
24
|
+
'width': 60
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
],
|
|
28
|
+
style={
|
|
29
|
+
'width': '600px',
|
|
30
|
+
'paddingTop': '50px',
|
|
31
|
+
'margin': '0 auto',
|
|
32
|
+
'display': 'flex',
|
|
33
|
+
'flexDirection': 'column',
|
|
34
|
+
'alignItems': 'center',
|
|
35
|
+
'gap': '25px'
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
app.run(debug=True)
|