sculp-js 1.8.2 → 1.8.4

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.
Files changed (63) hide show
  1. package/lib/cjs/array.js +2 -3
  2. package/lib/cjs/async.js +1 -1
  3. package/lib/cjs/base64.js +1 -1
  4. package/lib/cjs/clipboard.js +1 -1
  5. package/lib/cjs/cloneDeep.js +117 -0
  6. package/lib/cjs/cookie.js +1 -1
  7. package/lib/cjs/date.js +1 -1
  8. package/lib/cjs/dom.js +1 -1
  9. package/lib/cjs/download.js +29 -5
  10. package/lib/cjs/easing.js +1 -1
  11. package/lib/cjs/file.js +1 -1
  12. package/lib/cjs/func.js +1 -28
  13. package/lib/cjs/index.js +5 -3
  14. package/lib/cjs/isEqual.js +133 -0
  15. package/lib/cjs/math.js +1 -1
  16. package/lib/cjs/number.js +1 -1
  17. package/lib/cjs/object.js +1 -235
  18. package/lib/cjs/path.js +1 -1
  19. package/lib/cjs/qs.js +1 -1
  20. package/lib/cjs/random.js +1 -1
  21. package/lib/cjs/string.js +1 -1
  22. package/lib/cjs/tooltip.js +1 -1
  23. package/lib/cjs/tree.js +1 -1
  24. package/lib/cjs/type.js +1 -1
  25. package/lib/cjs/unique.js +1 -1
  26. package/lib/cjs/url.js +1 -1
  27. package/lib/cjs/validator.js +1 -1
  28. package/lib/cjs/variable.js +3 -2
  29. package/lib/cjs/watermark.js +1 -1
  30. package/lib/cjs/we-decode.js +1 -1
  31. package/lib/es/array.js +2 -3
  32. package/lib/es/async.js +1 -1
  33. package/lib/es/base64.js +1 -1
  34. package/lib/es/clipboard.js +1 -1
  35. package/lib/es/cloneDeep.js +115 -0
  36. package/lib/es/cookie.js +1 -1
  37. package/lib/es/date.js +1 -1
  38. package/lib/es/dom.js +1 -1
  39. package/lib/es/download.js +30 -6
  40. package/lib/es/easing.js +1 -1
  41. package/lib/es/file.js +1 -1
  42. package/lib/es/func.js +1 -28
  43. package/lib/es/index.js +4 -2
  44. package/lib/es/isEqual.js +131 -0
  45. package/lib/es/math.js +1 -1
  46. package/lib/es/number.js +1 -1
  47. package/lib/es/object.js +2 -234
  48. package/lib/es/path.js +1 -1
  49. package/lib/es/qs.js +1 -1
  50. package/lib/es/random.js +1 -1
  51. package/lib/es/string.js +1 -1
  52. package/lib/es/tooltip.js +1 -1
  53. package/lib/es/tree.js +1 -1
  54. package/lib/es/type.js +1 -1
  55. package/lib/es/unique.js +1 -1
  56. package/lib/es/url.js +1 -1
  57. package/lib/es/validator.js +1 -1
  58. package/lib/es/variable.js +4 -3
  59. package/lib/es/watermark.js +1 -1
  60. package/lib/es/we-decode.js +1 -1
  61. package/lib/index.d.ts +32 -21
  62. package/lib/umd/index.js +262 -267
  63. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -332,13 +332,22 @@ declare function downloadHref(href: string, filename: string, callback?: Functio
332
332
  * @param {Function} callback
333
333
  */
334
334
  declare function downloadBlob(blob: Blob, filename: string, callback?: Function): void;
335
+ type CrossOriginDownloadParams = {
336
+ successCode?: number;
337
+ successCallback?: Function;
338
+ failCallback?: Function;
339
+ };
335
340
  /**
336
341
  * 根据URL下载文件(解决跨域a.download不生效问题)
342
+ *
343
+ * 可定制下载成功的状态码status(浏览器原生状态码)
344
+ *
345
+ * 支持下载操作成功、失败后的回调
337
346
  * @param {string} url
338
347
  * @param {string} filename
339
- * @param {Function} callback
348
+ * @param {CrossOriginDownloadParams} options
340
349
  */
341
- declare function crossOriginDownload(url: string, filename: string, callback?: Function): void;
350
+ declare function crossOriginDownload(url: string, filename: string, options?: CrossOriginDownloadParams): void;
342
351
  type FileType = 'json' | 'csv' | 'xls' | 'xlsx';
343
352
  /**
344
353
  * 将指定数据格式通过 A 链接的方式下载
@@ -417,25 +426,6 @@ declare function objectGet(obj: AnyObject, path: string, strict?: boolean): {
417
426
  k: string | undefined;
418
427
  v: any | undefined;
419
428
  };
420
- /**
421
- * 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
422
- *
423
- * 包含对null、原始值、对象循环引用的处理
424
- *
425
- * 对Map、Set、ArrayBuffer、Date、RegExp、Array、Object及原型链属性方法执行深拷贝
426
- * @param {T} source
427
- * @param {WeakMap} map
428
- * @returns {T}
429
- */
430
- declare function cloneDeep<T>(source: T, map?: WeakMap<any, any>): T;
431
- type Comparable = null | undefined | boolean | number | string | Date | RegExp | Map<any, any> | Set<any> | ArrayBuffer | object | Array<any>;
432
- /**
433
- * 比较两值是否相等,适用所有数据类型
434
- * @param {Comparable} a
435
- * @param {Comparable} b
436
- * @returns {boolean}
437
- */
438
- declare function isEqual(a: Comparable, b: Comparable): boolean;
439
429
 
440
430
  /**
441
431
  * 标准化路径
@@ -1055,4 +1045,25 @@ declare function replaceVarFromString(sourceStr: string, targetObj: Record<strin
1055
1045
  */
1056
1046
  declare function executeInScope(code: string, scope?: Record<string, any>): any;
1057
1047
 
1048
+ /**
1049
+ * 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
1050
+ *
1051
+ * 包含对null、原始值、对象循环引用的处理
1052
+ *
1053
+ * 对Map、Set、ArrayBuffer、Date、RegExp、Array、Object及原型链属性方法执行深拷贝
1054
+ * @param {T} source
1055
+ * @param {WeakMap} map
1056
+ * @returns {T}
1057
+ */
1058
+ declare function cloneDeep<T>(source: T, map?: WeakMap<any, any>): T;
1059
+
1060
+ type Comparable = null | undefined | boolean | number | string | Date | RegExp | Map<any, any> | Set<any> | ArrayBuffer | object | Array<any>;
1061
+ /**
1062
+ * 比较两值是否相等,适用所有数据类型
1063
+ * @param {Comparable} a
1064
+ * @param {Comparable} b
1065
+ * @returns {boolean}
1066
+ */
1067
+ declare function isEqual(a: Comparable, b: Comparable): boolean;
1068
+
1058
1069
  export { type AnyArray, type AnyFunc, type AnyObject, type ArrayElements, type Comparable, type DateObj, type DateValue, type DebounceFunc, EMAIL_REGEX, type FileType, HEX_POOL, HTTP_URL_REGEX, type ICanvasWM, type ICompressOptions, type IFieldOptions, type IFilterCondition, IPV4_REGEX, IPV6_REGEX, type ISearchTreeOpts, type ITreeConf, type IdLike, type LooseParamValue, type LooseParams, type ObjectAssignItem, type OnceFunc, PHONE_REGEX, type Params, type PartialDeep, type RandomString, type Replacer, STRING_ARABIC_NUMERALS, STRING_LOWERCASE_ALPHA, STRING_POOL, STRING_UPPERCASE_ALPHA, type SetStyle, type SmoothScrollOptions, type Style, type ThrottleFunc, UNIQUE_NUMBER_SAFE_LENGTH, URL_REGEX, type UniqueString, type Url, add, addClass, arrayEach, arrayEachAsync, arrayInsertBefore, arrayLike, arrayRemove, asyncMap, calculateDate, calculateDateTime, chooseLocalFile, cloneDeep, compressImg, cookieDel, cookieGet, cookieSet, copyText, crossOriginDownload, dateParse, dateToEnd, dateToStart, debounce, decodeFromBase64, divide, downloadBlob, downloadData, downloadHref, downloadURL, encodeToBase64, escapeRegExp, executeInScope, flatTree, forEachDeep, formatDate, formatNumber, formatTree, fuzzySearchTree, genCanvasWM, getComputedCssVal, getGlobal, getStrWidthPx, getStyle, hasClass, isArray, isBigInt, isBoolean, isDate, isDigit, isEmail, isEmpty, isEqual, isError, isFloat, isFunction, isIdNo, isInteger, isIpV4, isIpV6, isJsonString, isNaN, isNull, isNullOrUnDef, isNullOrUnDef as isNullish, isNumber, isNumerical, isObject, isPhone, isPlainObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, isUrl, isValidDate, mapDeep, multiply, numberAbbr, numberToHex, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectHas, objectMap, objectAssign as objectMerge, objectOmit, objectPick, once, parseQueryParams, parseVarFromString, pathJoin, pathNormalize, qsParse, qsStringify, randomNumber, randomString, randomUuid, removeClass, replaceVarFromString, searchTreeById, setGlobal, setStyle, smoothScroll, stringAssign, stringCamelCase, stringEscapeHtml, stringFill, stringFormat, stringKebabCase, strip, subtract, supportCanvas, throttle, tooltipEvent, typeIs, uniqueNumber, uniqueString, uniqueSymbol, urlDelParams, urlParse, urlSetParams, urlStringify, wait, weAtob, weBtoa };