0.0.4 • Published 3 years ago

@opensrp/plan-form v0.0.4

Weekly downloads
52
License
Apache-2.0
Repository
github
Last release
3 years ago

PlanForm

Component that renders a form to create or edit OpenSRP plans. It implements custom UI and user interactions as required by opensrp-web apps that use antd.

Installation

yarn add @opensrp/plan-form
import '@opensrp/plan-form/dist/index.css';

Usage

Props/ Configuration

envConfigs

Optional(EnvConfigs)

an object containing the env configuration options

hiddenFields

Optional(PlanFormFieldsKeys[])

an array of keys for fields that should be hidden

disabledFields

Optional(PlanFormFieldsKeys[])

an array of keys for fields that should be disabled

disabledActivityFields

Optional(string[])

an array of keys for fields that should be disabled in the activities section

afterSubmit

Optional(Function)

hook called after payload is successfully sent to the API

beforeSubmit

Optional((payload) => boolean)

hook called before the submitting is initiated, return boolean to indicate if submitting should proceed

getRedirectPath

required((planStatus) => string)

callback to get the path to redirect after successfully form submission

onCancel

required(() => void)

callback called once user clicks on cancel in the plan form

allFormActivities

Optional()

List of allowed activities

initialValues

Optional()

predefine form field values

Code examples

import {PlanForm} form '@opensrp/plan-form';
import '@opensrp/plan-form/dist/index.css';

const formPage = () => {
  return (<PlanForm />)
}