@visns-studio/visns-components 4.10.48 → 5.0.1-8.1
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 +29 -29
- package/src/components/cms/Field.jsx +39 -63
- package/src/components/crm/AsyncSelect.jsx +121 -15
- package/src/components/crm/Breadcrumb.jsx +2 -18
- package/src/components/crm/DataGrid.jsx +51 -424
- package/src/components/crm/Field.jsx +185 -358
- package/src/components/crm/Form.jsx +104 -92
- package/src/components/crm/MultiSelect.jsx +66 -45
- package/src/components/crm/Navigation.jsx +9 -92
- package/src/components/crm/QuickAction.jsx +1 -0
- package/src/components/crm/auth/Login.jsx +9 -1
- package/src/components/crm/auth/Profile.jsx +4 -2
- package/src/components/crm/auth/styles/Login.module.scss +52 -82
- package/src/components/crm/auth/styles/Profile.module.scss +150 -44
- package/src/components/crm/auth/styles/Reset.module.scss +55 -37
- package/src/components/crm/auth/styles/Verify.module.scss +55 -76
- package/src/components/crm/generic/GenericAuth.jsx +12 -5
- package/src/components/crm/generic/GenericDashboard.jsx +30 -340
- package/src/components/crm/generic/GenericDetail.jsx +534 -86
- package/src/components/crm/generic/GenericDynamic.jsx +76 -94
- package/src/components/crm/generic/GenericEditableTable.jsx +407 -0
- package/src/components/crm/generic/GenericFormBuilder.jsx +19 -79
- package/src/components/crm/generic/GenericIndex.jsx +1 -2
- package/src/components/crm/generic/styles/AuditLog.module.scss +4 -37
- package/src/components/crm/generic/styles/AuditLogs.module.scss +0 -51
- package/src/components/crm/generic/styles/GenericDetail.module.scss +263 -244
- package/src/components/crm/generic/styles/GenericDynamic.module.scss +100 -198
- package/src/components/crm/generic/styles/GenericEditableTable.module.scss +178 -0
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +63 -101
- package/src/components/crm/generic/styles/GenericIndex.module.scss +46 -66
- package/src/components/crm/generic/styles/GenericMain.module.scss +7 -7
- package/src/components/crm/generic/styles/GenericSort.module.scss +0 -36
- package/src/components/crm/generic/styles/NotificationList.module.scss +1 -32
- package/src/components/crm/styles/Autocomplete.module.scss +12 -20
- package/src/components/crm/styles/DataGrid.module.scss +28 -86
- package/src/components/crm/styles/Field.module.scss +72 -252
- package/src/components/crm/styles/Form.module.scss +141 -450
- package/src/components/crm/styles/Navigation.module.scss +356 -507
- package/src/components/crm/styles/Notification.module.scss +1 -0
- package/src/components/crm/styles/QrCode.module.scss +4 -18
- package/src/components/crm/styles/SwitchAccount.module.scss +0 -1
- package/src/components/crm/styles/TableFilter.module.scss +2 -1
- package/src/components/styles/global.css +164 -34
- package/src/index.js +0 -8
- package/src/components/crm/generic/styles/GenericDashboard.module.scss +0 -325
- package/src/components/crm/sketch/SketchField.jsx +0 -395
- package/src/components/crm/sketch/arrow.jsx +0 -108
- package/src/components/crm/sketch/circle.jsx +0 -75
- package/src/components/crm/sketch/default-tool.jsx +0 -16
- package/src/components/crm/sketch/fabrictool.jsx +0 -22
- package/src/components/crm/sketch/history.jsx +0 -144
- package/src/components/crm/sketch/json/config.json +0 -14
- package/src/components/crm/sketch/line.jsx +0 -64
- package/src/components/crm/sketch/pan.jsx +0 -48
- package/src/components/crm/sketch/pencil.jsx +0 -36
- package/src/components/crm/sketch/rectangle-label-object.jsx +0 -69
- package/src/components/crm/sketch/rectangle-label.jsx +0 -93
- package/src/components/crm/sketch/rectangle.jsx +0 -76
- package/src/components/crm/sketch/select.jsx +0 -16
- package/src/components/crm/sketch/tools.jsx +0 -11
- package/src/components/crm/sketch/utils.jsx +0 -67
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@emotion/is-prop-valid": "^1.3.1",
|
|
4
|
-
"@fontsource/barlow": "^5.1.
|
|
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.87.0",
|
|
8
|
+
"@nivo/core": "^0.87.0",
|
|
9
|
+
"@nivo/line": "^0.87.0",
|
|
10
|
+
"@nivo/pie": "^0.87.0",
|
|
11
11
|
"@tinymce/tinymce-react": "^5.1.1",
|
|
12
|
-
"@vitejs/plugin-react": "^4.3.
|
|
12
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
13
13
|
"add": "^2.0.6",
|
|
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.7.
|
|
18
|
-
"browser-image-compression": "^2.0.2",
|
|
17
|
+
"axios": "^1.7.7",
|
|
19
18
|
"dayjs": "^1.11.13",
|
|
20
19
|
"fabric": "^6.5.4",
|
|
21
20
|
"file-saver": "^2.0.5",
|
|
22
|
-
"framer-motion": "^11.
|
|
23
|
-
"html-react-parser": "^5.
|
|
21
|
+
"framer-motion": "^11.11.9",
|
|
22
|
+
"html-react-parser": "^5.1.18",
|
|
24
23
|
"lodash": "^4.17.21",
|
|
25
24
|
"lodash.debounce": "^4.0.8",
|
|
26
25
|
"moment": "^2.30.1",
|
|
27
|
-
"motion": "^
|
|
26
|
+
"motion": "^10.18.0",
|
|
28
27
|
"numeral": "^2.0.6",
|
|
29
28
|
"pluralize": "^8.0.0",
|
|
30
29
|
"quill-image-uploader": "^1.3.0",
|
|
30
|
+
"react-big-calendar": "^1.17.1",
|
|
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
|
-
"react-datepicker": "^7.
|
|
35
|
-
"react-dropzone": "^14.
|
|
34
|
+
"react-datepicker": "^7.5.0",
|
|
35
|
+
"react-dropzone": "^14.2.10",
|
|
36
36
|
"react-grid-gallery": "^1.0.1",
|
|
37
|
-
"react-number-format": "^5.4.
|
|
37
|
+
"react-number-format": "^5.4.2",
|
|
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.
|
|
44
|
-
"react-signature-pad-wrapper": "^4.
|
|
42
|
+
"react-router-dom": "^6.27.0",
|
|
43
|
+
"react-select": "^5.8.1",
|
|
44
|
+
"react-signature-pad-wrapper": "^4.0.4",
|
|
45
45
|
"react-slugify": "^4.0.1",
|
|
46
46
|
"react-sortable-hoc": "^2.0.0",
|
|
47
|
-
"react-to-print": "^
|
|
47
|
+
"react-to-print": "^2.15.1",
|
|
48
48
|
"react-toastify": "^10.0.6",
|
|
49
49
|
"react-toggle": "^4.1.3",
|
|
50
50
|
"react-tooltip": "^5.28.0",
|
|
51
|
-
"react-window": "^1.8.
|
|
51
|
+
"react-window": "^1.8.10",
|
|
52
52
|
"reactjs-popup": "^2.0.6",
|
|
53
53
|
"style-loader": "^4.0.0",
|
|
54
54
|
"truncate": "^3.0.0",
|
|
55
|
-
"uuid": "^
|
|
55
|
+
"uuid": "^10.0.0",
|
|
56
56
|
"validator": "^13.12.0",
|
|
57
|
-
"vite": "^5.4.
|
|
57
|
+
"vite": "^5.4.10",
|
|
58
58
|
"yarn": "^1.22.22"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "^7.
|
|
61
|
+
"@babel/core": "^7.25.9",
|
|
62
62
|
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
64
|
-
"@babel/preset-react": "^7.
|
|
63
|
+
"@babel/preset-env": "^7.25.9",
|
|
64
|
+
"@babel/preset-react": "^7.25.9",
|
|
65
65
|
"babel-loader": "^9.2.1",
|
|
66
66
|
"copy-webpack-plugin": "^12.0.2",
|
|
67
67
|
"css-loader": "^7.1.2",
|
|
68
68
|
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
69
|
-
"mini-css-extract-plugin": "^2.9.
|
|
69
|
+
"mini-css-extract-plugin": "^2.9.1",
|
|
70
70
|
"react": "^18.3.1",
|
|
71
71
|
"react-dom": "^18.3.1",
|
|
72
|
-
"sass": "^1.
|
|
73
|
-
"sass-loader": "^16.0.
|
|
72
|
+
"sass": "^1.80.3",
|
|
73
|
+
"sass-loader": "^16.0.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": "^17.0.0 || ^18.0.0",
|
|
77
77
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
79
79
|
"name": "@visns-studio/visns-components",
|
|
80
|
-
"version": "
|
|
80
|
+
"version": "5.0.18.1",
|
|
81
81
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
82
82
|
"main": "src/index.js",
|
|
83
83
|
"files": [
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"url": "https://github.com/visnsstudio/visns-components/issues"
|
|
99
99
|
},
|
|
100
100
|
"homepage": "https://github.com/visnsstudio/visns-components#readme",
|
|
101
|
-
"packageManager": "yarn@4.
|
|
101
|
+
"packageManager": "yarn@4.4.0"
|
|
102
102
|
}
|
|
@@ -667,71 +667,47 @@ const Field = ({
|
|
|
667
667
|
break;
|
|
668
668
|
case 'richeditor':
|
|
669
669
|
htmlContainer = (
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
'
|
|
686
|
-
'
|
|
687
|
-
'
|
|
670
|
+
<Editor
|
|
671
|
+
tinymceScriptSrc="https://d16lktya8ojp5z.cloudfront.net/generic/packages/tinymce_v701/tinymce.min.js"
|
|
672
|
+
licenseKey="gpl"
|
|
673
|
+
onEditorChange={(value, e) => {
|
|
674
|
+
onChangeRicheditor(e, value, settings.id);
|
|
675
|
+
}}
|
|
676
|
+
onInit={(evt, editor) =>
|
|
677
|
+
(editorRef.current = editor)
|
|
678
|
+
}
|
|
679
|
+
value={inputValue || ''}
|
|
680
|
+
init={{
|
|
681
|
+
branding: false,
|
|
682
|
+
height: 500,
|
|
683
|
+
menubar: false,
|
|
684
|
+
plugins: [
|
|
685
|
+
'advlist',
|
|
686
|
+
'autolink',
|
|
687
|
+
'lists',
|
|
688
688
|
'link',
|
|
689
689
|
'image',
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
// 'lists',
|
|
712
|
-
// 'link',
|
|
713
|
-
// 'image',
|
|
714
|
-
// 'charmap',
|
|
715
|
-
// 'preview',
|
|
716
|
-
// 'anchor',
|
|
717
|
-
// 'searchreplace',
|
|
718
|
-
// 'visualblocks',
|
|
719
|
-
// 'code',
|
|
720
|
-
// 'fullscreen',
|
|
721
|
-
// 'insertdatetime',
|
|
722
|
-
// 'media',
|
|
723
|
-
// 'table',
|
|
724
|
-
// 'code',
|
|
725
|
-
// ],
|
|
726
|
-
// toolbar:
|
|
727
|
-
// 'undo redo | blocks | ' +
|
|
728
|
-
// 'bold italic forecolor | alignleft aligncenter ' +
|
|
729
|
-
// 'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
730
|
-
// 'removeformat | table',
|
|
731
|
-
// content_style:
|
|
732
|
-
// 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
|
|
733
|
-
// }}
|
|
734
|
-
// />
|
|
690
|
+
'charmap',
|
|
691
|
+
'preview',
|
|
692
|
+
'anchor',
|
|
693
|
+
'searchreplace',
|
|
694
|
+
'visualblocks',
|
|
695
|
+
'code',
|
|
696
|
+
'fullscreen',
|
|
697
|
+
'insertdatetime',
|
|
698
|
+
'media',
|
|
699
|
+
'table',
|
|
700
|
+
'code',
|
|
701
|
+
],
|
|
702
|
+
toolbar:
|
|
703
|
+
'undo redo | blocks | ' +
|
|
704
|
+
'bold italic forecolor | alignleft aligncenter ' +
|
|
705
|
+
'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
706
|
+
'removeformat | table',
|
|
707
|
+
content_style:
|
|
708
|
+
'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
|
|
709
|
+
}}
|
|
710
|
+
/>
|
|
735
711
|
);
|
|
736
712
|
break;
|
|
737
713
|
case 'image':
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import CustomFetch from './Fetch';
|
|
3
3
|
import SelectList from './SelectList';
|
|
4
4
|
import AsyncSelect from 'react-select/async';
|
|
5
|
+
import AsyncCreatableSelect from 'react-select/async-creatable';
|
|
5
6
|
import { debounce } from 'lodash';
|
|
6
7
|
import styles from './styles/AsyncSelect.module.scss';
|
|
8
|
+
import { components } from 'react-select';
|
|
9
|
+
|
|
10
|
+
// Custom Option component to add a second line of text
|
|
11
|
+
const CustomOption = (props) => (
|
|
12
|
+
<components.Option {...props}>
|
|
13
|
+
<div>
|
|
14
|
+
{props.data.label}
|
|
15
|
+
{props.data.description && props.data.description !== '' && (
|
|
16
|
+
<div style={{ fontSize: '0.85em', color: '#888' }}>
|
|
17
|
+
{props.data.description}
|
|
18
|
+
</div>
|
|
19
|
+
)}
|
|
20
|
+
</div>
|
|
21
|
+
</components.Option>
|
|
22
|
+
);
|
|
7
23
|
|
|
8
24
|
function VisnsAsyncSelect({
|
|
25
|
+
className,
|
|
9
26
|
fields = [],
|
|
10
27
|
inputValue,
|
|
11
28
|
onChange,
|
|
@@ -14,6 +31,7 @@ function VisnsAsyncSelect({
|
|
|
14
31
|
placeholder,
|
|
15
32
|
settings,
|
|
16
33
|
style,
|
|
34
|
+
isCreatable = false, // New prop to toggle creatable functionality
|
|
17
35
|
}) {
|
|
18
36
|
const loadSuggestedOptions = useCallback(
|
|
19
37
|
debounce((inputValue, callback) => {
|
|
@@ -31,7 +49,6 @@ function VisnsAsyncSelect({
|
|
|
31
49
|
return new Promise((resolve, reject) => {
|
|
32
50
|
let data = [];
|
|
33
51
|
|
|
34
|
-
// Prepare payload
|
|
35
52
|
let payload = {
|
|
36
53
|
where: [
|
|
37
54
|
{
|
|
@@ -41,38 +58,50 @@ function VisnsAsyncSelect({
|
|
|
41
58
|
],
|
|
42
59
|
};
|
|
43
60
|
|
|
44
|
-
// Check and set fields from settings if fields prop is null or empty
|
|
45
61
|
if (fields && fields.length > 0) {
|
|
46
62
|
payload.fields = fields;
|
|
47
63
|
} else if (settings.fields && settings.fields.length > 0) {
|
|
48
64
|
payload.fields = settings.fields;
|
|
49
65
|
}
|
|
50
66
|
|
|
51
|
-
// Check and set orderBy from settings if orderBy prop is null or empty
|
|
52
67
|
if (orderBy) {
|
|
53
68
|
payload.orderBy = orderBy;
|
|
54
69
|
} else if (settings.orderBy) {
|
|
55
70
|
payload.orderBy = settings.orderBy;
|
|
56
71
|
}
|
|
57
72
|
|
|
58
|
-
// Fetch data
|
|
59
73
|
CustomFetch(
|
|
60
74
|
settings.url,
|
|
61
75
|
'POST',
|
|
62
76
|
payload,
|
|
63
77
|
function (result) {
|
|
64
78
|
result.data.forEach((a) => {
|
|
79
|
+
let mainLabel = a.label || a[Object.keys(a)[0]];
|
|
80
|
+
|
|
81
|
+
if (settings.fields && settings.fields.length > 2) {
|
|
82
|
+
const additionalFields =
|
|
83
|
+
settings.fields.slice(2);
|
|
84
|
+
const additionalLabels = additionalFields
|
|
85
|
+
.filter(
|
|
86
|
+
(field) =>
|
|
87
|
+
field !== settings.descriptionKey
|
|
88
|
+
)
|
|
89
|
+
.map((field) => a[field] || '')
|
|
90
|
+
.join(' ');
|
|
91
|
+
mainLabel += ` ${additionalLabels}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
65
94
|
let _optionItem = {
|
|
66
95
|
value: a.id,
|
|
67
|
-
label:
|
|
96
|
+
label: mainLabel,
|
|
97
|
+
description: settings.descriptionKey
|
|
98
|
+
? a[settings.descriptionKey]
|
|
99
|
+
: '',
|
|
68
100
|
};
|
|
69
101
|
|
|
70
102
|
Object.keys(a).forEach((b) => {
|
|
71
|
-
if (b !== 'id') {
|
|
72
|
-
_optionItem =
|
|
73
|
-
..._optionItem,
|
|
74
|
-
[b]: a[b],
|
|
75
|
-
};
|
|
103
|
+
if (b !== 'id' && b !== 'label') {
|
|
104
|
+
_optionItem[b] = a[b];
|
|
76
105
|
}
|
|
77
106
|
});
|
|
78
107
|
|
|
@@ -87,17 +116,92 @@ function VisnsAsyncSelect({
|
|
|
87
116
|
);
|
|
88
117
|
});
|
|
89
118
|
} else {
|
|
90
|
-
return Promise.resolve([]);
|
|
119
|
+
return Promise.resolve([]);
|
|
91
120
|
}
|
|
92
121
|
};
|
|
93
122
|
|
|
123
|
+
const handleCreateOption = async (inputValue) => {
|
|
124
|
+
if (
|
|
125
|
+
settings.creatableConfig &&
|
|
126
|
+
settings.creatableConfig.url &&
|
|
127
|
+
settings.creatableConfig.method
|
|
128
|
+
) {
|
|
129
|
+
let payload;
|
|
130
|
+
let firstNameField, lastNameField;
|
|
131
|
+
|
|
132
|
+
if (
|
|
133
|
+
settings.creatableConfig.type === 'name' &&
|
|
134
|
+
Array.isArray(settings.creatableConfig.fields)
|
|
135
|
+
) {
|
|
136
|
+
[firstNameField, lastNameField] =
|
|
137
|
+
settings.creatableConfig.fields;
|
|
138
|
+
|
|
139
|
+
const nameParts = inputValue.trim().split(' ');
|
|
140
|
+
let firstname = '';
|
|
141
|
+
let lastname = '';
|
|
142
|
+
|
|
143
|
+
if (nameParts.length === 1) {
|
|
144
|
+
firstname = nameParts[0];
|
|
145
|
+
} else if (nameParts.length === 2) {
|
|
146
|
+
firstname = nameParts[0];
|
|
147
|
+
lastname = nameParts[1];
|
|
148
|
+
} else {
|
|
149
|
+
firstname = nameParts[0];
|
|
150
|
+
lastname = nameParts.slice(1).join(' ');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
payload = {
|
|
154
|
+
[firstNameField || 'firstname']: firstname,
|
|
155
|
+
[lastNameField || 'lastname']: lastname,
|
|
156
|
+
};
|
|
157
|
+
} else {
|
|
158
|
+
payload = { label: inputValue };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const newOption = await CustomFetch(
|
|
162
|
+
settings.creatableConfig.url,
|
|
163
|
+
settings.creatableConfig.method,
|
|
164
|
+
payload
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
if (newOption && newOption.data && newOption.data.data) {
|
|
168
|
+
const newOptionData = newOption.data.data;
|
|
169
|
+
const option = {
|
|
170
|
+
value: newOptionData.id,
|
|
171
|
+
label:
|
|
172
|
+
settings.creatableConfig.type === 'name'
|
|
173
|
+
? `${
|
|
174
|
+
newOptionData[firstNameField] ||
|
|
175
|
+
newOptionData.firstname
|
|
176
|
+
} ${
|
|
177
|
+
newOptionData[lastNameField] ||
|
|
178
|
+
newOptionData.lastname
|
|
179
|
+
}`
|
|
180
|
+
: newOptionData.label || inputValue,
|
|
181
|
+
description: settings.descriptionKey
|
|
182
|
+
? newOptionData[settings.descriptionKey]
|
|
183
|
+
: 'Placeholder text for description',
|
|
184
|
+
...newOptionData,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
onChange(option, { action: 'create-option' }, settings.id); // Directly call onChange with new option
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const SelectComponent = isCreatable ? AsyncCreatableSelect : AsyncSelect;
|
|
193
|
+
|
|
94
194
|
return (
|
|
95
|
-
<
|
|
195
|
+
<SelectComponent
|
|
96
196
|
isClearable
|
|
97
197
|
cacheOptions
|
|
98
198
|
loadOptions={loadSuggestedOptions}
|
|
99
199
|
defaultOptions
|
|
100
|
-
className={
|
|
200
|
+
className={
|
|
201
|
+
className
|
|
202
|
+
? `${styles.visns__ms} ${className}`
|
|
203
|
+
: styles.visns__ms
|
|
204
|
+
}
|
|
101
205
|
onChange={(inputValue, action) => {
|
|
102
206
|
onChange(inputValue, action, settings.id);
|
|
103
207
|
}}
|
|
@@ -106,7 +210,9 @@ function VisnsAsyncSelect({
|
|
|
106
210
|
onKeyDown(e);
|
|
107
211
|
}
|
|
108
212
|
}}
|
|
109
|
-
|
|
213
|
+
classNamePrefix="visns-select"
|
|
214
|
+
onCreateOption={isCreatable ? handleCreateOption : undefined}
|
|
215
|
+
components={{ Option: CustomOption }}
|
|
110
216
|
styles={{
|
|
111
217
|
menu: (styles) => ({
|
|
112
218
|
...styles,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
import { CircleChevronRight } from 'akar-icons';
|
|
4
|
-
import moment from 'moment';
|
|
5
4
|
|
|
6
5
|
function Breadcrumb({ data, page }) {
|
|
7
6
|
// Function to get nested data, handling array of keys
|
|
@@ -20,15 +19,6 @@ function Breadcrumb({ data, page }) {
|
|
|
20
19
|
? getNestedData(data, page.parentTitleKey)
|
|
21
20
|
: null;
|
|
22
21
|
|
|
23
|
-
// Function to handle titleKey when it's a nested path like 'event_detail.name'
|
|
24
|
-
const getTitleData = (data, titleKey) => {
|
|
25
|
-
if (typeof titleKey === 'string' && titleKey.includes('.')) {
|
|
26
|
-
const keys = titleKey.split('.'); // Split the nested path by "."
|
|
27
|
-
return getNestedData(data, keys); // Use getNestedData to fetch the nested value
|
|
28
|
-
}
|
|
29
|
-
return data[titleKey]; // If not nested, return the direct data
|
|
30
|
-
};
|
|
31
|
-
|
|
32
22
|
return (
|
|
33
23
|
<h1>
|
|
34
24
|
{page?.parentTitle && page?.parentUrl && (
|
|
@@ -66,19 +56,13 @@ function Breadcrumb({ data, page }) {
|
|
|
66
56
|
// If titleKey is an array, iterate and display each nested value
|
|
67
57
|
page.titleKey.map((key, index) => (
|
|
68
58
|
<span key={index}>
|
|
69
|
-
{
|
|
59
|
+
{data[key]}
|
|
70
60
|
{index < page.titleKey.length - 1 && ' '}
|
|
71
61
|
</span>
|
|
72
62
|
))
|
|
73
63
|
) : (
|
|
74
64
|
// If titleKey is a single string, display the corresponding data
|
|
75
|
-
<>
|
|
76
|
-
{page.titleType === 'date'
|
|
77
|
-
? moment(
|
|
78
|
-
getTitleData(data, page.titleKey)
|
|
79
|
-
).format('DD-MM-YYYY')
|
|
80
|
-
: getTitleData(data, page.titleKey)}
|
|
81
|
-
</>
|
|
65
|
+
<>{data[page.titleKey]}</>
|
|
82
66
|
)}
|
|
83
67
|
</>
|
|
84
68
|
)}
|