feffery_utils_components 0.0.22 → 0.0.23

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.
@@ -2956,7 +2956,15 @@
2956
2956
  },
2957
2957
  "className": {
2958
2958
  "type": {
2959
- "name": "string"
2959
+ "name": "union",
2960
+ "value": [
2961
+ {
2962
+ "name": "string"
2963
+ },
2964
+ {
2965
+ "name": "object"
2966
+ }
2967
+ ]
2960
2968
  },
2961
2969
  "required": false,
2962
2970
  "description": ""
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_utils_components",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "Build more utility components for Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,6 +27,7 @@
27
27
  "@uiw/react-color-wheel": "^1.1.0",
28
28
  "ahooks": "^3.7.0",
29
29
  "byte-guide": "^1.0.7",
30
+ "lodash": "^4.17.21",
30
31
  "ninja-keys": "^1.1.12",
31
32
  "nprogress": "^0.2.0",
32
33
  "ramda": "^0.26.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_utils_components",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "Build more utility components for Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,6 +27,7 @@
27
27
  "@uiw/react-color-wheel": "^1.1.0",
28
28
  "ahooks": "^3.7.0",
29
29
  "byte-guide": "^1.0.7",
30
+ "lodash": "^4.17.21",
30
31
  "ninja-keys": "^1.1.12",
31
32
  "nprogress": "^0.2.0",
32
33
  "ramda": "^0.26.1",
@@ -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.22"
6
+ const version = "0.0.23"
7
7
 
8
8
  include("jl/''_fefferyblockcolorpicker.jl")
9
9
  include("jl/''_fefferycirclecolorpicker.jl")
@@ -49,14 +49,14 @@ function __init__()
49
49
  [
50
50
  DashBase.Resource(
51
51
  relative_package_path = "feffery_utils_components.min.js",
52
- external_url = "https://unpkg.com/feffery_utils_components@0.0.22/feffery_utils_components/feffery_utils_components.min.js",
52
+ external_url = "https://unpkg.com/feffery_utils_components@0.0.23/feffery_utils_components/feffery_utils_components.min.js",
53
53
  dynamic = nothing,
54
54
  async = nothing,
55
55
  type = :js
56
56
  ),
57
57
  DashBase.Resource(
58
58
  relative_package_path = "feffery_utils_components.min.js.map",
59
- external_url = "https://unpkg.com/feffery_utils_components@0.0.22/feffery_utils_components/feffery_utils_components.min.js.map",
59
+ external_url = "https://unpkg.com/feffery_utils_components@0.0.23/feffery_utils_components/feffery_utils_components.min.js.map",
60
60
  dynamic = true,
61
61
  async = nothing,
62
62
  type = :js
@@ -15,7 +15,7 @@ Keyword arguments:
15
15
  - `id` (String; optional)
16
16
  - `_height` (Real; optional)
17
17
  - `_width` (Real; optional)
18
- - `className` (String; optional)
18
+ - `className` (String | Dict; optional)
19
19
  - `clickAwayCount` (Real; optional)
20
20
  - `contextMenuEvent` (optional): . contextMenuEvent has the following type: lists containing elements 'pageX', 'pageY', 'timestamp'.
21
21
  Those elements have the following types:
@@ -1,4 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
+ import { useCss } from 'react-use';
3
+ import { isString } from 'lodash';
2
4
  import PropTypes from 'prop-types';
3
5
  import { useSize, useRequest, useHover, useClickAway } from 'ahooks';
4
6
 
@@ -62,7 +64,11 @@ const FefferyDiv = (props) => {
62
64
  return <div
63
65
  id={id}
64
66
  style={style}
65
- className={className}
67
+ className={
68
+ isString(className) ?
69
+ className :
70
+ useCss(className)
71
+ }
66
72
  ref={ref}
67
73
  onClick={() => setProps({ nClicks: nClicks + 1 })}
68
74
  onDoubleClick={() => setProps({ nDoubleClicks: nDoubleClicks + 1 })}
@@ -97,7 +103,10 @@ FefferyDiv.propTypes = {
97
103
 
98
104
  style: PropTypes.object,
99
105
 
100
- className: PropTypes.string,
106
+ className: PropTypes.oneOfType([
107
+ PropTypes.string,
108
+ PropTypes.object
109
+ ]),
101
110
 
102
111
  // 监听容器像素宽度变化
103
112
  _width: PropTypes.number,
@@ -14,10 +14,14 @@ app.layout = html.Div(
14
14
  [
15
15
  fuc.FefferyDiv(
16
16
  id='div-demo',
17
+ className={
18
+ '&:hover': {
19
+ 'background': 'lightgrey',
20
+ }
21
+ },
17
22
  style={
18
23
  'width': '200px',
19
24
  'height': '100px',
20
- 'background': 'lightgrey',
21
25
  'border': '1ox dashed black'
22
26
  }
23
27
  )