Skip to content

Commit 02e249c

Browse files
committed
component lc-input lc-form
1 parent bb253f8 commit 02e249c

File tree

9 files changed

+219
-436
lines changed

9 files changed

+219
-436
lines changed

demo/App.vue

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,13 @@
152152
<div class="w-full">
153153
<lc-form
154154
id-form="1"
155-
:fields="formInput"
155+
:fields="formFields"
156156
:button-primary="lcFormButtonPrimary"
157-
edition-mode
157+
:button-secondary="lcFormButtonSecondary"
158158
@onSubmit="onSubmit"
159+
@onCancel="onCancel"
159160
/>
160-
<pre>{{ formInput }}</pre>
161+
<pre>{{ formFields }}</pre>
161162
</div>
162163
</div>
163164
</div>
@@ -180,17 +181,49 @@ export default defineComponent({
180181
full: true,
181182
text: 'Valider',
182183
},
184+
lcFormButtonSecondary: {
185+
attrs: {
186+
color: 'secondary',
187+
class: 'btn-secondary',
188+
},
189+
full: true,
190+
text: 'Annuler',
191+
},
183192
formInput: [{
184193
model: '',
185194
inputType: 'input',
186-
inputClass: 'w-full lc-col',
187195
attr: {
196+
inputClass: 'w-full lc-col',
188197
placeholder: 'Ecrit dedans :)',
189-
label: 'addresse',
190-
name: 'address',
198+
label: 'Nom',
199+
name: 'lastname',
191200
rules: 'required',
192201
},
193202
}],
203+
formFields: [
204+
{
205+
model: '',
206+
inputType: 'input',
207+
attr: {
208+
disabled: true,
209+
inputClass: 'w-full lc-col',
210+
placeholder: 'Ecrit dedans :)',
211+
label: 'Prénom',
212+
name: 'firstname',
213+
rules: 'required',
214+
},
215+
},
216+
{
217+
model: '',
218+
inputType: 'input',
219+
attr: {
220+
inputClass: 'w-full lc-col',
221+
label: 'addresse',
222+
name: 'address',
223+
rules: 'required',
224+
},
225+
},
226+
],
194227
buttonSizes: ['sm', 'md', 'lg', 'xl'],
195228
iconSizes: ['xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
196229
btnColors: ['primary',
@@ -215,8 +248,12 @@ export default defineComponent({
215248
}
216249
},
217250
methods: {
218-
onSubmit() {
219-
console.log('on submit')
251+
onSubmit(values: Object) {
252+
console.log('onSubmit', values)
253+
},
254+
onCancel(group: String, oldFields: Array<any>) {
255+
console.log('onCancel', group, oldFields)
256+
this.formFields = oldFields
220257
},
221258
},
222259
})

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lc-component-library",
3-
"version": "1.0.94",
3+
"version": "1.0.2",
44
"files": [
55
"dist"
66
],
@@ -22,7 +22,10 @@
2222
}
2323
},
2424
"dependencies": {
25+
"@vee-validate/i18n": "^4.1.20",
26+
"@vee-validate/rules": "^4.1.20",
2527
"esno": "0.4.4",
28+
"vee-validate": "^4.2.4",
2629
"vue": "^3.0.5"
2730
},
2831
"devDependencies": {

src/components/LcErrors.vue

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/components/LcFieldRules.vue

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)