@xfe-repo/web-utils 1.6.0 → 1.6.1
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/dist/tools.d.mts +8 -2
- package/dist/tools.d.ts +8 -2
- package/dist/tools.js +5 -1
- package/dist/tools.mjs +5 -1
- package/package.json +2 -2
package/dist/tools.d.mts
CHANGED
|
@@ -16,7 +16,13 @@ declare function formatterPrice(value?: string | number | undefined): string;
|
|
|
16
16
|
declare function formatterTax(percentTax: string): string;
|
|
17
17
|
declare function uuid(): string;
|
|
18
18
|
declare const imgRelative2Absolute: (imgUrl?: string) => string;
|
|
19
|
-
|
|
19
|
+
type ResizeAliYunOptions = {
|
|
20
|
+
width?: number;
|
|
21
|
+
quality?: number;
|
|
22
|
+
/** 阿里云自定义裁剪参数 */
|
|
23
|
+
customStyle?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const resizeAliYun: (imgUrl?: string, options?: ResizeAliYunOptions) => string;
|
|
20
26
|
type FieldsWithoutArray<FS extends Record<string, any>> = {
|
|
21
27
|
[K in keyof FS]: FS[K] extends any[] | undefined ? string | undefined : FS[K];
|
|
22
28
|
};
|
|
@@ -44,4 +50,4 @@ declare const combobox2Options: <CB extends Record<string, (ComboBox | ComboBox<
|
|
|
44
50
|
optionsMap: OptionsMapType<keyof CB>;
|
|
45
51
|
};
|
|
46
52
|
|
|
47
|
-
export { type ComboBox, type OptionsMapType, type OptionsRecordType, type OptionsType, combobox2Options, delayHandle, fieldsArrayToString, fieldsReset, formatterPrice, formatterTax, getBase64, getObjectURL, getUrlQuery, imgRelative2Absolute, mockSkeletons, parseUrlQuery, queryString, resizeAliYun, setUrlQuery, uuid };
|
|
53
|
+
export { type ComboBox, type OptionsMapType, type OptionsRecordType, type OptionsType, type ResizeAliYunOptions, combobox2Options, delayHandle, fieldsArrayToString, fieldsReset, formatterPrice, formatterTax, getBase64, getObjectURL, getUrlQuery, imgRelative2Absolute, mockSkeletons, parseUrlQuery, queryString, resizeAliYun, setUrlQuery, uuid };
|
package/dist/tools.d.ts
CHANGED
|
@@ -16,7 +16,13 @@ declare function formatterPrice(value?: string | number | undefined): string;
|
|
|
16
16
|
declare function formatterTax(percentTax: string): string;
|
|
17
17
|
declare function uuid(): string;
|
|
18
18
|
declare const imgRelative2Absolute: (imgUrl?: string) => string;
|
|
19
|
-
|
|
19
|
+
type ResizeAliYunOptions = {
|
|
20
|
+
width?: number;
|
|
21
|
+
quality?: number;
|
|
22
|
+
/** 阿里云自定义裁剪参数 */
|
|
23
|
+
customStyle?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const resizeAliYun: (imgUrl?: string, options?: ResizeAliYunOptions) => string;
|
|
20
26
|
type FieldsWithoutArray<FS extends Record<string, any>> = {
|
|
21
27
|
[K in keyof FS]: FS[K] extends any[] | undefined ? string | undefined : FS[K];
|
|
22
28
|
};
|
|
@@ -44,4 +50,4 @@ declare const combobox2Options: <CB extends Record<string, (ComboBox | ComboBox<
|
|
|
44
50
|
optionsMap: OptionsMapType<keyof CB>;
|
|
45
51
|
};
|
|
46
52
|
|
|
47
|
-
export { type ComboBox, type OptionsMapType, type OptionsRecordType, type OptionsType, combobox2Options, delayHandle, fieldsArrayToString, fieldsReset, formatterPrice, formatterTax, getBase64, getObjectURL, getUrlQuery, imgRelative2Absolute, mockSkeletons, parseUrlQuery, queryString, resizeAliYun, setUrlQuery, uuid };
|
|
53
|
+
export { type ComboBox, type OptionsMapType, type OptionsRecordType, type OptionsType, type ResizeAliYunOptions, combobox2Options, delayHandle, fieldsArrayToString, fieldsReset, formatterPrice, formatterTax, getBase64, getObjectURL, getUrlQuery, imgRelative2Absolute, mockSkeletons, parseUrlQuery, queryString, resizeAliYun, setUrlQuery, uuid };
|
package/dist/tools.js
CHANGED
|
@@ -162,7 +162,8 @@ var imgRelative2Absolute = (imgUrl = "") => {
|
|
|
162
162
|
}
|
|
163
163
|
return imgUrl;
|
|
164
164
|
};
|
|
165
|
-
var resizeAliYun = (imgUrl = "",
|
|
165
|
+
var resizeAliYun = (imgUrl = "", options = {}) => {
|
|
166
|
+
const { width, quality, customStyle } = options;
|
|
166
167
|
if (!imgUrl) return imgUrl;
|
|
167
168
|
if (isTmp(imgUrl) || isBlob(imgUrl) || isImgWeChat(imgUrl)) {
|
|
168
169
|
return imgUrl;
|
|
@@ -175,6 +176,9 @@ var resizeAliYun = (imgUrl = "", width, quality) => {
|
|
|
175
176
|
return imgUrl;
|
|
176
177
|
}
|
|
177
178
|
imgUrl = imgUrl.replace(/[?#].*/g, "");
|
|
179
|
+
if (customStyle) {
|
|
180
|
+
return `${imgUrl}?x-oss-process=style/${customStyle}`;
|
|
181
|
+
}
|
|
178
182
|
const isHeic = isImgHeic(imgUrl);
|
|
179
183
|
let params = "x-oss-process=image";
|
|
180
184
|
if (width) params = `${params}/resize,w_${width}`;
|
package/dist/tools.mjs
CHANGED
|
@@ -92,7 +92,8 @@ var imgRelative2Absolute = (imgUrl = "") => {
|
|
|
92
92
|
}
|
|
93
93
|
return imgUrl;
|
|
94
94
|
};
|
|
95
|
-
var resizeAliYun = (imgUrl = "",
|
|
95
|
+
var resizeAliYun = (imgUrl = "", options = {}) => {
|
|
96
|
+
const { width, quality, customStyle } = options;
|
|
96
97
|
if (!imgUrl) return imgUrl;
|
|
97
98
|
if (isTmp(imgUrl) || isBlob(imgUrl) || isImgWeChat(imgUrl)) {
|
|
98
99
|
return imgUrl;
|
|
@@ -105,6 +106,9 @@ var resizeAliYun = (imgUrl = "", width, quality) => {
|
|
|
105
106
|
return imgUrl;
|
|
106
107
|
}
|
|
107
108
|
imgUrl = imgUrl.replace(/[?#].*/g, "");
|
|
109
|
+
if (customStyle) {
|
|
110
|
+
return `${imgUrl}?x-oss-process=style/${customStyle}`;
|
|
111
|
+
}
|
|
108
112
|
const isHeic = isImgHeic(imgUrl);
|
|
109
113
|
let params = "x-oss-process=image";
|
|
110
114
|
if (width) params = `${params}/resize,w_${width}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"module": "dist/*.js",
|
|
6
6
|
"types": "types/*.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/node": "^20.17.0",
|
|
31
31
|
"eslint": "8.57.1",
|
|
32
32
|
"@xfe-repo/eslint-config": "1.6.0",
|
|
33
|
-
"@xfe-repo/typescript-config": "1.6.
|
|
33
|
+
"@xfe-repo/typescript-config": "1.6.1"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"registry": "https://registry.npmjs.org/"
|