xt-element-ui 1.3.2 → 1.3.4
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/CHANGELOG.md +72 -72
- package/LICENSE +21 -21
- package/README.md +240 -240
- package/docs/README.md +100 -100
- package/docs/components/base/xt-button.md +114 -114
- package/docs/components/base/xt-card-item.md +104 -104
- package/docs/components/base/xt-card.md +108 -108
- package/docs/components/base/xt-config-provider.md +199 -199
- package/docs/components/base/xt-flex-box.md +115 -115
- package/docs/components/base/xt-grid-box.md +302 -302
- package/docs/components/base/xt-input.md +150 -150
- package/docs/components/base/xt-map-provider.md +23 -0
- package/docs/components/base/xt-map.md +331 -331
- package/docs/components/base/xt-step-price.md +165 -165
- package/docs/components/base/xt-text.md +212 -212
- package/docs/components/base/xt-time.md +165 -165
- package/docs/components/extend/ex-bar.md +67 -67
- package/docs/components/extend/ex-button.md +62 -62
- package/docs/components/extend/ex-card.md +86 -86
- package/docs/components/extend/ex-chart.md +463 -463
- package/docs/components/extend/ex-icon.md +189 -189
- package/docs/components/extend/ex-line.md +70 -70
- package/docs/components/extend/ex-multi.md +155 -155
- package/docs/components/extend/ex-pie.md +69 -69
- package/docs/components/extend/ex-select-tree.md +210 -210
- package/docs/components/extend/ex-table.md +590 -590
- package/docs/components/extend/ex-upload.md +134 -134
- package/docs/components/utils/size.md +147 -147
- package/docs/components/utils/theme.md +182 -182
- package/lib/index.common.js +4131 -4162
- package/lib/index.css +1 -1
- package/lib/index.umd.js +4099 -4129
- package/lib/index.umd.min.js +3 -3
- package/package.json +80 -81
- package/src/components/ex-button/index.js +7 -7
- package/src/components/ex-button/index.vue +66 -66
- package/src/components/ex-button/style/index.scss +67 -67
- package/src/components/ex-card/index.js +7 -7
- package/src/components/ex-card/index.vue +68 -68
- package/src/components/ex-card/style/index.scss +73 -73
- package/src/components/ex-chart/index.js +7 -7
- package/src/components/ex-chart/index.vue +136 -136
- package/src/components/ex-date-picker/index.js +7 -7
- package/src/components/ex-icon/index.js +7 -7
- package/src/components/ex-icon/index.vue +168 -168
- package/src/components/ex-icon/style/index.scss +7 -7
- package/src/components/ex-page/index.js +7 -7
- package/src/components/ex-select-tree/index.js +7 -7
- package/src/components/ex-table/ExTableCell.vue +22 -22
- package/src/components/ex-table/index.js +7 -7
- package/src/components/ex-table/virtualScrollData.js +35 -35
- package/src/components/ex-upload/index.js +7 -7
- package/src/components/index.scss +39 -39
- package/src/components/xt-button/index.js +7 -7
- package/src/components/xt-button/index.vue +97 -97
- package/src/components/xt-card/index.js +7 -7
- package/src/components/xt-card/style/index.scss +48 -48
- package/src/components/xt-card-item/index.js +7 -7
- package/src/components/xt-card-item/style/index copy.scss +71 -71
- package/src/components/xt-card-item/style/index.scss +82 -82
- package/src/components/xt-config-provider/index.js +7 -7
- package/src/components/xt-config-provider/index.vue +362 -362
- package/src/components/xt-config-provider/style/index.scss +11 -11
- package/src/components/xt-flex-box/index.js +7 -7
- package/src/components/xt-flex-box/style/index.scss +81 -81
- package/src/components/xt-grid-box/index.js +7 -7
- package/src/components/xt-grid-box/style/index.scss +92 -92
- package/src/components/xt-grid-item/index.js +7 -7
- package/src/components/xt-grid-item/index.vue +106 -106
- package/src/components/xt-input/index.js +7 -7
- package/src/components/xt-input/index.vue +66 -66
- package/src/components/xt-input/style/index.scss +84 -84
- package/src/components/xt-map/adapters/amap.js +235 -235
- package/src/components/xt-map/adapters/baidu.js +254 -254
- package/src/components/xt-map/adapters/base.js +267 -267
- package/src/components/xt-map/adapters/index.js +29 -29
- package/src/components/xt-map/adapters/tianditu.js +242 -242
- package/src/components/xt-map/config/xt-map-config.js +197 -197
- package/src/components/xt-map/index.js +8 -30
- package/src/components/xt-map/index.vue +351 -351
- package/src/components/xt-map/loaders/script-loader.js +114 -114
- package/src/components/xt-map/provider.vue +200 -200
- package/src/components/xt-map/style/index.scss +77 -77
- package/src/components/xt-map-provider/index.js +8 -0
- package/src/components/xt-step-price/index.js +10 -10
- package/src/components/xt-step-price/index.vue +272 -272
- package/src/components/xt-step-price/style/index.scss +123 -123
- package/src/components/xt-step-price-item/index.js +7 -7
- package/src/components/xt-step-price-item/index.vue +187 -187
- package/src/components/xt-text/index.js +7 -7
- package/src/components/xt-text/index.vue +1 -1
- package/src/components/xt-text/style/index.scss +92 -92
- package/src/components/xt-time/index.js +7 -7
- package/src/components/xt-time/index.vue +313 -313
- package/src/components/xt-time/style/index.scss +23 -23
- package/src/config/element-registry.js +135 -135
- package/src/index.js +162 -178
- package/src/styles/css-variables.scss +257 -257
- package/src/styles/theme/background.scss +5 -5
- package/src/styles/theme/border-radius.scss +3 -3
- package/src/styles/theme/borders.scss +3 -3
- package/src/styles/theme/colors.scss +101 -101
- package/src/styles/theme/component-variables.scss +69 -69
- package/src/styles/theme/dark-variables.scss +28 -28
- package/src/styles/theme/font.scss +12 -12
- package/src/styles/theme/index.scss +11 -11
- package/src/styles/theme/shadows.scss +2 -2
- package/src/styles/theme/spacing.scss +4 -4
- package/src/styles/theme/transitions.scss +2 -2
- package/src/styles/theme/typography.scss +4 -4
- package/src/styles/variables-export.scss +85 -85
- package/src/utils/index.js +191 -202
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
## XtStepPrice 阶梯价格组件
|
|
2
|
-
|
|
3
|
-
用于配置阶梯式价格、数量区间等场景,支持区间自动校正、批量删除、自定义字段名等功能。
|
|
4
|
-
|
|
5
|
-
### 核心特性
|
|
6
|
-
|
|
7
|
-
- **区间自动校正**:保证区间连续且不重叠,自动处理左闭右闭逻辑
|
|
8
|
-
- **批量操作**:支持新增、删除档位,达到上限时自动禁用新增
|
|
9
|
-
- **自定义字段名**:允许传入自定义字段名映射(如 min/max/price 可改为 start/end/value)
|
|
10
|
-
- **单位与精度**:支持自定义货币单位和小数精度
|
|
11
|
-
- **括号逻辑**:自动处理括号显示(单条显示 `]`,多条显示 `)`)
|
|
12
|
-
|
|
13
|
-
### 安装与引入
|
|
14
|
-
|
|
15
|
-
#### 方式1:全量引入(推荐)
|
|
16
|
-
|
|
17
|
-
```vue
|
|
18
|
-
import Vue from 'vue'
|
|
19
|
-
import XtElementUI from 'xt-element-ui'
|
|
20
|
-
|
|
21
|
-
Vue.use(XtElementUI)
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
#### 方式2:单独引入(支持 Vue.use)
|
|
25
|
-
|
|
26
|
-
```vue
|
|
27
|
-
import Vue from 'vue'
|
|
28
|
-
import XtStepPrice from 'xt-element-ui/src/components/xt-step-price'
|
|
29
|
-
|
|
30
|
-
// 自动注册 XtStepPrice 和 XtStepPriceItem
|
|
31
|
-
Vue.use(XtStepPrice)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
#### 方式3:手动注册组件
|
|
35
|
-
|
|
36
|
-
```vue
|
|
37
|
-
import Vue from 'vue'
|
|
38
|
-
import { XtStepPrice, XtStepPriceItem } from 'xt-element-ui/src/components/xt-step-price'
|
|
39
|
-
|
|
40
|
-
Vue.component(XtStepPrice.name, XtStepPrice)
|
|
41
|
-
Vue.component(XtStepPriceItem.name, XtStepPriceItem)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### 基本用法
|
|
45
|
-
|
|
46
|
-
```vue
|
|
47
|
-
<template>
|
|
48
|
-
<div style="width: 600px;">
|
|
49
|
-
<XtStepPrice
|
|
50
|
-
v-model="priceSteps"
|
|
51
|
-
title="阶梯价格"
|
|
52
|
-
unit="元"
|
|
53
|
-
:precision="2"
|
|
54
|
-
:limit="5"
|
|
55
|
-
:step="10"
|
|
56
|
-
tip="区间左闭右闭 [min, max],最后一级为 [min, +∞)"
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
</template>
|
|
60
|
-
|
|
61
|
-
<script>
|
|
62
|
-
export default {
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
priceSteps: [
|
|
66
|
-
{ min: 0, max: 100, price: 10 },
|
|
67
|
-
{ min: 100, max: 500, price: 9 },
|
|
68
|
-
{ min: 500, max: Infinity, price: 8 }
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
</script>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 自定义字段名
|
|
77
|
-
|
|
78
|
-
```vue
|
|
79
|
-
<template>
|
|
80
|
-
<XtStepPrice
|
|
81
|
-
v-model="customSteps"
|
|
82
|
-
:field-keys="{ min: 'start', max: 'end', price: 'value' }"
|
|
83
|
-
title="自定义字段名"
|
|
84
|
-
/>
|
|
85
|
-
</template>
|
|
86
|
-
|
|
87
|
-
<script>
|
|
88
|
-
export default {
|
|
89
|
-
data() {
|
|
90
|
-
return {
|
|
91
|
-
customSteps: [
|
|
92
|
-
{ start: 0, end: 100, value: 10 },
|
|
93
|
-
{ start: 100, end: 500, value: 9 }
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</script>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 禁用状态
|
|
102
|
-
|
|
103
|
-
```vue
|
|
104
|
-
<XtStepPrice
|
|
105
|
-
v-model="priceSteps"
|
|
106
|
-
disabled
|
|
107
|
-
title="禁用状态"
|
|
108
|
-
/>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### 属性说明
|
|
112
|
-
|
|
113
|
-
| 属性 | 类型 | 默认值 | 说明 |
|
|
114
|
-
|------|------|--------|------|
|
|
115
|
-
| `value` / `v-model` | Array | `[]` | 阶梯数据数组,每个元素包含 `min`/`max`/`price` 字段 |
|
|
116
|
-
| `title` | String | `''` | 标题文本 |
|
|
117
|
-
| `unit` | String | `'元'` | 价格单位 |
|
|
118
|
-
| `precision` | Number | `2` | 价格小数精度 |
|
|
119
|
-
| `leftBracket` | String | `'['` | 左括号,传空字符串则不显示 |
|
|
120
|
-
| `rightBracket` | String | `null` | 右括号,默认自动逻辑(单条 `]`,多条 `)`);传具体值强制使用 |
|
|
121
|
-
| `fieldKeys` | Object | `{ min: 'min', max: 'max', price: 'price' }` | 字段名映射,支持自定义字段名 |
|
|
122
|
-
| `limit` | Number | `0` | 阶梯数量上限,<=0 表示不限制 |
|
|
123
|
-
| `step` | Number | `10` | 阶梯增量,新增时自动填充下一级的 min 值 |
|
|
124
|
-
| `disabled` | Boolean | `false` | 是否禁用所有操作 |
|
|
125
|
-
| `tip` | String | `'区间左闭右闭 [min, max],最后一级为 [min, +∞),保证连续且不重叠。'` | 底部提示文本 |
|
|
126
|
-
| `defaultFirst` | Boolean | `true` | 空数组时是否自动生成默认阶梯 |
|
|
127
|
-
|
|
128
|
-
### 事件
|
|
129
|
-
|
|
130
|
-
| 事件名 | 说明 | 参数 |
|
|
131
|
-
|--------|------|------|
|
|
132
|
-
| `input` | 数据变化时触发 | 最新的阶梯数组 |
|
|
133
|
-
| `add` | 新增档位时触发 | 新增的档位数据 |
|
|
134
|
-
| `delete` | 删除档位时触发 | 删除的档位索引和数据 |
|
|
135
|
-
| `change` | 任一档位数据变化时触发 | 变化后的完整阶梯数组 |
|
|
136
|
-
|
|
137
|
-
### 插槽
|
|
138
|
-
|
|
139
|
-
| 插槽名 | 说明 |
|
|
140
|
-
|--------|------|
|
|
141
|
-
| `header` | 标题栏右侧自定义内容 |
|
|
142
|
-
| `tip` | 底部提示区域自定义内容 |
|
|
143
|
-
|
|
144
|
-
### XtStepPriceItem 子组件(单独使用)
|
|
145
|
-
|
|
146
|
-
```vue
|
|
147
|
-
<XtStepPriceItem
|
|
148
|
-
v-model="item"
|
|
149
|
-
:index="0"
|
|
150
|
-
:is-first="true"
|
|
151
|
-
:is-last="true"
|
|
152
|
-
:items-length="1"
|
|
153
|
-
:unit="'元'"
|
|
154
|
-
:precision="2"
|
|
155
|
-
@input="onItemInput"
|
|
156
|
-
@delete="onDelete"
|
|
157
|
-
/>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 注意事项
|
|
161
|
-
|
|
162
|
-
1. **区间逻辑**:采用左闭右闭 `[min, max]`,最后一级自动处理为 `[min, +∞)`
|
|
163
|
-
2. **空值处理**:当 `v-model` 为空数组时,会自动生成默认阶梯(可通过 `defaultFirst=false` 关闭)
|
|
164
|
-
3. **精度控制**:所有输入值会自动按 `precision` 四舍五入
|
|
165
|
-
4. **性能优化**:当阶梯数量较多时,建议设置 `limit` 限制最大数量
|
|
1
|
+
## XtStepPrice 阶梯价格组件
|
|
2
|
+
|
|
3
|
+
用于配置阶梯式价格、数量区间等场景,支持区间自动校正、批量删除、自定义字段名等功能。
|
|
4
|
+
|
|
5
|
+
### 核心特性
|
|
6
|
+
|
|
7
|
+
- **区间自动校正**:保证区间连续且不重叠,自动处理左闭右闭逻辑
|
|
8
|
+
- **批量操作**:支持新增、删除档位,达到上限时自动禁用新增
|
|
9
|
+
- **自定义字段名**:允许传入自定义字段名映射(如 min/max/price 可改为 start/end/value)
|
|
10
|
+
- **单位与精度**:支持自定义货币单位和小数精度
|
|
11
|
+
- **括号逻辑**:自动处理括号显示(单条显示 `]`,多条显示 `)`)
|
|
12
|
+
|
|
13
|
+
### 安装与引入
|
|
14
|
+
|
|
15
|
+
#### 方式1:全量引入(推荐)
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
import Vue from 'vue'
|
|
19
|
+
import XtElementUI from 'xt-element-ui'
|
|
20
|
+
|
|
21
|
+
Vue.use(XtElementUI)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### 方式2:单独引入(支持 Vue.use)
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
import Vue from 'vue'
|
|
28
|
+
import XtStepPrice from 'xt-element-ui/src/components/xt-step-price'
|
|
29
|
+
|
|
30
|
+
// 自动注册 XtStepPrice 和 XtStepPriceItem
|
|
31
|
+
Vue.use(XtStepPrice)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### 方式3:手动注册组件
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
import Vue from 'vue'
|
|
38
|
+
import { XtStepPrice, XtStepPriceItem } from 'xt-element-ui/src/components/xt-step-price'
|
|
39
|
+
|
|
40
|
+
Vue.component(XtStepPrice.name, XtStepPrice)
|
|
41
|
+
Vue.component(XtStepPriceItem.name, XtStepPriceItem)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 基本用法
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<template>
|
|
48
|
+
<div style="width: 600px;">
|
|
49
|
+
<XtStepPrice
|
|
50
|
+
v-model="priceSteps"
|
|
51
|
+
title="阶梯价格"
|
|
52
|
+
unit="元"
|
|
53
|
+
:precision="2"
|
|
54
|
+
:limit="5"
|
|
55
|
+
:step="10"
|
|
56
|
+
tip="区间左闭右闭 [min, max],最后一级为 [min, +∞)"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
export default {
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
priceSteps: [
|
|
66
|
+
{ min: 0, max: 100, price: 10 },
|
|
67
|
+
{ min: 100, max: 500, price: 9 },
|
|
68
|
+
{ min: 500, max: Infinity, price: 8 }
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 自定义字段名
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<template>
|
|
80
|
+
<XtStepPrice
|
|
81
|
+
v-model="customSteps"
|
|
82
|
+
:field-keys="{ min: 'start', max: 'end', price: 'value' }"
|
|
83
|
+
title="自定义字段名"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script>
|
|
88
|
+
export default {
|
|
89
|
+
data() {
|
|
90
|
+
return {
|
|
91
|
+
customSteps: [
|
|
92
|
+
{ start: 0, end: 100, value: 10 },
|
|
93
|
+
{ start: 100, end: 500, value: 9 }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</script>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 禁用状态
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<XtStepPrice
|
|
105
|
+
v-model="priceSteps"
|
|
106
|
+
disabled
|
|
107
|
+
title="禁用状态"
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 属性说明
|
|
112
|
+
|
|
113
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
114
|
+
|------|------|--------|------|
|
|
115
|
+
| `value` / `v-model` | Array | `[]` | 阶梯数据数组,每个元素包含 `min`/`max`/`price` 字段 |
|
|
116
|
+
| `title` | String | `''` | 标题文本 |
|
|
117
|
+
| `unit` | String | `'元'` | 价格单位 |
|
|
118
|
+
| `precision` | Number | `2` | 价格小数精度 |
|
|
119
|
+
| `leftBracket` | String | `'['` | 左括号,传空字符串则不显示 |
|
|
120
|
+
| `rightBracket` | String | `null` | 右括号,默认自动逻辑(单条 `]`,多条 `)`);传具体值强制使用 |
|
|
121
|
+
| `fieldKeys` | Object | `{ min: 'min', max: 'max', price: 'price' }` | 字段名映射,支持自定义字段名 |
|
|
122
|
+
| `limit` | Number | `0` | 阶梯数量上限,<=0 表示不限制 |
|
|
123
|
+
| `step` | Number | `10` | 阶梯增量,新增时自动填充下一级的 min 值 |
|
|
124
|
+
| `disabled` | Boolean | `false` | 是否禁用所有操作 |
|
|
125
|
+
| `tip` | String | `'区间左闭右闭 [min, max],最后一级为 [min, +∞),保证连续且不重叠。'` | 底部提示文本 |
|
|
126
|
+
| `defaultFirst` | Boolean | `true` | 空数组时是否自动生成默认阶梯 |
|
|
127
|
+
|
|
128
|
+
### 事件
|
|
129
|
+
|
|
130
|
+
| 事件名 | 说明 | 参数 |
|
|
131
|
+
|--------|------|------|
|
|
132
|
+
| `input` | 数据变化时触发 | 最新的阶梯数组 |
|
|
133
|
+
| `add` | 新增档位时触发 | 新增的档位数据 |
|
|
134
|
+
| `delete` | 删除档位时触发 | 删除的档位索引和数据 |
|
|
135
|
+
| `change` | 任一档位数据变化时触发 | 变化后的完整阶梯数组 |
|
|
136
|
+
|
|
137
|
+
### 插槽
|
|
138
|
+
|
|
139
|
+
| 插槽名 | 说明 |
|
|
140
|
+
|--------|------|
|
|
141
|
+
| `header` | 标题栏右侧自定义内容 |
|
|
142
|
+
| `tip` | 底部提示区域自定义内容 |
|
|
143
|
+
|
|
144
|
+
### XtStepPriceItem 子组件(单独使用)
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<XtStepPriceItem
|
|
148
|
+
v-model="item"
|
|
149
|
+
:index="0"
|
|
150
|
+
:is-first="true"
|
|
151
|
+
:is-last="true"
|
|
152
|
+
:items-length="1"
|
|
153
|
+
:unit="'元'"
|
|
154
|
+
:precision="2"
|
|
155
|
+
@input="onItemInput"
|
|
156
|
+
@delete="onDelete"
|
|
157
|
+
/>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 注意事项
|
|
161
|
+
|
|
162
|
+
1. **区间逻辑**:采用左闭右闭 `[min, max]`,最后一级自动处理为 `[min, +∞)`
|
|
163
|
+
2. **空值处理**:当 `v-model` 为空数组时,会自动生成默认阶梯(可通过 `defaultFirst=false` 关闭)
|
|
164
|
+
3. **精度控制**:所有输入值会自动按 `precision` 四舍五入
|
|
165
|
+
4. **性能优化**:当阶梯数量较多时,建议设置 `limit` 限制最大数量
|
|
166
166
|
5. **字段名映射**:`fieldKeys` 必须与传入的 `value` 字段名完全匹配
|