@indfnd/utils 0.1.9 → 0.1.11

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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.11](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.10...v0.1.11) (2024-06-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **number:** 修改保留小数位数消除了两位数据的问题 ([52c6e5a](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/52c6e5a641314e274c5e6f99832f3a284f33ac7a))
11
+
12
+ ### [0.1.10](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.9...v0.1.10) (2024-05-27)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * 更新依赖 ([283e6b2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/283e6b21cfda4dfc252f80b26482a811a92f3de7))
18
+ * **enum:** 表格enum处理支持多行表头 ([d3256e6](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/d3256e688d3702a5435777d6bdf748159a30bdbb))
19
+ * **half-year:** 半年公共方法支持全年 ([6cab2e7](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6cab2e7a00cd08c791fb585dcd2062be39f080c1))
20
+ * **table:** row2column有的人不维护key ([14b6968](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/14b696814d8053d0662e410b9a00e7c53e5d824f))
21
+
5
22
  ### [0.1.9](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.8...v0.1.9) (2024-04-30)
6
23
 
7
24
 
@@ -9814,6 +9814,9 @@ function renderColumnEnums(columns = [], enumRelation = {}) {
9814
9814
  column.cellRendererParams.datas = enums;
9815
9815
  }
9816
9816
  }
9817
+ if (column.children && column.children.length) {
9818
+ column.children = renderColumnEnums(column.children, enumRelation);
9819
+ }
9817
9820
  });
9818
9821
  return rlt;
9819
9822
  }
@@ -10347,12 +10350,15 @@ function preventDefault(event, isStopPropagation) {
10347
10350
  }
10348
10351
  }
10349
10352
  function getHalfYear(date) {
10350
- if (!date || date.length < 6) {
10353
+ if (!date || date.length < 4) {
10351
10354
  return "";
10352
10355
  }
10353
10356
  const year = date.substring(0, 4);
10354
10357
  const month = date.substring(4, 6);
10355
10358
  const halfYear = getHalfYearNum(parseInt(month));
10359
+ if (!month) {
10360
+ return `${year}`;
10361
+ }
10356
10362
  return `${year}H${halfYear}`;
10357
10363
  }
10358
10364
  function getHalfYearNum(month) {
@@ -10364,29 +10370,41 @@ function getHalfYearNum(month) {
10364
10370
  return month <= 6 ? 1 : 2;
10365
10371
  }
10366
10372
  function formatHalfYear(halfYear) {
10367
- if (!halfYear || halfYear.length < 6) {
10373
+ if (!halfYear || halfYear.length < 4) {
10368
10374
  return halfYear;
10369
10375
  }
10370
10376
  const year = halfYear.substring(0, 4);
10377
+ const month = halfYear.substring(4, 6);
10378
+ if (!month) {
10379
+ return `${year}\u5168\u5E74`;
10380
+ }
10371
10381
  const halfYearNum = parseInt(halfYear.substring(5));
10372
10382
  const halfStr = halfYearNum === 1 ? "\u4E0A\u534A\u5E74" : "\u4E0B\u534A\u5E74";
10373
10383
  return `${year}${halfStr}`;
10374
10384
  }
10375
10385
  function getHalfYearBeginMonth(halfYear) {
10376
- if (!halfYear || halfYear.length < 6) {
10386
+ if (!halfYear || halfYear.length < 4) {
10377
10387
  return halfYear;
10378
10388
  }
10379
10389
  const year = halfYear.substring(0, 4);
10390
+ const month = halfYear.substring(4, 6);
10391
+ if (!month) {
10392
+ return `${year}01`;
10393
+ }
10380
10394
  const halfYearNum = parseInt(halfYear.substring(5));
10381
10395
  const beginMonth = halfYearNum * 6 - 5;
10382
10396
  const monthStr = beginMonth < 10 ? `0${beginMonth}` : `${beginMonth}`;
10383
10397
  return `${year}${monthStr}`;
10384
10398
  }
10385
10399
  function getHalfYearEndMonth(halfYear) {
10386
- if (!halfYear || halfYear.length < 6) {
10400
+ if (!halfYear || halfYear.length < 4) {
10387
10401
  return halfYear;
10388
10402
  }
10389
10403
  const year = halfYear.substring(0, 4);
10404
+ const month = halfYear.substring(4, 6);
10405
+ if (!month) {
10406
+ return `${year}12`;
10407
+ }
10390
10408
  const halfYearNum = parseInt(halfYear.substring(5));
10391
10409
  const endMonth = halfYearNum * 2;
10392
10410
  const monthStr = endMonth < 10 ? `0${endMonth}` : `${endMonth}`;
@@ -10521,9 +10539,9 @@ function round(number, precision = 2) {
10521
10539
  if (result.length > 2) {
10522
10540
  const num = result[1];
10523
10541
  const e = result[2];
10524
- return Math.round(parseInt(+num + "e" + (+e + precision))) / Math.pow(10, precision);
10542
+ return Math.round(parseFloat(+num + "e" + (+e + precision))) / Math.pow(10, precision);
10525
10543
  }
10526
- return Math.round(parseInt(+number + "e" + precision)) / Math.pow(10, precision);
10544
+ return Math.round(parseFloat(+number + "e" + precision)) / Math.pow(10, precision);
10527
10545
  }
10528
10546
  return number;
10529
10547
  }
@@ -10709,7 +10727,7 @@ function renderColumnTree(data, columnGroup, option = {}) {
10709
10727
  title
10710
10728
  });
10711
10729
  if (children && children.length) {
10712
- const prefix = `${keyPrefix}${key}`;
10730
+ const prefix = `${keyPrefix}${key || ""}`;
10713
10731
  const columnChildren = children.map((child) => {
10714
10732
  return renderColumnTree(data, child, __spreadProps(__spreadValues({}, option), { keyPrefix: prefix }));
10715
10733
  });
@@ -10720,7 +10738,7 @@ function renderColumnTree(data, columnGroup, option = {}) {
10720
10738
  });
10721
10739
  }
10722
10740
  return __spreadProps(__spreadValues({}, args), {
10723
- [keyPropName]: `${keyPrefix}${key}`,
10741
+ [keyPropName]: `${keyPrefix}${key || ""}`,
10724
10742
  [titlePropName]: title,
10725
10743
  headerTooltip: headerTooltipText
10726
10744
  });