Skip to content

Latest commit

 

History

History
132 lines (119 loc) · 3.59 KB

masters.md

File metadata and controls

132 lines (119 loc) · 3.59 KB

Master

Avails facility to list/create/update/delete records for master

import { Provider, Master } from '@knovator/masters-admin`;

function App() {
    return (
        <Provider
            ...
        >
            <Master />
        </Provider>
    )
}

(back to top)

Master.Table

  • Avails facility to show Table component for Master explicitly.
  • Available props are mentioned in data-formats
    <Master>
        <Master.Table />
    </Master>

(back to top)

Master.Pagination

  • Avails facility to show Pagination component for Master explicitly.
    <Master>
        <Master.Table />
        <Master.Pagination />
    </Master>

(back to top)

Master.Search

  • Avails facility to show Search component for Master explicitly.
  • Search records in master, as user starts typing
    <Master>
        <Master.Search />
    </Master.Search>

(back to top)

Master.AddButton

  • Avails facility to open Form, when clicked
    <Master>
        <Master.AddButton />
    </Master.Search>

(back to top)

Master.Lister

  • Avails facility to list Master records, to use together in sync with SubMaster
    <Master>
        <Master.Lister />
    </Master>

Props

  • render({ row, onClick, masterCode }) => JSX (optional) => function to render list items, provides following arguments while execution
    • row => Current record
    • onClick => Function to call when current item is selected/clicked
    • masterCode => string indicates record code currently selected
  • selectFirst => boolean prop indicats to show submasters data for first master record

(back to top)

Master.FormWrapper

  • Avails facility to access form parameters, to use when explicitForm is true for Master
    <Master
        explicitForm={true}
    >
        <Master.FormWrapper>
            {({ formState, onClose, open }) => (
                ...
            )}
        </Master.FormWrapper>
    </Master>

(back to top)

Master.FormActions

  • Avails facility to show FormActions, to be used inside FormWrapper along with Form. Required to provide formRef.
    const formRef = React.createRef();
    
    // return
    <Master
        explicitForm={true}
    >
        <Master.FormWrapper>
            {({ formState, onClose, open }) => (
                <>
                    <Master.Form ref={formRef} />
                    <Master.FormActions formRef={formRef} />
                </>
            )}
        </Master.FormWrapper>
    </Master>

(back to top)

Master.Form

  • Avails facility to show Form, to be used inside FormWrapper along with FormActions. Required to provide ref.
    const formRef = React.createRef();
    
    // return
    <Master
        explicitForm={true}
    >
        <Master.FormWrapper>
            {({ formState, onClose, open }) => (
                <>
                    <Master.Form ref={formRef} />
                    <Master.FormActions formRef={formRef} />
                </>
            )}
        </Master.FormWrapper>
    </Master>

(back to top)