@visns-studio/visns-components 5.4.5 → 5.4.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/package.json +14 -14
- package/src/components/crm/DataGrid.jsx +2 -0
- package/src/components/crm/README_DATAGRID.md +70 -0
- package/src/components/crm/generic/GenericIndex.jsx +2 -0
- package/src/components/crm/styles/DataGrid.module.scss +2 -2
- package/src/components/styles/global.css +2 -2
- package/src/examples/CustomHoverDataGrid.jsx +92 -0
package/package.json
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"akar-icons": "^1.9.31",
|
|
15
15
|
"array-move": "^4.0.0",
|
|
16
16
|
"awesome-debounce-promise": "^2.1.0",
|
|
17
|
-
"axios": "^1.8.
|
|
17
|
+
"axios": "^1.8.4",
|
|
18
18
|
"dayjs": "^1.11.13",
|
|
19
|
-
"fabric": "^6.
|
|
19
|
+
"fabric": "^6.6.2",
|
|
20
20
|
"file-saver": "^2.0.5",
|
|
21
21
|
"framer-motion": "^11.18.2",
|
|
22
22
|
"html-react-parser": "^5.2.3",
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"numeral": "^2.0.6",
|
|
28
28
|
"pluralize": "^8.0.0",
|
|
29
29
|
"quill-image-uploader": "^1.3.0",
|
|
30
|
-
"react-big-calendar": "^1.
|
|
30
|
+
"react-big-calendar": "^1.18.0",
|
|
31
31
|
"react-color": "^2.19.3",
|
|
32
32
|
"react-confirm-alert": "^3.0.6",
|
|
33
33
|
"react-copy-to-clipboard": "^5.1.0",
|
|
34
34
|
"react-datepicker": "^7.6.0",
|
|
35
|
-
"react-dropzone": "^14.3.
|
|
35
|
+
"react-dropzone": "^14.3.8",
|
|
36
36
|
"react-grid-gallery": "^1.0.1",
|
|
37
37
|
"react-number-format": "^5.4.3",
|
|
38
38
|
"react-password-strength-bar": "^0.4.1",
|
|
39
39
|
"react-promise-tracker": "^2.1.1",
|
|
40
40
|
"react-quill": "^2.0.0",
|
|
41
41
|
"react-reveal": "^1.2.2",
|
|
42
|
-
"react-router-dom": "^6.
|
|
43
|
-
"react-select": "^5.
|
|
42
|
+
"react-router-dom": "^6.30.0",
|
|
43
|
+
"react-select": "^5.10.1",
|
|
44
44
|
"react-signature-pad-wrapper": "^4.1.0",
|
|
45
45
|
"react-slugify": "^4.0.1",
|
|
46
46
|
"react-sortable-hoc": "^2.0.0",
|
|
@@ -55,30 +55,30 @@
|
|
|
55
55
|
"truncate": "^3.0.0",
|
|
56
56
|
"uuid": "^10.0.0",
|
|
57
57
|
"validator": "^13.15.0",
|
|
58
|
-
"vite": "^5.4.
|
|
58
|
+
"vite": "^5.4.16",
|
|
59
59
|
"yarn": "^1.22.22"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/core": "^7.26.
|
|
63
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
64
|
-
"@babel/preset-env": "^7.26.
|
|
62
|
+
"@babel/core": "^7.26.10",
|
|
63
|
+
"@babel/plugin-transform-runtime": "^7.26.10",
|
|
64
|
+
"@babel/preset-env": "^7.26.9",
|
|
65
65
|
"@babel/preset-react": "^7.26.3",
|
|
66
66
|
"babel-loader": "^9.2.1",
|
|
67
67
|
"copy-webpack-plugin": "^12.0.2",
|
|
68
68
|
"css-loader": "^7.1.2",
|
|
69
|
-
"css-minimizer-webpack-plugin": "^7.0.
|
|
69
|
+
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
70
70
|
"mini-css-extract-plugin": "^2.9.2",
|
|
71
71
|
"react": "^18.3.1",
|
|
72
72
|
"react-dom": "^18.3.1",
|
|
73
|
-
"sass": "^1.
|
|
74
|
-
"sass-loader": "^16.0.
|
|
73
|
+
"sass": "^1.86.2",
|
|
74
|
+
"sass-loader": "^16.0.5"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"react": "^17.0.0 || ^18.0.0",
|
|
78
78
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
79
79
|
},
|
|
80
80
|
"name": "@visns-studio/visns-components",
|
|
81
|
-
"version": "5.4.
|
|
81
|
+
"version": "5.4.6",
|
|
82
82
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
83
83
|
"main": "src/index.js",
|
|
84
84
|
"files": [
|
|
@@ -133,6 +133,7 @@ const DataGrid = forwardRef(
|
|
|
133
133
|
columns,
|
|
134
134
|
form,
|
|
135
135
|
gridHeight,
|
|
136
|
+
hoverColor,
|
|
136
137
|
mapbox,
|
|
137
138
|
pageData,
|
|
138
139
|
pageSetting,
|
|
@@ -2856,6 +2857,7 @@ const DataGrid = forwardRef(
|
|
|
2856
2857
|
: 450
|
|
2857
2858
|
: 400,
|
|
2858
2859
|
boxShadow: 'none',
|
|
2860
|
+
...(hoverColor ? { '--hover-color': hoverColor } : {}),
|
|
2859
2861
|
});
|
|
2860
2862
|
const headerProps = {
|
|
2861
2863
|
style: style ? style : {},
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# DataGrid Component
|
|
2
|
+
|
|
3
|
+
## Customizing Hover Color
|
|
4
|
+
|
|
5
|
+
The DataGrid component now supports customizable hover colors. This allows you to set different hover colors for different instances of the DataGrid.
|
|
6
|
+
|
|
7
|
+
### Method 1: Using the hoverColor Prop (Recommended)
|
|
8
|
+
|
|
9
|
+
The simplest way to set a custom hover color is to use the `hoverColor` prop directly:
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import DataGrid from './components/crm/DataGrid';
|
|
13
|
+
|
|
14
|
+
// In your component
|
|
15
|
+
<DataGrid
|
|
16
|
+
hoverColor="rgb(255, 240, 230)" // Custom hover color
|
|
17
|
+
// other props...
|
|
18
|
+
/>;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Method 2: Using CSS Variables in Component Props
|
|
22
|
+
|
|
23
|
+
You can pass a custom style object to the DataGrid component with the `--hover-color` CSS variable:
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
import DataGrid from './components/crm/DataGrid';
|
|
27
|
+
|
|
28
|
+
// Define custom styles with hover color
|
|
29
|
+
const customStyle = {
|
|
30
|
+
'--hover-color': 'rgb(255, 240, 230)', // Custom hover color
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// In your component
|
|
34
|
+
<DataGrid
|
|
35
|
+
style={customStyle}
|
|
36
|
+
// other props...
|
|
37
|
+
/>;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Method 3: Using CSS/SCSS
|
|
41
|
+
|
|
42
|
+
You can define the `--hover-color` CSS variable in your CSS or SCSS files:
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
/* Global default hover color */
|
|
46
|
+
:root {
|
|
47
|
+
--hover-color: rgb(230, 240, 250);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* For specific containers */
|
|
51
|
+
.special-grid-container {
|
|
52
|
+
--hover-color: rgb(255, 240, 230);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then apply the class to your container:
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
<div className="special-grid-container">
|
|
60
|
+
<DataGrid {...props} />
|
|
61
|
+
</div>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Default Value
|
|
65
|
+
|
|
66
|
+
If no hover color is specified (via prop or CSS variable), the DataGrid will use a default light blue color (`rgb(230, 240, 250)`).
|
|
67
|
+
|
|
68
|
+
### Example
|
|
69
|
+
|
|
70
|
+
See the `src/examples/CustomHoverDataGrid.jsx` file for a complete example of how to implement custom hover colors using all three methods.
|
|
@@ -40,6 +40,7 @@ function useConfig(setting, tabs, filters, setRowsSelected, tableSetting) {
|
|
|
40
40
|
columns: setting.columns,
|
|
41
41
|
setRowsSelected,
|
|
42
42
|
settings: setting.settings,
|
|
43
|
+
style: setting.style || {},
|
|
43
44
|
tableSetting,
|
|
44
45
|
type: setting.type ? setting.type : 'table',
|
|
45
46
|
});
|
|
@@ -340,6 +341,7 @@ function GenericIndex({
|
|
|
340
341
|
<Table
|
|
341
342
|
{...config}
|
|
342
343
|
ref={gridRef}
|
|
344
|
+
hoverColor={config.style.hoverColor}
|
|
343
345
|
gridHeight={windowHeight * 0.65}
|
|
344
346
|
setConfig={setConfig}
|
|
345
347
|
setTableData={setTableData}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
.vs-datagrid--row:hover {
|
|
25
25
|
.InovuaReactDataGrid__row-cell-wrap {
|
|
26
|
-
background: rgb(
|
|
26
|
+
background: var(--hover-color, rgb(230, 240, 250)) !important;
|
|
27
27
|
cursor: pointer;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
.InovuaReactDataGrid__row-hover-target:hover {
|
|
40
40
|
color: var(--primary-color) !important;
|
|
41
|
-
background: rgb(
|
|
41
|
+
background: var(--hover-color, rgb(230, 240, 250)) !important;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.InovuaReactDataGrid__row:hover {
|
|
@@ -161,7 +161,7 @@ input[type]:not([type='search']):not([type='url']):not([type='hidden']):not(
|
|
|
161
161
|
|
|
162
162
|
.vs-datagrid--row:hover {
|
|
163
163
|
.InovuaReactDataGrid__row-cell-wrap {
|
|
164
|
-
background: rgb(
|
|
164
|
+
background: var(--hover-color, rgb(230, 240, 250)) !important;
|
|
165
165
|
cursor: pointer;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -176,7 +176,7 @@ input[type]:not([type='search']):not([type='url']):not([type='hidden']):not(
|
|
|
176
176
|
|
|
177
177
|
.InovuaReactDataGrid__row-hover-target:hover {
|
|
178
178
|
color: var(--paragraph-color) !important;
|
|
179
|
-
background: rgb(
|
|
179
|
+
background: var(--hover-color, rgb(230, 240, 250)) !important;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
.InovuaReactDataGrid__row:hover {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DataGrid from '../components/crm/DataGrid';
|
|
3
|
+
|
|
4
|
+
// Example of using custom hover color with DataGrid
|
|
5
|
+
const CustomHoverDataGrid = () => {
|
|
6
|
+
// Example DataGrid props with direct hoverColor prop
|
|
7
|
+
const exampleProps = {
|
|
8
|
+
// Your DataGrid props here
|
|
9
|
+
hoverColor: 'rgb(255, 240, 230)', // Peachy hover color
|
|
10
|
+
// Other props...
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Define custom styles with hover color (alternative method)
|
|
14
|
+
const customStyle = {
|
|
15
|
+
// You can define any CSS variables here
|
|
16
|
+
'--hover-color': 'rgb(230, 255, 230)', // Light green hover color
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div>
|
|
21
|
+
<h2>DataGrid with Custom Hover Color</h2>
|
|
22
|
+
<p>
|
|
23
|
+
This example shows how to customize the hover color of the
|
|
24
|
+
DataGrid.
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<h3>Method 1: Using the hoverColor prop (Recommended)</h3>
|
|
28
|
+
<div>
|
|
29
|
+
<DataGrid {...exampleProps} />
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<h3>Method 2: Using CSS Variables in style prop</h3>
|
|
33
|
+
<div>
|
|
34
|
+
<DataGrid style={customStyle} />
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<h3>Method 3: Using CSS/SCSS classes</h3>
|
|
38
|
+
<div className="custom-hover-grid">
|
|
39
|
+
<DataGrid />
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<h3>How to Use Custom Hover Colors</h3>
|
|
43
|
+
<p>You can set a custom hover color in three ways:</p>
|
|
44
|
+
<ol>
|
|
45
|
+
<li>
|
|
46
|
+
<strong>Using the hoverColor prop (Recommended):</strong>
|
|
47
|
+
<pre>
|
|
48
|
+
{`
|
|
49
|
+
// Direct prop approach
|
|
50
|
+
<DataGrid
|
|
51
|
+
hoverColor="rgb(255, 240, 230)"
|
|
52
|
+
{...otherProps}
|
|
53
|
+
/>
|
|
54
|
+
`}
|
|
55
|
+
</pre>
|
|
56
|
+
</li>
|
|
57
|
+
<li>
|
|
58
|
+
<strong>Using CSS Variables in style prop:</strong>
|
|
59
|
+
<pre>
|
|
60
|
+
{`
|
|
61
|
+
// Define in your component
|
|
62
|
+
const customStyle = {
|
|
63
|
+
'--hover-color': 'rgb(230, 255, 230)'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Apply to DataGrid
|
|
67
|
+
<DataGrid style={customStyle} {...otherProps} />
|
|
68
|
+
`}
|
|
69
|
+
</pre>
|
|
70
|
+
</li>
|
|
71
|
+
<li>
|
|
72
|
+
<strong>Using CSS/SCSS:</strong>
|
|
73
|
+
<pre>
|
|
74
|
+
{`
|
|
75
|
+
/* In your CSS/SCSS file */
|
|
76
|
+
:root {
|
|
77
|
+
--hover-color: rgb(230, 240, 250);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* For specific containers */
|
|
81
|
+
.custom-hover-grid {
|
|
82
|
+
--hover-color: rgb(200, 220, 255);
|
|
83
|
+
}
|
|
84
|
+
`}
|
|
85
|
+
</pre>
|
|
86
|
+
</li>
|
|
87
|
+
</ol>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default CustomHoverDataGrid;
|