amos-tool 1.4.13 → 1.4.14

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/docs/Logger.html CHANGED
@@ -334,7 +334,7 @@ isDebug: true
334
334
  <br class="clear">
335
335
 
336
336
  <footer>
337
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
337
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Aug 09 2022 15:32:24 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
338
338
  </footer>
339
339
 
340
340
  <script>prettyPrint();</script>
package/docs/global.html CHANGED
@@ -15477,7 +15477,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
15477
15477
  <br class="clear">
15478
15478
 
15479
15479
  <footer>
15480
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
15480
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Aug 09 2022 15:32:24 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
15481
15481
  </footer>
15482
15482
 
15483
15483
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -783,7 +783,7 @@ convert2BMP(canvas, width, height)</p>
783
783
  <br class="clear">
784
784
 
785
785
  <footer>
786
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Mon Jun 13 2022 17:00:40 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
786
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Aug 09 2022 15:32:24 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
787
787
  </footer>
788
788
 
789
789
  <script>prettyPrint();</script>
package/index.d.ts CHANGED
@@ -204,10 +204,21 @@ declare namespace LocationParam {
204
204
  export function extractParams(url: string): Object;
205
205
  /**
206
206
  * 补全参数
207
- * @param {*} param
208
- * @param {*} url 可以为空,如果为空,则默认取 location.href
209
- */
210
- export function completeParam(param: Object, url: string): string;
207
+ * @param {Object} param
208
+ * @param {String} url 可以为空,如果为空,则默认取 location.href
209
+ * @param {Boolean} forceCast 强制转换,默认会将参数中的 undefined 和 null 转化为 '' 字符串
210
+ * @example
211
+ * // 如:window.location.href = http://localhost:8080/aaa
212
+ * // 传入一个参数,url 将使用 `window.location.href`
213
+ * completeParam({ token: 'xxddf' }); // `http://localhost:8080/aaa?token=xxddf`
214
+ * // 使用自定义的 url
215
+ * completeParam({ token: 'xxddf' }, '/main/sub'); // `/main/sub?token=xxddf`
216
+ * // 强制转化 null 值
217
+ * completeParam({ token: 'xxddf', id: null }, '/main/sub', true); // `/main/sub?token=xxddf&id=`
218
+ * // 使用 location.href, 传入两个参数,强制转化 null 值
219
+ * completeParam({ token: 'xxddf', id: null }, true); // `http://localhost:8080/aaa?token=xxddf&id=`
220
+ */
221
+ export function completeParam(param: Object, url: string, forceCast: Boolean): string;
211
222
  export type LocationSearch = { init(): void; getValue(key: string): string; getParameters(): Array<any> };
212
223
  export type LSFN = { getValue(): string; getParameters(): Array<any> };
213
224
  }
@@ -708,6 +719,18 @@ export function amountCase(n): string;
708
719
  export function pwdStrength(str): number;
709
720
  export function addition(arg1, arg2): number;
710
721
  export function subtraction(arg1, arg2): number;
722
+ /**
723
+ * 小数乘法
724
+ * @param arg1 被乘数(接受小数和整数)
725
+ * @param arg2 乘数(接受小数和整数)
726
+ * @param fix 乘积保留几位(接受正负整数以及0)
727
+ * @returns {Number}
728
+ * @example
729
+ * accMul(0.56, 100); // 56
730
+ * accMul(0.5679, 100); // 57
731
+ * accMul(0.5679, 100.2); // 57
732
+ */
733
+ export function accMul(arg1: Number, arg2: Number, fix = 0): number;
711
734
 
