@visns-studio/visns-components 5.15.15 → 5.15.16

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 CHANGED
@@ -13,6 +13,7 @@ VISNS Components is a React-based UI component library that provides a set of re
13
13
 
14
14
  ### Latest Enhancements
15
15
 
16
+ - **Phone and ABN Formatting**: Added specialized formatting for Australian phone numbers and ABNs across DataGrid, GenericDetail, and JSON fields with format support
16
17
  - **CameraPlacement Legacy Import**: Added comprehensive legacy JSON file import functionality with support for multiple data formats, automatic image loading, and seamless database integration
17
18
  - **CameraPlacement Module**: Enhanced interactive camera placement tool with improved UI consistency, better icon visibility, drag-and-drop image upload, professional export capabilities, and complete Verkada database integration
18
19
  - **Complete StandardModal Migration**: All components now use StandardModal instead of reactjs-popup for consistent modal behavior across the entire library
@@ -586,6 +587,8 @@ The DataGrid component utilizes a modular column renderer system with 28 special
586
587
  - `json` - JSON data extraction and display
587
588
  - `number` - Numeric values
588
589
  - `option` - Option mapping with placeholders
590
+ - `phone` - Phone number formatting for Australian numbers
591
+ - `abn` - Australian Business Number formatting
589
592
  - `placeholder` - Static placeholder text
590
593
  - `age` - Age calculation from dates
591
594
  - `coding` - Custom coding logic
@@ -677,6 +680,72 @@ The `html5_date` column type provides native HTML5 date picker functionality in
677
680
  }
678
681
  ```
679
682
 
683
+ #### Phone and ABN Formatting
684
+
685
+ The DataGrid and GenericDetail components include specialized formatting for Australian phone numbers and ABNs (Australian Business Numbers).
686
+
687
+ ##### Phone Number Formatting
688
+
689
+ The `phone` column type automatically formats phone numbers according to Australian standards:
690
+
691
+ **Supported Formats:**
692
+ - **Mobile Numbers**: `0400 000 000` (04XX XXX XXX)
693
+ - **1300/1800 Numbers**: `1300 000 000` (1300 XXX XXX)
694
+ - **Landline Numbers**: `(02) 0000 0000` ((0X) XXXX XXXX)
695
+ - **Generic Formatting**: Applied to other number patterns
696
+ - **Fallback**: Returns original value if no pattern matches
697
+
698
+ **Configuration Examples:**
699
+
700
+ DataGrid:
701
+ ```jsx
702
+ {
703
+ id: 'phone',
704
+ label: 'Phone Number',
705
+ type: 'phone',
706
+ width: '15%'
707
+ }
708
+ ```
709
+
710
+ GenericDetail:
711
+ ```jsx
712
+ {
713
+ id: 'phone',
714
+ label: 'Phone Number',
715
+ type: 'phone',
716
+ relation: ['company'] // Also works with relationship fields
717
+ }
718
+ ```
719
+
720
+ JSON Fields with Format:
721
+ ```jsx
722
+ {
723
+ id: 'contact_data',
724
+ label: 'Contact',
725
+ type: 'json',
726
+ jsonData: 'phone',
727
+ format: 'phone' // Applies phone formatting to JSON field values
728
+ }
729
+ ```
730
+
731
+ ##### ABN Formatting
732
+
733
+ The `abn` column type formats Australian Business Numbers:
734
+
735
+ **Format**: `00 000 000 000` (XX XXX XXX XXX)
736
+ - Validates 11-digit ABNs
737
+ - Returns original value if not valid format
738
+
739
+ **Configuration Example:**
740
+ ```jsx
741
+ {
742
+ id: 'abn',
743
+ label: 'ABN',
744
+ type: 'abn',
745
+ width: '15%'
746
+ }
747
+ ```
748
+
680
749
  #### Intelligent Relationship Sorting
681
750
 
682
751
  The DataGrid component includes intelligent sorting capabilities that automatically detect and enable sorting for relationship and JSON fields. This feature works seamlessly with the backend `HasRelationshipSorting` trait.
package/package.json CHANGED
@@ -94,7 +94,7 @@
94
94
  "react-dom": "^17.0.0 || ^18.0.0"
95
95
  },
96
96
  "name": "@visns-studio/visns-components",
97
- "version": "5.15.15",
97
+ "version": "5.15.16",
98
98
  "description": "Various packages to assist in the development of our Custom Applications.",
99
99
  "main": "src/index.js",
100
100
  "files": [
@@ -2412,6 +2412,22 @@ const DataGrid = forwardRef(
2412
2412
  }
2413
2413
  }
2414
2414
 
2415
+ // Check function-based condition if it exists
2416
+ if (allow && s.condition && typeof s.condition === 'function') {
2417
+ try {
2418
+ console.log('🔍 DataGrid: Evaluating condition for setting:', s.id, 'with data:', d);
2419
+ const conditionResult = s.condition(d);
2420
+ console.log('🔍 DataGrid: Condition result:', conditionResult, 'for setting:', s.id);
2421
+ if (!conditionResult) {
2422
+ allow = false;
2423
+ console.log('🔍 DataGrid: Setting blocked by condition:', s.id);
2424
+ }
2425
+ } catch (error) {
2426
+ console.warn('🔍 DataGrid: Condition function error for setting:', s.id, error);
2427
+ allow = false;
2428
+ }
2429
+ }
2430
+
2415
2431
  if (allow) {
2416
2432
  switch (s.id) {
2417
2433
  case 'activate':
@@ -2456,6 +2472,8 @@ const DataGrid = forwardRef(
2456
2472
  return getIconComponent(RotateCcw);
2457
2473
  case 'update':
2458
2474
  return getIconComponent(Edit);
2475
+ case 'romComplete':
2476
+ return getIconComponent(CheckCircle);
2459
2477
  default:
2460
2478
  return null;
2461
2479
  }
@@ -15,6 +15,11 @@ const interpretBooleanValue = (value, column) => {
15
15
 
16
16
  if (!isTrue && !isFalse) return value; // Return original if not clearly boolean
17
17
 
18
+ // Check for custom boolean labels first
19
+ if (column.booleanLabels && typeof column.booleanLabels === 'object') {
20
+ return isTrue ? column.booleanLabels.true : column.booleanLabels.false;
21
+ }
22
+
18
23
  // Contextual interpretations based on column name patterns
19
24
  const interpretations = {
20
25
  // Status/State patterns