@cyberpunk-vue/components 1.2.0 → 1.4.0

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.
@@ -0,0 +1,200 @@
1
+ /**
2
+ * CpFormItem 表单项
3
+ *
4
+ * 包含标签、内容区和错误信息区域。支持验证规则和 Form 上下文继承。
5
+ *
6
+ * @example
7
+ * ```vue
8
+ * <CpFormItem label="用户名" prop="username" required>
9
+ * <CpInput v-model="formData.username" />
10
+ * </CpFormItem>
11
+ * ```
12
+ *
13
+ * @slot label - 自定义标签内容
14
+ * @slot default - 表单控件
15
+ * @slot error - 自定义错误信息展示
16
+ */
17
+ export declare const CpFormItem: import('../utils').SFCWithInstall<{
18
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
19
+ readonly label: {
20
+ readonly type: StringConstructor;
21
+ readonly default: "";
22
+ };
23
+ readonly prop: {
24
+ readonly type: StringConstructor;
25
+ readonly default: "";
26
+ };
27
+ readonly required: {
28
+ readonly type: BooleanConstructor;
29
+ readonly default: false;
30
+ };
31
+ readonly rules: {
32
+ readonly type: import('vue').PropType<import('..').FormRule | import('..').FormRule[]>;
33
+ readonly default: undefined;
34
+ };
35
+ readonly labelWidth: {
36
+ readonly type: import('vue').PropType<string | number>;
37
+ readonly default: undefined;
38
+ };
39
+ readonly showMessage: {
40
+ readonly type: BooleanConstructor;
41
+ readonly default: undefined;
42
+ };
43
+ readonly reserveErrorSpace: {
44
+ readonly type: BooleanConstructor;
45
+ readonly default: undefined;
46
+ };
47
+ readonly error: {
48
+ readonly type: StringConstructor;
49
+ readonly default: "";
50
+ };
51
+ readonly size: {
52
+ readonly type: import('vue').PropType<import('@cyberpunk-vue/hooks').Size>;
53
+ readonly default: undefined;
54
+ };
55
+ }>> & Readonly<{}>, {
56
+ validate: (trigger?: string) => Promise<boolean>;
57
+ resetField: () => void;
58
+ clearValidate: () => void;
59
+ validateState: import('vue').Ref<"" | "error" | "validating", "" | "error" | "validating">;
60
+ validateMessage: import('vue').Ref<string, string>;
61
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
62
+ readonly size: import('@cyberpunk-vue/hooks').Size;
63
+ readonly error: string;
64
+ readonly label: string;
65
+ readonly required: boolean;
66
+ readonly prop: string;
67
+ readonly rules: import('..').FormRule | import('..').FormRule[];
68
+ readonly labelWidth: string | number;
69
+ readonly showMessage: boolean;
70
+ readonly reserveErrorSpace: boolean;
71
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
72
+ P: {};
73
+ B: {};
74
+ D: {};
75
+ C: {};
76
+ M: {};
77
+ Defaults: {};
78
+ }, Readonly<import('vue').ExtractPropTypes<{
79
+ readonly label: {
80
+ readonly type: StringConstructor;
81
+ readonly default: "";
82
+ };
83
+ readonly prop: {
84
+ readonly type: StringConstructor;
85
+ readonly default: "";
86
+ };
87
+ readonly required: {
88
+ readonly type: BooleanConstructor;
89
+ readonly default: false;
90
+ };
91
+ readonly rules: {
92
+ readonly type: import('vue').PropType<import('..').FormRule | import('..').FormRule[]>;
93
+ readonly default: undefined;
94
+ };
95
+ readonly labelWidth: {
96
+ readonly type: import('vue').PropType<string | number>;
97
+ readonly default: undefined;
98
+ };
99
+ readonly showMessage: {
100
+ readonly type: BooleanConstructor;
101
+ readonly default: undefined;
102
+ };
103
+ readonly reserveErrorSpace: {
104
+ readonly type: BooleanConstructor;
105
+ readonly default: undefined;
106
+ };
107
+ readonly error: {
108
+ readonly type: StringConstructor;
109
+ readonly default: "";
110
+ };
111
+ readonly size: {
112
+ readonly type: import('vue').PropType<import('@cyberpunk-vue/hooks').Size>;
113
+ readonly default: undefined;
114
+ };
115
+ }>> & Readonly<{}>, {
116
+ validate: (trigger?: string) => Promise<boolean>;
117
+ resetField: () => void;
118
+ clearValidate: () => void;
119
+ validateState: import('vue').Ref<"" | "error" | "validating", "" | "error" | "validating">;
120
+ validateMessage: import('vue').Ref<string, string>;
121
+ }, {}, {}, {}, {
122
+ readonly size: import('@cyberpunk-vue/hooks').Size;
123
+ readonly error: string;
124
+ readonly label: string;
125
+ readonly required: boolean;
126
+ readonly prop: string;
127
+ readonly rules: import('..').FormRule | import('..').FormRule[];
128
+ readonly labelWidth: string | number;
129
+ readonly showMessage: boolean;
130
+ readonly reserveErrorSpace: boolean;
131
+ }>;
132
+ __isFragment?: never;
133
+ __isTeleport?: never;
134
+ __isSuspense?: never;
135
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
136
+ readonly label: {
137
+ readonly type: StringConstructor;
138
+ readonly default: "";
139
+ };
140
+ readonly prop: {
141
+ readonly type: StringConstructor;
142
+ readonly default: "";
143
+ };
144
+ readonly required: {
145
+ readonly type: BooleanConstructor;
146
+ readonly default: false;
147
+ };
148
+ readonly rules: {
149
+ readonly type: import('vue').PropType<import('..').FormRule | import('..').FormRule[]>;
150
+ readonly default: undefined;
151
+ };
152
+ readonly labelWidth: {
153
+ readonly type: import('vue').PropType<string | number>;
154
+ readonly default: undefined;
155
+ };
156
+ readonly showMessage: {
157
+ readonly type: BooleanConstructor;
158
+ readonly default: undefined;
159
+ };
160
+ readonly reserveErrorSpace: {
161
+ readonly type: BooleanConstructor;
162
+ readonly default: undefined;
163
+ };
164
+ readonly error: {
165
+ readonly type: StringConstructor;
166
+ readonly default: "";
167
+ };
168
+ readonly size: {
169
+ readonly type: import('vue').PropType<import('@cyberpunk-vue/hooks').Size>;
170
+ readonly default: undefined;
171
+ };
172
+ }>> & Readonly<{}>, {
173
+ validate: (trigger?: string) => Promise<boolean>;
174
+ resetField: () => void;
175
+ clearValidate: () => void;
176
+ validateState: import('vue').Ref<"" | "error" | "validating", "" | "error" | "validating">;
177
+ validateMessage: import('vue').Ref<string, string>;
178
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
179
+ readonly size: import('@cyberpunk-vue/hooks').Size;
180
+ readonly error: string;
181
+ readonly label: string;
182
+ readonly required: boolean;
183
+ readonly prop: string;
184
+ readonly rules: import('..').FormRule | import('..').FormRule[];
185
+ readonly labelWidth: string | number;
186
+ readonly showMessage: boolean;
187
+ readonly reserveErrorSpace: boolean;
188
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
189
+ $slots: {
190
+ label?(_: {}): any;
191
+ default?(_: {}): any;
192
+ error?(_: {
193
+ error: string;
194
+ }): any;
195
+ };
196
+ })>;
197
+ export default CpFormItem;
198
+ export * from './src/form-item';
199
+ export type { FormItemInstance } from './src/instance';
200
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../form-item/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwB,CAAA;AAC/C,eAAe,UAAU,CAAA;AAEzB,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,75 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ import { Size } from '@cyberpunk-vue/hooks';
3
+ import { FormRule } from '../../form/src/form';
4
+ /**
5
+ * CpFormItem Props
6
+ */
7
+ export declare const formItemProps: {
8
+ /** 标签文本 */
9
+ readonly label: {
10
+ readonly type: StringConstructor;
11
+ readonly default: "";
12
+ };
13
+ /**
14
+ * 对应 Form model 中的字段名
15
+ * 用于验证和重置
16
+ */
17
+ readonly prop: {
18
+ readonly type: StringConstructor;
19
+ readonly default: "";
20
+ };
21
+ /**
22
+ * 是否必填(显示星号标记)
23
+ * @default false
24
+ */
25
+ readonly required: {
26
+ readonly type: BooleanConstructor;
27
+ readonly default: false;
28
+ };
29
+ /**
30
+ * 单项验证规则(覆盖 Form 级规则)
31
+ */
32
+ readonly rules: {
33
+ readonly type: PropType<FormRule | FormRule[]>;
34
+ readonly default: undefined;
35
+ };
36
+ /**
37
+ * 覆盖 Form 的 labelWidth
38
+ */
39
+ readonly labelWidth: {
40
+ readonly type: PropType<string | number>;
41
+ readonly default: undefined;
42
+ };
43
+ /**
44
+ * 独立控制是否显示错误信息
45
+ * 不传时继承 Form 设置
46
+ */
47
+ readonly showMessage: {
48
+ readonly type: BooleanConstructor;
49
+ readonly default: undefined;
50
+ };
51
+ /**
52
+ * 独立控制是否预留错误信息占位高度
53
+ * 不传时继承 Form 设置
54
+ */
55
+ readonly reserveErrorSpace: {
56
+ readonly type: BooleanConstructor;
57
+ readonly default: undefined;
58
+ };
59
+ /**
60
+ * 手动设置错误信息
61
+ */
62
+ readonly error: {
63
+ readonly type: StringConstructor;
64
+ readonly default: "";
65
+ };
66
+ /**
67
+ * 覆盖 Form 的 size
68
+ */
69
+ readonly size: {
70
+ readonly type: PropType<Size>;
71
+ readonly default: undefined;
72
+ };
73
+ };
74
+ export type FormItemProps = ExtractPropTypes<typeof formItemProps>;
75
+ //# sourceMappingURL=form-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-item.d.ts","sourceRoot":"","sources":["../../../form-item/src/form-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB,WAAW;;;;;IAKX;;;OAGG;;;;;IAKH;;;OAGG;;;;;IAKH;;OAEG;;uBAEwB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,EAAE,CAAC;;;IAG1D;;OAEG;;uBAEyB,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;;;IAGrD;;;OAGG;;;;;IAKH;;;OAGG;;;;;IAKH;;OAEG;;;;;IAKH;;OAEG;;uBAEyB,QAAQ,CAAC,IAAI,CAAC;;;CAGlC,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,aAAa,CAAC,CAAA"}
@@ -0,0 +1,118 @@
1
+ import { FormRule } from '../../form/src/form';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ label?(_: {}): any;
6
+ default?(_: {}): any;
7
+ error?(_: {
8
+ error: string;
9
+ }): any;
10
+ };
11
+ refs: {};
12
+ rootEl: HTMLDivElement;
13
+ };
14
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
16
+ readonly label: {
17
+ readonly type: StringConstructor;
18
+ readonly default: "";
19
+ };
20
+ readonly prop: {
21
+ readonly type: StringConstructor;
22
+ readonly default: "";
23
+ };
24
+ readonly required: {
25
+ readonly type: BooleanConstructor;
26
+ readonly default: false;
27
+ };
28
+ readonly rules: {
29
+ readonly type: import('vue').PropType<FormRule | FormRule[]>;
30
+ readonly default: undefined;
31
+ };
32
+ readonly labelWidth: {
33
+ readonly type: import('vue').PropType<string | number>;
34
+ readonly default: undefined;
35
+ };
36
+ readonly showMessage: {
37
+ readonly type: BooleanConstructor;
38
+ readonly default: undefined;
39
+ };
40
+ readonly reserveErrorSpace: {
41
+ readonly type: BooleanConstructor;
42
+ readonly default: undefined;
43
+ };
44
+ readonly error: {
45
+ readonly type: StringConstructor;
46
+ readonly default: "";
47
+ };
48
+ readonly size: {
49
+ readonly type: import('vue').PropType<import('@cyberpunk-vue/hooks').Size>;
50
+ readonly default: undefined;
51
+ };
52
+ }>, {
53
+ /** @description 验证该表单项 */
54
+ validate: (trigger?: string) => Promise<boolean>;
55
+ /** @description 重置该表单项 */
56
+ resetField: () => void;
57
+ /** @description 清除验证状态 */
58
+ clearValidate: () => void;
59
+ /** @description 当前验证状态 */
60
+ validateState: import('vue').Ref<"" | "error" | "validating", "" | "error" | "validating">;
61
+ /** @description 当前验证信息 */
62
+ validateMessage: import('vue').Ref<string, string>;
63
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
64
+ readonly label: {
65
+ readonly type: StringConstructor;
66
+ readonly default: "";
67
+ };
68
+ readonly prop: {
69
+ readonly type: StringConstructor;
70
+ readonly default: "";
71
+ };
72
+ readonly required: {
73
+ readonly type: BooleanConstructor;
74
+ readonly default: false;
75
+ };
76
+ readonly rules: {
77
+ readonly type: import('vue').PropType<FormRule | FormRule[]>;
78
+ readonly default: undefined;
79
+ };
80
+ readonly labelWidth: {
81
+ readonly type: import('vue').PropType<string | number>;
82
+ readonly default: undefined;
83
+ };
84
+ readonly showMessage: {
85
+ readonly type: BooleanConstructor;
86
+ readonly default: undefined;
87
+ };
88
+ readonly reserveErrorSpace: {
89
+ readonly type: BooleanConstructor;
90
+ readonly default: undefined;
91
+ };
92
+ readonly error: {
93
+ readonly type: StringConstructor;
94
+ readonly default: "";
95
+ };
96
+ readonly size: {
97
+ readonly type: import('vue').PropType<import('@cyberpunk-vue/hooks').Size>;
98
+ readonly default: undefined;
99
+ };
100
+ }>> & Readonly<{}>, {
101
+ readonly size: import('@cyberpunk-vue/hooks').Size;
102
+ readonly error: string;
103
+ readonly label: string;
104
+ readonly required: boolean;
105
+ readonly prop: string;
106
+ readonly rules: FormRule | FormRule[];
107
+ readonly labelWidth: string | number;
108
+ readonly showMessage: boolean;
109
+ readonly reserveErrorSpace: boolean;
110
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
111
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
112
+ export default _default;
113
+ type __VLS_WithTemplateSlots<T, S> = T & {
114
+ new (): {
115
+ $slots: S;
116
+ };
117
+ };
118
+ //# sourceMappingURL=form-item.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-item.vue.d.ts","sourceRoot":"","sources":["../../../form-item/src/form-item.vue"],"names":[],"mappings":"AA8SA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAuQnD,iBAAS,cAAc;WAoDT,OAAO,IAA6B;;uBAZvB,GAAG;yBACD,GAAG;;;YACL,GAAG;;;;EAe7B;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IApGnB,0BAA0B;yBAnIM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;IAqIzD,0BAA0B;;IAE1B,0BAA0B;;IAE1B,0BAA0B;;IAE1B,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uFAoG1B,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { default as FormItem } from './form-item.vue';
2
+ export type FormItemInstance = InstanceType<typeof FormItem> & unknown;
3
+ //# sourceMappingURL=instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../../form-item/src/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,QAAQ,CAAC,GAAG,OAAO,CAAA"}