web-appform
v0.1.2
Published
Schema-driven dynamic form engine for React.
Readme
web-appform
Schema-driven dynamic form engine for React.
Installation
npm install web-appformNo registry configuration and no access token — this is a public package on npmjs.com.
Peer dependencies
react and react-dom (^19.0.0) are the only things the host must install.
MUI, Emotion, date-fns and react-toastify are compiled into the bundle, so
they are declared as devDependencies rather than dependencies — installing
this package pulls down nothing beyond React.
Usage
import {
AppFormComponent,
type IAppFormData,
type IFileInfo,
} from "web-appform";
import "web-appform/dist/web-appform.css";
<AppFormComponent
formCode="myFormCode"
config={{
hideTitle: false,
saveBtnTitle: "Save",
mode: "Add",
renderMode: "modal",
}}
ExternalMethods={{ getAppForm }}
ExpressionMethods={{ VAR, DVAR }}
onSubmit={(formData: IAppFormData, files: IFileInfo[]) => {
/* ... */
}}
onDiscard={() => {
/* ... */
}}
/>;The CSS import is required — without it the form renders unstyled.
AppFormComponent supplies its own theme and dialog/toast providers, and
detects existing ones in the host so it does not double-wrap.
Exports
Runtime values: AppFormComponent, lightTheme, formatDateTime,
parseDateTime, DateTimeFormats, the enums FormFieldType, FileType,
AttributeType, UploadFileType, RuleType, TargetPropertyType, and the
DialogServiceProvider / ToastServiceProvider providers with their
useDialogService / useToastService hooks.
Types: IAppForm, IField, IAppFormData, IForm, IExternalMethods,
IExpressionMethods, IBinding, IValidation, IRule, FormField and its
per-type variants, and the rest of the schema surface.
