@94ai/common-ui 5.0.0 → 5.0.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.
@@ -359,6 +359,54 @@ const copyFile = (sourcePath, targetPath) => {
359
359
  fs.copyFileSync(newSourcePath, newTargetPath);
360
360
  });
361
361
  };
362
+ const add = (arg1, arg2) => {
363
+ let r1, r2, m;
364
+ try {
365
+ r1 = (arg1.toString().split(".")[1] || "").length;
366
+ } catch (e) {
367
+ r1 = 0;
368
+ }
369
+ try {
370
+ r2 = (arg2.toString().split(".")[1] || "").length;
371
+ } catch (e) {
372
+ r2 = 0;
373
+ }
374
+ m = Math.pow(10, Math.max(r1, r2));
375
+ return div(mul(arg1, m) + mul(arg2, m), m);
376
+ };
377
+ const mul = (arg1, arg2) => {
378
+ let m = 0;
379
+ const s1 = arg1.toString();
380
+ const s2 = arg2.toString();
381
+ m += (s1.split(".")[1] || "").length;
382
+ m += (s2.split(".")[1] || "").length;
383
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
384
+ };
385
+ const div = (arg1, arg2) => {
386
+ const t1 = (arg1.toString().split(".")[1] || "").length;
387
+ const t2 = (arg2.toString().split(".")[1] || "").length;
388
+ const r1 = Number(arg1.toString().replace(".", ""));
389
+ const r2 = Number(arg2.toString().replace(".", ""));
390
+ return r1 / r2 * Math.pow(10, t2 - t1);
391
+ };
392
+ function getLocalTime(i) {
393
+ let time = i;
394
+ if (typeof time === "string") {
395
+ const arr = time.split(":");
396
+ if (arr.length < 2) {
397
+ return /* @__PURE__ */ new Date();
398
+ }
399
+ time = add(Number(arr[0]), div(Math.floor(Number(arr[1])), 60));
400
+ }
401
+ if (typeof time !== "number") {
402
+ return /* @__PURE__ */ new Date();
403
+ }
404
+ const d = /* @__PURE__ */ new Date();
405
+ const len = d.getTime();
406
+ const offset = d.getTimezoneOffset() * 6e4;
407
+ const utcTime = len + offset;
408
+ return new Date(utcTime + 36e5 * time);
409
+ }
362
410
  function toPascalCase(str) {
363
411
  const camelCase = str.replace(/-([a-z])/g, function(_match, letter) {
364
412
  return letter.toUpperCase();
@@ -388,6 +436,7 @@ const tool = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
388
436
  getHalfYear,
389
437
  getJsComponentSampleConfig,
390
438
  getLightColor,
439
+ getLocalTime,
391
440
  getNextYear,
392
441
  getQuarter,
393
442
  getResolver,
@@ -425,6 +474,7 @@ exports.getFlexDirection = getFlexDirection;
425
474
  exports.getHalfYear = getHalfYear;
426
475
  exports.getJsComponentSampleConfig = getJsComponentSampleConfig;
427
476
  exports.getLightColor = getLightColor;
477
+ exports.getLocalTime = getLocalTime;
428
478
  exports.getNextYear = getNextYear;
429
479
  exports.getQuarter = getQuarter;
430
480
  exports.getResolver = getResolver;
@@ -357,6 +357,54 @@ const copyFile = (sourcePath, targetPath) => {
357
357
  fs.copyFileSync(newSourcePath, newTargetPath);
358
358
  });
359
359
  };
360
+ const add = (arg1, arg2) => {
361
+ let r1, r2, m;
362
+ try {
363
+ r1 = (arg1.toString().split(".")[1] || "").length;
364
+ } catch (e) {
365
+ r1 = 0;
366
+ }
367
+ try {
368
+ r2 = (arg2.toString().split(".")[1] || "").length;
369
+ } catch (e) {
370
+ r2 = 0;
371
+ }
372
+ m = Math.pow(10, Math.max(r1, r2));
373
+ return div(mul(arg1, m) + mul(arg2, m), m);
374
+ };
375
+ const mul = (arg1, arg2) => {
376
+ let m = 0;
377
+ const s1 = arg1.toString();
378
+ const s2 = arg2.toString();
379
+ m += (s1.split(".")[1] || "").length;
380
+ m += (s2.split(".")[1] || "").length;
381
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
382
+ };
383
+ const div = (arg1, arg2) => {
384
+ const t1 = (arg1.toString().split(".")[1] || "").length;
385
+ const t2 = (arg2.toString().split(".")[1] || "").length;
386
+ const r1 = Number(arg1.toString().replace(".", ""));
387
+ const r2 = Number(arg2.toString().replace(".", ""));
388
+ return r1 / r2 * Math.pow(10, t2 - t1);
389
+ };
390
+ function getLocalTime(i) {
391
+ let time = i;
392
+ if (typeof time === "string") {
393
+ const arr = time.split(":");
394
+ if (arr.length < 2) {
395
+ return /* @__PURE__ */ new Date();
396
+ }
397
+ time = add(Number(arr[0]), div(Math.floor(Number(arr[1])), 60));
398
+ }
399
+ if (typeof time !== "number") {
400
+ return /* @__PURE__ */ new Date();
401
+ }
402
+ const d = /* @__PURE__ */ new Date();
403
+ const len = d.getTime();
404
+ const offset = d.getTimezoneOffset() * 6e4;
405
+ const utcTime = len + offset;
406
+ return new Date(utcTime + 36e5 * time);
407
+ }
360
408
  function toPascalCase(str) {
361
409
  const camelCase = str.replace(/-([a-z])/g, function(_match, letter) {
362
410
  return letter.toUpperCase();
@@ -386,6 +434,7 @@ const tool = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
386
434
  getHalfYear,
387
435
  getJsComponentSampleConfig,
388
436
  getLightColor,
437
+ getLocalTime,
389
438
  getNextYear,
390
439
  getQuarter,
391
440
  getResolver,
@@ -424,6 +473,7 @@ export {
424
473
  getHalfYear,
425
474
  getJsComponentSampleConfig,
426
475
  getLightColor,
476
+ getLocalTime,
427
477
  getNextYear,
428
478
  getQuarter,
429
479
  getResolver,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/common-ui",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "94智能公共组件库",
5
5
  "keywords": [
6
6
  "组件库"
@@ -16,54 +16,54 @@
16
16
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
17
17
  },
18
18
  "dependencies": {
19
- "@94ai/common-utils": "^5.0.0",
20
- "@94ai/nf-action": "^5.0.0",
21
- "@94ai/nf-address-select": "^5.0.0",
22
- "@94ai/nf-alert": "^5.0.0",
23
- "@94ai/nf-audio": "^5.0.0",
24
- "@94ai/nf-button": "^5.0.0",
25
- "@94ai/nf-button-demo": "^5.0.0",
26
- "@94ai/nf-conditions": "^5.0.0",
27
- "@94ai/nf-confirm": "^5.0.0",
28
- "@94ai/nf-date-picker": "^5.0.0",
29
- "@94ai/nf-double-half-year": "^5.0.0",
30
- "@94ai/nf-double-quarter": "^5.0.0",
31
- "@94ai/nf-double-time": "^5.0.0",
32
- "@94ai/nf-double-week": "^5.0.0",
33
- "@94ai/nf-double-year": "^5.0.0",
34
- "@94ai/nf-drawer": "^5.0.0",
35
- "@94ai/nf-empty": "^5.0.0",
36
- "@94ai/nf-form": "^5.0.0",
37
- "@94ai/nf-form-item": "^5.0.0",
38
- "@94ai/nf-half-year-picker": "^5.0.0",
39
- "@94ai/nf-iconfont-icon": "^5.0.0",
40
- "@94ai/nf-import-template": "^5.0.0",
41
- "@94ai/nf-indicator-plane": "^5.0.0",
42
- "@94ai/nf-infinite-menu": "^5.0.0",
43
- "@94ai/nf-input": "^5.0.0",
44
- "@94ai/nf-keywords": "^5.0.0",
45
- "@94ai/nf-lazy-select": "^5.0.0",
46
- "@94ai/nf-menu": "^5.0.0",
47
- "@94ai/nf-message": "^5.0.0",
48
- "@94ai/nf-microphone": "^5.0.0",
49
- "@94ai/nf-notification": "^5.0.0",
50
- "@94ai/nf-popup-lazy-select": "^5.0.0",
51
- "@94ai/nf-quarter-picker": "^5.0.0",
52
- "@94ai/nf-radio-group": "^5.0.0",
53
- "@94ai/nf-resizable-panels": "^5.0.0",
54
- "@94ai/nf-rules": "^5.0.0",
55
- "@94ai/nf-search-form": "^5.0.0",
56
- "@94ai/nf-softphone": "^5.0.0",
57
- "@94ai/nf-svg-icon": "^5.0.0",
58
- "@94ai/nf-table": "^5.0.0",
59
- "@94ai/nf-tag": "^5.0.0",
60
- "@94ai/nf-text-overflow": "^5.0.0",
61
- "@94ai/nf-theme-chalk": "^5.0.0",
62
- "@94ai/nf-timezone-picker": "^5.0.0",
63
- "@94ai/nf-toast-demo": "^5.0.0",
64
- "@94ai/nf-transfer-select": "^5.0.0",
65
- "@94ai/nf-variable-select": "^5.0.0",
66
- "@94ai/nf-virtual-select": "^5.0.0",
19
+ "@94ai/common-utils": "^5.0.1",
20
+ "@94ai/nf-action": "^5.0.1",
21
+ "@94ai/nf-address-select": "^5.0.1",
22
+ "@94ai/nf-alert": "^5.0.1",
23
+ "@94ai/nf-audio": "^5.0.1",
24
+ "@94ai/nf-button": "^5.0.1",
25
+ "@94ai/nf-button-demo": "^5.0.1",
26
+ "@94ai/nf-conditions": "^5.0.1",
27
+ "@94ai/nf-confirm": "^5.0.1",
28
+ "@94ai/nf-date-picker": "^5.0.1",
29
+ "@94ai/nf-double-half-year": "^5.0.1",
30
+ "@94ai/nf-double-quarter": "^5.0.1",
31
+ "@94ai/nf-double-time": "^5.0.1",
32
+ "@94ai/nf-double-week": "^5.0.1",
33
+ "@94ai/nf-double-year": "^5.0.1",
34
+ "@94ai/nf-drawer": "^5.0.1",
35
+ "@94ai/nf-empty": "^5.0.1",
36
+ "@94ai/nf-form": "^5.0.1",
37
+ "@94ai/nf-form-item": "^5.0.1",
38
+ "@94ai/nf-half-year-picker": "^5.0.1",
39
+ "@94ai/nf-iconfont-icon": "^5.0.1",
40
+ "@94ai/nf-import-template": "^5.0.1",
41
+ "@94ai/nf-indicator-plane": "^5.0.1",
42
+ "@94ai/nf-infinite-menu": "^5.0.1",
43
+ "@94ai/nf-input": "^5.0.1",
44
+ "@94ai/nf-keywords": "^5.0.1",
45
+ "@94ai/nf-lazy-select": "^5.0.1",
46
+ "@94ai/nf-menu": "^5.0.1",
47
+ "@94ai/nf-message": "^5.0.1",
48
+ "@94ai/nf-microphone": "^5.0.1",
49
+ "@94ai/nf-notification": "^5.0.1",
50
+ "@94ai/nf-popup-lazy-select": "^5.0.1",
51
+ "@94ai/nf-quarter-picker": "^5.0.1",
52
+ "@94ai/nf-radio-group": "^5.0.1",
53
+ "@94ai/nf-resizable-panels": "^5.0.1",
54
+ "@94ai/nf-rules": "^5.0.1",
55
+ "@94ai/nf-search-form": "^5.0.1",
56
+ "@94ai/nf-softphone": "^5.0.1",
57
+ "@94ai/nf-svg-icon": "^5.0.1",
58
+ "@94ai/nf-table": "^5.0.1",
59
+ "@94ai/nf-tag": "^5.0.1",
60
+ "@94ai/nf-text-overflow": "^5.0.1",
61
+ "@94ai/nf-theme-chalk": "^5.0.1",
62
+ "@94ai/nf-timezone-picker": "^5.0.1",
63
+ "@94ai/nf-toast-demo": "^5.0.1",
64
+ "@94ai/nf-transfer-select": "^5.0.1",
65
+ "@94ai/nf-variable-select": "^5.0.1",
66
+ "@94ai/nf-virtual-select": "^5.0.1",
67
67
  "lodash-es": "^4.17.21",
68
68
  "vue-demi": "^0.14.5"
69
69
  },
@@ -97,5 +97,5 @@
97
97
  "import": "./lib/common-ui.tool.esm-bundler.mjs"
98
98
  }
99
99
  },
100
- "gitHead": "64725f65bf563ac6ede581b82024cde6408fbaa3"
100
+ "gitHead": "6ce64e4667a262706f4577c008871a42b69edef4"
101
101
  }