xt-element-ui 1.2.8 → 1.3.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/docs/components/base/xt-map.md +331 -0
- package/docs/components/base/xt-step-price.md +103 -217
- package/lib/index.common.js +2218 -87
- package/lib/index.css +1 -1
- package/lib/index.umd.js +2218 -87
- package/lib/index.umd.min.js +5 -5
- package/package.json +4 -3
- package/src/components/ex-button/index.js +8 -2
- package/src/components/ex-chart/index.js +6 -0
- package/src/components/ex-date-picker/index.js +8 -2
- package/src/components/ex-icon/index.js +6 -0
- package/src/components/ex-page/index.js +8 -2
- package/src/components/ex-select-tree/index.js +8 -2
- package/src/components/ex-table/index.js +6 -0
- package/src/components/ex-upload/index.js +6 -0
- package/src/components/xt-button/index.js +8 -2
- package/src/components/xt-button/index.vue +53 -10
- package/src/components/xt-button/style/index.scss +147 -43
- package/src/components/xt-card/index.js +8 -2
- package/src/components/xt-card-item/index.js +8 -2
- package/src/components/xt-config-provider/index.js +6 -0
- package/src/components/xt-flex-box/index.js +8 -2
- package/src/components/xt-flex-box/style/index.scss +0 -9
- package/src/components/xt-grid-box/index.js +8 -2
- package/src/components/xt-grid-item/index.js +7 -1
- package/src/components/xt-input/index.js +8 -2
- package/src/components/xt-input/index.vue +66 -37
- package/src/components/xt-input/style/index.scss +70 -13
- package/src/components/xt-map/adapters/amap.js +235 -0
- package/src/components/xt-map/adapters/baidu.js +254 -0
- package/src/components/xt-map/adapters/base.js +267 -0
- package/src/components/xt-map/adapters/index.js +29 -0
- package/src/components/xt-map/adapters/tianditu.js +242 -0
- package/src/components/xt-map/config/xt-map-config.js +197 -0
- package/src/components/xt-map/index.js +22 -0
- package/src/components/xt-map/index.vue +351 -0
- package/src/components/xt-map/loaders/script-loader.js +114 -0
- package/src/components/xt-map/provider.vue +200 -0
- package/src/components/xt-map/style/index.scss +77 -0
- package/src/components/xt-step-price/index.js +9 -0
- package/src/components/xt-step-price/index.vue +12 -10
- package/src/components/xt-step-price/style/index.scss +32 -24
- package/src/components/xt-step-price-item/index.js +6 -0
- package/src/components/xt-step-price-item/index.vue +13 -9
- package/src/components/xt-text/index.js +8 -2
- package/src/components/xt-time/index.js +6 -0
- package/src/index.js +6 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['xt-map-provider', { 'xt-map-provider--dark': mergedTheme === 'dark' }]" :style="wrapperStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import {
|
|
9
|
+
getMapConfig,
|
|
10
|
+
setMapConfig,
|
|
11
|
+
setMapProvider,
|
|
12
|
+
setMapApiKey,
|
|
13
|
+
setMapApiUrl,
|
|
14
|
+
setMapType,
|
|
15
|
+
setMapTheme,
|
|
16
|
+
setMapCenter,
|
|
17
|
+
setMapZoom,
|
|
18
|
+
setMapPlugins,
|
|
19
|
+
setSecurityJsCode,
|
|
20
|
+
getMapProvider,
|
|
21
|
+
getMapApiKey,
|
|
22
|
+
getMapApiUrl,
|
|
23
|
+
getMapType,
|
|
24
|
+
getMapTheme,
|
|
25
|
+
getMapCenter,
|
|
26
|
+
getMapZoom,
|
|
27
|
+
getMapPlugins,
|
|
28
|
+
MAP_PROVIDERS,
|
|
29
|
+
MAP_TYPES,
|
|
30
|
+
MAP_THEMES,
|
|
31
|
+
onMapConfigChange
|
|
32
|
+
} from './config/xt-map-config'
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'XtMapProvider',
|
|
36
|
+
|
|
37
|
+
props: {
|
|
38
|
+
provider: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
validator: (val) => val === '' || MAP_PROVIDERS.includes(val)
|
|
42
|
+
},
|
|
43
|
+
apiKey: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ''
|
|
46
|
+
},
|
|
47
|
+
apiUrl: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ''
|
|
50
|
+
},
|
|
51
|
+
mapType: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '',
|
|
54
|
+
validator: (val) => val === '' || MAP_TYPES.includes(val)
|
|
55
|
+
},
|
|
56
|
+
theme: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
validator: (val) => val === '' || MAP_THEMES.includes(val)
|
|
60
|
+
},
|
|
61
|
+
center: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: () => null
|
|
64
|
+
},
|
|
65
|
+
zoom: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: null
|
|
68
|
+
},
|
|
69
|
+
plugins: {
|
|
70
|
+
type: Array,
|
|
71
|
+
default: () => []
|
|
72
|
+
},
|
|
73
|
+
securityJsCode: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
},
|
|
77
|
+
tag: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'div'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
mergedTheme: this.theme || getMapTheme() || 'light'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
computed: {
|
|
90
|
+
wrapperStyle() {
|
|
91
|
+
return {}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
watch: {
|
|
96
|
+
provider: {
|
|
97
|
+
immediate: true,
|
|
98
|
+
handler(newVal) {
|
|
99
|
+
if (newVal) setMapProvider(newVal)
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
apiKey: {
|
|
103
|
+
immediate: true,
|
|
104
|
+
handler(newVal) {
|
|
105
|
+
if (newVal) setMapApiKey(newVal)
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
apiUrl: {
|
|
109
|
+
immediate: true,
|
|
110
|
+
handler(newVal) {
|
|
111
|
+
if (newVal) setMapApiUrl(newVal)
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
mapType: {
|
|
115
|
+
immediate: true,
|
|
116
|
+
handler(newVal) {
|
|
117
|
+
if (newVal) setMapType(newVal)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
theme: {
|
|
121
|
+
immediate: true,
|
|
122
|
+
handler(newVal) {
|
|
123
|
+
if (newVal) {
|
|
124
|
+
setMapTheme(newVal)
|
|
125
|
+
this.mergedTheme = newVal
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
center: {
|
|
130
|
+
immediate: true,
|
|
131
|
+
handler(newVal) {
|
|
132
|
+
if (newVal) setMapCenter(newVal)
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
zoom: {
|
|
136
|
+
immediate: true,
|
|
137
|
+
handler(newVal) {
|
|
138
|
+
if (newVal !== null && newVal !== undefined) setMapZoom(newVal)
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
plugins: {
|
|
142
|
+
immediate: true,
|
|
143
|
+
handler(newVal) {
|
|
144
|
+
if (newVal && newVal.length > 0) setMapPlugins(newVal)
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
securityJsCode: {
|
|
148
|
+
immediate: true,
|
|
149
|
+
handler(newVal) {
|
|
150
|
+
if (newVal) setSecurityJsCode(newVal)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
provide() {
|
|
156
|
+
return {
|
|
157
|
+
xtMapConfig: {
|
|
158
|
+
getProvider: () => this.provider || getMapProvider(),
|
|
159
|
+
getApiKey: () => this.apiKey || getMapApiKey(),
|
|
160
|
+
getApiUrl: () => this.apiUrl || getMapApiUrl(),
|
|
161
|
+
getMapType: () => this.mapType || getMapType(),
|
|
162
|
+
getTheme: () => this.theme || getMapTheme(),
|
|
163
|
+
getCenter: () => this.center || getMapCenter(),
|
|
164
|
+
getZoom: () => this.zoom !== null ? this.zoom : getMapZoom(),
|
|
165
|
+
getPlugins: () => this.plugins.length > 0 ? this.plugins : getMapPlugins(),
|
|
166
|
+
getConfig: () => ({
|
|
167
|
+
provider: this.provider || getMapProvider(),
|
|
168
|
+
apiKey: this.apiKey || getMapApiKey(),
|
|
169
|
+
apiUrl: this.apiUrl || getMapApiUrl(),
|
|
170
|
+
mapType: this.mapType || getMapType(),
|
|
171
|
+
theme: this.theme || getMapTheme(),
|
|
172
|
+
center: this.center || getMapCenter(),
|
|
173
|
+
zoom: this.zoom !== null ? this.zoom : getMapZoom()
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
created() {
|
|
180
|
+
this._unsubscribe = onMapConfigChange((key, value) => {
|
|
181
|
+
if (key === 'theme') this.mergedTheme = this.theme || value
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
beforeDestroy() {
|
|
186
|
+
if (this._unsubscribe) this._unsubscribe()
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<style scoped>
|
|
192
|
+
.xt-map-provider {
|
|
193
|
+
width: 100%;
|
|
194
|
+
height: 100%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.xt-map-provider--dark {
|
|
198
|
+
background-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.xt-map-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.xt-map-container {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background-color: var(--xt-map-bg, #f5f5f5);
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.xt-map-container[data-theme="dark"] {
|
|
17
|
+
background-color: #1a1a1a;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.xt-map-loading {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 50%;
|
|
23
|
+
left: 50%;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
25
|
+
padding: 12px 20px;
|
|
26
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
27
|
+
border-radius: 6px;
|
|
28
|
+
color: #606266;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
31
|
+
z-index: 10;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.xt-map-container[data-theme="dark"] + .xt-map-loading,
|
|
35
|
+
.xt-map-wrapper[data-theme="dark"] .xt-map-loading {
|
|
36
|
+
background-color: rgba(30, 30, 30, 0.9);
|
|
37
|
+
color: #c0c4cc;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.xt-map-error {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 50%;
|
|
43
|
+
left: 50%;
|
|
44
|
+
transform: translate(-50%, -50%);
|
|
45
|
+
padding: 12px 20px;
|
|
46
|
+
background-color: rgba(254, 235, 235, 0.95);
|
|
47
|
+
border: 1px solid #fbc4c4;
|
|
48
|
+
border-radius: 6px;
|
|
49
|
+
color: #f56c6c;
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
text-align: center;
|
|
52
|
+
max-width: 80%;
|
|
53
|
+
z-index: 10;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.xt-map-container[data-theme="dark"] + .xt-map-error,
|
|
57
|
+
.xt-map-wrapper[data-theme="dark"] .xt-map-error {
|
|
58
|
+
background-color: rgba(60, 30, 30, 0.95);
|
|
59
|
+
border-color: #7a3a3a;
|
|
60
|
+
color: #f56c6c;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* 暗黑模式下对天地图/百度的瓦片反色滤镜兜底 */
|
|
64
|
+
.xt-map-container[data-theme="dark"] img {
|
|
65
|
+
/* 各适配器内部会自行处理滤镜,这里仅做最低限度兜底 */
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* 暗黑模式下覆盖层的辅助 CSS 变量 */
|
|
69
|
+
.xt-map-container[data-theme="dark"] {
|
|
70
|
+
--xt-map-overlay-bg: rgba(30, 30, 30, 0.9);
|
|
71
|
+
--xt-map-overlay-color: #c0c4cc;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.xt-map-container[data-theme="light"] {
|
|
75
|
+
--xt-map-overlay-bg: rgba(255, 255, 255, 0.95);
|
|
76
|
+
--xt-map-overlay-color: #606266;
|
|
77
|
+
}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import XtStepPrice from './index.vue'
|
|
2
|
+
import XtStepPriceItem from '../xt-step-price-item/index.vue'
|
|
3
|
+
|
|
4
|
+
XtStepPrice.install = function (Vue) {
|
|
5
|
+
Vue.component(XtStepPrice.name, XtStepPrice)
|
|
6
|
+
Vue.component(XtStepPriceItem.name, XtStepPriceItem)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 同时导出组件和 install 方法,支持多种引入方式
|
|
2
10
|
export default XtStepPrice
|
|
11
|
+
export { XtStepPrice, XtStepPriceItem }
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
<div v-if="title || $slots.header" class="xt-step-price__header">
|
|
4
4
|
<xt-text v-if="title" bold size="medium">{{ title }}</xt-text>
|
|
5
5
|
<slot name="header" />
|
|
6
|
-
<
|
|
6
|
+
<xt-button
|
|
7
7
|
v-if="!disabled && !isLimitReached"
|
|
8
8
|
type="primary"
|
|
9
9
|
size="small"
|
|
10
10
|
icon="el-icon-plus"
|
|
11
11
|
plain
|
|
12
12
|
@click="onAdd"
|
|
13
|
-
|
|
13
|
+
>新增档位</xt-button>
|
|
14
14
|
<xt-text v-if="isLimitReached" size="small" type-color="info">已达上限({{ localItems.length }}/{{ limit }})</xt-text>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
:min-locked="idx !== 0 ? true : false"
|
|
28
28
|
:unit="unit"
|
|
29
29
|
:precision="precision"
|
|
30
|
+
:step="step"
|
|
30
31
|
:left-bracket="leftBracket"
|
|
31
32
|
:right-bracket="rightBracket"
|
|
32
33
|
:field-keys="fieldKeys"
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
</div>
|
|
40
41
|
|
|
41
42
|
<div v-if="localItems.length === 0" class="xt-step-price__empty">
|
|
42
|
-
<span
|
|
43
|
+
<span>暂无数据,点击右上角「新增档位」开始配置</span>
|
|
43
44
|
</div>
|
|
44
45
|
|
|
45
46
|
<div v-if="tip || $slots.tip" class="xt-step-price__tip">
|
|
@@ -87,6 +88,8 @@ export default {
|
|
|
87
88
|
},
|
|
88
89
|
// 阶梯数量上限;<= 0 表示不限制
|
|
89
90
|
limit: { type: Number, default: 0 },
|
|
91
|
+
// 阶梯增量:新增/校正时,下一条阶梯的 min = 当前 max = 当前 min + step(默认 1)
|
|
92
|
+
step: { type: Number, default: 10 },
|
|
90
93
|
disabled: { type: Boolean, default: false },
|
|
91
94
|
tip: {
|
|
92
95
|
type: String,
|
|
@@ -142,14 +145,15 @@ export default {
|
|
|
142
145
|
ensureContinuity(list) {
|
|
143
146
|
if (!Array.isArray(list) || list.length === 0) return
|
|
144
147
|
list[0][this.keyMin] = 0
|
|
148
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
145
149
|
|
|
146
150
|
for (let i = 0; i < list.length; i++) {
|
|
147
151
|
const cur = list[i]
|
|
148
152
|
const next = list[i + 1]
|
|
149
153
|
const curMin = this.safeNumber(cur[this.keyMin], 0)
|
|
150
154
|
if (next) {
|
|
151
|
-
let curMax = this.safeNumber(cur[this.keyMax], curMin +
|
|
152
|
-
if (curMax <= curMin) curMax = curMin +
|
|
155
|
+
let curMax = this.safeNumber(cur[this.keyMax], curMin + stepVal)
|
|
156
|
+
if (curMax <= curMin) curMax = curMin + stepVal
|
|
153
157
|
cur[this.keyMax] = curMax
|
|
154
158
|
next[this.keyMin] = curMax
|
|
155
159
|
} else {
|
|
@@ -200,6 +204,7 @@ export default {
|
|
|
200
204
|
const list = this.localItems
|
|
201
205
|
const lim = Number(this.limit)
|
|
202
206
|
if (lim > 0 && list.length >= lim) return
|
|
207
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
203
208
|
|
|
204
209
|
// 场景 1:空数组 —— 直接 push 一条 [0, +∞)
|
|
205
210
|
if (list.length === 0) {
|
|
@@ -212,10 +217,10 @@ export default {
|
|
|
212
217
|
return
|
|
213
218
|
}
|
|
214
219
|
|
|
215
|
-
// 场景 2:已有数据 ——
|
|
220
|
+
// 场景 2:已有数据 —— 在末条前插入新条,新条的 max = 末条 min + step
|
|
216
221
|
const last = list[list.length - 1]
|
|
217
222
|
const newMin = this.safeNumber(last[this.keyMin], 0)
|
|
218
|
-
const newMax = newMin +
|
|
223
|
+
const newMax = newMin + stepVal
|
|
219
224
|
|
|
220
225
|
// 新条 price:优先继承「倒数第二条」的 price,其次用末条 price(>0 时),否则默认 10
|
|
221
226
|
const prev = list[list.length - 2]
|
|
@@ -227,9 +232,6 @@ export default {
|
|
|
227
232
|
newPrice = lastPrice > 0 ? lastPrice : 10
|
|
228
233
|
}
|
|
229
234
|
|
|
230
|
-
// 关键修复:构造全新数组,避免 splice 导致 Vue 组件复用 & 响应式不同步
|
|
231
|
-
// 新条 = { newMin, newMax, newPrice }
|
|
232
|
-
// 新末条 = { min: newMax, max: null, price: newPrice }
|
|
233
235
|
const newArr = [
|
|
234
236
|
...list.slice(0, -1),
|
|
235
237
|
{
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
@import '../../../styles/variables.scss';
|
|
2
|
+
|
|
1
3
|
.xt-step-price {
|
|
2
4
|
padding: 12px 16px;
|
|
3
|
-
background-color: #ffffff;
|
|
4
|
-
border: 1px solid #ebeef5;
|
|
5
|
-
border-radius: 4px;
|
|
5
|
+
background-color: var(--xt-fill-color-blank, #ffffff);
|
|
6
|
+
border: 1px solid var(--xt-border-color-lighter, #ebeef5);
|
|
7
|
+
border-radius: var(--xt-border-radius-base, 4px);
|
|
6
8
|
|
|
7
9
|
&__header {
|
|
8
10
|
display: flex;
|
|
@@ -20,19 +22,19 @@
|
|
|
20
22
|
&__empty {
|
|
21
23
|
padding: 24px;
|
|
22
24
|
text-align: center;
|
|
23
|
-
color: #909399;
|
|
24
|
-
font-size: 13px;
|
|
25
|
+
color: var(--xt-text-color-secondary, #909399);
|
|
26
|
+
font-size: var(--xt-font-size-small, 13px);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
&__tip {
|
|
28
30
|
margin-top: 12px;
|
|
29
|
-
color: #909399;
|
|
30
|
-
font-size: 12px;
|
|
31
|
+
color: var(--xt-text-color-secondary, #909399);
|
|
32
|
+
font-size: var(--xt-font-size-extra-small, 12px);
|
|
31
33
|
line-height: 1.6;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
&.is-disabled {
|
|
35
|
-
background-color: #
|
|
37
|
+
background-color: var(--xt-fill-color-light, #f5f7fa);
|
|
36
38
|
opacity: 0.85;
|
|
37
39
|
pointer-events: none;
|
|
38
40
|
}
|
|
@@ -42,44 +44,50 @@
|
|
|
42
44
|
display: flex;
|
|
43
45
|
align-items: center;
|
|
44
46
|
padding: 8px 12px;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
gap: 8px;
|
|
48
|
+
background-color: var(--xt-fill-color-light, #f5f7fa);
|
|
49
|
+
border-radius: var(--xt-border-radius-base, 4px);
|
|
50
|
+
transition: background-color var(--xt-transition-duration-fast, 0.2s) ease;
|
|
48
51
|
|
|
49
52
|
&:hover {
|
|
50
|
-
background-color: #
|
|
53
|
+
background-color: var(--xt-fill-color, #f0f2f5);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
&__range {
|
|
54
57
|
display: inline-flex;
|
|
55
58
|
align-items: center;
|
|
56
59
|
flex: 0 0 auto;
|
|
57
|
-
color: #606266;
|
|
58
|
-
font-size: 13px;
|
|
60
|
+
color: var(--xt-text-color-regular, #606266);
|
|
61
|
+
font-size: var(--xt-font-size-small, 13px);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__name {
|
|
65
|
+
color: var(--xt-text-color-primary, #303133);
|
|
66
|
+
font-weight: 600;
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
&__bracket {
|
|
62
70
|
margin: 0 4px;
|
|
63
|
-
color: #909399;
|
|
71
|
+
color: var(--xt-text-color-secondary, #909399);
|
|
64
72
|
font-weight: 600;
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
&__comma {
|
|
68
76
|
margin: 0 6px;
|
|
69
|
-
color: #909399;
|
|
77
|
+
color: var(--xt-text-color-secondary, #909399);
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
&__infinity {
|
|
73
81
|
display: inline-block;
|
|
74
|
-
min-width:
|
|
82
|
+
min-width: 80px;
|
|
75
83
|
text-align: center;
|
|
76
|
-
color: #c0c4cc;
|
|
77
|
-
font-size: 13px;
|
|
84
|
+
color: var(--xt-text-color-placeholder, #c0c4cc);
|
|
85
|
+
font-size: var(--xt-font-size-small, 13px);
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
&__arrow {
|
|
81
89
|
margin: 0 12px;
|
|
82
|
-
color: #
|
|
90
|
+
color: var(--xt-color-primary, #1890ff);
|
|
83
91
|
font-weight: 600;
|
|
84
92
|
}
|
|
85
93
|
|
|
@@ -91,8 +99,8 @@
|
|
|
91
99
|
|
|
92
100
|
&__unit {
|
|
93
101
|
margin-left: 8px;
|
|
94
|
-
color: #606266;
|
|
95
|
-
font-size: 13px;
|
|
102
|
+
color: var(--xt-text-color-regular, #606266);
|
|
103
|
+
font-size: var(--xt-font-size-small, 13px);
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
&__input {
|
|
@@ -106,10 +114,10 @@
|
|
|
106
114
|
|
|
107
115
|
&__delete {
|
|
108
116
|
margin-left: 12px;
|
|
109
|
-
color: #f56c6c !important;
|
|
117
|
+
color: var(--xt-color-danger, #f56c6c) !important;
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
&__delete:hover {
|
|
113
|
-
color: #
|
|
121
|
+
color: var(--xt-color-danger-light-5, #f57786) !important;
|
|
114
122
|
}
|
|
115
123
|
}
|
|
@@ -2,30 +2,32 @@
|
|
|
2
2
|
<div class="xt-step-price-item">
|
|
3
3
|
<div class="xt-step-price-item__range">
|
|
4
4
|
<span class="xt-step-price-item__bracket">{{ finalLeftBracket }}</span>
|
|
5
|
-
<
|
|
5
|
+
<span v-if="itemsLength > 1" class="xt-step-price-item__name">第{{ index + 1 }}档</span>
|
|
6
|
+
<span class="xt-step-price-item__bracket">{{ finalRightBracket }}</span>
|
|
7
|
+
<xt-input
|
|
6
8
|
v-model.number="minInput"
|
|
7
9
|
:disabled="disabled || minLocked"
|
|
8
10
|
size="small"
|
|
11
|
+
placeholder="下限"
|
|
9
12
|
class="xt-step-price-item__input"
|
|
10
13
|
@blur="onMinBlur"
|
|
11
14
|
/>
|
|
12
|
-
<span class="xt-step-price-item__comma"
|
|
13
|
-
<
|
|
15
|
+
<span class="xt-step-price-item__comma">-</span>
|
|
16
|
+
<xt-input
|
|
14
17
|
v-if="!isLast"
|
|
15
18
|
v-model.number="maxInput"
|
|
16
19
|
:disabled="disabled"
|
|
17
20
|
size="small"
|
|
21
|
+
placeholder="上限"
|
|
18
22
|
class="xt-step-price-item__input"
|
|
19
23
|
@blur="onMaxBlur"
|
|
20
24
|
/>
|
|
21
25
|
<span v-else class="xt-step-price-item__infinity">+∞</span>
|
|
22
|
-
<span class="xt-step-price-item__bracket">{{ finalRightBracket }}</span>
|
|
23
26
|
</div>
|
|
24
27
|
|
|
25
|
-
<span class="xt-step-price-item__arrow">→</span>
|
|
26
28
|
|
|
27
29
|
<div class="xt-step-price-item__price">
|
|
28
|
-
<
|
|
30
|
+
<xt-input
|
|
29
31
|
v-model.number="priceInput"
|
|
30
32
|
:disabled="disabled"
|
|
31
33
|
size="small"
|
|
@@ -36,9 +38,9 @@
|
|
|
36
38
|
<span class="xt-step-price-item__unit">{{ unit }}</span>
|
|
37
39
|
</div>
|
|
38
40
|
|
|
39
|
-
<
|
|
41
|
+
<xt-button
|
|
40
42
|
v-if="!disabled && removable && itemsLength > 1"
|
|
41
|
-
|
|
43
|
+
text
|
|
42
44
|
icon="el-icon-delete"
|
|
43
45
|
class="xt-step-price-item__delete"
|
|
44
46
|
@click="onDelete"
|
|
@@ -65,6 +67,8 @@ export default {
|
|
|
65
67
|
minLocked: { type: Boolean, default: false },
|
|
66
68
|
unit: { type: String, default: '元' },
|
|
67
69
|
precision: { type: Number, default: 2 },
|
|
70
|
+
// 阶梯增量:控制新增/校正时的区间跨度,默认 1
|
|
71
|
+
step: { type: Number, default: 1 },
|
|
68
72
|
// 左括号:默认 '[',传空则不显示
|
|
69
73
|
leftBracket: { type: String, default: '[' },
|
|
70
74
|
// 右括号:默认 null,走内置规则(只有1条为 ']',多条为 ')');传值则强制使用
|
|
@@ -82,7 +86,7 @@ export default {
|
|
|
82
86
|
keyPrice() { return (this.fieldKeys && this.fieldKeys.price) || 'price' },
|
|
83
87
|
finalRightBracket() {
|
|
84
88
|
if (this.rightBracket !== null && this.rightBracket !== undefined && this.rightBracket !== '') return this.rightBracket
|
|
85
|
-
return this.
|
|
89
|
+
return this.isLast ? ']' : ')'
|
|
86
90
|
},
|
|
87
91
|
finalLeftBracket() {
|
|
88
92
|
return (this.leftBracket === null || this.leftBracket === undefined) ? '[' : this.leftBracket
|
package/src/index.js
CHANGED
|
@@ -26,6 +26,8 @@ import XtText from './components/xt-text'
|
|
|
26
26
|
import XtTime from './components/xt-time'
|
|
27
27
|
import XtStepPrice from './components/xt-step-price'
|
|
28
28
|
import XtStepPriceItem from './components/xt-step-price-item'
|
|
29
|
+
import XtMap from './components/xt-map'
|
|
30
|
+
import { XtMapProvider } from './components/xt-map'
|
|
29
31
|
import XtGridBox from './components/xt-grid-box'
|
|
30
32
|
import XtGridItem from './components/xt-grid-item'
|
|
31
33
|
import ExDatePicker from './components/ex-date-picker'
|
|
@@ -50,6 +52,8 @@ const components = [
|
|
|
50
52
|
XtTime,
|
|
51
53
|
XtStepPrice,
|
|
52
54
|
XtStepPriceItem,
|
|
55
|
+
XtMap,
|
|
56
|
+
XtMapProvider,
|
|
53
57
|
XtGridBox,
|
|
54
58
|
XtGridItem,
|
|
55
59
|
ExDatePicker,
|
|
@@ -140,6 +144,8 @@ export default {
|
|
|
140
144
|
XtTime,
|
|
141
145
|
XtStepPrice,
|
|
142
146
|
XtStepPriceItem,
|
|
147
|
+
XtMap,
|
|
148
|
+
XtMapProvider,
|
|
143
149
|
XtGridBox,
|
|
144
150
|
XtGridItem,
|
|
145
151
|
ExDatePicker,
|