feffery_utils_components 0.2.0-rc19 → 0.2.0-rc20
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 -0
- package/Project.toml +2 -2
- package/README.md +1 -1
- package/feffery_utils_components/FefferyEventListener.py +65 -0
- package/feffery_utils_components/FefferyListenElementSize.py +59 -0
- package/feffery_utils_components/FefferyListenHover.py +56 -0
- package/feffery_utils_components/FefferyListenScroll.py +40 -5
- package/feffery_utils_components/_imports_.py +6 -0
- package/feffery_utils_components/alias.py +20 -8
- package/feffery_utils_components/async-feffery_animated_3d_background_p5.js +1 -1
- package/feffery_utils_components/async-feffery_animated_3d_background_three.js +1 -1
- package/feffery_utils_components/async-feffery_animated_image.js +1 -1
- package/feffery_utils_components/async-feffery_aplayer.js +1 -1
- package/feffery_utils_components/async-feffery_auto_animate.js +1 -1
- package/feffery_utils_components/async-feffery_auto_fit.js +2 -2
- package/feffery_utils_components/async-feffery_burger.js +1 -1
- package/feffery_utils_components/async-feffery_captcha.js +1 -1
- package/feffery_utils_components/async-feffery_color_pickers.js +1 -1
- package/feffery_utils_components/async-feffery_dom2image.js +1 -1
- package/feffery_utils_components/async-feffery_dplayer.js +1 -1
- package/feffery_utils_components/async-feffery_emoji_picker.js +1 -1
- package/feffery_utils_components/async-feffery_excel_preview.js +1 -1
- package/feffery_utils_components/async-feffery_extra_spinner.js +1 -1
- package/feffery_utils_components/async-feffery_fancy_button.js +1 -1
- package/feffery_utils_components/async-feffery_grid.js +1 -1
- package/feffery_utils_components/async-feffery_http_requests.js +1 -1
- package/feffery_utils_components/async-feffery_image_cropper.js +1 -1
- package/feffery_utils_components/async-feffery_json_viewer.js +1 -1
- package/feffery_utils_components/async-feffery_local_large_storage.js +1 -1
- package/feffery_utils_components/async-feffery_markdown_editor.js +2 -2
- package/feffery_utils_components/async-feffery_motion.js +1 -1
- package/feffery_utils_components/async-feffery_music_player.js +1 -1
- package/feffery_utils_components/async-feffery_photo_sphere_viewer.js +1 -1
- package/feffery_utils_components/async-feffery_resizable.js +1 -1
- package/feffery_utils_components/async-feffery_rich_text_editor.js +2 -2
- package/feffery_utils_components/async-feffery_rnd.js +1 -1
- package/feffery_utils_components/async-feffery_seamless_scroll.js +1 -1
- package/feffery_utils_components/async-feffery_shortcut_panel.js +1 -1
- package/feffery_utils_components/async-feffery_slider_captcha.js +1 -1
- package/feffery_utils_components/async-feffery_sortable.js +1 -1
- package/feffery_utils_components/async-feffery_vditor.js +1 -1
- package/feffery_utils_components/async-feffery_word_preview.js +1 -1
- package/feffery_utils_components/async-fuc-shared.js +3 -3
- package/feffery_utils_components/feffery_utils_components.min.js +7 -7
- package/feffery_utils_components/metadata.json +302 -1
- package/feffery_utils_components/package-info.json +1 -1
- package/package.json +1 -1
- package/src/lib/components/FefferyEventSource.react.js +2 -0
- package/src/lib/components/listeners/FefferyEventListener.react.js +97 -0
- package/src/lib/components/listeners/FefferyListenElementSize.react.js +86 -0
- package/src/lib/components/listeners/FefferyListenHover.js +75 -0
- package/src/lib/components/listeners/FefferyListenScroll.react.js +91 -10
- package/src/lib/index.js +7 -1
- package/usage.py +17 -29
|
@@ -18003,6 +18003,97 @@
|
|
|
18003
18003
|
}
|
|
18004
18004
|
}
|
|
18005
18005
|
},
|
|
18006
|
+
"src/lib/components/listeners/FefferyEventListener.react.js": {
|
|
18007
|
+
"description": "\u901a\u7528\u4e8b\u4ef6\u76d1\u542c\u7ec4\u4ef6FefferyEventListener",
|
|
18008
|
+
"displayName": "FefferyEventListener",
|
|
18009
|
+
"methods": [],
|
|
18010
|
+
"props": {
|
|
18011
|
+
"id": {
|
|
18012
|
+
"type": {
|
|
18013
|
+
"name": "string"
|
|
18014
|
+
},
|
|
18015
|
+
"required": false,
|
|
18016
|
+
"description": "\u7ec4\u4ef6id"
|
|
18017
|
+
},
|
|
18018
|
+
"key": {
|
|
18019
|
+
"type": {
|
|
18020
|
+
"name": "string"
|
|
18021
|
+
},
|
|
18022
|
+
"required": false,
|
|
18023
|
+
"description": "\u5f3a\u5236\u5237\u65b0\u7528key\u503c"
|
|
18024
|
+
},
|
|
18025
|
+
"eventName": {
|
|
18026
|
+
"type": {
|
|
18027
|
+
"name": "string"
|
|
18028
|
+
},
|
|
18029
|
+
"required": true,
|
|
18030
|
+
"description": "\u5fc5\u586b\uff0c\u76ee\u6807\u4e8b\u4ef6\u540d\u79f0"
|
|
18031
|
+
},
|
|
18032
|
+
"handler": {
|
|
18033
|
+
"type": {
|
|
18034
|
+
"name": "string"
|
|
18035
|
+
},
|
|
18036
|
+
"required": false,
|
|
18037
|
+
"description": "\u5fc5\u586b\uff0c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u5904\u7406js\u51fd\u6570\u5b57\u7b26\u4e32\uff0c\u552f\u4e00\u5165\u53c2\u4e3a\u4e8b\u4ef6\u5bf9\u8c61\uff0c\u8fd4\u56de\u503c\u5c06\u7528\u4e8e\u66f4\u65b0`result`\u5c5e\u6027"
|
|
18038
|
+
},
|
|
18039
|
+
"targetSelector": {
|
|
18040
|
+
"type": {
|
|
18041
|
+
"name": "string"
|
|
18042
|
+
},
|
|
18043
|
+
"required": false,
|
|
18044
|
+
"description": "\u4e8b\u4ef6\u76d1\u542c\u76ee\u6807\u5bf9\u5e94\u7684\u9009\u62e9\u5668\u5b57\u7b26\u4e32\uff0c\u9ed8\u8ba4\u76d1\u542c\u76ee\u6807\u4e3a\u6574\u4e2a\u9875\u9762"
|
|
18045
|
+
},
|
|
18046
|
+
"enable": {
|
|
18047
|
+
"type": {
|
|
18048
|
+
"name": "bool"
|
|
18049
|
+
},
|
|
18050
|
+
"required": false,
|
|
18051
|
+
"description": "\u63a7\u5236\u662f\u5426\u5f00\u542f\u76d1\u542c\r\n\u9ed8\u8ba4\u503c\uff1a`true`",
|
|
18052
|
+
"defaultValue": {
|
|
18053
|
+
"value": "true",
|
|
18054
|
+
"computed": false
|
|
18055
|
+
}
|
|
18056
|
+
},
|
|
18057
|
+
"result": {
|
|
18058
|
+
"type": {
|
|
18059
|
+
"name": "any"
|
|
18060
|
+
},
|
|
18061
|
+
"required": false,
|
|
18062
|
+
"description": "\u76d1\u542c`handler`\u5bf9\u5e94\u51fd\u6570\u7684\u8fd4\u56de\u503c\uff0c\u4f5c\u4e3a\u4e8b\u4ef6\u76d1\u542c\u7684\u7ed3\u679c"
|
|
18063
|
+
},
|
|
18064
|
+
"setProps": {
|
|
18065
|
+
"type": {
|
|
18066
|
+
"name": "func"
|
|
18067
|
+
},
|
|
18068
|
+
"required": false,
|
|
18069
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
18070
|
+
},
|
|
18071
|
+
"loading_state": {
|
|
18072
|
+
"type": {
|
|
18073
|
+
"name": "shape",
|
|
18074
|
+
"value": {
|
|
18075
|
+
"is_loading": {
|
|
18076
|
+
"name": "bool",
|
|
18077
|
+
"description": "Determines if the component is loading or not",
|
|
18078
|
+
"required": false
|
|
18079
|
+
},
|
|
18080
|
+
"prop_name": {
|
|
18081
|
+
"name": "string",
|
|
18082
|
+
"description": "Holds which property is loading",
|
|
18083
|
+
"required": false
|
|
18084
|
+
},
|
|
18085
|
+
"component_name": {
|
|
18086
|
+
"name": "string",
|
|
18087
|
+
"description": "Holds the name of the component that is loading",
|
|
18088
|
+
"required": false
|
|
18089
|
+
}
|
|
18090
|
+
}
|
|
18091
|
+
},
|
|
18092
|
+
"required": false,
|
|
18093
|
+
"description": ""
|
|
18094
|
+
}
|
|
18095
|
+
}
|
|
18096
|
+
},
|
|
18006
18097
|
"src/lib/components/listeners/FefferyGeolocation.react.js": {
|
|
18007
18098
|
"description": "",
|
|
18008
18099
|
"displayName": "FefferyGeolocation",
|
|
@@ -18247,6 +18338,145 @@
|
|
|
18247
18338
|
}
|
|
18248
18339
|
}
|
|
18249
18340
|
},
|
|
18341
|
+
"src/lib/components/listeners/FefferyListenElementSize.react.js": {
|
|
18342
|
+
"description": "\u5143\u7d20\u5c3a\u5bf8\u76d1\u542c\u7ec4\u4ef6FefferyListenElementSize",
|
|
18343
|
+
"displayName": "FefferyListenElementSize",
|
|
18344
|
+
"methods": [],
|
|
18345
|
+
"props": {
|
|
18346
|
+
"id": {
|
|
18347
|
+
"type": {
|
|
18348
|
+
"name": "string"
|
|
18349
|
+
},
|
|
18350
|
+
"required": false,
|
|
18351
|
+
"description": "\u7ec4\u4ef6id"
|
|
18352
|
+
},
|
|
18353
|
+
"key": {
|
|
18354
|
+
"type": {
|
|
18355
|
+
"name": "string"
|
|
18356
|
+
},
|
|
18357
|
+
"required": false,
|
|
18358
|
+
"description": "\u5f3a\u5236\u5237\u65b0\u7528key\u503c"
|
|
18359
|
+
},
|
|
18360
|
+
"target": {
|
|
18361
|
+
"type": {
|
|
18362
|
+
"name": "string"
|
|
18363
|
+
},
|
|
18364
|
+
"required": true,
|
|
18365
|
+
"description": "\u5fc5\u586b\uff0c\u8bbe\u7f6e\u5c3a\u5bf8\u76d1\u542c\u76ee\u6807\u5143\u7d20id"
|
|
18366
|
+
},
|
|
18367
|
+
"width": {
|
|
18368
|
+
"type": {
|
|
18369
|
+
"name": "number"
|
|
18370
|
+
},
|
|
18371
|
+
"required": false,
|
|
18372
|
+
"description": "\u76d1\u542c\u76ee\u6807\u5143\u7d20\u50cf\u7d20\u5bbd\u5ea6"
|
|
18373
|
+
},
|
|
18374
|
+
"height": {
|
|
18375
|
+
"type": {
|
|
18376
|
+
"name": "number"
|
|
18377
|
+
},
|
|
18378
|
+
"required": false,
|
|
18379
|
+
"description": "\u76d1\u542c\u76ee\u6807\u5143\u7d20\u50cf\u7d20\u9ad8\u5ea6"
|
|
18380
|
+
},
|
|
18381
|
+
"setProps": {
|
|
18382
|
+
"type": {
|
|
18383
|
+
"name": "func"
|
|
18384
|
+
},
|
|
18385
|
+
"required": false,
|
|
18386
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
18387
|
+
},
|
|
18388
|
+
"loading_state": {
|
|
18389
|
+
"type": {
|
|
18390
|
+
"name": "shape",
|
|
18391
|
+
"value": {
|
|
18392
|
+
"is_loading": {
|
|
18393
|
+
"name": "bool",
|
|
18394
|
+
"description": "Determines if the component is loading or not",
|
|
18395
|
+
"required": false
|
|
18396
|
+
},
|
|
18397
|
+
"prop_name": {
|
|
18398
|
+
"name": "string",
|
|
18399
|
+
"description": "Holds which property is loading",
|
|
18400
|
+
"required": false
|
|
18401
|
+
},
|
|
18402
|
+
"component_name": {
|
|
18403
|
+
"name": "string",
|
|
18404
|
+
"description": "Holds the name of the component that is loading",
|
|
18405
|
+
"required": false
|
|
18406
|
+
}
|
|
18407
|
+
}
|
|
18408
|
+
},
|
|
18409
|
+
"required": false,
|
|
18410
|
+
"description": ""
|
|
18411
|
+
}
|
|
18412
|
+
}
|
|
18413
|
+
},
|
|
18414
|
+
"src/lib/components/listeners/FefferyListenHover.js": {
|
|
18415
|
+
"description": "\u9f20\u6807\u60ac\u505c\u76d1\u542c\u7ec4\u4ef6FefferyListenHover",
|
|
18416
|
+
"displayName": "FefferyListenHover",
|
|
18417
|
+
"methods": [],
|
|
18418
|
+
"props": {
|
|
18419
|
+
"id": {
|
|
18420
|
+
"type": {
|
|
18421
|
+
"name": "string"
|
|
18422
|
+
},
|
|
18423
|
+
"required": false,
|
|
18424
|
+
"description": "\u7ec4\u4ef6id"
|
|
18425
|
+
},
|
|
18426
|
+
"key": {
|
|
18427
|
+
"type": {
|
|
18428
|
+
"name": "string"
|
|
18429
|
+
},
|
|
18430
|
+
"required": false,
|
|
18431
|
+
"description": "\u5f3a\u5236\u5237\u65b0\u7528key\u503c"
|
|
18432
|
+
},
|
|
18433
|
+
"targetSelector": {
|
|
18434
|
+
"type": {
|
|
18435
|
+
"name": "string"
|
|
18436
|
+
},
|
|
18437
|
+
"required": true,
|
|
18438
|
+
"description": "\u5fc5\u586b\uff0c\u76d1\u542c\u76ee\u6807\u9009\u62e9\u5668\u5b57\u7b26\u4e32"
|
|
18439
|
+
},
|
|
18440
|
+
"isHovering": {
|
|
18441
|
+
"type": {
|
|
18442
|
+
"name": "bool"
|
|
18443
|
+
},
|
|
18444
|
+
"required": false,
|
|
18445
|
+
"description": "\u76d1\u542c\u76ee\u6807\u5143\u7d20\u662f\u5426\u5904\u4e8e\u9f20\u6807\u60ac\u505c\u72b6\u6001"
|
|
18446
|
+
},
|
|
18447
|
+
"setProps": {
|
|
18448
|
+
"type": {
|
|
18449
|
+
"name": "func"
|
|
18450
|
+
},
|
|
18451
|
+
"required": false,
|
|
18452
|
+
"description": "Dash-assigned callback that should be called to report property changes\r\nto Dash, to make them available for callbacks."
|
|
18453
|
+
},
|
|
18454
|
+
"loading_state": {
|
|
18455
|
+
"type": {
|
|
18456
|
+
"name": "shape",
|
|
18457
|
+
"value": {
|
|
18458
|
+
"is_loading": {
|
|
18459
|
+
"name": "bool",
|
|
18460
|
+
"description": "Determines if the component is loading or not",
|
|
18461
|
+
"required": false
|
|
18462
|
+
},
|
|
18463
|
+
"prop_name": {
|
|
18464
|
+
"name": "string",
|
|
18465
|
+
"description": "Holds which property is loading",
|
|
18466
|
+
"required": false
|
|
18467
|
+
},
|
|
18468
|
+
"component_name": {
|
|
18469
|
+
"name": "string",
|
|
18470
|
+
"description": "Holds the name of the component that is loading",
|
|
18471
|
+
"required": false
|
|
18472
|
+
}
|
|
18473
|
+
}
|
|
18474
|
+
},
|
|
18475
|
+
"required": false,
|
|
18476
|
+
"description": ""
|
|
18477
|
+
}
|
|
18478
|
+
}
|
|
18479
|
+
},
|
|
18250
18480
|
"src/lib/components/listeners/FefferyListenPaste.react.js": {
|
|
18251
18481
|
"description": "",
|
|
18252
18482
|
"displayName": "FefferyListenPaste",
|
|
@@ -18329,7 +18559,7 @@
|
|
|
18329
18559
|
}
|
|
18330
18560
|
},
|
|
18331
18561
|
"src/lib/components/listeners/FefferyListenScroll.react.js": {
|
|
18332
|
-
"description": "",
|
|
18562
|
+
"description": "\u6eda\u52a8\u6761\u76d1\u542c\u7ec4\u4ef6FefferyListenScroll",
|
|
18333
18563
|
"displayName": "FefferyListenScroll",
|
|
18334
18564
|
"methods": [],
|
|
18335
18565
|
"props": {
|
|
@@ -18340,6 +18570,13 @@
|
|
|
18340
18570
|
"required": false,
|
|
18341
18571
|
"description": "\u7ec4\u4ef6id"
|
|
18342
18572
|
},
|
|
18573
|
+
"key": {
|
|
18574
|
+
"type": {
|
|
18575
|
+
"name": "string"
|
|
18576
|
+
},
|
|
18577
|
+
"required": false,
|
|
18578
|
+
"description": "\u5f3a\u5236\u5237\u65b0\u7528key\u503c"
|
|
18579
|
+
},
|
|
18343
18580
|
"target": {
|
|
18344
18581
|
"type": {
|
|
18345
18582
|
"name": "string"
|
|
@@ -18354,6 +18591,70 @@
|
|
|
18354
18591
|
"required": false,
|
|
18355
18592
|
"description": "\u76d1\u542c\u76ee\u6807\u6eda\u52a8\u6761\u7684\u6c34\u5e73\u53ca\u7ad6\u76f4\u65b9\u5411\u4e0a\u7684\u50cf\u7d20\u504f\u79fb\u91cf"
|
|
18356
18593
|
},
|
|
18594
|
+
"isScrolling": {
|
|
18595
|
+
"type": {
|
|
18596
|
+
"name": "bool"
|
|
18597
|
+
},
|
|
18598
|
+
"required": false,
|
|
18599
|
+
"description": "\u76d1\u542c\u76ee\u6807\u6eda\u52a8\u6761\u662f\u5426\u6b63\u5728\u6eda\u52a8\u4e2d"
|
|
18600
|
+
},
|
|
18601
|
+
"arrivedState": {
|
|
18602
|
+
"type": {
|
|
18603
|
+
"name": "object"
|
|
18604
|
+
},
|
|
18605
|
+
"required": false,
|
|
18606
|
+
"description": "\u76d1\u542c\u76ee\u6807\u6eda\u52a8\u6761\u7684\u5230\u8fbe\u8fb9\u754c\u72b6\u6001"
|
|
18607
|
+
},
|
|
18608
|
+
"directions": {
|
|
18609
|
+
"type": {
|
|
18610
|
+
"name": "object"
|
|
18611
|
+
},
|
|
18612
|
+
"required": false,
|
|
18613
|
+
"description": "\u76d1\u542c\u76ee\u6807\u6eda\u52a8\u6761\u7684\u6eda\u52a8\u65b9\u5411"
|
|
18614
|
+
},
|
|
18615
|
+
"throttle": {
|
|
18616
|
+
"type": {
|
|
18617
|
+
"name": "number"
|
|
18618
|
+
},
|
|
18619
|
+
"required": false,
|
|
18620
|
+
"description": "\u6eda\u52a8\u4e8b\u4ef6\u76d1\u542c\u8282\u6d41\u65f6\u957f\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2\r\n\u9ed8\u8ba4\uff1a`0`"
|
|
18621
|
+
},
|
|
18622
|
+
"idle": {
|
|
18623
|
+
"type": {
|
|
18624
|
+
"name": "number"
|
|
18625
|
+
},
|
|
18626
|
+
"required": false,
|
|
18627
|
+
"description": "\u6eda\u52a8\u7ed3\u675f\u884c\u4e3a\u7684\u68c0\u67e5\u65f6\u957f\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2\uff0c\u5f53`throttle>0`\u65f6\uff0c\u68c0\u67e5\u65f6\u957f\u5c06\u4e3a`throttle+idle`\r\n\u9ed8\u8ba4\uff1a`0`"
|
|
18628
|
+
},
|
|
18629
|
+
"offset": {
|
|
18630
|
+
"type": {
|
|
18631
|
+
"name": "shape",
|
|
18632
|
+
"value": {
|
|
18633
|
+
"top": {
|
|
18634
|
+
"name": "number",
|
|
18635
|
+
"description": "\u4e0a\u9876\u7aef\u5230\u8fbe\u8fb9\u754c\u50cf\u7d20\u9608\u503c",
|
|
18636
|
+
"required": false
|
|
18637
|
+
},
|
|
18638
|
+
"bottom": {
|
|
18639
|
+
"name": "number",
|
|
18640
|
+
"description": "\u4e0b\u5e95\u90e8\u5230\u8fbe\u8fb9\u754c\u50cf\u7d20\u9608\u503c",
|
|
18641
|
+
"required": false
|
|
18642
|
+
},
|
|
18643
|
+
"left": {
|
|
18644
|
+
"name": "number",
|
|
18645
|
+
"description": "\u5de6\u4fa7\u5230\u8fbe\u8fb9\u754c\u50cf\u7d20\u9608\u503c",
|
|
18646
|
+
"required": false
|
|
18647
|
+
},
|
|
18648
|
+
"right": {
|
|
18649
|
+
"name": "number",
|
|
18650
|
+
"description": "\u53f3\u4fa7\u5230\u8fbe\u8fb9\u754c\u50cf\u7d20\u9608\u503c",
|
|
18651
|
+
"required": false
|
|
18652
|
+
}
|
|
18653
|
+
}
|
|
18654
|
+
},
|
|
18655
|
+
"required": false,
|
|
18656
|
+
"description": "\u9488\u5bf9\u5404\u4e2a\u65b9\u5411\u7684\u5230\u8fbe\u8fb9\u754c\u72b6\u6001\uff0c\u8bbe\u7f6e\u50cf\u7d20\u9608\u503c"
|
|
18657
|
+
},
|
|
18357
18658
|
"setProps": {
|
|
18358
18659
|
"type": {
|
|
18359
18660
|
"name": "func"
|
package/package.json
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useEventListener } from 'ahooks';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 通用事件监听组件FefferyEventListener
|
|
6
|
+
*/
|
|
7
|
+
const FefferyEventListener = (props) => {
|
|
8
|
+
const {
|
|
9
|
+
eventName,
|
|
10
|
+
handler,
|
|
11
|
+
targetSelector,
|
|
12
|
+
enable,
|
|
13
|
+
setProps,
|
|
14
|
+
loading_state
|
|
15
|
+
} = props;
|
|
16
|
+
|
|
17
|
+
useEventListener(
|
|
18
|
+
eventName,
|
|
19
|
+
(e) => {
|
|
20
|
+
setProps({
|
|
21
|
+
result: eval(handler)(e)
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
target: () => document.querySelector(targetSelector),
|
|
26
|
+
enabled: enable
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return <></>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
FefferyEventListener.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* 组件id
|
|
36
|
+
*/
|
|
37
|
+
id: PropTypes.string,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 强制刷新用key值
|
|
41
|
+
*/
|
|
42
|
+
key: PropTypes.string,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 必填,目标事件名称
|
|
46
|
+
*/
|
|
47
|
+
eventName: PropTypes.string.isRequired,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 必填,自定义事件处理js函数字符串,唯一入参为事件对象,返回值将用于更新`result`属性
|
|
51
|
+
*/
|
|
52
|
+
handler: PropTypes.string,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 事件监听目标对应的选择器字符串,默认监听目标为整个页面
|
|
56
|
+
*/
|
|
57
|
+
targetSelector: PropTypes.string,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 控制是否开启监听
|
|
61
|
+
* 默认值:`true`
|
|
62
|
+
*/
|
|
63
|
+
enable: PropTypes.bool,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 监听`handler`对应函数的返回值,作为事件监听的结果
|
|
67
|
+
*/
|
|
68
|
+
result: PropTypes.any,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Dash-assigned callback that should be called to report property changes
|
|
72
|
+
* to Dash, to make them available for callbacks.
|
|
73
|
+
*/
|
|
74
|
+
setProps: PropTypes.func,
|
|
75
|
+
|
|
76
|
+
loading_state: PropTypes.shape({
|
|
77
|
+
/**
|
|
78
|
+
* Determines if the component is loading or not
|
|
79
|
+
*/
|
|
80
|
+
is_loading: PropTypes.bool,
|
|
81
|
+
/**
|
|
82
|
+
* Holds which property is loading
|
|
83
|
+
*/
|
|
84
|
+
prop_name: PropTypes.string,
|
|
85
|
+
/**
|
|
86
|
+
* Holds the name of the component that is loading
|
|
87
|
+
*/
|
|
88
|
+
component_name: PropTypes.string
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// 设置默认参数
|
|
93
|
+
FefferyEventListener.defaultProps = {
|
|
94
|
+
enable: true
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default FefferyEventListener;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useElementSize } from '@reactuses/core';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 元素尺寸监听组件FefferyListenElementSize
|
|
7
|
+
*/
|
|
8
|
+
const FefferyListenElementSize = (props) => {
|
|
9
|
+
let {
|
|
10
|
+
target,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
setProps,
|
|
14
|
+
loading_state
|
|
15
|
+
} = props;
|
|
16
|
+
|
|
17
|
+
const [_width, _height] = useElementSize(() => target ? document.getElementById(target) : document);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (width !== parseInt(_width)) {
|
|
21
|
+
setProps({ width: _width })
|
|
22
|
+
}
|
|
23
|
+
}, [_width])
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (height !== parseInt(_height)) {
|
|
27
|
+
setProps({ height: _height })
|
|
28
|
+
}
|
|
29
|
+
}, [_height])
|
|
30
|
+
|
|
31
|
+
return <></>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
FefferyListenElementSize.propTypes = {
|
|
35
|
+
/**
|
|
36
|
+
* 组件id
|
|
37
|
+
*/
|
|
38
|
+
id: PropTypes.string,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 强制刷新用key值
|
|
42
|
+
*/
|
|
43
|
+
key: PropTypes.string,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 必填,设置尺寸监听目标元素id
|
|
47
|
+
*/
|
|
48
|
+
target: PropTypes.string.isRequired,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 监听目标元素像素宽度
|
|
52
|
+
*/
|
|
53
|
+
width: PropTypes.number,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 监听目标元素像素高度
|
|
57
|
+
*/
|
|
58
|
+
height: PropTypes.number,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Dash-assigned callback that should be called to report property changes
|
|
62
|
+
* to Dash, to make them available for callbacks.
|
|
63
|
+
*/
|
|
64
|
+
setProps: PropTypes.func,
|
|
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
|
+
// 设置默认参数
|
|
83
|
+
FefferyListenElementSize.defaultProps = {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default FefferyListenElementSize;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useHover } from 'ahooks';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 鼠标悬停监听组件FefferyListenHover
|
|
6
|
+
*/
|
|
7
|
+
const FefferyListenHover = (props) => {
|
|
8
|
+
const {
|
|
9
|
+
targetSelector,
|
|
10
|
+
setProps,
|
|
11
|
+
loading_state
|
|
12
|
+
} = props;
|
|
13
|
+
|
|
14
|
+
useHover(
|
|
15
|
+
() => document.querySelector(targetSelector),
|
|
16
|
+
{
|
|
17
|
+
onChange: (e) => {
|
|
18
|
+
setProps({
|
|
19
|
+
isHovering: e
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
return <></>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
FefferyListenHover.propTypes = {
|
|
29
|
+
/**
|
|
30
|
+
* 组件id
|
|
31
|
+
*/
|
|
32
|
+
id: PropTypes.string,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 强制刷新用key值
|
|
36
|
+
*/
|
|
37
|
+
key: PropTypes.string,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 必填,监听目标选择器字符串
|
|
41
|
+
*/
|
|
42
|
+
targetSelector: PropTypes.string.isRequired,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 监听目标元素是否处于鼠标悬停状态
|
|
46
|
+
*/
|
|
47
|
+
isHovering: PropTypes.bool,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Dash-assigned callback that should be called to report property changes
|
|
51
|
+
* to Dash, to make them available for callbacks.
|
|
52
|
+
*/
|
|
53
|
+
setProps: PropTypes.func,
|
|
54
|
+
|
|
55
|
+
loading_state: PropTypes.shape({
|
|
56
|
+
/**
|
|
57
|
+
* Determines if the component is loading or not
|
|
58
|
+
*/
|
|
59
|
+
is_loading: PropTypes.bool,
|
|
60
|
+
/**
|
|
61
|
+
* Holds which property is loading
|
|
62
|
+
*/
|
|
63
|
+
prop_name: PropTypes.string,
|
|
64
|
+
/**
|
|
65
|
+
* Holds the name of the component that is loading
|
|
66
|
+
*/
|
|
67
|
+
component_name: PropTypes.string
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// 设置默认参数
|
|
72
|
+
FefferyListenHover.defaultProps = {
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default FefferyListenHover;
|