fj-form 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,83 +1,137 @@
1
1
  import { App } from 'vue';
2
2
  import { ComponentOptionsMixin } from 'vue';
3
3
  import { ComponentProvideOptions } from 'vue';
4
+ import { CreateComponentPublicInstanceWithMixins } from 'vue';
4
5
  import { DefineComponent } from 'vue';
6
+ import { GlobalComponents } from 'vue';
7
+ import { GlobalDirectives } from 'vue';
5
8
  import { PublicProps } from 'vue';
6
9
 
7
10
  export declare class Base {
8
11
  formType: FormItemType;
9
- span: number;
12
+ span?: number;
10
13
  key: string;
11
- label: string;
12
- clearable: boolean;
13
- disabled: boolean;
14
- readonly: boolean;
15
- rules?: FormItemRule;
14
+ label?: string;
15
+ clearable?: boolean;
16
+ disabled?: boolean;
17
+ required?: boolean;
18
+ readonly?: boolean;
19
+ dictId?: string | number;
20
+ rules?: FormItemRule | null;
16
21
  children?: Array<FormItem>;
17
- constructor();
22
+ initValue?: InitValue;
23
+ [key: string]: unknown;
24
+ constructor(data: Record<string, unknown>);
18
25
  }
19
26
 
20
27
  export declare class Block extends Base {
21
28
  children: Array<FormItem>;
22
- constructor();
29
+ initValue?: InitValue;
30
+ constructor(data: Record<string, unknown>);
23
31
  }
24
32
 
