iv-npm 1.6.71 → 1.6.74

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 (26) hide show
  1. package/package.json +1 -1
  2. package/packages/shared/dist/utils/index.d.ts +29 -1
  3. package/packages/shared/dist/utils/index.mjs +52 -0
  4. package/packages/shared/package.json +32 -32
  5. package/packages/ui/dist/index.cjs.js +1 -1
  6. package/packages/ui/dist/index.cjs.js.map +1 -1
  7. package/packages/ui/dist/index.esm.js +1 -1
  8. package/packages/ui/dist/index.esm.js.map +1 -1
  9. package/packages/ui/dist/index.umd.js +1 -1
  10. package/packages/ui/dist/index.umd.js.map +1 -1
  11. package/packages/ui/package.json +76 -76
  12. package/packages/ui/dist/business-ui/component/IVMrpLineDropdown.d.ts +0 -155
  13. package/packages/ui/dist/business-ui/component/IVMrpManagDropdown.d.ts +0 -141
  14. package/packages/ui/dist/business-ui/component/IVMrpMaterialSelector.d.ts +0 -20
  15. package/packages/ui/dist/business-ui/component/IVMrpMaterialTypeDropdown.d.ts +0 -158
  16. package/packages/ui/dist/business-ui/component/IVMrpOrgDropdown.d.ts +0 -152
  17. package/packages/ui/dist/business-ui/component/IVMrpPostDropdown.d.ts +0 -148
  18. package/packages/ui/dist/business-ui/component/IVMrpProdBaseDropdown.d.ts +0 -154
  19. package/packages/ui/dist/business-ui/component/IVMrpRateDropdown.d.ts +0 -46
  20. package/packages/ui/dist/business-ui/component/IVMrpSetofbookDropdown.d.ts +0 -158
  21. package/packages/ui/dist/business-ui/component/IVMrpUnitDropdown.d.ts +0 -64
  22. package/packages/ui/dist/business-ui/component/IVMrpUserSelector.d.ts +0 -20
  23. package/packages/ui/dist/business-ui/component/IVMrpVendorSelector.d.ts +0 -20
  24. package/packages/ui/dist/function-ui/component/IVMrpModal.d.ts +0 -41
  25. package/packages/ui/dist/function-ui/component/IVMrpTable.d.ts +0 -79
  26. package/packages/ui/dist/function-ui/component/IVMrpTableControl.d.ts +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iv-npm",
3
- "version": "1.6.71",
3
+ "version": "1.6.74",
4
4
  "description": "公共通用包",
5
5
  "author": "Mr.Cong",
6
6
  "license": "ISC",
@@ -1,4 +1,5 @@
1
1
  export { TreeList } from '../types/index.js';
2
+ export { divide, minus, plus, round, strip, times } from 'number-precision';
2
3
 
3
4
  declare function arrToTree(list: any[], parentMark: string, childrenMark: string): any;
