@ismail424/svelte-formly
Version:
<p align="center"> <img width="100%" height="300" src="./logo.png" alt="Svelte Formly" /> </p>
92 lines (91 loc) • 2.07 kB
TypeScript
export interface IFormProps {
form_name: string;
fields: IField[];
btnSubmit?: IBtnSubmit;
btnReset?: IBtnReset;
realtime?: boolean;
}
export interface IForm extends IFormProps {
values: any;
valid: boolean;
}
declare const _number: number;
export declare type RulesList = 'required' | `min:${typeof _number}` | `max:${typeof _number}` | 'email' | 'between' | 'file' | 'equal' | 'url' | {
name: string;
fnc: () => Promise<boolean>;
};
export interface IField {
type: 'input' | 'date' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'file' | 'autocomplete';
name: string;
value?: any;
attributes: Attributes;
description?: Description;
prefix?: IPrefix;
rules?: RulesList[];
messages?: any;
extra?: any;
preprocess?: Function;
validation?: any;
file?: IFileRules;
}
export interface IPropsField {
form_name: string;
field: IField;
changeValue: Function;
}
export interface Attributes {
id: string;
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'range';
label?: string;
classes?: string[];
placeholder?: string;
disabled?: boolean;
readonly?: boolean;
min?: number;
max?: number;
step?: number;
autocomplete?: string;
autocorrect?: string;
rows?: number;
cols?: number;
}
export interface AutoCompleteItems {
title: string;
value: any;
}
export interface Description {
tag: string;
classes?: string[];
text: string;
}
export interface IPrefix {
tag: string;
classes?: string[];
}
export interface IPropsTag {
tag: string;
classes?: string[] | null;
children: any;
}
export interface IValue {
form_name: string;
values: any;
}
export interface ISubmit {
type: string;
text: string;
classes: string[];
}
export interface IBtnSubmit {
text?: string;
classes?: string[];
}
export interface IBtnReset {
text?: string;
classes?: string[];
}
export interface IFileRules {
maxSize?: number;
extensions?: string[];
}
export {};