vft 0.0.342 → 0.0.343

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.
@@ -206,10 +206,6 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
206
206
  size: {
207
207
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
208
208
  };
209
- required: {
210
- type: import("vue").PropType<boolean>;
211
- default: undefined;
212
- };
213
209
  rules: {
214
210
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
215
211
  };
@@ -231,6 +227,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
231
227
  hideRequiredAsterisk: {
232
228
  type: import("vue").PropType<boolean>;
233
229
  };
230
+ required: {
231
+ type: import("vue").PropType<boolean>;
232
+ default: undefined;
233
+ };
234
234
  for: {
235
235
  type: import("vue").PropType<string>;
236
236
  };
@@ -253,10 +253,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
253
253
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
254
254
  "update:error": (val: string) => void;
255
255
  }, import("vue").PublicProps, {
256
- required: boolean;
257
256
  labelWidth: string | number;
258
257
  inlineMessage: string | boolean;
259
258
  showMessage: boolean;
259
+ required: boolean;
260
260
  hideLabel: boolean;
261
261
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
262
262
  P: {};
@@ -278,10 +278,6 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
278
278
  size: {
279
279
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
280
280
  };
281
- required: {
282
- type: import("vue").PropType<boolean>;
283
- default: undefined;
284
- };
285
281
  rules: {
286
282
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
287
283
  };
@@ -303,6 +299,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
303
299
  hideRequiredAsterisk: {
304
300
  type: import("vue").PropType<boolean>;
305
301
  };
302
+ required: {
303
+ type: import("vue").PropType<boolean>;
304
+ default: undefined;
305
+ };
306
306
  for: {
307
307
  type: import("vue").PropType<string>;
308
308
  };
@@ -323,10 +323,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
323
323
  clearValidate: () => void;
324
324
  resetField: () => void;
325
325
  }, {}, {}, {}, {
326
- required: boolean;
327
326
  labelWidth: string | number;
328
327
  inlineMessage: string | boolean;
329
328
  showMessage: boolean;
329
+ required: boolean;
330
330
  hideLabel: boolean;
331
331
  }>;
332
332
  __isFragment?: never;
@@ -345,10 +345,6 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
345
345
  size: {
346
346
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
347
347
  };
348
- required: {
349
- type: import("vue").PropType<boolean>;
350
- default: undefined;
351
- };
352
348
  rules: {
353
349
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
354
350
  };
@@ -370,6 +366,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
370
366
  hideRequiredAsterisk: {
371
367
  type: import("vue").PropType<boolean>;
372
368
  };
369
+ required: {
370
+ type: import("vue").PropType<boolean>;
371
+ default: undefined;
372
+ };
373
373
  for: {
374
374
  type: import("vue").PropType<string>;
375
375
  };
@@ -392,10 +392,10 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
392
392
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
393
393
  "update:error": (val: string) => void;
