@stonecrop/aform 0.3.4 → 0.3.6
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/aform.d.ts +108 -28
- package/dist/aform.js +423 -419
- package/dist/aform.js.map +1 -1
- package/dist/aform.umd.cjs +2 -2
- package/dist/aform.umd.cjs.map +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/directives/mask.js +33 -0
- package/dist/index.js +0 -4
- package/dist/src/directives/mask.d.ts +7 -0
- package/dist/src/directives/mask.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +144 -28
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/form/ACheckbox.vue +8 -1
- package/src/components/form/ADate.vue +1 -0
- package/src/components/form/ADatePicker.vue +2 -0
- package/src/components/form/AFieldset.vue +2 -0
- package/src/components/form/ANumericInput.vue +8 -1
- package/src/components/form/ATextInput.vue +9 -1
- package/src/directives/mask.ts +34 -1
- package/src/index.ts +2 -6
- package/src/types/index.ts +163 -28
package/src/types/index.ts
CHANGED
|
@@ -5,60 +5,195 @@ import type { TableColumn, TableConfig, TableRow } from '@stonecrop/atable'
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export type ComponentProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The schema object to pass to the component
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
schema?: SchemaTypes
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The label to display in the component
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
8
18
|
label?: string
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The masking string to apply to inputs inside the component
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
9
24
|
mask?: string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Indicate whether input is required for text and/or select elements inside the component
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
10
30
|
required?: boolean
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Indicate whether elements inside the component are read-only
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
11
36
|
readonly?: boolean
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Set a unique identifier for elements inside the component
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
12
42
|
uuid?: string
|
|
13
|
-
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Validation options for elements inside the component
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
validation?: {
|
|
49
|
+
/**
|
|
50
|
+
* The error message to display when validation fails
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
errorMessage: string
|
|
54
|
+
|
|
55
|
+
[key: string]: any
|
|
56
|
+
}
|
|
14
57
|
}
|
|
15
58
|
|
|
16
59
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
60
|
+
* Basic field structure for AForm schemas
|
|
61
|
+
* @public
|
|
19
62
|
*/
|
|
20
|
-
export type
|
|
21
|
-
|
|
63
|
+
export type BaseSchema = {
|
|
64
|
+
/**
|
|
65
|
+
* The fieldname for the schema field
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
22
68
|
fieldname: string
|
|
23
|
-
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The component to render
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This must be a string that represents the component to render. The registration of the component
|
|
75
|
+
* should be done in the main application.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
component?: string
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A placeholder value for the field
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
value?: any
|
|
24
86
|
}
|
|
25
87
|
|
|
26
88
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
89
|
+
* Schema structure for defining forms inside AForm
|
|
90
|
+
* @public
|
|
29
91
|
*/
|
|
30
|
-
export type FormSchema =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
92
|
+
export type FormSchema = BaseSchema & {
|
|
93
|
+
/**
|
|
94
|
+
* Align the field in the form
|
|
95
|
+
* @beta
|
|
96
|
+
*/
|
|
97
|
+
align?: string
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Indicate whether the field is editable
|
|
101
|
+
* @beta
|
|
102
|
+
*/
|
|
103
|
+
edit?: boolean
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The field type for the schema field
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* This must be a string that represents the field type. A mask string will be automatically
|
|
110
|
+
* applied for the following field types:
|
|
111
|
+
* - Date ('##/##/####')
|
|
112
|
+
* - Datetime ('####/##/## ##:##')
|
|
113
|
+
* - Time ('##:##')
|
|
114
|
+
* - Fulltime ('##:##:##')
|
|
115
|
+
* - Phone ('(###) ### - ####')
|
|
116
|
+
* - Card ('#### #### #### ####')
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
fieldtype?: string
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The label to display in the form
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
label?: string
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The unique identifier for the field
|
|
130
|
+
* @beta
|
|
131
|
+
*/
|
|
132
|
+
name?: string
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The width of the field element.
|
|
136
|
+
* @beta
|
|
137
|
+
*/
|
|
138
|
+
width?: string
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The mask string for the field
|
|
142
|
+
* @beta
|
|
143
|
+
*/
|
|
37
144
|
mask?: string
|
|
38
145
|
}
|
|
39
146
|
|
|
40
147
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
148
|
+
* Schema structure for defining tables inside AForm
|
|
149
|
+
* @public
|
|
43
150
|
*/
|
|
44
|
-
export type TableSchema =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
151
|
+
export type TableSchema = BaseSchema & {
|
|
152
|
+
/**
|
|
153
|
+
* The columns to display in the table
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
columns?: TableColumn[]
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The configuration for the table
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
config?: TableConfig
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The rows to display in the table
|
|
166
|
+
* @public
|
|
167
|
+
*/
|
|
168
|
+
rows?: TableRow[]
|
|
48
169
|
}
|
|
49
170
|
|
|
50
171
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
172
|
+
* Schema structure for defining fieldsets inside AForm
|
|
173
|
+
* @public
|
|
53
174
|
*/
|
|
54
|
-
export type FieldsetSchema =
|
|
55
|
-
|
|
56
|
-
|
|
175
|
+
export type FieldsetSchema = BaseSchema & {
|
|
176
|
+
/**
|
|
177
|
+
* The label to display in the fieldset
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
label?: string
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The schemas to be rendered inside the fieldset
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
186
|
+
schema?: (FormSchema | TableSchema)[]
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Indicate whether the fieldset is collapsible
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
57
192
|
collapsible?: boolean
|
|
58
193
|
}
|
|
59
194
|
|
|
60
195
|
/**
|
|
61
|
-
* Superset of schema types
|
|
62
|
-
* @
|
|
196
|
+
* Superset of all schema types for AForm
|
|
197
|
+
* @public
|
|
63
198
|
*/
|
|
64
199
|
export type SchemaTypes = FormSchema | TableSchema | FieldsetSchema
|