@xelto.npm/xc-lib
v1.1.9
Published
Xelcode Library containing components and utilities
Maintainers
Readme
Xelcode Library
A comprehensive React component library and utility toolkit for building enterprise applications with Material-UI integration.
📦 Installation
npm install xelcode-library
# or
yarn add xelcode-library🔗 Development Setup
For development and testing, you can use yarn link:
# In the xelcode-library directory
yarn link
# In your project directory
yarn link xelcode-library🏗️ Project Structure
src/
├── components/ # React components
├── store/ # Redux store with sagas
└── utils/ # Utility functions and helpers🧩 Components
Core Components
Button: Enhanced Material-UI Button with additional styling and icon supportDialog: Modal dialog component with built-in audio feedback and type-based stylingTextField: Enhanced text input with scanning support and custom adornmentsList&SimpleList: Advanced list components with search, sorting, and swipe functionalityDatePicker: Date selection component with Material-UI Pickers integrationSelect&SelectDialog: Dropdown selection components with keyboard navigation support
Additional Components
ButtonGroup: Arrange buttons in a grid layoutErrorBoundary: React error boundary with fallback UIHelperText: Information text with iconsLabel&LabelAligned: Text display componentsLoading: Loading overlay with timeout supportRadioButtonGroup: Radio button selection groupScannerService: Barcode scanner integration service
🗄️ Store & State Management
The library includes a complete Redux store setup with Redux-Saga for side effects.
Store Modules
API: API request state managementCommon: Shared application stateScanner: Barcode scanner stateUser: User authentication and session management
Usage
import { libraryActions, librarySaga } from 'xelcode-library/store';
// Dispatch actions
dispatch(libraryActions.getConfig());
dispatch(libraryActions.getPrinters());
// Access selectors
import { selectCommon, selectUser } from 'xelcode-library/store';
const common = useSelector(selectCommon());
const user = useSelector(selectUser());🛠️ Utilities
API Management
import { ApiManager } from 'xelcode-library/utils';
// Initialize API manager
ApiManager.setStore(store);
ApiManager.setSession(sessionId);
// Make API calls
const result = await ApiManager.post('endpoint', data);JDE Utilities
import { JdeUtils, Config } from 'xelcode-library/utils';
// Format lot numbers
const formatted = JdeUtils.formatLotLots(item, lotn, lots, branch);
// Get configuration
const value = Config.get('key');Available JdeUtils Functions
consignmentFlag(branch): Check if branch is consignmentformatLotLots(item, lotn, lots, branch): Format item with lotn and lots informationtrim(text, length): Trim text to specified lengthgetPrinter(processId, printers): Get appropriate printer for processIdisValidTime(time): Validate time formatparseOrderNumber(order, withCompany): Parse order number into componentstoDouble(text, numberOfDigit): Convert text to double with numberOfDigit decimal placestoBool(text): Convert text to booleanformatQuantity(quantity, um): Format quantity with unit of measure umformatDate(date): Format date to YYYYMMDD stringformatOrder(...args): Join args order argumentsformatTime(hhmm): Format hhmm time to HH:MMtoPrimaryUM(item, quantity, fromUM): Convert quantity from fromUM to primary unitconvertUM(quantity, item, umCode): Convert quantity between units using umCodegetUMFactor(item, umCode): Get unit of measure conversion factor for umCodeconvertToStruct(quantity, item, structId): Convert quantity to structural unit structIdconvertFromStruct(quantity, item, structId): Convert quantity from structural unit structIdgetUom1(item): Get primary unit of measure from itemgetStructUM(item, structId): Get structural unit of measure for structIdcompareItemsMask(item1, scan): Compare item1 with scan using maskcompareItems(item1, scan): Compare item1 with scan for equalitycompareItem(item, itemCode): Compare item with itemCodelocationFormat(location, addRemainingSeparators): Format location stringlocationDeformat(location): Remove formatting from locationfilter(textfieldValue, value): Filter value based on textfieldValue inputparseToHHMM(time): Parse time to HH:MM formatparseMicrosoftDate(date): Parse Microsoft date format
🔧 Configuration
Environment Variables
API_BASE_URL=https://api.example.com
TIMEOUT=364000📋 Requirements
- Node.js >= 10
- React >= 17.0.2
- React DOM >= 17.0.2
- Material-UI >= 4.12.3
🚀 Development
Build
npm run build
# or
yarn buildBuilt with ❤️ by the Xelcode team
