plmt-constructor-sdk 0.13.14 → 0.13.15
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/conditional-format/conditions.d.ts +2 -0
- package/conditional-format/conditions.js +132 -0
- package/conditional-format/constants.d.ts +55 -0
- package/conditional-format/constants.js +38 -0
- package/conditional-format/index.d.ts +2 -0
- package/conditional-format/index.js +18 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFulfillingCondition = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
function isFulfillingCondition(type, cellValue, condition) {
|
|
6
|
+
const method = condition.condition;
|
|
7
|
+
const conditionValue = condition.value;
|
|
8
|
+
switch (type) {
|
|
9
|
+
case constants_1.ColumnType.String:
|
|
10
|
+
return isFulfillingStringCondition(method, cellValue, conditionValue);
|
|
11
|
+
case constants_1.ColumnType.Number:
|
|
12
|
+
case constants_1.ColumnType.Boolean:
|
|
13
|
+
const value = Array.isArray(conditionValue)
|
|
14
|
+
? conditionValue.map((item) => Number(item))
|
|
15
|
+
: conditionValue;
|
|
16
|
+
return isFulfillingNumberCondition(method, cellValue, value);
|
|
17
|
+
case constants_1.ColumnType.Date:
|
|
18
|
+
const date = Array.isArray(conditionValue)
|
|
19
|
+
? conditionValue.map((item) => new Date(item))
|
|
20
|
+
: new Date(conditionValue);
|
|
21
|
+
return isFulfillingDateCondition(method, new Date(cellValue), date);
|
|
22
|
+
default:
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.isFulfillingCondition = isFulfillingCondition;
|
|
27
|
+
function isFulfillingStringCondition(method, cellValue, conditionValue) {
|
|
28
|
+
switch (method) {
|
|
29
|
+
case constants_1.FilterMethod.Equal:
|
|
30
|
+
return cellValue === conditionValue;
|
|
31
|
+
case constants_1.FilterMethod.NotEqual:
|
|
32
|
+
return cellValue !== conditionValue;
|
|
33
|
+
case constants_1.FilterMethod.Like:
|
|
34
|
+
return cellValue.includes(conditionValue);
|
|
35
|
+
case constants_1.FilterMethod.Like$Not:
|
|
36
|
+
return !cellValue.includes(conditionValue);
|
|
37
|
+
case constants_1.FilterMethod.Like$CaseIgnore:
|
|
38
|
+
return cellValue
|
|
39
|
+
.toUpperCase()
|
|
40
|
+
.includes(conditionValue.toUpperCase());
|
|
41
|
+
case constants_1.FilterMethod.Like$Not$CaseIgnore:
|
|
42
|
+
return !cellValue
|
|
43
|
+
.toUpperCase()
|
|
44
|
+
.includes(conditionValue.toUpperCase());
|
|
45
|
+
case constants_1.FilterMethod.StartsLike:
|
|
46
|
+
return cellValue.startsWith(conditionValue);
|
|
47
|
+
case constants_1.FilterMethod.StartsLike$Not:
|
|
48
|
+
return !cellValue.startsWith(conditionValue);
|
|
49
|
+
case constants_1.FilterMethod.StartsLike$CaseIgnore:
|
|
50
|
+
return cellValue
|
|
51
|
+
.toUpperCase()
|
|
52
|
+
.startsWith(conditionValue.toUpperCase());
|
|
53
|
+
case constants_1.FilterMethod.StartsLike$Not$CaseIgnore:
|
|
54
|
+
return !cellValue
|
|
55
|
+
.toUpperCase()
|
|
56
|
+
.startsWith(conditionValue.toUpperCase());
|
|
57
|
+
case constants_1.FilterMethod.EndsLike:
|
|
58
|
+
return cellValue.endsWith(conditionValue);
|
|
59
|
+
case constants_1.FilterMethod.EndsLike$Not:
|
|
60
|
+
return !cellValue.endsWith(conditionValue);
|
|
61
|
+
case constants_1.FilterMethod.EndsLike$CaseIgnore:
|
|
62
|
+
return cellValue
|
|
63
|
+
.toUpperCase()
|
|
64
|
+
.endsWith(conditionValue.toUpperCase());
|
|
65
|
+
case constants_1.FilterMethod.EndsLike$Not$CaseIgnore:
|
|
66
|
+
return !cellValue
|
|
67
|
+
.toUpperCase()
|
|
68
|
+
.endsWith(conditionValue.toUpperCase());
|
|
69
|
+
default:
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function isFulfillingNumberCondition(method, cellValue, conditionValue) {
|
|
74
|
+
if (Array.isArray(conditionValue))
|
|
75
|
+
switch (method) {
|
|
76
|
+
case constants_1.FilterMethod.InList:
|
|
77
|
+
return (cellValue >= conditionValue[0] &&
|
|
78
|
+
cellValue <= conditionValue[1]);
|
|
79
|
+
case constants_1.FilterMethod.NotInList:
|
|
80
|
+
return (cellValue < conditionValue[0] ||
|
|
81
|
+
cellValue > conditionValue[1]);
|
|
82
|
+
default:
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
else
|
|
86
|
+
switch (method) {
|
|
87
|
+
case constants_1.FilterMethod.Equal:
|
|
88
|
+
return cellValue === conditionValue;
|
|
89
|
+
case constants_1.FilterMethod.NotEqual:
|
|
90
|
+
return cellValue !== conditionValue;
|
|
91
|
+
case constants_1.FilterMethod.GreaterThen:
|
|
92
|
+
return cellValue > conditionValue;
|
|
93
|
+
case constants_1.FilterMethod.GreaterThenOrEqual:
|
|
94
|
+
return cellValue >= conditionValue;
|
|
95
|
+
case constants_1.FilterMethod.LessThen:
|
|
96
|
+
return cellValue < conditionValue;
|
|
97
|
+
case constants_1.FilterMethod.LessThenOrEqual:
|
|
98
|
+
return cellValue <= conditionValue;
|
|
99
|
+
default:
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function isFulfillingDateCondition(method, cellValue, conditionValue) {
|
|
104
|
+
if (Array.isArray(conditionValue))
|
|
105
|
+
switch (method) {
|
|
106
|
+
case constants_1.FilterMethod.DateRange:
|
|
107
|
+
return (cellValue >= conditionValue[0] &&
|
|
108
|
+
cellValue <= conditionValue[1]);
|
|
109
|
+
case constants_1.FilterMethod.DateRange$Not:
|
|
110
|
+
return (cellValue < conditionValue[0] ||
|
|
111
|
+
cellValue > conditionValue[1]);
|
|
112
|
+
default:
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
else
|
|
116
|
+
switch (method) {
|
|
117
|
+
case constants_1.FilterMethod.Equal:
|
|
118
|
+
return cellValue.getTime() === conditionValue.getTime();
|
|
119
|
+
case constants_1.FilterMethod.NotEqual:
|
|
120
|
+
return cellValue.getTime() !== conditionValue.getTime();
|
|
121
|
+
case constants_1.FilterMethod.GreaterThen:
|
|
122
|
+
return cellValue > conditionValue;
|
|
123
|
+
case constants_1.FilterMethod.GreaterThenOrEqual:
|
|
124
|
+
return cellValue >= conditionValue;
|
|
125
|
+
case constants_1.FilterMethod.LessThen:
|
|
126
|
+
return cellValue < conditionValue;
|
|
127
|
+
case constants_1.FilterMethod.LessThenOrEqual:
|
|
128
|
+
return cellValue <= conditionValue;
|
|
129
|
+
default:
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare enum ColumnType {
|
|
2
|
+
String = 0,
|
|
3
|
+
Number = 1,
|
|
4
|
+
Date = 2,
|
|
5
|
+
Boolean = 3
|
|
6
|
+
}
|
|
7
|
+
export declare enum FilterMethod {
|
|
8
|
+
Equal = "EQ",
|
|
9
|
+
NotEqual = "NEQ",
|
|
10
|
+
GreaterThen = "GT",
|
|
11
|
+
LessThen = "LT",
|
|
12
|
+
GreaterThenOrEqual = "GTE",
|
|
13
|
+
LessThenOrEqual = "LTE",
|
|
14
|
+
InList = "IN",
|
|
15
|
+
NotInList = "NIN",
|
|
16
|
+
Like = "LIKE",
|
|
17
|
+
Like$CaseIgnore = "LIKE_I",
|
|
18
|
+
Like$Not = "NLIKE",
|
|
19
|
+
Like$Not$CaseIgnore = "NLIKE_I",
|
|
20
|
+
StartsLike = "START_LIKE",
|
|
21
|
+
StartsLike$CaseIgnore = "START_LIKE_I",
|
|
22
|
+
StartsLike$Not = "NSTART_LIKE",
|
|
23
|
+
StartsLike$Not$CaseIgnore = "NSTART_LIKE_I",
|
|
24
|
+
EndsLike = "END_LIKE",
|
|
25
|
+
EndsLike$CaseIgnore = "END_LIKE_I",
|
|
26
|
+
EndsLike$Not = "NEND_LIKE",
|
|
27
|
+
EndsLike$Not$CaseIgnore = "NEND_LIKE_I",
|
|
28
|
+
DateRange = "DATE_RANGE",
|
|
29
|
+
DateRange$Not = "NDATE_RANGE",
|
|
30
|
+
Range = "RANGE",
|
|
31
|
+
Range$Not = "NRANGE"
|
|
32
|
+
}
|
|
33
|
+
export declare const COLOR_STEPS = 128;
|
|
34
|
+
export interface Condition {
|
|
35
|
+
column_id: number;
|
|
36
|
+
condition: FilterMethod;
|
|
37
|
+
value: any;
|
|
38
|
+
}
|
|
39
|
+
export interface ConditionalFormatter {
|
|
40
|
+
id: number;
|
|
41
|
+
name: string;
|
|
42
|
+
gradient: boolean;
|
|
43
|
+
three_tone_gradient: boolean;
|
|
44
|
+
conditions: Condition[];
|
|
45
|
+
column_id: number;
|
|
46
|
+
column_middle: number;
|
|
47
|
+
column_min: number;
|
|
48
|
+
column_max: number;
|
|
49
|
+
color_start: string;
|
|
50
|
+
color_middle: string;
|
|
51
|
+
color_end: string;
|
|
52
|
+
value_start: number;
|
|
53
|
+
value_middle: number;
|
|
54
|
+
value_end: number;
|
|
55
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COLOR_STEPS = exports.FilterMethod = exports.ColumnType = void 0;
|
|
4
|
+
var ColumnType;
|
|
5
|
+
(function (ColumnType) {
|
|
6
|
+
ColumnType[ColumnType["String"] = 0] = "String";
|
|
7
|
+
ColumnType[ColumnType["Number"] = 1] = "Number";
|
|
8
|
+
ColumnType[ColumnType["Date"] = 2] = "Date";
|
|
9
|
+
ColumnType[ColumnType["Boolean"] = 3] = "Boolean";
|
|
10
|
+
})(ColumnType = exports.ColumnType || (exports.ColumnType = {}));
|
|
11
|
+
var FilterMethod;
|
|
12
|
+
(function (FilterMethod) {
|
|
13
|
+
FilterMethod["Equal"] = "EQ";
|
|
14
|
+
FilterMethod["NotEqual"] = "NEQ";
|
|
15
|
+
FilterMethod["GreaterThen"] = "GT";
|
|
16
|
+
FilterMethod["LessThen"] = "LT";
|
|
17
|
+
FilterMethod["GreaterThenOrEqual"] = "GTE";
|
|
18
|
+
FilterMethod["LessThenOrEqual"] = "LTE";
|
|
19
|
+
FilterMethod["InList"] = "IN";
|
|
20
|
+
FilterMethod["NotInList"] = "NIN";
|
|
21
|
+
FilterMethod["Like"] = "LIKE";
|
|
22
|
+
FilterMethod["Like$CaseIgnore"] = "LIKE_I";
|
|
23
|
+
FilterMethod["Like$Not"] = "NLIKE";
|
|
24
|
+
FilterMethod["Like$Not$CaseIgnore"] = "NLIKE_I";
|
|
25
|
+
FilterMethod["StartsLike"] = "START_LIKE";
|
|
26
|
+
FilterMethod["StartsLike$CaseIgnore"] = "START_LIKE_I";
|
|
27
|
+
FilterMethod["StartsLike$Not"] = "NSTART_LIKE";
|
|
28
|
+
FilterMethod["StartsLike$Not$CaseIgnore"] = "NSTART_LIKE_I";
|
|
29
|
+
FilterMethod["EndsLike"] = "END_LIKE";
|
|
30
|
+
FilterMethod["EndsLike$CaseIgnore"] = "END_LIKE_I";
|
|
31
|
+
FilterMethod["EndsLike$Not"] = "NEND_LIKE";
|
|
32
|
+
FilterMethod["EndsLike$Not$CaseIgnore"] = "NEND_LIKE_I";
|
|
33
|
+
FilterMethod["DateRange"] = "DATE_RANGE";
|
|
34
|
+
FilterMethod["DateRange$Not"] = "NDATE_RANGE";
|
|
35
|
+
FilterMethod["Range"] = "RANGE";
|
|
36
|
+
FilterMethod["Range$Not"] = "NRANGE";
|
|
37
|
+
})(FilterMethod = exports.FilterMethod || (exports.FilterMethod = {}));
|
|
38
|
+
exports.COLOR_STEPS = 128;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./conditions"), exports);
|
|
18
|
+
__exportStar(require("./constants"), exports);
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./declare"), exports);
|
|
18
18
|
__exportStar(require("./widget"), exports);
|
|
19
|
+
__exportStar(require("./conditional-format"), exports);
|