@visns-studio/visns-components 5.8.20 → 5.9.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/README.md +149 -0
- package/package.json +1 -1
- package/src/components/crm/DataGrid.jsx +1177 -56
- package/src/components/crm/Field.jsx +2 -2
- package/src/components/crm/MultiSelect.jsx +33 -13
- package/src/components/crm/styles/DataGrid.module.scss +66 -6
- package/src/components/crm/styles/MultiSelect.module.scss +31 -9
- package/src/components/crm/styles/global-datagrid.css +240 -10
- package/src/examples/MultiSelectStylingTest.jsx +76 -0
package/README.md
CHANGED
|
@@ -1375,6 +1375,155 @@ We welcome contributions! Please follow these steps:
|
|
|
1375
1375
|
|
|
1376
1376
|
[MIT License](LICENSE)
|
|
1377
1377
|
|
|
1378
|
+
## Modal Actions in Components
|
|
1379
|
+
|
|
1380
|
+
### Using Modal Actions in GenericQuote Component
|
|
1381
|
+
|
|
1382
|
+
Modal actions allow you to open a form modal when a user clicks an action button. This is useful for collecting additional information from users or submitting data related to the quote.
|
|
1383
|
+
|
|
1384
|
+
#### Implementation Methods
|
|
1385
|
+
|
|
1386
|
+
There are two ways to implement this functionality:
|
|
1387
|
+
|
|
1388
|
+
**1. Using the "addModal" type:**
|
|
1389
|
+
|
|
1390
|
+
```javascript
|
|
1391
|
+
{
|
|
1392
|
+
"id": "anyCustomId1",
|
|
1393
|
+
"label": "Submit Form",
|
|
1394
|
+
"type": "addModal",
|
|
1395
|
+
"setting": {
|
|
1396
|
+
// Form settings go here (see structure below)
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
**2. Using the "modal" type (alternative approach):**
|
|
1402
|
+
|
|
1403
|
+
```javascript
|
|
1404
|
+
{
|
|
1405
|
+
"id": "anyCustomId2",
|
|
1406
|
+
"label": "Submit Form",
|
|
1407
|
+
"type": "modal",
|
|
1408
|
+
"setting": {
|
|
1409
|
+
// Form settings go here (see structure below)
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
```
|
|
1413
|
+
|
|
1414
|
+
Both approaches are treated identically in the code.
|
|
1415
|
+
|
|
1416
|
+
#### Form Settings Structure
|
|
1417
|
+
|
|
1418
|
+
The `setting` property MUST follow this specific structure:
|
|
1419
|
+
|
|
1420
|
+
```javascript
|
|
1421
|
+
"setting": {
|
|
1422
|
+
// IMPORTANT: The 'create' property is required for the form to work properly
|
|
1423
|
+
"create": {
|
|
1424
|
+
"title": "Submit New Form",
|
|
1425
|
+
"submitUrl": "/api/forms/submit",
|
|
1426
|
+
"method": "POST"
|
|
1427
|
+
},
|
|
1428
|
+
// The 'fields' array is required to define the form fields
|
|
1429
|
+
"fields": [
|
|
1430
|
+
{
|
|
1431
|
+
"id": "name",
|
|
1432
|
+
"label": "Name",
|
|
1433
|
+
"type": "text",
|
|
1434
|
+
"required": "yes",
|
|
1435
|
+
"size": "half"
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
"id": "email",
|
|
1439
|
+
"label": "Email",
|
|
1440
|
+
"type": "email",
|
|
1441
|
+
"required": "yes",
|
|
1442
|
+
"size": "half"
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
"id": "message",
|
|
1446
|
+
"label": "Message",
|
|
1447
|
+
"type": "textarea",
|
|
1448
|
+
"required": "yes",
|
|
1449
|
+
"size": "full"
|
|
1450
|
+
}
|
|
1451
|
+
]
|
|
1452
|
+
}
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1455
|
+
#### Required Form Settings Properties
|
|
1456
|
+
|
|
1457
|
+
- `create`: Object containing settings for the create form (REQUIRED)
|
|
1458
|
+
|
|
1459
|
+
- `title`: The title displayed at the top of the modal
|
|
1460
|
+
- `submitUrl`: The URL to submit the form data to
|
|
1461
|
+
- `method`: The HTTP method to use (POST, PUT, etc.)
|
|
1462
|
+
|
|
1463
|
+
- `fields`: Array of field objects that define the form fields (REQUIRED)
|
|
1464
|
+
- `id`: Unique identifier for the field
|
|
1465
|
+
- `label`: Display label for the field
|
|
1466
|
+
- `type`: Field type (text, email, textarea, select, etc.)
|
|
1467
|
+
- `required`: Whether the field is required ("yes" or "no")
|
|
1468
|
+
- `size`: Field size in the form layout ("full", "half", "quarter")
|
|
1469
|
+
- Additional properties depending on the field type
|
|
1470
|
+
|
|
1471
|
+
## Troubleshooting
|
|
1472
|
+
|
|
1473
|
+
### DataGrid Checkbox Issues
|
|
1474
|
+
|
|
1475
|
+
#### Checkbox Cell Click Bug Fix
|
|
1476
|
+
|
|
1477
|
+
**Problem:** Clicking anywhere within a checkbox cell (but outside the actual checkbox input) incorrectly cleared all other selected checkboxes, leaving only the clicked row selected.
|
|
1478
|
+
|
|
1479
|
+
**Solution:** Enhanced click detection to distinguish between checkbox input clicks and cell area clicks. The fix ensures that both checkbox input clicks and cell area clicks behave identically - toggling only the specific row while maintaining all other selections.
|
|
1480
|
+
|
|
1481
|
+
**Files Modified:**
|
|
1482
|
+
|
|
1483
|
+
- `src/components/crm/DataGrid.jsx` - Enhanced click handling logic
|
|
1484
|
+
- `src/components/crm/styles/global-datagrid.css` - Improved cell styling
|
|
1485
|
+
|
|
1486
|
+
#### Checkbox Improvements
|
|
1487
|
+
|
|
1488
|
+
The DataGrid checkbox functionality has been enhanced with:
|
|
1489
|
+
|
|
1490
|
+
- Larger touch targets for better mobile usability
|
|
1491
|
+
- Consistent behavior between input and cell area clicks
|
|
1492
|
+
- Proper selection state management
|
|
1493
|
+
- Improved visual feedback
|
|
1494
|
+
|
|
1495
|
+
### Modal Action Troubleshooting
|
|
1496
|
+
|
|
1497
|
+
If the modal doesn't open when clicking the action button, check the following:
|
|
1498
|
+
|
|
1499
|
+
1. Make sure the action object has either:
|
|
1500
|
+
|
|
1501
|
+
- `id: "addModal"` or
|
|
1502
|
+
- `type: "modal"`
|
|
1503
|
+
|
|
1504
|
+
2. Check the browser console for any errors or debug messages
|
|
1505
|
+
|
|
1506
|
+
3. **IMPORTANT**: Verify that the `setting` property has the REQUIRED structure:
|
|
1507
|
+
|
|
1508
|
+
- It MUST have a `create` object containing at least `title`, `submitUrl`, and `method`
|
|
1509
|
+
- It MUST have a `fields` array with properly defined field objects
|
|
1510
|
+
|
|
1511
|
+
4. If using the default form settings (without a custom `setting` property), make sure the component has valid form settings in its props.
|
|
1512
|
+
|
|
1513
|
+
## Development Notes
|
|
1514
|
+
|
|
1515
|
+
### DataGrid Layout Optimization
|
|
1516
|
+
|
|
1517
|
+
The DataGrid component has been optimized for vertical space by conditionally relocating the auto refresh control when it's the sole UI control present. This provides better space utilization and cleaner interfaces.
|
|
1518
|
+
|
|
1519
|
+
### Modal Alignment Implementation
|
|
1520
|
+
|
|
1521
|
+
Modal components support vertical alignment configuration with the `verticalAlign` property. Setting `verticalAlign: 'top'` positions modals at 5vh from the top of the viewport for better user experience.
|
|
1522
|
+
|
|
1523
|
+
### Grouping Investigation Results
|
|
1524
|
+
|
|
1525
|
+
The ReactDataGrid's `defaultGroupBy` prop enables internal grouping functionality that creates collapsible group headers within the table structure. It does NOT create any external UI elements that need relocation, as all grouping controls are internal to the table component.
|
|
1526
|
+
|
|
1378
1527
|
## Support
|
|
1379
1528
|
|
|
1380
1529
|
For support, please contact the VISNS Studio team or open an issue on GitHub.
|
package/package.json
CHANGED
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
87
87
|
},
|
|
88
88
|
"name": "@visns-studio/visns-components",
|
|
89
|
-
"version": "5.
|
|
89
|
+
"version": "5.9.1",
|
|
90
90
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
91
91
|
"main": "src/index.js",
|
|
92
92
|
"files": [
|