feffery_utils_components 0.0.25 → 0.0.26
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/FefferyBlockColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyCaptcha.py +2 -5
- package/build/lib/feffery_utils_components/FefferyCircleColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyCountDown.py +2 -5
- package/build/lib/feffery_utils_components/FefferyDiv.py +1 -4
- package/build/lib/feffery_utils_components/FefferyDocumentVisibility.py +2 -5
- package/build/lib/feffery_utils_components/FefferyExecuteJs.py +2 -5
- package/build/lib/feffery_utils_components/FefferyExternalCss.py +2 -5
- package/build/lib/feffery_utils_components/FefferyExternalJs.py +2 -5
- package/build/lib/feffery_utils_components/FefferyExtraSpinner.py +2 -5
- package/build/lib/feffery_utils_components/FefferyGeolocation.py +2 -5
- package/build/lib/feffery_utils_components/FefferyGithubColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyGuide.py +3 -1
- package/build/lib/feffery_utils_components/FefferyHexColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyHighlightWords.py +2 -5
- package/build/lib/feffery_utils_components/FefferyIdle.py +2 -5
- package/build/lib/feffery_utils_components/FefferyInViewport.py +1 -4
- package/build/lib/feffery_utils_components/FefferyKeyPress.py +3 -1
- package/build/lib/feffery_utils_components/FefferyLazyLoad.py +1 -4
- package/build/lib/feffery_utils_components/FefferyLocation.py +3 -1
- package/build/lib/feffery_utils_components/FefferyRawHTML.py +43 -0
- package/build/lib/feffery_utils_components/FefferyResponsive.py +2 -5
- package/build/lib/feffery_utils_components/FefferyRgbColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyScroll.py +2 -5
- package/build/lib/feffery_utils_components/FefferyScrollbars.py +1 -4
- package/build/lib/feffery_utils_components/FefferySetTitle.py +2 -5
- package/build/lib/feffery_utils_components/FefferyShortcutPanel.py +2 -5
- package/build/lib/feffery_utils_components/FefferySortableContainer.py +1 -4
- package/build/lib/feffery_utils_components/FefferySortableItem.py +1 -4
- package/build/lib/feffery_utils_components/FefferySplit.py +1 -4
- package/build/lib/feffery_utils_components/FefferySplitPane.py +1 -4
- package/build/lib/feffery_utils_components/FefferySyntaxHighlighter.py +3 -1
- package/build/lib/feffery_utils_components/FefferyTimeout.py +2 -5
- package/build/lib/feffery_utils_components/FefferyTopProgress.py +1 -4
- package/build/lib/feffery_utils_components/FefferyTwitterColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyVirtualList.py +2 -0
- package/build/lib/feffery_utils_components/FefferyWheelColorPicker.py +2 -5
- package/build/lib/feffery_utils_components/FefferyWindowSize.py +2 -5
- 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 +52 -0
- package/build/lib/feffery_utils_components/package-info.json +2 -1
- package/feffery_utils_components/FefferyFancyNotification.py +85 -0
- package/feffery_utils_components/_imports_.py +2 -0
- package/feffery_utils_components/feffery_utils_components.min.js +1 -1
- package/feffery_utils_components/metadata.json +273 -0
- package/feffery_utils_components/package-info.json +2 -1
- package/package.json +2 -1
- package/src/FefferyUtilsComponents.jl +4 -3
- package/src/jl/''_fefferyfancynotification.jl +51 -0
- package/src/lib/components/FefferyFancyNotification.js +191 -0
- package/src/lib/index.js +3 -1
- package/tests/FancyNotificationTest/app.py +50 -0
|
@@ -1391,6 +1391,279 @@
|
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
},
|
|
1394
|
+
"src/lib/components/FefferyFancyNotification.js": {
|
|
1395
|
+
"description": "",
|
|
1396
|
+
"displayName": "FefferyFancyNotification",
|
|
1397
|
+
"methods": [],
|
|
1398
|
+
"props": {
|
|
1399
|
+
"children": {
|
|
1400
|
+
"type": {
|
|
1401
|
+
"name": "node"
|
|
1402
|
+
},
|
|
1403
|
+
"required": false,
|
|
1404
|
+
"description": ""
|
|
1405
|
+
},
|
|
1406
|
+
"id": {
|
|
1407
|
+
"type": {
|
|
1408
|
+
"name": "string"
|
|
1409
|
+
},
|
|
1410
|
+
"required": false,
|
|
1411
|
+
"description": ""
|
|
1412
|
+
},
|
|
1413
|
+
"key": {
|
|
1414
|
+
"type": {
|
|
1415
|
+
"name": "string"
|
|
1416
|
+
},
|
|
1417
|
+
"required": false,
|
|
1418
|
+
"description": ""
|
|
1419
|
+
},
|
|
1420
|
+
"className": {
|
|
1421
|
+
"type": {
|
|
1422
|
+
"name": "string"
|
|
1423
|
+
},
|
|
1424
|
+
"required": false,
|
|
1425
|
+
"description": ""
|
|
1426
|
+
},
|
|
1427
|
+
"style": {
|
|
1428
|
+
"type": {
|
|
1429
|
+
"name": "object"
|
|
1430
|
+
},
|
|
1431
|
+
"required": false,
|
|
1432
|
+
"description": ""
|
|
1433
|
+
},
|
|
1434
|
+
"type": {
|
|
1435
|
+
"type": {
|
|
1436
|
+
"name": "enum",
|
|
1437
|
+
"value": [
|
|
1438
|
+
{
|
|
1439
|
+
"value": "'info'",
|
|
1440
|
+
"computed": false
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
"value": "'success'",
|
|
1444
|
+
"computed": false
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
"value": "'warning'",
|
|
1448
|
+
"computed": false
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
"value": "'error'",
|
|
1452
|
+
"computed": false
|
|
1453
|
+
}
|
|
1454
|
+
]
|
|
1455
|
+
},
|
|
1456
|
+
"required": false,
|
|
1457
|
+
"description": ""
|
|
1458
|
+
},
|
|
1459
|
+
"visible": {
|
|
1460
|
+
"type": {
|
|
1461
|
+
"name": "bool"
|
|
1462
|
+
},
|
|
1463
|
+
"required": false,
|
|
1464
|
+
"description": "",
|
|
1465
|
+
"defaultValue": {
|
|
1466
|
+
"value": "true",
|
|
1467
|
+
"computed": false
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
"position": {
|
|
1471
|
+
"type": {
|
|
1472
|
+
"name": "enum",
|
|
1473
|
+
"value": [
|
|
1474
|
+
{
|
|
1475
|
+
"value": "'top-right'",
|
|
1476
|
+
"computed": false
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
"value": "'top-center'",
|
|
1480
|
+
"computed": false
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
"value": "'top-left'",
|
|
1484
|
+
"computed": false
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
"value": "'bottom-right'",
|
|
1488
|
+
"computed": false
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
"value": "'bottom-cente'",
|
|
1492
|
+
"computed": false
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"value": "'bottom-left'",
|
|
1496
|
+
"computed": false
|
|
1497
|
+
}
|
|
1498
|
+
]
|
|
1499
|
+
},
|
|
1500
|
+
"required": false,
|
|
1501
|
+
"description": ""
|
|
1502
|
+
},
|
|
1503
|
+
"autoClose": {
|
|
1504
|
+
"type": {
|
|
1505
|
+
"name": "union",
|
|
1506
|
+
"value": [
|
|
1507
|
+
{
|
|
1508
|
+
"name": "bool"
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
"name": "number"
|
|
1512
|
+
}
|
|
1513
|
+
]
|
|
1514
|
+
},
|
|
1515
|
+
"required": false,
|
|
1516
|
+
"description": ""
|
|
1517
|
+
},
|
|
1518
|
+
"closable": {
|
|
1519
|
+
"type": {
|
|
1520
|
+
"name": "bool"
|
|
1521
|
+
},
|
|
1522
|
+
"required": false,
|
|
1523
|
+
"description": "",
|
|
1524
|
+
"defaultValue": {
|
|
1525
|
+
"value": "true",
|
|
1526
|
+
"computed": false
|
|
1527
|
+
}
|
|
1528
|
+
},
|
|
1529
|
+
"hideProgressBar": {
|
|
1530
|
+
"type": {
|
|
1531
|
+
"name": "bool"
|
|
1532
|
+
},
|
|
1533
|
+
"required": false,
|
|
1534
|
+
"description": ""
|
|
1535
|
+
},
|
|
1536
|
+
"pauseOnHover": {
|
|
1537
|
+
"type": {
|
|
1538
|
+
"name": "bool"
|
|
1539
|
+
},
|
|
1540
|
+
"required": false,
|
|
1541
|
+
"description": ""
|
|
1542
|
+
},
|
|
1543
|
+
"closeOnClick": {
|
|
1544
|
+
"type": {
|
|
1545
|
+
"name": "bool"
|
|
1546
|
+
},
|
|
1547
|
+
"required": false,
|
|
1548
|
+
"description": ""
|
|
1549
|
+
},
|
|
1550
|
+
"newestOnTop": {
|
|
1551
|
+
"type": {
|
|
1552
|
+
"name": "bool"
|
|
1553
|
+
},
|
|
1554
|
+
"required": false,
|
|
1555
|
+
"description": ""
|
|
1556
|
+
},
|
|
1557
|
+
"toastClassName": {
|
|
1558
|
+
"type": {
|
|
1559
|
+
"name": "string"
|
|
1560
|
+
},
|
|
1561
|
+
"required": false,
|
|
1562
|
+
"description": ""
|
|
1563
|
+
},
|
|
1564
|
+
"bodyClassName": {
|
|
1565
|
+
"type": {
|
|
1566
|
+
"name": "string"
|
|
1567
|
+
},
|
|
1568
|
+
"required": false,
|
|
1569
|
+
"description": ""
|
|
1570
|
+
},
|
|
1571
|
+
"progressClassName": {
|
|
1572
|
+
"type": {
|
|
1573
|
+
"name": "string"
|
|
1574
|
+
},
|
|
1575
|
+
"required": false,
|
|
1576
|
+
"description": ""
|
|
1577
|
+
},
|
|
1578
|
+
"progressStyle": {
|
|
1579
|
+
"type": {
|
|
1580
|
+
"name": "object"
|
|
1581
|
+
},
|
|
1582
|
+
"required": false,
|
|
1583
|
+
"description": ""
|
|
1584
|
+
},
|
|
1585
|
+
"draggable": {
|
|
1586
|
+
"type": {
|
|
1587
|
+
"name": "bool"
|
|
1588
|
+
},
|
|
1589
|
+
"required": false,
|
|
1590
|
+
"description": ""
|
|
1591
|
+
},
|
|
1592
|
+
"draggablePercent": {
|
|
1593
|
+
"type": {
|
|
1594
|
+
"name": "number"
|
|
1595
|
+
},
|
|
1596
|
+
"required": false,
|
|
1597
|
+
"description": ""
|
|
1598
|
+
},
|
|
1599
|
+
"containerId": {
|
|
1600
|
+
"type": {
|
|
1601
|
+
"name": "string"
|
|
1602
|
+
},
|
|
1603
|
+
"required": false,
|
|
1604
|
+
"description": ""
|
|
1605
|
+
},
|
|
1606
|
+
"limit": {
|
|
1607
|
+
"type": {
|
|
1608
|
+
"name": "number"
|
|
1609
|
+
},
|
|
1610
|
+
"required": false,
|
|
1611
|
+
"description": ""
|
|
1612
|
+
},
|
|
1613
|
+
"theme": {
|
|
1614
|
+
"type": {
|
|
1615
|
+
"name": "enum",
|
|
1616
|
+
"value": [
|
|
1617
|
+
{
|
|
1618
|
+
"value": "'light'",
|
|
1619
|
+
"computed": false
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
"value": "'dark'",
|
|
1623
|
+
"computed": false
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
"value": "'colored'",
|
|
1627
|
+
"computed": false
|
|
1628
|
+
}
|
|
1629
|
+
]
|
|
1630
|
+
},
|
|
1631
|
+
"required": false,
|
|
1632
|
+
"description": ""
|
|
1633
|
+
},
|
|
1634
|
+
"setProps": {
|
|
1635
|
+
"type": {
|
|
1636
|
+
"name": "func"
|
|
1637
|
+
},
|
|
1638
|
+
"required": false,
|
|
1639
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
1640
|
+
},
|
|
1641
|
+
"loading_state": {
|
|
1642
|
+
"type": {
|
|
1643
|
+
"name": "shape",
|
|
1644
|
+
"value": {
|
|
1645
|
+
"is_loading": {
|
|
1646
|
+
"name": "bool",
|
|
1647
|
+
"description": "Determines if the component is loading or not",
|
|
1648
|
+
"required": false
|
|
1649
|
+
},
|
|
1650
|
+
"prop_name": {
|
|
1651
|
+
"name": "string",
|
|
1652
|
+
"description": "Holds which property is loading",
|
|
1653
|
+
"required": false
|
|
1654
|
+
},
|
|
1655
|
+
"component_name": {
|
|
1656
|
+
"name": "string",
|
|
1657
|
+
"description": "Holds the name of the component that is loading",
|
|
1658
|
+
"required": false
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
},
|
|
1662
|
+
"required": false,
|
|
1663
|
+
"description": ""
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
},
|
|
1394
1667
|
"src/lib/components/FefferyGuide.react.js": {
|
|
1395
1668
|
"description": "",
|
|
1396
1669
|
"displayName": "FefferyGuide",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"react-spinners-kit": "^1.9.1",
|
|
47
47
|
"react-split": "^2.0.14",
|
|
48
48
|
"react-syntax-highlighter": "^15.4.4",
|
|
49
|
+
"react-toastify": "9.0.3",
|
|
49
50
|
"react-use": "^17.4.0",
|
|
50
51
|
"simplebar-react": "^2.3.7"
|
|
51
52
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Build more utility components for Plotly Dash.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"react-spinners-kit": "^1.9.1",
|
|
47
47
|
"react-split": "^2.0.14",
|
|
48
48
|
"react-syntax-highlighter": "^15.4.4",
|
|
49
|
+
"react-toastify": "9.0.3",
|
|
49
50
|
"react-use": "^17.4.0",
|
|
50
51
|
"simplebar-react": "^2.3.7"
|
|
51
52
|
},
|
|
@@ -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.26"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferyblockcolorpicker.jl")
|
|
9
9
|
include("jl/''_fefferycirclecolorpicker.jl")
|
|
@@ -20,6 +20,7 @@ include("jl/''_fefferycaptcha.jl")
|
|
|
20
20
|
include("jl/''_fefferycountdown.jl")
|
|
21
21
|
include("jl/''_fefferyexecutejs.jl")
|
|
22
22
|
include("jl/''_fefferyextraspinner.jl")
|
|
23
|
+
include("jl/''_fefferyfancynotification.jl")
|
|
23
24
|
include("jl/''_fefferyguide.jl")
|
|
24
25
|
include("jl/''_fefferyhighlightwords.jl")
|
|
25
26
|
include("jl/''_fefferylazyload.jl")
|
|
@@ -53,14 +54,14 @@ function __init__()
|
|
|
53
54
|
[
|
|
54
55
|
DashBase.Resource(
|
|
55
56
|
relative_package_path = "feffery_utils_components.min.js",
|
|
56
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
57
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.26/feffery_utils_components/feffery_utils_components.min.js",
|
|
57
58
|
dynamic = nothing,
|
|
58
59
|
async = nothing,
|
|
59
60
|
type = :js
|
|
60
61
|
),
|
|
61
62
|
DashBase.Resource(
|
|
62
63
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
63
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
64
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.26/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
64
65
|
dynamic = true,
|
|
65
66
|
async = nothing,
|
|
66
67
|
type = :js
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferyfancynotification
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferyfancynotification(;kwargs...)
|
|
7
|
+
''_fefferyfancynotification(children::Any;kwargs...)
|
|
8
|
+
''_fefferyfancynotification(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferyFancyNotification component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional)
|
|
15
|
+
- `id` (String; optional)
|
|
16
|
+
- `autoClose` (Bool | Real; optional)
|
|
17
|
+
- `bodyClassName` (String; optional)
|
|
18
|
+
- `className` (String; optional)
|
|
19
|
+
- `closable` (Bool; optional)
|
|
20
|
+
- `closeOnClick` (Bool; optional)
|
|
21
|
+
- `containerId` (String; optional)
|
|
22
|
+
- `draggable` (Bool; optional)
|
|
23
|
+
- `draggablePercent` (Real; optional)
|
|
24
|
+
- `hideProgressBar` (Bool; optional)
|
|
25
|
+
- `key` (String; optional)
|
|
26
|
+
- `limit` (Real; optional)
|
|
27
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
28
|
+
Those elements have the following types:
|
|
29
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
30
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
31
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
32
|
+
- `newestOnTop` (Bool; optional)
|
|
33
|
+
- `pauseOnHover` (Bool; optional)
|
|
34
|
+
- `position` (a value equal to: 'top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-cente', 'bottom-left'; optional)
|
|
35
|
+
- `progressClassName` (String; optional)
|
|
36
|
+
- `progressStyle` (Dict; optional)
|
|
37
|
+
- `style` (Dict; optional)
|
|
38
|
+
- `theme` (a value equal to: 'light', 'dark', 'colored'; optional)
|
|
39
|
+
- `toastClassName` (String; optional)
|
|
40
|
+
- `type` (a value equal to: 'info', 'success', 'warning', 'error'; optional)
|
|
41
|
+
- `visible` (Bool; optional)
|
|
42
|
+
"""
|
|
43
|
+
function ''_fefferyfancynotification(; kwargs...)
|
|
44
|
+
available_props = Symbol[:children, :id, :autoClose, :bodyClassName, :className, :closable, :closeOnClick, :containerId, :draggable, :draggablePercent, :hideProgressBar, :key, :limit, :loading_state, :newestOnTop, :pauseOnHover, :position, :progressClassName, :progressStyle, :style, :theme, :toastClassName, :type, :visible]
|
|
45
|
+
wild_props = Symbol[]
|
|
46
|
+
return Component("''_fefferyfancynotification", "FefferyFancyNotification", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
''_fefferyfancynotification(children::Any; kwargs...) = ''_fefferyfancynotification(;kwargs..., children = children)
|
|
50
|
+
''_fefferyfancynotification(children_maker::Function; kwargs...) = ''_fefferyfancynotification(children_maker(); kwargs...)
|
|
51
|
+
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { ToastContainer, toast } from 'react-toastify';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
5
|
+
|
|
6
|
+
// 定义美观通知提示组件FefferyFancyNotification
|
|
7
|
+
const FefferyFancyNotification = (props) => {
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
id,
|
|
11
|
+
children,
|
|
12
|
+
key,
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
type,
|
|
16
|
+
visible,
|
|
17
|
+
position,
|
|
18
|
+
autoClose,
|
|
19
|
+
closable,
|
|
20
|
+
hideProgressBar,
|
|
21
|
+
pauseOnHover,
|
|
22
|
+
closeOnClick,
|
|
23
|
+
newestOnTop,
|
|
24
|
+
toastClassName,
|
|
25
|
+
bodyClassName,
|
|
26
|
+
progressClassName,
|
|
27
|
+
progressStyle,
|
|
28
|
+
draggable,
|
|
29
|
+
draggablePercent,
|
|
30
|
+
containerId,
|
|
31
|
+
limit,
|
|
32
|
+
theme,
|
|
33
|
+
setProps,
|
|
34
|
+
loading_state
|
|
35
|
+
} = props;
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (visible) {
|
|
39
|
+
if (type) {
|
|
40
|
+
toast(
|
|
41
|
+
children,
|
|
42
|
+
{
|
|
43
|
+
type: type
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
} else {
|
|
47
|
+
toast(
|
|
48
|
+
children,
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
setProps({
|
|
52
|
+
visible: false
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}, [visible])
|
|
57
|
+
|
|
58
|
+
return (<ToastContainer
|
|
59
|
+
id={id}
|
|
60
|
+
key={key}
|
|
61
|
+
className={className}
|
|
62
|
+
style={style}
|
|
63
|
+
position={position}
|
|
64
|
+
autoClose={autoClose}
|
|
65
|
+
closeButton={closable}
|
|
66
|
+
hideProgressBar={hideProgressBar}
|
|
67
|
+
pauseOnHover={pauseOnHover}
|
|
68
|
+
closeOnClick={closeOnClick}
|
|
69
|
+
newestOnTop={newestOnTop}
|
|
70
|
+
toastClassName={toastClassName}
|
|
71
|
+
bodyClassName={bodyClassName}
|
|
72
|
+
progressClassName={progressClassName}
|
|
73
|
+
progressStyle={progressStyle}
|
|
74
|
+
draggable={draggable}
|
|
75
|
+
draggablePercent={draggablePercent}
|
|
76
|
+
containerId={containerId}
|
|
77
|
+
limit={limit}
|
|
78
|
+
theme={theme}
|
|
79
|
+
data-dash-is-loading={
|
|
80
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
81
|
+
} />);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 定义参数或属性
|
|
85
|
+
FefferyFancyNotification.propTypes = {
|
|
86
|
+
|
|
87
|
+
children: PropTypes.node,
|
|
88
|
+
|
|
89
|
+
// 部件id
|
|
90
|
+
id: PropTypes.string,
|
|
91
|
+
|
|
92
|
+
key: PropTypes.string,
|
|
93
|
+
|
|
94
|
+
// 设置容器的css类名
|
|
95
|
+
className: PropTypes.string,
|
|
96
|
+
|
|
97
|
+
// 设置容器的css样式
|
|
98
|
+
style: PropTypes.object,
|
|
99
|
+
|
|
100
|
+
// 设置信息类型,可选的有'info', 'success', 'warning', 'error'
|
|
101
|
+
type: PropTypes.oneOf(['info', 'success', 'warning', 'error']),
|
|
102
|
+
|
|
103
|
+
// 主动设置是否可见,默认为false
|
|
104
|
+
visible: PropTypes.bool,
|
|
105
|
+
|
|
106
|
+
// 设置通知提示弹出方位,可选的有'top-right'、'top-center'、'top-left'、
|
|
107
|
+
// 'bottom-right'、'bottom-cente'、'bottom-left'
|
|
108
|
+
// 默认为'top-right'
|
|
109
|
+
position: PropTypes.oneOf([
|
|
110
|
+
'top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-cente', 'bottom-left'
|
|
111
|
+
]),
|
|
112
|
+
|
|
113
|
+
// 配置自动关闭延时(单位:毫秒),默认为5000
|
|
114
|
+
// 当设置为false时不会自动关闭
|
|
115
|
+
autoClose: PropTypes.oneOfType([
|
|
116
|
+
PropTypes.bool,
|
|
117
|
+
PropTypes.number
|
|
118
|
+
]),
|
|
119
|
+
|
|
120
|
+
// 设置是否可关闭,默认为true
|
|
121
|
+
closable: PropTypes.bool,
|
|
122
|
+
|
|
123
|
+
// 设置是否显示关闭倒计时进度条,默认为false
|
|
124
|
+
hideProgressBar: PropTypes.bool,
|
|
125
|
+
|
|
126
|
+
// 设置当鼠标悬浮于通知框上时,是否暂停倒计时
|
|
127
|
+
// 默认为true
|
|
128
|
+
pauseOnHover: PropTypes.bool,
|
|
129
|
+
|
|
130
|
+
// 设置是否允许通知框在被点击后自动关闭,默认为true
|
|
131
|
+
closeOnClick: PropTypes.bool,
|
|
132
|
+
|
|
133
|
+
// 设置是否将新的通知框显示在更顶端的位置,默认为false
|
|
134
|
+
newestOnTop: PropTypes.bool,
|
|
135
|
+
|
|
136
|
+
toastClassName: PropTypes.string,
|
|
137
|
+
|
|
138
|
+
bodyClassName: PropTypes.string,
|
|
139
|
+
|
|
140
|
+
progressClassName: PropTypes.string,
|
|
141
|
+
|
|
142
|
+
progressStyle: PropTypes.object,
|
|
143
|
+
|
|
144
|
+
// 设置通知框是否可拖拽,默认为true
|
|
145
|
+
draggable: PropTypes.bool,
|
|
146
|
+
|
|
147
|
+
// 设置通知框被拖拽距离占自身宽度的百分比阈值
|
|
148
|
+
// 拖拽距离超出此阈值时通知框会被关闭,默认为80
|
|
149
|
+
draggablePercent: PropTypes.number,
|
|
150
|
+
|
|
151
|
+
// 可选,设置局部目标容器的id
|
|
152
|
+
containerId: PropTypes.string,
|
|
153
|
+
|
|
154
|
+
// 设置屏幕中允许同时显示的通知框数量上限,默认无上限
|
|
155
|
+
limit: PropTypes.number,
|
|
156
|
+
|
|
157
|
+
// 设置主题,可选的有'light'、'dark'、'colored'
|
|
158
|
+
// 默认为'light'
|
|
159
|
+
theme: PropTypes.oneOf([
|
|
160
|
+
'light', 'dark', 'colored'
|
|
161
|
+
]),
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Dash-assigned callback that should be called to report property changes
|
|
165
|
+
* to Dash, to make them available for callbacks.
|
|
166
|
+
*/
|
|
167
|
+
setProps: PropTypes.func,
|
|
168
|
+
|
|
169
|
+
loading_state: PropTypes.shape({
|
|
170
|
+
/**
|
|
171
|
+
* Determines if the component is loading or not
|
|
172
|
+
*/
|
|
173
|
+
is_loading: PropTypes.bool,
|
|
174
|
+
/**
|
|
175
|
+
* Holds which property is loading
|
|
176
|
+
*/
|
|
177
|
+
prop_name: PropTypes.string,
|
|
178
|
+
/**
|
|
179
|
+
* Holds the name of the component that is loading
|
|
180
|
+
*/
|
|
181
|
+
component_name: PropTypes.string
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// 设置默认参数
|
|
186
|
+
FefferyFancyNotification.defaultProps = {
|
|
187
|
+
visible: true,
|
|
188
|
+
closable: true
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export default React.memo(FefferyFancyNotification);
|
package/src/lib/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import FefferyCountDown from "./components/FefferyCountDown.react";
|
|
|
37
37
|
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
|
+
import FefferyFancyNotification from "./components/FefferyFancyNotification";
|
|
40
41
|
|
|
41
42
|
/*
|
|
42
43
|
忽略部分设计React中规范的console警告信息
|
|
@@ -98,5 +99,6 @@ export {
|
|
|
98
99
|
FefferyCountDown,
|
|
99
100
|
FefferySortableItem,
|
|
100
101
|
FefferySortableContainer,
|
|
101
|
-
FefferyRawHTML
|
|
102
|
+
FefferyRawHTML,
|
|
103
|
+
FefferyFancyNotification
|
|
102
104
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
if True:
|
|
2
|
+
import sys
|
|
3
|
+
import time
|
|
4
|
+
sys.path.append('../..')
|
|
5
|
+
import dash
|
|
6
|
+
import uuid
|
|
7
|
+
from dash import html, dcc
|
|
8
|
+
import feffery_utils_components as fuc
|
|
9
|
+
from dash.dependencies import Input, Output, State
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
app = dash.Dash(__name__)
|
|
13
|
+
|
|
14
|
+
app.layout = html.Div(
|
|
15
|
+
[
|
|
16
|
+
html.Button(
|
|
17
|
+
'触发',
|
|
18
|
+
id='trigger-button'
|
|
19
|
+
),
|
|
20
|
+
|
|
21
|
+
html.Div(
|
|
22
|
+
id='fancy-notification-container',
|
|
23
|
+
style={
|
|
24
|
+
'height': '800px'
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@app.callback(
|
|
32
|
+
Output('fancy-notification-container', 'children'),
|
|
33
|
+
Input('trigger-button', 'n_clicks')
|
|
34
|
+
)
|
|
35
|
+
def demo(n_clicks):
|
|
36
|
+
|
|
37
|
+
if n_clicks:
|
|
38
|
+
|
|
39
|
+
return fuc.FefferyFancyNotification(
|
|
40
|
+
html.Span('自定义内容测试', style={'color': 'green'}),
|
|
41
|
+
autoClose=5000,
|
|
42
|
+
closable=False,
|
|
43
|
+
position='top-left',
|
|
44
|
+
type='success',
|
|
45
|
+
draggable=False
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if __name__ == '__main__':
|
|
50
|
+
app.run(debug=True)
|