@longhongguo/form-create-ant-design-vue 3.2.36
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/LICENSE +21 -0
- package/README.md +137 -0
- package/auto-import.d.ts +5 -0
- package/auto-import.js +54 -0
- package/dist/form-create.esm.js +8 -0
- package/dist/form-create.esm.js.map +1 -0
- package/dist/form-create.js +8 -0
- package/dist/form-create.js.map +1 -0
- package/package.json +94 -0
- package/src/components/icon/QuestionCircleOutlined.vue +18 -0
- package/src/components/index.js +7 -0
- package/src/core/alias.js +37 -0
- package/src/core/api.js +150 -0
- package/src/core/config.js +39 -0
- package/src/core/index.js +53 -0
- package/src/core/maker.js +90 -0
- package/src/core/manager.js +303 -0
- package/src/core/modelFields.js +11 -0
- package/src/core/provider.js +55 -0
- package/src/index.js +13 -0
- package/src/parsers/cascader.js +35 -0
- package/src/parsers/checkbox.js +12 -0
- package/src/parsers/datePicker.js +44 -0
- package/src/parsers/hidden.js +13 -0
- package/src/parsers/index.js +27 -0
- package/src/parsers/input.js +30 -0
- package/src/parsers/radio.js +5 -0
- package/src/parsers/rangePicker.js +12 -0
- package/src/parsers/row.js +10 -0
- package/src/parsers/select.js +37 -0
- package/src/parsers/timePicker.js +15 -0
- package/src/parsers/timeRangePicker.js +11 -0
- package/src/parsers/tree.js +16 -0
- package/src/style/index.css +23 -0
- package/types/config.d.ts +152 -0
- package/types/index.d.ts +36 -0
- package/types/maker.d.ts +70 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { FormData, VNodeRule } from '@longhongguo/form-create-core'
|
|
2
|
+
import { ColProps, RowProps, TooltipProps, ButtonProps } from 'ant-design-vue'
|
|
3
|
+
import { Api } from './index'
|
|
4
|
+
import { ComponentInternalInstance } from '@vue/runtime-core'
|
|
5
|
+
|
|
6
|
+
export interface OptionAttrs {
|
|
7
|
+
col?:
|
|
8
|
+
| Boolean
|
|
9
|
+
| Partial<
|
|
10
|
+
ColProps & {
|
|
11
|
+
labelWidth?: number | string
|
|
12
|
+
show?: Boolean
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
row?:
|
|
16
|
+
| Boolean
|
|
17
|
+
| Partial<
|
|
18
|
+
RowProps & {
|
|
19
|
+
show?: Boolean
|
|
20
|
+
}
|
|
21
|
+
>
|
|
22
|
+
info?:
|
|
23
|
+
| Boolean
|
|
24
|
+
| Partial<
|
|
25
|
+
(TooltipProps | Object) &
|
|
26
|
+
VNodeRule & {
|
|
27
|
+
show?: Boolean
|
|
28
|
+
native?: Boolean
|
|
29
|
+
icon?: string
|
|
30
|
+
align?: 'left' | 'right'
|
|
31
|
+
info?: string
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
wrap?:
|
|
35
|
+
| Boolean
|
|
36
|
+
| Partial<
|
|
37
|
+
VNodeRule & {
|
|
38
|
+
colon?: boolean
|
|
39
|
+
extra?: any
|
|
40
|
+
hasFeedback?: boolean
|
|
41
|
+
help?: any
|
|
42
|
+
label?: any
|
|
43
|
+
labelCol?: ColProps
|
|
44
|
+
required?: boolean
|
|
45
|
+
validateStatus?: '' | 'success' | 'warning' | 'error' | 'validating'
|
|
46
|
+
wrapperCol?: ColProps
|
|
47
|
+
labelAlign?: 'left' | 'right'
|
|
48
|
+
autoLink?: boolean
|
|
49
|
+
show?: Boolean
|
|
50
|
+
}
|
|
51
|
+
>
|
|
52
|
+
form?: Partial<{
|
|
53
|
+
hideRequiredMark?: boolean
|
|
54
|
+
labelCol?: ColProps
|
|
55
|
+
layout?: 'horizontal' | 'inline' | 'vertical'
|
|
56
|
+
wrapperCol?: ColProps
|
|
57
|
+
colon?: boolean
|
|
58
|
+
labelAlign?: 'left' | 'right'
|
|
59
|
+
validateMessages?: any
|
|
60
|
+
validateOnRuleChange?: boolean
|
|
61
|
+
className?: any
|
|
62
|
+
col?: Boolean
|
|
63
|
+
}>
|
|
64
|
+
|
|
65
|
+
submitBtn?:
|
|
66
|
+
| Boolean
|
|
67
|
+
| Partial<
|
|
68
|
+
ButtonProps & {
|
|
69
|
+
click?: Function
|
|
70
|
+
innerText?: string
|
|
71
|
+
show?: Boolean
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
|
|
75
|
+
resetBtn?:
|
|
76
|
+
| Boolean
|
|
77
|
+
| Partial<
|
|
78
|
+
ButtonProps & {
|
|
79
|
+
click?: Function
|
|
80
|
+
innerText?: string
|
|
81
|
+
show?: Boolean
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare const optionAttrs: Partial<
|
|
87
|
+
OptionAttrs & {
|
|
88
|
+
title?:
|
|
89
|
+
| Boolean
|
|
90
|
+
| Partial<
|
|
91
|
+
VNodeRule & {
|
|
92
|
+
show?: Boolean
|
|
93
|
+
native?: Boolean
|
|
94
|
+
title?: string
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
|
|
100
|
+
export interface CreatorAttrs {
|
|
101
|
+
col(props: typeof optionAttrs.col): this
|
|
102
|
+
|
|
103
|
+
wrap(props: typeof optionAttrs.wrap): this
|
|
104
|
+
|
|
105
|
+
title(props: string | typeof optionAttrs.title): this
|
|
106
|
+
|
|
107
|
+
info(props: string | typeof optionAttrs.info): this
|
|
108
|
+
|
|
109
|
+
className(prop: string): this
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface RuleAttrs {
|
|
113
|
+
col?: typeof optionAttrs.col
|
|
114
|
+
wrap?: typeof optionAttrs.wrap
|
|
115
|
+
title?: string | typeof optionAttrs.title
|
|
116
|
+
info?: string | typeof optionAttrs.info
|
|
117
|
+
className?: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ApiAttrs {
|
|
121
|
+
btn: {
|
|
122
|
+
loading(loading: boolean): void
|
|
123
|
+
disabled(disabled: boolean): void
|
|
124
|
+
show(show: boolean): void
|
|
125
|
+
}
|
|
126
|
+
resetBtn: {
|
|
127
|
+
loading(loading: boolean): void
|
|
128
|
+
disabled(disabled: boolean): void
|
|
129
|
+
show(show: boolean): void
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
formEl(): undefined | ComponentInternalInstance
|
|
133
|
+
|
|
134
|
+
wrapEl(id: string): undefined | ComponentInternalInstance
|
|
135
|
+
|
|
136
|
+
submit(
|
|
137
|
+
success: (formData: FormData, $f: Api) => void,
|
|
138
|
+
fail: ($f: Api) => void
|
|
139
|
+
): Promise<any>
|
|
140
|
+
|
|
141
|
+
clearValidateState(fields?: string | string[], clearSub?: Boolean): void
|
|
142
|
+
|
|
143
|
+
clearSubValidateState(fields?: string | string[]): void
|
|
144
|
+
|
|
145
|
+
validate(callback?: (state: any) => void): Promise<any>
|
|
146
|
+
|
|
147
|
+
validateField(field: string, callback?: (state: any) => void): Promise<any>
|
|
148
|
+
|
|
149
|
+
submitBtnProps(props: ButtonProps): void
|
|
150
|
+
|
|
151
|
+
resetBtnProps(props: ButtonProps): void
|
|
152
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormCreate,
|
|
3
|
+
FormCreateProps as $FormCreateProps,
|
|
4
|
+
FormRule as $FormRule,
|
|
5
|
+
Options as $Options,
|
|
6
|
+
Rule as $Rule,
|
|
7
|
+
Creator as $Creator,
|
|
8
|
+
Control as $Control,
|
|
9
|
+
Api as $Api,
|
|
10
|
+
Effect as $Effect,
|
|
11
|
+
Parser as $Parser
|
|
12
|
+
} from '@longhongguo/form-create-core'
|
|
13
|
+
import Maker from './maker'
|
|
14
|
+
import { ApiAttrs, CreatorAttrs, OptionAttrs, RuleAttrs } from './config'
|
|
15
|
+
import { ExtractPropTypes } from 'vue'
|
|
16
|
+
|
|
17
|
+
declare const formCreate: FormCreate<
|
|
18
|
+
Maker,
|
|
19
|
+
OptionAttrs,
|
|
20
|
+
CreatorAttrs,
|
|
21
|
+
RuleAttrs,
|
|
22
|
+
ApiAttrs
|
|
23
|
+
>
|
|
24
|
+
export default formCreate
|
|
25
|
+
export declare const maker: typeof formCreate.maker
|
|
26
|
+
export type FormRule = $FormRule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
27
|
+
export type Options = $Options<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
28
|
+
export type Rule = $Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
29
|
+
export type Effect = $Effect<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
30
|
+
export type Creator = $Creator<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
31
|
+
export type Control = $Control<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
32
|
+
export type Api = $Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
33
|
+
export type FormCreateProps = ExtractPropTypes<
|
|
34
|
+
$FormCreateProps<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
35
|
+
>
|
|
36
|
+
export type Parser = $Parser
|
package/types/maker.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CreatorHelper } from '@longhongguo/form-create-core'
|
|
2
|
+
import { ApiAttrs, CreatorAttrs, OptionAttrs, RuleAttrs } from './config'
|
|
3
|
+
|
|
4
|
+
declare const makerFactory: CreatorHelper<
|
|
5
|
+
OptionAttrs,
|
|
6
|
+
CreatorAttrs,
|
|
7
|
+
RuleAttrs,
|
|
8
|
+
ApiAttrs
|
|
9
|
+
>
|
|
10
|
+
|
|
11
|
+
declare enum MakerName {
|
|
12
|
+
'treeSelect',
|
|
13
|
+
'checkbox',
|
|
14
|
+
'datePicker',
|
|
15
|
+
'dateRange',
|
|
16
|
+
'datetimeRange',
|
|
17
|
+
'date',
|
|
18
|
+
'month',
|
|
19
|
+
'week',
|
|
20
|
+
'hidden',
|
|
21
|
+
'input',
|
|
22
|
+
'idate',
|
|
23
|
+
'password',
|
|
24
|
+
'url',
|
|
25
|
+
'email',
|
|
26
|
+
'text',
|
|
27
|
+
'textarea',
|
|
28
|
+
'search',
|
|
29
|
+
'timePicker',
|
|
30
|
+
'tree',
|
|
31
|
+
'radio',
|
|
32
|
+
'select',
|
|
33
|
+
'upload',
|
|
34
|
+
'frame',
|
|
35
|
+
'autoComplete',
|
|
36
|
+
'cascader',
|
|
37
|
+
'inputNumber',
|
|
38
|
+
'inputPassword',
|
|
39
|
+
'rate',
|
|
40
|
+
'switch',
|
|
41
|
+
'slider',
|
|
42
|
+
'auto',
|
|
43
|
+
'number',
|
|
44
|
+
'time',
|
|
45
|
+
'sliderRange',
|
|
46
|
+
'frameInputs',
|
|
47
|
+
'frameFiles',
|
|
48
|
+
'frameImages',
|
|
49
|
+
'frameInputOne',
|
|
50
|
+
'frameFileOne',
|
|
51
|
+
'frameImageOne',
|
|
52
|
+
'frameInput',
|
|
53
|
+
'frameFile',
|
|
54
|
+
'frameImage',
|
|
55
|
+
'image',
|
|
56
|
+
'file',
|
|
57
|
+
'uploadFileOne',
|
|
58
|
+
'uploadImageOne',
|
|
59
|
+
'uploadImage',
|
|
60
|
+
'uploadFile',
|
|
61
|
+
'selectMultiple',
|
|
62
|
+
'selectTags',
|
|
63
|
+
'selectCombobox'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type Maker = {
|
|
67
|
+
[name in keyof typeof MakerName]: typeof makerFactory
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default Maker
|