@cjdevstudios/bumblevue-forms 1.0.0-beta.1
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.md +22 -0
- package/README.md +1 -0
- package/form/BaseForm.vue +42 -0
- package/form/Form.vue +54 -0
- package/form/index.d.ts +339 -0
- package/form/index.mjs +115 -0
- package/form/index.mjs.map +1 -0
- package/form/package.json +11 -0
- package/form/style/index.d.ts +17 -0
- package/form/style/index.mjs +12 -0
- package/form/style/index.mjs.map +1 -0
- package/form/style/package.json +6 -0
- package/formfield/BaseFormField.vue +54 -0
- package/formfield/FormField.vue +51 -0
- package/formfield/index.d.ts +224 -0
- package/formfield/index.mjs +122 -0
- package/formfield/index.mjs.map +1 -0
- package/formfield/package.json +11 -0
- package/formfield/style/index.d.ts +17 -0
- package/formfield/style/index.mjs +12 -0
- package/formfield/style/index.mjs.map +1 -0
- package/formfield/style/package.json +6 -0
- package/index.d.ts +11 -0
- package/index.mjs +9 -0
- package/index.mjs.map +1 -0
- package/package.json +50 -0
- package/resolvers/joi/index.d.ts +1 -0
- package/resolvers/joi/index.mjs +2 -0
- package/resolvers/joi/index.mjs.map +1 -0
- package/resolvers/joi/package.json +5 -0
- package/resolvers/superstruct/index.d.ts +1 -0
- package/resolvers/superstruct/index.mjs +2 -0
- package/resolvers/superstruct/index.mjs.map +1 -0
- package/resolvers/superstruct/package.json +5 -0
- package/resolvers/valibot/index.d.ts +1 -0
- package/resolvers/valibot/index.mjs +2 -0
- package/resolvers/valibot/index.mjs.map +1 -0
- package/resolvers/valibot/package.json +5 -0
- package/resolvers/yup/index.d.ts +1 -0
- package/resolvers/yup/index.mjs +2 -0
- package/resolvers/yup/index.mjs.map +1 -0
- package/resolvers/yup/package.json +5 -0
- package/resolvers/zod/index.d.ts +1 -0
- package/resolvers/zod/index.mjs +2 -0
- package/resolvers/zod/index.mjs.map +1 -0
- package/resolvers/zod/package.json +5 -0
- package/types.d.ts +9 -0
- package/useform/index.d.ts +73 -0
- package/useform/index.mjs +420 -0
- package/useform/index.mjs.map +1 -0
- package/useform/package.json +5 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import BaseComponent from '@primevue/core/basecomponent';
|
|
3
|
+
import FormFieldStyle from '@primevue/forms/formfield/style';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'BaseFormField',
|
|
7
|
+
extends: BaseComponent,
|
|
8
|
+
style: FormFieldStyle,
|
|
9
|
+
props: {
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: undefined
|
|
13
|
+
},
|
|
14
|
+
resolver: {
|
|
15
|
+
type: Function,
|
|
16
|
+
default: undefined
|
|
17
|
+
},
|
|
18
|
+
initialValue: {
|
|
19
|
+
type: null,
|
|
20
|
+
default: undefined
|
|
21
|
+
},
|
|
22
|
+
validateOnValueUpdate: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: undefined
|
|
25
|
+
},
|
|
26
|
+
validateOnBlur: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: undefined
|
|
29
|
+
},
|
|
30
|
+
validateOnMount: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: undefined
|
|
33
|
+
},
|
|
34
|
+
validateOnSubmit: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: undefined
|
|
37
|
+
},
|
|
38
|
+
as: {
|
|
39
|
+
type: [String, Object],
|
|
40
|
+
default: 'DIV'
|
|
41
|
+
},
|
|
42
|
+
asChild: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
provide() {
|
|
48
|
+
return {
|
|
49
|
+
$pcFormField: this,
|
|
50
|
+
$parentInstance: this
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component v-if="!asChild" :is="as" :class="cx('root')" v-bind="ptmi('root')">
|
|
3
|
+
<slot :props="field.props" v-bind="fieldAttrs"></slot>
|
|
4
|
+
</component>
|
|
5
|
+
<slot v-else :class="cx('root')" :props="field.props" v-bind="fieldAttrs"></slot>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import BaseFormField from './BaseFormField.vue';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'FormField',
|
|
13
|
+
extends: BaseFormField,
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
inject: {
|
|
16
|
+
$pcForm: {
|
|
17
|
+
default: undefined
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
watch: {
|
|
21
|
+
formControl: {
|
|
22
|
+
immediate: true,
|
|
23
|
+
handler(newValue) {
|
|
24
|
+
this.$pcForm?.register?.(this.name, newValue);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
formControl() {
|
|
30
|
+
return {
|
|
31
|
+
name: this.name,
|
|
32
|
+
resolver: this.resolver,
|
|
33
|
+
initialValue: this.initialValue,
|
|
34
|
+
validateOnValueUpdate: this.validateOnValueUpdate,
|
|
35
|
+
validateOnBlur: this.validateOnBlur,
|
|
36
|
+
validateOnMount: this.validateOnMount,
|
|
37
|
+
validateOnSubmit: this.validateOnSubmit
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
field() {
|
|
41
|
+
return this.$pcForm?.fields?.[this.name] || {};
|
|
42
|
+
},
|
|
43
|
+
fieldAttrs() {
|
|
44
|
+
return {
|
|
45
|
+
...this.field.props,
|
|
46
|
+
...this.field.states
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* FormField is a helper component that provides validation and tracking for form fields.
|
|
4
|
+
*
|
|
5
|
+
* [Live Demo](https://www.primevue.org/forms/)
|
|
6
|
+
*
|
|
7
|
+
* @module formfield
|
|
8
|
+
*/
|
|
9
|
+
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
|
|
10
|
+
import type { ComponentHooks } from '@primevue/core/basecomponent';
|
|
11
|
+
import { Component, VNode } from 'vue';
|
|
12
|
+
import type { PassThroughOptions } from '../types';
|
|
13
|
+
|
|
14
|
+
export declare type FormFieldPassThroughOptionType = FormFieldPassThroughAttributes | ((options: FormFieldPassThroughMethodOptions) => FormFieldPassThroughAttributes | string) | string | null | undefined;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Custom passthrough(pt) option method.
|
|
18
|
+
*/
|
|
19
|
+
export interface FormFieldPassThroughMethodOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Defines instance.
|
|
22
|
+
*/
|
|
23
|
+
instance: any;
|
|
24
|
+
/**
|
|
25
|
+
* Defines valid properties.
|
|
26
|
+
*/
|
|
27
|
+
props: FormFieldProps;
|
|
28
|
+
/**
|
|
29
|
+
* Defines valid attributes.
|
|
30
|
+
*/
|
|
31
|
+
attrs: any;
|
|
32
|
+
/**
|
|
33
|
+
* Defines parent options.
|
|
34
|
+
*/
|
|
35
|
+
parent: any;
|
|
36
|
+
/**
|
|
37
|
+
* Defines passthrough(pt) options in global config.
|
|
38
|
+
*/
|
|
39
|
+
global: object | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Custom passthrough(pt) options.
|
|
44
|
+
* @see {@link FormFieldProps.pt}
|
|
45
|
+
*/
|
|
46
|
+
export interface FormFieldPassThroughOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Used to pass attributes to the root's DOM element.
|
|
49
|
+
*/
|
|
50
|
+
root?: FormFieldPassThroughOptionType;
|
|
51
|
+
/**
|
|
52
|
+
* Used to manage all lifecycle hooks.
|
|
53
|
+
* @see {@link BaseComponent.ComponentHooks}
|
|
54
|
+
*/
|
|
55
|
+
hooks?: ComponentHooks;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Custom passthrough attributes for each DOM elements
|
|
60
|
+
*/
|
|
61
|
+
export interface FormFieldPassThroughAttributes {
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Resolver options for FormField component.
|
|
67
|
+
*/
|
|
68
|
+
export interface FormFieldResolverOptions {
|
|
69
|
+
/**
|
|
70
|
+
* The value of the form field.
|
|
71
|
+
*/
|
|
72
|
+
value: any;
|
|
73
|
+
/**
|
|
74
|
+
* The name of the form field.
|
|
75
|
+
*/
|
|
76
|
+
name: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Defines valid properties in FormField component.
|
|
81
|
+
*/
|
|
82
|
+
export interface FormFieldProps {
|
|
83
|
+
/**
|
|
84
|
+
* The name of the form field.
|
|
85
|
+
*/
|
|
86
|
+
name?: string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* A function that resolves validation logic.
|
|
89
|
+
* @param {FormResolverOptions} e - Resolver options
|
|
90
|
+
*/
|
|
91
|
+
resolver?: (e: FormFieldResolverOptions) => any | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The initial value for the form field.
|
|
94
|
+
*/
|
|
95
|
+
initialValue?: any;
|
|
96
|
+
/**
|
|
97
|
+
* Whether to validate the form field when the value change.
|
|
98
|
+
*/
|
|
99
|
+
validateOnValueUpdate?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Whether to validate the form field when it loses focus (on blur).
|
|
102
|
+
*/
|
|
103
|
+
validateOnBlur?: boolean | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to validate the form field immediately after the form is mounted.
|
|
106
|
+
*/
|
|
107
|
+
validateOnMount?: boolean | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Whether to validate the form field when the form is submitted.
|
|
110
|
+
*/
|
|
111
|
+
validateOnSubmit?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Use to change the HTML tag of root element.
|
|
114
|
+
* @defaultValue DIV
|
|
115
|
+
*/
|
|
116
|
+
as?: string | Component | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* When enabled, it changes the default rendered element for the one passed as a child element.
|
|
119
|
+
* @defaultValue false
|
|
120
|
+
*/
|
|
121
|
+
asChild?: boolean | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* It generates scoped CSS variables using design tokens for the component.
|
|
124
|
+
*/
|
|
125
|
+
dt?: DesignToken<any>;
|
|
126
|
+
/**
|
|
127
|
+
* Used to pass attributes to DOM elements inside the component.
|
|
128
|
+
* @type {FormPassThroughOptions}
|
|
129
|
+
*/
|
|
130
|
+
pt?: PassThrough<FormFieldPassThroughOptions>;
|
|
131
|
+
/**
|
|
132
|
+
* Used to configure passthrough(pt) options of the component.
|
|
133
|
+
* @type {PassThroughOptions}
|
|
134
|
+
*/
|
|
135
|
+
ptOptions?: PassThroughOptions;
|
|
136
|
+
/**
|
|
137
|
+
* When enabled, it removes component related styles in the core.
|
|
138
|
+
* @defaultValue false
|
|
139
|
+
*/
|
|
140
|
+
unstyled?: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Defines valid slots in FormField component.
|
|
145
|
+
*/
|
|
146
|
+
export interface FormFieldSlots {
|
|
147
|
+
/**
|
|
148
|
+
* Default content slot.
|
|
149
|
+
* @param {Object} scope - default slot's params.
|
|
150
|
+
*/
|
|
151
|
+
default: (scope: {
|
|
152
|
+
/**
|
|
153
|
+
* @todo
|
|
154
|
+
*/
|
|
155
|
+
props: any;
|
|
156
|
+
/**
|
|
157
|
+
* The value of the form field.
|
|
158
|
+
*/
|
|
159
|
+
value: any;
|
|
160
|
+
/**
|
|
161
|
+
* Whether the form field has been touched.
|
|
162
|
+
* @defaultValue false
|
|
163
|
+
*/
|
|
164
|
+
touched: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the form field has been modified.
|
|
167
|
+
* @defaultValue false
|
|
168
|
+
*/
|
|
169
|
+
dirty: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the form field has not been modified.
|
|
172
|
+
* @defaultValue true
|
|
173
|
+
*/
|
|
174
|
+
pristine: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the form field is valid.
|
|
177
|
+
* @defaultValue true
|
|
178
|
+
*/
|
|
179
|
+
valid: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Whether the form field is invalid.
|
|
182
|
+
* @defaultValue false
|
|
183
|
+
*/
|
|
184
|
+
invalid: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* The first error message of the form field.
|
|
187
|
+
*/
|
|
188
|
+
error: any;
|
|
189
|
+
/**
|
|
190
|
+
* All error messages of the form field.
|
|
191
|
+
* @defaultValue []
|
|
192
|
+
*/
|
|
193
|
+
errors: any[];
|
|
194
|
+
}) => VNode[];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Defines valid emits in FormField component.
|
|
199
|
+
*/
|
|
200
|
+
export interface FormFieldEmitsOptions {}
|
|
201
|
+
|
|
202
|
+
export declare type FormFieldEmits = EmitFn<FormFieldEmitsOptions>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* **PrimeVue - FormField**
|
|
206
|
+
*
|
|
207
|
+
* _FormField is a helper component that provides validation and tracking for form fields._
|
|
208
|
+
*
|
|
209
|
+
* [Live Demo](https://www.primevue.org/forms/)
|
|
210
|
+
* --- ---
|
|
211
|
+
* 
|
|
212
|
+
*
|
|
213
|
+
* @group Component
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
declare const FormField: DefineComponent<FormFieldProps, FormFieldSlots, FormFieldEmits>;
|
|
217
|
+
|
|
218
|
+
declare module 'vue' {
|
|
219
|
+
export interface GlobalComponents {
|
|
220
|
+
FormField: DefineComponent<FormFieldProps, FormFieldSlots, FormFieldEmits>;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export default FormField;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import BaseComponent from '@primevue/core/basecomponent';
|
|
2
|
+
import FormFieldStyle from '@primevue/forms/formfield/style';
|
|
3
|
+
import { openBlock, createBlock, resolveDynamicComponent, mergeProps, withCtx, renderSlot } from 'vue';
|
|
4
|
+
|
|
5
|
+
var script$1 = {
|
|
6
|
+
name: 'BaseFormField',
|
|
7
|
+
"extends": BaseComponent,
|
|
8
|
+
style: FormFieldStyle,
|
|
9
|
+
props: {
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
"default": undefined
|
|
13
|
+
},
|
|
14
|
+
resolver: {
|
|
15
|
+
type: Function,
|
|
16
|
+
"default": undefined
|
|
17
|
+
},
|
|
18
|
+
initialValue: {
|
|
19
|
+
type: null,
|
|
20
|
+
"default": undefined
|
|
21
|
+
},
|
|
22
|
+
validateOnValueUpdate: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
"default": undefined
|
|
25
|
+
},
|
|
26
|
+
validateOnBlur: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
"default": undefined
|
|
29
|
+
},
|
|
30
|
+
validateOnMount: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
"default": undefined
|
|
33
|
+
},
|
|
34
|
+
validateOnSubmit: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
"default": undefined
|
|
37
|
+
},
|
|
38
|
+
as: {
|
|
39
|
+
type: [String, Object],
|
|
40
|
+
"default": 'DIV'
|
|
41
|
+
},
|
|
42
|
+
asChild: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
"default": false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
provide: function provide() {
|
|
48
|
+
return {
|
|
49
|
+
$pcFormField: this,
|
|
50
|
+
$parentInstance: this
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
56
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
57
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
58
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
59
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
60
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
61
|
+
var script = {
|
|
62
|
+
name: 'FormField',
|
|
63
|
+
"extends": script$1,
|
|
64
|
+
inheritAttrs: false,
|
|
65
|
+
inject: {
|
|
66
|
+
$pcForm: {
|
|
67
|
+
"default": undefined
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
watch: {
|
|
71
|
+
formControl: {
|
|
72
|
+
immediate: true,
|
|
73
|
+
handler: function handler(newValue) {
|
|
74
|
+
var _this$$pcForm, _this$$pcForm$registe;
|
|
75
|
+
(_this$$pcForm = this.$pcForm) === null || _this$$pcForm === void 0 || (_this$$pcForm$registe = _this$$pcForm.register) === null || _this$$pcForm$registe === void 0 || _this$$pcForm$registe.call(_this$$pcForm, this.name, newValue);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
formControl: function formControl() {
|
|
81
|
+
return {
|
|
82
|
+
name: this.name,
|
|
83
|
+
resolver: this.resolver,
|
|
84
|
+
initialValue: this.initialValue,
|
|
85
|
+
validateOnValueUpdate: this.validateOnValueUpdate,
|
|
86
|
+
validateOnBlur: this.validateOnBlur,
|
|
87
|
+
validateOnMount: this.validateOnMount,
|
|
88
|
+
validateOnSubmit: this.validateOnSubmit
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
field: function field() {
|
|
92
|
+
var _this$$pcForm2;
|
|
93
|
+
return ((_this$$pcForm2 = this.$pcForm) === null || _this$$pcForm2 === void 0 || (_this$$pcForm2 = _this$$pcForm2.fields) === null || _this$$pcForm2 === void 0 ? void 0 : _this$$pcForm2[this.name]) || {};
|
|
94
|
+
},
|
|
95
|
+
fieldAttrs: function fieldAttrs() {
|
|
96
|
+
return _objectSpread(_objectSpread({}, this.field.props), this.field.states);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
102
|
+
return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
|
|
103
|
+
key: 0,
|
|
104
|
+
"class": _ctx.cx('root')
|
|
105
|
+
}, _ctx.ptmi('root')), {
|
|
106
|
+
"default": withCtx(function () {
|
|
107
|
+
return [renderSlot(_ctx.$slots, "default", mergeProps({
|
|
108
|
+
props: $options.field.props
|
|
109
|
+
}, $options.fieldAttrs))];
|
|
110
|
+
}),
|
|
111
|
+
_: 3
|
|
112
|
+
}, 16, ["class"])) : renderSlot(_ctx.$slots, "default", mergeProps({
|
|
113
|
+
key: 1,
|
|
114
|
+
"class": _ctx.cx('root'),
|
|
115
|
+
props: $options.field.props
|
|
116
|
+
}, $options.fieldAttrs));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
script.render = render;
|
|
120
|
+
|
|
121
|
+
export { script as default };
|
|
122
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/formfield/BaseFormField.vue","../../src/formfield/FormField.vue","../../src/formfield/FormField.vue?vue&type=template&id=4107279f&lang.js"],"sourcesContent":["<script>\nimport BaseComponent from '@primevue/core/basecomponent';\nimport FormFieldStyle from '@primevue/forms/formfield/style';\n\nexport default {\n name: 'BaseFormField',\n extends: BaseComponent,\n style: FormFieldStyle,\n props: {\n name: {\n type: String,\n default: undefined\n },\n resolver: {\n type: Function,\n default: undefined\n },\n initialValue: {\n type: null,\n default: undefined\n },\n validateOnValueUpdate: {\n type: Boolean,\n default: undefined\n },\n validateOnBlur: {\n type: Boolean,\n default: undefined\n },\n validateOnMount: {\n type: Boolean,\n default: undefined\n },\n validateOnSubmit: {\n type: Boolean,\n default: undefined\n },\n as: {\n type: [String, Object],\n default: 'DIV'\n },\n asChild: {\n type: Boolean,\n default: false\n }\n },\n provide() {\n return {\n $pcFormField: this,\n $parentInstance: this\n };\n }\n};\n</script>\n","<template>\n <component v-if=\"!asChild\" :is=\"as\" :class=\"cx('root')\" v-bind=\"ptmi('root')\">\n <slot :props=\"field.props\" v-bind=\"fieldAttrs\"></slot>\n </component>\n <slot v-else :class=\"cx('root')\" :props=\"field.props\" v-bind=\"fieldAttrs\"></slot>\n</template>\n\n<script>\nimport BaseFormField from './BaseFormField.vue';\n\nexport default {\n name: 'FormField',\n extends: BaseFormField,\n inheritAttrs: false,\n inject: {\n $pcForm: {\n default: undefined\n }\n },\n watch: {\n formControl: {\n immediate: true,\n handler(newValue) {\n this.$pcForm?.register?.(this.name, newValue);\n }\n }\n },\n computed: {\n formControl() {\n return {\n name: this.name,\n resolver: this.resolver,\n initialValue: this.initialValue,\n validateOnValueUpdate: this.validateOnValueUpdate,\n validateOnBlur: this.validateOnBlur,\n validateOnMount: this.validateOnMount,\n validateOnSubmit: this.validateOnSubmit\n };\n },\n field() {\n return this.$pcForm?.fields?.[this.name] || {};\n },\n fieldAttrs() {\n return {\n ...this.field.props,\n ...this.field.states\n };\n }\n }\n};\n</script>\n","<template>\n <component v-if=\"!asChild\" :is=\"as\" :class=\"cx('root')\" v-bind=\"ptmi('root')\">\n <slot :props=\"field.props\" v-bind=\"fieldAttrs\"></slot>\n </component>\n <slot v-else :class=\"cx('root')\" :props=\"field.props\" v-bind=\"fieldAttrs\"></slot>\n</template>\n\n<script>\nimport BaseFormField from './BaseFormField.vue';\n\nexport default {\n name: 'FormField',\n extends: BaseFormField,\n inheritAttrs: false,\n inject: {\n $pcForm: {\n default: undefined\n }\n },\n watch: {\n formControl: {\n immediate: true,\n handler(newValue) {\n this.$pcForm?.register?.(this.name, newValue);\n }\n }\n },\n computed: {\n formControl() {\n return {\n name: this.name,\n resolver: this.resolver,\n initialValue: this.initialValue,\n validateOnValueUpdate: this.validateOnValueUpdate,\n validateOnBlur: this.validateOnBlur,\n validateOnMount: this.validateOnMount,\n validateOnSubmit: this.validateOnSubmit\n };\n },\n field() {\n return this.$pcForm?.fields?.[this.name] || {};\n },\n fieldAttrs() {\n return {\n ...this.field.props,\n ...this.field.states\n };\n }\n }\n};\n</script>\n"],"names":["name","BaseComponent","style","FormFieldStyle","props","type","String","undefined","resolver","Function","initialValue","validateOnValueUpdate","Boolean","validateOnBlur","validateOnMount","validateOnSubmit","as","Object","asChild","provide","$pcFormField","$parentInstance","BaseFormField","inheritAttrs","inject","$pcForm","watch","formControl","immediate","handler","newValue","_this$$pcForm","_this$$pcForm$registe","register","call","computed","field","_this$$pcForm2","fields","fieldAttrs","_objectSpread","states","_ctx","_createBlock","_resolveDynamicComponent","_mergeProps","cx","ptmi","_renderSlot","$options"],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* [Live Demo](https://www.primevue.org/forms/)
|
|
4
|
+
*
|
|
5
|
+
* @module formfieldstyle
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { BaseStyle } from '@primevue/core/base/style';
|
|
9
|
+
|
|
10
|
+
export enum FormFieldClasses {
|
|
11
|
+
/**
|
|
12
|
+
* The class of root element
|
|
13
|
+
*/
|
|
14
|
+
root = 'p-formfield'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FormFieldStyle extends BaseStyle {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseStyle from '@primevue/core/base/style';
|
|
2
|
+
|
|
3
|
+
var classes = {
|
|
4
|
+
root: 'p-formfield p-component'
|
|
5
|
+
};
|
|
6
|
+
var FormFieldStyle = BaseStyle.extend({
|
|
7
|
+
name: 'formfield',
|
|
8
|
+
classes: classes
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { FormFieldStyle as default };
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/formfield/style/FormFieldStyle.js"],"sourcesContent":["import BaseStyle from '@primevue/core/base/style';\n\nconst classes = {\n root: 'p-formfield p-component'\n};\n\nexport default BaseStyle.extend({\n name: 'formfield',\n classes\n});\n"],"names":["classes","root","BaseStyle","extend","name"],"mappings":";;AAEA,IAAMA,OAAO,GAAG;AACZC,EAAAA,IAAI,EAAE;AACV,CAAC;AAED,qBAAeC,SAAS,CAACC,MAAM,CAAC;AAC5BC,EAAAA,IAAI,EAAE,WAAW;AACjBJ,EAAAA,OAAO,EAAPA;AACJ,CAAC,CAAC;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Form
|
|
2
|
+
export * from '@primevue/forms/form';
|
|
3
|
+
export { default as Form } from '@primevue/forms/form';
|
|
4
|
+
export * from '@primevue/forms/form/style';
|
|
5
|
+
export { default as FormStyle } from '@primevue/forms/form/style';
|
|
6
|
+
|
|
7
|
+
// FormField
|
|
8
|
+
export * from '@primevue/forms/formfield';
|
|
9
|
+
export { default as FormField } from '@primevue/forms/formfield';
|
|
10
|
+
export * from '@primevue/forms/formfield/style';
|
|
11
|
+
export { default as FormFieldStyle } from '@primevue/forms/formfield/style';
|
package/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '@primevue/forms/form';
|
|
2
|
+
export { default as Form } from '@primevue/forms/form';
|
|
3
|
+
export * from '@primevue/forms/form/style';
|
|
4
|
+
export { default as FormStyle } from '@primevue/forms/form/style';
|
|
5
|
+
export * from '@primevue/forms/formfield';
|
|
6
|
+
export { default as FormField } from '@primevue/forms/formfield';
|
|
7
|
+
export * from '@primevue/forms/formfield/style';
|
|
8
|
+
export { default as FormFieldStyle } from '@primevue/forms/formfield/style';
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cjdevstudios/bumblevue-forms",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"author": "CJ Development Studios",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "CJ Development Studios"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "PrimeTek Informatics"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"description": "",
|
|
14
|
+
"homepage": "https://bumblevue.org/",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/CJDevStudios/bumblevue.git",
|
|
19
|
+
"directory": "packages/forms"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/CJDevStudios/bumblevue/issues"
|
|
23
|
+
},
|
|
24
|
+
"main": "./index.mjs",
|
|
25
|
+
"module": "./index.mjs",
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./index.d.ts",
|
|
30
|
+
"import": "./index.mjs",
|
|
31
|
+
"default": "./index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./*/index.d.ts",
|
|
35
|
+
"import": "./*/index.mjs",
|
|
36
|
+
"default": "./*/index.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@cjdevstudios/bumbleuix-utils": "1.0.0-beta.1",
|
|
44
|
+
"@cjdevstudios/bumbleuix-forms": "1.0.0-beta.1",
|
|
45
|
+
"@cjdevstudios/bumblevue-core": "1.0.0-beta.1"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=12.11.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@primeuix/forms/resolvers/joi';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@primeuix/forms/resolvers/superstruct';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@primeuix/forms/resolvers/valibot';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@primeuix/forms/resolvers/yup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|