@fileverse-dev/fortune-core 1.1.1 → 1.1.3
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/es/locale/en.d.ts +6 -0
- package/es/locale/en.js +7 -1
- package/es/modules/ConditionFormat.js +107 -16
- package/lib/locale/en.d.ts +6 -0
- package/lib/locale/en.js +7 -1
- package/lib/modules/ConditionFormat.js +107 -16
- package/package.json +1 -1
package/es/locale/en.d.ts
CHANGED
|
@@ -517,8 +517,12 @@ declare const _default: {
|
|
|
517
517
|
conditionformat: {
|
|
518
518
|
conditionformat_greaterThan: string;
|
|
519
519
|
conditionformat_greaterThan_title: string;
|
|
520
|
+
conditionformat_greaterThanOrEqual: string;
|
|
521
|
+
conditionformat_greaterThanOrEqual_title: string;
|
|
520
522
|
conditionformat_lessThan: string;
|
|
521
523
|
conditionformat_lessThan_title: string;
|
|
524
|
+
conditionformat_lessThanOrEqual: string;
|
|
525
|
+
conditionformat_lessThanOrEqual_title: string;
|
|
522
526
|
conditionformat_between: string;
|
|
523
527
|
conditionformat_between_title: string;
|
|
524
528
|
conditionformat_equal: string;
|
|
@@ -619,7 +623,9 @@ declare const _default: {
|
|
|
619
623
|
specificText: string;
|
|
620
624
|
occurrenceDate: string;
|
|
621
625
|
greaterThan: string;
|
|
626
|
+
greaterThanOrEqual: string;
|
|
622
627
|
lessThan: string;
|
|
628
|
+
lessThanOrEqual: string;
|
|
623
629
|
between: string;
|
|
624
630
|
equal: string;
|
|
625
631
|
in: string;
|
package/es/locale/en.js
CHANGED
|
@@ -9272,7 +9272,7 @@ export default {
|
|
|
9272
9272
|
value: "split",
|
|
9273
9273
|
example: ""
|
|
9274
9274
|
}, {
|
|
9275
|
-
text: "
|
|
9275
|
+
text: "Currency",
|
|
9276
9276
|
value: "fmtOtherSelf",
|
|
9277
9277
|
example: "",
|
|
9278
9278
|
icon: "rightArrow"
|
|
@@ -9659,8 +9659,12 @@ export default {
|
|
|
9659
9659
|
conditionformat: {
|
|
9660
9660
|
conditionformat_greaterThan: "Conditional format - Greater than",
|
|
9661
9661
|
conditionformat_greaterThan_title: "Format cells greater than",
|
|
9662
|
+
conditionformat_greaterThanOrEqual: "Conditional format - Greater than or equal",
|
|
9663
|
+
conditionformat_greaterThanOrEqual_title: "Format cells greater than or equal",
|
|
9662
9664
|
conditionformat_lessThan: "Conditional format - Less than",
|
|
9663
9665
|
conditionformat_lessThan_title: "Format cells smaller than",
|
|
9666
|
+
conditionformat_lessThanOrEqual: "Conditional format - Less than or equal",
|
|
9667
|
+
conditionformat_lessThanOrEqual_title: "Format cells less than or equal",
|
|
9664
9668
|
conditionformat_between: "Conditional format - Betweenness",
|
|
9665
9669
|
conditionformat_between_title: "Format cells with values between",
|
|
9666
9670
|
conditionformat_equal: "Conditional format - Equal",
|
|
@@ -9761,7 +9765,9 @@ export default {
|
|
|
9761
9765
|
specificText: "Specific text",
|
|
9762
9766
|
occurrenceDate: "Date",
|
|
9763
9767
|
greaterThan: "Greater than",
|
|
9768
|
+
greaterThanOrEqual: "Greater than or equal",
|
|
9764
9769
|
lessThan: "Less than",
|
|
9770
|
+
lessThanOrEqual: "Less than or equal",
|
|
9765
9771
|
between: "Between",
|
|
9766
9772
|
equal: "Equal",
|
|
9767
9773
|
in: "In",
|
|
@@ -16,6 +16,86 @@ import { genarate } from "./format";
|
|
|
16
16
|
import { execfunction, functionCopy } from "./formula";
|
|
17
17
|
import { checkProtectionFormatCells } from "./protection";
|
|
18
18
|
import { isRealNull } from "./validation";
|
|
19
|
+
function hasAlphabeticChars(value) {
|
|
20
|
+
return /[a-zA-Z]/.test(String(value));
|
|
21
|
+
}
|
|
22
|
+
function compareGreaterThan(cellValue, conditionValue, symbol) {
|
|
23
|
+
var cellStr = String(cellValue);
|
|
24
|
+
var conditionStr = String(conditionValue);
|
|
25
|
+
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
26
|
+
if (symbol === '>=') {
|
|
27
|
+
return cellStr.localeCompare(conditionStr) >= 0;
|
|
28
|
+
}
|
|
29
|
+
return cellStr.localeCompare(conditionStr) > 0;
|
|
30
|
+
}
|
|
31
|
+
var cellNum = Number(cellValue);
|
|
32
|
+
var conditionNum = Number(conditionValue);
|
|
33
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '>=') {
|
|
34
|
+
return cellNum >= conditionNum;
|
|
35
|
+
}
|
|
36
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '>') {
|
|
37
|
+
return cellNum > conditionNum;
|
|
38
|
+
}
|
|
39
|
+
if (symbol === '>=') {
|
|
40
|
+
return cellStr.localeCompare(conditionStr) >= 0;
|
|
41
|
+
}
|
|
42
|
+
return cellStr.localeCompare(conditionStr) > 0;
|
|
43
|
+
}
|
|
44
|
+
function compareLessThan(cellValue, conditionValue, symbol) {
|
|
45
|
+
var cellStr = String(cellValue);
|
|
46
|
+
var conditionStr = String(conditionValue);
|
|
47
|
+
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
48
|
+
if (symbol === '<=') {
|
|
49
|
+
return cellStr.localeCompare(conditionStr) <= 0;
|
|
50
|
+
}
|
|
51
|
+
return cellStr.localeCompare(conditionStr) < 0;
|
|
52
|
+
}
|
|
53
|
+
var cellNum = Number(cellValue);
|
|
54
|
+
var conditionNum = Number(conditionValue);
|
|
55
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '<=') {
|
|
56
|
+
return cellNum <= conditionNum;
|
|
57
|
+
}
|
|
58
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum)) {
|
|
59
|
+
return cellNum < conditionNum;
|
|
60
|
+
}
|
|
61
|
+
if (symbol === '<=') {
|
|
62
|
+
return cellStr.localeCompare(conditionStr) <= 0;
|
|
63
|
+
}
|
|
64
|
+
return cellStr.localeCompare(conditionStr) < 0;
|
|
65
|
+
}
|
|
66
|
+
function compareBetween(cellValue, value1, value2) {
|
|
67
|
+
var cellStr = String(cellValue);
|
|
68
|
+
var val1Str = String(value1);
|
|
69
|
+
var val2Str = String(value2);
|
|
70
|
+
var smallerValue, biggerValue;
|
|
71
|
+
if (hasAlphabeticChars(value1) || hasAlphabeticChars(value2) || hasAlphabeticChars(cellValue)) {
|
|
72
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
73
|
+
biggerValue = val1Str;
|
|
74
|
+
smallerValue = val2Str;
|
|
75
|
+
} else {
|
|
76
|
+
biggerValue = val2Str;
|
|
77
|
+
smallerValue = val1Str;
|
|
78
|
+
}
|
|
79
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
80
|
+
} else {
|
|
81
|
+
var cellNum = Number(cellValue);
|
|
82
|
+
var val1Num = Number(value1);
|
|
83
|
+
var val2Num = Number(value2);
|
|
84
|
+
if (!isNaN(cellNum) && !isNaN(val1Num) && !isNaN(val2Num)) {
|
|
85
|
+
var smallerNum = Math.min(val1Num, val2Num);
|
|
86
|
+
var biggerNum = Math.max(val1Num, val2Num);
|
|
87
|
+
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
88
|
+
}
|
|
89
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
90
|
+
biggerValue = val1Str;
|
|
91
|
+
smallerValue = val2Str;
|
|
92
|
+
} else {
|
|
93
|
+
biggerValue = val2Str;
|
|
94
|
+
smallerValue = val1Str;
|
|
95
|
+
}
|
|
96
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
19
99
|
export function getHistoryRules(fileH) {
|
|
20
100
|
var historyRules = [];
|
|
21
101
|
for (var h = 0; h < fileH.length; h += 1) {
|
|
@@ -44,7 +124,7 @@ export function setConditionRules(ctx, protection, generalDialog, conditionforma
|
|
|
44
124
|
var conditionName = rules.rulesType;
|
|
45
125
|
var conditionRange = [];
|
|
46
126
|
var conditionValue = [];
|
|
47
|
-
if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
|
|
127
|
+
if (conditionName === "greaterThan" || conditionName === "greaterThanOrEqual" || conditionName === "lessThan" || conditionName === "lessThanOrEqual" || conditionName === "equal" || conditionName === "textContains") {
|
|
48
128
|
var v = rules.rulesValue;
|
|
49
129
|
var rangeArr = getRangeByTxt(ctx, v);
|
|
50
130
|
if (rangeArr.length > 1) {
|
|
@@ -468,7 +548,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
468
548
|
var textColor_1 = format.textColor,
|
|
469
549
|
cellColor_1 = format.cellColor;
|
|
470
550
|
for (var s = 0; s < cellrange.length; s += 1) {
|
|
471
|
-
if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
|
|
551
|
+
if (conditionName === "greaterThan" || conditionName === "greaterThanOrEqual" || conditionName === "lessThan" || conditionName === "lessThanOrEqual" || conditionName === "equal" || conditionName === "textContains") {
|
|
472
552
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
473
553
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
474
554
|
if (_.isNil(d[r]) || _.isNil(d[r][c])) {
|
|
@@ -478,7 +558,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
478
558
|
if (_.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v)) {
|
|
479
559
|
continue;
|
|
480
560
|
}
|
|
481
|
-
if (conditionName === "greaterThan" &&
|
|
561
|
+
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0, '>')) {
|
|
482
562
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
483
563
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
484
564
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -488,7 +568,27 @@ export function compute(ctx, ruleArr, d) {
|
|
|
488
568
|
cellColor: cellColor_1
|
|
489
569
|
};
|
|
490
570
|
}
|
|
491
|
-
} else if (conditionName === "
|
|
571
|
+
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0, '>=')) {
|
|
572
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
573
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
574
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
575
|
+
} else {
|
|
576
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
577
|
+
textColor: textColor_1,
|
|
578
|
+
cellColor: cellColor_1
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
} else if (conditionName === "lessThan" && compareLessThan(cell.v, conditionValue0, "<")) {
|
|
582
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
583
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
584
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
585
|
+
} else {
|
|
586
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
587
|
+
textColor: textColor_1,
|
|
588
|
+
cellColor: cellColor_1
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0, '<=')) {
|
|
492
592
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
493
593
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
494
594
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -522,15 +622,6 @@ export function compute(ctx, ruleArr, d) {
|
|
|
522
622
|
}
|
|
523
623
|
}
|
|
524
624
|
} else if (conditionName === "between") {
|
|
525
|
-
var vBig = 0;
|
|
526
|
-
var vSmall = 0;
|
|
527
|
-
if (conditionValue0 > conditionValue1) {
|
|
528
|
-
vBig = conditionValue0;
|
|
529
|
-
vSmall = conditionValue1;
|
|
530
|
-
} else {
|
|
531
|
-
vBig = conditionValue1;
|
|
532
|
-
vSmall = conditionValue0;
|
|
533
|
-
}
|
|
534
625
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
535
626
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
536
627
|
if (_.isNil(d[r]) || _.isNil(d[r][c])) {
|
|
@@ -540,7 +631,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
540
631
|
if (_.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v)) {
|
|
541
632
|
continue;
|
|
542
633
|
}
|
|
543
|
-
if (
|
|
634
|
+
if (compareBetween(cell.v, conditionValue0, conditionValue1)) {
|
|
544
635
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
545
636
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
546
637
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -1004,7 +1095,7 @@ export function CFSplitRange(range1, range2, range3, type) {
|
|
|
1004
1095
|
row: [range2.row[1] + 1, r2],
|
|
1005
1096
|
column: [c1, c2]
|
|
1006
1097
|
}, {
|
|
1007
|
-
row: [
|
|
1098
|
+
row: [range2.row[0] + offset_r, r2 + offset_r],
|
|
1008
1099
|
column: [range2.column[0] + offset_c, c2 + offset_c]
|
|
1009
1100
|
}];
|
|
1010
1101
|
} else if (type === "restPart") {
|
|
@@ -1017,7 +1108,7 @@ export function CFSplitRange(range1, range2, range3, type) {
|
|
|
1017
1108
|
}];
|
|
1018
1109
|
} else if (type === "operatePart") {
|
|
1019
1110
|
range = [{
|
|
1020
|
-
row: [
|
|
1111
|
+
row: [range2.row[0] + offset_r, r2 + offset_r],
|
|
1021
1112
|
column: [range2.column[0] + offset_c, c2 + offset_c]
|
|
1022
1113
|
}];
|
|
1023
1114
|
}
|
package/lib/locale/en.d.ts
CHANGED
|
@@ -517,8 +517,12 @@ declare const _default: {
|
|
|
517
517
|
conditionformat: {
|
|
518
518
|
conditionformat_greaterThan: string;
|
|
519
519
|
conditionformat_greaterThan_title: string;
|
|
520
|
+
conditionformat_greaterThanOrEqual: string;
|
|
521
|
+
conditionformat_greaterThanOrEqual_title: string;
|
|
520
522
|
conditionformat_lessThan: string;
|
|
521
523
|
conditionformat_lessThan_title: string;
|
|
524
|
+
conditionformat_lessThanOrEqual: string;
|
|
525
|
+
conditionformat_lessThanOrEqual_title: string;
|
|
522
526
|
conditionformat_between: string;
|
|
523
527
|
conditionformat_between_title: string;
|
|
524
528
|
conditionformat_equal: string;
|
|
@@ -619,7 +623,9 @@ declare const _default: {
|
|
|
619
623
|
specificText: string;
|
|
620
624
|
occurrenceDate: string;
|
|
621
625
|
greaterThan: string;
|
|
626
|
+
greaterThanOrEqual: string;
|
|
622
627
|
lessThan: string;
|
|
628
|
+
lessThanOrEqual: string;
|
|
623
629
|
between: string;
|
|
624
630
|
equal: string;
|
|
625
631
|
in: string;
|
package/lib/locale/en.js
CHANGED
|
@@ -9278,7 +9278,7 @@ var _default = exports.default = {
|
|
|
9278
9278
|
value: "split",
|
|
9279
9279
|
example: ""
|
|
9280
9280
|
}, {
|
|
9281
|
-
text: "
|
|
9281
|
+
text: "Currency",
|
|
9282
9282
|
value: "fmtOtherSelf",
|
|
9283
9283
|
example: "",
|
|
9284
9284
|
icon: "rightArrow"
|
|
@@ -9665,8 +9665,12 @@ var _default = exports.default = {
|
|
|
9665
9665
|
conditionformat: {
|
|
9666
9666
|
conditionformat_greaterThan: "Conditional format - Greater than",
|
|
9667
9667
|
conditionformat_greaterThan_title: "Format cells greater than",
|
|
9668
|
+
conditionformat_greaterThanOrEqual: "Conditional format - Greater than or equal",
|
|
9669
|
+
conditionformat_greaterThanOrEqual_title: "Format cells greater than or equal",
|
|
9668
9670
|
conditionformat_lessThan: "Conditional format - Less than",
|
|
9669
9671
|
conditionformat_lessThan_title: "Format cells smaller than",
|
|
9672
|
+
conditionformat_lessThanOrEqual: "Conditional format - Less than or equal",
|
|
9673
|
+
conditionformat_lessThanOrEqual_title: "Format cells less than or equal",
|
|
9670
9674
|
conditionformat_between: "Conditional format - Betweenness",
|
|
9671
9675
|
conditionformat_between_title: "Format cells with values between",
|
|
9672
9676
|
conditionformat_equal: "Conditional format - Equal",
|
|
@@ -9767,7 +9771,9 @@ var _default = exports.default = {
|
|
|
9767
9771
|
specificText: "Specific text",
|
|
9768
9772
|
occurrenceDate: "Date",
|
|
9769
9773
|
greaterThan: "Greater than",
|
|
9774
|
+
greaterThanOrEqual: "Greater than or equal",
|
|
9770
9775
|
lessThan: "Less than",
|
|
9776
|
+
lessThanOrEqual: "Less than or equal",
|
|
9771
9777
|
between: "Between",
|
|
9772
9778
|
equal: "Equal",
|
|
9773
9779
|
in: "In",
|
|
@@ -31,6 +31,86 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
31
31
|
};
|
|
32
32
|
return __assign.apply(this, arguments);
|
|
33
33
|
};
|
|
34
|
+
function hasAlphabeticChars(value) {
|
|
35
|
+
return /[a-zA-Z]/.test(String(value));
|
|
36
|
+
}
|
|
37
|
+
function compareGreaterThan(cellValue, conditionValue, symbol) {
|
|
38
|
+
var cellStr = String(cellValue);
|
|
39
|
+
var conditionStr = String(conditionValue);
|
|
40
|
+
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
41
|
+
if (symbol === '>=') {
|
|
42
|
+
return cellStr.localeCompare(conditionStr) >= 0;
|
|
43
|
+
}
|
|
44
|
+
return cellStr.localeCompare(conditionStr) > 0;
|
|
45
|
+
}
|
|
46
|
+
var cellNum = Number(cellValue);
|
|
47
|
+
var conditionNum = Number(conditionValue);
|
|
48
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '>=') {
|
|
49
|
+
return cellNum >= conditionNum;
|
|
50
|
+
}
|
|
51
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '>') {
|
|
52
|
+
return cellNum > conditionNum;
|
|
53
|
+
}
|
|
54
|
+
if (symbol === '>=') {
|
|
55
|
+
return cellStr.localeCompare(conditionStr) >= 0;
|
|
56
|
+
}
|
|
57
|
+
return cellStr.localeCompare(conditionStr) > 0;
|
|
58
|
+
}
|
|
59
|
+
function compareLessThan(cellValue, conditionValue, symbol) {
|
|
60
|
+
var cellStr = String(cellValue);
|
|
61
|
+
var conditionStr = String(conditionValue);
|
|
62
|
+
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
63
|
+
if (symbol === '<=') {
|
|
64
|
+
return cellStr.localeCompare(conditionStr) <= 0;
|
|
65
|
+
}
|
|
66
|
+
return cellStr.localeCompare(conditionStr) < 0;
|
|
67
|
+
}
|
|
68
|
+
var cellNum = Number(cellValue);
|
|
69
|
+
var conditionNum = Number(conditionValue);
|
|
70
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol === '<=') {
|
|
71
|
+
return cellNum <= conditionNum;
|
|
72
|
+
}
|
|
73
|
+
if (!isNaN(cellNum) && !isNaN(conditionNum)) {
|
|
74
|
+
return cellNum < conditionNum;
|
|
75
|
+
}
|
|
76
|
+
if (symbol === '<=') {
|
|
77
|
+
return cellStr.localeCompare(conditionStr) <= 0;
|
|
78
|
+
}
|
|
79
|
+
return cellStr.localeCompare(conditionStr) < 0;
|
|
80
|
+
}
|
|
81
|
+
function compareBetween(cellValue, value1, value2) {
|
|
82
|
+
var cellStr = String(cellValue);
|
|
83
|
+
var val1Str = String(value1);
|
|
84
|
+
var val2Str = String(value2);
|
|
85
|
+
var smallerValue, biggerValue;
|
|
86
|
+
if (hasAlphabeticChars(value1) || hasAlphabeticChars(value2) || hasAlphabeticChars(cellValue)) {
|
|
87
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
88
|
+
biggerValue = val1Str;
|
|
89
|
+
smallerValue = val2Str;
|
|
90
|
+
} else {
|
|
91
|
+
biggerValue = val2Str;
|
|
92
|
+
smallerValue = val1Str;
|
|
93
|
+
}
|
|
94
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
95
|
+
} else {
|
|
96
|
+
var cellNum = Number(cellValue);
|
|
97
|
+
var val1Num = Number(value1);
|
|
98
|
+
var val2Num = Number(value2);
|
|
99
|
+
if (!isNaN(cellNum) && !isNaN(val1Num) && !isNaN(val2Num)) {
|
|
100
|
+
var smallerNum = Math.min(val1Num, val2Num);
|
|
101
|
+
var biggerNum = Math.max(val1Num, val2Num);
|
|
102
|
+
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
103
|
+
}
|
|
104
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
105
|
+
biggerValue = val1Str;
|
|
106
|
+
smallerValue = val2Str;
|
|
107
|
+
} else {
|
|
108
|
+
biggerValue = val2Str;
|
|
109
|
+
smallerValue = val1Str;
|
|
110
|
+
}
|
|
111
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
34
114
|
function getHistoryRules(fileH) {
|
|
35
115
|
var historyRules = [];
|
|
36
116
|
for (var h = 0; h < fileH.length; h += 1) {
|
|
@@ -59,7 +139,7 @@ function setConditionRules(ctx, protection, generalDialog, conditionformat, rule
|
|
|
59
139
|
var conditionName = rules.rulesType;
|
|
60
140
|
var conditionRange = [];
|
|
61
141
|
var conditionValue = [];
|
|
62
|
-
if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
|
|
142
|
+
if (conditionName === "greaterThan" || conditionName === "greaterThanOrEqual" || conditionName === "lessThan" || conditionName === "lessThanOrEqual" || conditionName === "equal" || conditionName === "textContains") {
|
|
63
143
|
var v = rules.rulesValue;
|
|
64
144
|
var rangeArr = (0, _cell.getRangeByTxt)(ctx, v);
|
|
65
145
|
if (rangeArr.length > 1) {
|
|
@@ -483,7 +563,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
483
563
|
var textColor_1 = format.textColor,
|
|
484
564
|
cellColor_1 = format.cellColor;
|
|
485
565
|
for (var s = 0; s < cellrange.length; s += 1) {
|
|
486
|
-
if (conditionName === "greaterThan" || conditionName === "lessThan" || conditionName === "equal" || conditionName === "textContains") {
|
|
566
|
+
if (conditionName === "greaterThan" || conditionName === "greaterThanOrEqual" || conditionName === "lessThan" || conditionName === "lessThanOrEqual" || conditionName === "equal" || conditionName === "textContains") {
|
|
487
567
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
488
568
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
489
569
|
if (_lodash.default.isNil(d[r]) || _lodash.default.isNil(d[r][c])) {
|
|
@@ -493,7 +573,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
493
573
|
if (_lodash.default.isNil(cell) || _lodash.default.isNil(cell.v) || (0, _validation.isRealNull)(cell.v)) {
|
|
494
574
|
continue;
|
|
495
575
|
}
|
|
496
|
-
if (conditionName === "greaterThan" &&
|
|
576
|
+
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0, '>')) {
|
|
497
577
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
498
578
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
499
579
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -503,7 +583,27 @@ function compute(ctx, ruleArr, d) {
|
|
|
503
583
|
cellColor: cellColor_1
|
|
504
584
|
};
|
|
505
585
|
}
|
|
506
|
-
} else if (conditionName === "
|
|
586
|
+
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0, '>=')) {
|
|
587
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
588
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
589
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
590
|
+
} else {
|
|
591
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
592
|
+
textColor: textColor_1,
|
|
593
|
+
cellColor: cellColor_1
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
} else if (conditionName === "lessThan" && compareLessThan(cell.v, conditionValue0, "<")) {
|
|
597
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
598
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
599
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
600
|
+
} else {
|
|
601
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
602
|
+
textColor: textColor_1,
|
|
603
|
+
cellColor: cellColor_1
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0, '<=')) {
|
|
507
607
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
508
608
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
509
609
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -537,15 +637,6 @@ function compute(ctx, ruleArr, d) {
|
|
|
537
637
|
}
|
|
538
638
|
}
|
|
539
639
|
} else if (conditionName === "between") {
|
|
540
|
-
var vBig = 0;
|
|
541
|
-
var vSmall = 0;
|
|
542
|
-
if (conditionValue0 > conditionValue1) {
|
|
543
|
-
vBig = conditionValue0;
|
|
544
|
-
vSmall = conditionValue1;
|
|
545
|
-
} else {
|
|
546
|
-
vBig = conditionValue1;
|
|
547
|
-
vSmall = conditionValue0;
|
|
548
|
-
}
|
|
549
640
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
550
641
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
551
642
|
if (_lodash.default.isNil(d[r]) || _lodash.default.isNil(d[r][c])) {
|
|
@@ -555,7 +646,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
555
646
|
if (_lodash.default.isNil(cell) || _lodash.default.isNil(cell.v) || (0, _validation.isRealNull)(cell.v)) {
|
|
556
647
|
continue;
|
|
557
648
|
}
|
|
558
|
-
if (
|
|
649
|
+
if (compareBetween(cell.v, conditionValue0, conditionValue1)) {
|
|
559
650
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
560
651
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
561
652
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -1019,7 +1110,7 @@ function CFSplitRange(range1, range2, range3, type) {
|
|
|
1019
1110
|
row: [range2.row[1] + 1, r2],
|
|
1020
1111
|
column: [c1, c2]
|
|
1021
1112
|
}, {
|
|
1022
|
-
row: [
|
|
1113
|
+
row: [range2.row[0] + offset_r, r2 + offset_r],
|
|
1023
1114
|
column: [range2.column[0] + offset_c, c2 + offset_c]
|
|
1024
1115
|
}];
|
|
1025
1116
|
} else if (type === "restPart") {
|
|
@@ -1032,7 +1123,7 @@ function CFSplitRange(range1, range2, range3, type) {
|
|
|
1032
1123
|
}];
|
|
1033
1124
|
} else if (type === "operatePart") {
|
|
1034
1125
|
range = [{
|
|
1035
|
-
row: [
|
|
1126
|
+
row: [range2.row[0] + offset_r, r2 + offset_r],
|
|
1036
1127
|
column: [range2.column[0] + offset_c, c2 + offset_c]
|
|
1037
1128
|
}];
|
|
1038
1129
|
}
|