712
735
  /**
713
736
  * 将数值格式化成金额形式
package/lib/amostool.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var Base64 = require("./encrypt/_base64"), MD5 = require("./encrypt/_md5"), DES = require("./encrypt/des"), Browser = require("./_browser"), cloneTools = require("./_clone"), amosCookie = require("./_cookie"), deepCopy = require("./_deepCopy"), deepEqual = require("./_deepEqual"), _fastDeepEqual = require("./_fastDeepEqual"), funcThrottle = require("./_funcThrottle"), isNode = require("./_isnode"), List = require("./_list"), _objectAssign = require("./_object.assign"), _objectEntries = require("./_object.entries"), _objectValues = require("./_object.values"), omit = require("./_omit"), pick = require("./_pick"), parseJson = require("./_parseJson"), Queue = require("./_queue"), shallowCopy = require("./_shallowCopy"), stringify = require("./_stringify"), supportWs = require("./_supportWs"), trim = require("./_trim"), UUID = require("./_uuids"), array2tree = require("./array2tree"), arrayFilter = require("./arrayFilter"), arrayUtils = require("./arrayUtils"), browserSupport = require("./browserSupport"), completeUnit = require("./completeUnit"), consts = require("./consts"), flat = require("./flat"), LocationParam = require("./locationParams"), Log = require("./log"), merged = require("./merged"), objectPath = require("./objectPath"), parseText = require("./parseText"), pwdPolicy = require("./pwdPolicy"), random = require("./random"), shallowEqual = require("./shallowEqual"), Store = require("./store"), strUtils = require("./strUtils"), tableFilter = require("./tableFilter"), utils = require("./utils"), canvas2img = require("./dom/canvas2img"), canvasTools = require("./dom/canvasTools"), downloadFile = require("./dom/downloadFile"), eventHelper = require("./dom/eventHelper"), fileBlob = require("./dom/fileBlob"), fileSaveAs = require("./dom/fileSaveAs"), getFontSize = require("./dom/getFontSize"), minfyImg = require("./dom/minfyImg"), addition = require("./math/addition"), amountCase = require("./math/amountCase"), coinFormat = require("./math/coinFormat"), colorUtil = require("./math/colorUtil"), dateTime = require("./math/dateTime"), pwdStrength = require("./math/pwdStrength"), randomColor = require("./math/randomColor"), subtraction = require("./math/subtraction"), qs = require("./qs"), encodeUrl = require("./url/encodeUrl"), restfulUrl = require("./url/restfulUrl"), positionFactory = require("./positionFactory"), throttleDebounce = require("./throttleDebounce"), checkFlash = require("./_flashSupport");
3
+ var Base64 = require("./encrypt/_base64"), MD5 = require("./encrypt/_md5"), DES = require("./encrypt/des"), Browser = require("./_browser"), cloneTools = require("./_clone"), amosCookie = require("./_cookie"), deepCopy = require("./_deepCopy"), deepEqual = require("./_deepEqual"), _fastDeepEqual = require("./_fastDeepEqual"), funcThrottle = require("./_funcThrottle"), isNode = require("./_isnode"), List = require("./_list"), _objectAssign = require("./_object.assign"), _objectEntries = require("./_object.entries"), _objectValues = require("./_object.values"), omit = require("./_omit"), pick = require("./_pick"), parseJson = require("./_parseJson"), Queue = require("./_queue"), shallowCopy = require("./_shallowCopy"), stringify = require("./_stringify"), supportWs = require("./_supportWs"), trim = require("./_trim"), UUID = require("./_uuids"), array2tree = require("./array2tree"), arrayFilter = require("./arrayFilter"), arrayUtils = require("./arrayUtils"), browserSupport = require("./browserSupport"), completeUnit = require("./completeUnit"), consts = require("./consts"), flat = require("./flat"), LocationParam = require("./locationParams"), Log = require("./log"), merged = require("./merged"), objectPath = require("./objectPath"), parseText = require("./parseText"), pwdPolicy = require("./pwdPolicy"), random = require("./random"), shallowEqual = require("./shallowEqual"), Store = require("./store"), strUtils = require("./strUtils"), tableFilter = require("./tableFilter"), utils = require("./utils"), canvas2img = require("./dom/canvas2img"), canvasTools = require("./dom/canvasTools"), downloadFile = require("./dom/downloadFile"), eventHelper = require("./dom/eventHelper"), fileBlob = require("./dom/fileBlob"), fileSaveAs = require("./dom/fileSaveAs"), getFontSize = require("./dom/getFontSize"), minfyImg = require("./dom/minfyImg"), addition = require("./math/addition"), amountCase = require("./math/amountCase"), coinFormat = require("./math/coinFormat"), colorUtil = require("./math/colorUtil"), dateTime = require("./math/dateTime"), pwdStrength = require("./math/pwdStrength"), randomColor = require("./math/randomColor"), subtraction = require("./math/subtraction"), accMul = require("./math/mul"), qs = require("./qs"), encodeUrl = require("./url/encodeUrl"), restfulUrl = require("./url/restfulUrl"), positionFactory = require("./positionFactory"), throttleDebounce = require("./throttleDebounce"), checkFlash = require("./_flashSupport");
4
4
 
5
5
  module.exports = {
6
6
  Base64: Base64,
@@ -61,6 +61,7 @@ module.exports = {
61
61
  randomColor: randomColor,
62
62
  addition: addition,
63
63
  subtraction: subtraction,
64
+ accMul: accMul,
64
65
  coinFormat: coinFormat,
65
66
  dateTime: dateTime,
66
67
  qs: qs,
@@ -44,19 +44,19 @@ var utils = require("./utils"), _LSFN = function() {
44
44
  }
45
45
  }, LocationParam = {
46
46
  parse: function(t) {
47
- var n, e, i, r, o;
47
+ var n, e, i, o, r;
48
48
  t || (t = window.location.search);
49
49
  var a = {}, c = [];
50
- if (!utils.isEmpty(t) && t.length > 1) for (r = 0, o = (c = t.slice(1 + t.indexOf("?"), t.length).split("&")).length; r < o; r++) n = (e = (e = c[r]).split("="))[0],
50
+ if (!utils.isEmpty(t) && t.length > 1) for (o = 0, r = (c = t.slice(1 + t.indexOf("?"), t.length).split("&")).length; o < r; o++) n = (e = (e = c[o]).split("="))[0],
51
51
  i = e[1], n in a ? (utils.isArray(a[n]) || (a[n] = [ a[n] ]), a[n].push(decodeURIComponent(i))) : a[n] = decodeURIComponent(i);
52
52
  return a;
53
53
  },
54
54
  paramSearch: function(t, n) {
55
55
  if (utils.isUndefined(n) || utils.isNull(n)) {
56
56
  if (n = window.location.search, utils.isUndefined(t) || utils.isNull(t)) {
57
- for (var e = n.substr(1, n.length - 1).split("&"), i = {}, r = 0; r < e.length; r++) {
58
- var o = e[r].split("=");
59
- 1 === o.length ? i[o[0]] = "" : 2 === o.length ? i[o[0]] = decodeURIComponent(o[1]) : console.log("there is something wrong when use [paramSearch]!");
57
+ for (var e = n.substr(1, n.length - 1).split("&"), i = {}, o = 0; o < e.length; o++) {
58
+ var r = e[o].split("=");
59
+ 1 === r.length ? i[r[0]] = "" : 2 === r.length ? i[r[0]] = decodeURIComponent(r[1]) : console.log("there is something wrong when use [paramSearch]!");
60
60
  }
61
61
  return i;
62
62
  }
@@ -71,9 +71,9 @@ var utils = require("./utils"), _LSFN = function() {
71
71
  getLocationParams: function() {
72
72
  var t, n, e = {}, i = window.location.href;
73
73
  if (!utils.isEmpty(i)) {
74
- var r = i.indexOf("?");
75
- if (r < -1) console.log("the location.href is invalid!"); else for (var o = (i = i.substr(r + 1)).split("&"), a = 0; a < o.length; a++) (r = o[a].indexOf("=")) > 0 && (t = o[a].substring(0, r),
76
- n = o[a].substr(r + 1), e[t] = decodeURIComponent(n));
74
+ var o = i.indexOf("?");
75
+ if (o < -1) console.log("the location.href is invalid!"); else for (var r = (i = i.substr(o + 1)).split("&"), a = 0; a < r.length; a++) (o = r[a].indexOf("=")) > 0 && (t = r[a].substring(0, o),
76
+ n = r[a].substr(o + 1), e[t] = decodeURIComponent(n));
77
77
  }
78
78
  return e;
79
79
  },
@@ -90,20 +90,23 @@ var utils = require("./utils"), _LSFN = function() {
90
90
  return utils.isNil(i) ? null : decodeURIComponent(i[2]);
91
91
  },
92
92
  extractParams: function(t) {
93
- var n, e, i = {}, r = t || window.location.href;
94
- if (!utils.isEmpty(r)) {
95
- var o = r.indexOf("?");
96
- if (o < -1) console.log("the location.href is invalid!"); else for (var a = (r = r.substr(o + 1)).split("&"), c = 0; c < a.length; c++) (o = a[c].indexOf("=")) > 0 && (n = a[c].substring(0, o),
97
- e = a[c].substr(o + 1), i[n] = decodeURIComponent(e));
93
+ var n, e, i = {}, o = t || window.location.href;
94
+ if (!utils.isEmpty(o)) {
95
+ var r = o.indexOf("?");
96
+ if (r < -1) console.log("the location.href is invalid!"); else for (var a = (o = o.substr(r + 1)).split("&"), c = 0; c < a.length; c++) (r = a[c].indexOf("=")) > 0 && (n = a[c].substring(0, r),
97
+ e = a[c].substr(r + 1), i[n] = decodeURIComponent(e));
98
98
  }
99
99
  return i;
100
100
  },
101
- completeParam: function(t, n) {
102
- n || (n = window.location.href);
103
- var e = (Object.keys(t) || []).reduce((function(n, e) {
104
- return n += "&".concat(e, "=").concat(t[e]);
101
+ completeParam: function(t, n, e) {
102
+ var i = arguments;
103
+ 1 === i.length ? n || (n = window.location.href) : 2 === i.length && utils.isBoolean(n) && (e = n,
104
+ n = window.location.href), utils.isUndefined(e) && (e = !1), n || (n = window.location.href);
105
+ var o = (Object.keys(t) || []).reduce((function(n, i) {
106
+ var o = t[i];
107
+ return e && (utils.isNull(o) || utils.isUndefined(o)) && (o = ""), n += "&".concat(i, "=").concat(o);
105
108
  }), "");
106
- return e ? (e = e.slice(1), -1 !== n.indexOf("?") ? n.endsWith("?") ? "".concat(n).concat(e) : "".concat(n, "&").concat(e) : "".concat(n, "?").concat(e)) : n;
109
+ return o ? (o = o.slice(1), -1 !== n.indexOf("?") ? n.endsWith("?") ? "".concat(n).concat(o) : "".concat(n, "&").concat(o) : "".concat(n, "?").concat(o)) : n;
107
110
  },
108
111
  LocationSearch: _LocationSearch,
109
112
  LSFN: _LSFN
@@ -148,7 +148,8 @@ var colorKeyWordsHexStr = {
148
148
  white: "#ffffff",
149
149
  whitesmoke: "#f5f5f5",
150
150
  yellow: "#ffff00",
151
- yellowgreen: "#9acd32"
151
+ yellowgreen: "#9acd32",
152
+ transparent: "rgba(0, 0, 0, 0)"
152
153
  };
153
154
 
154
155
  module.exports = colorKeyWordsHexStr;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var pow = function(t) {
4
+ return Math.pow(10, t);
5
+ };
6
+
7
+ module.exports = function(t, e) {
8
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
9
+ if (!parseInt(r) != r) {
10
+ var o, n, p = 0, a = t.toString(), u = e.toString(), c = 0;
11
+ try {
12
+ c = a.split(".")[1].length || 0;
13
+ } catch (t) {
14
+ c = 0;
15
+ }
16
+ p += c;
17
+ try {
18
+ o = u.split(".")[1].length || 0;
19
+ } catch (t) {
20
+ o = 0;
21
+ }
22
+ return n = (p += o) > r ? Math.round(Number(a.replace(".", "")) * Number(u.replace(".", "")) / pow(p - r)) / pow(r) : p <= r ? (Number(a.replace(".", "")) * Number(u.replace(".", "")) / pow(p)).toFixed(r) : (t * e).toFixed(r),
23
+ Number(n);
24
+ }
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amos-tool",
3
- "version": "1.4.13",
3
+ "version": "1.4.14",
4
4
  "description": "amos ui tool",
5
5
  "main": "index.js",
6
6
  "directories": {