-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Egor Stambakio edited this page Jun 4, 2018
·
3 revisions
- Getting started
- API Reference:
- Code-Conventions
- Diagrams
Installation:
npm i @opuscapita/react-crudeditor
Minimal setup:
import createEditor from '@opuscapita/react-crudeditor'
import modelDefinition from './modelDefinition'
const ContractEditor = createEditor(<Model Definition>)
// ...use it later
// <ContractEditor/>
<Model Definition>
is a single object:
// modelDefinition.js
import { FIELD_TYPE_STRING } from '@opuscapita/react-crudeditor'
export default {
model: {
name: 'Contract',
fields: {
contractId: {
unique: true,
type: FIELD_TYPE_STRING,
constraints: {
required: true
}
},
description: {
type: FIELD_TYPE_STRING
}
},
validate: () => true
},
permissions: {
crudOperations: {
create: true,
edit: true,
delete: true,
view: true
}
},
api: { get, search, delete, create, update }, // API functions
ui: {
create: { formLayout },
edit: { formLayout },
show: { formLayout }
}
}
Not implemented:
- isCreateSupported,
- duplicationConfiguration,
- cmlExportConfiguration.
- Allow custom operations to overwrite standard operations.