394
394
  }, string, {
395
- required: boolean;
396
395
  labelWidth: string | number;
397
396
  inlineMessage: string | boolean;
398
397
  showMessage: boolean;
398
+ required: boolean;
399
399
  hideLabel: boolean;
400
400
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
401
401
  $slots: {
@@ -423,10 +423,6 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
423
423
  size: {
424
424
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
425
425
  };
426
- required: {
427
- type: import("vue").PropType<boolean>;
428
- default: undefined;
429
- };
430
426
  rules: {
431
427
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
432
428
  };
@@ -448,6 +444,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
448
444
  hideRequiredAsterisk: {
449
445
  type: import("vue").PropType<boolean>;
450
446
  };
447
+ required: {
448
+ type: import("vue").PropType<boolean>;
449
+ default: undefined;
450
+ };
451
451
  for: {
452
452
  type: import("vue").PropType<string>;
453
453
  };
@@ -470,10 +470,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
470
470
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
471
471
  "update:error": (val: string) => void;
472
472
  }, import("vue").PublicProps, {
473
- required: boolean;
474
473
  labelWidth: string | number;
475
474
  inlineMessage: string | boolean;
476
475
  showMessage: boolean;
476
+ required: boolean;
477
477
  hideLabel: boolean;
478
478
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
479
479
  P: {};
@@ -495,10 +495,6 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
495
495
  size: {
496
496
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
497
497
  };
498
- required: {
499
- type: import("vue").PropType<boolean>;
500
- default: undefined;
501
- };
502
498
  rules: {
503
499
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
504
500
  };
@@ -520,6 +516,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
520
516
  hideRequiredAsterisk: {
521
517
  type: import("vue").PropType<boolean>;
522
518
  };
519
+ required: {
520
+ type: import("vue").PropType<boolean>;
521
+ default: undefined;
522
+ };
523
523
  for: {
524
524
  type: import("vue").PropType<string>;
525
525
  };
@@ -540,10 +540,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
540
540
  clearValidate: () => void;
541
541
  resetField: () => void;
542
542
  }, {}, {}, {}, {
543
- required: boolean;
544
543
  labelWidth: string | number;
545
544
  inlineMessage: string | boolean;
546
545
  showMessage: boolean;
546
+ required: boolean;
547
547
  hideLabel: boolean;
548
548
  }>;
549
549
  __isFragment?: never;
@@ -562,10 +562,6 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
562
562
  size: {
563
563
  type: import("vue").PropType<import("vft/es/constants").ComponentSize>;
564
564
  };
565
- required: {
566
- type: import("vue").PropType<boolean>;
567
- default: undefined;
568
- };
569
565
  rules: {
570
566
  type: import("vue").PropType<import("vft/es/utils").Arrayable<import("./types").FormItemRule>>;
571
567
  };
@@ -587,6 +583,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
587
583
  hideRequiredAsterisk: {
588
584
  type: import("vue").PropType<boolean>;
589
585
  };
586
+ required: {
587
+ type: import("vue").PropType<boolean>;
588
+ default: undefined;
589
+ };
590
590
  for: {
591
591
  type: import("vue").PropType<string>;
592
592
  };
@@ -609,10 +609,10 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
609
609
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
610
610
  "update:error": (val: string) => void;
611
611
  }, string, {
612
- required: boolean;
613
612
  labelWidth: string | number;
614
613
  inlineMessage: string | boolean;
615
614
  showMessage: boolean;
615
+ required: boolean;
616
616
  hideLabel: boolean;
617
617
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
618
618
  $slots: {
@@ -7,14 +7,14 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
7
7
  type: import("vue").PropType<string | number>;
8
8
  default: number;
9
9
  };
10
- icon: {
11
- type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
12
- default: string;
13
- };
14
10
  teleported: {
15
11
  type: import("vue").PropType<boolean>;
16
12
  default: boolean;
17
13
  };
14
+ icon: {
15
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
16
+ default: string;
17
+ };
18
18
  hideAfter: {
19
19
  type: import("vue").PropType<number>;
20
20
  default: number;
@@ -52,8 +52,8 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
52
52
  cancel: (val: MouseEvent) => void;
53
53
  }, import("vue").PublicProps, {
54
54
  width: string | number;
55
- icon: string | import("vft/es/vft").IconProps;
56
55
  teleported: boolean;
56
+ icon: string | import("vft/es/vft").IconProps;
57
57
  hideAfter: number;
58
58
  persistent: boolean;
59
59
  confirmButtonType: import("vft/es/vft").ButtonType;
@@ -74,14 +74,14 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
74
74
  type: import("vue").PropType<string | number>;
75
75
  default: number;
76
76
  };
77
- icon: {
78
- type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
79
- default: string;
80
- };
81
77
  teleported: {
82
78
  type: import("vue").PropType<boolean>;
83
79
  default: boolean;
84
80
  };
81
+ icon: {
82
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
83
+ default: string;
84
+ };
85
85
  hideAfter: {
86
86
  type: import("vue").PropType<number>;
87
87
  default: number;
@@ -116,8 +116,8 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
116
116
  onConfirm?: ((val: MouseEvent) => any) | undefined;
117
117
  }>, {}, {}, {}, {}, {
118
118
  width: string | number;
119
- icon: string | import("vft/es/vft").IconProps;
120
119
  teleported: boolean;
120
+ icon: string | import("vft/es/vft").IconProps;
121
121
  hideAfter: number;
122
122
  persistent: boolean;
123
123
  confirmButtonType: import("vft/es/vft").ButtonType;
@@ -135,14 +135,14 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
135
135
  type: import("vue").PropType<string | number>;
136
136
  default: number;
137
137
  };
138
- icon: {
139
- type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
140
- default: string;
141
- };
142
138
  teleported: {
143
139
  type: import("vue").PropType<boolean>;
144
140
  default: boolean;
145
141
  };
142
+ icon: {
143
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
144
+ default: string;
145
+ };
146
146
  hideAfter: {
147
147
  type: import("vue").PropType<number>;
148
148
  default: number;
@@ -180,8 +180,8 @@ export declare const VftPopconfirm: import("vft/es/utils").SFCWithInstall<{
180
180
  cancel: (val: MouseEvent) => void;
181
181
  }, string, {
182
182
  width: string | number;
183
- icon: string | import("vft/es/vft").IconProps;
184
183
  teleported: boolean;
184
+ icon: string | import("vft/es/vft").IconProps;
185
185
  hideAfter: number;
186
186
  persistent: boolean;
187
187
  confirmButtonType: import("vft/es/vft").ButtonType;
@@ -43,8 +43,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
43
43
  onConfirm?: ((val: MouseEvent) => any) | undefined;
44
44
  }>, {
45
45
  width: string | number;
46
- icon: string | IconProps;
47
46
  teleported: boolean;
47
+ icon: string | IconProps;
48
48
  hideAfter: number;
49
49
  persistent: boolean;
50
50
  confirmButtonType: ButtonType;
@@ -123,7 +123,7 @@ export declare const VftSuperForm: import("vft/es/utils").SFCWithInstall<{
123
123
  onRegister?: ((instance: Partial<import("./types").FormActionType>) => any) | undefined;
124
124
  "onField-value-change"?: (() => any) | undefined;
125
125
  }>, {
126
- getFieldsValue: () => import("../types").Recordable;
126
+ getFieldsValue: (showHideData?: any) => import("../types").Recordable;
127
127
  getFieldValue: (field: string) => string | number | import("../types").Recordable;
128
128
  setFieldsValue: (values: import("../types").Recordable, autoValidate?: boolean) => Promise<void>;
129
129
  resetFields: (props: any) => Promise<void>;
@@ -290,7 +290,7 @@ export declare const VftSuperForm: import("vft/es/utils").SFCWithInstall<{
290
290
  onRegister?: ((instance: Partial<import("./types").FormActionType>) => any) | undefined;
291
291
  "onField-value-change"?: (() => any) | undefined;
292
292
  }>, {
293
- getFieldsValue: () => import("../types").Recordable;
293
+ getFieldsValue: (showHideData?: any) => import("../types").Recordable;
294
294
  getFieldValue: (field: string) => string | number | import("../types").Recordable;
295
295
  setFieldsValue: (values: import("../types").Recordable, autoValidate?: boolean) => Promise<void>;
296
296
  resetFields: (props: any) => Promise<void>;
@@ -449,7 +449,7 @@ export declare const VftSuperForm: import("vft/es/utils").SFCWithInstall<{
449
449
  onRegister?: ((instance: Partial<import("./types").FormActionType>) => any) | undefined;
450
450
  "onField-value-change"?: (() => any) | undefined;
451
451
  }>, {
452
- getFieldsValue: () => import("../types").Recordable;
452
+ getFieldsValue: (showHideData?: any) => import("../types").Recordable;
453
453
  getFieldValue: (field: string) => string | number | import("../types").Recordable;
454
454
  setFieldsValue: (values: import("../types").Recordable, autoValidate?: boolean) => Promise<void>;
455
455
  resetFields: (props: any) => Promise<void>;
@@ -29,7 +29,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
29
29
  actionInline: boolean;
30
30
  customLayout: boolean;
31
31
  }>>, {
32
- getFieldsValue: () => Recordable;
32
+ getFieldsValue: (showHideData?: any) => Recordable;
33
33
  getFieldValue: (field: string) => string | number | Recordable;
34
34
  setFieldsValue: (values: Recordable, autoValidate?: boolean) => Promise<void>;
35
35
  resetFields: (props: any) => Promise<void>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@vft/utils"),N=require("@vft/utils/date"),b=require("lodash-es"),i=require("vue"),O=require("../component-map.cjs"),Z=require("./helper.cjs");function U(p,F){const{show:u,ifShow:l}=p;let y=!0,a=!0;return typeof u=="boolean"?y=u:typeof u=="function"&&(y=u({field:p.field,model:F,values:{...F},schema:p})),typeof l=="boolean"?a=l:typeof l=="function"&&(a=l({field:p.field,model:F,values:{...F},schema:p})),y&&a}function L(p,F={}){const u=/^\[(.+)\]$/;if(u.test(p)){const l=p.match(u);if(l&&l[1]){const y=l[1].split(",");if(!y.length)return;const a=[];return y.forEach((v,V)=>{b.set(a,V,F[v.trim()])}),a.filter(Boolean).length?a:void 0}}}function K(p,F={}){const u=/^\{(.+)\}$/;if(u.test(p)){const l=p.match(u);if(l&&l[1]){const y=l[1].split(",");if(!y.length)return;const a={};return y.forEach(v=>{b.set(a,v.trim(),F[v.trim()])}),Object.values(a).filter(Boolean).length?a:void 0}}}function R({emit:p,getProps:F,formModel:u,getSchema:l,defaultValueRef:y,formElRef:a,schemaRef:v,handleFormValues:V,initValues:A}){async function $(e){const{resetFunc:t,submitOnReset:s}=i.unref(F);t&&c.isFunction(t)&&await t();const r=i.unref(a);if(r){if(e?.length)return r.resetFields(e);Object.keys(u).forEach(o=>{const f=i.unref(l).find(d=>d.field===o),n=b.cloneDeep(y.value[o]);u[o]=O.isInput(f?.type)?n||"":n}),i.nextTick(()=>j()),p("reset",i.toRaw(u)),s&&await x()}}async function C(e,t=!0){const s=i.unref(l).map(n=>n.field).filter(Boolean),r=".",o=s.filter(n=>String(n).indexOf(r)>=0),f=[];s.forEach(n=>{const d=i.unref(l).find(h=>h.field===n);let E=b.get(e,n);const S=Reflect.has(e,n);E=Z.handleInputNumberValue(d?.type,E);const{componentProps:_}=d||{};let w=_;typeof _=="function"&&(w=w({formModel:i.unref(u)}));const m=L(n,e)||K(n,e);if(S||m){const h=m||E;if(W(n))if(Array.isArray(h)){const D=[];for(const g of h)D.push(g?N.formatToDate(g):null);i.unref(u)[n]=D}else i.unref(u)[n]=h?w?.valueFormat?h:N.formatToDate(h):null;else i.unref(u)[n]=h;w?.onChange&&w?.onChange(h),f.push(n)}else o.forEach(h=>{try{const D=h.split(".").reduce((g,Y)=>g[Y],e);c.isDef(D)&&(i.unref(u)[h]=i.unref(D),f.push(h))}catch{c.isDef(y.value[h])&&(i.unref(u)[h]=b.cloneDeep(i.unref(y.value[h])))}})}),t&&i.nextTick(async()=>{await q(f).catch(n=>{})})}async function P(e){const t=b.cloneDeep(i.unref(l));if(!e)return;let s=c.isString(e)?[e]:e;c.isString(e)&&(s=[e]);for(const r of s)z(r,t);v.value=t}function z(e,t){if(c.isString(e)){const s=t.findIndex(r=>r.field===e);s!==-1&&(delete u[e],t.splice(s,1))}}async function G(e,t,s=!1){const r=b.cloneDeep(i.unref(l)),o=r.findIndex(n=>n.field===t),f=c.isObject(e)?[e]:e;if(!t||o===-1||s){s?r.unshift(...f):r.push(...f),v.value=r,I(e);return}o!==-1&&r.splice(o+1,0,...f),I(e),v.value=r}async function H(e){let t=[];if(c.isObject(e)&&t.push(e),c.isArray(e)&&(t=[...e]),!t.every(r=>r.type===O.FormCompEnum.DIVIDER||Reflect.has(r,"field")&&r.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}v.value=t}async function J(e){let t=[];if(c.isObject(e)&&t.push(e),c.isArray(e)&&(t=[...e]),!t.every(f=>f.type===O.FormCompEnum.DIVIDER||Reflect.has(f,"field")&&f.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}const r=[],o=[];i.unref(l).forEach(f=>{let n;if(t.forEach(d=>{f.field===d.field&&(n=d),d.defaultValue&&d.field&&r.push(d.field)}),n!==void 0&&f.field===n.field){const d=c.deepMerge(f,n);o.push(d)}else o.push(f)}),I(o,r),v.value=b.uniqBy(o,"field")}function I(e,t,s=!0){if(c.isArray(t)&&t?.length===0)return;let r=[];c.isObject(e)&&r.push(e),c.isArray(e)&&(r=[...e]);const o={},f=B();r.forEach(n=>{n.type!==O.FormCompEnum.DIVIDER&&Reflect.has(n,"field")&&n.field&&!c.isNullOrUndefined(n.defaultValue)&&(!(n.field in f)||c.isNullOrUndefined(f[n.field])||c.isEmpty(f[n.field]))&&(o[n.field]=n.defaultValue)}),c.isEmptyObject(o)||C(o,s)}function B(){return i.unref(a)?V(i.toRaw(i.unref(u))):{}}function Q(e){return i.unref(a)?i.toRaw(i.unref(u))[e]:{}}function W(e){return i.unref(l).some(t=>t.field===e?O.isDatePicker(t.type):!1)}async function q(e){return e||(e=i.unref(l).filter(s=>U(s,i.unref(u))).map(s=>s.field).filter(Boolean)),i.unref(a)?.validateField(e)}async function T(e){return e||(e=i.unref(l).filter(s=>U(s,i.unref(u))).map(s=>s.field).filter(Boolean)),await i.unref(a)?.validate(()=>{},e)}async function j(e){await i.unref(a)?.clearValidate(e)}async function X(e,t){await i.unref(a)?.scrollToField(e,t)}async function x(e){const{autoCleanErrorMessage:t,watchDataIsChange:s}=i.unref(F);e&&e.preventDefault(),t&&await j();const{submitFunc:r,beforeSubmitFunc:o}=i.unref(F);if(o&&c.isFunction(o)&&await o(),r&&c.isFunction(r)){await r();return}if(i.unref(a))try{const n=await T();if(!n)return;const d=V(n);if(s){const E=b.isEqual(A.value,d),S=c.findDifferentValuesForObj(A.value,d);p("submit",d,!E,S)}else p("submit",d)}catch(n){if(n?.outOfDate===!1&&n?.errorFields)return;throw new Error(n.message)}}return{handleSubmit:x,clearValidate:j,validate:T,validateField:q,getFieldsValue:B,updateSchema:J,resetSchema:H,appendSchemaByField:G,removeSchemaByField:P,resetFields:$,setFieldsValue:C,scrollToField:X,getFieldValue:Q}}exports.useFormEvents=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@vft/utils"),U=require("@vft/utils/date"),b=require("lodash-es"),t=require("vue"),V=require("../component-map.cjs"),Z=require("./helper.cjs");function C(p,F){const{show:l,ifShow:o}=p;let y=!0,a=!0;return typeof l=="boolean"?y=l:typeof l=="function"&&(y=l({field:p.field,model:F,values:{...F},schema:p})),typeof o=="boolean"?a=o:typeof o=="function"&&(a=o({field:p.field,model:F,values:{...F},schema:p})),y&&a}function L(p,F={}){const l=/^\[(.+)\]$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const a=[];return y.forEach((v,I)=>{b.set(a,I,F[v.trim()])}),a.filter(Boolean).length?a:void 0}}}function K(p,F={}){const l=/^\{(.+)\}$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const a={};return y.forEach(v=>{b.set(a,v.trim(),F[v.trim()])}),Object.values(a).filter(Boolean).length?a:void 0}}}function R({emit:p,getProps:F,formModel:l,getSchema:o,defaultValueRef:y,formElRef:a,schemaRef:v,handleFormValues:I,initValues:S}){async function $(e){const{resetFunc:i,submitOnReset:s}=t.unref(F);i&&c.isFunction(i)&&await i();const r=t.unref(a);if(r){if(e?.length)return r.resetFields(e);Object.keys(l).forEach(f=>{const u=t.unref(o).find(d=>d.field===f),n=b.cloneDeep(y.value[f]);l[f]=V.isInput(u?.type)?n||"":n}),t.nextTick(()=>A()),p("reset",t.toRaw(l)),s&&await _()}}async function q(e,i=!0){const s=t.unref(o).map(n=>n.field).filter(Boolean),r=".",f=s.filter(n=>String(n).indexOf(r)>=0),u=[];s.forEach(n=>{const d=t.unref(o).find(h=>h.field===n);let E=b.get(e,n);const B=Reflect.has(e,n);E=Z.handleInputNumberValue(d?.type,E);const{componentProps:m}=d||{};let w=m;typeof m=="function"&&(w=w({formModel:t.unref(l)}));const N=L(n,e)||K(n,e);if(B||N){const h=N||E;if(W(n))if(Array.isArray(h)){const D=[];for(const O of h)D.push(O?U.formatToDate(O):null);t.unref(l)[n]=D}else t.unref(l)[n]=h?w?.valueFormat?h:U.formatToDate(h):null;else t.unref(l)[n]=h;w?.onChange&&w?.onChange(h),u.push(n)}else f.forEach(h=>{try{const D=h.split(".").reduce((O,Y)=>O[Y],e);c.isDef(D)&&(t.unref(l)[h]=t.unref(D),u.push(h))}catch{c.isDef(y.value[h])&&(t.unref(l)[h]=b.cloneDeep(t.unref(y.value[h])))}})}),i&&t.nextTick(async()=>{await T(u).catch(n=>{})})}async function P(e){const i=b.cloneDeep(t.unref(o));if(!e)return;let s=c.isString(e)?[e]:e;c.isString(e)&&(s=[e]);for(const r of s)z(r,i);v.value=i}function z(e,i){if(c.isString(e)){const s=i.findIndex(r=>r.field===e);s!==-1&&(delete l[e],i.splice(s,1))}}async function G(e,i,s=!1){const r=b.cloneDeep(t.unref(o)),f=r.findIndex(n=>n.field===i),u=c.isObject(e)?[e]:e;if(!i||f===-1||s){s?r.unshift(...u):r.push(...u),v.value=r,g(e);return}f!==-1&&r.splice(f+1,0,...u),g(e),v.value=r}async function H(e){let i=[];if(c.isObject(e)&&i.push(e),c.isArray(e)&&(i=[...e]),!i.every(r=>r.type===V.FormCompEnum.DIVIDER||Reflect.has(r,"field")&&r.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}v.value=i}async function J(e){let i=[];if(c.isObject(e)&&i.push(e),c.isArray(e)&&(i=[...e]),!i.every(u=>u.type===V.FormCompEnum.DIVIDER||Reflect.has(u,"field")&&u.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}const r=[],f=[];t.unref(o).forEach(u=>{let n;if(i.forEach(d=>{u.field===d.field&&(n=d),d.defaultValue&&d.field&&r.push(d.field)}),n!==void 0&&u.field===n.field){const d=c.deepMerge(u,n);f.push(d)}else f.push(u)}),g(f,r),v.value=b.uniqBy(f,"field")}function g(e,i,s=!0){if(c.isArray(i)&&i?.length===0)return;let r=[];c.isObject(e)&&r.push(e),c.isArray(e)&&(r=[...e]);const f={},u=j();r.forEach(n=>{n.type!==V.FormCompEnum.DIVIDER&&Reflect.has(n,"field")&&n.field&&!c.isNullOrUndefined(n.defaultValue)&&(!(n.field in u)||c.isNullOrUndefined(u[n.field])||c.isEmpty(u[n.field]))&&(f[n.field]=n.defaultValue)}),c.isEmptyObject(f)||q(f,s)}function j(e=fasle){if(!t.unref(a))return{};const s=I(t.toRaw(t.unref(l)));if(e)return s;const r=t.unref(o).filter(u=>C(u,t.unref(l))).map(u=>u.field).filter(Boolean),f={};return r.forEach(u=>{u in s&&(f[u]=s[u])}),f}function Q(e){return t.unref(a)?t.toRaw(t.unref(l))[e]:{}}function W(e){return t.unref(o).some(i=>i.field===e?V.isDatePicker(i.type):!1)}async function T(e){return e||(e=t.unref(o).filter(s=>C(s,t.unref(l))).map(s=>s.field).filter(Boolean)),t.unref(a)?.validateField(e)}async function x(e){return e||(e=t.unref(o).filter(s=>C(s,t.unref(l))).map(s=>s.field).filter(Boolean)),await t.unref(a)?.validate(()=>{},e)}async function A(e){await t.unref(a)?.clearValidate(e)}async function X(e,i){await t.unref(a)?.scrollToField(e,i)}async function _(e){const{autoCleanErrorMessage:i,watchDataIsChange:s}=t.unref(F);e&&e.preventDefault(),i&&await A();const{submitFunc:r,beforeSubmitFunc:f}=t.unref(F);if(f&&c.isFunction(f)&&await f(),r&&c.isFunction(r)){await r();return}if(t.unref(a))try{if(!await x())return;const d=j();if(s){const E=b.isEqual(S.value,d),B=c.findDifferentValuesForObj(S.value,d);p("submit",d,!E,B)}else p("submit",d)}catch(n){if(n?.outOfDate===!1&&n?.errorFields)return;throw new Error(n.message)}}return{handleSubmit:_,clearValidate:A,validate:x,validateField:T,getFieldsValue:j,updateSchema:J,resetSchema:H,appendSchemaByField:G,removeSchemaByField:P,resetFields:$,setFieldsValue:q,scrollToField:X,getFieldValue:Q}}exports.useFormEvents=R;
@@ -17,7 +17,7 @@ export declare function useFormEvents({ emit, getProps, formModel, getSchema, de
17
17
  clearValidate: (name?: string | string[]) => Promise<void>;
18
18
  validate: (nameList?: any[] | undefined) => Promise<any>;
19
19
  validateField: (nameList?: any[] | undefined) => Promise<any>;
20
- getFieldsValue: () => Recordable;
20
+ getFieldsValue: (showHideData?: any) => Recordable;
21
21
  updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
22
22
  resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
23
23
  appendSchemaByField: (schema: FormSchema | FormSchema[], prefixField?: string, first?: boolean) => Promise<void>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.342";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.343";exports.version=e;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.342",
3
+ "version": "0.0.343",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vft",
3
- "version": "0.0.342",
3
+ "version": "0.0.343",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -56,10 +56,10 @@
56
56
  "sortablejs": "1.15.0",
57
57
  "photoswipe": "5.4.4",
58
58
  "@vft/router": "0.0.65",
59
- "@vft/store": "0.0.54",
60
59
  "@vft/constants": "0.0.72",
61
- "@vft/utils": "0.0.128",
62
60
  "@vft/use": "0.0.76",
61
+ "@vft/store": "0.0.54",
62
+ "@vft/utils": "0.0.128",
63
63
  "@vft/directives": "0.0.33"
64
64
  },
65
65
  "vetur": {
package/web-types.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.342","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
1
+ {"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.343","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}