UNPKG

2.74 kBTypeScriptView Raw
1import { RefObject, Emitter } from '@mantou/gem/lib/decorators';
2import { GemElement, TemplateResult } from '@mantou/gem/lib/element';
3import type { DataList } from './input';
4import type { Option } from './picker';
5import type { Option as SelectOption } from './select';
6import type { Adder } from './options';
7import './input';
8import './picker';
9import './button';
10import './checkbox';
11import './radio';
12import './select';
13import './help-text';
14import './date-picker';
15import './date-range-picker';
16/**
17 * @customElement dy-form
18 * @attr inline
19 */
20export declare class DuoyunFormElement<Data = Record<string, any>> extends GemElement {
21 inline: boolean;
22 change: Emitter<Data>;
23 get items(): DuoyunFormItemElement[];
24 get elements(): Record<string, DuoyunFormItemElement | undefined>;
25 get data(): Data;
26 constructor();
27 valid(): Promise<boolean>;
28 clearInvalidMessage(): void;
29}
30/**
31 * @customElement dy-form-item-inline-group
32 */
33export declare class DuoyunFormItemInlineGroupElement extends GemElement {
34 constructor();
35}
36declare type FormItemState = {
37 invalidMessage?: string;
38};
39declare type FormItemRule = {
40 message?: string;
41 pattern?: string | RegExp;
42 required?: boolean;
43 validator?: (value: any) => void | Promise<void>;
44};
45/**
46 * @customElement dy-form-item
47 * @attr type
48 * @attr multiple
49 * @attr name
50 * @attr label
51 * @attr placeholder
52 * @attr required
53 * @attr checked
54 * @attr autofocus
55 * @attr disabled
56 * @attr searchable
57 * @attr clearable
58 */
59export declare class DuoyunFormItemElement extends GemElement<FormItemState> {
60 #private;
61 static label: string;
62 static tip: string;
63 static input: string;
64 static add: string;
65 type: 'text' | 'password' | 'date' | 'date-range' | 'number' | 'checkbox' | 'checkbox-group' | 'picker' | 'radio-group' | 'select' | 'textarea' | 'slot';
66 multiple: boolean;
67 name: string;
68 label: string;
69 placeholder: string;
70 required: boolean;
71 checked: boolean;
72 autofocus: boolean;
73 disabled: boolean;
74 searchable: boolean;
75 clearable: boolean;
76 time: boolean;
77 invalid: boolean;
78 value?: number | string | any[] | any;
79 renderLabel?: (e: SelectOption) => string | TemplateResult;
80 rules?: FormItemRule[];
81 dataList?: DataList | Option[] | SelectOption[];
82 adder?: Adder;
83 itemchange: Emitter<{
84 name: string;
85 value: number | string | any[] | any;
86 }>;
87 slotRef: RefObject<HTMLSlotElement>;
88 state: FormItemState;
89 get data(): any;
90 constructor();
91 mounted: () => void;
92 render: () => TemplateResult;
93 focus(): void;
94 clearInvalidMessage(): void;
95 valid(): Promise<boolean>;
96}
97export {};
98//# sourceMappingURL=form.d.ts.map
\No newline at end of file