rayyy-vue-table-components 2.0.21 → 2.0.23

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.
@@ -1,65 +0,0 @@
1
- <template>
2
- <el-select
3
- v-bind="attrs"
4
- :model-value="modelValue"
5
- :class="props.class"
6
- :placeholder="props.placeholder || t('common.select')"
7
- :clearable="props.clearable"
8
- :collapse-tags="props.collapseTags"
9
- :collapse-tags-tooltip="props.collapseTagsTooltip"
10
- :multiple="props.multiple"
11
- :disabled="props.disabled"
12
- :reserve-keyword="false"
13
- filterable
14
- @update:model-value="updateValue"
15
- >
16
- <el-option v-for="it in options" :key="it.label" :label="it.label" :value="it.value" />
17
- </el-select>
18
- </template>
19
-
20
- <script lang="ts" setup>
21
- import { useAttrs } from 'vue'
22
- import { useI18n } from 'vue-i18n'
23
- import type { ElOptions } from '@/types/OptionDto.ts'
24
-
25
- const { t } = useI18n()
26
-
27
- export type Selection = string | string[]
28
-
29
- const props = withDefaults(
30
- defineProps<{
31
- modelValue?: Selection
32
- options?: ElOptions[]
33
- placeholder?: string
34
- clearable?: boolean
35
- collapseTags?: boolean
36
- collapseTagsTooltip?: boolean
37
- multiple?: boolean
38
- disabled?: boolean
39
- class?: string
40
- }>(),
41
- {
42
- modelValue: () => '',
43
- options: () => [{ value: '', label: '' }],
44
- placeholder: '',
45
- class: 'w-full',
46
- },
47
- )
48
-
49
- // 獲取所有非 props 屬性
50
- const attrs = useAttrs()
51
-
52
- const emits = defineEmits<{
53
- (e: 'update:modelValue', data?: Selection): void
54
- }>()
55
-
56
- function updateValue(val: Selection) {
57
- let value: Selection | undefined = val
58
-
59
- if (typeof value === 'string' && !value) {
60
- value = undefined
61
- }
62
-
63
- emits('update:modelValue', value)
64
- }
65
- </script>