stellar-ui-plus 1.25.6 → 1.25.8
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/method.ts +189 -20
- package/components/ste-app-update/ste-app-update.vue +160 -15
- package/components/ste-calendar/date.ts +10 -4
- package/components/ste-calendar/ste-calendar.vue +85 -12
- package/components/ste-calendar/useData.ts +1 -1
- package/components/ste-dropdown-menu/README.md +186 -1
- package/components/ste-dropdown-menu/ste-dropdown-menu.scss +8 -1
- package/components/ste-popup/ATTRIBUTES.md +3 -3
- package/components/ste-popup/ste-popup.easycom.json +138 -140
- package/components/ste-popup/ste-popup.vue +19 -23
- package/components/ste-radio/ATTRIBUTES.md +2 -2
- package/components/ste-radio/ste-radio.easycom.json +4 -4
- package/components/ste-select/README.md +0 -6
- package/components/ste-select-order/README.md +61 -0
- package/components/ste-select-order/config.json +5 -0
- package/components/ste-select-order/props.ts +30 -0
- package/components/ste-select-order/ste-select-order.easycom.json +73 -0
- package/components/ste-select-order/ste-select-order.vue +276 -0
- package/components/ste-table/ste-table.vue +7 -37
- package/package.json +2 -3
- package/utils/System.ts +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch, nextTick, getCurrentInstance, onMounted } from 'vue';
|
|
3
|
+
import propsData, { type SelectOption } from './props';
|
|
4
|
+
import { useColorStore } from '../../store/color';
|
|
5
|
+
import utils from '../../utils/utils';
|
|
6
|
+
|
|
7
|
+
defineOptions({
|
|
8
|
+
name: 'ste-select-order',
|
|
9
|
+
options: {
|
|
10
|
+
virtualHost: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const thas = ref()
|
|
15
|
+
|
|
16
|
+
onMounted(() => {
|
|
17
|
+
thas.value = getCurrentInstance()?.proxy
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const { getColor } = useColorStore();
|
|
21
|
+
const props = defineProps(propsData);
|
|
22
|
+
const emits = defineEmits<{
|
|
23
|
+
(e: 'update:modelValue', value: string | number | undefined): void;
|
|
24
|
+
(e: 'change', value: string | number | undefined, option: SelectOption | undefined): void;
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const open = ref(false);
|
|
28
|
+
const viewValue = ref(props.modelValue);
|
|
29
|
+
const isUpward = ref(false);
|
|
30
|
+
|
|
31
|
+
watch(() => props.modelValue, (newVal) => {
|
|
32
|
+
if (newVal !== viewValue.value) {
|
|
33
|
+
viewValue.value = newVal;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const onTouchMove = (e: TouchEvent) => {
|
|
38
|
+
// 只有在展开状态下才阻止动
|
|
39
|
+
if (open.value) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const cmpRootStyle = computed(() => ({
|
|
45
|
+
'--theme-color': getColor()?.steThemeColor || '#0090FF',
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const viewTitle = computed(() => {
|
|
49
|
+
if (!viewValue.value) return '';
|
|
50
|
+
const item = props.list.find(item => item[props.valueKey] === viewValue.value);
|
|
51
|
+
return item ? (item[props.labelKey] as string) || String(item[props.valueKey]) : String(viewValue.value);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const calculatePosition = async () => {
|
|
55
|
+
const header = await utils.querySelector(".ste-select-order-header", thas.value)
|
|
56
|
+
if (!header) return;
|
|
57
|
+
const vh = utils.System.getWindowHeight()
|
|
58
|
+
const { top, height } = header as any
|
|
59
|
+
const position = top + height / 2;
|
|
60
|
+
const middle = vh / 2;
|
|
61
|
+
isUpward.value = position > middle;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onTitleClick = async () => {
|
|
65
|
+
if (props.disabled) return;
|
|
66
|
+
if (!open.value) {
|
|
67
|
+
await calculatePosition();
|
|
68
|
+
}
|
|
69
|
+
await nextTick()
|
|
70
|
+
open.value = !open.value;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const onShadeClick = () => {
|
|
74
|
+
if (props.maskClose) {
|
|
75
|
+
open.value = false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const onSelect = (item: SelectOption) => {
|
|
80
|
+
if (item.disabled) return;
|
|
81
|
+
const val = item[props.valueKey];
|
|
82
|
+
if (val === viewValue.value || props.disabled) return;
|
|
83
|
+
viewValue.value = val;
|
|
84
|
+
emits('update:modelValue', val);
|
|
85
|
+
emits('change', val, item);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
open.value = false;
|
|
88
|
+
}, 300);
|
|
89
|
+
};
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<view class="ste-select-order-root" :class="{ open, disabled: props.disabled }" :style="[cmpRootStyle]">
|
|
94
|
+
<view class="ste-select-order-shade" @click="onShadeClick" @touchmove.stop="onTouchMove"></view>
|
|
95
|
+
<view class="ste-select-order-content" :class="{ 'is-upward': isUpward }" @click.stop="onTitleClick"
|
|
96
|
+
@touchmove.stop="onTouchMove">
|
|
97
|
+
<view class="ste-select-order-header">
|
|
98
|
+
<view class="ste-select-order-title" v-if="viewTitle">
|
|
99
|
+
<view class="ste-select-order-title-text">
|
|
100
|
+
{{ viewTitle }}
|
|
101
|
+
</view>
|
|
102
|
+
<ste-icon code="" v-if="open" />
|
|
103
|
+
<ste-icon code="" v-else />
|
|
104
|
+
</view>
|
|
105
|
+
<view class="ste-select-order-placeholder" v-else>{{ placeholder }}</view>
|
|
106
|
+
</view>
|
|
107
|
+
<view class="ste-select-order-list">
|
|
108
|
+
<view v-for="item in props.list" :key="item[props.valueKey]" class="ste-select-order-item"
|
|
109
|
+
:class="{ 'active': item[props.valueKey] === viewValue, 'disabled': item.disabled }"
|
|
110
|
+
@click.stop="onSelect(item)">
|
|
111
|
+
<view>{{ (item[props.labelKey] as string) || item[props.valueKey] }}</view>
|
|
112
|
+
<view class="ste-select-order-item-icon">
|
|
113
|
+
<ste-icon code="" />
|
|
114
|
+
</view>
|
|
115
|
+
</view>
|
|
116
|
+
</view>
|
|
117
|
+
</view>
|
|
118
|
+
</view>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<style scoped lang="scss">
|
|
122
|
+
.ste-select-order-root {
|
|
123
|
+
position: relative;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
width: 100%;
|
|
126
|
+
font-size: 32rpx;
|
|
127
|
+
color: #000;
|
|
128
|
+
transition: z-index 0.3s ease;
|
|
129
|
+
|
|
130
|
+
&.open {
|
|
131
|
+
z-index: 998;
|
|
132
|
+
|
|
133
|
+
.ste-select-order-shade {
|
|
134
|
+
display: block;
|
|
135
|
+
opacity: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ste-select-order-content {
|
|
139
|
+
|
|
140
|
+
.ste-select-order-header {
|
|
141
|
+
background-color: #fff;
|
|
142
|
+
border-radius: 16rpx 16rpx 0 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ste-select-order-list {
|
|
146
|
+
display: block;
|
|
147
|
+
background-color: #fff;
|
|
148
|
+
border-radius: 0 0 16rpx 16rpx;
|
|
149
|
+
position: absolute;
|
|
150
|
+
left: 0;
|
|
151
|
+
top: 100%;
|
|
152
|
+
width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.is-upward {
|
|
156
|
+
.ste-select-order-header {
|
|
157
|
+
border-radius: 0 0 16rpx 16rpx;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ste-select-order-list {
|
|
161
|
+
top: initial;
|
|
162
|
+
bottom: 100%;
|
|
163
|
+
border-radius: 16rpx 16rpx 0 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.disabled {
|
|
170
|
+
opacity: 0.6;
|
|
171
|
+
|
|
172
|
+
.ste-select-order-title,
|
|
173
|
+
.ste-select-order-placeholder {
|
|
174
|
+
color: #ccc;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.ste-select-order-shade {
|
|
179
|
+
position: fixed;
|
|
180
|
+
top: 0;
|
|
181
|
+
left: 0;
|
|
182
|
+
right: 0;
|
|
183
|
+
bottom: 0;
|
|
184
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
185
|
+
display: none;
|
|
186
|
+
opacity: 0;
|
|
187
|
+
z-index: 1;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ste-select-order-content {
|
|
191
|
+
width: 100%;
|
|
192
|
+
position: relative;
|
|
193
|
+
z-index: 2;
|
|
194
|
+
|
|
195
|
+
.ste-select-order-header {
|
|
196
|
+
padding: 28rpx 24rpx 24rpx 24rpx;
|
|
197
|
+
font-size: var(--font-size-32, 32rpx);
|
|
198
|
+
line-height: var(--font-size-44, 44rpx);
|
|
199
|
+
font-weight: bold;
|
|
200
|
+
|
|
201
|
+
.ste-select-order-placeholder,
|
|
202
|
+
.ste-select-order-title {
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.ste-select-order-title {
|
|
208
|
+
color: #0A0A0A;
|
|
209
|
+
|
|
210
|
+
.ste-select-order-title-text {
|
|
211
|
+
margin-right: 12rpx;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.ste-select-order-placeholder {
|
|
216
|
+
color: #999;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.ste-select-order-list {
|
|
221
|
+
display: none;
|
|
222
|
+
|
|
223
|
+
z-index: 2;
|
|
224
|
+
max-height: 480rpx;
|
|
225
|
+
overflow-y: auto;
|
|
226
|
+
border-top: 1px solid #F9F9F9;
|
|
227
|
+
background-color: #fff;
|
|
228
|
+
padding: 0 24rpx;
|
|
229
|
+
|
|
230
|
+
.ste-select-order-item {
|
|
231
|
+
padding: 24rpx 0;
|
|
232
|
+
font-size: var(--font-size-28, 28rpx);
|
|
233
|
+
line-height: var(--font-size-40, 40rpx);
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: space-between;
|
|
237
|
+
color: #0A0A0A;
|
|
238
|
+
transition: color 0.2s ease;
|
|
239
|
+
|
|
240
|
+
&+.ste-select-order-item {
|
|
241
|
+
border-top: 1px solid #F9F9F9;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.ste-select-order-item-icon {
|
|
245
|
+
width: 36rpx;
|
|
246
|
+
height: 36rpx;
|
|
247
|
+
border-radius: 50%;
|
|
248
|
+
border: 1px solid #CECECE;
|
|
249
|
+
color: #fff;
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
justify-content: center;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&.active {
|
|
256
|
+
color: var(--theme-color);
|
|
257
|
+
|
|
258
|
+
.ste-select-order-item-icon {
|
|
259
|
+
border-color: var(--theme-color);
|
|
260
|
+
background-color: var(--theme-color);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&.disabled {
|
|
265
|
+
color: #999;
|
|
266
|
+
|
|
267
|
+
.ste-select-order-item-icon {
|
|
268
|
+
border-color: #E0E0E0;
|
|
269
|
+
background-color: #F5F5F5;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, watch, ref, type CSSProperties, toRaw
|
|
2
|
+
import { computed, watch, ref, type CSSProperties, toRaw } from 'vue';
|
|
3
3
|
import propsData, { TABLE_KEY, tableEmits, CHECK_ICON_SIZE, SELECTION_COLOR_CONFIG, type TableProps } from './props';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import { useProvide } from '../../utils/mixin';
|
|
6
6
|
import useData from './useData';
|
|
7
7
|
import type { TableColumnProps } from '../ste-table-column/props';
|
|
8
8
|
import { useColorStore } from '../../store/color';
|
|
9
|
-
|
|
9
|
+
const { getColor } = useColorStore();
|
|
10
10
|
|
|
11
11
|
const componentName = `ste-table`;
|
|
12
12
|
defineOptions({
|
|
@@ -82,14 +82,14 @@ const cmpRootClass = computed(() => {
|
|
|
82
82
|
if (props.stripe) {
|
|
83
83
|
classArr.push('stripe');
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
85
|
+
if (Number(props.height) > 0) {
|
|
86
86
|
classArr.push('scroll-table');
|
|
87
87
|
}
|
|
88
88
|
return classArr.join(' ');
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
const cmpShowFixedPlaceholder = computed(() => {
|
|
92
|
-
return props.fixed ||
|
|
92
|
+
return props.fixed || Number(props.height) > 0 || Number(props.maxHeight) > 0;
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
const dataChangeFun = (fullLength: number = 0, val: any) => {
|
|
@@ -300,38 +300,7 @@ defineExpose({ clearSelection, toggleAllSelection, toggleRowSelection, getSelect
|
|
|
300
300
|
</view>
|
|
301
301
|
</view>
|
|
302
302
|
</view>
|
|
303
|
-
<
|
|
304
|
-
<scroll-view scroll-y class="ste-table-scroll" @scrolltolower="handleScrollToLower">
|
|
305
|
-
<view class="ste-table-body" :class="!tableData.length ? 'no-data' : ''">
|
|
306
|
-
<template v-if="tableData.length">
|
|
307
|
-
<view
|
|
308
|
-
class="ste-table-row"
|
|
309
|
-
:class="[getRowClass(row, rowIndex)]"
|
|
310
|
-
:style="[getRowStyle(row, rowIndex) as CSSProperties]"
|
|
311
|
-
v-for="(row, rowIndex) in tableData"
|
|
312
|
-
:key="rowIndex"
|
|
313
|
-
@click="rowClick(row, $event)"
|
|
314
|
-
>
|
|
315
|
-
<slot :row="row" name="default"></slot>
|
|
316
|
-
</view>
|
|
317
|
-
<view class="ste-table-row sum" v-if="showSummary">
|
|
318
|
-
<view class="ste-table-cell" v-for="(column, index) in columns" :key="index" :class="[getHeaderCellClass(column, 0)]">
|
|
319
|
-
<view class="cell-box">
|
|
320
|
-
<view v-if="index === 0" class="sum-header">{{ sumText }}</view>
|
|
321
|
-
<view v-else>
|
|
322
|
-
{{ sumData[index] || '-' }}
|
|
323
|
-
</view>
|
|
324
|
-
</view>
|
|
325
|
-
</view>
|
|
326
|
-
</view>
|
|
327
|
-
</template>
|
|
328
|
-
<template v-else>
|
|
329
|
-
<text class="no-data-text">- 暂无数据 -</text>
|
|
330
|
-
</template>
|
|
331
|
-
</view>
|
|
332
|
-
</scroll-view>
|
|
333
|
-
</template>
|
|
334
|
-
<template v-else>
|
|
303
|
+
<scroll-view :scroll-y="Number(height) > 0" class="ste-table-scroll" @scrolltolower="handleScrollToLower">
|
|
335
304
|
<view class="ste-table-body" :class="!tableData.length ? 'no-data' : ''">
|
|
336
305
|
<template v-if="tableData.length">
|
|
337
306
|
<view
|
|
@@ -339,6 +308,7 @@ defineExpose({ clearSelection, toggleAllSelection, toggleRowSelection, getSelect
|
|
|
339
308
|
:class="[getRowClass(row, rowIndex)]"
|
|
340
309
|
:style="[getRowStyle(row, rowIndex) as CSSProperties]"
|
|
341
310
|
v-for="(row, rowIndex) in tableData"
|
|
311
|
+
:key="rowIndex"
|
|
342
312
|
@click="rowClick(row, $event)"
|
|
343
313
|
>
|
|
344
314
|
<slot :row="row"></slot>
|
|
@@ -358,7 +328,7 @@ defineExpose({ clearSelection, toggleAllSelection, toggleRowSelection, getSelect
|
|
|
358
328
|
<text class="no-data-text">- 暂无数据 -</text>
|
|
359
329
|
</template>
|
|
360
330
|
</view>
|
|
361
|
-
</
|
|
331
|
+
</scroll-view>
|
|
362
332
|
</view>
|
|
363
333
|
</view>
|
|
364
334
|
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stellar-ui-plus",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish"
|
|
15
|
-
"prepublishOnly": "pnpm run publish-vscode-plugin"
|
|
14
|
+
"publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish"
|
|
16
15
|
}
|
|
17
16
|
}
|