dtable-utils 0.0.3-beta.1 → 0.0.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/README.md +2 -30
- package/dist/index.js +1 -1
- package/es/cell-value-get/cell-value.js +19 -227
- package/es/cell-value-get/collaborator.js +3 -9
- package/es/cell-value-get/digital-sign.js +1 -1
- package/es/cell-value-get/duration.js +1 -1
- package/es/cell-value-get/geolocation.js +5 -29
- package/es/cell-value-get/long-text.js +1 -1
- package/es/cell-value-get/number.js +18 -42
- package/es/cell-value-get/option.js +7 -17
- package/es/cell-value-set/number.js +1 -53
- package/es/column/{core.js → common.js} +14 -2
- package/es/column/date.js +1 -1
- package/es/column/number.js +1 -1
- package/es/common.js +10 -9
- package/es/constants/column.js +2 -127
- package/es/constants/filter/index.js +1 -5
- package/es/date.js +1 -1
- package/es/index.js +10 -62
- package/es/validate/filter.js +1 -1
- package/lib/cell-value-get/cell-value.js +18 -231
- package/lib/cell-value-get/collaborator.js +2 -9
- package/lib/cell-value-get/digital-sign.js +1 -1
- package/lib/cell-value-get/duration.js +1 -0
- package/lib/cell-value-get/geolocation.js +5 -30
- package/lib/cell-value-get/long-text.js +1 -1
- package/lib/cell-value-get/number.js +17 -42
- package/lib/cell-value-get/option.js +6 -18
- package/lib/cell-value-set/number.js +0 -53
- package/lib/column/{core.js → common.js} +14 -1
- package/lib/column/date.js +2 -2
- package/lib/column/number.js +3 -3
- package/lib/common.js +11 -13
- package/lib/constants/column.js +1 -134
- package/lib/constants/filter/index.js +0 -5
- package/lib/index.js +8 -176
- package/lib/validate/filter.js +3 -3
- package/package.json +3 -5
- package/es/cell-value-get/rate.js +0 -6
- package/es/cell-value-set/date.js +0 -20
- package/es/color/gradient-color.js +0 -100
- package/es/column/color.js +0 -415
- package/es/column/option.js +0 -115
- package/es/constants/color.js +0 -16
- package/es/constants/column-permission.js +0 -7
- package/es/constants/grid-header.js +0 -6
- package/es/constants/group.js +0 -23
- package/es/constants/limit.js +0 -3
- package/es/constants/reg.js +0 -4
- package/es/constants/row-color.js +0 -11
- package/es/constants/sort.js +0 -11
- package/es/filter/core.js +0 -287
- package/es/filter/filter-column/array.js +0 -82
- package/es/filter/filter-column/checkbox.js +0 -8
- package/es/filter/filter-column/collaborator.js +0 -67
- package/es/filter/filter-column/creator.js +0 -50
- package/es/filter/filter-column/date.js +0 -59
- package/es/filter/filter-column/digital-sign.js +0 -26
- package/es/filter/filter-column/file.js +0 -24
- package/es/filter/filter-column/formula.js +0 -49
- package/es/filter/filter-column/geolocation.js +0 -53
- package/es/filter/filter-column/link.js +0 -12
- package/es/filter/filter-column/long-text.js +0 -25
- package/es/filter/filter-column/multiple-select.js +0 -60
- package/es/filter/filter-column/number.js +0 -93
- package/es/filter/filter-column/single-select.js +0 -41
- package/es/filter/filter-column/text.js +0 -55
- package/es/filter/filter-row.js +0 -198
- package/es/group/core.js +0 -107
- package/es/group/group-row.js +0 -366
- package/es/link/core.js +0 -78
- package/es/number.js +0 -13
- package/es/row/color.js +0 -278
- package/es/row/core.js +0 -161
- package/es/sort/core.js +0 -32
- package/es/sort/sort-column/array.js +0 -63
- package/es/sort/sort-column/checkbox.js +0 -15
- package/es/sort/sort-column/collaborator.js +0 -9
- package/es/sort/sort-column/date.js +0 -25
- package/es/sort/sort-column/formula.js +0 -40
- package/es/sort/sort-column/link.js +0 -23
- package/es/sort/sort-column/multiple-select.js +0 -45
- package/es/sort/sort-column/number.js +0 -18
- package/es/sort/sort-column/single-select.js +0 -22
- package/es/sort/sort-column/text.js +0 -47
- package/es/sort/sort-row.js +0 -126
- package/es/table/column.js +0 -27
- package/es/table/core.js +0 -14
- package/es/table/index.js +0 -14
- package/es/table/row.js +0 -25
- package/es/validate/geolocation.js +0 -5
- package/es/view/core.js +0 -135
- package/es/view/formula.js +0 -143
- package/es/view/group.js +0 -32
- package/es/view/summaries.js +0 -179
- package/lib/cell-value-get/rate.js +0 -10
- package/lib/cell-value-set/date.js +0 -24
- package/lib/color/gradient-color.js +0 -110
- package/lib/column/color.js +0 -424
- package/lib/column/option.js +0 -123
- package/lib/constants/color.js +0 -20
- package/lib/constants/column-permission.js +0 -11
- package/lib/constants/grid-header.js +0 -10
- package/lib/constants/group.js +0 -36
- package/lib/constants/limit.js +0 -7
- package/lib/constants/reg.js +0 -9
- package/lib/constants/row-color.js +0 -17
- package/lib/constants/sort.js +0 -18
- package/lib/filter/core.js +0 -301
- package/lib/filter/filter-column/array.js +0 -86
- package/lib/filter/filter-column/checkbox.js +0 -12
- package/lib/filter/filter-column/collaborator.js +0 -75
- package/lib/filter/filter-column/creator.js +0 -54
- package/lib/filter/filter-column/date.js +0 -63
- package/lib/filter/filter-column/digital-sign.js +0 -30
- package/lib/filter/filter-column/file.js +0 -28
- package/lib/filter/filter-column/formula.js +0 -53
- package/lib/filter/filter-column/geolocation.js +0 -57
- package/lib/filter/filter-column/link.js +0 -16
- package/lib/filter/filter-column/long-text.js +0 -29
- package/lib/filter/filter-column/multiple-select.js +0 -68
- package/lib/filter/filter-column/number.js +0 -97
- package/lib/filter/filter-column/single-select.js +0 -45
- package/lib/filter/filter-column/text.js +0 -59
- package/lib/filter/filter-row.js +0 -204
- package/lib/group/core.js +0 -117
- package/lib/group/group-row.js +0 -377
- package/lib/link/core.js +0 -90
- package/lib/number.js +0 -18
- package/lib/row/color.js +0 -286
- package/lib/row/core.js +0 -170
- package/lib/sort/core.js +0 -37
- package/lib/sort/sort-column/array.js +0 -67
- package/lib/sort/sort-column/checkbox.js +0 -19
- package/lib/sort/sort-column/collaborator.js +0 -13
- package/lib/sort/sort-column/date.js +0 -29
- package/lib/sort/sort-column/formula.js +0 -44
- package/lib/sort/sort-column/link.js +0 -27
- package/lib/sort/sort-column/multiple-select.js +0 -50
- package/lib/sort/sort-column/number.js +0 -22
- package/lib/sort/sort-column/single-select.js +0 -26
- package/lib/sort/sort-column/text.js +0 -52
- package/lib/sort/sort-row.js +0 -136
- package/lib/table/column.js +0 -32
- package/lib/table/core.js +0 -18
- package/lib/table/index.js +0 -18
- package/lib/table/row.js +0 -30
- package/lib/validate/geolocation.js +0 -9
- package/lib/view/core.js +0 -144
- package/lib/view/formula.js +0 -150
- package/lib/view/group.js +0 -36
- package/lib/view/summaries.js +0 -185
package/es/view/summaries.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { getRowsByIds } from '../table/row.js';
|
|
2
|
-
import { isTableRows } from '../row/core.js';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import '../constants/group.js';
|
|
5
|
-
import '../validate/filter.js';
|
|
6
|
-
import '../filter/core.js';
|
|
7
|
-
import '@babel/runtime/helpers/toConsumableArray';
|
|
8
|
-
import '../constants/filter/filter-column-options.js';
|
|
9
|
-
import '../constants/filter/filter-modifier.js';
|
|
10
|
-
import '../constants/filter/filter-predicate.js';
|
|
11
|
-
import '../constants/filter/filter-is-within.js';
|
|
12
|
-
import '../date.js';
|
|
13
|
-
import { isNumber } from '../number.js';
|
|
14
|
-
import '../cell-value-get/cell-value.js';
|
|
15
|
-
import { isNumericColumn } from '../column/number.js';
|
|
16
|
-
import '../constants/column.js';
|
|
17
|
-
import { FORMULA_COLUMN_TYPES_MAP } from '../constants/formula.js';
|
|
18
|
-
import '../constants/row-color.js';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* calculate summaries of numeric columns from table
|
|
22
|
-
* @param {object} table
|
|
23
|
-
* @param {array} rows table's rows or rows ids
|
|
24
|
-
* @param {object} formulaRows support numeric formula columns
|
|
25
|
-
* @returns object, { [column.key]: { sum, average, median, max, min, ... }, ... }
|
|
26
|
-
*/
|
|
27
|
-
var getSummaries = function getSummaries(table, rows, formulaRows) {
|
|
28
|
-
var numericColumns = table.columns.filter(function (column) {
|
|
29
|
-
return isNumericColumn(column);
|
|
30
|
-
});
|
|
31
|
-
if (numericColumns.length === 0) {
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
var summaryRows = isTableRows(rows) ? rows : getRowsByIds(table, rows);
|
|
35
|
-
var summaries = {};
|
|
36
|
-
numericColumns.forEach(function (column) {
|
|
37
|
-
var type = column.type,
|
|
38
|
-
key = column.key;
|
|
39
|
-
var validNumbersCount = 0;
|
|
40
|
-
var medianArr = [];
|
|
41
|
-
var sum = 0;
|
|
42
|
-
var min;
|
|
43
|
-
var max;
|
|
44
|
-
var median;
|
|
45
|
-
summaryRows.forEach(function (row) {
|
|
46
|
-
var cellValue = row[key];
|
|
47
|
-
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
48
|
-
var formulaRow = formulaRows && formulaRows[row._id];
|
|
49
|
-
cellValue = formulaRow && formulaRow[key];
|
|
50
|
-
if (Array.isArray(cellValue) && cellValue.length === 1) {
|
|
51
|
-
cellValue = cellValue[0];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (isNumber(cellValue)) {
|
|
55
|
-
medianArr.push(cellValue);
|
|
56
|
-
validNumbersCount += 1;
|
|
57
|
-
sum += cellValue;
|
|
58
|
-
if (min === undefined) {
|
|
59
|
-
min = cellValue;
|
|
60
|
-
} else {
|
|
61
|
-
min = cellValue < min ? cellValue : min;
|
|
62
|
-
}
|
|
63
|
-
if (max === undefined) {
|
|
64
|
-
max = cellValue;
|
|
65
|
-
} else {
|
|
66
|
-
max = cellValue > max ? cellValue : max;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (validNumbersCount > 0) {
|
|
71
|
-
medianArr.sort();
|
|
72
|
-
if (medianArr.length % 2 === 0) {
|
|
73
|
-
median = (medianArr[medianArr.length / 2 - 1] + medianArr[medianArr.length / 2]) / 2;
|
|
74
|
-
} else {
|
|
75
|
-
median = medianArr[parseInt(medianArr.length / 2)];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
var average = validNumbersCount === 0 ? 0 : sum / validNumbersCount;
|
|
79
|
-
summaries[key] = {
|
|
80
|
-
sum: sum,
|
|
81
|
-
average: average,
|
|
82
|
-
median: median,
|
|
83
|
-
max: max,
|
|
84
|
-
min: min
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
return summaries;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* calculate sub-group's summaries of numeric columns
|
|
92
|
-
* @param {array} subgroups { summaries, ... }
|
|
93
|
-
* @param {array} numericColumns
|
|
94
|
-
* @returns object, { [column.key]: { sum, average, median, max, min, ... } }
|
|
95
|
-
*/
|
|
96
|
-
var getSummariesWithSubgroups = function getSummariesWithSubgroups(subgroups, numericColumns) {
|
|
97
|
-
var subgroupsLen = subgroups.length;
|
|
98
|
-
var summaries = {};
|
|
99
|
-
numericColumns.forEach(function (column) {
|
|
100
|
-
var medianArr = [];
|
|
101
|
-
var sum = 0;
|
|
102
|
-
var average = 0;
|
|
103
|
-
var median;
|
|
104
|
-
var max;
|
|
105
|
-
var min;
|
|
106
|
-
subgroups.forEach(function (subgroup) {
|
|
107
|
-
var summaries = subgroup.summaries;
|
|
108
|
-
var summary = summaries[column.key];
|
|
109
|
-
var subgroupSum = summary.sum,
|
|
110
|
-
subgroupAverage = summary.average,
|
|
111
|
-
subgroupMedian = summary.median,
|
|
112
|
-
subgroupMax = summary.max,
|
|
113
|
-
subgroupMin = summary.min;
|
|
114
|
-
sum += subgroupSum || 0;
|
|
115
|
-
average += subgroupAverage || 0;
|
|
116
|
-
if (isNumber(subgroupMedian)) {
|
|
117
|
-
medianArr.push(subgroupMedian);
|
|
118
|
-
}
|
|
119
|
-
if (isNumber(subgroupMax)) {
|
|
120
|
-
if (max === undefined) {
|
|
121
|
-
max = subgroupMax;
|
|
122
|
-
} else {
|
|
123
|
-
max = subgroupMax > max ? subgroupMax : max;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (isNumber(subgroupMin)) {
|
|
127
|
-
if (min === undefined) {
|
|
128
|
-
min = subgroupMin;
|
|
129
|
-
} else {
|
|
130
|
-
min = subgroupMin < min ? subgroupMin : min;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
if (medianArr.length > 0) {
|
|
135
|
-
medianArr.sort();
|
|
136
|
-
if (medianArr.length % 2 === 0) {
|
|
137
|
-
median = (medianArr[medianArr.length / 2 - 1] + medianArr[medianArr.length / 2]) / 2;
|
|
138
|
-
} else {
|
|
139
|
-
median = medianArr[parseInt(medianArr.length / 2)];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
average = average / subgroupsLen;
|
|
143
|
-
summaries[column.key] = {
|
|
144
|
-
sum: sum,
|
|
145
|
-
average: average,
|
|
146
|
-
median: median,
|
|
147
|
-
max: max,
|
|
148
|
-
min: min
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
return summaries;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* calculate group's summaries of numeric columns from table
|
|
156
|
-
* @param {array} groups { subgroups, row_ids, ... }
|
|
157
|
-
* @param {object} table
|
|
158
|
-
* @param {object} formulaRows support numeric formula columns
|
|
159
|
-
*/
|
|
160
|
-
var updateGroupSummaries = function updateGroupSummaries(groups, table, formulaRows) {
|
|
161
|
-
var numericColumns = table.columns.filter(function (column) {
|
|
162
|
-
return isNumericColumn(column);
|
|
163
|
-
});
|
|
164
|
-
if (!Array.isArray(groups) || numericColumns.length === 0) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
groups.forEach(function (group) {
|
|
168
|
-
var subgroups = group.subgroups,
|
|
169
|
-
row_ids = group.row_ids;
|
|
170
|
-
if (Array.isArray(subgroups) && subgroups.length > 0) {
|
|
171
|
-
updateGroupSummaries(subgroups, table, formulaRows);
|
|
172
|
-
group.summaries = getSummariesWithSubgroups(subgroups, numericColumns);
|
|
173
|
-
} else if (row_ids) {
|
|
174
|
-
group.summaries = getSummaries(table, row_ids, formulaRows);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export { getSummaries, getSummariesWithSubgroups, updateGroupSummaries };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var getRateDisplayString = function getRateDisplayString(value) {
|
|
6
|
-
if (!value) return '';
|
|
7
|
-
return String(value);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
exports.getRateDisplayString = getRateDisplayString;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var date = require('../date.js');
|
|
6
|
-
var number = require('./number.js');
|
|
7
|
-
|
|
8
|
-
var formatTextToDate = function formatTextToDate(text) {
|
|
9
|
-
var dateFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD';
|
|
10
|
-
if (typeof text !== 'string' || !text.trim()) return null;
|
|
11
|
-
var isAllNumber = /^[0-9]+$/.test(text);
|
|
12
|
-
var dateObj = {};
|
|
13
|
-
if (isAllNumber) {
|
|
14
|
-
dateObj = new Date(number.getFloatNumber(text));
|
|
15
|
-
} else {
|
|
16
|
-
dateObj = date.DateUtils.parseDateWithFormat(text, dateFormat);
|
|
17
|
-
}
|
|
18
|
-
if (dateFormat.indexOf('HH:mm') < 0) {
|
|
19
|
-
return date.DateUtils.format(dateObj, 'YYYY-MM-DD') || null;
|
|
20
|
-
}
|
|
21
|
-
return date.DateUtils.format(dateObj, 'YYYY-MM-DD HH:MM') || null;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports.formatTextToDate = formatTextToDate;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
7
|
-
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
8
|
-
var color = require('../constants/color.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
13
|
-
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
14
|
-
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
15
|
-
|
|
16
|
-
var GradientColorUtils = /*#__PURE__*/function () {
|
|
17
|
-
function GradientColorUtils(_ref) {
|
|
18
|
-
var colorType = _ref.colorType,
|
|
19
|
-
max = _ref.max,
|
|
20
|
-
min = _ref.min;
|
|
21
|
-
_classCallCheck__default["default"](this, GradientColorUtils);
|
|
22
|
-
var newColorType = colorType || 'color_gradation_1';
|
|
23
|
-
var colors = color.COLOR_GRADATION_OPTIONS[newColorType];
|
|
24
|
-
this.startColor = this.hexToRgb(colors[0]);
|
|
25
|
-
this.endColor = this.hexToRgb(colors[4]);
|
|
26
|
-
this.min = min;
|
|
27
|
-
this.max = max;
|
|
28
|
-
this.computeMap = {};
|
|
29
|
-
}
|
|
30
|
-
_createClass__default["default"](GradientColorUtils, [{
|
|
31
|
-
key: "hexToRgb",
|
|
32
|
-
value: function hexToRgb(hexCode) {
|
|
33
|
-
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
34
|
-
var nextHexCode = hexCode.toLowerCase();
|
|
35
|
-
if (nextHexCode && reg.test(nextHexCode)) {
|
|
36
|
-
if (nextHexCode.length === 4) {
|
|
37
|
-
var newHexCode = '#';
|
|
38
|
-
for (var i = 1; i < 4; i += 1) {
|
|
39
|
-
newHexCode += nextHexCode.slice(i, i + 1).concat(nextHexCode.slice(i, i + 1));
|
|
40
|
-
}
|
|
41
|
-
nextHexCode = newHexCode;
|
|
42
|
-
}
|
|
43
|
-
var hexCodeChange = [];
|
|
44
|
-
for (var _i = 1; _i < 7; _i += 2) {
|
|
45
|
-
hexCodeChange.push(parseInt("0x".concat(nextHexCode.slice(_i, _i + 2))));
|
|
46
|
-
}
|
|
47
|
-
return "RGB(".concat(hexCodeChange.join(','), ")");
|
|
48
|
-
}
|
|
49
|
-
return nextHexCode;
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "getColorGradation",
|
|
53
|
-
value: function getColorGradation(color1, color2, value1, value2, value) {
|
|
54
|
-
var rgb1 = color1.split(',');
|
|
55
|
-
var r1 = parseInt(rgb1[0].split('(')[1]);
|
|
56
|
-
var g1 = parseInt(rgb1[1]);
|
|
57
|
-
var b1 = parseInt(rgb1[2].split(')')[0]);
|
|
58
|
-
var rgb2 = color2.split(',');
|
|
59
|
-
var r2 = parseInt(rgb2[0].split('(')[1]);
|
|
60
|
-
var g2 = parseInt(rgb2[1]);
|
|
61
|
-
var b2 = parseInt(rgb2[2].split(')')[0]);
|
|
62
|
-
var r = Math.round(r1 - (r1 - r2) / (value1 - value2) * (value1 - value));
|
|
63
|
-
var g = Math.round(g1 - (g1 - g2) / (value1 - value2) * (value1 - value));
|
|
64
|
-
var b = Math.round(b1 - (b1 - b2) / (value1 - value2) * (value1 - value));
|
|
65
|
-
return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")");
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "getCellColor",
|
|
69
|
-
value: function getCellColor(value) {
|
|
70
|
-
if (this.computeMap[value]) {
|
|
71
|
-
return this.computeMap[value];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// eslint-disable-next-line
|
|
75
|
-
if (value == this.min) {
|
|
76
|
-
if (this.computeMap[value]) {
|
|
77
|
-
this.computeMap[value] = this.startColor;
|
|
78
|
-
} else {
|
|
79
|
-
this.computeMap = _defineProperty__default["default"]({}, value, this.startColor);
|
|
80
|
-
}
|
|
81
|
-
return this.computeMap[value];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// eslint-disable-next-line
|
|
85
|
-
if (value == this.max) {
|
|
86
|
-
if (this.computeMap[value]) {
|
|
87
|
-
this.computeMap[value] = this.endColor;
|
|
88
|
-
} else {
|
|
89
|
-
this.computeMap = _defineProperty__default["default"]({}, value, this.endColor);
|
|
90
|
-
}
|
|
91
|
-
return this.computeMap[value];
|
|
92
|
-
}
|
|
93
|
-
if (value > this.min && value < this.max) {
|
|
94
|
-
var color1 = this.startColor,
|
|
95
|
-
color2 = this.endColor,
|
|
96
|
-
value1 = this.min,
|
|
97
|
-
value2 = this.max;
|
|
98
|
-
var color = this.getColorGradation(color1, color2, value1, value2, value);
|
|
99
|
-
this.computeMap[value] = color;
|
|
100
|
-
return this.computeMap[value];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// value < min || value > max
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}]);
|
|
107
|
-
return GradientColorUtils;
|
|
108
|
-
}();
|
|
109
|
-
|
|
110
|
-
exports["default"] = GradientColorUtils;
|