resolver-egretimp-plus 0.0.276 → 0.0.278

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,141 +0,0 @@
1
- <template>
2
- <ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
3
- <ElOption v-for="option in options"
4
- :key="option.columnValue"
5
- :label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
6
- :value="option.columnValue"
7
- :disabled="option.columnStatus == '0' || option.columnStatus == '2'"
8
- />
9
- </ElSelect>
10
- </template>
11
- <script setup>
12
- import { ElSelect, ElOption } from 'element-plus'
13
- import { computed, defineProps, inject, useAttrs } from 'vue'
14
- import { commonPropsType } from '../../utils/index.js'
15
-
16
- const VALUE_TYPES = {
17
- LIST: 'list',
18
- OBJECT: 'object',
19
- STRING: 'string',
20
- }
21
- const modelValue = defineModel()
22
- const props = defineProps({
23
- ...ElSelect.props,
24
- ...commonPropsType,
25
- multiple: [String, Boolean],
26
- filterable: [String, Boolean],
27
- multipleLimit: [String, Number],
28
- rangeOptions: Array,
29
- excludeOptions: Array,
30
- // 多选的分割符号
31
- separator: {
32
- type: [String],
33
- default: ','
34
- }
35
- })
36
- const attrs = useAttrs()
37
- const separator = computed(() => {
38
- return props.separator
39
- })
40
- const valueTypes = computed(() => {
41
- return props.config?.valueType
42
- })
43
- // 值是list 还是,连起来的string
44
- const isStrVal = computed(() => {
45
- // valueType 值为 list 或者 string
46
- return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
47
- })
48
- const isObject = computed(() => {
49
- return valueTypes.value === VALUE_TYPES.OBJECT
50
- })
51
-
52
- // 是否为多选
53
- const isMutiple = computed(() => {
54
- return props.multiple == '1'
55
- })
56
-
57
- const options = computed(() => {
58
- let list = props.options
59
- if (props.rangeOptions && props.rangeOptions.length) {
60
- list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
61
- }
62
- if (props.excludeOptions && props.excludeOptions.length) {
63
- list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
64
- }
65
- return list
66
- })
67
-
68
- const value = computed({
69
- get() {
70
- if (isMutiple.value) {
71
- const val = modelValue.value || ''
72
- return val ?
73
- (
74
- isStrVal.value ?
75
- val.split(separator.value) :
76
- (
77
- isObject.value ?
78
- Object.values(val || {}) :
79
- val
80
- )
81
- ) :
82
- []
83
- } else {
84
- if (modelValue.value !== null && modelValue.value !== undefined) {
85
- if (options.value?.some(item => item.columnValue == modelValue.value)) {
86
- props.config.isMatch = true
87
- return `${modelValue.value}`
88
- } else {
89
- props.config.isMatch = false
90
- return ''
91
- }
92
- } else {
93
- return ''
94
- }
95
- }
96
- },
97
- set(val) {
98
- if (isMutiple.value) {
99
- modelValue.value = isStrVal.value ?
100
- val.join(separator.value) :
101
- (
102
- isObject.value ?
103
- val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
104
- val
105
- )
106
- } else {
107
- modelValue.value = val
108
- }
109
- }
110
- })
111
-
112
- const selectProps = computed(() => {
113
- const attrs = Object.keys(ElSelect.props).reduce((ret, key) => {
114
- ret[key] = props[key]
115
- return ret
116
- }, {})
117
- if (attrs.placeholder === null || attrs.placeholder === undefined) {
118
- attrs.placeholder = ''
119
- }
120
- if (typeof attrs.filterable === 'string') {
121
- attrs.filterable = attrs.filterable == '1'
122
- }
123
- if (typeof attrs.multiple === 'string') {
124
- attrs.multiple = attrs.multiple == '1'
125
- }
126
- if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
127
- delete attrs.suffixIcon
128
- delete attrs['suffix-icon']
129
- }
130
- attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
131
- return attrs
132
- })
133
- const lang = inject('lang')
134
- const clear = () => {
135
- modelValue.value = ''
136
- }
137
- </script>
138
- <style lang="scss">
139
- .custom-self-select {
140
- }
141
- </style>