@visns-studio/visns-components 5.0.19 → 5.0.20
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 +6 -6
- package/src/components/crm/MultiSelect.jsx +46 -67
- package/src/components/crm/auth/styles/Profile.module.scss +6 -7
- package/src/components/crm/generic/GenericDashboard.jsx +467 -29
- package/src/components/crm/generic/GenericFormBuilder.jsx +96 -32
- package/src/components/crm/generic/styles/AuditLog.module.scss +3 -3
- package/src/components/crm/generic/styles/AuditLogs.module.scss +1 -1
- package/src/components/crm/generic/styles/GenericDashboard.module.scss +364 -0
- package/src/components/crm/generic/styles/GenericDynamic.module.scss +11 -11
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +327 -317
- package/src/components/crm/generic/styles/GenericIndex.module.scss +8 -8
- package/src/components/crm/generic/styles/GenericSort.module.scss +3 -3
- package/src/components/crm/generic/styles/NotificationList.module.scss +2 -2
- package/src/components/crm/sketch/SketchField.jsx +395 -0
- package/src/components/crm/sketch/arrow.jsx +108 -0
- package/src/components/crm/sketch/circle.jsx +75 -0
- package/src/components/crm/sketch/default-tool.jsx +16 -0
- package/src/components/crm/sketch/fabrictool.jsx +22 -0
- package/src/components/crm/sketch/history.jsx +144 -0
- package/src/components/crm/sketch/json/config.json +14 -0
- package/src/components/crm/sketch/line.jsx +64 -0
- package/src/components/crm/sketch/pan.jsx +48 -0
- package/src/components/crm/sketch/pencil.jsx +36 -0
- package/src/components/crm/sketch/rectangle-label-object.jsx +69 -0
- package/src/components/crm/sketch/rectangle-label.jsx +93 -0
- package/src/components/crm/sketch/rectangle.jsx +76 -0
- package/src/components/crm/sketch/select.jsx +16 -0
- package/src/components/crm/sketch/tools.jsx +11 -0
- package/src/components/crm/sketch/utils.jsx +67 -0
- package/src/components/crm/sorting/Item.jsx +2 -2
- package/src/components/crm/sorting/styles/Item.module.scss +12 -65
- package/src/components/crm/sorting/styles/List.module.scss +6 -20
- package/src/components/crm/styles/Form.module.scss +4 -6
- package/src/components/crm/styles/MultiSelect.module.scss +4 -0
- package/src/components/crm/styles/Navigation.module.scss +13 -6
- package/src/components/crm/styles/QrCode.module.scss +2 -2
- package/src/components/styles/global.css +8 -0
- package/src/index.js +2 -0
package/package.json
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"@fontsource/barlow": "^5.1.0",
|
|
5
5
|
"@inovua/reactdatagrid-community": "^5.10.2",
|
|
6
6
|
"@inovua/reactdatagrid-enterprise": "^5.10.2",
|
|
7
|
-
"@nivo/bar": "^0.
|
|
8
|
-
"@nivo/core": "^0.
|
|
9
|
-
"@nivo/line": "^0.
|
|
10
|
-
"@nivo/pie": "^0.
|
|
7
|
+
"@nivo/bar": "^0.88.0",
|
|
8
|
+
"@nivo/core": "^0.88.0",
|
|
9
|
+
"@nivo/line": "^0.88.0",
|
|
10
|
+
"@nivo/pie": "^0.88.0",
|
|
11
11
|
"@tinymce/tinymce-react": "^5.1.1",
|
|
12
12
|
"@vitejs/plugin-react": "^4.3.3",
|
|
13
13
|
"add": "^2.0.6",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react-quill": "^2.0.0",
|
|
41
41
|
"react-reveal": "^1.2.2",
|
|
42
42
|
"react-router-dom": "^6.27.0",
|
|
43
|
-
"react-select": "^5.
|
|
43
|
+
"react-select": "^5.9.0",
|
|
44
44
|
"react-signature-pad-wrapper": "^4.0.4",
|
|
45
45
|
"react-slugify": "^4.0.1",
|
|
46
46
|
"react-sortable-hoc": "^2.0.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
79
79
|
"name": "@visns-studio/visns-components",
|
|
80
|
-
"version": "5.0.
|
|
80
|
+
"version": "5.0.20",
|
|
81
81
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
82
82
|
"main": "src/index.js",
|
|
83
83
|
"files": [
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import CustomFetch from './Fetch';
|
|
3
|
-
import
|
|
3
|
+
import SelectList from './SelectList';
|
|
4
|
+
import Select, { createFilter } from 'react-select';
|
|
4
5
|
import CreatableSelect from 'react-select/creatable';
|
|
5
|
-
import styles from './styles/
|
|
6
|
-
|
|
7
|
-
const CustomOption = (props) => (
|
|
8
|
-
<components.Option {...props}>
|
|
9
|
-
<div>
|
|
10
|
-
{props.data.label}
|
|
11
|
-
{props.data.description && props.data.description !== '' && (
|
|
12
|
-
<div style={{ fontSize: '0.85em', color: '#888' }}>
|
|
13
|
-
{props.data.description}
|
|
14
|
-
</div>
|
|
15
|
-
)}
|
|
16
|
-
</div>
|
|
17
|
-
</components.Option>
|
|
18
|
-
);
|
|
6
|
+
import styles from './styles/MultiSelect.module.scss';
|
|
19
7
|
|
|
20
8
|
function MultiSelect({
|
|
21
9
|
className,
|
|
22
|
-
inputValue = [],
|
|
10
|
+
inputValue = [], // Default to an empty array
|
|
23
11
|
multi,
|
|
24
12
|
onChange,
|
|
25
|
-
options = [],
|
|
13
|
+
options = [], // Default to an empty array
|
|
26
14
|
placeholder,
|
|
27
15
|
settings,
|
|
28
16
|
style,
|
|
@@ -31,49 +19,49 @@ function MultiSelect({
|
|
|
31
19
|
}) {
|
|
32
20
|
const [selectOptions, setSelectOptions] = useState([]);
|
|
33
21
|
const [selectValue, setSelectValue] = useState([]);
|
|
22
|
+
const prevInputValueRef = useRef();
|
|
34
23
|
|
|
35
|
-
// Memoize transformed options
|
|
36
|
-
const memoizedOptions = useMemo(() => {
|
|
37
|
-
return options
|
|
38
|
-
.filter((a) => a?.label || a?.name || a?.description) // Filter out options with no label, name, or description
|
|
39
|
-
.map((a) => ({
|
|
40
|
-
value: a?.id,
|
|
41
|
-
label: a?.label || a?.name || a?.description || 'Unknown',
|
|
42
|
-
description: a?.description || '',
|
|
43
|
-
...a,
|
|
44
|
-
}));
|
|
45
|
-
}, [options]);
|
|
46
|
-
|
|
47
|
-
// Memoize transformed input values
|
|
48
|
-
const memoizedInputValue = useMemo(() => {
|
|
49
|
-
const normalizeInputValue = (value) =>
|
|
50
|
-
Array.isArray(value) ? value : value ? [value] : [];
|
|
51
|
-
|
|
52
|
-
return normalizeInputValue(inputValue)
|
|
53
|
-
.filter((a) => a?.label || a?.name || a?.description) // Filter out values with no label, name, or description
|
|
54
|
-
.map((a) => ({
|
|
55
|
-
value: a?.id,
|
|
56
|
-
label: a?.label || a?.name || a?.description || 'Unknown',
|
|
57
|
-
description: a?.description || '',
|
|
58
|
-
...a,
|
|
59
|
-
}));
|
|
60
|
-
}, [inputValue]);
|
|
61
|
-
|
|
62
|
-
// Set options when memoizedOptions changes
|
|
63
24
|
useEffect(() => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
25
|
+
const _options = Array.isArray(options)
|
|
26
|
+
? options.map((a) => ({
|
|
27
|
+
value: a.id,
|
|
28
|
+
label: a.label || a.name || a.description || 'Unknown',
|
|
29
|
+
...a,
|
|
30
|
+
}))
|
|
31
|
+
: [];
|
|
32
|
+
setSelectOptions(_options);
|
|
33
|
+
}, [options]);
|
|
68
34
|
|
|
69
|
-
// Set value when memoizedInputValue changes
|
|
70
35
|
useEffect(() => {
|
|
36
|
+
// Only update if `inputValue` content has changed
|
|
71
37
|
if (
|
|
72
|
-
JSON.stringify(
|
|
38
|
+
JSON.stringify(prevInputValueRef.current) !==
|
|
39
|
+
JSON.stringify(inputValue)
|
|
73
40
|
) {
|
|
74
|
-
|
|
41
|
+
const _values = Array.isArray(inputValue)
|
|
42
|
+
? inputValue.map((a) => ({
|
|
43
|
+
value: a.id,
|
|
44
|
+
label: a.label || a.name || a.description || 'Unknown',
|
|
45
|
+
...a,
|
|
46
|
+
}))
|
|
47
|
+
: inputValue && typeof inputValue === 'object'
|
|
48
|
+
? [
|
|
49
|
+
{
|
|
50
|
+
value: inputValue.id,
|
|
51
|
+
label:
|
|
52
|
+
inputValue.label ||
|
|
53
|
+
inputValue.name ||
|
|
54
|
+
inputValue.description ||
|
|
55
|
+
'Unknown',
|
|
56
|
+
...inputValue,
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
: [];
|
|
60
|
+
|
|
61
|
+
setSelectValue(_values);
|
|
62
|
+
prevInputValueRef.current = inputValue;
|
|
75
63
|
}
|
|
76
|
-
}, [
|
|
64
|
+
}, [inputValue]);
|
|
77
65
|
|
|
78
66
|
const handleCreate = async (inputValue) => {
|
|
79
67
|
if (creatableConfig.url && creatableConfig.method) {
|
|
@@ -87,20 +75,11 @@ function MultiSelect({
|
|
|
87
75
|
const newOption = {
|
|
88
76
|
value: res.data.id,
|
|
89
77
|
label: res.data.label || inputValue,
|
|
90
|
-
description: res.data.description || 'Newly created item',
|
|
91
78
|
...res.data,
|
|
92
79
|
};
|
|
93
80
|
|
|
94
81
|
setSelectOptions((prevOptions) => [...prevOptions, newOption]);
|
|
95
|
-
setSelectValue((prevValues) =>
|
|
96
|
-
multi ? [...prevValues, newOption] : [newOption]
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
onChange(
|
|
100
|
-
multi ? [...selectValue, newOption] : newOption,
|
|
101
|
-
{ action: 'create-option' },
|
|
102
|
-
settings.id
|
|
103
|
-
);
|
|
82
|
+
setSelectValue((prevValues) => [...prevValues, newOption]);
|
|
104
83
|
}
|
|
105
84
|
}
|
|
106
85
|
};
|
|
@@ -114,7 +93,7 @@ function MultiSelect({
|
|
|
114
93
|
isSearchable
|
|
115
94
|
isMulti={multi}
|
|
116
95
|
filterOption={createFilter({ ignoreAccents: false })}
|
|
117
|
-
components={{
|
|
96
|
+
components={{ SelectList }}
|
|
118
97
|
options={selectOptions}
|
|
119
98
|
onChange={(inputValue, action) => {
|
|
120
99
|
onChange(inputValue, action, settings.id);
|
|
@@ -136,8 +115,8 @@ function MultiSelect({
|
|
|
136
115
|
}),
|
|
137
116
|
}}
|
|
138
117
|
value={selectValue}
|
|
139
|
-
onCreateOption={
|
|
140
|
-
placeholder={placeholder
|
|
118
|
+
onCreateOption={handleCreate}
|
|
119
|
+
placeholder={placeholder ? placeholder : 'Select...'}
|
|
141
120
|
/>
|
|
142
121
|
);
|
|
143
122
|
}
|
|
@@ -38,7 +38,7 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
38
38
|
position: relative;
|
|
39
39
|
padding: 2px;
|
|
40
40
|
margin: 8px 0;
|
|
41
|
-
box-shadow: 0 4px 0 rgba(var(--primary-
|
|
41
|
+
box-shadow: 0 4px 0 rgba(var(--primary-rgb), 0.05);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.grid__subrow {
|
|
@@ -68,7 +68,7 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
68
68
|
padding: 5px;
|
|
69
69
|
margin: 8px 0;
|
|
70
70
|
height: auto;
|
|
71
|
-
box-shadow: 0 4px 0 rgba(var(--primary-
|
|
71
|
+
box-shadow: 0 4px 0 rgba(var(--primary-rgb), 0.05);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.grid__subnav > ul {
|
|
@@ -280,7 +280,7 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
280
280
|
text-decoration: none;
|
|
281
281
|
overflow: hidden;
|
|
282
282
|
background: var(--primary-color);
|
|
283
|
-
border: 1px solid rgba(var(--primary-
|
|
283
|
+
border: 1px solid rgba(var(--primary-rgb), 1.1);
|
|
284
284
|
border-radius: var(--br);
|
|
285
285
|
outline: none;
|
|
286
286
|
transition: all 0.2s cubic-bezier(0.85, 0, 0.15, 1) 0s;
|
|
@@ -296,7 +296,6 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
296
296
|
border-color: red !important;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
|
|
300
299
|
.crmtitle {
|
|
301
300
|
min-height: auto;
|
|
302
301
|
padding: 1rem;
|
|
@@ -323,7 +322,7 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
323
322
|
}
|
|
324
323
|
|
|
325
324
|
svg {
|
|
326
|
-
color: rgba(var(--primary-
|
|
325
|
+
color: rgba(var(--primary-rgb), 0.5);
|
|
327
326
|
position: relative;
|
|
328
327
|
top: 2px;
|
|
329
328
|
margin: 0 0.25rem;
|
|
@@ -333,9 +332,9 @@ select:not(:placeholder-shown) + .fi__span {
|
|
|
333
332
|
.titleInfo {
|
|
334
333
|
width: max-content;
|
|
335
334
|
}
|
|
336
|
-
|
|
335
|
+
|
|
337
336
|
.titleInfo span {
|
|
338
337
|
font-size: 0.875em;
|
|
339
338
|
color: rgba(var(--paragraph-color-rgb), 0.65);
|
|
340
339
|
}
|
|
341
|
-
}
|
|
340
|
+
}
|