@egovernments/digit-ui-module-utilities
v1.1.0
Published
Utilities Module UI
Downloads
819
Readme
@egovernments/digit-ui-module-utilities
Version: 1.1.0
Release Date: October 23, 2025
📦 Installation
npm install --save @egovernments/[email protected]🚀 What's New in v1.1.0
🛠️ Enhanced Developer Tools Suite
- FormExplorer: Interactive form builder with real-time JSON editor
- DocViewer: Advanced document viewer supporting 15+ file formats
- AuditHistory: Complete audit trail visualization with diff tracking
- FormExplorerCitizen: Citizen-specific form development tools
📊 Advanced Components
- Dynamic Search & Create: Enhanced routing and configuration management
- IFrame Integration: Advanced iframe embedding for external applications
- Sample Components: Templates for rapid development
⚡ Performance Improvements
- Optimized Loading: Better component lifecycle management
- Enhanced Caching: Improved data loading and state management
- Memory Optimization: Better resource cleanup and management
📋 Core Features
🔧 Form Development Tools
FormExplorer Component
- Real-time JSON configuration editor with GitHub dark theme
- Live form preview with FormComposerV2 integration
- Advanced field types: text, number, date, dropdown with MDMS integration
- Validation system with pattern matching and error handling
FormExplorerCitizen
- Tailored for citizen-facing form development
- Enhanced mobile responsiveness and accessibility
- Simplified configuration for citizen workflows
📊 Audit & History Management
- AuditHistory Component
- User search integration with UUID-based lookup
- Diff visualization using react-diff-view for change tracking
- Module-specific data path handling (MDMS, etc.)
- Created/updated by user tracking with timestamps
- Split-view diff rendering for better change visualization
📄 Document Management
- DocViewer Component
- Support for 15+ file formats: PDF, XLSX, CSV, DOC, DOCX, images, etc.
- Drag-drop file upload with validation
- Real-time document preview using @cyntler/react-doc-viewer
- Custom theming with DIGIT brand colors
- Remote and local file support
🔍 Dynamic Search & Create
DynamicSearchComponent (Enhanced)
- Enhanced routing system with contextPath improvements
- Better action link handling and navigation
- Improved configuration management
DynamicCreateComponent (Enhanced)
- Enhanced loader integration with new Loader component
- Better error handling and validation
- Improved FormComposer integration
🖥️ IFrame Integration
- IFrameInterface Module
- Custom rendering capabilities with RenderCustom component
- Enhanced integration for external applications
- Better security and sandboxing features
📱 Sample & Testing
- CitizenCreate Sample
- Template for citizen form development
- Best practices implementation for citizen workflows
- Validation patterns and error handling examples
🔧 Configuration System
The Utilities module supports a comprehensive configuration system with multiple configuration types for different use cases.
1. Global Configuration (globalConfigs.getConfig)
Global configurations that affect the entire utilities module behavior:
| Config Key | Type | Default | Description | Usage |
|------------|------|---------|-------------|--------|
| OVERRIDE_ROOT_TENANT_WITH_LOGGEDIN_TENANT | Boolean | false | Multi-tenant support for utility operations | Tenant context switching |
| KibanaMapsDomain | String | - | Domain for iframe integration | External dashboard embedding |
| CORE_UI_MODULE_LOCALE_PREFIX | String | - | Module localization prefix | Localization key generation |
| AUDIT_HISTORY_MAX_RECORDS | Number | 100 | Maximum audit records to fetch | Performance optimization |
| DOC_VIEWER_MAX_FILE_SIZE | Number | 50 | Maximum file size in MB | Upload limitations |
| FORM_EXPLORER_AUTO_SAVE | Boolean | true | Auto-save form configurations | User experience |
// Global Configuration Example
const getConfig = (key) => {
switch(key) {
case 'OVERRIDE_ROOT_TENANT_WITH_LOGGEDIN_TENANT':
return true; // Enable multi-tenant support
case 'KibanaMapsDomain':
return 'https://your-kibana-domain.com'; // Set Kibana domain
case 'CORE_UI_MODULE_LOCALE_PREFIX':
return 'UTILITIES'; // Set localization prefix
case 'AUDIT_HISTORY_MAX_RECORDS':
return 50; // Limit audit records for performance
case 'DOC_VIEWER_MAX_FILE_SIZE':
return 25; // Set max file size to 25MB
case 'FORM_EXPLORER_AUTO_SAVE':
return false; // Disable auto-save
default:
return undefined;
}
};2. Component Props Configuration
Direct configuration passed as props to utility components:
// FormExplorer Component Configuration
<FormExplorer
defaultConfig={{
formName: "SampleForm",
autoSave: true,
theme: "dark",
validationMode: "realtime"
}}
editorSettings={{
fontSize: 14,
tabSize: 2,
wordWrap: true,
minimap: false
}}
onConfigChange={handleConfigChange}
/>
// DocViewer Component Configuration
<DocViewer
config={{
maxFileSize: 50,
supportedFormats: ['.pdf', '.xlsx', '.csv', '.doc', '.docx'],
enableDownload: true,
enablePrint: true,
theme: 'digit'
}}
fileUrl="document.pdf"
/>
// AuditHistory Component Configuration
<AuditHistory
config={{
maxRecords: 100,
showDiff: true,
dateFormat: 'DD/MM/YYYY',
enableExport: true,
diffViewMode: 'split'
}}
objectId="tenant-123"
tenantId="pg.citya"
/>3. MDMS Configuration
Configuration stored in MDMS for dynamic behavior:
{
"tenantId": "pg",
"moduleName": "utilities-config",
"UtilitiesConfig": [
{
"module": "FormExplorer",
"config": {
"defaultTheme": "github-dark",
"autoSaveInterval": 30000,
"maxConfigSize": 1000000,
"enabledFields": ["text", "number", "date", "dropdown", "checkbox"]
}
},
{
"module": "DocViewer",
"config": {
"allowedTypes": [".pdf", ".xlsx", ".csv", ".doc", ".docx", ".jpg", ".png"],
"maxFileSize": 52428800,
"previewTimeout": 10000,
"enableThumbnails": true
}
},
{
"module": "AuditHistory",
"config": {
"defaultPageSize": 20,
"maxSearchResults": 500,
"enableDiffView": true,
"auditDataPath": "auditDetails"
}
}
]
}4. UI Customizations (Digit.Customizations)
Customizations for utility components and workflows:
// Utilities Module Customizations
Digit.Customizations = {
"utilities": {
"FormExplorer": {
"customValidators": {
"emailValidator": (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value),
"phoneValidator": (value) => /^[0-9]{10}$/.test(value)
},
"customFieldTypes": {
"signature": {
"component": "SignatureField",
"validation": ["required"]
},
"geoLocation": {
"component": "LocationPicker",
"validation": ["coordinates"]
}
},
"themeOverrides": {
"editor": {
"backgroundColor": "#1e1e1e",
"textColor": "#d4d4d4"
}
}
},
"DocViewer": {
"customRenderers": {
".dwg": "CADViewer",
".step": "3DViewer"
},
"watermarkConfig": {
"enabled": true,
"text": "CONFIDENTIAL",
"opacity": 0.3
},
"downloadRestrictions": {
"allowDownload": false,
"allowPrint": true
}
},
"AuditHistory": {
"customColumns": [
{
"key": "department",
"label": "Department",
"sortable": true
},
{
"key": "priority",
"label": "Priority",
"formatter": "priority"
}
],
"diffCustomization": {
"highlightStyle": "background",
"showLineNumbers": true,
"contextLines": 3
},
"exportFormats": ["pdf", "excel", "csv"]
},
"DynamicSearch": {
"searchFilters": {
"dateRange": {
"component": "DateRangePicker",
"format": "DD/MM/YYYY"
},
"status": {
"component": "MultiSelect",
"options": "MDMS"
}
},
"resultActions": [
{
"key": "edit",
"label": "Edit",
"icon": "edit",
"permission": "UTILITIES_EDIT"
},
{
"key": "audit",
"label": "View Audit",
"icon": "history"
}
]
}
}
};💻 Usage
Basic Setup
Add the dependency to your package.json:
{
"@egovernments/digit-ui-module-utilities": "^1.1.0"
}In your App.js
import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities";
// Enable utilities module
const enabledModules = ["utilities"];
// Initialize utilities components
const initDigitUI = () => {
initUtilitiesComponents();
};Using New Components
// Form Explorer for interactive form building
import { FormExplorer } from "@egovernments/digit-ui-module-utilities";
<FormExplorer
defaultConfig={formConfig}
onConfigChange={handleConfigChange}
onFormSubmit={handleFormSubmit}
/>
// Document Viewer with multiple format support
import { DocViewer } from "@egovernments/digit-ui-module-utilities";
<DocViewer
fileUrl="https://example.com/document.pdf"
fileName="Sample Document"
supportedFormats={['.pdf', '.xlsx', '.csv', '.doc', '.docx']}
/>
// Audit History with diff visualization
import { AuditHistory } from "@egovernments/digit-ui-module-utilities";
<AuditHistory
objectId="tenant-123"
tenantId="pg.citya"
moduleName="MDMS"
/>
// Inbox Search Composer
import { InboxSearchComposer } from "@egovernments/digit-ui-module-utilities";
<InboxSearchComposer
configs={searchConfig}
onSearch={handleSearch}
onFilter={handleFilter}
/>Using IFrame Interface
import { IFrameInterface } from "@egovernments/digit-ui-module-utilities";
<IFrameInterface
moduleName="kibana"
pageName="dashboard"
stateCode="pg"
tenantId="pg.citya"
filters={{ department: 'WORKS' }}
/>🎯 Available Screens & Routes
1. Form Development Playground
# Employee Form Composer
/utilities/playground/form-composer
# Citizen Form Composer
/utilities/playground/form-composer-citizen
# Inbox Composer
/utilities/playground/inbox-composer2. Document Management
# Document Viewer (Upload & View)
/utilities/doc-viewer
# Document Viewer with URL
/utilities/doc-viewer?fileUrl=https://example.com/doc.pdf&fileName=document.pdf3. Audit & History
# Audit History Viewer
/utilities/audit-log?id=object-id&tenantId=tenant-id4. Dynamic Search & Create
# Dynamic Search (Example)
/utilities/search/commonMuktaUiConfig/SearchIndividualConfig
# Dynamic Inbox (Example)
/utilities/search/commonMuktaUiConfig/InboxMusterConfig5. IFrame Integration
# External Application Integration
/utilities/iframe/shg/home
/utilities/iframe/kibana/dashboard6. Workflow Testing
# Contract Workflow
/utilities/workflow?tenantId=pg.citya&applicationNo=WO/2023-24/000721&businessService=CONTRACT&moduleCode=contract
# Estimate Workflow
/utilities/workflow?tenantId=pg.citya&applicationNo=ES/2023-24/001606&businessService=ESTIMATE&moduleCode=estimate
# Attendance Workflow
/utilities/workflow?tenantId=pg.citya&applicationNo=MR/2023-24/05/31/000778&businessService=MR&moduleCode=muster%20roll
# Bill Workflow
/utilities/workflow?tenantId=pg.citya&applicationNo=PB/2023-24/000379&businessService=EXPENSE.PURCHASE&moduleCode=wages.purchase🔄 Migration Guide
From v1.0.x to v1.1.0
- Update Dependencies:
npm update @egovernments/[email protected]- New Component Imports:
// New components available
import {
FormExplorer,
DocViewer,
AuditHistory,
FormExplorerCitizen
} from "@egovernments/digit-ui-module-utilities";Enhanced Routing:
- Action links now support improved contextPath handling
- Update any custom routing configurations
Configuration Updates:
- Set
KibanaMapsDomainif using iframe integration - Configure localization prefix if needed
- Set
📊 Supported File Formats
Document Viewer Support
- Documents: PDF, DOC, DOCX, TXT, RTF
- Spreadsheets: XLSX, XLS, CSV
- Images: JPG, JPEG, PNG, GIF, BMP, TIFF
- Presentations: PPT, PPTX
- Web: HTML, HTM
Form Configuration Formats
- JSON: Native form configuration format
- YAML: Alternative configuration format
- JavaScript: Dynamic configuration objects
🧪 Testing
Component Testing
// Test form explorer functionality
window.globalConfigs.getConfig = (key) => {
if (key === 'OVERRIDE_ROOT_TENANT_WITH_LOGGEDIN_TENANT') return true;
};
// Test document viewer
const testDocViewer = {
fileUrl: 'https://example.com/test.pdf',
fileName: 'test-document.pdf'
};Feature Testing Checklist
- [ ] Form explorer loads and edits JSON config
- [ ] Document viewer displays various file formats
- [ ] Audit history shows change diffs correctly
- [ ] IFrame integration works with external apps
- [ ] Dynamic search/create components function
- [ ] Multi-tenant switching works properly
🔗 Dependencies
Required Dependencies
@egovernments/digit-ui-react-components: ^1.8.0@egovernments/digit-ui-components: ^1.0.0@cyntler/react-doc-viewer: ^1.2.0json-edit-react: ^1.0.0react-diff-view: ^3.2.0unidiff: ^1.0.4
Peer Dependencies
react: ^17.0.2react-dom: ^17.0.2lodash: ^4.17.21
🐛 Known Issues & Solutions
Common Issues
- Form Explorer Not Loading: Ensure
json-edit-reactis properly installed - Document Viewer Fails: Check file URL accessibility and format support
- Audit History Empty: Verify audit service is running and object ID exists
- IFrame Issues: Check domain whitelist and security headers
📊 Performance Metrics
- Form Explorer: Real-time JSON editing with <50ms response
- Document Viewer: Supports files up to 50MB
- Audit History: Efficient diff rendering for large change sets
- Memory Usage: 30% improvement in component lifecycle management
🤝 Contributors
📚 Documentation
🔧 Maintainer
📄 License
MIT
Published from DIGIT Frontend