4
5
  interface TreeList {
@@ -18,6 +19,33 @@ declare function findTree<T extends {
18
19
  children?: T[];
19
20
  }>(id: string, list: T[], idName?: any): any;
20
21
 
22
+ /**
23
+ * @description 计算两个数字的百分百比
24
+ * @param {Number} complete 分子
25
+ * @param {Number} need 分母
26
+ * @return {Number} complete / need
27
+ */
28
+ declare const formatPercentage: (complete: number, need: number) => number;
29
+ /**
30
+ * @description 计算数组之和
31
+ * @param {Number[]} number[]
32
+ * @return {Number}
33
+ */
34
+ declare const arraySum: (arr: number[]) => number;
35
+ /**
36
+ * @description 计算数组某个字段之和
37
+ * @param {object[]} object[]
38
+ * @return {Number}
39
+ */
40
+ declare const arraySumByKey: (arr: any[], key: string) => any;
41
+ /**
42
+ * @description 对比两个数组某个字段之和是否相同
43
+ * @param {object[]} object1[]
44
+ * @param {object[]} object2[]
45
+ * @return {Number}
46
+ */
47
+ declare const isArraySumCompared: (arr1: any[], arr2: any[], key1: string, key2?: string) => boolean;
48
+
21
49
  /**
22
50
  * 检查对象是否为普通对象(使用“{}”或“new Object”创建)
23
51
  * */
@@ -100,4 +128,4 @@ declare function getAmountByUnit(amount: number): string;
100
128
  * */
101
129
  declare const amountToFixed: (_v?: number | string) => string | 0;
102
130
 
103
- export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatType, getAmountByUnit, hostConfiger, isDate, isObject, isPlainObject, isURLSearchParams, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
131
+ export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, arraySum, arraySumByKey, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatPercentage, formatType, getAmountByUnit, hostConfiger, isArraySumCompared, isDate, isObject, isPlainObject, isURLSearchParams, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
@@ -45,6 +45,48 @@ function findTree(id, list, idName) {
45
45
  return result;
46
46
  }
47
47
 
48
+ // utils/arr/digitalComp.ts
49
+ import { strip, plus, minus, times, divide, round } from "number-precision";
50
+ var isKeyInObject = (object, key) => {
51
+ return Object.prototype.hasOwnProperty.call(object, key);
52
+ };
53
+ var formatPercentage = (complete, need) => {
54
+ if (!need || !complete)
55
+ return 0;
56
+ const result = times(divide(complete / need), 100);
57
+ return Number.isNaN(result) ? 0 : result;
58
+ };
59
+ var arraySum = (arr) => {
60
+ const len = arr.length;
61
+ if (len === 0)
62
+ return 0;
63
+ if (len === 1)
64
+ return arr[0];
65
+ return plus(...arr);
66
+ };
67
+ var arraySumByKey = (arr, key) => {
68
+ const len = arr.length;
69
+ if (len === 0)
70
+ return 0;
71
+ if (len === 1) {
72
+ if (!isKeyInObject(arr[0], key))
73
+ throw new Error(`could not find it '${key}' in arraySumByKey function`);
74
+ return arr[0][key] ?? 0;
75
+ }
76
+ const tempArr = [];
77
+ arr.forEach((_e) => {
78
+ if (!isKeyInObject(_e, key))
79
+ throw new Error(`could not find it '${key}' in arraySumByKey function`);
80
+ tempArr.push(_e[key] ?? 0);
81
+ });
82
+ return arraySum(tempArr);
83
+ };
84
+ var isArraySumCompared = (arr1, arr2, key1, key2) => {
85
+ const k1 = key1;
86
+ const k2 = key2 ?? key1;
87
+ return arraySumByKey(arr1, k1) === arraySumByKey(arr2, k2);
88
+ };
89
+
48
90
  // utils/obj/judge.ts
49
91
  function isPlainObject(obj) {
50
92
  let proto, Ctor;
@@ -413,18 +455,28 @@ export {
413
455
  amountToFixed,
414
456
  apiConfiger,
415
457
  arrToTree,
458
+ arraySum,
459
+ arraySumByKey,
416
460
  assign,
417
461
  buildURL as buildUrl,
418
462
  dateFormat,
463
+ divide,
419
464
  filterOptionHeadle,
420
465
  findTree,
466
+ formatPercentage,
421
467
  getAmountByUnit,
422
468
  hostConfiger,
469
+ isArraySumCompared,
423
470
  isDate,
424
471
  isObject,
425
472
  isPlainObject,
426
473
  isURLSearchParams,
474
+ minus,
427
475
  onChangeTail,
476
+ plus,
477
+ round,
478
+ strip,
479
+ times,
428
480
  tranListToTreeData,
429
481
  yearMonthDayFormat,
430
482
  yearMonthFormat
@@ -1,32 +1,32 @@
1
- {
2
- "name": "@IVNPM/shared",
3
- "version": "1.0.0",
4
- "private": false,
5
- "description": "IVNPM/shared",
6
- "scripts": {
7
- "prepare": "npm run build",
8
- "dev": "tsup --watch",
9
- "build": "tsup"
10
- },
11
- "main": "dist/utils/index.mjs",
12
- "module": "dist/utils/index.mjs",
13
- "types": "dist/utils/index.d.ts",
14
- "files": [
15
- "index.js",
16
- "dist"
17
- ],
18
- "author": "Mr.Cong",
19
- "license": "ISC",
20
- "devDependencies": {
21
- "@types/node": "^18.6.4",
22
- "rollup-plugin-copy": "^3.4.0",
23
- "tsup": "^6.2.1"
24
- },
25
- "peerDependencies": {
26
- "ant-design-vue": "^3.2.5"
27
- },
28
- "dependencies": {
29
- "nanoid": "^4.0.0",
30
- "number-precision": "^1.6.0"
31
- }
32
- }
1
+ {
2
+ "name": "@IVNPM/shared",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "IVNPM/shared",
6
+ "scripts": {
7
+ "prepare": "npm run build",
8
+ "dev": "tsup --watch",
9
+ "build": "tsup"
10
+ },
11
+ "main": "dist/utils/index.mjs",
12
+ "module": "dist/utils/index.mjs",
13
+ "types": "dist/utils/index.d.ts",
14
+ "files": [
15
+ "index.js",
16
+ "dist"
17
+ ],
18
+ "author": "Mr.Cong",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@types/node": "^18.6.4",
22
+ "rollup-plugin-copy": "^3.4.0",
23
+ "tsup": "^6.2.1"
24
+ },
25
+ "peerDependencies": {
26
+ "ant-design-vue": "^3.2.5"
27
+ },
28
+ "dependencies": {
29
+ "nanoid": "^4.0.0",
30
+ "number-precision": "^1.6.0"
31
+ }
32
+ }