Skip to content

Commit 84b0a2c

Browse files
committed
improve: minor change dev code
1 parent 52fc88c commit 84b0a2c

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

dev/app.vue

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import Vue from "vue";
3434
import VueFormGenerator from "../src";
3535
import DataTable from "./dataTable.vue";
36+
import Fakerator from "fakerator";
3637
3738
import Schema from "./schema";
3839
import { users } from "./data";
@@ -42,6 +43,8 @@
4243
4344
Vue.use(VueFormGenerator);
4445
46+
let fakerator = new Fakerator();
47+
4548
export default {
4649
components: {
4750
DataTable
@@ -181,6 +184,10 @@
181184
182185
ready() {
183186
window.app = this;
187+
188+
if (users.length > 0) {
189+
this.selectRow(null, fakerator.random.arrayElement(users));
190+
}
184191
}
185192
}
186193

dev/schema.js

+16-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
fields: [
1111
{
1212
type: "text",
13-
label: "ID",
13+
label: "ID (disabled text field)",
1414
model: "id",
1515
readonly: true,
1616
editableIfNew: true, // TODO
@@ -19,7 +19,7 @@ module.exports = {
1919
},
2020
{
2121
type: "select",
22-
label: "Type",
22+
label: "Type (select field)",
2323
model: "type",
2424
required: true,
2525
values: [
@@ -70,7 +70,7 @@ module.exports = {
7070
},
7171
{
7272
type: "password",
73-
label: "Password",
73+
label: "Password (password field)",
7474
model: "password",
7575
min: 6,
7676
required: true,
@@ -81,7 +81,7 @@ module.exports = {
8181

8282
{
8383
type: "selectEx",
84-
label: "Skills",
84+
label: "Skills (selectEx field)",
8585
model: "skills",
8686
multi: true,
8787
required: true,
@@ -128,7 +128,7 @@ module.exports = {
128128
},
129129
{
130130
type: "email",
131-
label: "E-mail",
131+
label: "E-mail (email field)",
132132
model: "email",
133133
placeholder: "User's e-mail address"
134134
},
@@ -145,15 +145,15 @@ module.exports = {
145145
},
146146
{
147147
type: "masked",
148-
label: "Mobile",
148+
label: "Mobile (masked field)",
149149
model: "mobile",
150150
mask: "(99) 999-9999",
151151
styleClasses: "half-width",
152152
validator: validators.required
153153
},
154154
{
155155
type: "spectrum",
156-
label: "Color",
156+
label: "Color (spectrum field)",
157157
model: "favoriteColor",
158158
required: true,
159159
colorOptions: {
@@ -163,7 +163,7 @@ module.exports = {
163163
},
164164
{
165165
type: "image",
166-
label: "Avatar",
166+
label: "Avatar (image field)",
167167
model: "avatar",
168168
required: true,
169169
browse: true,
@@ -172,7 +172,7 @@ module.exports = {
172172
},
173173
{
174174
type: "number",
175-
label: "Age",
175+
label: "Age (number field)",
176176
model: "age",
177177
multi: true,
178178
disabled: true,
@@ -187,7 +187,7 @@ module.exports = {
187187
},
188188
{
189189
type: "dateTime",
190-
label: "DOB",
190+
label: "DOB (dateTime field)",
191191
model: "dob",
192192
required: true,
193193
placeholder: "User's birth of date",
@@ -236,7 +236,7 @@ module.exports = {
236236

237237
{
238238
type: "slider",
239-
label: "Rank",
239+
label: "Rank (slider field)",
240240
model: "rank",
241241
multi: true,
242242
min: 1,
@@ -289,12 +289,13 @@ module.exports = {
289289
{ id: "it", name: "Italic" },
290290
{ id: "fr", name: "French" }
291291
],
292+
hint: "Your native language",
292293
styleClasses: "half-width",
293294
validator: validators.required
294295
},
295296
{
296297
type: "selectEx",
297-
label: "Country",
298+
label: "Country (selectEx field)",
298299
model: "address.country",
299300
multi: true,
300301
required: true,
@@ -390,13 +391,13 @@ module.exports = {
390391
},
391392
{
392393
type: "label",
393-
label: "Created",
394+
label: "Created (label field)",
394395
model: "created",
395396
get(model) { return model && model.created ? moment(model.created).format("LLL") : "-"; }
396397
},
397398
{
398399
type: "switch",
399-
label: "Status",
400+
label: "Status (switch field)",
400401
model: "status",
401402
multi: true,
402403
default: true,
@@ -405,7 +406,7 @@ module.exports = {
405406
},
406407
{
407408
type: "textArea",
408-
label: "Biography",
409+
label: "Biography (textArea field)",
409410
model: "bio",
410411
hint: "Max 500 characters",
411412
max: 500,

0 commit comments

Comments
 (0)