n20-common-lib 3.0.87 → 3.0.89
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 +1 -1
- package/src/assets/css/table.scss +2 -1
- package/src/assets/css/v3/table.scss +2 -2
- package/src/components/Pivot/index.vue +15 -10
- package/src/components/v3/TablePro/index.vue +3 -3
- package/style/index.css +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
- package/src/components/Pivot/ViewToggle.vue +0 -132
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="view-toggle" :class="{ disabled }">
|
|
3
|
-
<div class="toggle-container">
|
|
4
|
-
<div
|
|
5
|
-
v-for="(item, index) in options"
|
|
6
|
-
:key="item.value"
|
|
7
|
-
class="toggle-item"
|
|
8
|
-
:class="{ active: value === item.value }"
|
|
9
|
-
:style="itemStyle"
|
|
10
|
-
@click="handleChange(item.value)"
|
|
11
|
-
>
|
|
12
|
-
{{ item.label }}
|
|
13
|
-
</div>
|
|
14
|
-
<div class="toggle-indicator" :style="indicatorStyle"></div>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
export default {
|
|
21
|
-
name: 'ViewToggle',
|
|
22
|
-
props: {
|
|
23
|
-
value: {
|
|
24
|
-
type: [String, Number],
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
options: {
|
|
28
|
-
type: Array,
|
|
29
|
-
required: true,
|
|
30
|
-
validator(value) {
|
|
31
|
-
return value.every((item) => item.label && item.value !== undefined)
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
itemWidth: {
|
|
35
|
-
type: [Number, String],
|
|
36
|
-
default: 80
|
|
37
|
-
},
|
|
38
|
-
itemHeight: {
|
|
39
|
-
type: [Number, String],
|
|
40
|
-
default: 30
|
|
41
|
-
},
|
|
42
|
-
disabled: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
computed: {
|
|
48
|
-
itemStyle() {
|
|
49
|
-
const width = typeof this.itemWidth === 'number' ? `${this.itemWidth}px` : this.itemWidth
|
|
50
|
-
const height = typeof this.itemHeight === 'number' ? `${this.itemHeight}px` : this.itemHeight
|
|
51
|
-
return {
|
|
52
|
-
width,
|
|
53
|
-
height
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
indicatorStyle() {
|
|
57
|
-
const itemW = typeof this.itemWidth === 'number' ? this.itemWidth : parseInt(this.itemWidth)
|
|
58
|
-
const itemH = typeof this.itemHeight === 'number' ? this.itemHeight : parseInt(this.itemHeight)
|
|
59
|
-
const gap = 2
|
|
60
|
-
const activeIndex = this.options.findIndex((item) => item.value === this.value)
|
|
61
|
-
const translateX = activeIndex >= 0 ? activeIndex * itemW : 0
|
|
62
|
-
return {
|
|
63
|
-
width: `${itemW - 2 * gap}px`,
|
|
64
|
-
height: `${itemH - 2 * gap}px`,
|
|
65
|
-
top: `${gap}px`,
|
|
66
|
-
left: `${gap}px`,
|
|
67
|
-
transform: `translateX(${translateX}px)`
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
methods: {
|
|
72
|
-
handleChange(val) {
|
|
73
|
-
if (this.disabled) return
|
|
74
|
-
if (val !== this.value) {
|
|
75
|
-
this.$emit('input', val)
|
|
76
|
-
this.$emit('change', val)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<style lang="scss" scoped>
|
|
84
|
-
.view-toggle {
|
|
85
|
-
background: #f2f3f5;
|
|
86
|
-
border-radius: 4px;
|
|
87
|
-
padding: 2px;
|
|
88
|
-
display: inline-block;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.view-toggle.disabled {
|
|
92
|
-
opacity: 0.6;
|
|
93
|
-
cursor: not-allowed;
|
|
94
|
-
pointer-events: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.toggle-container {
|
|
98
|
-
display: flex;
|
|
99
|
-
position: relative;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.toggle-item {
|
|
103
|
-
display: flex;
|
|
104
|
-
align-items: center;
|
|
105
|
-
justify-content: center;
|
|
106
|
-
color: var(--text-1, #1d2129);
|
|
107
|
-
font-family: 'PingFang SC';
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
font-style: normal;
|
|
110
|
-
font-weight: 400;
|
|
111
|
-
line-height: 22px;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
border-radius: 2px;
|
|
114
|
-
transition: all 0.2s;
|
|
115
|
-
z-index: 1;
|
|
116
|
-
user-select: none;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.toggle-item.active {
|
|
120
|
-
color: var(--primary-6, #007aff);
|
|
121
|
-
font-weight: 500;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.toggle-indicator {
|
|
125
|
-
position: absolute;
|
|
126
|
-
background: #fff;
|
|
127
|
-
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.08);
|
|
128
|
-
border-radius: 2px;
|
|
129
|
-
transition: transform 0.2s;
|
|
130
|
-
z-index: 0;
|
|
131
|
-
}
|
|
132
|
-
</style>
|