33
+ export declare interface DictItem {
34
+ id: string;
35
+ value: string | number | boolean | object;
36
+ label: string | number | boolean;
37
+ disabled?: boolean;
38
+ children?: Array<DictItem>;
39
+ }
40
+
41
+ export declare const EditForm: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
42
+ formRef: CreateComponentPublicInstanceWithMixins<Readonly<Props> & Readonly<{
43
+ onChange?: ((...args: any[]) => any) | undefined;
44
+ onRemove?: ((...args: any[]) => any) | undefined;
45
+ }>, {
46
+ submit: () => Promise<FormModel>;
47
+ reset: () => void;
48
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
49
+ change: (...args: any[]) => void;
50
+ remove: (...args: any[]) => void;
51
+ }, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
52
+ P: {};
53
+ B: {};
54
+ D: {};
55
+ C: {};
56
+ M: {};
57
+ Defaults: {};
58
+ }, Readonly<Props> & Readonly<{
59
+ onChange?: ((...args: any[]) => any) | undefined;
60
+ onRemove?: ((...args: any[]) => any) | undefined;
61
+ }>, {
62
+ submit: () => Promise<FormModel>;
63
+ reset: () => void;
64
+ }, {}, {}, {}, {}> | null;
65
+ }, HTMLDivElement>;
66
+
25
67
  export declare const FjForm: DefineComponent<Props, {
26
68
  submit: () => Promise<FormModel>;
27
- }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
69
+ reset: () => void;
70
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
71
+ change: (...args: any[]) => void;
72
+ remove: (...args: any[]) => void;
73
+ }, string, PublicProps, Readonly<Props> & Readonly<{
74
+ onChange?: ((...args: any[]) => any) | undefined;
75
+ onRemove?: ((...args: any[]) => any) | undefined;
76
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
28
77
 
29
78
  export declare interface FjFormInstance {
30
79
  submit: () => Promise<FormModel>;
80
+ reset: () => void;
31
81
  }
32
82
 
33
83
  export declare class Form extends Base {
34
84
  config: Array<FormItem>;
35
- constructor();
85
+ constructor(data: Record<string, unknown>);
36
86
  }
37
87
 
38
88
  export declare class FormDateTime extends Base {
39
- formType: string;
89
+ formType: FormItemType;
40
90
  type?: 'year' | 'years' | 'month' | 'months' | 'date' | 'dates' | 'datetime' | 'week' | 'datetimerange' | 'daterange' | 'monthrange' | 'yearrange';
41
91
  defaultValue?: Date | [Date, Date];
42
92
  defaultTime?: Date | [Date, Date];
43
93
  valueFormat?: string;
44
94
  dateFormat?: string;
45
95
  timeFormat?: string;
46
- constructor();
96
+ initValue?: InitValue;
97
+ constructor(data: Record<string, unknown>);
47
98
  }
48
99
 
49
100
  export declare class FormInput extends Base {
50
- formType: string;
101
+ formType: FormItemType;
51
102
  maxlength?: number;
52
103
  minlength?: number;
53
104
  showWordLimit?: boolean;
54
105
  placeholder?: string;
55
106
  type?: 'text' | 'textarea' | 'number' | 'password' | 'email' | 'search' | 'tel' | 'url';
56
- constructor();
107
+ initValue?: InitValue;
108
+ constructor(data: Record<string, unknown>);
57
109
  }
58
110
 
59
111
  export declare type FormItem = Block | FormInput | FormSelect | FormNumber | FormSwitch | FormDateTime | FormRadio;
60
112
 
61
113
  export declare interface FormItemRule {
62
- required: boolean;
63
- message: string;
64
- trigger: 'change' | 'blur';
114
+ required?: boolean;
115
+ message?: string;
116
+ trigger?: 'change' | 'blur';
65
117
  }
66
118
 
67
- export declare type FormItemType = 'block' | FormInput['formType'] | FormSelect['formType'] | FormNumber['formType'] | FormSwitch['formType'] | FormDateTime['formType'] | FormRadio['formType'];
119
+ export declare type FormItemType = 'block' | 'input' | 'select' | 'number' | 'switch' | 'date' | 'radio';
68
120
 
69
121
  export declare interface FormModel {
70
- [propName: string]: string | number | boolean | null | object | Array<string | number | boolean | null | object>;
122
+ [propName: string]: InitValue;
71
123
  }
72
124
 
73
125
  export declare class FormNumber extends Base {
74
- formType: string;
126
+ formType: FormItemType;
75
127
  min?: number;
76
128
  max?: number;
77
129
  step?: number;
78
130
  precision?: number;
79
131
  controls?: boolean;
80
- constructor();
132
+ placeholder?: string;
133
+ initValue?: InitValue;
134
+ constructor(data: Record<string, unknown>);
81
135
  }
82
136
 
83
137
  export declare interface FormOption {
@@ -88,41 +142,52 @@ export declare interface FormOption {
88
142
  }
89
143
 
90
144
  export declare class FormRadio extends Base {
91
- formType: string;
145
+ formType: FormItemType;
92
146
  options?: Array<FormOption>;
93
147
  border?: boolean;
94
148
  textColor?: string;
95
149
  fill?: string;
96
150
  type?: 'radio' | 'button';
97
- constructor();
151
+ initValue?: InitValue;
152
+ constructor(data: Record<string, unknown>);
98
153
  }
99
154
 
100
155
  export declare class FormSelect extends Base {
101
- formType: string;
156
+ formType: FormItemType;
102
157
  options?: Array<FormOption>;
103
158
  multiple?: boolean;
104
159
  multipleLimit?: number;
105
- constructor();
160
+ placeholder?: string;
161
+ initValue?: InitValue;
162
+ constructor(data: Record<string, unknown>);
106
163
  }
107
164
 
108
165
  export declare class FormSwitch extends Base {
109
- formType: string;
166
+ formType: FormItemType;
110
167
  loading?: boolean;
111
168
  width?: string | number;
112
169
  activeText?: string;
113
170
  inactiveText?: string;
114
- activeValue?: string;
115
- inactiveValue?: string;
116
- constructor();
171
+ activeValue?: string | number | boolean;
172
+ inactiveValue?: string | number | boolean;
173
+ initValue?: InitValue;
174
+ constructor(data: Record<string, unknown>);
117
175
  }
118
176
 
177
+ export declare type InitValue = string | number | boolean | object | null | Date | undefined | Array<string | number | boolean | object | null | Date>;
178
+
119
179
  declare function install(app: App): void;
120
180
  export default install;
121
181
  export { install }
122
182
 
123
- declare interface Props {
183
+ export declare interface Props {
124
184
  data: FormModel;
125
185
  config: Array<FormItem>;
186
+ draggable?: boolean;
187
+ dictList?: Array<DictItem>;
188
+ labelWidth?: string | number;
189
+ span?: number;
190
+ edit?: boolean;
126
191
  }
127
192
 
128
193
  export { }
@@ -131,5 +196,6 @@ export { }
131
196
  declare module 'vue' {
132
197
  interface GlobalComponents {
133
198
  FjForm: typeof FjForm;
199
+ EditForm: typeof EditForm;
134
200
  }
135
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fj-form",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -23,6 +23,7 @@
23
23
  "dependencies": {
24
24
  "@vueuse/core": "^14.1.0",
25
25
  "element-plus": "^2.13.1",
26
+ "lodash-es": "^4.17.23",
26
27
  "pinia": "^3.0.4",
27
28
  "vue": "^3.5.26",
28
29
  "vue-router": "^4.6.4"