fj-form 0.0.6 → 0.0.7

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,128 @@
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
+ rules?: FormItemRule | null;
16
20
  children?: Array<FormItem>;
17
- constructor();
21
+ initValue?: InitValue;
22
+ [key: string]: unknown;
23
+ constructor(data: Record<string, unknown>);
18
24
  }
19
25
 
20
26
  export declare class Block extends Base {
21
27
  children: Array<FormItem>;
22
- constructor();
28
+ initValue?: InitValue;
29
+ constructor(data: Record<string, unknown>);
23
30
  }
24
31
 
32
+ export declare const EditForm: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
33
+ formRef: CreateComponentPublicInstanceWithMixins<Readonly<Props> & Readonly<{
34
+ onChange?: ((...args: any[]) => any) | undefined;
35
+ onRemove?: ((...args: any[]) => any) | undefined;
36
+ }>, {
37
+ submit: () => Promise<FormModel>;
38
+ reset: () => void;
39
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
40
+ change: (...args: any[]) => void;
41
+ remove: (...args: any[]) => void;
42
+ }, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
43
+ P: {};
44
+ B: {};
45
+ D: {};
46
+ C: {};
47
+ M: {};
48
+ Defaults: {};
49
+ }, Readonly<Props> & Readonly<{
50
+ onChange?: ((...args: any[]) => any) | undefined;
51
+ onRemove?: ((...args: any[]) => any) | undefined;
52
+ }>, {
53
+ submit: () => Promise<FormModel>;
54
+ reset: () => void;
55
+ }, {}, {}, {}, {}> | null;
56
+ }, HTMLDivElement>;
57
+
25
58
  export declare const FjForm: DefineComponent<Props, {
26
59
  submit: () => Promise<FormModel>;
27
- }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
60
+ reset: () => void;
61
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
62
+ change: (...args: any[]) => void;
63
+ remove: (...args: any[]) => void;
64
+ }, string, PublicProps, Readonly<Props> & Readonly<{
65
+ onChange?: ((...args: any[]) => any) | undefined;
66
+ onRemove?: ((...args: any[]) => any) | undefined;
67
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
28
68
 
29
69
  export declare interface FjFormInstance {
30
70
  submit: () => Promise<FormModel>;
71
+ reset: () => void;
31
72
  }
32
73
 
33
74
  export declare class Form extends Base {
34
75
  config: Array<FormItem>;
35
- constructor();
76
+ constructor(data: Record<string, unknown>);
36
77
  }
37
78
 
38
79
  export declare class FormDateTime extends Base {
39
- formType: string;
80
+ formType: FormItemType;
40
81
  type?: 'year' | 'years' | 'month' | 'months' | 'date' | 'dates' | 'datetime' | 'week' | 'datetimerange' | 'daterange' | 'monthrange' | 'yearrange';
41
82
  defaultValue?: Date | [Date, Date];
42
83
  defaultTime?: Date | [Date, Date];
43
84
  valueFormat?: string;
44
85
  dateFormat?: string;
45
86
  timeFormat?: string;
46
- constructor();
87
+ initValue?: InitValue;
88
+ constructor(data: Record<string, unknown>);
47
89
  }
48
90
 
49
91
  export declare class FormInput extends Base {
50
- formType: string;
92
+ formType: FormItemType;
51
93
  maxlength?: number;
52
94
  minlength?: number;
53
95
  showWordLimit?: boolean;
54
96
  placeholder?: string;
55
97
  type?: 'text' | 'textarea' | 'number' | 'password' | 'email' | 'search' | 'tel' | 'url';
56
- constructor();
98
+ initValue?: InitValue;
99
+ constructor(data: Record<string, unknown>);
57
100
  }
58
101
 
59
102
  export declare type FormItem = Block | FormInput | FormSelect | FormNumber | FormSwitch | FormDateTime | FormRadio;
60
103
 
61
104
  export declare interface FormItemRule {
62
- required: boolean;
63
- message: string;
64
- trigger: 'change' | 'blur';
105
+ required?: boolean;
106
+ message?: string;
107
+ trigger?: 'change' | 'blur';
65
108
  }
66
109
 
67
- export declare type FormItemType = 'block' | FormInput['formType'] | FormSelect['formType'] | FormNumber['formType'] | FormSwitch['formType'] | FormDateTime['formType'] | FormRadio['formType'];
110
+ export declare type FormItemType = 'block' | 'input' | 'select' | 'number' | 'switch' | 'date' | 'radio';
68
111
 
69
112
  export declare interface FormModel {
70
- [propName: string]: string | number | boolean | null | object | Array<string | number | boolean | null | object>;
113
+ [propName: string]: InitValue;
71
114
  }
72
115
 
73
116
  export declare class FormNumber extends Base {
74
- formType: string;
117
+ formType: FormItemType;
75
118
  min?: number;
76
119
  max?: number;
77
120
  step?: number;
78
121
  precision?: number;
79
122
  controls?: boolean;
80
- constructor();
123
+ placeholder?: string;
124
+ initValue?: InitValue;
125
+ constructor(data: Record<string, unknown>);
81
126
  }
82
127
 
83
128
  export declare interface FormOption {
@@ -88,41 +133,49 @@ export declare interface FormOption {
88
133
  }
89
134
 
90
135
  export declare class FormRadio extends Base {
91
- formType: string;
136
+ formType: FormItemType;
92
137
  options?: Array<FormOption>;
93
138
  border?: boolean;
94
139
  textColor?: string;
95
140
  fill?: string;
96
141
  type?: 'radio' | 'button';
97
- constructor();
142
+ initValue?: InitValue;
143
+ constructor(data: Record<string, unknown>);
98
144
  }
99
145
 
100
146
  export declare class FormSelect extends Base {
101
- formType: string;
147
+ formType: FormItemType;
102
148
  options?: Array<FormOption>;
103
149
  multiple?: boolean;
104
150
  multipleLimit?: number;
105
- constructor();
151
+ placeholder?: string;
152
+ initValue?: InitValue;
153
+ constructor(data: Record<string, unknown>);
106
154
  }
107
155
 
108
156
  export declare class FormSwitch extends Base {
109
- formType: string;
157
+ formType: FormItemType;
110
158
  loading?: boolean;
111
159
  width?: string | number;
112
160
  activeText?: string;
113
161
  inactiveText?: string;
114
- activeValue?: string;
115
- inactiveValue?: string;
116
- constructor();
162
+ activeValue?: string | number | boolean;
163
+ inactiveValue?: string | number | boolean;
164
+ initValue?: InitValue;
165
+ constructor(data: Record<string, unknown>);
117
166
  }
118
167
 
168
+ export declare type InitValue = string | number | boolean | object | null | Date | undefined | Array<string | number | boolean | object | null | Date>;
169
+
119
170
  declare function install(app: App): void;
120
171
  export default install;
121
172
  export { install }
122
173
 
123
- declare interface Props {
174
+ export declare interface Props {
124
175
  data: FormModel;
125
176
  config: Array<FormItem>;
177
+ draggable?: boolean;
178
+ edit?: boolean;
126
179
  }
127
180
 
128
181
  export { }
@@ -131,5 +184,6 @@ export { }
131
184
  declare module 'vue' {
132
185
  interface GlobalComponents {
133
186
  FjForm: typeof FjForm;
187
+ EditForm: typeof EditForm;
134
188
  }
135
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fj-form",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
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"