@speykye/vue-form-engine 0.1.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.
- package/dist/components/DynamicFormArrayField.vue.d.ts +17 -0
- package/dist/components/DynamicFormArrayField.vue.d.ts.map +1 -0
- package/dist/components/DynamicFormBlock.vue.d.ts +10 -0
- package/dist/components/DynamicFormBlock.vue.d.ts.map +1 -0
- package/dist/components/DynamicFormEngine.vue.d.ts +45 -0
- package/dist/components/DynamicFormEngine.vue.d.ts.map +1 -0
- package/dist/components/DynamicFormField.vue.d.ts +17 -0
- package/dist/components/DynamicFormField.vue.d.ts.map +1 -0
- package/dist/components/DynamicFormSection.vue.d.ts +17 -0
- package/dist/components/DynamicFormSection.vue.d.ts.map +1 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +296 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/vue-form-engine.css +2 -0
- package/package.json +28 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FormArrayFieldSchema, type FormContext, type FormFieldSchema, type FormModel } from '@speykye/vue-form-engine-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: FormArrayFieldSchema;
|
|
4
|
+
model: FormModel;
|
|
5
|
+
errors?: Record<string, string[]>;
|
|
6
|
+
context?: FormContext;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
update: (key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
10
|
+
blur: (field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onUpdate?: ((key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
13
|
+
onBlur?: ((field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=DynamicFormArrayField.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormArrayField.vue.d.ts","sourceRoot":"","sources":["../../src/components/DynamicFormArrayField.vue"],"names":[],"mappings":"AAiIA,OAAO,EAAiC,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAGjK,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAkLF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FormBlockSchema, type FormContext, type FormModel } from '@speykye/vue-form-engine-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: FormBlockSchema;
|
|
4
|
+
model: FormModel;
|
|
5
|
+
context?: FormContext;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=DynamicFormBlock.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormBlock.vue.d.ts","sourceRoot":"","sources":["../../src/components/DynamicFormBlock.vue"],"names":[],"mappings":"AA8CA,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEvH,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AA4DF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type FormContext, type FormModel, type FormSchema } from '@speykye/vue-form-engine-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
schema: FormSchema;
|
|
4
|
+
modelValue?: FormModel;
|
|
5
|
+
context?: FormContext;
|
|
6
|
+
submitText?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function validate(): Promise<boolean>;
|
|
9
|
+
declare function handleSubmit(): Promise<void>;
|
|
10
|
+
declare var __VLS_9: {
|
|
11
|
+
submit: typeof handleSubmit;
|
|
12
|
+
validate: typeof validate;
|
|
13
|
+
model: FormModel;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
actions?: (props: typeof __VLS_9) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
19
|
+
model: FormModel;
|
|
20
|
+
errors: import("vue").Ref<Record<string, string[]>, Record<string, string[]>>;
|
|
21
|
+
validate: typeof validate;
|
|
22
|
+
submit: typeof handleSubmit;
|
|
23
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
"update:modelValue": (value: FormModel) => any;
|
|
25
|
+
submit: (value: FormModel) => any;
|
|
26
|
+
validate: (valid: boolean, errors: Record<string, string[]>) => any;
|
|
27
|
+
fieldChange: (key: string, value: any, model: FormModel) => any;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
+
"onUpdate:modelValue"?: ((value: FormModel) => any) | undefined;
|
|
30
|
+
onSubmit?: ((value: FormModel) => any) | undefined;
|
|
31
|
+
onValidate?: ((valid: boolean, errors: Record<string, string[]>) => any) | undefined;
|
|
32
|
+
onFieldChange?: ((key: string, value: any, model: FormModel) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
modelValue: FormModel;
|
|
35
|
+
submitText: string;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=DynamicFormEngine.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormEngine.vue.d.ts","sourceRoot":"","sources":["../../src/components/DynamicFormEngine.vue"],"names":[],"mappings":"AAiKA,OAAO,EAKL,KAAK,WAAW,EAEhB,KAAK,SAAS,EACd,KAAK,UAAU,EAEhB,MAAM,+BAA+B,CAAC;AAIvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAiFF,iBAAe,QAAQ,qBAKtB;AAED,iBAAe,YAAY,kBAK1B;AA6FD,QAAA,IAAI,OAAO;;;;CAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;gBApMD,SAAS;gBAET,MAAM;6EAuMnB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FormContext, type FormFieldSchema, type FormModel } from '@speykye/vue-form-engine-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: FormFieldSchema;
|
|
4
|
+
model: FormModel;
|
|
5
|
+
errors?: Record<string, string[]>;
|
|
6
|
+
context?: FormContext;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
update: (key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
10
|
+
blur: (field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onUpdate?: ((key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
13
|
+
onBlur?: ((field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=DynamicFormField.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormField.vue.d.ts","sourceRoot":"","sources":["../../src/components/DynamicFormField.vue"],"names":[],"mappings":"AAkEA,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEvH,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AA6GF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FormContext, type FormFieldSchema, type FormModel, type FormSectionSchema } from '@speykye/vue-form-engine-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
section: FormSectionSchema;
|
|
4
|
+
model: FormModel;
|
|
5
|
+
errors?: Record<string, string[]>;
|
|
6
|
+
context?: FormContext;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
update: (key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
10
|
+
blur: (field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onUpdate?: ((key: string, value: any, field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
13
|
+
onBlur?: ((field: FormFieldSchema<Record<string, any>, Record<string, any>>) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=DynamicFormSection.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/DynamicFormSection.vue"],"names":[],"mappings":"AAiFA,OAAO,EAA2C,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKxK,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AA8JF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,UAAU,CAA6B,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@speykye/vue-form-engine-core"),t=require("vue");var n=Symbol(`FORM_ENGINE_KEY`),r={key:1,class:`vfe-missing-field`},i=(0,t.defineComponent)({__name:`DynamicFormField`,props:{field:{},model:{},errors:{},context:{}},emits:[`update`,`blur`],setup(i,{emit:a}){let o=i,s=a,c=(0,t.inject)(n);if(!c)throw Error(`[vue-form-engine] Form engine is not provided. Use createVueFormEngine().`);let l=(0,t.computed)(()=>c.fields.get(o.field.type)),u=(0,t.computed)(()=>l.value?.component),d=(0,t.computed)(()=>(0,e.isItemDisabled)(o.field,o.model,c,o.context??{})),f=(0,t.computed)(()=>o.errors?.[o.field.key]?.[0]??``);function p(e){let t=l.value?.normalizeValue,n=t?t(e,{field:o.field,model:o.model,context:o.context??{}}):e;s(`update`,o.field.key,n,o.field)}return(e,n)=>u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u.value),{key:0,field:i.field,"model-value":i.model[i.field.key],model:i.model,disabled:d.value,readonly:i.field.readonly,"error-message":f.value,"onUpdate:modelValue":p,onChange:p,onBlur:n[0]||=e=>s(`blur`,i.field)},null,40,[`field`,`model-value`,`model`,`disabled`,`readonly`,`error-message`])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,r,` Unknown field type: `+(0,t.toDisplayString)(i.field.type),1))}}),a=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},o=a(i,[[`__scopeId`,`data-v-5cda7259`]]),s={class:`vfe-array-field`},c={class:`vfe-array-header`},l={class:`vfe-array-title`},u={key:0,class:`vfe-array-description`},d=[`disabled`],f={class:`vfe-array-item-header`},p=[`disabled`,`onClick`],m=a((0,t.defineComponent)({__name:`DynamicFormArrayField`,props:{field:{},model:{},errors:{},context:{}},emits:[`update`,`blur`],setup(r,{emit:i}){let a=r,m=i,h=(0,t.inject)(n);if(!h)throw Error(`[vue-form-engine] Form engine is not provided. Use createVueFormEngine().`);let g=(0,t.computed)(()=>Array.isArray(a.model[a.field.key])?a.model[a.field.key]:[]),_=(0,t.computed)(()=>a.field.maxItems===void 0||g.value.length<a.field.maxItems),v=(0,t.computed)(()=>a.field.minItems===void 0||g.value.length>a.field.minItems);function y(){(0,e.addArrayItem)(a.model,a.field,h)}function b(t){(0,e.removeArrayItem)(a.model,a.field,t)}function x(e,t,n,r){let i=Array.isArray(a.model[a.field.key])?a.model[a.field.key]:[];i[e]||(i[e]={}),i[e][t]=n,m(`update`,`${a.field.key}.${e}.${t}`,n,r)}function S(e){let t={};return Object.entries(a.errors??{}).forEach(([n,r])=>{let i=`${a.field.key}.${e}.`;n.startsWith(i)&&(t[n.slice(i.length)]=r)}),t}return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,s,[(0,t.createElementVNode)(`div`,c,[(0,t.createElementVNode)(`div`,null,[(0,t.createElementVNode)(`div`,l,(0,t.toDisplayString)(r.field.label),1),r.field.placeholder?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,u,(0,t.toDisplayString)(r.field.placeholder),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`button`,{type:`button`,class:`vfe-array-add`,disabled:!_.value,onClick:y},(0,t.toDisplayString)(r.field.addText??`Add`),9,d)]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(g.value,(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:i,class:`vfe-array-item`},[(0,t.createElementVNode)(`div`,f,[(0,t.createElementVNode)(`span`,null,`#`+(0,t.toDisplayString)(i+1),1),(0,t.createElementVNode)(`button`,{type:`button`,class:`vfe-array-remove`,disabled:!v.value,onClick:e=>b(i)},(0,t.toDisplayString)(r.field.removeText??`Remove`),9,p)]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.field.itemFields,a=>((0,t.openBlock)(),(0,t.createBlock)(o,{key:a.key,field:a,model:e,errors:S(i),context:r.context,onUpdate:(e,t,n)=>x(i,e,t,n),onBlur:n[0]||=e=>m(`blur`,e)},null,8,[`field`,`model`,`errors`,`context`,`onUpdate`]))),128))]))),128))]))}}),[[`__scopeId`,`data-v-7ddd9b9e`]]),h={key:1,class:`vfe-missing-block`},g=a((0,t.defineComponent)({__name:`DynamicFormBlock`,props:{block:{},model:{},context:{}},setup(r){let i=r,a=(0,t.inject)(n);if(!a)throw Error(`[vue-form-engine] Form engine is not provided. Use createVueFormEngine().`);let o=(0,t.computed)(()=>a.blocks.get(i.block.type)),s=(0,t.computed)(()=>o.value?.component),c=(0,t.computed)(()=>(0,e.isItemDisabled)(i.block,i.model,a,i.context??{}));return(e,n)=>s.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(s.value),(0,t.mergeProps)({key:0,block:r.block,model:r.model,disabled:c.value},r.block.props),null,16,[`block`,`model`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,h,` Unknown block type: `+(0,t.toDisplayString)(r.block.type),1))}}),[[`__scopeId`,`data-v-21472dc3`]]),_={class:`vfe-section`},v={key:0,class:`vfe-section-header`},y={key:0},b={key:1},x=a((0,t.defineComponent)({__name:`DynamicFormSection`,props:{section:{},model:{},errors:{},context:{}},emits:[`update`,`blur`],setup(r,{emit:i}){let a=i,s=(0,t.inject)(n);if(!s)throw Error(`[vue-form-engine] Form engine is not provided. Use createVueFormEngine().`);return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,_,[r.section.title||r.section.description?((0,t.openBlock)(),(0,t.createElementBlock)(`header`,v,[r.section.title?((0,t.openBlock)(),(0,t.createElementBlock)(`h3`,y,(0,t.toDisplayString)(r.section.title),1)):(0,t.createCommentVNode)(``,!0),r.section.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,b,(0,t.toDisplayString)(r.section.description),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.section.items,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.key},[(0,t.unref)(e.isFieldItem)(n)&&(0,t.unref)(e.isItemVisible)(n,r.model,(0,t.unref)(s),r.context??{})?((0,t.openBlock)(),(0,t.createBlock)(o,{key:0,field:n,model:r.model,errors:r.errors,context:r.context,onUpdate:i[0]||=(e,t,n)=>a(`update`,e,t,n),onBlur:i[1]||=e=>a(`blur`,e)},null,8,[`field`,`model`,`errors`,`context`])):(0,t.unref)(e.isArrayItem)(n)&&(0,t.unref)(e.isItemVisible)(n,r.model,(0,t.unref)(s),r.context??{})?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,field:n,model:r.model,errors:r.errors,context:r.context,onUpdate:i[2]||=(e,t,n)=>a(`update`,e,t,n),onBlur:i[3]||=e=>a(`blur`,e)},null,8,[`field`,`model`,`errors`,`context`])):n.kind===`block`&&(0,t.unref)(e.isItemVisible)(n,r.model,(0,t.unref)(s),r.context??{})?((0,t.openBlock)(),(0,t.createBlock)(g,{key:2,block:n,model:r.model,context:r.context},null,8,[`block`,`model`,`context`])):(0,t.createCommentVNode)(``,!0)],64))),128))]))}}),[[`__scopeId`,`data-v-2be4e4fc`]]),S={type:`submit`,class:`vfe-submit`},C=a((0,t.defineComponent)({__name:`DynamicFormEngine`,props:{schema:{},modelValue:{default:()=>({})},context:{},submitText:{default:`Submit`}},emits:[`update:modelValue`,`submit`,`validate`,`fieldChange`],setup(r,{expose:i,emit:a}){let o=r,s=a,c=(0,t.inject)(n);if(!c)throw Error(`[vue-form-engine] Form engine is not provided. Use createVueFormEngine().`);let l=(0,t.reactive)((0,e.buildInitialModel)(o.schema,c,o.modelValue)),u=(0,t.ref)({}),d=new Map;(0,t.watch)(()=>o.modelValue,t=>{Object.assign(l,(0,e.buildInitialModel)(o.schema,c,t??{}))},{deep:!0}),(0,t.watch)(l,()=>s(`update:modelValue`,{...l}),{deep:!0});function f(e,t){if(u.value={...u.value,[e]:t},!t.length){let t={...u.value};delete t[e],u.value=t}}async function p(t,n){let r=await(0,e.validateField)(t,l[t.key],l,c,o.context??{},n);return f(t.key,r),r}function m(e,t){let n=e.validateDebounce??Math.max(0,...(e.rules??[]).map(e=>e.debounce??0));if(t!==`onChange`||n<=0){p(e,t);return}let r=d.get(e.key);r&&window.clearTimeout(r);let i=window.setTimeout(()=>{p(e,t),d.delete(e.key)},n);d.set(e.key,i)}function h(e,t,n){e.includes(`.`)||(l[e]=t),s(`fieldChange`,e,t,{...l}),m(n,`onChange`)}function g(e){m(e,`onBlur`)}async function _(){u.value=await(0,e.validateForm)(o.schema,l,c,o.context??{},`onSubmit`);let t=Object.keys(u.value).length===0;return s(`validate`,t,u.value),t}async function v(){await _()&&s(`submit`,(0,e.collectSubmitValues)(o.schema,l,c,o.context??{}))}return i({model:l,errors:u,validate:_,submit:v}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`form`,{class:`vfe-form`,onSubmit:(0,t.withModifiers)(v,[`prevent`])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.schema.sections,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(x,{key:e.key??n,section:e,model:l,errors:u.value,context:r.context,onUpdate:h,onBlur:g},null,8,[`section`,`model`,`errors`,`context`]))),128)),(0,t.renderSlot)(e.$slots,`actions`,{submit:v,validate:_,model:l},()=>[(0,t.createElementVNode)(`button`,S,(0,t.toDisplayString)(r.submitText),1)],!0)],32))}}),[[`__scopeId`,`data-v-967b6c31`]]);function w(t={}){let r=t.engine??(0,e.createFormEngine)();return t.plugins?.forEach(e=>r.use(e)),{engine:r,install(e){e.provide(n,r),e.component(`DynamicFormEngine`,C)}}}exports.DynamicFormArrayField=m,exports.DynamicFormBlock=g,exports.DynamicFormEngine=C,exports.DynamicFormField=o,exports.createVueFormEngine=w,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createVueFormEngine } from './plugin';
|
|
2
|
+
export { default as DynamicFormEngine } from './components/DynamicFormEngine.vue';
|
|
3
|
+
export { default as DynamicFormField } from './components/DynamicFormField.vue';
|
|
4
|
+
export { default as DynamicFormArrayField } from './components/DynamicFormArrayField.vue';
|
|
5
|
+
export { default as DynamicFormBlock } from './components/DynamicFormBlock.vue';
|
|
6
|
+
export type { FormPlugin } from '@speykye/vue-form-engine-core';
|
|
7
|
+
export * from '@speykye/vue-form-engine-core';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,cAAc,+BAA+B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { addArrayItem as e, buildInitialModel as t, collectSubmitValues as n, createFormEngine as r, isArrayItem as i, isFieldItem as a, isItemDisabled as o, isItemVisible as s, removeArrayItem as c, validateField as l, validateForm as u } from "@speykye/vue-form-engine-core";
|
|
2
|
+
import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, defineComponent as _, inject as v, mergeProps as y, openBlock as b, reactive as x, ref as S, renderList as C, renderSlot as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, watch as O, withModifiers as k } from "vue";
|
|
3
|
+
export * from "@speykye/vue-form-engine-core";
|
|
4
|
+
//#region src/context.ts
|
|
5
|
+
var A = Symbol("FORM_ENGINE_KEY"), j = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "vfe-missing-field"
|
|
8
|
+
}, M = /*@__PURE__*/ _({
|
|
9
|
+
__name: "DynamicFormField",
|
|
10
|
+
props: {
|
|
11
|
+
field: {},
|
|
12
|
+
model: {},
|
|
13
|
+
errors: {},
|
|
14
|
+
context: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["update", "blur"],
|
|
17
|
+
setup(e, { emit: t }) {
|
|
18
|
+
let n = e, r = t, i = v(A);
|
|
19
|
+
if (!i) throw Error("[vue-form-engine] Form engine is not provided. Use createVueFormEngine().");
|
|
20
|
+
let a = f(() => i.fields.get(n.field.type)), s = f(() => a.value?.component), c = f(() => o(n.field, n.model, i, n.context ?? {})), l = f(() => n.errors?.[n.field.key]?.[0] ?? "");
|
|
21
|
+
function u(e) {
|
|
22
|
+
let t = a.value?.normalizeValue, i = t ? t(e, {
|
|
23
|
+
field: n.field,
|
|
24
|
+
model: n.model,
|
|
25
|
+
context: n.context ?? {}
|
|
26
|
+
}) : e;
|
|
27
|
+
r("update", n.field.key, i, n.field);
|
|
28
|
+
}
|
|
29
|
+
return (t, n) => s.value ? (b(), p(T(s.value), {
|
|
30
|
+
key: 0,
|
|
31
|
+
field: e.field,
|
|
32
|
+
"model-value": e.model[e.field.key],
|
|
33
|
+
model: e.model,
|
|
34
|
+
disabled: c.value,
|
|
35
|
+
readonly: e.field.readonly,
|
|
36
|
+
"error-message": l.value,
|
|
37
|
+
"onUpdate:modelValue": u,
|
|
38
|
+
onChange: u,
|
|
39
|
+
onBlur: n[0] ||= (t) => r("blur", e.field)
|
|
40
|
+
}, null, 40, [
|
|
41
|
+
"field",
|
|
42
|
+
"model-value",
|
|
43
|
+
"model",
|
|
44
|
+
"disabled",
|
|
45
|
+
"readonly",
|
|
46
|
+
"error-message"
|
|
47
|
+
])) : (b(), h("div", j, " Unknown field type: " + E(e.field.type), 1));
|
|
48
|
+
}
|
|
49
|
+
}), N = (e, t) => {
|
|
50
|
+
let n = e.__vccOpts || e;
|
|
51
|
+
for (let [e, r] of t) n[e] = r;
|
|
52
|
+
return n;
|
|
53
|
+
}, P = /*#__PURE__*/ N(M, [["__scopeId", "data-v-5cda7259"]]), F = { class: "vfe-array-field" }, I = { class: "vfe-array-header" }, L = { class: "vfe-array-title" }, R = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "vfe-array-description"
|
|
56
|
+
}, z = ["disabled"], B = { class: "vfe-array-item-header" }, V = ["disabled", "onClick"], H = /*#__PURE__*/ N(/* @__PURE__ */ _({
|
|
57
|
+
__name: "DynamicFormArrayField",
|
|
58
|
+
props: {
|
|
59
|
+
field: {},
|
|
60
|
+
model: {},
|
|
61
|
+
errors: {},
|
|
62
|
+
context: {}
|
|
63
|
+
},
|
|
64
|
+
emits: ["update", "blur"],
|
|
65
|
+
setup(t, { emit: n }) {
|
|
66
|
+
let r = t, i = n, a = v(A);
|
|
67
|
+
if (!a) throw Error("[vue-form-engine] Form engine is not provided. Use createVueFormEngine().");
|
|
68
|
+
let o = f(() => Array.isArray(r.model[r.field.key]) ? r.model[r.field.key] : []), s = f(() => r.field.maxItems === void 0 || o.value.length < r.field.maxItems), l = f(() => r.field.minItems === void 0 || o.value.length > r.field.minItems);
|
|
69
|
+
function u() {
|
|
70
|
+
e(r.model, r.field, a);
|
|
71
|
+
}
|
|
72
|
+
function _(e) {
|
|
73
|
+
c(r.model, r.field, e);
|
|
74
|
+
}
|
|
75
|
+
function y(e, t, n, a) {
|
|
76
|
+
let o = Array.isArray(r.model[r.field.key]) ? r.model[r.field.key] : [];
|
|
77
|
+
o[e] || (o[e] = {}), o[e][t] = n, i("update", `${r.field.key}.${e}.${t}`, n, a);
|
|
78
|
+
}
|
|
79
|
+
function x(e) {
|
|
80
|
+
let t = {};
|
|
81
|
+
return Object.entries(r.errors ?? {}).forEach(([n, i]) => {
|
|
82
|
+
let a = `${r.field.key}.${e}.`;
|
|
83
|
+
n.startsWith(a) && (t[n.slice(a.length)] = i);
|
|
84
|
+
}), t;
|
|
85
|
+
}
|
|
86
|
+
return (e, n) => (b(), h("div", F, [g("div", I, [g("div", null, [g("div", L, E(t.field.label), 1), t.field.placeholder ? (b(), h("div", R, E(t.field.placeholder), 1)) : m("", !0)]), g("button", {
|
|
87
|
+
type: "button",
|
|
88
|
+
class: "vfe-array-add",
|
|
89
|
+
disabled: !s.value,
|
|
90
|
+
onClick: u
|
|
91
|
+
}, E(t.field.addText ?? "Add"), 9, z)]), (b(!0), h(d, null, C(o.value, (e, r) => (b(), h("div", {
|
|
92
|
+
key: r,
|
|
93
|
+
class: "vfe-array-item"
|
|
94
|
+
}, [g("div", B, [g("span", null, "#" + E(r + 1), 1), g("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
class: "vfe-array-remove",
|
|
97
|
+
disabled: !l.value,
|
|
98
|
+
onClick: (e) => _(r)
|
|
99
|
+
}, E(t.field.removeText ?? "Remove"), 9, V)]), (b(!0), h(d, null, C(t.field.itemFields, (a) => (b(), p(P, {
|
|
100
|
+
key: a.key,
|
|
101
|
+
field: a,
|
|
102
|
+
model: e,
|
|
103
|
+
errors: x(r),
|
|
104
|
+
context: t.context,
|
|
105
|
+
onUpdate: (e, t, n) => y(r, e, t, n),
|
|
106
|
+
onBlur: n[0] ||= (e) => i("blur", e)
|
|
107
|
+
}, null, 8, [
|
|
108
|
+
"field",
|
|
109
|
+
"model",
|
|
110
|
+
"errors",
|
|
111
|
+
"context",
|
|
112
|
+
"onUpdate"
|
|
113
|
+
]))), 128))]))), 128))]));
|
|
114
|
+
}
|
|
115
|
+
}), [["__scopeId", "data-v-7ddd9b9e"]]), U = {
|
|
116
|
+
key: 1,
|
|
117
|
+
class: "vfe-missing-block"
|
|
118
|
+
}, W = /*#__PURE__*/ N(/* @__PURE__ */ _({
|
|
119
|
+
__name: "DynamicFormBlock",
|
|
120
|
+
props: {
|
|
121
|
+
block: {},
|
|
122
|
+
model: {},
|
|
123
|
+
context: {}
|
|
124
|
+
},
|
|
125
|
+
setup(e) {
|
|
126
|
+
let t = e, n = v(A);
|
|
127
|
+
if (!n) throw Error("[vue-form-engine] Form engine is not provided. Use createVueFormEngine().");
|
|
128
|
+
let r = f(() => n.blocks.get(t.block.type)), i = f(() => r.value?.component), a = f(() => o(t.block, t.model, n, t.context ?? {}));
|
|
129
|
+
return (t, n) => i.value ? (b(), p(T(i.value), y({
|
|
130
|
+
key: 0,
|
|
131
|
+
block: e.block,
|
|
132
|
+
model: e.model,
|
|
133
|
+
disabled: a.value
|
|
134
|
+
}, e.block.props), null, 16, [
|
|
135
|
+
"block",
|
|
136
|
+
"model",
|
|
137
|
+
"disabled"
|
|
138
|
+
])) : (b(), h("div", U, " Unknown block type: " + E(e.block.type), 1));
|
|
139
|
+
}
|
|
140
|
+
}), [["__scopeId", "data-v-21472dc3"]]), G = { class: "vfe-section" }, K = {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: "vfe-section-header"
|
|
143
|
+
}, q = { key: 0 }, J = { key: 1 }, Y = /*#__PURE__*/ N(/* @__PURE__ */ _({
|
|
144
|
+
__name: "DynamicFormSection",
|
|
145
|
+
props: {
|
|
146
|
+
section: {},
|
|
147
|
+
model: {},
|
|
148
|
+
errors: {},
|
|
149
|
+
context: {}
|
|
150
|
+
},
|
|
151
|
+
emits: ["update", "blur"],
|
|
152
|
+
setup(e, { emit: t }) {
|
|
153
|
+
let n = t, r = v(A);
|
|
154
|
+
if (!r) throw Error("[vue-form-engine] Form engine is not provided. Use createVueFormEngine().");
|
|
155
|
+
return (t, o) => (b(), h("section", G, [e.section.title || e.section.description ? (b(), h("header", K, [e.section.title ? (b(), h("h3", q, E(e.section.title), 1)) : m("", !0), e.section.description ? (b(), h("p", J, E(e.section.description), 1)) : m("", !0)])) : m("", !0), (b(!0), h(d, null, C(e.section.items, (t) => (b(), h(d, { key: t.key }, [D(a)(t) && D(s)(t, e.model, D(r), e.context ?? {}) ? (b(), p(P, {
|
|
156
|
+
key: 0,
|
|
157
|
+
field: t,
|
|
158
|
+
model: e.model,
|
|
159
|
+
errors: e.errors,
|
|
160
|
+
context: e.context,
|
|
161
|
+
onUpdate: o[0] ||= (e, t, r) => n("update", e, t, r),
|
|
162
|
+
onBlur: o[1] ||= (e) => n("blur", e)
|
|
163
|
+
}, null, 8, [
|
|
164
|
+
"field",
|
|
165
|
+
"model",
|
|
166
|
+
"errors",
|
|
167
|
+
"context"
|
|
168
|
+
])) : D(i)(t) && D(s)(t, e.model, D(r), e.context ?? {}) ? (b(), p(H, {
|
|
169
|
+
key: 1,
|
|
170
|
+
field: t,
|
|
171
|
+
model: e.model,
|
|
172
|
+
errors: e.errors,
|
|
173
|
+
context: e.context,
|
|
174
|
+
onUpdate: o[2] ||= (e, t, r) => n("update", e, t, r),
|
|
175
|
+
onBlur: o[3] ||= (e) => n("blur", e)
|
|
176
|
+
}, null, 8, [
|
|
177
|
+
"field",
|
|
178
|
+
"model",
|
|
179
|
+
"errors",
|
|
180
|
+
"context"
|
|
181
|
+
])) : t.kind === "block" && D(s)(t, e.model, D(r), e.context ?? {}) ? (b(), p(W, {
|
|
182
|
+
key: 2,
|
|
183
|
+
block: t,
|
|
184
|
+
model: e.model,
|
|
185
|
+
context: e.context
|
|
186
|
+
}, null, 8, [
|
|
187
|
+
"block",
|
|
188
|
+
"model",
|
|
189
|
+
"context"
|
|
190
|
+
])) : m("", !0)], 64))), 128))]));
|
|
191
|
+
}
|
|
192
|
+
}), [["__scopeId", "data-v-2be4e4fc"]]), X = {
|
|
193
|
+
type: "submit",
|
|
194
|
+
class: "vfe-submit"
|
|
195
|
+
}, Z = /*#__PURE__*/ N(/* @__PURE__ */ _({
|
|
196
|
+
__name: "DynamicFormEngine",
|
|
197
|
+
props: {
|
|
198
|
+
schema: {},
|
|
199
|
+
modelValue: { default: () => ({}) },
|
|
200
|
+
context: {},
|
|
201
|
+
submitText: { default: "Submit" }
|
|
202
|
+
},
|
|
203
|
+
emits: [
|
|
204
|
+
"update:modelValue",
|
|
205
|
+
"submit",
|
|
206
|
+
"validate",
|
|
207
|
+
"fieldChange"
|
|
208
|
+
],
|
|
209
|
+
setup(e, { expose: r, emit: i }) {
|
|
210
|
+
let a = e, o = i, s = v(A);
|
|
211
|
+
if (!s) throw Error("[vue-form-engine] Form engine is not provided. Use createVueFormEngine().");
|
|
212
|
+
let c = x(t(a.schema, s, a.modelValue)), f = S({}), m = /* @__PURE__ */ new Map();
|
|
213
|
+
O(() => a.modelValue, (e) => {
|
|
214
|
+
Object.assign(c, t(a.schema, s, e ?? {}));
|
|
215
|
+
}, { deep: !0 }), O(c, () => o("update:modelValue", { ...c }), { deep: !0 });
|
|
216
|
+
function _(e, t) {
|
|
217
|
+
if (f.value = {
|
|
218
|
+
...f.value,
|
|
219
|
+
[e]: t
|
|
220
|
+
}, !t.length) {
|
|
221
|
+
let t = { ...f.value };
|
|
222
|
+
delete t[e], f.value = t;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function y(e, t) {
|
|
226
|
+
let n = await l(e, c[e.key], c, s, a.context ?? {}, t);
|
|
227
|
+
return _(e.key, n), n;
|
|
228
|
+
}
|
|
229
|
+
function T(e, t) {
|
|
230
|
+
let n = e.validateDebounce ?? Math.max(0, ...(e.rules ?? []).map((e) => e.debounce ?? 0));
|
|
231
|
+
if (t !== "onChange" || n <= 0) {
|
|
232
|
+
y(e, t);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
let r = m.get(e.key);
|
|
236
|
+
r && window.clearTimeout(r);
|
|
237
|
+
let i = window.setTimeout(() => {
|
|
238
|
+
y(e, t), m.delete(e.key);
|
|
239
|
+
}, n);
|
|
240
|
+
m.set(e.key, i);
|
|
241
|
+
}
|
|
242
|
+
function D(e, t, n) {
|
|
243
|
+
e.includes(".") || (c[e] = t), o("fieldChange", e, t, { ...c }), T(n, "onChange");
|
|
244
|
+
}
|
|
245
|
+
function j(e) {
|
|
246
|
+
T(e, "onBlur");
|
|
247
|
+
}
|
|
248
|
+
async function M() {
|
|
249
|
+
f.value = await u(a.schema, c, s, a.context ?? {}, "onSubmit");
|
|
250
|
+
let e = Object.keys(f.value).length === 0;
|
|
251
|
+
return o("validate", e, f.value), e;
|
|
252
|
+
}
|
|
253
|
+
async function N() {
|
|
254
|
+
await M() && o("submit", n(a.schema, c, s, a.context ?? {}));
|
|
255
|
+
}
|
|
256
|
+
return r({
|
|
257
|
+
model: c,
|
|
258
|
+
errors: f,
|
|
259
|
+
validate: M,
|
|
260
|
+
submit: N
|
|
261
|
+
}), (t, n) => (b(), h("form", {
|
|
262
|
+
class: "vfe-form",
|
|
263
|
+
onSubmit: k(N, ["prevent"])
|
|
264
|
+
}, [(b(!0), h(d, null, C(e.schema.sections, (t, n) => (b(), p(Y, {
|
|
265
|
+
key: t.key ?? n,
|
|
266
|
+
section: t,
|
|
267
|
+
model: c,
|
|
268
|
+
errors: f.value,
|
|
269
|
+
context: e.context,
|
|
270
|
+
onUpdate: D,
|
|
271
|
+
onBlur: j
|
|
272
|
+
}, null, 8, [
|
|
273
|
+
"section",
|
|
274
|
+
"model",
|
|
275
|
+
"errors",
|
|
276
|
+
"context"
|
|
277
|
+
]))), 128)), w(t.$slots, "actions", {
|
|
278
|
+
submit: N,
|
|
279
|
+
validate: M,
|
|
280
|
+
model: c
|
|
281
|
+
}, () => [g("button", X, E(e.submitText), 1)], !0)], 32));
|
|
282
|
+
}
|
|
283
|
+
}), [["__scopeId", "data-v-967b6c31"]]);
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/plugin.ts
|
|
286
|
+
function Q(e = {}) {
|
|
287
|
+
let t = e.engine ?? r();
|
|
288
|
+
return e.plugins?.forEach((e) => t.use(e)), {
|
|
289
|
+
engine: t,
|
|
290
|
+
install(e) {
|
|
291
|
+
e.provide(A, t), e.component("DynamicFormEngine", Z);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
export { H as DynamicFormArrayField, W as DynamicFormBlock, Z as DynamicFormEngine, P as DynamicFormField, Q as createVueFormEngine };
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import { type FormEngine, type FormPlugin } from '@speykye/vue-form-engine-core';
|
|
3
|
+
export interface VueFormEngineOptions {
|
|
4
|
+
engine?: FormEngine;
|
|
5
|
+
plugins?: FormPlugin[];
|
|
6
|
+
}
|
|
7
|
+
export declare function createVueFormEngine(options?: VueFormEngineOptions): {
|
|
8
|
+
engine: FormEngine;
|
|
9
|
+
install(app: App): void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAoB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAInG,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB;;iBAMrD,GAAG;EAKnB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.vfe-missing-field[data-v-5cda7259]{color:#b42318;border:1px dashed #f04438;border-radius:6px;padding:8px 12px}.vfe-array-field[data-v-7ddd9b9e]{border:1px solid #e5e7eb;border-radius:8px;margin-bottom:16px;padding:12px}.vfe-array-header[data-v-7ddd9b9e],.vfe-array-item-header[data-v-7ddd9b9e]{justify-content:space-between;align-items:center;gap:12px;display:flex}.vfe-array-title[data-v-7ddd9b9e]{font-weight:600}.vfe-array-description[data-v-7ddd9b9e]{color:#667085;font-size:12px}.vfe-array-item[data-v-7ddd9b9e]{border:1px solid #f0f0f0;border-radius:8px;margin-top:12px;padding:12px}.vfe-array-add[data-v-7ddd9b9e],.vfe-array-remove[data-v-7ddd9b9e]{cursor:pointer;background:#fff;border:1px solid #d0d5dd;border-radius:6px;padding:4px 10px}.vfe-array-add[data-v-7ddd9b9e]:disabled,.vfe-array-remove[data-v-7ddd9b9e]:disabled{cursor:not-allowed;opacity:.5}.vfe-missing-block[data-v-21472dc3]{color:#b42318;border:1px dashed #f04438;border-radius:6px;padding:8px 12px}.vfe-section[data-v-2be4e4fc]{margin-bottom:24px}.vfe-section-header[data-v-2be4e4fc]{margin-bottom:16px}.vfe-section-header h3[data-v-2be4e4fc]{margin:0;font-size:18px}.vfe-section-header p[data-v-2be4e4fc]{color:#667085;margin:4px 0 0}.vfe-form[data-v-967b6c31]{flex-direction:column;gap:12px;display:flex}.vfe-submit[data-v-967b6c31]{color:#fff;cursor:pointer;background:#1677ff;border:1px solid #1677ff;border-radius:6px;align-self:flex-start;padding:8px 16px}
|
|
2
|
+
/*$vite$:1*/
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@speykye/vue-form-engine",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vue": "^3.5.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@speykye/vue-form-engine-core": "^0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "vue-tsc --declaration --emitDeclarationOnly --outDir dist && vite build",
|
|
26
|
+
"typecheck": "vue-tsc --noEmit"
|
|
27
|
+
}
|
|
28
|
+
}
|