1- <template >
2- <div class =" container-examples" >
3- <div :key = " values" >Values: {{values}}</div >
4-
5- <div :key = " changes" >Changes: {{changes}}</div >
6- <div :key = " pureValue" >Pure values: {{pureValue}}</div >
7- <div :key = " pureAvailabilities" >Pure av: {{pureAvailabilities}}</div >
1+ <script setup lang="ts">
82
9- <input-field name = " birthday" type = " date" label = " Placeholder" />
3+ import {useFormValues , Form , FormField } from " ../../../src/index" ;
4+ import ParentForm from " ./parent-form.vue" ;
105
11- <input-field name = " birthday" type = " date" label = " Other mask" mask = " MM/DD/YYYY" :handlers = " [testFrom, testTo]" />
6+ const form = new Form ({
7+ name: " grand"
8+ })
9+ const values = useFormValues (form );
1210
11+ // @ts-ignore
12+ window .theForm = form ;
13+ </script >
1314
15+ <template >
16+ <div class =" container" >
17+ <form-field name =" username" label =" username" />
18+ {{ values }}
19+ <parent-form />
1420 </div >
1521</template >
1622
17- <script setup lang='ts'>
18- import Form from " ../../../src/classes/Form" ;
19- import {ref } from " vue" ;
20- import copyObject from " ./../../../src/utils/copy-object" ;
21- import {InputField } from " ../../../src/index" ;
22- import DateController from " ../../../src/controllers/date-controller" ;
23-
24- // @ts-ignore
25- const form = window .form = new Form ({
26- name: " main" ,
27- parent:false
28- });
29- const show = ref (false );
30-
31- setInterval (() => {
32- if (! form ) return ;
33-
34- values .value = copyObject (form ?.values );
35- changes .value = copyObject (form .changes );
36- pureValue .value = copyObject (form .TEST_PURE_VALUE );
37- pureAvailabilities .value = copyObject (form .TEST_PURE_AVAILABILITIES )
38- }, 50 );
39-
40-
41-
42-
43- const values = ref (0 );
44- const changes = ref ({});
45- const pureValue= ref ({});
46- const pureAvailabilities = ref ({})
47-
48- const name = ref (' username' );
49-
50- function change() {
51- name .value = name .value === ' username' ? ' age' : ' username' ;
23+ <style scoped>
24+ .container {
25+ padding : 20px ;
26+ border : 2px solid black ;
5227}
53- function clean() {
54- form .cleanValues ();
55- }
56-
57- function testFrom(date : unknown ) {
58- if (typeof date !== ' string' ) return null ;
59- return new Date (date )
60- }
61-
62- function testTo(str ? : string ) {
63- if (typeof str !== ' string' ) return null ;
64-
65- const p = DateController .ConvertToDate (str , " MM/DD/YYYY" );
66- if (! p ) return null ;
67-
68- return DateController .GetPrettyDate (p , ' YYYY-MM-DD' )
69- }
70-
71- </script >
72-
73- <style >
74-
75- </style >
28+ </style >
0 commit comments