@timus-networks/theme 2.0.0 → 2.0.2
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/README.md +113 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +11 -0
- package/dist/module.d.ts +11 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +181 -0
- package/dist/runtime/components/development/example.alert.vue +29 -0
- package/dist/runtime/components/development/example.avatar.vue +85 -0
- package/dist/runtime/components/development/example.badge.vue +93 -0
- package/dist/runtime/components/development/example.breadcrumb.vue +54 -0
- package/dist/runtime/components/development/example.button.vue +235 -0
- package/dist/runtime/components/development/example.button.vue.d.ts +11 -0
- package/dist/runtime/components/development/example.card.vue +68 -0
- package/dist/runtime/components/development/example.checkbox.vue +176 -0
- package/dist/runtime/components/development/example.checkbox.vue.d.ts +24 -0
- package/dist/runtime/components/development/example.collapse.vue +38 -0
- package/dist/runtime/components/development/example.datepicker.vue +193 -0
- package/dist/runtime/components/development/example.description.vue +94 -0
- package/dist/runtime/components/development/example.dialog.vue +79 -0
- package/dist/runtime/components/development/example.dropdown.vue +166 -0
- package/dist/runtime/components/development/example.form.vue +488 -0
- package/dist/runtime/components/development/example.input.vue +270 -0
- package/dist/runtime/components/development/example.input.vue.d.ts +23 -0
- package/dist/runtime/components/development/example.link.vue +68 -0
- package/dist/runtime/components/development/example.message.vue +64 -0
- package/dist/runtime/components/development/example.notification.vue +75 -0
- package/dist/runtime/components/development/example.number.vue +70 -0
- package/dist/runtime/components/development/example.pagination.vue +89 -0
- package/dist/runtime/components/development/example.popover.vue +151 -0
- package/dist/runtime/components/development/example.radio.vue +163 -0
- package/dist/runtime/components/development/example.radio.vue.d.ts +25 -0
- package/dist/runtime/components/development/example.select.vue +588 -0
- package/dist/runtime/components/development/example.select.vue.d.ts +70 -0
- package/dist/runtime/components/development/example.sidebar.vue +101 -0
- package/dist/runtime/components/development/example.static.vue +50 -0
- package/dist/runtime/components/development/example.switch.vue +101 -0
- package/dist/runtime/components/development/example.table.vue +112 -0
- package/dist/runtime/components/development/example.tag.vue +255 -0
- package/dist/runtime/components/development/example.timepicker.vue +89 -0
- package/dist/runtime/components/development/example.tooltip.vue +104 -0
- package/dist/runtime/components/development/example.upload.vue +84 -0
- package/dist/runtime/components/production/html-encode.vue +96 -0
- package/dist/runtime/components/production/timus-breadcrumb.d.ts +36 -0
- package/dist/runtime/components/production/timus-breadcrumb.js +224 -0
- package/dist/runtime/components/production/timus-breadcrumb.mjs +224 -0
- package/dist/runtime/components/production/timus-breadcrumb.vue +83 -0
- package/dist/runtime/components/production/timus-breadcrumb.vue.d.ts +340 -0
- package/dist/runtime/composables/useBreadcrumb.d.ts +8 -0
- package/dist/runtime/composables/useBreadcrumb.js +53 -0
- package/dist/runtime/composables/useBreadcrumb.mjs +53 -0
- package/dist/runtime/pages/theme.vue +61 -0
- package/dist/runtime/plugins/disable-warnings-plugin.d.ts +2 -0
- package/dist/runtime/plugins/disable-warnings-plugin.js +18 -0
- package/dist/runtime/plugins/disable-warnings-plugin.mjs +18 -0
- package/dist/runtime/plugins/sample-plugin.d.ts +20 -0
- package/dist/runtime/plugins/sample-plugin.js +5 -0
- package/dist/runtime/plugins/sample-plugin.mjs +5 -0
- package/dist/runtime/plugins/theme-provider-plugin.d.ts +30 -0
- package/dist/runtime/plugins/theme-provider-plugin.js +46 -0
- package/dist/runtime/plugins/theme-provider-plugin.mjs +46 -0
- package/dist/runtime/public/scss/element-plus/affix.css +305 -0
- package/dist/runtime/public/scss/element-plus/alert.css +516 -0
- package/dist/runtime/public/scss/element-plus/anchor-link.css +332 -0
- package/dist/runtime/public/scss/element-plus/anchor.css +376 -0
- package/dist/runtime/public/scss/element-plus/aside.css +308 -0
- package/dist/runtime/public/scss/element-plus/autocomplete.css +411 -0
- package/dist/runtime/public/scss/element-plus/avatar.css +370 -0
- package/dist/runtime/public/scss/element-plus/backtop.css +326 -0
- package/dist/runtime/public/scss/element-plus/badge.css +376 -0
- package/dist/runtime/public/scss/element-plus/base.css +550 -0
- package/dist/runtime/public/scss/element-plus/breadcrumb-item.css +0 -0
- package/dist/runtime/public/scss/element-plus/breadcrumb.css +370 -0
- package/dist/runtime/public/scss/element-plus/button-group.css +535 -0
- package/dist/runtime/public/scss/element-plus/button.css +1089 -0
- package/dist/runtime/public/scss/element-plus/calendar.css +370 -0
- package/dist/runtime/public/scss/element-plus/card.css +347 -0
- package/dist/runtime/public/scss/element-plus/carousel-item.css +350 -0
- package/dist/runtime/public/scss/element-plus/carousel.css +475 -0
- package/dist/runtime/public/scss/element-plus/cascader-panel.css +428 -0
- package/dist/runtime/public/scss/element-plus/cascader.css +560 -0
- package/dist/runtime/public/scss/element-plus/check-tag.css +386 -0
- package/dist/runtime/public/scss/element-plus/checkbox-button.css +451 -0
- package/dist/runtime/public/scss/element-plus/checkbox-group.css +307 -0
- package/dist/runtime/public/scss/element-plus/checkbox.css +588 -0
- package/dist/runtime/public/scss/element-plus/col.css +3270 -0
- package/dist/runtime/public/scss/element-plus/collapse-item.css +0 -0
- package/dist/runtime/public/scss/element-plus/collapse-transition.css +0 -0
- package/dist/runtime/public/scss/element-plus/collapse.css +490 -0
- package/dist/runtime/public/scss/element-plus/color/index.css +0 -0
- package/dist/runtime/public/scss/element-plus/color-picker.css +650 -0
- package/dist/runtime/public/scss/element-plus/common/popup.css +338 -0
- package/dist/runtime/public/scss/element-plus/common/transition.css +420 -0
- package/dist/runtime/public/scss/element-plus/common/var.css +302 -0
- package/dist/runtime/public/scss/element-plus/config-provider.css +0 -0
- package/dist/runtime/public/scss/element-plus/container.css +313 -0
- package/dist/runtime/public/scss/element-plus/dark/css-vars.css +353 -0
- package/dist/runtime/public/scss/element-plus/dark/var.css +302 -0
- package/dist/runtime/public/scss/element-plus/date-picker/date-picker.css +558 -0
- package/dist/runtime/public/scss/element-plus/date-picker/date-range-picker.css +410 -0
- package/dist/runtime/public/scss/element-plus/date-picker/date-table.css +426 -0
- package/dist/runtime/public/scss/element-plus/date-picker/month-table.css +388 -0
- package/dist/runtime/public/scss/element-plus/date-picker/picker-panel.css +454 -0
- package/dist/runtime/public/scss/element-plus/date-picker/picker.css +662 -0
- package/dist/runtime/public/scss/element-plus/date-picker/time-picker.css +384 -0
- package/dist/runtime/public/scss/element-plus/date-picker/time-range-picker.css +338 -0
- package/dist/runtime/public/scss/element-plus/date-picker/time-spinner.css +389 -0
- package/dist/runtime/public/scss/element-plus/date-picker/year-table.css +384 -0
- package/dist/runtime/public/scss/element-plus/date-picker.css +1531 -0
- package/dist/runtime/public/scss/element-plus/descriptions-item.css +347 -0
- package/dist/runtime/public/scss/element-plus/descriptions.css +435 -0
- package/dist/runtime/public/scss/element-plus/dialog.css +512 -0
- package/dist/runtime/public/scss/element-plus/display.css +357 -0
- package/dist/runtime/public/scss/element-plus/divider.css +345 -0
- package/dist/runtime/public/scss/element-plus/drawer.css +419 -0
- package/dist/runtime/public/scss/element-plus/dropdown-item.css +0 -0
- package/dist/runtime/public/scss/element-plus/dropdown-menu.css +0 -0
- package/dist/runtime/public/scss/element-plus/dropdown.css +495 -0
- package/dist/runtime/public/scss/element-plus/empty.css +355 -0
- package/dist/runtime/public/scss/element-plus/footer.css +310 -0
- package/dist/runtime/public/scss/element-plus/form-item.css +0 -0
- package/dist/runtime/public/scss/element-plus/form.css +527 -0
- package/dist/runtime/public/scss/element-plus/header.css +310 -0
- package/dist/runtime/public/scss/element-plus/icon.css +343 -0
- package/dist/runtime/public/scss/element-plus/image-viewer.css +439 -0
- package/dist/runtime/public/scss/element-plus/image.css +343 -0
- package/dist/runtime/public/scss/element-plus/index.css +17293 -0
- package/dist/runtime/public/scss/element-plus/infinite-scroll.css +0 -0
- package/dist/runtime/public/scss/element-plus/input-number.css +494 -0
- package/dist/runtime/public/scss/element-plus/input.css +770 -0
- package/dist/runtime/public/scss/element-plus/link.css +453 -0
- package/dist/runtime/public/scss/element-plus/loading.css +391 -0
- package/dist/runtime/public/scss/element-plus/main.css +311 -0
- package/dist/runtime/public/scss/element-plus/mention.css +413 -0
- package/dist/runtime/public/scss/element-plus/menu-item-group.css +0 -0
- package/dist/runtime/public/scss/element-plus/menu-item.css +0 -0
- package/dist/runtime/public/scss/element-plus/menu.css +737 -0
- package/dist/runtime/public/scss/element-plus/message-box.css +533 -0
- package/dist/runtime/public/scss/element-plus/message.css +528 -0
- package/dist/runtime/public/scss/element-plus/mixins/config.css +0 -0
- package/dist/runtime/public/scss/element-plus/mixins/function.css +0 -0
- package/dist/runtime/public/scss/element-plus/mixins/mixins.css +302 -0
- package/dist/runtime/public/scss/element-plus/mixins/utils.css +0 -0
- package/dist/runtime/public/scss/element-plus/notification.css +413 -0
- package/dist/runtime/public/scss/element-plus/option-group.css +331 -0
- package/dist/runtime/public/scss/element-plus/option.css +354 -0
- package/dist/runtime/public/scss/element-plus/overlay.css +317 -0
- package/dist/runtime/public/scss/element-plus/page-header.css +351 -0
- package/dist/runtime/public/scss/element-plus/pagination.css +586 -0
- package/dist/runtime/public/scss/element-plus/popconfirm.css +315 -0
- package/dist/runtime/public/scss/element-plus/popover.css +352 -0
- package/dist/runtime/public/scss/element-plus/popper.css +400 -0
- package/dist/runtime/public/scss/element-plus/progress.css +449 -0
- package/dist/runtime/public/scss/element-plus/radio-button.css +436 -0
- package/dist/runtime/public/scss/element-plus/radio-group.css +308 -0
- package/dist/runtime/public/scss/element-plus/radio.css +561 -0
- package/dist/runtime/public/scss/element-plus/rate.css +384 -0
- package/dist/runtime/public/scss/element-plus/reset.css +399 -0
- package/dist/runtime/public/scss/element-plus/result.css +381 -0
- package/dist/runtime/public/scss/element-plus/row.css +339 -0
- package/dist/runtime/public/scss/element-plus/scrollbar.css +373 -0
- package/dist/runtime/public/scss/element-plus/segmented.css +460 -0
- package/dist/runtime/public/scss/element-plus/select-dropdown-v2.css +351 -0
- package/dist/runtime/public/scss/element-plus/select-dropdown.css +351 -0
- package/dist/runtime/public/scss/element-plus/select-v2.css +765 -0
- package/dist/runtime/public/scss/element-plus/select.css +765 -0
- package/dist/runtime/public/scss/element-plus/skeleton-item.css +372 -0
- package/dist/runtime/public/scss/element-plus/skeleton.css +335 -0
- package/dist/runtime/public/scss/element-plus/slider.css +480 -0
- package/dist/runtime/public/scss/element-plus/space.css +317 -0
- package/dist/runtime/public/scss/element-plus/spinner.css +342 -0
- package/dist/runtime/public/scss/element-plus/statistic.css +336 -0
- package/dist/runtime/public/scss/element-plus/step.css +586 -0
- package/dist/runtime/public/scss/element-plus/steps.css +319 -0
- package/dist/runtime/public/scss/element-plus/sub-menu.css +0 -0
- package/dist/runtime/public/scss/element-plus/switch.css +594 -0
- package/dist/runtime/public/scss/element-plus/tab-pane.css +0 -0
- package/dist/runtime/public/scss/element-plus/table-column.css +382 -0
- package/dist/runtime/public/scss/element-plus/table-v2.css +520 -0
- package/dist/runtime/public/scss/element-plus/table.css +893 -0
- package/dist/runtime/public/scss/element-plus/tabs.css +892 -0
- package/dist/runtime/public/scss/element-plus/tag.css +624 -0
- package/dist/runtime/public/scss/element-plus/text.css +378 -0
- package/dist/runtime/public/scss/element-plus/time-picker.css +1023 -0
- package/dist/runtime/public/scss/element-plus/time-select.css +946 -0
- package/dist/runtime/public/scss/element-plus/timeline-item.css +415 -0
- package/dist/runtime/public/scss/element-plus/timeline.css +334 -0
- package/dist/runtime/public/scss/element-plus/tooltip-v2.css +410 -0
- package/dist/runtime/public/scss/element-plus/tooltip.css +0 -0
- package/dist/runtime/public/scss/element-plus/tour.css +461 -0
- package/dist/runtime/public/scss/element-plus/transfer.css +497 -0
- package/dist/runtime/public/scss/element-plus/tree-select.css +325 -0
- package/dist/runtime/public/scss/element-plus/tree.css +538 -0
- package/dist/runtime/public/scss/element-plus/upload.css +862 -0
- package/dist/runtime/public/scss/element-plus/var.css +389 -0
- package/dist/runtime/public/scss/element-plus/virtual-list.css +330 -0
- package/dist/runtime/public/scss/theme.css +1268 -0
- package/dist/runtime/server/tsconfig.json +6 -0
- package/dist/runtime/types.d.ts +31 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/package.json +29 -12
- package/components/TimusIcons.vue +0 -54
- package/generate-icon.js +0 -22
- package/module.ts +0 -84
- package/pages/icons.vue +0 -46
- package/plugins/sample-plugin.ts +0 -5
- package/public/isax/fonts/iconsax.svg +0 -927
- package/public/isax/fonts/iconsax.ttf +0 -0
- package/public/isax/fonts/iconsax.woff +0 -0
- package/public/isax/icons.json +0 -899
- package/public/isax/selection.json +0 -1
- package/public/isax/style.css +0 -1
- package/public/isax/style.scss +0 -5435
- package/public/isax/variables.scss +0 -900
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-8 mb-16">
|
|
3
|
+
<h1 class="">Form</h1>
|
|
4
|
+
<p>Form consists of input, radio, select, checkbox and so on. With form, you can collect, verify and submit data.</p>
|
|
5
|
+
|
|
6
|
+
<el-card>
|
|
7
|
+
<template #header>Basic Form</template>
|
|
8
|
+
<div class="flex flex-col gap-3 items-start">
|
|
9
|
+
<p>
|
|
10
|
+
It includes all kinds of input items, such as input, select, radio and checkbox. In each form component, you need a form-item field to be the container of your input
|
|
11
|
+
item.
|
|
12
|
+
</p>
|
|
13
|
+
<div class="flex gap-2">
|
|
14
|
+
<el-form :model="form" label-width="auto" style="max-width: 600px" :label-position="labelPosition" require-asterisk-position="right">
|
|
15
|
+
<el-form-item label="Form Align" :required="true" class="grow">
|
|
16
|
+
<el-radio-group v-model="labelPosition" aria-label="label position">
|
|
17
|
+
<el-radio-button value="left">Left</el-radio-button>
|
|
18
|
+
<el-radio-button value="right">Right</el-radio-button>
|
|
19
|
+
<el-radio-button value="top">Top</el-radio-button>
|
|
20
|
+
</el-radio-group>
|
|
21
|
+
</el-form-item>
|
|
22
|
+
<el-form-item label="Activity name" class="grow">
|
|
23
|
+
<el-input v-model="form.name" />
|
|
24
|
+
</el-form-item>
|
|
25
|
+
<el-form-item label="Activity form">
|
|
26
|
+
<el-input v-model="form.desc" type="textarea" />
|
|
27
|
+
</el-form-item>
|
|
28
|
+
<el-form-item label="Instant delivery">
|
|
29
|
+
<el-switch v-model="form.delivery" />
|
|
30
|
+
</el-form-item>
|
|
31
|
+
<el-form-item label="Activity type">
|
|
32
|
+
<el-checkbox-group v-model="form.type">
|
|
33
|
+
<el-checkbox value="Online activities" name="type"> Online activities </el-checkbox>
|
|
34
|
+
<el-checkbox value="Promotion activities" name="type"> Promotion activities </el-checkbox>
|
|
35
|
+
<el-checkbox value="Offline activities" name="type"> Offline activities </el-checkbox>
|
|
36
|
+
<el-checkbox value="Simple brand exposure" name="type"> Simple brand exposure </el-checkbox>
|
|
37
|
+
</el-checkbox-group>
|
|
38
|
+
</el-form-item>
|
|
39
|
+
<el-form-item label="Resources">
|
|
40
|
+
<el-radio-group v-model="form.resource">
|
|
41
|
+
<el-radio value="Sponsor">Sponsor</el-radio>
|
|
42
|
+
<el-radio value="Venue">Venue</el-radio>
|
|
43
|
+
</el-radio-group>
|
|
44
|
+
</el-form-item>
|
|
45
|
+
<el-form-item label="Activity time">
|
|
46
|
+
<el-col :span="11">
|
|
47
|
+
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" />
|
|
48
|
+
</el-col>
|
|
49
|
+
<el-col :span="2" class="text-center">
|
|
50
|
+
<span class="text-gray-500">-</span>
|
|
51
|
+
</el-col>
|
|
52
|
+
<el-col :span="11">
|
|
53
|
+
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
|
|
54
|
+
</el-col>
|
|
55
|
+
</el-form-item>
|
|
56
|
+
<el-form-item class="flex gap-7">
|
|
57
|
+
<el-button class="mr-7.5" type="primary" @click="onSubmit">Create</el-button>
|
|
58
|
+
<el-button>Cancel</el-button>
|
|
59
|
+
</el-form-item>
|
|
60
|
+
</el-form>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<template #footer> <html-encode :tag="snippets.basic" /> </template>
|
|
65
|
+
</el-card>
|
|
66
|
+
|
|
67
|
+
<el-card>
|
|
68
|
+
<template #header> Same Line Form Items </template>
|
|
69
|
+
<div class="flex flex-col gap-3 items-start">
|
|
70
|
+
<p>
|
|
71
|
+
Add a <el-text tag="mark">div</el-text> with a class name containing <el-text tag="mark">.el-form-items</el-text> to make the form items appear on the same line, which
|
|
72
|
+
will automatically add a 30px gap between them.
|
|
73
|
+
</p>
|
|
74
|
+
<div class="flex gap-2">
|
|
75
|
+
<el-form :model="form" label-width="auto" :label-position="labelPosition" require-asterisk-position="right">
|
|
76
|
+
<div class="el-form-items">
|
|
77
|
+
<el-form-item label="Activity form">
|
|
78
|
+
<el-input v-model="form.input" />
|
|
79
|
+
</el-form-item>
|
|
80
|
+
<el-form-item label="Activity zone">
|
|
81
|
+
<el-select v-model="form.region" placeholder="please select your zone" class="!w-32">
|
|
82
|
+
<el-option label="Zone one" value="shanghai" />
|
|
83
|
+
<el-option label="Zone two" value="beijing" />
|
|
84
|
+
</el-select>
|
|
85
|
+
</el-form-item>
|
|
86
|
+
<el-form-item label="Activity form">
|
|
87
|
+
<el-input v-model="form.input" />
|
|
88
|
+
</el-form-item>
|
|
89
|
+
<el-form-item label="Deactivity form">
|
|
90
|
+
<el-input v-model="form.input" />
|
|
91
|
+
</el-form-item>
|
|
92
|
+
<el-form-item label="Activity zone" class="w-32">
|
|
93
|
+
<el-select v-model="form.region" placeholder="please select your zone">
|
|
94
|
+
<el-option label="Zone one" value="shanghai" />
|
|
95
|
+
<el-option label="Zone two" value="beijing" />
|
|
96
|
+
</el-select>
|
|
97
|
+
</el-form-item>
|
|
98
|
+
<el-form-item>
|
|
99
|
+
<el-button class="isax-add" />
|
|
100
|
+
</el-form-item>
|
|
101
|
+
</div>
|
|
102
|
+
</el-form>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<template #footer> <html-encode :tag="snippets.same_line" /> </template>
|
|
107
|
+
</el-card>
|
|
108
|
+
|
|
109
|
+
<el-card>
|
|
110
|
+
<template #header> Sticky Form Items </template>
|
|
111
|
+
<div class="flex flex-col gap-3 items-start">
|
|
112
|
+
<p>
|
|
113
|
+
Add a <el-text tag="mark">div</el-text> with a class name containing <el-text tag="mark">sticky</el-text> and <el-text tag="mark">el-form-items</el-text> to make it stick
|
|
114
|
+
to others.
|
|
115
|
+
</p>
|
|
116
|
+
<div class="flex gap-2">
|
|
117
|
+
<el-form :model="form" label-width="auto" :label-position="labelPosition" require-asterisk-position="right">
|
|
118
|
+
<div class="el-form-items sticky">
|
|
119
|
+
<el-form-item label="Activity form">
|
|
120
|
+
<el-input v-model="form.input" />
|
|
121
|
+
</el-form-item>
|
|
122
|
+
<el-form-item label="Activity zone">
|
|
123
|
+
<el-select v-model="form.region" placeholder="please select your zone" class="!w-32">
|
|
124
|
+
<el-option label="Zone one" value="shanghai" />
|
|
125
|
+
<el-option label="Zone two" value="beijing" />
|
|
126
|
+
</el-select>
|
|
127
|
+
</el-form-item>
|
|
128
|
+
<el-form-item label="Activity form">
|
|
129
|
+
<el-input v-model="form.input" />
|
|
130
|
+
</el-form-item>
|
|
131
|
+
<el-form-item label="Deactivity form">
|
|
132
|
+
<el-input v-model="form.input" />
|
|
133
|
+
</el-form-item>
|
|
134
|
+
<el-form-item label="Activity zone" class="w-32">
|
|
135
|
+
<el-select v-model="form.region" placeholder="please select your zone">
|
|
136
|
+
<el-option label="Zone one" value="shanghai" />
|
|
137
|
+
<el-option label="Zone two" value="beijing" />
|
|
138
|
+
</el-select>
|
|
139
|
+
</el-form-item>
|
|
140
|
+
<el-form-item>
|
|
141
|
+
<el-button class="isax-add" />
|
|
142
|
+
</el-form-item>
|
|
143
|
+
</div>
|
|
144
|
+
</el-form>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<template #footer> <html-encode :tag="snippets.sticky" /> </template>
|
|
148
|
+
</el-card>
|
|
149
|
+
|
|
150
|
+
<el-card>
|
|
151
|
+
<template #header> Validation </template>
|
|
152
|
+
<div class="flex flex-col gap-3 items-start">
|
|
153
|
+
<p>
|
|
154
|
+
Form component allows you to verify your data, helping you find and correct errors. Just add the <el-text tag="mark">rules</el-text> attribute for
|
|
155
|
+
<el-text tag="mark">Form</el-text> component, pass validation rules, and set prop attribute for FormItem as a specific key that needs to be validated. See more
|
|
156
|
+
information at <a href="https://github.com/yiminghe/async-validator" target="_blank">async-validator</a>.
|
|
157
|
+
</p>
|
|
158
|
+
<div class="flex gap-2">
|
|
159
|
+
<el-form
|
|
160
|
+
ref="ruleFormRef"
|
|
161
|
+
style="max-width: 600px"
|
|
162
|
+
:model="ruleForm"
|
|
163
|
+
:rules="rules"
|
|
164
|
+
label-width="auto"
|
|
165
|
+
class="demo-ruleForm"
|
|
166
|
+
:size="formSize"
|
|
167
|
+
status-icon
|
|
168
|
+
require-asterisk-position="right"
|
|
169
|
+
label-position="top"
|
|
170
|
+
>
|
|
171
|
+
<el-form-item label="Activity name" prop="name">
|
|
172
|
+
<el-input v-model="ruleForm.name" />
|
|
173
|
+
</el-form-item>
|
|
174
|
+
<el-form-item label="Activity zone" prop="region">
|
|
175
|
+
<el-select v-model="ruleForm.region" placeholder="Activity zone">
|
|
176
|
+
<el-option label="Zone one" value="shanghai" />
|
|
177
|
+
<el-option label="Zone two" value="beijing" />
|
|
178
|
+
</el-select>
|
|
179
|
+
</el-form-item>
|
|
180
|
+
<el-form-item label="Activity count" prop="count">
|
|
181
|
+
<el-select-v2 v-model="ruleForm.count" placeholder="Activity count" :options="options" />
|
|
182
|
+
</el-form-item>
|
|
183
|
+
<el-form-item label="Activity time" required>
|
|
184
|
+
<el-col :span="11">
|
|
185
|
+
<el-form-item prop="date1">
|
|
186
|
+
<el-input v-model="ruleForm.name" />
|
|
187
|
+
</el-form-item>
|
|
188
|
+
</el-col>
|
|
189
|
+
<el-col class="text-center" :span="2">
|
|
190
|
+
<span class="text-gray-500">-</span>
|
|
191
|
+
</el-col>
|
|
192
|
+
<el-col :span="11">
|
|
193
|
+
<el-form-item prop="date2">
|
|
194
|
+
<el-input v-model="ruleForm.name" />
|
|
195
|
+
</el-form-item>
|
|
196
|
+
</el-col>
|
|
197
|
+
</el-form-item>
|
|
198
|
+
<div label="Activity time" required class="el-form-items sticky">
|
|
199
|
+
<el-form-item prop="date1" label="Date 1">
|
|
200
|
+
<el-date-picker v-model="ruleForm.date1" type="date" aria-label="Pick a date" placeholder="Pick a date" style="width: 100%" />
|
|
201
|
+
</el-form-item>
|
|
202
|
+
<el-form-item prop="date2">
|
|
203
|
+
<el-time-picker v-model="ruleForm.date2" aria-label="Pick a time" placeholder="Pick a time" style="width: 100%" />
|
|
204
|
+
</el-form-item>
|
|
205
|
+
</div>
|
|
206
|
+
<el-form-item label="Instant delivery" prop="delivery">
|
|
207
|
+
<el-switch v-model="ruleForm.delivery" />
|
|
208
|
+
</el-form-item>
|
|
209
|
+
<el-form-item label="Activity location" prop="location">
|
|
210
|
+
<el-segmented v-model="ruleForm.location" :options="locationOptions" />
|
|
211
|
+
</el-form-item>
|
|
212
|
+
<el-form-item label="Activity type" prop="type">
|
|
213
|
+
<el-checkbox-group v-model="ruleForm.type">
|
|
214
|
+
<el-checkbox value="Online activities" name="type"> Online activities </el-checkbox>
|
|
215
|
+
<el-checkbox value="Promotion activities" name="type"> Promotion activities </el-checkbox>
|
|
216
|
+
<el-checkbox value="Offline activities" name="type"> Offline activities </el-checkbox>
|
|
217
|
+
<el-checkbox value="Simple brand exposure" name="type"> Simple brand exposure </el-checkbox>
|
|
218
|
+
</el-checkbox-group>
|
|
219
|
+
</el-form-item>
|
|
220
|
+
<el-form-item label="Resources" prop="resource">
|
|
221
|
+
<el-radio-group v-model="ruleForm.resource">
|
|
222
|
+
<el-radio value="Sponsorship">Sponsorship</el-radio>
|
|
223
|
+
<el-radio value="Venue">Venue</el-radio>
|
|
224
|
+
</el-radio-group>
|
|
225
|
+
</el-form-item>
|
|
226
|
+
<el-form-item label="Activity form" prop="desc">
|
|
227
|
+
<el-input v-model="ruleForm.desc" type="textarea" />
|
|
228
|
+
</el-form-item>
|
|
229
|
+
<el-form-item>
|
|
230
|
+
<el-button type="primary" class="mr-7.5" @click="submitForm(ruleFormRef)"> Create </el-button>
|
|
231
|
+
<el-button @click="resetForm(ruleFormRef)">Reset</el-button>
|
|
232
|
+
</el-form-item>
|
|
233
|
+
</el-form>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
<template #footer> <html-encode :tag="snippets.validation" /> </template>
|
|
237
|
+
</el-card>
|
|
238
|
+
|
|
239
|
+
<el-card>
|
|
240
|
+
<template #header> Sizes </template>
|
|
241
|
+
<div class="flex flex-col gap-3 items-start">
|
|
242
|
+
<p>
|
|
243
|
+
All components in a Form inherit their <el-text tag="mark">size</el-text> attribute from that Form. Similarly, FormItem also has a size attribute. Still you can fine tune
|
|
244
|
+
each component's size if you don't want that component to inherit its size from From or FormItem.
|
|
245
|
+
</p>
|
|
246
|
+
<div class="flex flex-col gap-7.5">
|
|
247
|
+
<div class="flex gap-7.5">
|
|
248
|
+
<el-radio-group v-model="formSize" aria-label="size control">
|
|
249
|
+
<el-radio-button value="default">default</el-radio-button>
|
|
250
|
+
<el-radio-button value="large">large</el-radio-button>
|
|
251
|
+
<el-radio-button value="medium">medium</el-radio-button>
|
|
252
|
+
<el-radio-button value="small">small</el-radio-button>
|
|
253
|
+
<el-radio-button value="mini">mini</el-radio-button>
|
|
254
|
+
</el-radio-group>
|
|
255
|
+
<el-radio-group v-model="labelPosition" aria-label="position control">
|
|
256
|
+
<el-radio-button value="left">Left</el-radio-button>
|
|
257
|
+
<el-radio-button value="right">Right</el-radio-button>
|
|
258
|
+
<el-radio-button value="top">Top</el-radio-button>
|
|
259
|
+
</el-radio-group>
|
|
260
|
+
</div>
|
|
261
|
+
<el-form style="max-width: 600px" :model="ruleForm" label-width="auto" :label-position="labelPosition" :size="formSize">
|
|
262
|
+
<el-form-item label="Activity name">
|
|
263
|
+
<el-input v-model="ruleForm.name" />
|
|
264
|
+
</el-form-item>
|
|
265
|
+
<el-form-item label="Activity zone">
|
|
266
|
+
<el-select v-model="ruleForm.region" placeholder="please select your zone">
|
|
267
|
+
<el-option label="Zone one" value="shanghai" />
|
|
268
|
+
<el-option label="Zone two" value="beijing" />
|
|
269
|
+
</el-select>
|
|
270
|
+
</el-form-item>
|
|
271
|
+
<el-form-item label="Activity time">
|
|
272
|
+
<el-col :span="11">
|
|
273
|
+
<el-date-picker v-model="ruleForm.date1" type="date" aria-label="Pick a date" placeholder="Pick a date" style="width: 100%" />
|
|
274
|
+
</el-col>
|
|
275
|
+
<el-col class="text-center" :span="1" style="margin: 0 0.5rem">-</el-col>
|
|
276
|
+
<el-col :span="11">
|
|
277
|
+
<el-time-picker v-model="ruleForm.date2" aria-label="Pick a time" placeholder="Pick a time" style="width: 100%" />
|
|
278
|
+
</el-col>
|
|
279
|
+
</el-form-item>
|
|
280
|
+
<el-form-item label="Activity type">
|
|
281
|
+
<el-checkbox-group v-model="ruleForm.type">
|
|
282
|
+
<el-checkbox-button value="Online activities" name="type"> Online activities </el-checkbox-button>
|
|
283
|
+
<el-checkbox-button value="Promotion activities" name="type"> Promotion activities </el-checkbox-button>
|
|
284
|
+
</el-checkbox-group>
|
|
285
|
+
</el-form-item>
|
|
286
|
+
<el-form-item label="Resources">
|
|
287
|
+
<el-radio-group v-model="ruleForm.resource">
|
|
288
|
+
<el-radio border value="Sponsor">Sponsor</el-radio>
|
|
289
|
+
<el-radio border value="Venue">Venue</el-radio>
|
|
290
|
+
</el-radio-group>
|
|
291
|
+
</el-form-item>
|
|
292
|
+
<el-form-item>
|
|
293
|
+
<el-button type="primary" class="mr-7.5" @click="onSubmit">Create</el-button>
|
|
294
|
+
<el-button>Cancel</el-button>
|
|
295
|
+
</el-form-item>
|
|
296
|
+
</el-form>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
<template #footer> <html-encode :tag="snippets.size" /> </template>
|
|
300
|
+
</el-card>
|
|
301
|
+
</div>
|
|
302
|
+
</template>
|
|
303
|
+
|
|
304
|
+
<script lang="ts" setup>
|
|
305
|
+
import type { FormProps } from 'element-plus';
|
|
306
|
+
import { reactive, ref } from 'vue';
|
|
307
|
+
|
|
308
|
+
// do not use same name with ref
|
|
309
|
+
const form = reactive({
|
|
310
|
+
name: '',
|
|
311
|
+
region: '',
|
|
312
|
+
date1: '',
|
|
313
|
+
date2: '',
|
|
314
|
+
delivery: false,
|
|
315
|
+
input: '',
|
|
316
|
+
type: [],
|
|
317
|
+
resource: '',
|
|
318
|
+
desc: '',
|
|
319
|
+
});
|
|
320
|
+
const onSubmit = () => {
|
|
321
|
+
console.log('submit!');
|
|
322
|
+
};
|
|
323
|
+
const labelPosition = ref<FormProps['labelPosition']>('top');
|
|
324
|
+
const snippets = ref({
|
|
325
|
+
basic: `
|
|
326
|
+
<el-form :model="form" label-width="auto" :label-position="top" require-asterisk-position="right">
|
|
327
|
+
</el-form>`,
|
|
328
|
+
same_line: `
|
|
329
|
+
<el-form :model="form" label-width="auto" :label-position="top" require-asterisk-position="right">
|
|
330
|
+
<div class="el-form-items">
|
|
331
|
+
<el-form-item label="Activity form">
|
|
332
|
+
<el-input v-model="form.input" />
|
|
333
|
+
</el-form-item>
|
|
334
|
+
<el-form-item label="Activity zone">
|
|
335
|
+
<el-select v-model="form.region" placeholder="please select your zone" class="!w-32">
|
|
336
|
+
<el-option label="Zone one" value="shanghai" />
|
|
337
|
+
<el-option label="Zone two" value="beijing" />
|
|
338
|
+
</el-select>
|
|
339
|
+
</el-form-item>
|
|
340
|
+
<el-form-item>
|
|
341
|
+
<el-button class="isax-add" />
|
|
342
|
+
</el-form-item>
|
|
343
|
+
</div>
|
|
344
|
+
</el-form>`,
|
|
345
|
+
sticky: `
|
|
346
|
+
<el-form :model="form" label-width="auto" :label-position="top" require-asterisk-position="right">
|
|
347
|
+
<div class="el-form-items sticky">
|
|
348
|
+
<el-form-item label="Activity form">
|
|
349
|
+
<el-input v-model="form.input" />
|
|
350
|
+
</el-form-item>
|
|
351
|
+
<el-form-item label="Activity zone">
|
|
352
|
+
<el-select v-model="form.region" placeholder="please select your zone" class="!w-32">
|
|
353
|
+
<el-option label="Zone one" value="shanghai" />
|
|
354
|
+
<el-option label="Zone two" value="beijing" />
|
|
355
|
+
</el-select>
|
|
356
|
+
</el-form-item>
|
|
357
|
+
<el-form-item>
|
|
358
|
+
<el-button class="isax-add" />
|
|
359
|
+
</el-form-item>
|
|
360
|
+
</div>
|
|
361
|
+
</el-form>
|
|
362
|
+
`,
|
|
363
|
+
validation: `
|
|
364
|
+
<el-form
|
|
365
|
+
ref="ruleFormRef"
|
|
366
|
+
style="max-width: 600px"
|
|
367
|
+
:model="ruleForm"
|
|
368
|
+
:rules="rules"
|
|
369
|
+
label-width="auto"
|
|
370
|
+
class="demo-ruleForm"
|
|
371
|
+
:size="formSize"
|
|
372
|
+
status-icon
|
|
373
|
+
require-asterisk-position="right"
|
|
374
|
+
label-position="top"
|
|
375
|
+
/>`,
|
|
376
|
+
size: `<el-form size="large" :model="ruleForm" label-width="auto" label-position="top"></el-form>`,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Rules
|
|
380
|
+
|
|
381
|
+
import type { ComponentSize, FormInstance, FormRules } from 'element-plus';
|
|
382
|
+
|
|
383
|
+
interface RuleForm {
|
|
384
|
+
name: string;
|
|
385
|
+
region: string;
|
|
386
|
+
count: string;
|
|
387
|
+
date1: string;
|
|
388
|
+
date2: string;
|
|
389
|
+
delivery: boolean;
|
|
390
|
+
location: string;
|
|
391
|
+
type: string[];
|
|
392
|
+
resource: string;
|
|
393
|
+
desc: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const formSize = ref<ComponentSize>('default');
|
|
397
|
+
const ruleFormRef = ref<FormInstance>();
|
|
398
|
+
const ruleForm = reactive<RuleForm>({
|
|
399
|
+
name: 'Hello',
|
|
400
|
+
region: '',
|
|
401
|
+
count: '',
|
|
402
|
+
date1: '',
|
|
403
|
+
date2: '',
|
|
404
|
+
delivery: false,
|
|
405
|
+
location: '',
|
|
406
|
+
type: [],
|
|
407
|
+
resource: '',
|
|
408
|
+
desc: '',
|
|
409
|
+
});
|
|
410
|
+
const locationOptions = ['Home', 'Company', 'School'];
|
|
411
|
+
const rules = reactive<FormRules<RuleForm>>({
|
|
412
|
+
name: [
|
|
413
|
+
{ required: true, message: 'Please input Activity name', trigger: 'blur' },
|
|
414
|
+
{ min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
|
|
415
|
+
],
|
|
416
|
+
region: [
|
|
417
|
+
{
|
|
418
|
+
required: true,
|
|
419
|
+
message: 'Please select Activity zone',
|
|
420
|
+
trigger: 'change',
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
count: [
|
|
424
|
+
{
|
|
425
|
+
required: true,
|
|
426
|
+
message: 'Please select Activity count',
|
|
427
|
+
trigger: 'change',
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
date1: [
|
|
431
|
+
{
|
|
432
|
+
type: 'date',
|
|
433
|
+
required: true,
|
|
434
|
+
message: 'Please pick a date',
|
|
435
|
+
trigger: 'change',
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
date2: [
|
|
439
|
+
{
|
|
440
|
+
type: 'date',
|
|
441
|
+
required: true,
|
|
442
|
+
message: 'Please pick a time',
|
|
443
|
+
trigger: 'change',
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
location: [
|
|
447
|
+
{
|
|
448
|
+
required: true,
|
|
449
|
+
message: 'Please select a location',
|
|
450
|
+
trigger: 'change',
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
type: [
|
|
454
|
+
{
|
|
455
|
+
type: 'array',
|
|
456
|
+
required: true,
|
|
457
|
+
message: 'Please select at least one activity type',
|
|
458
|
+
trigger: 'change',
|
|
459
|
+
},
|
|
460
|
+
],
|
|
461
|
+
resource: [
|
|
462
|
+
{
|
|
463
|
+
required: true,
|
|
464
|
+
message: 'Please select activity resource',
|
|
465
|
+
trigger: 'change',
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
desc: [{ required: true, message: 'Please input activity form', trigger: 'blur' }],
|
|
469
|
+
});
|
|
470
|
+
const submitForm = async (formEl: FormInstance | undefined) => {
|
|
471
|
+
if (!formEl) return;
|
|
472
|
+
await formEl.validate((valid: boolean, fields) => {
|
|
473
|
+
if (valid) {
|
|
474
|
+
console.log('submit!');
|
|
475
|
+
} else {
|
|
476
|
+
console.log('error submit!', fields);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
const resetForm = (formEl: FormInstance | undefined) => {
|
|
481
|
+
if (!formEl) return;
|
|
482
|
+
formEl.resetFields();
|
|
483
|
+
};
|
|
484
|
+
const options = Array.from({ length: 10000 }).map((_, idx) => ({
|
|
485
|
+
value: `${idx + 1}`,
|
|
486
|
+
label: `${idx + 1}`,
|
|
487
|
+
}));
|
|
488
|
+
</script>
|