atr-components 0.2.301 → 0.2.303
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/core/utils/ToolsUtil.d.ts +28 -0
- package/esm2020/core/utils/ToolsUtil.mjs +59 -1
- package/esm2020/lib/shared/form/form.component.mjs +4 -1
- package/esm2020/lib/shared/table/table-td/table-td.component.mjs +7 -16
- package/fesm2015/atr-components.mjs +66 -15
- package/fesm2015/atr-components.mjs.map +1 -1
- package/fesm2020/atr-components.mjs +66 -15
- package/fesm2020/atr-components.mjs.map +1 -1
- package/lib/shared/form/form.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -610,6 +610,24 @@ class ToolsUtil {
|
|
|
610
610
|
static allEmpty(...arr) {
|
|
611
611
|
return arr.every(item => !item);
|
|
612
612
|
}
|
|
613
|
+
static isEmpty(obj) {
|
|
614
|
+
if (obj === undefined) {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
if (obj === null) {
|
|
618
|
+
return true;
|
|
619
|
+
}
|
|
620
|
+
if (typeof obj == 'boolean') {
|
|
621
|
+
return false;
|
|
622
|
+
}
|
|
623
|
+
if (obj === 0) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
if (obj.trim() === '') {
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
613
631
|
static encodeValue(params) {
|
|
614
632
|
Object.keys(params).forEach(key => params[key] = encodeURIComponent(params[key]));
|
|
615
633
|
return params;
|
|
@@ -623,6 +641,46 @@ class ToolsUtil {
|
|
|
623
641
|
static modaleStyle() {
|
|
624
642
|
return { 'maxHeight': ToolsUtil.windowHeight() - 200 + 'px', 'overflow-y': 'auto' };
|
|
625
643
|
}
|
|
644
|
+
static getLength(pointA, pointB) {
|
|
645
|
+
var lengthAB = Math.sqrt(Math.pow(pointA.x1 - pointB.x1, 2) +
|
|
646
|
+
Math.pow(pointA.y1 - pointB.y1, 2));
|
|
647
|
+
return lengthAB;
|
|
648
|
+
}
|
|
649
|
+
static getRotateNum(pointB, pointC, pointA) {
|
|
650
|
+
//ABC中心点,起始点,终点
|
|
651
|
+
let AB = {};
|
|
652
|
+
let AC = {};
|
|
653
|
+
AB.x1 = pointB.x1 - pointA.x1;
|
|
654
|
+
AB.y1 = pointB.y1 - pointA.y1;
|
|
655
|
+
AC.x1 = pointC.x1 - pointA.x1;
|
|
656
|
+
AC.y1 = pointC.y1 - pointA.y1;
|
|
657
|
+
var direct = AB.x1 * AC.y1 - AB.y1 * AC.y1;
|
|
658
|
+
var lengthAB = this.getLength(pointB, pointA);
|
|
659
|
+
var lengthAC = this.getLength(pointC, pointA);
|
|
660
|
+
var lengthBC = this.getLength(pointB, pointC);
|
|
661
|
+
var cosA = (Math.pow(lengthAB, 2) + Math.pow(lengthAC, 2) -
|
|
662
|
+
Math.pow(lengthBC, 2)) / (2 * lengthAB * lengthAC);
|
|
663
|
+
var angleA = Math.round(Math.acos(cosA) * 180 / Math.PI);
|
|
664
|
+
if (direct < 0) {
|
|
665
|
+
return -angleA;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
return angleA;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
//绕center点旋转rotate角度
|
|
672
|
+
static getRotatePoint(p, center, rotate) {
|
|
673
|
+
let startX = p.x1;
|
|
674
|
+
let startY = p.y1;
|
|
675
|
+
let a = center.x1;
|
|
676
|
+
let b = center.y1;
|
|
677
|
+
let x1 = a - Math.cos(rotate * Math.PI / 180) * (a - startX) + Math.sin(rotate * Math.PI / 180) * (b - startY);
|
|
678
|
+
let y1 = b - Math.cos(rotate * Math.PI / 180) * (b - startY) - Math.sin(rotate * Math.PI / 180) * (a - startX);
|
|
679
|
+
return {
|
|
680
|
+
x1: x1,
|
|
681
|
+
y1: y1
|
|
682
|
+
};
|
|
683
|
+
}
|
|
626
684
|
}
|
|
627
685
|
ToolsUtil.getOrgCode = function () {
|
|
628
686
|
// var orgCode = '';
|
|
@@ -2570,15 +2628,11 @@ class TableTdComponent {
|
|
|
2570
2628
|
let isShow = false;
|
|
2571
2629
|
if (op.length > 1) {
|
|
2572
2630
|
let value = data[op[0]];
|
|
2573
|
-
|
|
2574
|
-
isShow = false;
|
|
2575
|
-
}
|
|
2576
|
-
else {
|
|
2577
|
-
isShow = this.compare(value, op[1], op[2]);
|
|
2578
|
-
}
|
|
2631
|
+
isShow = this.compare(value, op[1], op[2]);
|
|
2579
2632
|
}
|
|
2580
|
-
else
|
|
2633
|
+
else {
|
|
2581
2634
|
isShow = false;
|
|
2635
|
+
}
|
|
2582
2636
|
return isShow;
|
|
2583
2637
|
}
|
|
2584
2638
|
compare(value, operator, target) {
|
|
@@ -2600,16 +2654,10 @@ class TableTdComponent {
|
|
|
2600
2654
|
}
|
|
2601
2655
|
break;
|
|
2602
2656
|
case 'notEmpty':
|
|
2603
|
-
isRight =
|
|
2604
|
-
if (value) {
|
|
2605
|
-
isRight = true;
|
|
2606
|
-
}
|
|
2657
|
+
isRight = !ToolsUtil.isEmpty(value);
|
|
2607
2658
|
break;
|
|
2608
2659
|
case 'empty':
|
|
2609
|
-
isRight =
|
|
2610
|
-
if (!!value) {
|
|
2611
|
-
isRight = false;
|
|
2612
|
-
}
|
|
2660
|
+
isRight = ToolsUtil.isEmpty(value);
|
|
2613
2661
|
break;
|
|
2614
2662
|
default:
|
|
2615
2663
|
isRight = false;
|
|
@@ -4678,6 +4726,9 @@ class AtrFormComponent {
|
|
|
4678
4726
|
return obj;
|
|
4679
4727
|
}
|
|
4680
4728
|
showTime(item) {
|
|
4729
|
+
if (item.nzShowTime) {
|
|
4730
|
+
return item.nzShowTime;
|
|
4731
|
+
}
|
|
4681
4732
|
if (!item.dateFormat || item.dateFormat == "yyyy-MM-dd") {
|
|
4682
4733
|
return false;
|
|
4683
4734
|
}
|