stellar-ui-plus 1.17.19 → 1.17.21
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.
|
@@ -174,10 +174,10 @@ defineExpose({
|
|
|
174
174
|
<view class="icon-box" v-if="icon">
|
|
175
175
|
<ste-icon :code="cmpIconCode" color="#999999" size="45"></ste-icon>
|
|
176
176
|
</view>
|
|
177
|
-
<
|
|
177
|
+
<text class="ste-message-title">{{ title }}</text>
|
|
178
178
|
<view class="msg" v-if="!icon">
|
|
179
179
|
<slot>
|
|
180
|
-
<
|
|
180
|
+
<text class="text" v-if="!editable">{{ content }}</text>
|
|
181
181
|
<view v-else class="input-box">
|
|
182
182
|
<text class="placeholder-text" v-show="showInputPlaceholder">
|
|
183
183
|
{{ placeholderText }}
|
|
@@ -269,6 +269,7 @@ defineExpose({
|
|
|
269
269
|
font-weight: bold;
|
|
270
270
|
font-size: var(--font-size-32, 32rpx);
|
|
271
271
|
text-align: center;
|
|
272
|
+
display: block;
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
.msg {
|
|
@@ -141,7 +141,19 @@ function initColumns() {
|
|
|
141
141
|
result.push(refChilds.value[i]);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
// 解决某些情况下列重复
|
|
145
|
+
const tempResult: any[] = [];
|
|
146
|
+
result.forEach(e => {
|
|
147
|
+
if (
|
|
148
|
+
!tempResult.find(r => {
|
|
149
|
+
return r.props.label === e.props.label && r.props.prop === e.props.prop;
|
|
150
|
+
})
|
|
151
|
+
) {
|
|
152
|
+
tempResult.push(e);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
columns.value = tempResult.map(e => {
|
|
145
157
|
if (!e.props.label && props.header && typeof props.header === 'function') {
|
|
146
158
|
e.props.label = props.header(e.props, tableData.value);
|
|
147
159
|
}
|
package/package.json
CHANGED
package/utils/utils.ts
CHANGED
|
@@ -4,6 +4,8 @@ import config from '../config';
|
|
|
4
4
|
import System from './System';
|
|
5
5
|
import Color from './Color';
|
|
6
6
|
|
|
7
|
+
import { type ComponentPublicInstance } from 'vue';
|
|
8
|
+
|
|
7
9
|
type ReturnBasedOnBool<T extends boolean> = T extends true ? UniApp.NodeInfo[] : UniApp.NodeInfo;
|
|
8
10
|
|
|
9
11
|
type PxType = 'str' | 'num';
|
|
@@ -12,6 +14,15 @@ type PX<T extends PxType> = T extends 'str' ? string : number;
|
|
|
12
14
|
|
|
13
15
|
type PartType = 0 | 1 | 2;
|
|
14
16
|
|
|
17
|
+
// 声明全局变量用于节流函数
|
|
18
|
+
let throLast: number = 0;
|
|
19
|
+
let throTimer: ReturnType<typeof setTimeout> | null = null;
|
|
20
|
+
|
|
21
|
+
// 定义延迟选项接口
|
|
22
|
+
interface DelayOption {
|
|
23
|
+
delay?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
15
26
|
interface FormatTreeOptions {
|
|
16
27
|
valueKey?: string;
|
|
17
28
|
childrenKey?: string;
|
|
@@ -25,6 +36,66 @@ const utils = {
|
|
|
25
36
|
Color,
|
|
26
37
|
dayjs: dayjs.default,
|
|
27
38
|
config,
|
|
39
|
+
/**
|
|
40
|
+
* 节流
|
|
41
|
+
* @param fn 要节流的方法
|
|
42
|
+
* @param args 要节流方法的参数,如果最后一个参数是 {delay:2000},则该参数为节流时间参数,不记入方法参数
|
|
43
|
+
*/
|
|
44
|
+
thro<T extends (...args: any[]) => any>(fn: T, ...args: any[]): void {
|
|
45
|
+
let delay: number = 500;
|
|
46
|
+
let lastArg: any = null;
|
|
47
|
+
|
|
48
|
+
if (args.length > 0) {
|
|
49
|
+
lastArg = args[args.length - 1];
|
|
50
|
+
if (lastArg && typeof lastArg === 'object' && 'delay' in lastArg) {
|
|
51
|
+
delay = (lastArg as DelayOption).delay || 500;
|
|
52
|
+
args.pop();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const now: number = new Date().getTime();
|
|
57
|
+
|
|
58
|
+
if (throLast === 0 || now - throLast > delay) {
|
|
59
|
+
if (throTimer !== null) {
|
|
60
|
+
clearTimeout(throTimer);
|
|
61
|
+
}
|
|
62
|
+
fn.call(this, ...args);
|
|
63
|
+
throLast = now;
|
|
64
|
+
throTimer = setTimeout(() => {
|
|
65
|
+
throLast = 0;
|
|
66
|
+
}, delay);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 防抖
|
|
72
|
+
* @param fn 要防抖的方法
|
|
73
|
+
* @param args 要防抖方法的参数,如果最后一个参数是 {delay:2000},则该参数为防抖时间参数,不记入方法参数
|
|
74
|
+
* @returns 返回一个新的函数
|
|
75
|
+
*/
|
|
76
|
+
debounce<T extends (...args: any[]) => any>(fn: T, ...args: any[]): () => void {
|
|
77
|
+
let delay: number = 500;
|
|
78
|
+
let lastArg: any = null;
|
|
79
|
+
|
|
80
|
+
if (args.length > 0) {
|
|
81
|
+
lastArg = args[args.length - 1];
|
|
82
|
+
if (lastArg && typeof lastArg === 'object' && 'delay' in lastArg) {
|
|
83
|
+
delay = (lastArg as DelayOption).delay || 500;
|
|
84
|
+
args.pop();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
89
|
+
|
|
90
|
+
return function (this: any): void {
|
|
91
|
+
if (timer !== null) {
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
}
|
|
94
|
+
timer = setTimeout(() => {
|
|
95
|
+
fn.call(this, ...args);
|
|
96
|
+
}, delay);
|
|
97
|
+
};
|
|
98
|
+
},
|
|
28
99
|
isNaN(value: number | string | null | undefined): boolean {
|
|
29
100
|
const deg = /^-?\d+(\.\d+)?$/i;
|
|
30
101
|
return !deg.test(String(value));
|
|
@@ -158,7 +229,7 @@ const utils = {
|
|
|
158
229
|
for (let i = str.length; i < len; i++) str += Math.floor(Math.random() * 32).toString(32);
|
|
159
230
|
return str;
|
|
160
231
|
},
|
|
161
|
-
querySelector<T extends boolean>(selectors: string, component?:
|
|
232
|
+
querySelector<T extends boolean>(selectors: string, component?: ComponentPublicInstance | null, all?: T): Promise<ReturnBasedOnBool<T>> {
|
|
162
233
|
return new Promise((resolve, reject) => {
|
|
163
234
|
try {
|
|
164
235
|
const func = all ? 'selectAll' : 'select';
|