@timus-networks/theme 2.0.16 → 2.1.3
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 +187 -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 +35 -12
- package/components/TimusIcons.vue +0 -54
- package/generate-icon.js +0 -22
- package/module.ts +0 -84
- package/pages/icons.vue +0 -37
- 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,151 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-8 mb-16">
|
|
3
|
+
<h1 class="">Popover</h1>
|
|
4
|
+
<p>The Element Plus Popover component provides a customizable tooltip that appears when the user clicks or hovers over an element.</p>
|
|
5
|
+
|
|
6
|
+
<el-card>
|
|
7
|
+
<template #header> Usage </template>
|
|
8
|
+
<div class="flex flex-col gap-4 items-start">
|
|
9
|
+
<p>
|
|
10
|
+
Popover is built with <el-text tag="mark">ElTooltip</el-text>. So for some duplicated attributes, please refer to the documentation of Tooltip. The
|
|
11
|
+
<el-text tag="mark">trigger</el-text> attribute is used to define how popover is triggered: <span class="font-medium">hover, click, focus or contextmenu</span> . If you
|
|
12
|
+
want to manually control it, you can set <el-text tag="mark">:visible</el-text>.
|
|
13
|
+
</p>
|
|
14
|
+
<div class="flex gap-7.5">
|
|
15
|
+
<el-popover placement="top-start" title="Title" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
|
16
|
+
<template #reference>
|
|
17
|
+
<el-button>Hover to activate</el-button>
|
|
18
|
+
</template>
|
|
19
|
+
</el-popover>
|
|
20
|
+
|
|
21
|
+
<el-popover placement="bottom" title="Title" :width="200" trigger="click" content="this is content, this is content, this is content">
|
|
22
|
+
<template #reference>
|
|
23
|
+
<el-button>Click to activate</el-button>
|
|
24
|
+
</template>
|
|
25
|
+
</el-popover>
|
|
26
|
+
|
|
27
|
+
<el-popover ref="popover" placement="right" title="Title" :width="200" trigger="focus" content="this is content, this is content, this is content">
|
|
28
|
+
<template #reference>
|
|
29
|
+
<el-button>Focus to activate</el-button>
|
|
30
|
+
</template>
|
|
31
|
+
</el-popover>
|
|
32
|
+
|
|
33
|
+
<el-popover ref="popover" title="Title" :width="200" trigger="contextmenu" content="this is content, this is content, this is content">
|
|
34
|
+
<template #reference>
|
|
35
|
+
<el-button>contextmenu to activate</el-button>
|
|
36
|
+
</template>
|
|
37
|
+
</el-popover>
|
|
38
|
+
|
|
39
|
+
<el-popover :visible="visible" placement="bottom" title="Title" :width="200" content="this is content, this is content, this is content">
|
|
40
|
+
<template #reference>
|
|
41
|
+
<el-button @click="visible = !visible"> Manual to activate </el-button>
|
|
42
|
+
</template>
|
|
43
|
+
</el-popover>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<template #footer> <html-encode :tag="snippets.basic" /> </template>
|
|
47
|
+
</el-card>
|
|
48
|
+
|
|
49
|
+
<el-card>
|
|
50
|
+
<template #header> Virtual triggering </template>
|
|
51
|
+
<div class="flex flex-col gap-4 items-start">
|
|
52
|
+
<p>
|
|
53
|
+
Like Tooltip, Popover can be triggered by virtual elements, if your use case includes separate the triggering element and the content element, you should definitely use
|
|
54
|
+
the mechanism, normally we use <el-text tag="mark">#reference</el-text> to place our triggering element, with <el-text tag="mark">triggering-element</el-text> API you can
|
|
55
|
+
set your triggering element anywhere you like, but notice that the triggering element should be an element that accepts
|
|
56
|
+
<span class="font-medium">mouse and keyboard</span> event.
|
|
57
|
+
</p>
|
|
58
|
+
<div class="flex gap-2">
|
|
59
|
+
<el-button ref="buttonRef" v-click-outside="onClickOutside"> Click me </el-button>
|
|
60
|
+
<el-popover ref="popoverRef" :virtual-ref="buttonRef" trigger="click" title="With title" virtual-triggering>
|
|
61
|
+
<span> Some content </span>
|
|
62
|
+
</el-popover>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<template #footer> <html-encode :tag="snippets.reference" /> </template>
|
|
66
|
+
</el-card>
|
|
67
|
+
|
|
68
|
+
<el-card>
|
|
69
|
+
<template #header> Nested operation </template>
|
|
70
|
+
<div class="flex flex-col gap-4 items-start">
|
|
71
|
+
<p>Of course, you can nest other operations. It's more light-weight than using a dialog.</p>
|
|
72
|
+
<div class="flex gap-2">
|
|
73
|
+
<el-popover :visible="visible" placement="top" :width="360">
|
|
74
|
+
<p>Are you sure to delete this?</p>
|
|
75
|
+
<div class="flex gap-2 justify-end mt-3">
|
|
76
|
+
<el-button size="small" text @click="visible = false">cancel</el-button>
|
|
77
|
+
<el-button size="small" type="primary" @click="visible = false"> confirm </el-button>
|
|
78
|
+
</div>
|
|
79
|
+
<template #reference>
|
|
80
|
+
<el-button @click="visible = true">Delete</el-button>
|
|
81
|
+
</template>
|
|
82
|
+
</el-popover>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<template #footer> <html-encode :tag="snippets.nested" /> </template>
|
|
86
|
+
</el-card>
|
|
87
|
+
|
|
88
|
+
<el-card>
|
|
89
|
+
<template #header> Directive </template>
|
|
90
|
+
<div class="flex flex-col gap-4 items-start">
|
|
91
|
+
<p>
|
|
92
|
+
You can still using popover in directive way but this is <span class="font-medium">not recommended</span> anymore since this makes your application complicated, you may
|
|
93
|
+
refer to the virtual triggering for more information.
|
|
94
|
+
</p>
|
|
95
|
+
<div class="flex gap-2">
|
|
96
|
+
<el-button v-popover="popoverRef" v-click-outside="onClickOutside"> Click me </el-button>
|
|
97
|
+
<el-popover ref="popoverRef" trigger="click" title="With title" virtual-triggering persistent>
|
|
98
|
+
<span> Some content </span>
|
|
99
|
+
</el-popover>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<template #footer> <html-encode :tag="snippets.directive" /> </template>
|
|
103
|
+
</el-card>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import { ref, unref } from 'vue';
|
|
109
|
+
|
|
110
|
+
const buttonRef = ref();
|
|
111
|
+
const popoverRef = ref();
|
|
112
|
+
const visible = ref(false);
|
|
113
|
+
const onClickOutside = () => {
|
|
114
|
+
unref(popoverRef).popperRef?.delayHide?.();
|
|
115
|
+
};
|
|
116
|
+
const snippets = {
|
|
117
|
+
basic: `
|
|
118
|
+
<el-popover placement="top-start" title="Title" :width="200" trigger="hover" content="this is content, this is content, this is content">
|
|
119
|
+
<template #reference>
|
|
120
|
+
<el-button >Hover to activate</el-button>
|
|
121
|
+
</template>
|
|
122
|
+
</el-popover>
|
|
123
|
+
`,
|
|
124
|
+
reference: `
|
|
125
|
+
<el-button ref="buttonRef" v-click-outside="onClickOutside"> Click me </el-button>
|
|
126
|
+
|
|
127
|
+
<el-popover ref="popoverRef" :virtual-ref="buttonRef" trigger="click" title="With title" virtual-triggering>
|
|
128
|
+
<span> Some content </span>
|
|
129
|
+
</el-popover>
|
|
130
|
+
`,
|
|
131
|
+
nested: `
|
|
132
|
+
<el-popover :visible="visible" placement="top" :width="360">
|
|
133
|
+
<p>Are you sure to delete this?</p>
|
|
134
|
+
<div class="flex gap-2 justify-end mt-3">
|
|
135
|
+
<el-button size="small" text @click="visible = false">cancel</el-button>
|
|
136
|
+
<el-button size="small" type="primary" @click="visible = false"> confirm </el-button>
|
|
137
|
+
</div>
|
|
138
|
+
<template #reference>
|
|
139
|
+
<el-button @click="visible = true">Delete</el-button>
|
|
140
|
+
</template>
|
|
141
|
+
</el-popover>
|
|
142
|
+
`,
|
|
143
|
+
directive: `
|
|
144
|
+
<el-button v-popover="popoverRef" v-click-outside="onClickOutside"> Click me </el-button>
|
|
145
|
+
|
|
146
|
+
<el-popover ref="popoverRef" trigger="click" title="With title" virtual-triggering persistent>
|
|
147
|
+
<span> Some content </span>
|
|
148
|
+
</el-popover>
|
|
149
|
+
`,
|
|
150
|
+
};
|
|
151
|
+
</script>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-8 mb-16">
|
|
3
|
+
<h1 class="">Radio</h1>
|
|
4
|
+
<p>Single selection among multiple options.</p>
|
|
5
|
+
|
|
6
|
+
<el-card>
|
|
7
|
+
<template #header> Sizes </template>
|
|
8
|
+
<div class="flex flex-col gap-3 items-start">
|
|
9
|
+
<p>
|
|
10
|
+
Radio should not have too many options. Otherwise, use the Select component instead. Creating a radio component is easy, you just need to bind a variable to Radio's
|
|
11
|
+
<el-text tag="mark">v-model</el-text>. It equals to the value of <el-text tag="mark">value</el-text> of the chosen radio. The type of value is
|
|
12
|
+
<span class="font-medium">String, Number or Boolean</span>
|
|
13
|
+
</p>
|
|
14
|
+
<div class="flex flex-col gap-4 items-start">
|
|
15
|
+
Selected: {{ value }}
|
|
16
|
+
<el-radio-group v-model="value">
|
|
17
|
+
<el-radio v-for="(size, index) of sizes" :key="index" :value="index" :size="size">Option 1</el-radio>
|
|
18
|
+
</el-radio-group>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<template #footer> <html-encode :tag="snippets.sizes" /> </template>
|
|
22
|
+
</el-card>
|
|
23
|
+
|
|
24
|
+
<el-card>
|
|
25
|
+
<template #header> Disabled </template>
|
|
26
|
+
<div class="flex flex-col gap-3 items-start">
|
|
27
|
+
<p><el-text tag="mark">disabled</el-text> attribute is used to disable the radio. You just need to add the disabled attribute.</p>
|
|
28
|
+
<div class="flex flex-col gap-4 items-start">
|
|
29
|
+
Selected: {{ value }}
|
|
30
|
+
<el-radio-group v-model="value">
|
|
31
|
+
<el-radio disabled :value="1" label="Select above to large" />
|
|
32
|
+
<el-radio disabled :value="2" label="Select medium" />
|
|
33
|
+
</el-radio-group>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<template #footer> <html-encode :tag="snippets.disabled" /> </template>
|
|
37
|
+
</el-card>
|
|
38
|
+
|
|
39
|
+
<el-card>
|
|
40
|
+
<template #header>Radio group</template>
|
|
41
|
+
<div class="flex flex-col gap-3 items-start">
|
|
42
|
+
<p>
|
|
43
|
+
Suitable for choosing from some mutually exclusive options. Combine <el-text tag="mark">el-radio-group</el-text> with el-radio to display a radio group. Bind a variable
|
|
44
|
+
with v-model of el-radio-group element and set label value in el-radio. It also provides <el-text tag="mark">change</el-text> event with the current value as its
|
|
45
|
+
parameter.
|
|
46
|
+
</p>
|
|
47
|
+
<div class="flex flex-col gap-4 items-start">
|
|
48
|
+
Selected: {{ value }}
|
|
49
|
+
<el-radio-group v-model="value">
|
|
50
|
+
<el-radio :value="1">Option A</el-radio>
|
|
51
|
+
<el-radio :value="2">Option B</el-radio>
|
|
52
|
+
<el-radio :value="3">Option C</el-radio>
|
|
53
|
+
<el-radio :value="4">Option C</el-radio>
|
|
54
|
+
</el-radio-group>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<template #footer>
|
|
58
|
+
<html-encode :tag="snippets.group" />
|
|
59
|
+
</template>
|
|
60
|
+
</el-card>
|
|
61
|
+
|
|
62
|
+
<el-card>
|
|
63
|
+
<template #header> Button style </template>
|
|
64
|
+
<div class="flex flex-col gap-3 items-start">
|
|
65
|
+
<p>Radio with button styles. You just need to change el-radio element into <el-text tag="mark">el-radio-button</el-text> element. We also provide size attribute.</p>
|
|
66
|
+
<div class="flex flex-col gap-4 items-start">
|
|
67
|
+
Selected: {{ value }}
|
|
68
|
+
<el-select v-model="selected_size" placeholder="Select" style="width: 184px">
|
|
69
|
+
<el-option v-for="item in ['default', 'large', 'medium', 'small', 'mini']" :key="item" :label="item" :value="item" />
|
|
70
|
+
</el-select>
|
|
71
|
+
<el-radio-group v-model="value">
|
|
72
|
+
<el-radio-button
|
|
73
|
+
v-for="val of [1, 2, 3, 4]"
|
|
74
|
+
:key="val"
|
|
75
|
+
:size="selected_size"
|
|
76
|
+
label="New York"
|
|
77
|
+
:value="val"
|
|
78
|
+
:disabled="[1, 4].includes(Number(value)) && val === Number(value)"
|
|
79
|
+
/>
|
|
80
|
+
</el-radio-group>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<template #footer>
|
|
84
|
+
<html-encode :tag="snippets.button" />
|
|
85
|
+
</template>
|
|
86
|
+
</el-card>
|
|
87
|
+
|
|
88
|
+
<el-card>
|
|
89
|
+
<template #header>With borders</template>
|
|
90
|
+
<div class="flex flex-col gap-3 items-start">
|
|
91
|
+
<h2>With borders</h2>
|
|
92
|
+
<p>The <el-text tag="mark">border</el-text> attribute adds a border to Radios.</p>
|
|
93
|
+
<div class="flex flex-col gap-4 items-start">
|
|
94
|
+
Selected: {{ value }}
|
|
95
|
+
<el-radio-group v-for="size of sizes" :key="size" v-model="value">
|
|
96
|
+
<el-radio v-for="(val, index) of [1, 2]" :key="val" :value="val" :size="size" border :disabled="size === 'large' && val === 2">Option {{ index + 1 }}</el-radio>
|
|
97
|
+
</el-radio-group>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<template #footer>
|
|
101
|
+
<html-encode :tag="snippets.bordered" />
|
|
102
|
+
</template>
|
|
103
|
+
</el-card>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script>
|
|
108
|
+
import { defineComponent } from "vue";
|
|
109
|
+
export default defineComponent({
|
|
110
|
+
name: "TimusCheckbox",
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
selected_size: "default",
|
|
114
|
+
sizes: ["default", "large", "medium", "small", "mini"],
|
|
115
|
+
colors: ["primary", "secondary", "neutral", "success", "warning", "info", "danger"],
|
|
116
|
+
value: "",
|
|
117
|
+
disabled: "",
|
|
118
|
+
snippets: {
|
|
119
|
+
sizes: `<el-radio value="value" size="large">Label</el-radio>`,
|
|
120
|
+
disabled: `<el-radio value="value" label="Label" disabled />`,
|
|
121
|
+
group: `
|
|
122
|
+
<el-radio-group v-model="value">
|
|
123
|
+
<el-radio :value="1">Option A</el-radio>
|
|
124
|
+
<el-radio :value="2">Option B</el-radio>
|
|
125
|
+
</el-radio-group>
|
|
126
|
+
`,
|
|
127
|
+
button: `
|
|
128
|
+
<el-radio-group v-model="value">
|
|
129
|
+
<el-radio-button label="New York" value="ny" />
|
|
130
|
+
<el-radio-button label="\u0130stanbul" value="ist" />
|
|
131
|
+
</el-radio-group>
|
|
132
|
+
`,
|
|
133
|
+
bordered: `
|
|
134
|
+
<el-radio-group v-model="value">
|
|
135
|
+
<el-radio :value="1" border>Option A</el-radio>
|
|
136
|
+
<el-radio :value="2" border>Option B</el-radio>
|
|
137
|
+
</el-radio-group>
|
|
138
|
+
`
|
|
139
|
+
},
|
|
140
|
+
checkAll: false,
|
|
141
|
+
checkList: ["Value selected and disabled", "Value A"],
|
|
142
|
+
isIndeterminate: true,
|
|
143
|
+
checkedCities: ["Shanghai", "Beijing"],
|
|
144
|
+
cities: ["Shanghai", "Beijing", "Guangzhou", "Shenzhen"]
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
capitalize(value) {
|
|
149
|
+
const text = String(value);
|
|
150
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
151
|
+
},
|
|
152
|
+
handleCheckedCitiesChange(value) {
|
|
153
|
+
const checkedCount = value.length;
|
|
154
|
+
this.checkAll = checkedCount === this.cities.length;
|
|
155
|
+
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
|
|
156
|
+
},
|
|
157
|
+
handleCheckAllChange(val) {
|
|
158
|
+
this.checkedCities = val ? this.cities : [];
|
|
159
|
+
this.isIndeterminate = false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CheckboxValueType } from 'element-plus';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {
|
|
3
|
+
selected_size: string;
|
|
4
|
+
sizes: string[];
|
|
5
|
+
colors: string[];
|
|
6
|
+
value: string;
|
|
7
|
+
disabled: string;
|
|
8
|
+
snippets: {
|
|
9
|
+
sizes: string;
|
|
10
|
+
disabled: string;
|
|
11
|
+
group: string;
|
|
12
|
+
button: string;
|
|
13
|
+
bordered: string;
|
|
14
|
+
};
|
|
15
|
+
checkAll: boolean;
|
|
16
|
+
checkList: string[];
|
|
17
|
+
isIndeterminate: boolean;
|
|
18
|
+
checkedCities: string[];
|
|
19
|
+
cities: string[];
|
|
20
|
+
}, {}, {
|
|
21
|
+
capitalize(value: string): string;
|
|
22
|
+
handleCheckedCitiesChange(value: CheckboxValueType[]): void;
|
|
23
|
+
handleCheckAllChange(val: CheckboxValueType): void;
|
|
24
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
export default _default;
|