stellar-ui-v2 1.40.33 → 1.40.34
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/components/ste-app-update/README.md +52 -5
- package/components/ste-app-update/method.js +188 -28
- package/components/ste-app-update/ste-app-update.vue +170 -4
- package/components/ste-checkbox/ste-checkbox.vue +57 -55
- package/components/ste-checkbox-group/ste-checkbox-group.vue +21 -6
- package/components/ste-drag-sort/README.md +124 -0
- package/components/ste-drag-sort/config.json +5 -0
- package/components/ste-drag-sort/ste-drag-sort.vue +706 -0
- package/components/ste-message-box/ste-message-box.vue +364 -364
- package/components/ste-page-container/README.md +83 -83
- package/components/ste-page-container/WORKLOG-2026-03-12.md +229 -229
- package/components/ste-page-container/ste-page-container.vue +190 -190
- package/components/ste-popup/README.md +16 -16
- package/components/ste-popup/ste-popup.vue +392 -392
- package/components/ste-price/ste-price.vue +256 -256
- package/components/ste-radio/ste-radio.vue +53 -55
- package/components/ste-radio-group/ste-radio-group.vue +24 -9
- package/components/ste-search/ste-search.vue +576 -576
- package/components/ste-swipe-action/ste-swipe-action.vue +8 -8
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +5 -2
- package/components/ste-video/ste-video.vue +756 -756
- package/package.json +2 -2
- package/utils/System.js +19 -4
- package/utils/mixin.js +150 -0
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<script>
|
|
18
18
|
import utils from '../../utils/utils.js';
|
|
19
19
|
import useColor from '../../config/color.js';
|
|
20
|
+
import { configChildMixin } from '../../utils/mixin.js';
|
|
20
21
|
let color = useColor();
|
|
21
22
|
/**
|
|
22
23
|
* ste-checkbox 复选框
|
|
@@ -48,6 +49,7 @@ export default {
|
|
|
48
49
|
group: '表单组件',
|
|
49
50
|
title: 'Checkbox 复选框',
|
|
50
51
|
name: 'ste-checkbox',
|
|
52
|
+
mixins: [configChildMixin('checkboxGroup')],
|
|
51
53
|
props: {
|
|
52
54
|
value: {
|
|
53
55
|
type: [Boolean, null],
|
|
@@ -115,64 +117,57 @@ export default {
|
|
|
115
117
|
// 派发事件名,更新父组件数据
|
|
116
118
|
event: 'input',
|
|
117
119
|
},
|
|
118
|
-
inject: {
|
|
119
|
-
checkboxGroup: {
|
|
120
|
-
default: '',
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
120
|
data() {
|
|
124
121
|
return {
|
|
125
|
-
clickTask: null, // click完成任务和allowStopStatus搭配使用
|
|
126
|
-
allowStopStatus: false, // 允许阻止后续的事件触发
|
|
127
122
|
num: 1, // 解决支付宝小程序checkboxGroup.value更新不触发计算属性的问题
|
|
128
123
|
};
|
|
129
124
|
},
|
|
130
125
|
computed: {
|
|
131
126
|
cmpDisabled() {
|
|
132
|
-
let disabled = this.
|
|
127
|
+
let disabled = this.getParentProp('disabled', false);
|
|
133
128
|
// 限制最大可选数
|
|
134
|
-
if (this
|
|
135
|
-
if (!this.cmpChecked && this.
|
|
129
|
+
if (this.$hasParent && this.parent.max) {
|
|
130
|
+
if (!this.cmpChecked && this.parent.value.length >= this.parent.max) {
|
|
136
131
|
disabled = true;
|
|
137
132
|
}
|
|
138
133
|
}
|
|
139
134
|
return disabled;
|
|
140
135
|
},
|
|
141
136
|
cmpReadonly() {
|
|
142
|
-
return this.
|
|
137
|
+
return this.getParentProp('readonly', false);
|
|
143
138
|
},
|
|
144
139
|
cmpShape() {
|
|
145
|
-
return this.
|
|
140
|
+
return this.getParentProp('shape', 'circle');
|
|
146
141
|
},
|
|
147
142
|
cmpIconSize() {
|
|
148
|
-
return this.
|
|
143
|
+
return this.getParentProp('iconSize', 36);
|
|
149
144
|
},
|
|
150
145
|
cmpCheckedColor() {
|
|
151
|
-
return this.
|
|
146
|
+
return this.getParentProp('checkedColor', color.getColor().steThemeColor);
|
|
152
147
|
},
|
|
153
148
|
cmpTextPosition() {
|
|
154
|
-
return this.
|
|
149
|
+
return this.getParentProp('textPosition', 'right');
|
|
155
150
|
},
|
|
156
151
|
cmpTextSize() {
|
|
157
|
-
return this.
|
|
152
|
+
return this.getParentProp('textSize', 28);
|
|
158
153
|
},
|
|
159
154
|
cmpTextInactiveColor() {
|
|
160
|
-
return this.
|
|
155
|
+
return this.getParentProp('textInactiveColor', '#000000');
|
|
161
156
|
},
|
|
162
157
|
cmpTextActiveColor() {
|
|
163
|
-
return this.
|
|
158
|
+
return this.getParentProp('textActiveColor', '#000000');
|
|
164
159
|
},
|
|
165
160
|
cmpTextDisabled() {
|
|
166
|
-
return this.
|
|
161
|
+
return this.getParentProp('textDisabled', false);
|
|
167
162
|
},
|
|
168
163
|
cmpMarginLeft() {
|
|
169
|
-
return this.
|
|
164
|
+
return this.getParentProp('marginLeft', '0');
|
|
170
165
|
},
|
|
171
166
|
cmpMarginRight() {
|
|
172
|
-
return this.
|
|
167
|
+
return this.getParentProp('marginRight', '0');
|
|
173
168
|
},
|
|
174
169
|
cmpColumnGap() {
|
|
175
|
-
return this.
|
|
170
|
+
return this.getParentProp('columnGap', '16');
|
|
176
171
|
},
|
|
177
172
|
cmpSlotProps() {
|
|
178
173
|
return {
|
|
@@ -231,47 +226,54 @@ export default {
|
|
|
231
226
|
return style;
|
|
232
227
|
},
|
|
233
228
|
// 选中状态
|
|
229
|
+
// 注意:使用宽松相等比较,避免 value(字符串数组)和 name(数字)类型不一致导致匹配失败
|
|
234
230
|
cmpChecked() {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return
|
|
231
|
+
if (this.num && this.$hasParent) {
|
|
232
|
+
return this.parent.value.some((v) => v == this.name);
|
|
233
|
+
}
|
|
234
|
+
return this.value;
|
|
239
235
|
},
|
|
240
236
|
},
|
|
241
237
|
methods: {
|
|
242
|
-
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
238
|
+
click() {
|
|
239
|
+
if (this.cmpDisabled || this.cmpReadonly) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// 如果有 click 事件监听器,先触发事件
|
|
244
|
+
// 使用 $listeners 判断是否有 click 事件回调
|
|
245
|
+
if (this.$listeners?.click) {
|
|
246
|
+
let stopped = false;
|
|
247
|
+
const next = () => {
|
|
248
|
+
// 不阻止后续操作
|
|
249
|
+
};
|
|
250
|
+
const stop = () => {
|
|
251
|
+
stopped = true;
|
|
252
|
+
};
|
|
253
|
+
// 同步触发 click 事件回调
|
|
254
|
+
this.$emit('click', this.value, next, stop);
|
|
255
|
+
// 如果用户调用了 stop(),则不执行后续逻辑
|
|
256
|
+
if (stopped) {
|
|
257
|
+
return;
|
|
250
258
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
this.checkboxGroup.$emit('input', value);
|
|
260
|
-
this.checkboxGroup.$emit('change', value);
|
|
261
|
-
this.num++;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let value = null;
|
|
262
|
+
if (this.$hasParent) {
|
|
263
|
+
value = this.parent.value;
|
|
264
|
+
if (this.cmpChecked) {
|
|
265
|
+
value = value.filter((value) => value != this.name);
|
|
262
266
|
} else {
|
|
263
|
-
value
|
|
264
|
-
this.$emit('input', !this.cmpChecked);
|
|
267
|
+
value.push(this.name);
|
|
265
268
|
}
|
|
266
|
-
this.$emit('
|
|
269
|
+
this.parent.$emit('input', value);
|
|
270
|
+
this.parent.$emit('change', value);
|
|
271
|
+
this.num++;
|
|
272
|
+
} else {
|
|
273
|
+
value = !this.cmpChecked;
|
|
274
|
+
this.$emit('input', !this.cmpChecked);
|
|
267
275
|
}
|
|
268
|
-
|
|
269
|
-
// 允许阻止后续操作
|
|
270
|
-
allowStop() {
|
|
271
|
-
this.allowStopStatus = true;
|
|
272
|
-
},
|
|
273
|
-
getDefaultData(key, value) {
|
|
274
|
-
return this[key] != null ? this[key] : this.checkboxGroup[key] ? this.checkboxGroup[key] : value;
|
|
276
|
+
this.$emit('change', value);
|
|
275
277
|
},
|
|
276
278
|
},
|
|
277
279
|
};
|
|
@@ -5,6 +5,25 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
+
import { configParentMixin } from '../../utils/mixin.js';
|
|
9
|
+
|
|
10
|
+
// 需要透传给子组件的配置项
|
|
11
|
+
const CHECKBOX_PROP_KEYS = [
|
|
12
|
+
'disabled',
|
|
13
|
+
'readonly',
|
|
14
|
+
'shape',
|
|
15
|
+
'iconSize',
|
|
16
|
+
'checkedColor',
|
|
17
|
+
'textPosition',
|
|
18
|
+
'textSize',
|
|
19
|
+
'textInactiveColor',
|
|
20
|
+
'textActiveColor',
|
|
21
|
+
'textDisabled',
|
|
22
|
+
'marginLeft',
|
|
23
|
+
'marginRight',
|
|
24
|
+
'columnGap',
|
|
25
|
+
];
|
|
26
|
+
|
|
8
27
|
/**
|
|
9
28
|
* ste-checkbox-group 复选框组
|
|
10
29
|
* @description 复选框组组件,内部由多个checkbox组成。
|
|
@@ -35,6 +54,7 @@
|
|
|
35
54
|
*/
|
|
36
55
|
export default {
|
|
37
56
|
name: 'ste-checkbox-group',
|
|
57
|
+
mixins: [configParentMixin('checkboxGroup', CHECKBOX_PROP_KEYS)],
|
|
38
58
|
props: {
|
|
39
59
|
value: {
|
|
40
60
|
type: [Array, null],
|
|
@@ -62,7 +82,7 @@ export default {
|
|
|
62
82
|
},
|
|
63
83
|
checkedColor: {
|
|
64
84
|
type: [String, null],
|
|
65
|
-
default:
|
|
85
|
+
default: null,
|
|
66
86
|
},
|
|
67
87
|
textPosition: {
|
|
68
88
|
type: [String, null],
|
|
@@ -106,11 +126,6 @@ export default {
|
|
|
106
126
|
// 派发事件名,更新父组件数据
|
|
107
127
|
event: 'input',
|
|
108
128
|
},
|
|
109
|
-
provide() {
|
|
110
|
-
return {
|
|
111
|
-
checkboxGroup: this,
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
129
|
data() {
|
|
115
130
|
return {};
|
|
116
131
|
},
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# DragSort 拖拽排序
|
|
2
|
+
用于列表、宫格等场景的拖拽排序组件。
|
|
3
|
+
|
|
4
|
+
---$
|
|
5
|
+
|
|
6
|
+
### 代码演示
|
|
7
|
+
|
|
8
|
+
#### 基础用法
|
|
9
|
+
- 通过 `v-model` 传入待排序列表
|
|
10
|
+
- 通过具名插槽 `item` 自定义每一项的展示内容
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<template>
|
|
14
|
+
<ste-drag-sort v-model="basicList">
|
|
15
|
+
<template v-slot:item="{ item, index }">
|
|
16
|
+
<view class="demo-card-item">{{ index + 1 }}. {{ item.text }}</view>
|
|
17
|
+
</template>
|
|
18
|
+
</ste-drag-sort>
|
|
19
|
+
</template>
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
basicList: [{ text: '商品 A' }, { text: '商品 B' }, { text: '商品 C' }],
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
<style>
|
|
30
|
+
.demo-card-item {
|
|
31
|
+
padding: 24rpx;
|
|
32
|
+
margin-bottom: 16rpx;
|
|
33
|
+
border-radius: 16rpx;
|
|
34
|
+
background: #f5f7fa;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### 网格排序
|
|
40
|
+
- `columns` 大于 `1` 时会按网格布局排序
|
|
41
|
+
- 网格类纯拖拽场景可按需要设置 `:longPress="false"`
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<template>
|
|
45
|
+
<ste-drag-sort v-model="gridList" :columns="3" :longPress="false">
|
|
46
|
+
<template v-slot:item="{ item }">
|
|
47
|
+
<view class="grid-item">{{ item.text }}</view>
|
|
48
|
+
</template>
|
|
49
|
+
</ste-drag-sort>
|
|
50
|
+
</template>
|
|
51
|
+
<script>
|
|
52
|
+
export default {
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
gridList: [{ text: '1' }, { text: '2' }, { text: '3' }, { text: '4' }, { text: '5' }, { text: '6' }],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
<style>
|
|
61
|
+
.grid-item {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
height: 120rpx;
|
|
66
|
+
margin: 12rpx;
|
|
67
|
+
border-radius: 16rpx;
|
|
68
|
+
background: #eef3ff;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 禁用单项拖拽
|
|
74
|
+
- 列表项数据中可直接写 `disabled: true`
|
|
75
|
+
- 被禁用项会保留展示,但不能被拖拽
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<template>
|
|
79
|
+
<ste-drag-sort v-model="disabledList">
|
|
80
|
+
<template v-slot:item="{ item }">
|
|
81
|
+
<view class="demo-card-item" :style="{ opacity: item.disabled ? 0.5 : 1 }">{{ item.text }}</view>
|
|
82
|
+
</template>
|
|
83
|
+
</ste-drag-sort>
|
|
84
|
+
</template>
|
|
85
|
+
<script>
|
|
86
|
+
export default {
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
disabledList: [{ text: '固定在这里', disabled: true }, { text: '可拖拽 1' }, { text: '可拖拽 2' }],
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---$
|
|
97
|
+
|
|
98
|
+
### API
|
|
99
|
+
|
|
100
|
+
#### Props
|
|
101
|
+
|
|
102
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
103
|
+
| --- | --- | --- | --- | --- | --- |
|
|
104
|
+
| `value` | 拖拽数据列表,支持 v-model 双向绑定 | `Array` | `[]` | - | - |
|
|
105
|
+
| `disabled` | 是否禁用拖拽功能 | `Boolean` | `false` | - | - |
|
|
106
|
+
| `columns` | 列数,1 为纵向列表,大于 1 为网格排序 | `Number` | `1` | - | - |
|
|
107
|
+
| `longPress` | 拖拽启动方式。true 为长按后开始拖拽,适合列表和可滚动页面;false 为按下立即拖拽,适合网格和纯排序面板 | `Boolean` | `true` | - | - |
|
|
108
|
+
|
|
109
|
+
#### Events
|
|
110
|
+
|
|
111
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
112
|
+
| --- | --- | --- | --- |
|
|
113
|
+
| `start` | 开始拖拽时触发 | `index`:当前拖拽项索引 | - |
|
|
114
|
+
| `change` | 排序结果发生变化时触发 | `list`:最新排序结果 | - |
|
|
115
|
+
| `end` | 拖拽结束时触发 | `index`:最终落点索引 | - |
|
|
116
|
+
|
|
117
|
+
#### Slots
|
|
118
|
+
|
|
119
|
+
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
120
|
+
| --- | --- | --- | --- |
|
|
121
|
+
| `item` | 单个拖拽项内容 | `item`:当前项数据<br/>`index`:当前项索引<br/>`dragging`:当前是否处于拖拽中<br/>`dragIndex`:当前拖拽项索引<br/>`insertIndex`:当前插入位置索引 | - |
|
|
122
|
+
|
|
123
|
+
---$
|
|
124
|
+
{{fuyuwei}}
|