@lx-frontend/wrap-element-ui 0.4.2-beta → 0.4.3-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/.tool-versions +1 -0
- package/README.md +54 -54
- package/babel.config.js +5 -5
- package/global.d.ts +23 -23
- package/package.json +48 -48
- package/packages/AddMembers/index.js +11 -11
- package/packages/AddMembers/src/AddMembers.vue +127 -127
- package/packages/AuditSteps/index.js +7 -7
- package/packages/AuditSteps/src/AuditSteps.vue +85 -85
- package/packages/DemoComponent/index.js +7 -7
- package/packages/DemoComponent/src/DemoComponent.vue +10 -10
- package/packages/Ellipsis/index.js +7 -7
- package/packages/Ellipsis/src/Ellipsis.vue +119 -119
- package/packages/Ellipsis/src/MultilineEllipsis.vue +141 -141
- package/packages/LxTable/index.js +11 -11
- package/packages/LxTable/src/LxTable.vue +281 -281
- package/packages/PopoverForm/index.js +7 -7
- package/packages/PopoverForm/src/PopoverForm.vue +66 -66
- package/packages/SearchForm/index.js +7 -7
- package/packages/SearchForm/src/SearchForm.vue +217 -224
- package/packages/SearchSelect/index.js +7 -7
- package/packages/SearchSelect/src/SearchSelect.vue +150 -150
- package/packages/index.js +59 -59
- package/packages/lib/AddMembers.js +1 -0
- package/packages/lib/AuditSteps.js +1 -0
- package/packages/lib/DemoComponent.js +1 -0
- package/packages/lib/Ellipsis.js +1 -0
- package/packages/lib/LxTable.js +21 -0
- package/packages/lib/PopoverForm.js +1 -0
- package/packages/lib/SearchForm.js +1 -0
- package/packages/lib/SearchSelect.js +1 -0
- package/packages/lib/index.js +21 -0
- package/packages/singleMessage/index.ts +44 -44
- package/packages/theme-default/gulpfile.js +25 -25
- package/packages/theme-default/package.json +23 -23
- package/packages/theme-default/src/AuditSteps.scss +52 -52
- package/packages/theme-default/src/DemoComponent.scss +9 -9
- package/packages/theme-default/src/index.css +11 -11
- package/packages/theme-default/src/index.scss +2 -2
- package/plugins/wrap.js +22 -22
- package/postcss.config.js +5 -5
- package/tsconfig.json +41 -41
- package/yarn.lock +0 -12226
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ellipsis">
|
|
3
|
-
<div class="ellipsis__container" :style="{ 'font-size': `${fontSize}px`, 'line-height': lineHeight, color }">
|
|
4
|
-
<div class="ellipsis__content" ref="contentEl" :style="{ height: `${preHeight}px`, 'align-items': alignItems }">{{ preContent }}</div>
|
|
5
|
-
<div class="ellipsis__last-line" ref="lastLineEl" :style="{ height: `${lastLineHeight}px` }">{{ restContent }}
|
|
6
|
-
<span v-if="isShowIconMethod()" :class="iconName"></span>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: 'MultilineEllipsis',
|
|
15
|
-
props: {
|
|
16
|
-
fontSize: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 12
|
|
19
|
-
},
|
|
20
|
-
color: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: '#000000'
|
|
23
|
-
},
|
|
24
|
-
lineCount: {
|
|
25
|
-
type: Number,
|
|
26
|
-
default: 1
|
|
27
|
-
},
|
|
28
|
-
content: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: ''
|
|
31
|
-
},
|
|
32
|
-
isOverflow: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
},
|
|
36
|
-
iconName: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: 'el-icon-arrow-down'
|
|
39
|
-
},
|
|
40
|
-
overCountTip: {
|
|
41
|
-
type: Object,
|
|
42
|
-
},
|
|
43
|
-
showIconObj: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: () => {
|
|
46
|
-
return {
|
|
47
|
-
isShowIcon: false,
|
|
48
|
-
length: 0,
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
data () {
|
|
54
|
-
return {
|
|
55
|
-
restContent: '',
|
|
56
|
-
preContent: '',
|
|
57
|
-
lastLineHeight: 0,
|
|
58
|
-
alignItems: 'center'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
computed: {
|
|
62
|
-
preHeight () {
|
|
63
|
-
return (this.fontSize + 2) * (this.lineCount - 1)
|
|
64
|
-
},
|
|
65
|
-
lineHeight () {
|
|
66
|
-
return `${this.fontSize + 2}px`
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
mounted () {
|
|
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));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
</script>
|
|
124
|
-
|
|
125
|
-
<style lang="scss">
|
|
126
|
-
.ellipsis {
|
|
127
|
-
width: 100%;
|
|
128
|
-
margin: 5px auto;
|
|
129
|
-
&__content {
|
|
130
|
-
width: 100%;
|
|
131
|
-
overflow: hidden;
|
|
132
|
-
display: flex;
|
|
133
|
-
}
|
|
134
|
-
&__last-line {
|
|
135
|
-
width: 100%;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
white-space: nowrap;
|
|
138
|
-
text-overflow: ellipsis;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ellipsis">
|
|
3
|
+
<div class="ellipsis__container" :style="{ 'font-size': `${fontSize}px`, 'line-height': lineHeight, color }">
|
|
4
|
+
<div class="ellipsis__content" ref="contentEl" :style="{ height: `${preHeight}px`, 'align-items': alignItems }">{{ preContent }}</div>
|
|
5
|
+
<div class="ellipsis__last-line" ref="lastLineEl" :style="{ height: `${lastLineHeight}px` }">{{ restContent }}
|
|
6
|
+
<span v-if="isShowIconMethod()" :class="iconName"></span>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'MultilineEllipsis',
|
|
15
|
+
props: {
|
|
16
|
+
fontSize: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 12
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '#000000'
|
|
23
|
+
},
|
|
24
|
+
lineCount: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 1
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
isOverflow: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
iconName: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'el-icon-arrow-down'
|
|
39
|
+
},
|
|
40
|
+
overCountTip: {
|
|
41
|
+
type: Object,
|
|
42
|
+
},
|
|
43
|
+
showIconObj: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => {
|
|
46
|
+
return {
|
|
47
|
+
isShowIcon: false,
|
|
48
|
+
length: 0,
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
data () {
|
|
54
|
+
return {
|
|
55
|
+
restContent: '',
|
|
56
|
+
preContent: '',
|
|
57
|
+
lastLineHeight: 0,
|
|
58
|
+
alignItems: 'center'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
preHeight () {
|
|
63
|
+
return (this.fontSize + 2) * (this.lineCount - 1)
|
|
64
|
+
},
|
|
65
|
+
lineHeight () {
|
|
66
|
+
return `${this.fontSize + 2}px`
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
mounted () {
|
|
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));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="scss">
|
|
126
|
+
.ellipsis {
|
|
127
|
+
width: 100%;
|
|
128
|
+
margin: 5px auto;
|
|
129
|
+
&__content {
|
|
130
|
+
width: 100%;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
display: flex;
|
|
133
|
+
}
|
|
134
|
+
&__last-line {
|
|
135
|
+
width: 100%;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
text-overflow: ellipsis;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author monkeywang
|
|
3
|
-
* Date: 17/11/9
|
|
4
|
-
*/
|
|
5
|
-
import LxTable from './src/LxTable.vue';
|
|
6
|
-
|
|
7
|
-
LxTable.install = function (Vue) {
|
|
8
|
-
Vue.component(LxTable.name, LxTable)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default LxTable
|
|
1
|
+
/**
|
|
2
|
+
* @author monkeywang
|
|
3
|
+
* Date: 17/11/9
|
|
4
|
+
*/
|
|
5
|
+
import LxTable from './src/LxTable.vue';
|
|
6
|
+
|
|
7
|
+
LxTable.install = function (Vue) {
|
|
8
|
+
Vue.component(LxTable.name, LxTable)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default LxTable
|