2021-12-08 10:47:33 +08:00
|
|
|
<script setup lang="ts">
|
2021-12-19 15:22:15 +08:00
|
|
|
import { reactive, ref, onMounted, markRaw } from 'vue'
|
2021-12-16 14:32:20 +08:00
|
|
|
import { ElConfigProvider, ElIcon } from 'element-plus'
|
2021-12-30 16:03:02 +08:00
|
|
|
import { VConfigGlobal } from '@/components/ConfigGlobal'
|
2021-12-11 11:46:10 +08:00
|
|
|
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
|
|
|
// import en from 'element-plus/lib/locale/lang/en'
|
2021-12-16 14:32:20 +08:00
|
|
|
import { VFrom } from '@/components/Form'
|
|
|
|
import Calendar from '~icons/ep/calendar'
|
2021-12-18 20:09:05 +08:00
|
|
|
import Check from '~icons/ep/check'
|
|
|
|
import Close from '~icons/ep/close'
|
|
|
|
import ChatRound from '~icons/ep/chatRound'
|
|
|
|
import ChatLineRound from '~icons/ep/chatLineRound'
|
|
|
|
import ChatDotRound from '~icons/ep/chatDotRound'
|
2021-12-16 17:15:03 +08:00
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
|
const restaurants = ref<Recordable[]>([])
|
|
|
|
const querySearch = (queryString: string, cb: Fn) => {
|
|
|
|
const results = queryString
|
|
|
|
? restaurants.value.filter(createFilter(queryString))
|
|
|
|
: restaurants.value
|
|
|
|
// call callback function to return suggestions
|
|
|
|
cb(results)
|
|
|
|
}
|
|
|
|
const createFilter = (queryString: string) => {
|
|
|
|
return (restaurant: Recordable) => {
|
|
|
|
return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const loadAll = () => {
|
|
|
|
return [
|
|
|
|
{ value: 'vue', link: 'https://github.com/vuejs/vue' },
|
|
|
|
{ value: 'element', link: 'https://github.com/ElemeFE/element' },
|
|
|
|
{ value: 'cooking', link: 'https://github.com/ElemeFE/cooking' },
|
|
|
|
{ value: 'mint-ui', link: 'https://github.com/ElemeFE/mint-ui' },
|
|
|
|
{ value: 'vuex', link: 'https://github.com/vuejs/vuex' },
|
|
|
|
{ value: 'vue-router', link: 'https://github.com/vuejs/vue-router' },
|
|
|
|
{ value: 'babel', link: 'https://github.com/babel/babel' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
const handleSelect = (item: Recordable) => {
|
|
|
|
console.log(item)
|
|
|
|
}
|
|
|
|
onMounted(() => {
|
|
|
|
restaurants.value = loadAll()
|
|
|
|
})
|
2021-12-11 20:50:05 +08:00
|
|
|
|
2021-12-17 15:10:39 +08:00
|
|
|
const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
|
2021-12-26 17:32:33 +08:00
|
|
|
const options = ref<ComponentOptions[]>(
|
2021-12-17 15:10:39 +08:00
|
|
|
Array.from({ length: 1000 }).map((_, idx) => ({
|
|
|
|
value: `Option ${idx + 1}`,
|
|
|
|
label: `${initials[idx % 10]}${idx}`
|
|
|
|
}))
|
|
|
|
)
|
2021-12-26 17:32:33 +08:00
|
|
|
const options2 = ref<ComponentOptions[]>(
|
2021-12-17 15:10:39 +08:00
|
|
|
Array.from({ length: 10 }).map((_, idx) => {
|
|
|
|
const label = idx + 1
|
|
|
|
return {
|
|
|
|
value: `Group ${label}`,
|
|
|
|
label: `Group ${label}`,
|
|
|
|
options: Array.from({ length: 10 }).map((_, idx) => ({
|
|
|
|
value: `Option ${idx + 1 + 10 * label}`,
|
|
|
|
label: `${initials[idx % 10]}${idx + 1 + 10 * label}`
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
2021-12-26 17:32:33 +08:00
|
|
|
const options3: ComponentOptions[] = [
|
2021-12-18 20:09:05 +08:00
|
|
|
{
|
|
|
|
value: 'guide',
|
|
|
|
label: 'Guide',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'disciplines',
|
|
|
|
label: 'Disciplines',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'consistency',
|
|
|
|
label: 'Consistency'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'feedback',
|
|
|
|
label: 'Feedback'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'efficiency',
|
|
|
|
label: 'Efficiency'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'controllability',
|
|
|
|
label: 'Controllability'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'navigation',
|
|
|
|
label: 'Navigation',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'side nav',
|
|
|
|
label: 'Side Navigation'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'top nav',
|
|
|
|
label: 'Top Navigation'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'component',
|
|
|
|
label: 'Component',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'basic',
|
|
|
|
label: 'Basic',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'layout',
|
|
|
|
label: 'Layout'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'color',
|
|
|
|
label: 'Color'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'typography',
|
|
|
|
label: 'Typography'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'icon',
|
|
|
|
label: 'Icon'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'button',
|
|
|
|
label: 'Button'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'form',
|
|
|
|
label: 'Form',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'radio',
|
|
|
|
label: 'Radio'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'checkbox',
|
|
|
|
label: 'Checkbox'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'input',
|
|
|
|
label: 'Input'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'input-number',
|
|
|
|
label: 'InputNumber'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'select',
|
|
|
|
label: 'Select'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'cascader',
|
|
|
|
label: 'Cascader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'switch',
|
|
|
|
label: 'Switch'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'slider',
|
|
|
|
label: 'Slider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'time-picker',
|
|
|
|
label: 'TimePicker'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'date-picker',
|
|
|
|
label: 'DatePicker'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'datetime-picker',
|
|
|
|
label: 'DateTimePicker'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'upload',
|
|
|
|
label: 'Upload'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'rate',
|
|
|
|
label: 'Rate'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'form',
|
|
|
|
label: 'Form'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'data',
|
|
|
|
label: 'Data',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'table',
|
|
|
|
label: 'Table'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'tag',
|
|
|
|
label: 'Tag'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'progress',
|
|
|
|
label: 'Progress'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'tree',
|
|
|
|
label: 'Tree'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pagination',
|
|
|
|
label: 'Pagination'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'badge',
|
|
|
|
label: 'Badge'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'notice',
|
|
|
|
label: 'Notice',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'alert',
|
|
|
|
label: 'Alert'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'loading',
|
|
|
|
label: 'Loading'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'message',
|
|
|
|
label: 'Message'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'message-box',
|
|
|
|
label: 'MessageBox'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'notification',
|
|
|
|
label: 'Notification'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'navigation',
|
|
|
|
label: 'Navigation',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'menu',
|
|
|
|
label: 'Menu'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'tabs',
|
|
|
|
label: 'Tabs'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'breadcrumb',
|
|
|
|
label: 'Breadcrumb'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'dropdown',
|
|
|
|
label: 'Dropdown'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'steps',
|
|
|
|
label: 'Steps'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'others',
|
|
|
|
label: 'Others',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'dialog',
|
|
|
|
label: 'Dialog'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'tooltip',
|
|
|
|
label: 'Tooltip'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'popover',
|
|
|
|
label: 'Popover'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'card',
|
|
|
|
label: 'Card'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'carousel',
|
|
|
|
label: 'Carousel'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'collapse',
|
|
|
|
label: 'Collapse'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-12-25 10:51:01 +08:00
|
|
|
function generateData() {
|
|
|
|
const data: {
|
|
|
|
value: number
|
|
|
|
desc: string
|
|
|
|
disabled: boolean
|
|
|
|
}[] = []
|
|
|
|
for (let i = 1; i <= 15; i++) {
|
|
|
|
data.push({
|
|
|
|
value: i,
|
|
|
|
desc: `Option ${i}`,
|
|
|
|
disabled: i % 4 === 0
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
|
2021-12-26 17:32:33 +08:00
|
|
|
const holidays = [
|
|
|
|
'2021-10-01',
|
|
|
|
'2021-10-02',
|
|
|
|
'2021-10-03',
|
|
|
|
'2021-10-04',
|
|
|
|
'2021-10-05',
|
|
|
|
'2021-10-06',
|
|
|
|
'2021-10-07'
|
|
|
|
]
|
|
|
|
|
|
|
|
function isHoliday({ dayjs }) {
|
|
|
|
return holidays.includes(dayjs.format('YYYY-MM-DD'))
|
|
|
|
}
|
|
|
|
|
2021-12-14 17:42:43 +08:00
|
|
|
const schema = reactive<VFormSchema[]>([
|
|
|
|
{
|
|
|
|
field: 'field1',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.input'),
|
|
|
|
component: 'Divider'
|
2021-12-15 21:26:14 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field2',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.default'),
|
2021-12-14 17:42:43 +08:00
|
|
|
component: 'Input'
|
2021-12-16 14:32:20 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field3',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: `${t('formDemo.icon')}1`,
|
2021-12-16 14:32:20 +08:00
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
2021-12-19 15:22:15 +08:00
|
|
|
suffixIcon: markRaw(Calendar),
|
|
|
|
prefixIcon: markRaw(Calendar)
|
2021-12-16 14:32:20 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field4',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: `${t('formDemo.icon')}2`,
|
2021-12-16 14:32:20 +08:00
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
slots: {
|
|
|
|
suffix: true,
|
|
|
|
prefix: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field5',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.mixed'),
|
2021-12-16 14:32:20 +08:00
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
slots: {
|
|
|
|
prepend: true,
|
|
|
|
append: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field6',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.textarea'),
|
2021-12-16 14:32:20 +08:00
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
type: 'textarea',
|
|
|
|
rows: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field7',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.autocomplete'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field8',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Autocomplete',
|
|
|
|
componentProps: {
|
|
|
|
fetchSuggestions: querySearch,
|
|
|
|
onSelect: handleSelect
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field9',
|
|
|
|
label: t('formDemo.slot'),
|
|
|
|
component: 'Autocomplete',
|
|
|
|
componentProps: {
|
|
|
|
fetchSuggestions: querySearch,
|
|
|
|
onSelect: handleSelect,
|
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field10',
|
2021-12-16 14:32:20 +08:00
|
|
|
component: 'Divider',
|
2021-12-18 20:09:05 +08:00
|
|
|
label: t('formDemo.inputNumber')
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field11',
|
|
|
|
label: t('formDemo.default'),
|
2021-12-18 20:09:05 +08:00
|
|
|
component: 'InputNumber',
|
|
|
|
value: 0
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field12',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.position'),
|
|
|
|
component: 'InputNumber',
|
|
|
|
componentProps: {
|
|
|
|
controlsPosition: 'right'
|
2021-12-18 20:09:05 +08:00
|
|
|
},
|
|
|
|
value: 0
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field13',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.select'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field14',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Select',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2',
|
|
|
|
value: '2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field15',
|
2021-12-16 17:15:03 +08:00
|
|
|
label: t('formDemo.slot'),
|
|
|
|
component: 'Select',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2',
|
|
|
|
value: '2'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
optionsSlot: true
|
|
|
|
}
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field16',
|
2021-12-26 17:32:33 +08:00
|
|
|
label: t('formDemo.selectGroup'),
|
2021-12-16 17:15:03 +08:00
|
|
|
component: 'Select',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1-1',
|
|
|
|
value: '1-1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option1-2',
|
|
|
|
value: '1-2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option2-1',
|
|
|
|
value: '2-1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2-2',
|
|
|
|
value: '2-2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2021-12-16 17:15:03 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field17',
|
2021-12-26 17:32:33 +08:00
|
|
|
label: `${t('formDemo.selectGroup')}${t('formDemo.slot')}`,
|
2021-12-16 17:15:03 +08:00
|
|
|
component: 'Select',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option1-1',
|
|
|
|
value: '1-1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option1-2',
|
|
|
|
value: '1-2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option2-1',
|
|
|
|
value: '2-1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option2-2',
|
|
|
|
value: '2-2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
optionsSlot: true
|
|
|
|
}
|
2021-12-17 15:10:39 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field18',
|
2021-12-17 15:10:39 +08:00
|
|
|
label: `${t('formDemo.selectV2')}`,
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field19',
|
2021-12-17 15:10:39 +08:00
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'SelectV2',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: options.value
|
|
|
|
}
|
2021-12-17 15:10:39 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field20',
|
2021-12-17 15:10:39 +08:00
|
|
|
label: t('formDemo.slot'),
|
|
|
|
component: 'SelectV2',
|
|
|
|
componentProps: {
|
2021-12-26 17:32:33 +08:00
|
|
|
options: options.value,
|
2021-12-17 15:10:39 +08:00
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field21',
|
2021-12-26 17:32:33 +08:00
|
|
|
label: t('formDemo.selectGroup'),
|
2021-12-17 15:10:39 +08:00
|
|
|
component: 'SelectV2',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: options2.value
|
|
|
|
}
|
2021-12-17 15:10:39 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-18 20:09:05 +08:00
|
|
|
field: 'field22',
|
2021-12-26 17:32:33 +08:00
|
|
|
label: `${t('formDemo.selectGroup')}${t('formDemo.slot')}`,
|
2021-12-17 15:10:39 +08:00
|
|
|
component: 'SelectV2',
|
|
|
|
componentProps: {
|
2021-12-26 17:32:33 +08:00
|
|
|
options: options2.value,
|
2021-12-17 15:10:39 +08:00
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
}
|
2021-12-18 20:09:05 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field23',
|
|
|
|
label: t('formDemo.cascader'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field24',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Cascader',
|
2021-12-26 17:32:33 +08:00
|
|
|
componentProps: {
|
|
|
|
options: options3
|
|
|
|
}
|
2021-12-18 20:09:05 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field25',
|
|
|
|
label: t('formDemo.slot'),
|
|
|
|
component: 'Cascader',
|
|
|
|
componentProps: {
|
2021-12-26 17:32:33 +08:00
|
|
|
options: options3,
|
2021-12-18 20:09:05 +08:00
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field26',
|
|
|
|
label: t('formDemo.switch'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field27',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Switch',
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field28',
|
|
|
|
label: t('formDemo.icon'),
|
|
|
|
component: 'Switch',
|
|
|
|
value: false,
|
|
|
|
componentProps: {
|
2021-12-19 15:22:15 +08:00
|
|
|
activeIcon: markRaw(Check),
|
|
|
|
inactiveIcon: markRaw(Close)
|
2021-12-18 20:09:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field29',
|
|
|
|
label: t('formDemo.rate'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field30',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Rate',
|
|
|
|
value: null
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field31',
|
|
|
|
label: t('formDemo.icon'),
|
|
|
|
component: 'Rate',
|
|
|
|
value: null,
|
|
|
|
componentProps: {
|
2021-12-19 15:22:15 +08:00
|
|
|
voidIcon: markRaw(ChatRound),
|
|
|
|
icons: [markRaw(ChatRound), markRaw(ChatLineRound), markRaw(ChatDotRound)]
|
2021-12-18 20:09:05 +08:00
|
|
|
}
|
2021-12-25 10:51:01 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field32',
|
|
|
|
label: t('formDemo.colorPicker'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field33',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'ColorPicker'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field34',
|
|
|
|
label: t('formDemo.transfer'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field35',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Transfer',
|
|
|
|
componentProps: {
|
|
|
|
props: {
|
|
|
|
key: 'value',
|
|
|
|
label: 'desc',
|
|
|
|
disabled: 'disabled'
|
|
|
|
},
|
|
|
|
data: generateData()
|
|
|
|
},
|
|
|
|
value: [],
|
|
|
|
colProps: {
|
|
|
|
xl: 12
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field36',
|
|
|
|
label: t('formDemo.slot'),
|
|
|
|
component: 'Transfer',
|
|
|
|
componentProps: {
|
|
|
|
props: {
|
|
|
|
key: 'value',
|
|
|
|
label: 'desc',
|
|
|
|
disabled: 'disabled'
|
|
|
|
},
|
|
|
|
leftDefaultChecked: [2, 3],
|
|
|
|
rightDefaultChecked: [1],
|
|
|
|
data: generateData(),
|
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
value: [1],
|
|
|
|
colProps: {
|
|
|
|
xl: 12
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field37',
|
|
|
|
label: `${t('formDemo.render')}`,
|
|
|
|
component: 'Transfer',
|
|
|
|
componentProps: {
|
|
|
|
props: {
|
|
|
|
key: 'value',
|
|
|
|
label: 'desc',
|
|
|
|
disabled: 'disabled'
|
|
|
|
},
|
|
|
|
leftDefaultChecked: [2, 3],
|
|
|
|
rightDefaultChecked: [1],
|
|
|
|
data: generateData(),
|
|
|
|
renderContent: (h: Fn, option: Recordable) => {
|
|
|
|
return h('span', null, `${option.value} - ${option.desc}`)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
value: [1],
|
|
|
|
colProps: {
|
|
|
|
xl: 12
|
|
|
|
}
|
2021-12-26 17:32:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field38',
|
|
|
|
label: t('formDemo.radio'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field39',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Radio',
|
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option-1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-2',
|
|
|
|
value: '2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field40',
|
|
|
|
label: t('formDemo.button'),
|
|
|
|
component: 'RadioButton',
|
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option-1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-2',
|
|
|
|
value: '2'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field41',
|
|
|
|
label: t('formDemo.checkbox'),
|
|
|
|
component: 'Divider'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field42',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
component: 'Checkbox',
|
|
|
|
value: [],
|
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option-1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-2',
|
|
|
|
value: '2'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-3',
|
|
|
|
value: '23'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field43',
|
|
|
|
label: t('formDemo.button'),
|
|
|
|
component: 'CheckboxButton',
|
|
|
|
value: [],
|
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'option-1',
|
|
|
|
value: '1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-2',
|
|
|
|
value: '2'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'option-3',
|
|
|
|
value: '23'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field44',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.slider')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field45',
|
|
|
|
component: 'Slider',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field46',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.datePicker')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field47',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'date'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field48',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.shortcuts'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'date',
|
|
|
|
disabledDate: (time: Date) => {
|
|
|
|
return time.getTime() > Date.now()
|
|
|
|
},
|
|
|
|
shortcuts: [
|
|
|
|
{
|
|
|
|
text: t('formDemo.today'),
|
|
|
|
value: new Date()
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: t('formDemo.yesterday'),
|
|
|
|
value: () => {
|
|
|
|
const date = new Date()
|
|
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
|
|
|
return date
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: t('formDemo.aWeekAgo'),
|
|
|
|
value: () => {
|
|
|
|
const date = new Date()
|
|
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
|
return date
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field49',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.week'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'week',
|
|
|
|
format: `[${t('formDemo.week')}] ww`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field50',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.year'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'year'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field51',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.month'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'month'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field52',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.dates'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'dates'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field53',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.daterange'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'daterange'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field54',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.monthrange'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'monthrange'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field55',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.slot'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'date',
|
|
|
|
format: 'YYYY/MM/DD',
|
|
|
|
valueFormat: 'YYYY-MM-DD',
|
|
|
|
slots: {
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field56',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.dateTimePicker')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field57',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.default'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'datetime'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field58',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.shortcuts'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'datetime',
|
|
|
|
shortcuts: [
|
|
|
|
{
|
|
|
|
text: t('formDemo.today'),
|
|
|
|
value: new Date()
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: t('formDemo.yesterday'),
|
|
|
|
value: () => {
|
|
|
|
const date = new Date()
|
|
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
|
|
|
return date
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: t('formDemo.aWeekAgo'),
|
|
|
|
value: () => {
|
|
|
|
const date = new Date()
|
|
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
|
return date
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field59',
|
|
|
|
component: 'DatePicker',
|
|
|
|
label: t('formDemo.dateTimerange'),
|
|
|
|
componentProps: {
|
|
|
|
type: 'datetimerange'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field60',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.timePicker')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field61',
|
|
|
|
component: 'TimePicker',
|
|
|
|
label: t('formDemo.default')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field62',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.timeSelect')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field63',
|
|
|
|
component: 'TimeSelect',
|
|
|
|
label: t('formDemo.default')
|
2021-12-30 16:03:02 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field64',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('formDemo.inputPassword')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field65',
|
|
|
|
component: 'InputPassword',
|
|
|
|
label: t('formDemo.default')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field66',
|
|
|
|
component: 'InputPassword',
|
|
|
|
label: t('formDemo.passwordStrength'),
|
|
|
|
componentProps: {
|
|
|
|
strength: true
|
|
|
|
}
|
2021-12-14 17:42:43 +08:00
|
|
|
}
|
|
|
|
])
|
2021-12-08 10:47:33 +08:00
|
|
|
</script>
|
|
|
|
|
2021-12-11 11:46:10 +08:00
|
|
|
<template>
|
2021-12-30 16:03:02 +08:00
|
|
|
<VConfigGlobal>
|
|
|
|
<ElConfigProvider :locale="zhCn">
|
|
|
|
<VFrom :schema="schema">
|
|
|
|
<template #field4-prefix>
|
|
|
|
<ElIcon class="el-input__icon"><Calendar /></ElIcon>
|
|
|
|
</template>
|
|
|
|
<template #field4-suffix>
|
|
|
|
<ElIcon class="el-input__icon"><Calendar /></ElIcon>
|
|
|
|
</template>
|
2021-12-16 14:32:20 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field5-prepend> Http:// </template>
|
|
|
|
<template #field5-append> .com </template>
|
2021-12-16 17:15:03 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field9-default="{ item }">
|
|
|
|
<div class="value">{{ item.value }}</div>
|
|
|
|
<span class="link">{{ item.link }}</span>
|
|
|
|
</template>
|
2021-12-16 17:15:03 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field15-option="{ item }">
|
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
|
<span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">
|
|
|
|
{{ item.value }}
|
|
|
|
</span>
|
|
|
|
</template>
|
2021-12-17 15:10:39 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field17-option="{ item }">
|
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
|
<span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">
|
|
|
|
{{ item.value }}
|
|
|
|
</span>
|
|
|
|
</template>
|
2021-12-17 15:10:39 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field20-default="{ item }">
|
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
|
<span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">
|
|
|
|
{{ item.value }}
|
|
|
|
</span>
|
|
|
|
</template>
|
2021-12-16 17:15:03 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field22-default="{ item }">
|
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
|
<span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">
|
|
|
|
{{ item.value }}
|
|
|
|
</span>
|
|
|
|
</template>
|
2021-12-18 20:09:05 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field25-default="{ node, data }">
|
|
|
|
<span>{{ data.label }}</span>
|
|
|
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
|
|
|
</template>
|
2021-12-25 10:51:01 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field36-default="{ option }">
|
|
|
|
<span>{{ option.value }} - {{ option.desc }}</span>
|
|
|
|
</template>
|
2021-12-26 17:32:33 +08:00
|
|
|
|
2021-12-30 16:03:02 +08:00
|
|
|
<template #field55-default="cell">
|
|
|
|
<div class="cell" :class="{ current: cell.isCurrent }">
|
|
|
|
<span class="text">{{ cell.text }}</span>
|
|
|
|
<span v-if="isHoliday(cell)" class="holiday"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</VFrom>
|
|
|
|
</ElConfigProvider>
|
|
|
|
</VConfigGlobal>
|
2021-12-11 11:46:10 +08:00
|
|
|
</template>
|
2021-12-26 17:32:33 +08:00
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.cell {
|
|
|
|
height: 30px;
|
|
|
|
padding: 3px 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
.text {
|
|
|
|
position: absolute;
|
|
|
|
left: 50%;
|
|
|
|
display: block;
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
margin: 0 auto;
|
|
|
|
line-height: 24px;
|
|
|
|
border-radius: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.current {
|
|
|
|
.text {
|
|
|
|
color: #fff;
|
|
|
|
background: purple;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.holiday {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0px;
|
|
|
|
left: 50%;
|
|
|
|
width: 6px;
|
|
|
|
height: 6px;
|
|
|
|
background: red;
|
|
|
|
border-radius: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|