@lx-frontend/wrap-element-ui 1.0.28-beta.3 → 2.0.0-beta.1
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/useColumnHeaderOperation.ts +5 -4
- package/src/components/EditableTable/bizHooks/useDefaultOperation.ts +12 -4
- package/src/components/EditableTable/bizHooks/useDragSort.ts +6 -2
- 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 +25 -15
- 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
|
@@ -3,123 +3,106 @@
|
|
|
3
3
|
<div class="ellipsis__container" :style="{ 'font-size': `${fontSize}px`, 'line-height': lineHeight, color }">
|
|
4
4
|
<div class="ellipsis__content" ref="contentEl" :style="{ height: `${preHeight}px`, 'align-items': alignItems }">{{ preContent }}</div>
|
|
5
5
|
<div class="ellipsis__last-line" ref="lastLineEl" :style="{ height: `${lastLineHeight}px` }">{{ restContent }}
|
|
6
|
-
<
|
|
6
|
+
<el-icon v-if="isShowIconMethod()" class="ellipsis__icon"><ArrowDown /></el-icon>
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<script>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
// 由于在 element table 中,渲染计算时的宽度可能与实际展示时的宽度可能存在偏差,在此把宽度固定为组件挂载时获取到的宽度
|
|
71
|
-
this.$refs.contentEl.style.width = `${this.$refs.contentEl.offsetWidth}px`
|
|
72
|
-
// 处理长度为1的数据不用走截取逻辑减少计算
|
|
73
|
-
if (this.content.length === 1) {
|
|
74
|
-
this.restContent = this.content;
|
|
75
|
-
this.$refs.contentEl.remove();
|
|
76
|
-
this.lastLineHeight = (this.fontSize + 2);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
this.bsearch(this.content)
|
|
80
|
-
this.lastLineHeight = (this.fontSize + 2)
|
|
81
|
-
},
|
|
82
|
-
methods: {
|
|
83
|
-
bsearch (data, pre = 0) {
|
|
84
|
-
const len = data.length
|
|
85
|
-
const half = Math.floor((len - pre) / 2) + pre
|
|
86
|
-
if (len - pre <= 1) {
|
|
87
|
-
const restContent = pre === 0 ? this.content.slice(pre) : this.content.slice(pre + 1)
|
|
88
|
-
this.preContent = pre === 0 ? '' : data.slice(0, pre + 1)
|
|
89
|
-
if (!restContent) {
|
|
90
|
-
this.lastLineHeight = 0
|
|
91
|
-
this.$emit('update:isOverflow', false)
|
|
92
|
-
return false
|
|
93
|
-
}
|
|
94
|
-
this.restContent = restContent
|
|
95
|
-
this.$nextTick(() => {
|
|
96
|
-
this.$emit('update:isOverflow', this.$refs.lastLineEl.scrollWidth !== this.$refs.lastLineEl.offsetWidth)
|
|
97
|
-
})
|
|
98
|
-
return true
|
|
99
|
-
}
|
|
100
|
-
this.preContent = data.slice(0, half + 1)
|
|
101
|
-
this.$nextTick(() => {
|
|
102
|
-
const isEqual = this.$refs.contentEl.scrollHeight === this.preHeight
|
|
103
|
-
if (isEqual) {
|
|
104
|
-
this.alignItems = 'center'
|
|
105
|
-
return this.bsearch(data, half)
|
|
106
|
-
}
|
|
107
|
-
this.alignItems = 'flex-start'
|
|
108
|
-
return this.bsearch(data.slice(0, half), pre)
|
|
109
|
-
})
|
|
110
|
-
return true
|
|
111
|
-
},
|
|
112
|
-
isShowIconMethod() {
|
|
113
|
-
/**
|
|
114
|
-
* 1、isShowIcon--是否展示icon; length-- 所有传入数据总数量
|
|
115
|
-
* 2、this.overCountTip.index === this.overCountTip.length 当前列表展示个数(最后一个列)
|
|
116
|
-
* 3、length > this.overCountTip.length 满足总个数大于当前列表展示个数
|
|
117
|
-
**/
|
|
118
|
-
const { isShowIcon, length } = this.showIconObj;
|
|
119
|
-
return (isShowIcon && this.overCountTip.index === this.overCountTip.length && this.content.length && (length > this.overCountTip.length));
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { ref, computed, onMounted, nextTick } from 'vue'
|
|
14
|
+
import { ArrowDown } from '@element-plus/icons-vue'
|
|
15
|
+
|
|
16
|
+
defineOptions({ name: 'MultilineEllipsis' })
|
|
17
|
+
|
|
18
|
+
interface IProps {
|
|
19
|
+
fontSize?: number
|
|
20
|
+
color?: string
|
|
21
|
+
lineCount?: number
|
|
22
|
+
content?: string
|
|
23
|
+
isOverflow?: boolean
|
|
24
|
+
iconName?: string
|
|
25
|
+
overCountTip?: Record<string, any>
|
|
26
|
+
showIconObj?: { isShowIcon: boolean; length: number }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface IEmits {
|
|
30
|
+
(e: 'update:is-overflow', val: boolean): void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
34
|
+
fontSize: 12,
|
|
35
|
+
color: '#000000',
|
|
36
|
+
lineCount: 1,
|
|
37
|
+
content: '',
|
|
38
|
+
isOverflow: false,
|
|
39
|
+
iconName: 'el-icon-arrow-down',
|
|
40
|
+
showIconObj: () => ({ isShowIcon: false, length: 0 }),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const emit = defineEmits<IEmits>()
|
|
44
|
+
|
|
45
|
+
const restContent = ref('')
|
|
46
|
+
const preContent = ref('')
|
|
47
|
+
const lastLineHeight = ref(0)
|
|
48
|
+
const alignItems = ref('center')
|
|
49
|
+
const contentEl = ref<HTMLElement>()
|
|
50
|
+
const lastLineEl = ref<HTMLElement>()
|
|
51
|
+
|
|
52
|
+
const preHeight = computed(() => {
|
|
53
|
+
return (props.fontSize + 2) * (props.lineCount - 1)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const lineHeight = computed(() => {
|
|
57
|
+
return `${props.fontSize + 2}px`
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const bsearch = (data: string, pre = 0): boolean => {
|
|
61
|
+
const len = data.length
|
|
62
|
+
const half = Math.floor((len - pre) / 2) + pre
|
|
63
|
+
if (len - pre <= 1) {
|
|
64
|
+
const _restContent = pre === 0 ? props.content.slice(pre) : props.content.slice(pre + 1)
|
|
65
|
+
preContent.value = pre === 0 ? '' : data.slice(0, pre + 1)
|
|
66
|
+
if (!_restContent) {
|
|
67
|
+
lastLineHeight.value = 0
|
|
68
|
+
emit('update:is-overflow', false)
|
|
69
|
+
return false
|
|
120
70
|
}
|
|
71
|
+
restContent.value = _restContent
|
|
72
|
+
nextTick(() => {
|
|
73
|
+
emit('update:is-overflow', lastLineEl.value!.scrollWidth !== lastLineEl.value!.offsetWidth)
|
|
74
|
+
})
|
|
75
|
+
return true
|
|
121
76
|
}
|
|
77
|
+
preContent.value = data.slice(0, half + 1)
|
|
78
|
+
nextTick(() => {
|
|
79
|
+
const isEqual = contentEl.value!.scrollHeight === preHeight.value
|
|
80
|
+
if (isEqual) {
|
|
81
|
+
alignItems.value = 'center'
|
|
82
|
+
return bsearch(data, half)
|
|
83
|
+
}
|
|
84
|
+
alignItems.value = 'flex-start'
|
|
85
|
+
return bsearch(data.slice(0, half), pre)
|
|
86
|
+
})
|
|
87
|
+
return true
|
|
122
88
|
}
|
|
89
|
+
|
|
90
|
+
const isShowIconMethod = () => {
|
|
91
|
+
const { isShowIcon, length } = props.showIconObj
|
|
92
|
+
return (isShowIcon && props.overCountTip!.index === props.overCountTip!.length && props.content.length && (length > props.overCountTip!.length))
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
contentEl.value!.style.width = `${contentEl.value!.offsetWidth}px`
|
|
97
|
+
if (props.content.length === 1) {
|
|
98
|
+
restContent.value = props.content
|
|
99
|
+
contentEl.value!.remove()
|
|
100
|
+
lastLineHeight.value = (props.fontSize + 2)
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
bsearch(props.content)
|
|
104
|
+
lastLineHeight.value = (props.fontSize + 2)
|
|
105
|
+
})
|
|
123
106
|
</script>
|
|
124
107
|
|
|
125
108
|
<style lang="less">
|
|
@@ -137,5 +120,9 @@ export default {
|
|
|
137
120
|
white-space: nowrap;
|
|
138
121
|
text-overflow: ellipsis;
|
|
139
122
|
}
|
|
123
|
+
&__icon {
|
|
124
|
+
vertical-align: middle;
|
|
125
|
+
margin-left: 2px;
|
|
126
|
+
}
|
|
140
127
|
}
|
|
141
128
|
</style>
|
|
@@ -1,110 +1,135 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ellipsis-popover">
|
|
3
3
|
<ElPopover
|
|
4
|
-
:
|
|
4
|
+
:visible="popoverVisible"
|
|
5
|
+
:width="'auto'"
|
|
5
6
|
:popper-class="popoverName"
|
|
6
7
|
placement="top-start"
|
|
7
|
-
trigger="
|
|
8
|
+
:trigger="('manual' as any)"
|
|
8
9
|
>
|
|
9
10
|
<div class="popover-content">
|
|
10
11
|
<slot name="popover">
|
|
11
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
v-for="(item, index) in contentArr"
|
|
14
|
+
:key="getKey(item, index)"
|
|
15
|
+
>
|
|
16
|
+
{{ item }}
|
|
17
|
+
</div>
|
|
12
18
|
</slot>
|
|
13
19
|
</div>
|
|
14
|
-
<
|
|
15
|
-
<div
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
<template #reference>
|
|
21
|
+
<div
|
|
22
|
+
ref="referenceEl"
|
|
23
|
+
@mouseenter="onMouseEnter"
|
|
24
|
+
@mouseleave="onMouseLeave"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
v-for="(item, index) in contentArr"
|
|
28
|
+
:key="getKey(item, index)"
|
|
29
|
+
>
|
|
30
|
+
<MultilineEllipsis
|
|
31
|
+
:content="item"
|
|
32
|
+
:font-size="fontSize"
|
|
33
|
+
:color="color"
|
|
34
|
+
:line-count="lineCount"
|
|
35
|
+
:icon-name="iconName"
|
|
36
|
+
:show-icon-obj="{
|
|
37
|
+
isShowIcon: showIconObj.isShowIcon,
|
|
38
|
+
length: showIconObj.length,
|
|
39
|
+
}"
|
|
40
|
+
:over-count-tip="{
|
|
41
|
+
index: index + 1,
|
|
42
|
+
length: contentArr.length,
|
|
43
|
+
}"
|
|
44
|
+
:is-overflow="overflowArr[index]"
|
|
45
|
+
@update:is-overflow="val => handleOverflowUpdate(index, val)"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
32
48
|
</div>
|
|
33
|
-
</
|
|
49
|
+
</template>
|
|
34
50
|
</ElPopover>
|
|
35
51
|
</div>
|
|
36
52
|
</template>
|
|
37
53
|
|
|
38
|
-
<script>
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { ref, computed, watch } from 'vue'
|
|
56
|
+
import { ElPopover } from 'element-plus'
|
|
39
57
|
import MultilineEllipsis from './MultilineEllipsis.vue'
|
|
40
58
|
|
|
41
|
-
|
|
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
|
-
return {
|
|
87
|
-
overflowArr: []
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
computed: {
|
|
91
|
-
contentArr () {
|
|
92
|
-
return typeof (this.content) === 'string' ? [this.content] : [...this.content]
|
|
93
|
-
},
|
|
94
|
-
isOverflow () {
|
|
95
|
-
return this.overflowArr.includes(true)
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
watch: {
|
|
99
|
-
contentArr (val) {
|
|
100
|
-
this.overflowArr.length = val.length
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
methods: {
|
|
104
|
-
getKey (item, index) {
|
|
105
|
-
return btoa(escape(`${item}_${index}`))
|
|
106
|
-
}
|
|
59
|
+
defineOptions({ name: 'Ellipsis' })
|
|
60
|
+
|
|
61
|
+
interface IProps {
|
|
62
|
+
fontSize?: number
|
|
63
|
+
color?: string
|
|
64
|
+
lineCount?: number
|
|
65
|
+
iconName?: string
|
|
66
|
+
overCountTip?: Record<string, any>
|
|
67
|
+
showIconObj?: { isShowIcon: boolean; length: number }
|
|
68
|
+
content?: string | string[]
|
|
69
|
+
popoverName?: string
|
|
70
|
+
showPopover?: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
74
|
+
fontSize: 12,
|
|
75
|
+
color: '#000000',
|
|
76
|
+
lineCount: 1,
|
|
77
|
+
iconName: 'arrow-down',
|
|
78
|
+
showIconObj: () => ({ isShowIcon: false, length: 0 }),
|
|
79
|
+
content: '',
|
|
80
|
+
showPopover: 'auto',
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const overflowArr = ref<boolean[]>([])
|
|
84
|
+
const innerVisible = ref(false)
|
|
85
|
+
const referenceEl = ref<HTMLElement>()
|
|
86
|
+
|
|
87
|
+
const contentArr = computed(() => {
|
|
88
|
+
return typeof props.content === 'string' ? [props.content] : [...props.content]
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const isOverflow = computed(() => {
|
|
92
|
+
return overflowArr.value.includes(true)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const popoverVisible = computed(() => {
|
|
96
|
+
if (props.showPopover === 'off') return false
|
|
97
|
+
if (props.showPopover === 'always') return innerVisible.value
|
|
98
|
+
return innerVisible.value && isOverflow.value
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
watch(contentArr, (val) => {
|
|
102
|
+
if (val.length !== overflowArr.value.length) {
|
|
103
|
+
overflowArr.value = new Array(val.length).fill(false)
|
|
107
104
|
}
|
|
105
|
+
}, { immediate: true })
|
|
106
|
+
|
|
107
|
+
const handleOverflowUpdate = (index: number, val: boolean) => {
|
|
108
|
+
const newArr = [...overflowArr.value]
|
|
109
|
+
newArr[index] = val
|
|
110
|
+
overflowArr.value = newArr
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const checkOverflow = () => {
|
|
114
|
+
const ref = referenceEl.value
|
|
115
|
+
if (!ref) return
|
|
116
|
+
const lastLineEls = ref.querySelectorAll('.ellipsis__last-line')
|
|
117
|
+
if (lastLineEls.length > 0) {
|
|
118
|
+
overflowArr.value = [...lastLineEls as any].map((el: HTMLElement) => el.scrollWidth > el.offsetWidth)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const onMouseEnter = () => {
|
|
123
|
+
checkOverflow()
|
|
124
|
+
innerVisible.value = true
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const onMouseLeave = () => {
|
|
128
|
+
innerVisible.value = false
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const getKey = (item: any, index: number) => {
|
|
132
|
+
return btoa(escape(`${item}_${index}`))
|
|
108
133
|
}
|
|
109
134
|
</script>
|
|
110
135
|
|