sard-uniapp 1.19.5 → 1.20.0
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 +22 -0
- package/README.md +1 -1
- package/components/calendar/README.md +20 -20
- package/components/calendar/calendar.vue +1 -1
- package/components/calendar-input/README.md +10 -10
- package/components/calendar-input/calendar-input.vue +2 -2
- package/components/calendar-month/calendar-month.vue +17 -21
- package/components/calendar-popout/calendar-popout.vue +1 -1
- package/components/card/README.md +16 -8
- package/components/card/card.vue +7 -1
- package/components/card/common.d.ts +2 -0
- package/components/card/index.scss +30 -2
- package/components/card/variables.scss +16 -1
- package/components/checkbox/common.d.ts +1 -0
- package/components/checkbox/common.js +1 -0
- package/components/checkbox-input/checkbox-input.vue +9 -0
- package/components/checkbox-popout/README.md +27 -6
- package/components/checkbox-popout/checkbox-popout.vue +113 -47
- package/components/checkbox-popout/common.d.ts +3 -0
- package/components/checkbox-popout/index.scss +16 -0
- package/components/config/index.d.ts +6 -0
- package/components/config/index.js +6 -0
- package/components/datetime-picker/README.md +1 -71
- package/components/datetime-picker/common.d.ts +1 -0
- package/components/datetime-picker/common.js +21 -8
- package/components/datetime-picker/datetime-picker.vue +3 -3
- package/components/datetime-picker-input/README.md +10 -10
- package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
- package/components/datetime-picker-popout/datetime-picker-popout.vue +1 -1
- package/components/datetime-range-picker/datetime-range-picker.vue +12 -10
- package/components/datetime-range-picker-input/README.md +10 -10
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
- package/components/datetime-range-picker-popout/README.md +0 -6
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +11 -8
- package/components/floating-bubble/floating-bubble.vue +3 -3
- package/components/form/README.md +19 -19
- package/components/form/form.vue +1 -1
- package/components/icon/icon.d.ts +1 -1
- package/components/indexes/README.md +4 -0
- package/components/indexes-nav/indexes-nav.vue +2 -2
- package/components/keyboard/common.d.ts +1 -2
- package/components/keyboard/common.js +2 -11
- package/components/keyboard/keyboard.d.ts +2 -2
- package/components/list-item/index.scss +4 -0
- package/components/locale/lang/en-US.d.ts +4 -0
- package/components/locale/lang/en-US.js +4 -0
- package/components/locale/lang/zh-CN.d.ts +4 -0
- package/components/locale/lang/zh-CN.js +4 -0
- package/components/marquee/README.md +8 -2
- package/components/marquee/marquee.vue +9 -1
- package/components/notice-bar/README.md +8 -2
- package/components/notice-bar/notice-bar.vue +14 -8
- package/components/notify/notify.d.ts +1 -1
- package/components/notify-agent/notify-agent.d.ts +1 -1
- package/components/pagination/pagination.vue +2 -2
- package/components/popover/utils.js +4 -4
- package/components/pull-down-refresh/common.d.ts +1 -1
- package/components/radio/common.d.ts +1 -0
- package/components/radio/common.js +1 -0
- package/components/radio-input/radio-input.vue +6 -0
- package/components/radio-popout/README.md +20 -6
- package/components/radio-popout/common.d.ts +2 -0
- package/components/radio-popout/index.scss +4 -0
- package/components/radio-popout/radio-popout.vue +91 -45
- package/components/read-more/README.md +82 -0
- package/components/read-more/common.d.ts +24 -0
- package/components/read-more/common.js +2 -0
- package/components/read-more/index.d.ts +1 -0
- package/components/read-more/index.js +1 -0
- package/components/read-more/index.scss +41 -0
- package/components/read-more/read-more.d.ts +20 -0
- package/components/read-more/read-more.vue +168 -0
- package/components/read-more/variables.scss +12 -0
- package/components/resize-sensor/README.md +55 -0
- package/components/resize-sensor/common.d.ts +19 -0
- package/components/resize-sensor/common.js +2 -0
- package/components/resize-sensor/index.d.ts +1 -0
- package/components/resize-sensor/index.js +1 -0
- package/components/resize-sensor/index.scss +33 -0
- package/components/resize-sensor/resize-sensor.d.ts +16 -0
- package/components/resize-sensor/resize-sensor.vue +152 -0
- package/components/scroll-list/README.md +79 -0
- package/components/scroll-list/common.d.ts +23 -0
- package/components/scroll-list/common.js +1 -0
- package/components/scroll-list/index.d.ts +1 -0
- package/components/scroll-list/index.js +1 -0
- package/components/scroll-list/index.scss +35 -0
- package/components/scroll-list/scroll-list.d.ts +20 -0
- package/components/scroll-list/scroll-list.vue +158 -0
- package/components/scroll-list/variables.scss +11 -0
- package/components/sidebar/README.md +8 -8
- package/components/sidebar/sidebar.vue +1 -1
- package/components/slider/slider.vue +4 -4
- package/components/stepper/stepper.vue +2 -2
- package/components/sticky/README.md +92 -0
- package/components/sticky/common.d.ts +15 -0
- package/components/sticky/common.js +1 -0
- package/components/sticky/index.d.ts +1 -0
- package/components/sticky/index.js +1 -0
- package/components/sticky/index.scss +18 -0
- package/components/sticky/sticky.d.ts +10 -0
- package/components/sticky/sticky.vue +190 -0
- package/components/sticky-box/common.d.ts +19 -0
- package/components/sticky-box/common.js +1 -0
- package/components/sticky-box/index.d.ts +1 -0
- package/components/sticky-box/index.js +1 -0
- package/components/sticky-box/index.scss +19 -0
- package/components/sticky-box/sticky-box.d.ts +10 -0
- package/components/sticky-box/sticky-box.vue +82 -0
- package/components/style/mixins/border.scss +101 -38
- package/components/style/variables-dark.scss +4 -0
- package/components/style/variables.scss +8 -0
- package/components/table/table.vue +2 -1
- package/components/table-fixation/table-fixation.vue +2 -1
- package/components/toast/toast.d.ts +1 -1
- package/components/toast-agent/toast-agent.d.ts +1 -1
- package/components/tree/tree.d.ts +1 -1
- package/components/tree-node/tree-node.vue +2 -2
- package/components/upload/README.md +23 -15
- package/components/upload/common.d.ts +6 -4
- package/components/upload/upload.d.ts +2 -0
- package/components/upload/upload.vue +51 -13
- package/components/upload/utils.d.ts +1 -0
- package/components/upload/utils.js +2 -0
- package/components/upload-preview/index.scss +1 -0
- package/components/upload-preview/upload-preview.d.ts +6 -4
- package/components/upload-preview/upload-preview.vue +17 -24
- package/global.d.ts +5 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/index.scss +2 -0
- package/package.json +4 -2
- package/use/index.d.ts +4 -0
- package/use/index.js +4 -0
- package/use/useIndeterminate.d.ts +10 -0
- package/use/useIndeterminate.js +27 -0
- package/use/useIntersectionObserver.d.ts +16 -0
- package/use/useIntersectionObserver.js +52 -0
- package/use/useSimulatedClick.js +2 -2
- package/use/useSimulatedPress.js +2 -2
- package/use/useSingleTask.d.ts +6 -0
- package/use/useSingleTask.js +40 -0
- package/use/useWindowResize.d.ts +4 -0
- package/use/useWindowResize.js +15 -0
- package/utils/array.d.ts +28 -0
- package/utils/array.js +90 -0
- package/utils/common.d.ts +3 -0
- package/utils/common.js +1 -0
- package/utils/date.d.ts +84 -11
- package/utils/date.js +120 -63
- package/utils/dom.js +2 -0
- package/utils/geometry.d.ts +56 -38
- package/utils/geometry.js +56 -30
- package/utils/index.d.ts +8 -1
- package/utils/index.js +8 -1
- package/utils/is.d.ts +12 -0
- package/utils/is.js +16 -0
- package/utils/number.d.ts +24 -0
- package/utils/number.js +37 -0
- package/utils/object.d.ts +29 -0
- package/utils/object.js +139 -0
- package/utils/persist.d.ts +15 -0
- package/utils/persist.js +89 -0
- package/utils/physics.d.ts +34 -0
- package/utils/physics.js +66 -0
- package/utils/request.d.ts +227 -0
- package/utils/request.js +249 -0
- package/utils/router.d.ts +47 -0
- package/utils/router.js +115 -0
- package/utils/string.d.ts +46 -0
- package/utils/string.js +134 -0
- package/utils/url-query.d.ts +19 -0
- package/utils/url-query.js +95 -0
- package/utils/utils.d.ts +0 -166
- package/utils/utils.js +0 -441
- package/utils/case.d.ts +0 -4
- package/utils/case.js +0 -26
package/utils/string.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function splitWord(string) {
|
|
2
|
+
return string
|
|
3
|
+
.split(/[^a-zA-Z0-9$]+/)
|
|
4
|
+
.map((item) => item.split(/([A-Z][^A-Z]*)/))
|
|
5
|
+
.flat()
|
|
6
|
+
.filter(Boolean);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 将字符串首字母转换为小写格式。
|
|
10
|
+
*/
|
|
11
|
+
export function lowerFirst(string) {
|
|
12
|
+
return string.replace(/^[A-Z]/, (m) => m.toLowerCase());
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 将字符串首字母转换为大写格式。
|
|
16
|
+
*/
|
|
17
|
+
export function upperFirst(string) {
|
|
18
|
+
return string.replace(/^[a-z]/, (m) => m.toUpperCase());
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 将字符串转换为 PascalCase 格式(大驼峰)。
|
|
22
|
+
*/
|
|
23
|
+
export function pascalCase(string) {
|
|
24
|
+
return splitWord(string)
|
|
25
|
+
.map((word) => upperFirst(word.toLowerCase()))
|
|
26
|
+
.join('');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 将字符串转换为 camelCase 格式(小驼峰)。
|
|
30
|
+
*/
|
|
31
|
+
export function camelCase(string) {
|
|
32
|
+
return lowerFirst(pascalCase(string));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 将字符串转换为 Capitalize 格式(首字母大写,其余小写)。
|
|
36
|
+
*/
|
|
37
|
+
export function capitalize(string) {
|
|
38
|
+
return upperFirst(string.toLowerCase());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 将字符串转换为 kebab-case 格式(使用连字符拼接单词)。
|
|
42
|
+
*/
|
|
43
|
+
export function kebabCase(string) {
|
|
44
|
+
return splitWord(string)
|
|
45
|
+
.map((item) => item.toLowerCase())
|
|
46
|
+
.join('-');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 将字符串转换为 snake_case 格式(使用下划线拼接单词)。
|
|
50
|
+
*/
|
|
51
|
+
export function snakeCase(string) {
|
|
52
|
+
return splitWord(string)
|
|
53
|
+
.map((item) => item.toLowerCase())
|
|
54
|
+
.join('_');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 每n位数字添加一个分隔符
|
|
58
|
+
*/
|
|
59
|
+
export function addSeparator(num, separator = ',', digit = 3) {
|
|
60
|
+
return String(num).replace(new RegExp(`\\B(?=(\\d{${digit}})+(?!\\d))`, 'g'), separator);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 生成唯一ID,用于设置元素的ID,以便获取
|
|
64
|
+
*/
|
|
65
|
+
export function uniqid(prefix = '__sar_') {
|
|
66
|
+
return prefix + (~~(Math.random() * 10e8)).toString(36);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 把各种类型的参数拼接成字符串类名,以便解决小程序不支持 classObject 的问题
|
|
70
|
+
*/
|
|
71
|
+
export function classNames(...args) {
|
|
72
|
+
let result = '';
|
|
73
|
+
for (let i = 0; i < args.length; i++) {
|
|
74
|
+
const arg = args[i];
|
|
75
|
+
if (!arg)
|
|
76
|
+
continue;
|
|
77
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
78
|
+
result += arg + ' ';
|
|
79
|
+
}
|
|
80
|
+
else if (Array.isArray(arg)) {
|
|
81
|
+
if (arg.length) {
|
|
82
|
+
const className = classNames(...arg);
|
|
83
|
+
if (className) {
|
|
84
|
+
result += className + ' ';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (typeof arg === 'object') {
|
|
89
|
+
for (const key in arg) {
|
|
90
|
+
const value = arg[key];
|
|
91
|
+
if (value) {
|
|
92
|
+
result += key + ' ';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
function toKebabCase(str) {
|
|
100
|
+
return str
|
|
101
|
+
.replace(/^[A-Z]/, (m) => m.toLowerCase())
|
|
102
|
+
.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 把样式对象拼接成字符串,解决小程序不支持 styleObject 的问题。
|
|
106
|
+
*/
|
|
107
|
+
export function stringifyStyle(...args) {
|
|
108
|
+
let result = '';
|
|
109
|
+
for (let i = 0; i < args.length; i++) {
|
|
110
|
+
const arg = args[i];
|
|
111
|
+
if (!arg)
|
|
112
|
+
continue;
|
|
113
|
+
if (typeof arg === 'string') {
|
|
114
|
+
result += arg + ';';
|
|
115
|
+
}
|
|
116
|
+
else if (Array.isArray(arg)) {
|
|
117
|
+
if (arg.length) {
|
|
118
|
+
const string = stringifyStyle(...arg);
|
|
119
|
+
if (string) {
|
|
120
|
+
result += string + ';';
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (typeof arg === 'object') {
|
|
125
|
+
for (const key in arg) {
|
|
126
|
+
const value = arg[key];
|
|
127
|
+
if (value || value === 0) {
|
|
128
|
+
result += `${toKebabCase(key)}:${value};`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class URLQuery {
|
|
2
|
+
_params: string[][];
|
|
3
|
+
constructor(init?: string[][] | Record<string, string> | string | URLQuery);
|
|
4
|
+
_fromString(queryString: string): void;
|
|
5
|
+
get size(): number;
|
|
6
|
+
append(name: string, value: string): void;
|
|
7
|
+
delete(name: string, value?: string): void;
|
|
8
|
+
get(name: string): string | null;
|
|
9
|
+
getAll(name: string): string[];
|
|
10
|
+
has(name: string, value?: string): boolean;
|
|
11
|
+
set(name: string, value: string): void;
|
|
12
|
+
sort(): void;
|
|
13
|
+
toString(): string;
|
|
14
|
+
forEach(callbackfn: (value: string, key: string, parent: URLQuery) => void, thisArg?: any): void;
|
|
15
|
+
entries(): ArrayIterator<string[]>;
|
|
16
|
+
keys(): Generator<string, void, unknown>;
|
|
17
|
+
values(): Generator<string, void, unknown>;
|
|
18
|
+
[Symbol.iterator](): ArrayIterator<string[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export class URLQuery {
|
|
2
|
+
_params = [];
|
|
3
|
+
constructor(init) {
|
|
4
|
+
this._params = [];
|
|
5
|
+
if (init) {
|
|
6
|
+
if (typeof init === 'string') {
|
|
7
|
+
this._fromString(init);
|
|
8
|
+
}
|
|
9
|
+
else if (Array.isArray(init)) {
|
|
10
|
+
init.forEach(([name, value]) => {
|
|
11
|
+
this.append(name, value);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else if (typeof init === 'object') {
|
|
15
|
+
Object.entries(init).forEach(([name, value]) => {
|
|
16
|
+
this.append(name, value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// 解析查询字符串
|
|
22
|
+
_fromString(queryString) {
|
|
23
|
+
if (queryString.startsWith('?')) {
|
|
24
|
+
queryString = queryString.slice(1);
|
|
25
|
+
}
|
|
26
|
+
queryString.split('&').forEach((pair) => {
|
|
27
|
+
const [name, value = ''] = pair.split('=').map(decodeURIComponent);
|
|
28
|
+
if (name) {
|
|
29
|
+
this.append(name, value);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
get size() {
|
|
34
|
+
return this._params.length;
|
|
35
|
+
}
|
|
36
|
+
// 添加键值对
|
|
37
|
+
append(name, value) {
|
|
38
|
+
this._params.push([String(name), String(value)]);
|
|
39
|
+
}
|
|
40
|
+
// 删除指定 name 的所有值
|
|
41
|
+
delete(name, value) {
|
|
42
|
+
this._params = this._params.filter(([k, v]) => name !== k || (value && value !== v));
|
|
43
|
+
}
|
|
44
|
+
// 获取第一个匹配的 value
|
|
45
|
+
get(name) {
|
|
46
|
+
const found = this._params.find(([k]) => k === name);
|
|
47
|
+
return found ? found[1] : null;
|
|
48
|
+
}
|
|
49
|
+
// 获取所有匹配的 values
|
|
50
|
+
getAll(name) {
|
|
51
|
+
return this._params.filter(([k]) => k === name).map(([, v]) => v);
|
|
52
|
+
}
|
|
53
|
+
// 检查是否存在 name
|
|
54
|
+
has(name, value) {
|
|
55
|
+
return this._params.some(([k, v]) => k === name && (!value || value === v));
|
|
56
|
+
}
|
|
57
|
+
// 设置 name 的值(覆盖所有旧值)
|
|
58
|
+
set(name, value) {
|
|
59
|
+
this.delete(name);
|
|
60
|
+
this.append(name, value);
|
|
61
|
+
}
|
|
62
|
+
// 按键名排序
|
|
63
|
+
sort() {
|
|
64
|
+
this._params.sort(([a], [b]) => a.localeCompare(b));
|
|
65
|
+
}
|
|
66
|
+
// 转换为查询字符串
|
|
67
|
+
toString() {
|
|
68
|
+
return this._params
|
|
69
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
70
|
+
.join('&');
|
|
71
|
+
}
|
|
72
|
+
forEach(callbackfn, thisArg) {
|
|
73
|
+
this._params.forEach(([name, value]) => {
|
|
74
|
+
callbackfn.call(thisArg, value, name, this);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// 迭代方法
|
|
78
|
+
entries() {
|
|
79
|
+
return this._params[Symbol.iterator]();
|
|
80
|
+
}
|
|
81
|
+
*keys() {
|
|
82
|
+
for (const [name] of this._params) {
|
|
83
|
+
yield name;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
*values() {
|
|
87
|
+
for (const [, value] of this._params) {
|
|
88
|
+
yield value;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// 支持 for...of 迭代
|
|
92
|
+
[Symbol.iterator]() {
|
|
93
|
+
return this.entries();
|
|
94
|
+
}
|
|
95
|
+
}
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,106 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: 确保目标是一个数组
|
|
3
|
-
* @param {any} target
|
|
4
|
-
* @return {array}
|
|
5
|
-
*/
|
|
6
|
-
export declare function toArray(target: any): any[];
|
|
7
|
-
/**
|
|
8
|
-
* @description: 限定数值范围
|
|
9
|
-
* @param {number} n 被限定的值
|
|
10
|
-
* @param {number} min 最小值
|
|
11
|
-
* @param {number} max 最大值
|
|
12
|
-
* @return {number} 限定后的值
|
|
13
|
-
*/
|
|
14
|
-
export declare function minmax(n: number, min: number, max: number): number;
|
|
15
|
-
/**
|
|
16
|
-
* @description: 获取小数位数
|
|
17
|
-
* @param {number | string} n 要操作的数值
|
|
18
|
-
* @return {number}
|
|
19
|
-
*/
|
|
20
|
-
export declare function getDecimalsLength(n: number | string): number;
|
|
21
|
-
/**
|
|
22
|
-
* @description: 把一个数四舍五入到指定位数小数
|
|
23
|
-
* @param {number} n 要操作的数值
|
|
24
|
-
* @param {number} precision 精准度,即小数个数
|
|
25
|
-
* @return {number}
|
|
26
|
-
*/
|
|
27
|
-
export declare function round(n: number, precision?: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* @description: 把一个数舍入到指定数的倍数
|
|
30
|
-
* @param {number} n 要舍入的数值
|
|
31
|
-
* @param {number} m 结果值的因数
|
|
32
|
-
* @return {number}
|
|
33
|
-
*/
|
|
34
|
-
export declare function mround(n: number, m: number): number;
|
|
35
|
-
/**
|
|
36
|
-
* @description: 生成唯一ID,用于设置元素的ID,以便获取
|
|
37
|
-
* @param {string} prefix
|
|
38
|
-
* @return {string}
|
|
39
|
-
*/
|
|
40
|
-
export declare function uniqid(prefix?: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* @description: 获取阻尼值
|
|
43
|
-
* @param {number} value
|
|
44
|
-
* @param {number} min
|
|
45
|
-
* @param {number} max
|
|
46
|
-
* @param {number} damping
|
|
47
|
-
* @return {number}
|
|
48
|
-
*/
|
|
49
|
-
export declare function getDampingValue(value: number, min: number, max: number, damping: number): number;
|
|
50
|
-
/**
|
|
51
|
-
* @description: 获取矩形阻尼值
|
|
52
|
-
* @param {number} offset 当前的偏移量
|
|
53
|
-
* @param {number} areaSize 范围值
|
|
54
|
-
* @param {number} viewSize 范围内某个视图尺寸值
|
|
55
|
-
* @param {number} damping 阻尼系数
|
|
56
|
-
* @return {number}
|
|
57
|
-
*/
|
|
58
|
-
export declare function getRectDampingValue(offset: number, areaSize: number, viewSize: number, damping: number): number;
|
|
59
|
-
/**
|
|
60
|
-
* @description: 获取范围值
|
|
61
|
-
* @param {number} offset 当前的偏移量
|
|
62
|
-
* @param {number} areaSize 范围值
|
|
63
|
-
* @param {number} viewSize 范围内某个视图尺寸值
|
|
64
|
-
* @return {number}
|
|
65
|
-
*/
|
|
66
|
-
export declare function getInBoundValue(offset: number, areaSize: number, viewSize: number): number;
|
|
67
|
-
/**
|
|
68
|
-
* @description: 获取溢出值范围
|
|
69
|
-
* @param {number} overflow 最大溢出值
|
|
70
|
-
* @param {number} areaSize 范围值
|
|
71
|
-
* @param {number} viewSize 范围内某个视图尺寸值
|
|
72
|
-
* @return {*}
|
|
73
|
-
*/
|
|
74
|
-
export declare function getOverflowRangeInArea(overflow: number, areaSize: number, viewSize: number): [number, number];
|
|
75
|
-
/**
|
|
76
|
-
* @description: 扩散性遍历
|
|
77
|
-
* @param {any[]} array 要遍历的数组
|
|
78
|
-
* @param {(el: any, spreadIndex: number, index: number) => any} callback 回调函数,接收当前元素、扩散性下标、迭代下标作为参数,
|
|
79
|
-
* 如果返回true,则中止遍历
|
|
80
|
-
* @param {number} currIndex 遍历开始的下标
|
|
81
|
-
* @param {number} direction 开始遍历的方向
|
|
82
|
-
* @return {number} 扩散性下标、或开始下标
|
|
83
|
-
*/
|
|
84
|
-
export declare function spreadEach(array: any[], callback: (el: any, spreadIndex: number, index: number) => any, startIndex?: number, direction?: number): number;
|
|
85
|
-
/**
|
|
86
|
-
* @description: 深度克隆对象,仅克隆数组和无格式对象,其他类型会被直接返回
|
|
87
|
-
* @param {any} target
|
|
88
|
-
* @return {any}
|
|
89
|
-
*/
|
|
90
|
-
export declare function deepClone(target: any): any;
|
|
91
|
-
/**
|
|
92
|
-
* @description: 深拷贝其他对象到第一个对象
|
|
93
|
-
* @param args 任意长度参数对象
|
|
94
|
-
* @return 返回第一个参数对象
|
|
95
|
-
*/
|
|
96
|
-
export declare function extend(...args: any[]): any;
|
|
97
|
-
/**
|
|
98
|
-
* @description: 判断两数组是否相等,浅比较
|
|
99
|
-
* @param {any[]} arr1
|
|
100
|
-
* @param {any[]} arr2
|
|
101
|
-
* @return {boolean}
|
|
102
|
-
*/
|
|
103
|
-
export declare function arrayEqual(arr1: any[], arr2: any[]): boolean;
|
|
104
1
|
/**
|
|
105
2
|
* @description: 判断一个对象是否为看得到的空
|
|
106
3
|
* @param {any} target
|
|
@@ -150,77 +47,14 @@ export declare function throttle(func: (...args: any[]) => any, wait: any, optio
|
|
|
150
47
|
* @return {[number, number]}
|
|
151
48
|
*/
|
|
152
49
|
export declare function getPageRange(current: number, pageCount: number, pageItemCount: number): number[];
|
|
153
|
-
interface AnyObject {
|
|
154
|
-
[p: string]: any;
|
|
155
|
-
}
|
|
156
|
-
export declare function treeToMap(tree: AnyObject[], keyName: string, childrenName: string, parentName: string): {
|
|
157
|
-
[p: string]: AnyObject;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* @description: 打乱数组
|
|
161
|
-
* @param {any[]} arr 要打乱的数组
|
|
162
|
-
* @param {boolean} inPlace 是否改变原数组
|
|
163
|
-
* @return {any[]}
|
|
164
|
-
*/
|
|
165
|
-
export declare function shuffle(arr: any[], inPlace?: boolean): any[];
|
|
166
|
-
interface Rect {
|
|
167
|
-
x: number;
|
|
168
|
-
y: number;
|
|
169
|
-
width: number;
|
|
170
|
-
height: number;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @description: 根据原始坐标尺寸和缩放后的坐标尺寸算出转换的原点
|
|
174
|
-
* @param {Rect} rect
|
|
175
|
-
* @param {Rect} scaleRect
|
|
176
|
-
* @return {[number, number]}
|
|
177
|
-
*/
|
|
178
|
-
export declare function getTransformOrigin(rect: Rect, scaleRect: Rect): number[];
|
|
179
50
|
/**
|
|
180
51
|
* @description: 将一个可选单位的字符串或数值拆分为数值和单位组成的数组
|
|
181
52
|
* @param {number | string} target
|
|
182
53
|
* @return {[number, string]}
|
|
183
54
|
*/
|
|
184
55
|
export declare function splitUnit(target: number | string): [number, string];
|
|
185
|
-
/**
|
|
186
|
-
* @description: 链式获取对象值
|
|
187
|
-
* @param object
|
|
188
|
-
* @param chain 通过点分割的字符串或者字符串数组
|
|
189
|
-
*/
|
|
190
|
-
export declare function chainGet(object: any, chain?: string | string[]): any;
|
|
191
|
-
/**
|
|
192
|
-
* @description: 链式设置对象值
|
|
193
|
-
* @param object
|
|
194
|
-
* @param chain 通过点分割的字符串或者字符串数组
|
|
195
|
-
* @param value 要设置的值
|
|
196
|
-
*/
|
|
197
|
-
export declare function chainSet(object: any, chain: string | string[], value: any): void;
|
|
198
|
-
/**
|
|
199
|
-
* @description: 移动数组中的元素
|
|
200
|
-
* @param array
|
|
201
|
-
* @param fromIndex
|
|
202
|
-
* @param toIndex
|
|
203
|
-
* @return 移动后的新数组
|
|
204
|
-
*/
|
|
205
|
-
export declare function arrayMove(array: any[], fromIndex: number, toIndex: number): any[];
|
|
206
|
-
export type StyleProp = string | Record<any, any> | null | undefined | false | StyleProp[];
|
|
207
|
-
export declare function stringifyStyle(...args: StyleProp[]): string;
|
|
208
|
-
export type ClassProp = string | number | null | undefined | Record<string, any> | ClassProp[];
|
|
209
|
-
export declare function classNames(...args: ClassProp[]): string;
|
|
210
56
|
export declare const noop: () => void;
|
|
211
|
-
export declare function nestedToMulti(nested: any[], values: (number | string)[], fieldKeys: {
|
|
212
|
-
value: string;
|
|
213
|
-
children: string;
|
|
214
|
-
}): any[];
|
|
215
|
-
export declare function random(min: number, max: number): number;
|
|
216
|
-
export declare function addSeparator(num: number | string, separator?: string, digit?: number): string;
|
|
217
|
-
export interface Coord {
|
|
218
|
-
x: number;
|
|
219
|
-
y: number;
|
|
220
|
-
}
|
|
221
|
-
export declare function getDistanceBetweenTwoPoints(c1: Coord, c2: Coord): number;
|
|
222
57
|
export declare function getMayPrimitiveOption(option: string | number | boolean | {
|
|
223
58
|
[key: PropertyKey]: any;
|
|
224
59
|
}, key: string): any;
|
|
225
60
|
export declare function sleep(time: number): Promise<unknown>;
|
|
226
|
-
export {};
|