@lx-frontend/wrap-element-ui 1.0.28 → 2.0.0-beta.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/package.json +21 -12
- package/src/components/AddMembers/index.vue +100 -89
- package/src/components/AuditSteps/index.vue +107 -74
- package/src/components/DemoComponent/index.vue +8 -5
- package/src/components/EditableTable/bizHooks/useCellHover.ts +47 -2
- package/src/components/EditableTable/bizHooks/useColumnHeaderOperation.ts +5 -4
- package/src/components/EditableTable/bizHooks/useDefaultOperation.ts +12 -4
- package/src/components/EditableTable/bizHooks/useDragSort.ts +36 -3
- package/src/components/EditableTable/bizHooks/useRowBgColor.ts +6 -2
- package/src/components/EditableTable/bizHooks/useViewSetting.ts +2 -1
- package/src/components/EditableTable/features/bizColorSelect.vue +4 -3
- package/src/components/EditableTable/features/bizEditCell.vue +6 -6
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizCheckboxFilter.vue +3 -3
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizColorRadioFilter.vue +3 -4
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizDoubleDatePickerFilter.vue +8 -8
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizInputFilter.vue +2 -2
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.vue +2 -2
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizRadioFilter.vue +3 -4
- package/src/components/EditableTable/features/bizTableHeaderPopover/index.vue +28 -19
- package/src/components/EditableTable/features/bizTableOperatePopover.vue +11 -9
- package/src/components/EditableTable/features/bizViewSettingDialog.vue +10 -6
- package/src/components/EditableTable/index.less +189 -186
- package/src/components/EditableTable/index.vue +34 -16
- package/src/components/EditableTable/types/index.ts +4 -4
- package/src/components/Ellipsis/MultilineEllipsis.vue +96 -109
- package/src/components/Ellipsis/index.vue +114 -89
- package/src/components/LxTable/index.vue +98 -143
- package/src/components/PopoverForm/index.vue +52 -47
- package/src/components/SearchForm/index.vue +128 -138
- package/src/components/SearchForm/types/index.ts +4 -4
- package/src/components/SearchSelect/index.vue +83 -67
- package/src/components/index.ts +1 -1
- package/src/components/singleMessage/index.ts +15 -44
|
@@ -20,31 +20,31 @@
|
|
|
20
20
|
<el-input
|
|
21
21
|
v-if="type === 'input'"
|
|
22
22
|
:placeholder="placeholder ? placeholder : showLabel ? '请输入' : label"
|
|
23
|
-
:value="formData[prop]"
|
|
23
|
+
:model-value="formData[prop]"
|
|
24
24
|
:maxlength="maxlength"
|
|
25
|
-
@
|
|
25
|
+
@update:modelValue="val => handleInput(val, prop, inputLimitCallback)"
|
|
26
26
|
/>
|
|
27
27
|
<div
|
|
28
28
|
v-if="type === 'doubleInput'"
|
|
29
29
|
:class="doubleIsInline ? 'form-double-inline': ''"
|
|
30
30
|
>
|
|
31
31
|
<el-input
|
|
32
|
-
@
|
|
33
|
-
:value="formData[prop[0]]"
|
|
32
|
+
@update:modelValue="val => handleInput(val, prop[0], inputLimitCallback)"
|
|
33
|
+
:model-value="formData[prop[0]]"
|
|
34
34
|
:placeholder="(placeholder || [])[0] || '请输入'"
|
|
35
35
|
/>
|
|
36
36
|
<el-input
|
|
37
37
|
:placeholder="(placeholder || [])[1] || '请输入'"
|
|
38
|
-
:value="formData[prop[1]]"
|
|
39
|
-
@
|
|
38
|
+
:model-value="formData[prop[1]]"
|
|
39
|
+
@update:modelValue="val => handleInput(val, prop[1], inputLimitCallback)"
|
|
40
40
|
/>
|
|
41
41
|
</div>
|
|
42
42
|
<el-select
|
|
43
43
|
v-if="type === 'select'"
|
|
44
|
-
:value="formData[prop]"
|
|
45
|
-
:placeholder="placeholder ? placeholder : showLabel ? '请输入' : label"
|
|
44
|
+
:model-value="formData[prop]"
|
|
45
|
+
:placeholder="withoutAll ? (placeholder ? placeholder : showLabel ? '请输入' : label) : (showLabel ? '全部' : label)"
|
|
46
46
|
:clearable="clearable"
|
|
47
|
-
@
|
|
47
|
+
@update:modelValue="val => handleInput(val, prop)"
|
|
48
48
|
@change="(...args) => changeCb && changeCb(...args)"
|
|
49
49
|
:filterable="filterable"
|
|
50
50
|
:multiple="multiple"
|
|
@@ -65,46 +65,46 @@
|
|
|
65
65
|
</el-select>
|
|
66
66
|
<el-date-picker
|
|
67
67
|
v-if="type === 'datePicker'"
|
|
68
|
-
@
|
|
68
|
+
@update:modelValue="val => handleInput(val, prop)"
|
|
69
69
|
@change="(...args) => changeCb && changeCb(...args)"
|
|
70
|
-
:value="formData[prop]"
|
|
71
|
-
format="
|
|
72
|
-
value-format="
|
|
70
|
+
:model-value="formData[prop]"
|
|
71
|
+
format="YYYY-MM-DD"
|
|
72
|
+
value-format="YYYY-MM-DD"
|
|
73
73
|
:type="dateType"
|
|
74
74
|
:range-separator="rangeSeparator || '到'"
|
|
75
75
|
:placeholder="dateType == 'date' ? placeholder || '选择日期' : '选择日期范围'"
|
|
76
76
|
start-placeholder="开始日期"
|
|
77
77
|
end-placeholder="结束日期"
|
|
78
|
-
:
|
|
78
|
+
:disabled-date="pickerOptions?.disabledDate"
|
|
79
79
|
/>
|
|
80
80
|
<div
|
|
81
81
|
v-if="type === 'doubleDatePicker'"
|
|
82
82
|
:class="doubleIsInline ? 'form-double-inline': ''"
|
|
83
83
|
>
|
|
84
84
|
<el-date-picker
|
|
85
|
-
@
|
|
85
|
+
@update:modelValue="val => handleInput(val, prop[0], '', key)"
|
|
86
86
|
@change="(...args) => changeCb && changeCb(...args)"
|
|
87
|
-
:value="formData[prop[0]]"
|
|
88
|
-
value-format="
|
|
89
|
-
format="
|
|
87
|
+
:model-value="formData[prop[0]]"
|
|
88
|
+
value-format="YYYY-MM-DD"
|
|
89
|
+
format="YYYY-MM-DD"
|
|
90
90
|
type="date"
|
|
91
91
|
:editable="false"
|
|
92
92
|
:placeholder="(placeholder || [])[0] || '开始日期'"
|
|
93
|
-
:
|
|
93
|
+
:disabled-date="pickerOptions?.start?.disabledDate || genStartDateDisabledOptions(formData[prop[1]], limit)?.disabledDate"
|
|
94
94
|
/>
|
|
95
95
|
<el-date-picker
|
|
96
|
-
@
|
|
96
|
+
@update:modelValue="val => handleInput(val, prop[1], '', key)"
|
|
97
97
|
@change="(...args) => changeCb && changeCb(...args)"
|
|
98
|
-
:value="formData[prop[1]]"
|
|
99
|
-
value-format="
|
|
100
|
-
format="
|
|
98
|
+
:model-value="formData[prop[1]]"
|
|
99
|
+
value-format="YYYY-MM-DD"
|
|
100
|
+
format="YYYY-MM-DD"
|
|
101
101
|
type="date"
|
|
102
102
|
:editable="false"
|
|
103
103
|
:placeholder="(placeholder || [])[1] || '结束日期'"
|
|
104
|
-
:
|
|
104
|
+
:disabled-date="pickerOptions?.end?.disabledDate || genEndDateDisabledOptions(formData[prop[0]], limit)?.disabledDate"
|
|
105
105
|
/>
|
|
106
106
|
<el-checkbox
|
|
107
|
-
:value="checkedIds[key]"
|
|
107
|
+
:model-value="checkedIds[key]"
|
|
108
108
|
v-if="isEmpty"
|
|
109
109
|
@change="(value) => handelIsEmpty(prop, value, key)"
|
|
110
110
|
class="is-empty"
|
|
@@ -117,146 +117,136 @@
|
|
|
117
117
|
:name="slotName"
|
|
118
118
|
/>
|
|
119
119
|
</el-form-item>
|
|
120
|
-
<
|
|
120
|
+
<el-form-item
|
|
121
|
+
v-if="isShowSearchBtn"
|
|
122
|
+
label-width="0"
|
|
123
|
+
class="search-form__buttons"
|
|
124
|
+
>
|
|
121
125
|
<el-button
|
|
122
126
|
class="search"
|
|
123
127
|
@click="handleSearch"
|
|
124
128
|
type="primary"
|
|
125
|
-
>
|
|
129
|
+
>
|
|
130
|
+
{{ searchText }}
|
|
131
|
+
</el-button>
|
|
126
132
|
<el-button
|
|
127
133
|
v-if="showClear"
|
|
128
134
|
@click="handleClearParams"
|
|
129
|
-
>
|
|
130
|
-
|
|
135
|
+
>
|
|
136
|
+
{{ clearText }}
|
|
137
|
+
</el-button>
|
|
138
|
+
</el-form-item>
|
|
131
139
|
</el-form>
|
|
132
140
|
</template>
|
|
133
141
|
|
|
134
|
-
<script>
|
|
135
|
-
import {
|
|
142
|
+
<script setup lang="ts">
|
|
143
|
+
import { ref, watch, onMounted } from 'vue'
|
|
144
|
+
import { genStartDateDisabledOptions, genEndDateDisabledOptions } from '../helper'
|
|
136
145
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
ownerClear: {
|
|
172
|
-
type: Function
|
|
173
|
-
},
|
|
174
|
-
resetCheckedIds: {
|
|
175
|
-
type: Boolean
|
|
176
|
-
},
|
|
177
|
-
searchText: {
|
|
178
|
-
default: '搜索',
|
|
179
|
-
type: String
|
|
180
|
-
},
|
|
181
|
-
clearText: {
|
|
182
|
-
default: '清除',
|
|
183
|
-
type: String
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
data () {
|
|
187
|
-
return {
|
|
188
|
-
visible: true,
|
|
189
|
-
initialData: {},
|
|
190
|
-
checkedIds: {}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
watch: {
|
|
194
|
-
resetCheckedIds () {
|
|
195
|
-
this.config.filter(c => c.type === 'doubleDatePicker').map(t => t.key).forEach(k => {
|
|
196
|
-
this.$set(this.checkedIds, k, false)
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
mounted () {
|
|
201
|
-
this.initialData = Object.freeze({ ...this.formData })
|
|
202
|
-
},
|
|
203
|
-
methods: {
|
|
204
|
-
genStartDateDisabledOptions,
|
|
205
|
-
genEndDateDisabledOptions,
|
|
206
|
-
handleInput (val, prop, inputLimitCallback, key) {
|
|
207
|
-
if (inputLimitCallback && !inputLimitCallback(val)) return false
|
|
208
|
-
if (val) {
|
|
209
|
-
this.$set(this.checkedIds, key, false)
|
|
210
|
-
}
|
|
211
|
-
this.$emit('update:formData', { ...this.formData, [prop]: val })
|
|
212
|
-
this.$emit('isPickerEmpty', this.checkedIds)
|
|
213
|
-
},
|
|
146
|
+
defineOptions({ name: 'SearchForm' })
|
|
147
|
+
|
|
148
|
+
interface IProps {
|
|
149
|
+
labelPosition?: string
|
|
150
|
+
isShowSearchBtn?: boolean
|
|
151
|
+
isInline?: boolean
|
|
152
|
+
config: Record<string, any>[]
|
|
153
|
+
width?: string
|
|
154
|
+
formData: Record<string, any>
|
|
155
|
+
showClear?: boolean
|
|
156
|
+
showLabel?: boolean
|
|
157
|
+
ownerClear?: () => void
|
|
158
|
+
resetCheckedIds?: boolean
|
|
159
|
+
searchText?: string
|
|
160
|
+
clearText?: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface IEmits {
|
|
164
|
+
(e: 'update:formData', val: Record<string, any>): void
|
|
165
|
+
(e: 'isPickerEmpty', val: Record<string, boolean>): void
|
|
166
|
+
(e: 'search', formData: Record<string, any>): void
|
|
167
|
+
(e: 'clear'): void
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
171
|
+
labelPosition: 'right',
|
|
172
|
+
isShowSearchBtn: true,
|
|
173
|
+
isInline: false,
|
|
174
|
+
width: '100px',
|
|
175
|
+
showClear: true,
|
|
176
|
+
showLabel: true,
|
|
177
|
+
searchText: '搜索',
|
|
178
|
+
clearText: '清除',
|
|
179
|
+
})
|
|
214
180
|
|
|
215
|
-
|
|
216
|
-
this.$emit('search', this.formData)
|
|
217
|
-
},
|
|
181
|
+
const emit = defineEmits<IEmits>()
|
|
218
182
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// eslint-disable-next-line
|
|
222
|
-
this.formData[prop[0]] = '';
|
|
223
|
-
// eslint-disable-next-line
|
|
224
|
-
this.formData[prop[1]] = '';
|
|
225
|
-
}
|
|
226
|
-
this.$set(this.checkedIds, key, value)
|
|
227
|
-
this.$emit('isPickerEmpty', this.checkedIds)
|
|
228
|
-
},
|
|
183
|
+
const initialData = ref<Record<string, any>>({})
|
|
184
|
+
const checkedIds = ref<Record<string, boolean>>({})
|
|
229
185
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Object.keys(this.checkedIds).forEach((k) => {
|
|
236
|
-
this.checkedIds[k] = false
|
|
237
|
-
})
|
|
238
|
-
this.$emit('update:formData', { ...this.formData, ...this.initialData })
|
|
239
|
-
this.$emit('clear')
|
|
240
|
-
},
|
|
186
|
+
watch(() => props.resetCheckedIds, () => {
|
|
187
|
+
props.config.filter(c => c.type === 'doubleDatePicker').map(t => t.key).forEach((k: string) => {
|
|
188
|
+
checkedIds.value[k] = false
|
|
189
|
+
})
|
|
190
|
+
})
|
|
241
191
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
192
|
+
onMounted(() => {
|
|
193
|
+
initialData.value = Object.freeze({ ...props.formData })
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
const handleInput = (val: any, prop: string | number, inputLimitCallback?: any, key?: string) => {
|
|
197
|
+
if (inputLimitCallback && !inputLimitCallback(val)) return false
|
|
198
|
+
if (val && key) {
|
|
199
|
+
checkedIds.value[key] = false
|
|
245
200
|
}
|
|
201
|
+
emit('update:formData', { ...props.formData, [prop]: val })
|
|
202
|
+
emit('isPickerEmpty', checkedIds.value)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const handleSearch = () => {
|
|
206
|
+
emit('search', props.formData)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const handelIsEmpty = (prop: string[], value: boolean, key: string) => {
|
|
210
|
+
if (value) {
|
|
211
|
+
emit('update:formData', { ...props.formData, [prop[0]]: '', [prop[1]]: '' })
|
|
212
|
+
}
|
|
213
|
+
checkedIds.value[key] = value
|
|
214
|
+
emit('isPickerEmpty', checkedIds.value)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const handleClearParams = () => {
|
|
218
|
+
if (props.ownerClear && typeof props.ownerClear === 'function') {
|
|
219
|
+
props.ownerClear()
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
Object.keys(checkedIds.value).forEach((k) => {
|
|
223
|
+
checkedIds.value[k] = false
|
|
224
|
+
})
|
|
225
|
+
emit('update:formData', { ...props.formData, ...initialData.value })
|
|
226
|
+
emit('clear')
|
|
246
227
|
}
|
|
247
228
|
</script>
|
|
248
229
|
<style scoped lang="less">
|
|
249
230
|
.form-double-inline {
|
|
250
231
|
display: flex;
|
|
251
|
-
|
|
232
|
+
:deep(.el-input) {
|
|
252
233
|
&:not(:first-child) {
|
|
253
234
|
margin-left: 4px;
|
|
254
235
|
}
|
|
255
236
|
}
|
|
256
|
-
|
|
257
|
-
&:not(:first-child){
|
|
237
|
+
:deep(.el-date-editor) {
|
|
238
|
+
&:not(:first-child) {
|
|
258
239
|
margin-left: 4px;
|
|
259
240
|
}
|
|
260
241
|
}
|
|
242
|
+
:deep(.is-empty) {
|
|
243
|
+
margin-left: 4px;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
:deep(.el-select) {
|
|
247
|
+
min-width: 180px;
|
|
248
|
+
}
|
|
249
|
+
:deep(.el-form-item__label) {
|
|
250
|
+
height: auto;
|
|
261
251
|
}
|
|
262
252
|
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DatePickerProps } from 'element-plus'
|
|
2
2
|
|
|
3
3
|
type BaseOption = {
|
|
4
4
|
label: string
|
|
@@ -41,7 +41,7 @@ type DatePickerOption = BaseOption & {
|
|
|
41
41
|
type: 'datePicker'
|
|
42
42
|
dateType?: string
|
|
43
43
|
rangeSeparator?: string
|
|
44
|
-
datePickerOptions?:
|
|
44
|
+
datePickerOptions?: DatePickerProps['disabledDate']
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
type BaseDoubleOption = Omit<BaseOption, 'prop'> & {
|
|
@@ -62,8 +62,8 @@ type DoubleDatePickerOptionBase = BaseDoubleOption & {
|
|
|
62
62
|
|
|
63
63
|
type DoubleDatePickerOption = DoubleDatePickerOptionBase & {
|
|
64
64
|
pickerOptions?: {
|
|
65
|
-
start?:
|
|
66
|
-
end?:
|
|
65
|
+
start?: DatePickerProps['disabledDate']
|
|
66
|
+
end?: DatePickerProps['disabledDate']
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
v-model="content"
|
|
11
11
|
class="search-select__input"
|
|
12
12
|
:placeholder="placeholder"
|
|
13
|
-
@
|
|
13
|
+
@update:modelValue="handleInputChange"
|
|
14
14
|
@focus="handleFocus"
|
|
15
15
|
@blur="handleBlur"
|
|
16
16
|
/>
|
|
@@ -38,72 +38,88 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
|
-
<script>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { ref, watch } from 'vue'
|
|
43
|
+
|
|
44
|
+
defineOptions({ name: 'SearchSelect' })
|
|
45
|
+
|
|
46
|
+
interface IProps {
|
|
47
|
+
value?: string
|
|
48
|
+
modelValue?: string
|
|
49
|
+
placeholder?: string
|
|
50
|
+
list?: any[]
|
|
51
|
+
showList?: any[]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface IEmits {
|
|
55
|
+
(e: 'input', val: string): void
|
|
56
|
+
(e: 'update:modelValue', val: string): void
|
|
57
|
+
(e: 'update:value', val: string): void
|
|
58
|
+
(e: 'select', item: any): void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
62
|
+
value: '',
|
|
63
|
+
modelValue: '',
|
|
64
|
+
placeholder: '请输入',
|
|
65
|
+
list: () => [],
|
|
66
|
+
showList: () => [],
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const emit = defineEmits<IEmits>()
|
|
70
|
+
|
|
71
|
+
const content = ref('')
|
|
72
|
+
const visible = ref(false)
|
|
73
|
+
const currentId = ref(0)
|
|
74
|
+
const input = ref<{ blur: () => void }>()
|
|
75
|
+
|
|
76
|
+
watch(() => props.value, (val) => {
|
|
77
|
+
content.value = val
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
watch(() => props.modelValue, (val) => {
|
|
81
|
+
content.value = val
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const handleFocus = () => {
|
|
85
|
+
visible.value = true
|
|
86
|
+
emit('input', content.value)
|
|
87
|
+
emit('update:modelValue', content.value)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const handleInputChange = (params: string) => {
|
|
91
|
+
emit('update:value', params)
|
|
92
|
+
emit('input', params)
|
|
93
|
+
emit('update:modelValue', params)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const navigateOptions = (e: KeyboardEvent, params: string) => {
|
|
97
|
+
const target = e.target as HTMLInputElement
|
|
98
|
+
target.selectionStart = content.value.length
|
|
99
|
+
if (params === 'next') currentId.value = currentId.value === props.list.length - 1 ? 0 : currentId.value + 1
|
|
100
|
+
if (params === 'prev') currentId.value = currentId.value === 0 ? props.list.length - 1 : currentId.value - 1
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const selectOption = () => {
|
|
104
|
+
visible.value = false
|
|
105
|
+
input.value?.blur()
|
|
106
|
+
emit('select', props.list[currentId.value])
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const handleBlur = () => {
|
|
110
|
+
const timer = setTimeout(() => {
|
|
111
|
+
visible.value = false
|
|
112
|
+
clearTimeout(timer)
|
|
113
|
+
}, 300)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const handleSelect = (item: any) => {
|
|
117
|
+
emit('select', item)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const getKey = (item: any, index: number) => {
|
|
121
|
+
return btoa(escape(`${item}_${index}`))
|
|
122
|
+
}
|
|
107
123
|
</script>
|
|
108
124
|
|
|
109
125
|
<style lang="less">
|
package/src/components/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import SearchSelect from './SearchSelect/index.vue'
|
|
|
8
8
|
import AddMembers from './AddMembers/index.vue'
|
|
9
9
|
import PopoverForm from './PopoverForm/index.vue'
|
|
10
10
|
import EditableTable from './EditableTable/index.vue'
|
|
11
|
-
import SingleMessage from './singleMessage/index'
|
|
11
|
+
import { SingleMessage } from './singleMessage/index'
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
14
|
DemoComponent,
|
|
@@ -1,44 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
messageInstance
|
|
18
|
-
&& (messageInstance.message !== options.message || messageInstance.type !== options.type)
|
|
19
|
-
) {
|
|
20
|
-
messageInstance.close();
|
|
21
|
-
messageInstance = Message({ ...options, duration: 0 });
|
|
22
|
-
return closeMsg(messageInstance);
|
|
23
|
-
}
|
|
24
|
-
if (messageInstance) {
|
|
25
|
-
messageInstance.singleTimer && clearTimeout(messageInstance.singleTimer);
|
|
26
|
-
return closeMsg(messageInstance);
|
|
27
|
-
}
|
|
28
|
-
messageInstance = Message({ ...options, duration: 0 });
|
|
29
|
-
closeMsg(messageInstance);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
['error', 'success', 'info', 'warning'].forEach(type => {
|
|
33
|
-
singleMessage[type] = options => {
|
|
34
|
-
if (typeof options === 'string') {
|
|
35
|
-
options = {
|
|
36
|
-
message: options,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
options.type = type;
|
|
40
|
-
return singleMessage(options);
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export default singleMessage;
|
|
1
|
+
import { ElMessage } from 'element-plus';
|
|
2
|
+
|
|
3
|
+
export interface ISingleMessageOption {
|
|
4
|
+
message: string;
|
|
5
|
+
type?: 'success' | 'warning' | 'info' | 'error';
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function SingleMessage(option: ISingleMessageOption) {
|
|
10
|
+
ElMessage({
|
|
11
|
+
message: option.message,
|
|
12
|
+
type: option.type || 'success',
|
|
13
|
+
duration: option.duration || 3000,
|
|
14
|
+
});
|
|
15
|
+
}
|