@zohodesk/library-platform
v1.0.2
Published
This library provides components for rendering Table List pages in compliance with the Zoho Desk Module Framework standards. It includes functionality for table handling.
Downloads
293
Maintainers
Keywords
Readme
Table List Library
This library provides components for rendering Table List pages in compliance with the Zoho Desk Module Framework standards. It includes functionality for table handling.
Installation
To install the library, use the following command:
npm install @zohodesk/library-platform
Usage
Creating a Table Connected Component
To create a Table Connected component, you can use the TableConnectedFactory
. Here is a simple example:
import TableConnectedFactory from '@zohodesk/library-platform/TableConnectedFactory';
const myTableComponent = TableConnectedFactory.create({
name: 'MyTableComponent',
dataBroker: myDataBroker,
eventHandlers: {
onRowSelect: row => {
console.log('Selected row:', row);
}
}
});
Custom Component Creation
You can create custom components using the createCustomComponent
function. This function sets up the component with the necessary dependencies and lifecycle methods.
Example
import createCustomComponent from '@zohodesk/library-platform/createCustomComponent';
const MyCustomComponent = createCustomComponent({
name: 'MyCustomComponent',
View: MyComponentView // Your component view
});
// Usage in application
<MyCustomComponent />;
Component Registry
The ComponentRegistry
class is a singleton that allows you to register and retrieve components by name. This can be useful for managing component instances throughout your application.
Example
import ComponentRegistry from '@zohodesk/library-platform/ComponentRegistry';
// Register a component
ComponentRegistry.register('MyComponent', myComponentInstance);
// Retrieve a component
const myComponent = ComponentRegistry.get('MyComponent');
Props Contract
The TableConnectedFactory.create
method accepts the following parameters:
- name:
string
- The name of the component. - dataBroker:
object
- The data broker instance to manage data fetching and manipulation. - eventHandlers:
object
- An object containing event handler functions. - View:
React.Component
- Custom view component to render the table.
Components Overview
- Properties: Defines the props contract for the Table Connected component.
- TableConnectedView: The default view component for rendering the table.
- EventHandlersFactory: Factory to manage event handlers for the component.
- Behaviour Factories: Include various behaviours such as HTTP requests, field management, and list rendering.
- ComponentRegistry: Singleton for managing component instances across your application.
- createCustomComponent: Function to create custom components with necessary dependencies and lifecycle methods.