@lightsoft/js-sdk 1.2.0 → 1.2.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/index.d.ts +9 -1
- package/dist/index.js +26 -1
- package/dist/index.umd.js +28 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/url.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -274,6 +274,14 @@ declare const countUp: (start: number, end: number, callback: (current: number)
|
|
|
274
274
|
|
|
275
275
|
declare function hasRepeatArray(arr: any[], keys?: string[]): any[];
|
|
276
276
|
|
|
277
|
+
type TAddURLParamsReturn = {
|
|
278
|
+
url: string;
|
|
279
|
+
queryString: string;
|
|
280
|
+
};
|
|
281
|
+
declare function addURLParams(params: Record<string, any>, url?: string): TAddURLParamsReturn;
|
|
282
|
+
declare function getURLParams(url?: string): Record<string, any>;
|
|
283
|
+
declare function deleteURLParams(keys: string[], url?: string): URL;
|
|
284
|
+
|
|
277
285
|
/**
|
|
278
286
|
* 匹配中文字母数字
|
|
279
287
|
*/
|
|
@@ -299,5 +307,5 @@ declare const email: RegExp;
|
|
|
299
307
|
*/
|
|
300
308
|
declare const url: RegExp;
|
|
301
309
|
|
|
302
|
-
export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, countUp, createWebSocket, dataHandler, debounce, deepMerge, download, email, findTreeDataNode, findTreeDataNodeName, getState, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useClose, useCountDown, useDownload, useOnMessage, useSendMessage, zhLetterNumber };
|
|
310
|
+
export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, createWebSocket, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getState, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useClose, useCountDown, useDownload, useOnMessage, useSendMessage, zhLetterNumber };
|
|
303
311
|
export type { ISectoralTable, Tag, typeIsNull };
|
package/dist/index.js
CHANGED
|
@@ -2865,6 +2865,31 @@ function hasRepeatArray(arr, keys) {
|
|
|
2865
2865
|
return [false];
|
|
2866
2866
|
}
|
|
2867
2867
|
|
|
2868
|
+
function addURLParams(params, url) {
|
|
2869
|
+
url = url || window.location.href;
|
|
2870
|
+
var urlParams = getURLParams(url);
|
|
2871
|
+
var queryString = new URLSearchParams(Object.entries(__assign(__assign({}, urlParams), params))).toString();
|
|
2872
|
+
return {
|
|
2873
|
+
url: "".concat(url, "?").concat(queryString),
|
|
2874
|
+
queryString: queryString,
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
function getURLParams(url) {
|
|
2878
|
+
url = url || window.location.href;
|
|
2879
|
+
var urlString = url.split('?')[1];
|
|
2880
|
+
var urlSearchParams = new URLSearchParams(urlString);
|
|
2881
|
+
var result = Object.fromEntries(urlSearchParams.entries());
|
|
2882
|
+
return result;
|
|
2883
|
+
}
|
|
2884
|
+
function deleteURLParams(keys, url) {
|
|
2885
|
+
url = url || window.location.href;
|
|
2886
|
+
var newUrl = new URL(url);
|
|
2887
|
+
var params = new URLSearchParams(newUrl.search);
|
|
2888
|
+
keys.forEach(function (key) { return params.delete(key); });
|
|
2889
|
+
newUrl.search = params.toString();
|
|
2890
|
+
return newUrl;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2868
2893
|
/**
|
|
2869
2894
|
* 匹配中文字母数字
|
|
2870
2895
|
*/
|
|
@@ -2890,4 +2915,4 @@ var email = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$
|
|
|
2890
2915
|
*/
|
|
2891
2916
|
var url = /^https?:\/\/[^\s/$.?#].[^\s]*$/;
|
|
2892
2917
|
|
|
2893
|
-
export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, countUp, dataHandler, debounce, deepMerge, download, email, findTreeDataNode, findTreeDataNodeName, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useCountDown, useDownload, zhLetterNumber };
|
|
2918
|
+
export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useCountDown, useDownload, zhLetterNumber };
|
package/dist/index.umd.js
CHANGED
|
@@ -1059,6 +1059,31 @@
|
|
|
1059
1059
|
return [false];
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
|
+
function addURLParams(params, url) {
|
|
1063
|
+
url = url || window.location.href;
|
|
1064
|
+
var urlParams = getURLParams(url);
|
|
1065
|
+
var queryString = new URLSearchParams(Object.entries(__assign(__assign({}, urlParams), params))).toString();
|
|
1066
|
+
return {
|
|
1067
|
+
url: "".concat(url, "?").concat(queryString),
|
|
1068
|
+
queryString: queryString,
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
function getURLParams(url) {
|
|
1072
|
+
url = url || window.location.href;
|
|
1073
|
+
var urlString = url.split('?')[1];
|
|
1074
|
+
var urlSearchParams = new URLSearchParams(urlString);
|
|
1075
|
+
var result = Object.fromEntries(urlSearchParams.entries());
|
|
1076
|
+
return result;
|
|
1077
|
+
}
|
|
1078
|
+
function deleteURLParams(keys, url) {
|
|
1079
|
+
url = url || window.location.href;
|
|
1080
|
+
var newUrl = new URL(url);
|
|
1081
|
+
var params = new URLSearchParams(newUrl.search);
|
|
1082
|
+
keys.forEach(function (key) { return params.delete(key); });
|
|
1083
|
+
newUrl.search = params.toString();
|
|
1084
|
+
return newUrl;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1062
1087
|
/**
|
|
1063
1088
|
* 匹配中文字母数字
|
|
1064
1089
|
*/
|
|
@@ -1090,16 +1115,19 @@
|
|
|
1090
1115
|
exports.Request = Request;
|
|
1091
1116
|
exports.RequestChain = RequestChain;
|
|
1092
1117
|
exports.Tour = Tour;
|
|
1118
|
+
exports.addURLParams = addURLParams;
|
|
1093
1119
|
exports.countUp = countUp;
|
|
1094
1120
|
exports.createWebSocket = createWebSocket;
|
|
1095
1121
|
exports.dataHandler = dataHandler;
|
|
1096
1122
|
exports.debounce = debounce;
|
|
1097
1123
|
exports.deepMerge = deepMerge;
|
|
1124
|
+
exports.deleteURLParams = deleteURLParams;
|
|
1098
1125
|
exports.download = download;
|
|
1099
1126
|
exports.email = email;
|
|
1100
1127
|
exports.findTreeDataNode = findTreeDataNode;
|
|
1101
1128
|
exports.findTreeDataNodeName = findTreeDataNodeName;
|
|
1102
1129
|
exports.getState = getState;
|
|
1130
|
+
exports.getURLParams = getURLParams;
|
|
1103
1131
|
exports.hasRepeatArray = hasRepeatArray;
|
|
1104
1132
|
exports.idCard = idCard;
|
|
1105
1133
|
exports.ip = ip;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TAddURLParamsReturn = {
|
|
2
|
+
url: string;
|
|
3
|
+
queryString: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function addURLParams(params: Record<string, any>, url?: string): TAddURLParamsReturn;
|
|
6
|
+
export declare function getURLParams(url?: string): Record<string, any>;
|
|
7
|
+
export declare function deleteURLParams(keys: string[], url?: string): URL;
|
|
8
|
+
export {};
|