@visns-studio/visns-components 5.10.11 → 5.11.2
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/README.md +85 -0
- package/package.json +7 -7
- package/src/components/cms/DataGrid.jsx +8 -8
- package/src/components/cms/DropZone.jsx +1 -1
- package/src/components/cms/Form.jsx +1 -1
- package/src/components/cms/Gallery.jsx +1 -1
- package/src/components/cms/sorting/Item.jsx +1 -1
- package/src/components/crm/Autocomplete.jsx +3 -3
- package/src/components/crm/Breadcrumb.jsx +4 -4
- package/src/components/crm/BusinessCardOcr.jsx +681 -95
- package/src/components/crm/DataGrid.jsx +34 -32
- package/src/components/crm/Field.jsx +12 -12
- package/src/components/crm/Form.jsx +2 -2
- package/src/components/crm/Navigation.jsx +11 -11
- package/src/components/crm/Notification.jsx +2 -2
- package/src/components/crm/QuickAction.jsx +3 -3
- package/src/components/crm/SectionHeader.jsx +1 -1
- package/src/components/crm/SwitchAccount.jsx +4 -4
- package/src/components/crm/auth/ClientLogin.jsx +2 -2
- package/src/components/crm/auth/ClientOTPVerify.jsx +2 -2
- package/src/components/crm/auth/Login.jsx +3 -3
- package/src/components/crm/auth/Reset.jsx +2 -2
- package/src/components/crm/auth/TwoFactorAuth.jsx +2 -2
- package/src/components/crm/columns/ColumnRenderers.jsx +320 -259
- package/src/components/crm/controls/DataGridSearch.jsx +5 -5
- package/src/components/crm/generic/AlternativeActionModal.jsx +100 -0
- package/src/components/crm/generic/ContactSelectorModal.jsx +423 -0
- package/src/components/crm/generic/DatePickerDialog.jsx +302 -0
- package/src/components/crm/generic/DateRangeSelectorModal.jsx +181 -0
- package/src/components/crm/generic/GenericClientPortal.jsx +1 -1
- package/src/components/crm/generic/GenericDashboard.jsx +4 -4
- package/src/components/crm/generic/GenericDetail.jsx +6 -6
- package/src/components/crm/generic/GenericDynamic.jsx +3 -3
- package/src/components/crm/generic/GenericEditableTable.jsx +4 -4
- package/src/components/crm/generic/GenericFormBuilder.jsx +6 -6
- package/src/components/crm/generic/GenericGrid.jsx +2888 -0
- package/src/components/crm/generic/GenericIndex.jsx +5 -1255
- package/src/components/crm/generic/GenericReport.jsx +966 -646
- package/src/components/crm/generic/GenericReportForm.jsx +194 -0
- package/src/components/crm/generic/NotificationList.jsx +1 -1
- package/src/components/crm/generic/ReasonCollectorModal.jsx +194 -0
- package/src/components/crm/generic/SortableQuoteItems.jsx +3 -3
- package/src/components/crm/generic/shared/formatters.js +231 -0
- package/src/components/crm/generic/shared/gridUtils.js +194 -0
- package/src/components/crm/generic/styles/AlternativeActionModal.css +127 -0
- package/src/components/crm/generic/styles/ContactSelectorModal.css +367 -0
- package/src/components/crm/generic/styles/DatePickerDialog.css +84 -0
- package/src/components/crm/generic/styles/DateRangeSelectorModal.css +115 -0
- package/src/components/crm/generic/styles/GenericIndex.module.scss +382 -0
- package/src/components/crm/generic/styles/GenericReport.module.scss +96 -0
- package/src/components/crm/generic/styles/ReasonCollectorModal.css +217 -0
- package/src/components/crm/modals/GalleryModal.jsx +2 -2
- package/src/components/crm/sorting/Item.jsx +3 -3
- package/src/components/crm/styles/BusinessCardOcr.module.scss +197 -4
- package/src/index.js +4 -0
package/README.md
CHANGED
|
@@ -93,6 +93,91 @@ const App = () => {
|
|
|
93
93
|
export default App;
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
## New Modular Architecture (v5.10.11+)
|
|
97
|
+
|
|
98
|
+
### GenericIndex Component Refactoring
|
|
99
|
+
|
|
100
|
+
Starting from version 5.10.11, the GenericIndex component has been refactored for better maintainability and reusability:
|
|
101
|
+
|
|
102
|
+
**Before**: Single monolithic component (2,281 lines)
|
|
103
|
+
**After**: Modular architecture with separated concerns
|
|
104
|
+
|
|
105
|
+
#### New Components
|
|
106
|
+
|
|
107
|
+
The refactoring introduced two new standalone components that can be used independently:
|
|
108
|
+
|
|
109
|
+
**GenericGrid** - Standalone grid component with full data management capabilities:
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
import { GenericGrid } from 'visns-components';
|
|
113
|
+
|
|
114
|
+
<GenericGrid
|
|
115
|
+
config={{
|
|
116
|
+
settings: {
|
|
117
|
+
fetch: {
|
|
118
|
+
url: '/api/data',
|
|
119
|
+
method: 'POST',
|
|
120
|
+
params: { filter: 'active' }
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
columns: [
|
|
124
|
+
{ name: 'id', header: 'ID', type: 'number' },
|
|
125
|
+
{ name: 'name', header: 'Name', type: 'text' },
|
|
126
|
+
{ name: 'date', header: 'Date', type: 'date' }
|
|
127
|
+
]
|
|
128
|
+
}}
|
|
129
|
+
userProfile={userProfile}
|
|
130
|
+
onDataChange={(data) => console.log('Data updated:', data)}
|
|
131
|
+
onRowClick={(row) => console.log('Row clicked:', row)}
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**GenericReportForm** - Standalone export form component:
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
import { GenericReportForm } from 'visns-components';
|
|
139
|
+
|
|
140
|
+
<GenericReportForm
|
|
141
|
+
config={{
|
|
142
|
+
form: {
|
|
143
|
+
title: 'Export Data',
|
|
144
|
+
description: 'Select your export criteria below',
|
|
145
|
+
filters: [
|
|
146
|
+
{ id: 'startDate', type: 'date', label: 'Start Date', required: true },
|
|
147
|
+
{ id: 'endDate', type: 'date', label: 'End Date', required: true },
|
|
148
|
+
{ id: 'format', type: 'dropdown', label: 'Format', options: [
|
|
149
|
+
{ value: 'csv', label: 'CSV' },
|
|
150
|
+
{ value: 'xlsx', label: 'Excel' }
|
|
151
|
+
]}
|
|
152
|
+
],
|
|
153
|
+
url: '/api/export',
|
|
154
|
+
method: 'POST',
|
|
155
|
+
filename: 'export.csv'
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
userProfile={userProfile}
|
|
159
|
+
onExport={(formData) => customExportHandler(formData)}
|
|
160
|
+
onFormChange={(formData) => console.log('Form changed:', formData)}
|
|
161
|
+
/>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Benefits of the Refactoring
|
|
165
|
+
|
|
166
|
+
- **Reduced complexity**: GenericIndex reduced from 2,281 to 1,031 lines (55% reduction)
|
|
167
|
+
- **Enhanced reusability**: Grid and form components can be used independently
|
|
168
|
+
- **Better maintainability**: Focused components are easier to debug and modify
|
|
169
|
+
- **Improved testing**: Components can be unit tested separately
|
|
170
|
+
- **Backward compatibility**: All existing GenericIndex usage remains unchanged
|
|
171
|
+
|
|
172
|
+
#### Shared Utilities
|
|
173
|
+
|
|
174
|
+
The refactoring also introduced shared utility functions:
|
|
175
|
+
|
|
176
|
+
- **`shared/formatters.js`**: Cell content formatting and styling utilities
|
|
177
|
+
- **`shared/gridUtils.js`**: Data operations (sorting, filtering, transformations)
|
|
178
|
+
|
|
179
|
+
These utilities are available for use in custom components and provide consistent functionality across the library.
|
|
180
|
+
|
|
96
181
|
## Component Documentation
|
|
97
182
|
|
|
98
183
|
### Authentication Components
|
package/package.json
CHANGED
|
@@ -17,24 +17,24 @@
|
|
|
17
17
|
"@visns-studio/visns-datagrid-enterprise": "^1.0.14",
|
|
18
18
|
"@vitejs/plugin-react": "^4.5.2",
|
|
19
19
|
"add": "^2.0.6",
|
|
20
|
-
"akar-icons": "^1.9.31",
|
|
21
20
|
"array-move": "^4.0.0",
|
|
22
21
|
"awesome-debounce-promise": "^2.1.0",
|
|
23
22
|
"browser-image-compression": "^2.0.2",
|
|
24
23
|
"dayjs": "^1.11.13",
|
|
25
24
|
"fabric": "^6.7.0",
|
|
26
25
|
"file-saver": "^2.0.5",
|
|
27
|
-
"framer-motion": "^12.
|
|
26
|
+
"framer-motion": "^12.18.1",
|
|
28
27
|
"html-react-parser": "^5.2.5",
|
|
29
28
|
"lodash": "^4.17.21",
|
|
30
29
|
"lodash.debounce": "^4.0.8",
|
|
30
|
+
"lucide-react": "^0.516.0",
|
|
31
31
|
"moment": "^2.30.1",
|
|
32
|
-
"motion": "^12.
|
|
32
|
+
"motion": "^12.18.1",
|
|
33
33
|
"numeral": "^2.0.6",
|
|
34
34
|
"pluralize": "^8.0.0",
|
|
35
35
|
"qrcode.react": "^4.2.0",
|
|
36
36
|
"quill-image-uploader": "^1.3.0",
|
|
37
|
-
"react-big-calendar": "^1.19.
|
|
37
|
+
"react-big-calendar": "^1.19.3",
|
|
38
38
|
"react-color": "^2.19.3",
|
|
39
39
|
"react-copy-to-clipboard": "^5.1.0",
|
|
40
40
|
"react-datepicker": "^8.4.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react-to-print": "^3.1.0",
|
|
54
54
|
"react-toastify": "^11.0.5",
|
|
55
55
|
"react-toggle": "^4.1.3",
|
|
56
|
-
"react-tooltip": "^5.29.
|
|
56
|
+
"react-tooltip": "^5.29.1",
|
|
57
57
|
"react-window": "^1.8.11",
|
|
58
58
|
"reactjs-popup": "^2.0.6",
|
|
59
59
|
"style-loader": "^4.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"validator": "^13.15.15",
|
|
66
66
|
"vite": "^6.3.5",
|
|
67
67
|
"yarn": "^1.22.22",
|
|
68
|
-
"yet-another-react-lightbox": "^3.23.
|
|
68
|
+
"yet-another-react-lightbox": "^3.23.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@babel/core": "^7.27.4",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
88
88
|
},
|
|
89
89
|
"name": "@visns-studio/visns-components",
|
|
90
|
-
"version": "5.
|
|
90
|
+
"version": "5.11.2",
|
|
91
91
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
92
92
|
"main": "src/index.js",
|
|
93
93
|
"files": [
|
|
@@ -14,22 +14,22 @@ import Toggle from 'react-toggle';
|
|
|
14
14
|
import fetchUtil from '../../utils/fetchUtil';
|
|
15
15
|
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
16
16
|
import {
|
|
17
|
-
Backspace,
|
|
17
|
+
Trash2 as Backspace,
|
|
18
18
|
Check,
|
|
19
19
|
Clock,
|
|
20
|
-
CloudDownload,
|
|
20
|
+
Download as CloudDownload,
|
|
21
21
|
Copy,
|
|
22
22
|
Edit,
|
|
23
23
|
Folder,
|
|
24
24
|
Inbox,
|
|
25
25
|
Network,
|
|
26
|
-
Ribbon,
|
|
26
|
+
Award as Ribbon,
|
|
27
27
|
Search,
|
|
28
|
-
ShippingBoxV1,
|
|
29
|
-
ToggleOff,
|
|
30
|
-
ToggleOnFill,
|
|
31
|
-
TriangleAlert,
|
|
32
|
-
} from '
|
|
28
|
+
Package as ShippingBoxV1,
|
|
29
|
+
ToggleLeft as ToggleOff,
|
|
30
|
+
ToggleRight as ToggleOnFill,
|
|
31
|
+
AlertTriangle as TriangleAlert,
|
|
32
|
+
} from 'lucide-react';
|
|
33
33
|
|
|
34
34
|
import '@visns-studio/visns-datagrid-enterprise/index.css';
|
|
35
35
|
import 'react-toggle/style.css';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
|
-
import { CircleX, File, TrashCan } from '
|
|
4
|
+
import { X as CircleX, File, Trash2 as TrashCan } from 'lucide-react';
|
|
5
5
|
import { toast } from 'react-toastify';
|
|
6
6
|
import { arrayMoveImmutable } from 'array-move';
|
|
7
7
|
import Popup from 'reactjs-popup';
|
|
@@ -6,7 +6,7 @@ import moment from 'moment';
|
|
|
6
6
|
import Reveal from 'react-reveal/Reveal';
|
|
7
7
|
import parse from 'html-react-parser';
|
|
8
8
|
import { toast } from 'react-toastify';
|
|
9
|
-
import { Copy, TrashBin } from '
|
|
9
|
+
import { Copy, Trash2 as TrashBin } from 'lucide-react';
|
|
10
10
|
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
11
11
|
|
|
12
12
|
function Form(props) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
SortableElement,
|
|
5
5
|
sortableHandle,
|
|
6
6
|
} from 'react-sortable-hoc';
|
|
7
|
-
import { ChevronVertical, Pencil, TrashCan } from '
|
|
7
|
+
import { GripVertical as ChevronVertical, Edit as Pencil, Trash2 as TrashCan } from 'lucide-react';
|
|
8
8
|
import styles from './styles/Gallery.module.css';
|
|
9
9
|
|
|
10
10
|
// Drag handle component
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SortableElement, sortableHandle } from 'react-sortable-hoc';
|
|
3
|
-
import { ChevronVertical, Pencil, TrashCan } from '
|
|
3
|
+
import { GripVertical as ChevronVertical, Edit as Pencil, Trash2 as TrashCan } from 'lucide-react';
|
|
4
4
|
|
|
5
5
|
import styles from './styles/Item.module.scss';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback, useMemo, memo, useRef } from 'react';
|
|
2
2
|
import AwesomeDebouncePromise from 'awesome-debounce-promise';
|
|
3
|
-
import {
|
|
3
|
+
import { ToggleLeft, ToggleRight, Search } from 'lucide-react';
|
|
4
4
|
import styles from './styles/Autocomplete.module.scss';
|
|
5
5
|
import fetchUtil from '../../utils/fetchUtil';
|
|
6
6
|
|
|
@@ -255,7 +255,7 @@ const VisnsAutocomplete = memo((props) => {
|
|
|
255
255
|
/>
|
|
256
256
|
|
|
257
257
|
{overwrite ? (
|
|
258
|
-
<
|
|
258
|
+
<ToggleRight
|
|
259
259
|
data-tooltip-id="system-tooltip"
|
|
260
260
|
data-tooltip-content="Enable Autocomplete"
|
|
261
261
|
strokeWidth={2}
|
|
@@ -264,7 +264,7 @@ const VisnsAutocomplete = memo((props) => {
|
|
|
264
264
|
className={styles.toggleActive}
|
|
265
265
|
/>
|
|
266
266
|
) : (
|
|
267
|
-
<
|
|
267
|
+
<ToggleLeft
|
|
268
268
|
data-tooltip-id="system-tooltip"
|
|
269
269
|
data-tooltip-content="Disable Autocomplete"
|
|
270
270
|
strokeWidth={2}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import parse from 'html-react-parser';
|
|
5
|
-
import {
|
|
5
|
+
import { ChevronRight } from 'lucide-react';
|
|
6
6
|
|
|
7
7
|
function Breadcrumb({ data, page }) {
|
|
8
8
|
// Function to get nested data, handling array of keys
|
|
@@ -73,7 +73,7 @@ function Breadcrumb({ data, page }) {
|
|
|
73
73
|
{page?.parentTitle && page?.parentUrl && (
|
|
74
74
|
<>
|
|
75
75
|
<Link to={page.parentUrl}>{parse(page.parentTitle)}</Link>
|
|
76
|
-
<
|
|
76
|
+
<ChevronRight strokeWidth={2} size={18} />
|
|
77
77
|
</>
|
|
78
78
|
)}
|
|
79
79
|
|
|
@@ -87,7 +87,7 @@ function Breadcrumb({ data, page }) {
|
|
|
87
87
|
>
|
|
88
88
|
{parse(nestedData)}
|
|
89
89
|
</Link>
|
|
90
|
-
<
|
|
90
|
+
<ChevronRight strokeWidth={2} size={18} />
|
|
91
91
|
</>
|
|
92
92
|
) : (
|
|
93
93
|
page &&
|
|
@@ -102,7 +102,7 @@ function Breadcrumb({ data, page }) {
|
|
|
102
102
|
>
|
|
103
103
|
{parse(page.title)}
|
|
104
104
|
</Link>
|
|
105
|
-
<
|
|
105
|
+
<ChevronRight strokeWidth={2} size={18} />
|
|
106
106
|
</>
|
|
107
107
|
)
|
|
108
108
|
)}
|