dtable-statistic 4.3.3 → 4.3.4
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/api/dtable-db-api.js +3 -10
- package/es/calculator/base-calculator.js +12 -20
- package/es/calculator/basic-chart-calculator.js +65 -72
- package/es/calculator/combination-calculator.js +57 -64
- package/es/calculator/compare-bar-calculator.js +26 -33
- package/es/calculator/completeness-calculator.js +30 -37
- package/es/calculator/copy-value.js +1 -7
- package/es/calculator/dashboard-calculator.js +13 -20
- package/es/calculator/heat-map-calculator.js +18 -25
- package/es/calculator/horizontal-bar-calculator.js +8 -15
- package/es/calculator/index.js +35 -42
- package/es/calculator/map-calculator.js +22 -29
- package/es/calculator/mirror-calculator.js +20 -27
- package/es/calculator/number-card-calculator.js +10 -17
- package/es/calculator/pivot-table-calculator.js +58 -65
- package/es/calculator/scatter-calculator.js +14 -21
- package/es/calculator/thread-manager.js +1 -7
- package/es/calculator/trend-calculator.js +22 -29
- package/es/calculator/workers/basic-chart-calculator-worker.js +76 -83
- package/es/calculator/workers/calculator.worker.js +30 -33
- package/es/calculator/workers/card-calculator-worker.js +13 -19
- package/es/calculator/workers/combination-calculator-worker.js +46 -53
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +22 -29
- package/es/calculator/workers/completeness-calculator-worker.js +34 -41
- package/es/calculator/workers/dashboard-calculator-worker.js +18 -24
- package/es/calculator/workers/mirror-calculator-worker.js +22 -29
- package/es/calculator/workers/pivot-table-calculator-worker.js +77 -84
- package/es/calculator/workers/scatter-calculator-worker.js +20 -27
- package/es/calculator/workers/trend-calculator-worker.js +27 -34
- package/es/calculator/world-map-calculator.js +17 -24
- package/es/components/common-add-tool.js +5 -12
- package/es/components/dialog/chart-addition-edit-dialog.js +12 -20
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +101 -108
- package/es/components/dialog/color-theme-dialog.js +15 -22
- package/es/components/dialog/delete-confirmation-dialog.js +11 -18
- package/es/components/dialog/enlarged-chart-dialog.js +20 -28
- package/es/components/dialog/new-table-dialog.js +16 -23
- package/es/components/dialog/new-view-dialog.js +14 -21
- package/es/components/dialog/rename-view-dialog.js +14 -22
- package/es/components/dialog/statistic-record-dialog/index.js +37 -45
- package/es/components/dialog/statistic-types-dialog/index.js +14 -22
- package/es/components/dialog/table-select-dialog.js +15 -23
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +41 -49
- package/es/components/dtable-popover.js +12 -19
- package/es/components/dtable-search-input.js +13 -21
- package/es/components/dtable-select.js +15 -21
- package/es/components/icon.js +4 -11
- package/es/components/index.js +11 -76
- package/es/components/loading.js +3 -10
- package/es/components/modal-portal.js +5 -12
- package/es/components/popover/color-rules/color-rule.js +25 -33
- package/es/components/popover/color-rules/index.js +6 -14
- package/es/components/popover/color-rules/rule-filters/filter.js +27 -34
- package/es/components/popover/color-rules/rule-filters/index.js +17 -25
- package/es/components/popover/color-rules/rule-filters/number-input.js +9 -17
- package/es/components/popover/color-rules-popover.js +24 -32
- package/es/components/popover/color-selector-popover.js +10 -17
- package/es/components/seatable-radio/index.js +9 -16
- package/es/components/select/index.js +2 -9
- package/es/components/select/option-group.js +19 -27
- package/es/components/select/option.js +6 -14
- package/es/components/select/select.js +17 -25
- package/es/components/toast/alert.js +24 -31
- package/es/components/toast/index.js +3 -10
- package/es/components/toast/toast.js +12 -20
- package/es/components/toast/toastManager.js +9 -17
- package/es/components/toast/toaster.js +6 -14
- package/es/constants/color-rules.js +6 -12
- package/es/constants/dtable-select-style.js +4 -9
- package/es/constants/event-types.js +4 -10
- package/es/constants/index.js +67 -96
- package/es/constants/key-codes.js +0 -2
- package/es/constants/map.js +2 -8
- package/es/constants/model.js +20 -26
- package/es/constants/regions.js +3 -8
- package/es/constants/zIndexes.js +1 -7
- package/es/custom-g2.js +208 -236
- package/es/dashboard.js +50 -58
- package/es/desktop-dashboard.js +47 -55
- package/es/index.js +3 -6
- package/es/locale/index.js +10 -13
- package/es/locale/lang/de.js +1 -7
- package/es/locale/lang/en.js +1 -7
- package/es/locale/lang/fr.js +1 -7
- package/es/locale/lang/zh_CN.js +1 -7
- package/es/mobile-dashboard.js +38 -46
- package/es/model/bar-group.js +11 -19
- package/es/model/bar.js +10 -18
- package/es/model/base-model.js +2 -9
- package/es/model/basic-number-card.js +8 -16
- package/es/model/collaborators.js +2 -9
- package/es/model/combination.js +12 -20
- package/es/model/compare-bar.js +16 -24
- package/es/model/completeness-group.js +8 -16
- package/es/model/completeness.js +5 -13
- package/es/model/custom-bar.js +6 -14
- package/es/model/dashboard.js +6 -14
- package/es/model/generic-model.js +133 -141
- package/es/model/heat-map.js +11 -19
- package/es/model/horizontal-bar-group.js +10 -18
- package/es/model/horizontal-bar.js +10 -18
- package/es/model/index.js +53 -185
- package/es/model/map.js +15 -23
- package/es/model/mirror.js +13 -21
- package/es/model/pie.js +10 -18
- package/es/model/ring.js +11 -19
- package/es/model/scatter.js +6 -14
- package/es/model/statistic-dashboard.js +2 -9
- package/es/model/table.js +10 -18
- package/es/model/trend.js +12 -20
- package/es/model/world-map.js +13 -21
- package/es/service/chart-service.js +7 -14
- package/es/service/dashboard-service.js +34 -41
- package/es/service/map-json.js +8 -14
- package/es/stat-editor/chart-name-editor.js +8 -15
- package/es/stat-editor/index.js +16 -24
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +21 -29
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +49 -57
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +4 -11
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +43 -51
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +37 -45
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +26 -34
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +47 -55
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +22 -30
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +27 -35
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +24 -32
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +33 -41
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +22 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +27 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +46 -54
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +23 -31
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +26 -34
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +77 -85
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +21 -29
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +73 -81
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +16 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +19 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +49 -57
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +47 -55
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +11 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +45 -53
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +9 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +20 -28
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +30 -38
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +50 -58
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +47 -55
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +11 -19
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +12 -19
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +62 -70
- package/es/stat-editor/stat-settings/map/map-level.js +13 -20
- package/es/stat-editor/stat-settings/map/map-province-city.js +20 -27
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +20 -28
- package/es/stat-editor/stat-settings/public-setting/calender.js +22 -29
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +6 -13
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +9 -16
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +13 -21
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +27 -35
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +18 -26
- package/es/stat-list/chart-preview.js +20 -28
- package/es/stat-list/index.js +27 -35
- package/es/stat-view/area-chart.js +43 -50
- package/es/stat-view/bar-chart.js +47 -54
- package/es/stat-view/base-chart.js +24 -32
- package/es/stat-view/basic-number-card.js +19 -26
- package/es/stat-view/combination-chart.js +49 -56
- package/es/stat-view/compare-chart.js +39 -46
- package/es/stat-view/completeness-chart.js +28 -35
- package/es/stat-view/custom-bar.js +31 -38
- package/es/stat-view/dashboard-chart.js +15 -22
- package/es/stat-view/heat-map.js +43 -50
- package/es/stat-view/horizontal-bar-chart.js +51 -58
- package/es/stat-view/index.js +73 -80
- package/es/stat-view/line-chart.js +39 -46
- package/es/stat-view/map.js +33 -40
- package/es/stat-view/mirror.js +21 -28
- package/es/stat-view/pie-chart.js +29 -36
- package/es/stat-view/pivot-table/index.js +32 -39
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +31 -39
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +29 -37
- package/es/stat-view/pivot-table/pivot-table-display-name.js +46 -54
- package/es/stat-view/pivot-table/two-dimension-table.js +62 -70
- package/es/stat-view/ring-chart.js +38 -45
- package/es/stat-view/scatter-chart.js +30 -37
- package/es/stat-view/treemap-chart.js +37 -44
- package/es/stat-view/trend-chart.js +32 -39
- package/es/stat-view/world-map.js +33 -40
- package/es/tabs/index.js +32 -40
- package/es/tabs/tab.js +26 -34
- package/es/utils/basic-chart-utils.js +2 -9
- package/es/utils/cell-format.js +14 -22
- package/es/utils/cell-value.js +7 -14
- package/es/utils/collaborator.js +4 -13
- package/es/utils/color-utils.js +18 -29
- package/es/utils/column-utils.js +18 -29
- package/es/utils/column.js +4 -11
- package/es/utils/common-utils.js +41 -65
- package/es/utils/date-format.js +2 -8
- package/es/utils/export-table-utils.js +82 -91
- package/es/utils/index.js +11 -100
- package/es/utils/map.js +26 -36
- package/es/utils/model.js +6 -14
- package/es/utils/object.js +6 -15
- package/es/utils/pivot-table.js +16 -23
- package/es/utils/row-utils.js +23 -33
- package/es/utils/search.js +21 -29
- package/es/utils/sql-utils.js +65 -75
- package/es/utils/stat-utils.js +60 -66
- package/es/utils/trend-utils.js +32 -40
- package/package.json +1 -1
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getChartDisplayLabels = getChartDisplayLabels;
|
|
7
|
-
exports.getChartGroups = getChartGroups;
|
|
8
|
-
function getChartDisplayLabels(containerWidth, minItemWidth, statistics) {
|
|
1
|
+
export function getChartDisplayLabels(containerWidth, minItemWidth, statistics) {
|
|
9
2
|
let labels = [];
|
|
10
3
|
let labelCount = Math.floor(containerWidth / minItemWidth);
|
|
11
4
|
labelCount = labelCount % 2 ? labelCount + 1 : labelCount;
|
|
@@ -18,7 +11,7 @@ function getChartDisplayLabels(containerWidth, minItemWidth, statistics) {
|
|
|
18
11
|
});
|
|
19
12
|
return labels;
|
|
20
13
|
}
|
|
21
|
-
function getChartGroups(statistics) {
|
|
14
|
+
export function getChartGroups(statistics) {
|
|
22
15
|
let chartGroups = [];
|
|
23
16
|
Array.isArray(statistics) && statistics.forEach(item => {
|
|
24
17
|
if (!chartGroups.find(g => g.name === item.name)) {
|
package/es/utils/cell-format.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getClientFormulaDisplayString = exports.getClientCellValueDisplayString = void 0;
|
|
8
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
-
var _dtableStore = require("dtable-store");
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { getCollaboratorsName, getCellValueDisplayString, getFormulaDisplayString, CellType, FORMULA_COLUMN_TYPES, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES } from 'dtable-store';
|
|
10
3
|
const getClientFormulaDisplayString = function (value, columnData) {
|
|
11
4
|
let {
|
|
12
5
|
tables = [],
|
|
@@ -17,16 +10,16 @@ const getClientFormulaDisplayString = function (value, columnData) {
|
|
|
17
10
|
result_type,
|
|
18
11
|
array_type
|
|
19
12
|
} = columnData;
|
|
20
|
-
if (result_type ===
|
|
21
|
-
if (
|
|
13
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
14
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
22
15
|
if (!value) {
|
|
23
16
|
return null;
|
|
24
17
|
}
|
|
25
18
|
const collaboratorList = Array.isArray(value) ? value : [value];
|
|
26
|
-
return
|
|
19
|
+
return getCollaboratorsName(collaborators, collaboratorList);
|
|
27
20
|
}
|
|
28
21
|
}
|
|
29
|
-
return
|
|
22
|
+
return getFormulaDisplayString(value, columnData, {
|
|
30
23
|
tables,
|
|
31
24
|
collaborators
|
|
32
25
|
});
|
|
@@ -40,7 +33,6 @@ const getClientFormulaDisplayString = function (value, columnData) {
|
|
|
40
33
|
* }
|
|
41
34
|
* ]
|
|
42
35
|
*/
|
|
43
|
-
exports.getClientFormulaDisplayString = getClientFormulaDisplayString;
|
|
44
36
|
const getClientLinkDisplayString = function (links, columnData) {
|
|
45
37
|
let {
|
|
46
38
|
tables = [],
|
|
@@ -53,7 +45,7 @@ const getClientLinkDisplayString = function (links, columnData) {
|
|
|
53
45
|
...columnData
|
|
54
46
|
};
|
|
55
47
|
if (!columnData.hasOwnProperty('result_type')) {
|
|
56
|
-
formulaData.result_type =
|
|
48
|
+
formulaData.result_type = FORMULA_RESULT_TYPE.ARRAY;
|
|
57
49
|
}
|
|
58
50
|
const displayValue = links.map(link => link.display_value);
|
|
59
51
|
return getClientFormulaDisplayString(displayValue, formulaData, {
|
|
@@ -66,7 +58,7 @@ const getAutoTimeDisplayString = (row, key) => {
|
|
|
66
58
|
if (value === '' || !value || typeof value !== 'string') {
|
|
67
59
|
return null;
|
|
68
60
|
}
|
|
69
|
-
const date = (
|
|
61
|
+
const date = dayjs(value);
|
|
70
62
|
if (!date.isValid()) return value;
|
|
71
63
|
return date.format('YYYY-MM-DD HH:mm:ss');
|
|
72
64
|
};
|
|
@@ -88,28 +80,28 @@ const getClientCellValueDisplayString = function (row, type, key) {
|
|
|
88
80
|
collaborators = [],
|
|
89
81
|
tables = []
|
|
90
82
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
91
|
-
if (
|
|
83
|
+
if (FORMULA_COLUMN_TYPES.includes(type)) {
|
|
92
84
|
const formulaRow = formulaRows[row._id] || {};
|
|
93
85
|
return getClientFormulaDisplayString(formulaRow[key], data, {
|
|
94
86
|
tables,
|
|
95
87
|
collaborators
|
|
96
88
|
});
|
|
97
|
-
} else if (type ===
|
|
89
|
+
} else if (type === CellType.LINK) {
|
|
98
90
|
const formulaRow = formulaRows[row._id] || {};
|
|
99
91
|
return getClientLinkDisplayString(formulaRow[key], data, {
|
|
100
92
|
tables,
|
|
101
93
|
collaborators
|
|
102
94
|
});
|
|
103
|
-
} else if (type ===
|
|
95
|
+
} else if (type === CellType.CTIME || type === CellType.MTIME) {
|
|
104
96
|
return getAutoTimeDisplayString(row, key);
|
|
105
|
-
} else if (type ===
|
|
97
|
+
} else if (type === CellType.FILE) {
|
|
106
98
|
return getFileDisplayString(row, key);
|
|
107
99
|
}
|
|
108
|
-
return
|
|
100
|
+
return getCellValueDisplayString(row, type, key, {
|
|
109
101
|
formulaRows,
|
|
110
102
|
data,
|
|
111
103
|
collaborators,
|
|
112
104
|
tables
|
|
113
105
|
});
|
|
114
106
|
};
|
|
115
|
-
|
|
107
|
+
export { getClientCellValueDisplayString, getClientFormulaDisplayString };
|
package/es/utils/cell-value.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isCellValueChanged = void 0;
|
|
7
|
-
var _dtableStore = require("dtable-store");
|
|
8
|
-
var _object = require("./object");
|
|
9
|
-
const isCellValueChanged = (oldVal, newVal, columnType) => {
|
|
1
|
+
import { CellType } from 'dtable-store';
|
|
2
|
+
import { isEmptyObject, isSameObject } from './object';
|
|
3
|
+
export const isCellValueChanged = (oldVal, newVal, columnType) => {
|
|
10
4
|
if (oldVal === newVal) {
|
|
11
5
|
return false;
|
|
12
6
|
}
|
|
13
7
|
if (oldVal === undefined || oldVal === null) {
|
|
14
|
-
if ((columnType ===
|
|
8
|
+
if ((columnType === CellType.GEOLOCATION || columnType === CellType.DIGITAL_SIGN) && isEmptyObject(newVal)) {
|
|
15
9
|
return false;
|
|
16
10
|
}
|
|
17
|
-
if ((columnType ===
|
|
11
|
+
if ((columnType === CellType.DATE || columnType === CellType.NUMBER || columnType === CellType.DURATION) && newVal === null) {
|
|
18
12
|
return false;
|
|
19
13
|
}
|
|
20
14
|
if (Array.isArray(newVal)) {
|
|
@@ -27,8 +21,7 @@ const isCellValueChanged = (oldVal, newVal, columnType) => {
|
|
|
27
21
|
return JSON.stringify(oldVal) !== JSON.stringify(newVal);
|
|
28
22
|
}
|
|
29
23
|
if (typeof oldVal === 'object' && typeof newVal === 'object' && newVal !== null) {
|
|
30
|
-
return !
|
|
24
|
+
return !isSameObject(oldVal, newVal);
|
|
31
25
|
}
|
|
32
26
|
return oldVal !== newVal;
|
|
33
|
-
};
|
|
34
|
-
exports.isCellValueChanged = isCellValueChanged;
|
|
27
|
+
};
|
package/es/utils/collaborator.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isValidCollaboratorEmail = exports.getKnownCreatorByEmail = exports.generateDefaultUser = void 0;
|
|
7
|
-
const isValidCollaboratorEmail = email => {
|
|
1
|
+
export const isValidCollaboratorEmail = email => {
|
|
8
2
|
const reg = /^[A-Za-z0-9]+([-_.][A-Za-z0-9]+)*@([A-Za-z0-9]+[-.])+[A-Za-z0-9]{2,6}$/;
|
|
9
3
|
return reg.test(email);
|
|
10
4
|
};
|
|
11
|
-
|
|
12
|
-
const getKnownCreatorByEmail = (collaborators, email) => {
|
|
5
|
+
export const getKnownCreatorByEmail = (collaborators, email) => {
|
|
13
6
|
let {
|
|
14
7
|
mediaUrl
|
|
15
8
|
} = window.dtable || {};
|
|
@@ -35,8 +28,7 @@ const getKnownCreatorByEmail = (collaborators, email) => {
|
|
|
35
28
|
if (creator) return creator;
|
|
36
29
|
return null;
|
|
37
30
|
};
|
|
38
|
-
|
|
39
|
-
const generateDefaultUser = name => {
|
|
31
|
+
export const generateDefaultUser = name => {
|
|
40
32
|
if (!window || window.dtable) return {};
|
|
41
33
|
let {
|
|
42
34
|
mediaUrl
|
|
@@ -46,5 +38,4 @@ const generateDefaultUser = name => {
|
|
|
46
38
|
name,
|
|
47
39
|
avatar_url: defaultAvatarUrl
|
|
48
40
|
};
|
|
49
|
-
};
|
|
50
|
-
exports.generateDefaultUser = generateDefaultUser;
|
|
41
|
+
};
|
package/es/utils/color-utils.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.getValidColorRules = exports.getLabelColorFromSpecificColor = exports.getLabelColorFromColorRules = exports.getLabelColor = exports.getConvertedColorRules = void 0;
|
|
7
|
-
var _dtableStore = require("dtable-store");
|
|
8
|
-
var _constants = require("../constants");
|
|
9
|
-
var _colorRules = require("../constants/color-rules");
|
|
10
|
-
const getValidColorRules = colorRules => {
|
|
1
|
+
import { filterRow, getValidFilters } from 'dtable-store';
|
|
2
|
+
import { STAT_TYPE, TYPE_COLOR_USING } from '../constants';
|
|
3
|
+
import { COLOR_RULE_FILTER_TYPE_MAP, FILTER_TYPE_2_CELL_TYPE } from '../constants/color-rules';
|
|
4
|
+
export const getValidColorRules = colorRules => {
|
|
11
5
|
if (!Array.isArray(colorRules) || colorRules.length === 0) {
|
|
12
6
|
return [];
|
|
13
7
|
}
|
|
@@ -20,8 +14,8 @@ const getValidColorRules = colorRules => {
|
|
|
20
14
|
return;
|
|
21
15
|
}
|
|
22
16
|
columns.push({
|
|
23
|
-
key:
|
|
24
|
-
type:
|
|
17
|
+
key: COLOR_RULE_FILTER_TYPE_MAP.NUMERIC_VALUE,
|
|
18
|
+
type: FILTER_TYPE_2_CELL_TYPE[filterType]
|
|
25
19
|
});
|
|
26
20
|
keyExistColumnMap[filterType] = true;
|
|
27
21
|
});
|
|
@@ -36,7 +30,7 @@ const getValidColorRules = colorRules => {
|
|
|
36
30
|
column_key: filter.filter_type
|
|
37
31
|
};
|
|
38
32
|
});
|
|
39
|
-
const validFilters =
|
|
33
|
+
const validFilters = getValidFilters(convertedFilters, columns);
|
|
40
34
|
if (validFilters.length === 0) {
|
|
41
35
|
return null;
|
|
42
36
|
}
|
|
@@ -46,8 +40,7 @@ const getValidColorRules = colorRules => {
|
|
|
46
40
|
};
|
|
47
41
|
}).filter(Boolean);
|
|
48
42
|
};
|
|
49
|
-
|
|
50
|
-
const getConvertedColorRules = colorRules => {
|
|
43
|
+
export const getConvertedColorRules = colorRules => {
|
|
51
44
|
const validColorRules = getValidColorRules(colorRules);
|
|
52
45
|
return validColorRules.map(colorRule => {
|
|
53
46
|
const convertedFilters = colorRule.filters.map(filter => {
|
|
@@ -59,7 +52,7 @@ const getConvertedColorRules = colorRules => {
|
|
|
59
52
|
column_key: filter_type,
|
|
60
53
|
column: {
|
|
61
54
|
key: filter_type,
|
|
62
|
-
type:
|
|
55
|
+
type: FILTER_TYPE_2_CELL_TYPE[filter_type]
|
|
63
56
|
}
|
|
64
57
|
};
|
|
65
58
|
});
|
|
@@ -69,14 +62,13 @@ const getConvertedColorRules = colorRules => {
|
|
|
69
62
|
};
|
|
70
63
|
});
|
|
71
64
|
};
|
|
72
|
-
|
|
73
|
-
const getLabelColorFromSpecificColor = chart => {
|
|
65
|
+
export const getLabelColorFromSpecificColor = chart => {
|
|
74
66
|
switch (chart.type) {
|
|
75
|
-
case
|
|
67
|
+
case STAT_TYPE.BAR:
|
|
76
68
|
{
|
|
77
69
|
return chart.y_axis_label_color;
|
|
78
70
|
}
|
|
79
|
-
case
|
|
71
|
+
case STAT_TYPE.HORIZONTAL_BAR:
|
|
80
72
|
{
|
|
81
73
|
return chart.horizontal_axis_label_color;
|
|
82
74
|
}
|
|
@@ -86,8 +78,7 @@ const getLabelColorFromSpecificColor = chart => {
|
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
80
|
};
|
|
89
|
-
|
|
90
|
-
const getLabelColorFromColorRules = (colorRules, value) => {
|
|
81
|
+
export const getLabelColorFromColorRules = (colorRules, value) => {
|
|
91
82
|
if (!colorRules) {
|
|
92
83
|
return null;
|
|
93
84
|
}
|
|
@@ -102,26 +93,25 @@ const getLabelColorFromColorRules = (colorRules, value) => {
|
|
|
102
93
|
filter_conjunction,
|
|
103
94
|
filters
|
|
104
95
|
} = colorRule;
|
|
105
|
-
if (
|
|
96
|
+
if (filterRow(row, filter_conjunction, filters)) {
|
|
106
97
|
matchedRuleColor = color;
|
|
107
98
|
break;
|
|
108
99
|
}
|
|
109
100
|
}
|
|
110
101
|
return matchedRuleColor;
|
|
111
102
|
};
|
|
112
|
-
|
|
113
|
-
const getLabelColor = _ref => {
|
|
103
|
+
export const getLabelColor = _ref => {
|
|
114
104
|
let {
|
|
115
105
|
chart,
|
|
116
106
|
colorRules,
|
|
117
107
|
value
|
|
118
108
|
} = _ref;
|
|
119
109
|
switch (chart.color_option) {
|
|
120
|
-
case
|
|
110
|
+
case TYPE_COLOR_USING.USE_SPECIFIC_COLORS:
|
|
121
111
|
{
|
|
122
112
|
return getLabelColorFromSpecificColor(chart);
|
|
123
113
|
}
|
|
124
|
-
case
|
|
114
|
+
case TYPE_COLOR_USING.USE_RULES:
|
|
125
115
|
{
|
|
126
116
|
return getLabelColorFromColorRules(colorRules, value);
|
|
127
117
|
}
|
|
@@ -130,5 +120,4 @@ const getLabelColor = _ref => {
|
|
|
130
120
|
return null;
|
|
131
121
|
}
|
|
132
122
|
}
|
|
133
|
-
};
|
|
134
|
-
exports.getLabelColor = getLabelColor;
|
|
123
|
+
};
|
package/es/utils/column-utils.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getColorFromSingleSelectColumn = getColorFromSingleSelectColumn;
|
|
7
|
-
exports.isWorldMapColumn = exports.isStatisticDateColumn = exports.isMirrorColumn = exports.isMapColumn = void 0;
|
|
8
|
-
var _dtableStore = require("dtable-store");
|
|
9
|
-
var _constants = require("../constants");
|
|
10
|
-
function getColorFromSingleSelectColumn(column, target) {
|
|
1
|
+
import { CellType, isDateColumn, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
|
|
2
|
+
import { MIRROR_COLUMN_LIST } from '../constants';
|
|
3
|
+
export function getColorFromSingleSelectColumn(column, target) {
|
|
11
4
|
let {
|
|
12
5
|
type: columnType,
|
|
13
6
|
data: columnData
|
|
14
7
|
} = column;
|
|
15
|
-
if (columnType !==
|
|
8
|
+
if (columnType !== CellType.SINGLE_SELECT) {
|
|
16
9
|
return null;
|
|
17
10
|
}
|
|
18
11
|
const options = columnData ? columnData.options : [];
|
|
@@ -26,18 +19,17 @@ function getColorFromSingleSelectColumn(column, target) {
|
|
|
26
19
|
const color = selectedOption && selectedOption.color;
|
|
27
20
|
return color || null;
|
|
28
21
|
}
|
|
29
|
-
const isStatisticDateColumn = column => {
|
|
22
|
+
export const isStatisticDateColumn = column => {
|
|
30
23
|
if (!column) return false;
|
|
31
|
-
return
|
|
24
|
+
return isDateColumn(column);
|
|
32
25
|
};
|
|
33
|
-
|
|
34
|
-
const isMapColumn = column => {
|
|
26
|
+
export const isMapColumn = column => {
|
|
35
27
|
if (!column) return false;
|
|
36
28
|
const {
|
|
37
29
|
type,
|
|
38
30
|
data
|
|
39
31
|
} = column;
|
|
40
|
-
if (type ===
|
|
32
|
+
if (type === CellType.GEOLOCATION) {
|
|
41
33
|
const {
|
|
42
34
|
geo_format
|
|
43
35
|
} = data || {};
|
|
@@ -46,13 +38,13 @@ const isMapColumn = column => {
|
|
|
46
38
|
}
|
|
47
39
|
return true;
|
|
48
40
|
}
|
|
49
|
-
if (
|
|
41
|
+
if (FORMULA_COLUMN_TYPES.includes(type)) {
|
|
50
42
|
const {
|
|
51
43
|
result_type,
|
|
52
44
|
array_type,
|
|
53
45
|
array_data
|
|
54
46
|
} = data || {};
|
|
55
|
-
if (result_type !==
|
|
47
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
56
48
|
return false;
|
|
57
49
|
}
|
|
58
50
|
const {
|
|
@@ -65,20 +57,18 @@ const isMapColumn = column => {
|
|
|
65
57
|
}
|
|
66
58
|
return false;
|
|
67
59
|
};
|
|
68
|
-
|
|
69
|
-
const isMirrorColumn = column => {
|
|
60
|
+
export const isMirrorColumn = column => {
|
|
70
61
|
if (!column) return false;
|
|
71
|
-
return
|
|
62
|
+
return MIRROR_COLUMN_LIST.includes(column.type);
|
|
72
63
|
};
|
|
73
|
-
|
|
74
|
-
const isWorldMapColumn = column => {
|
|
64
|
+
export const isWorldMapColumn = column => {
|
|
75
65
|
if (!column) return false;
|
|
76
66
|
const {
|
|
77
67
|
type,
|
|
78
68
|
data
|
|
79
69
|
} = column;
|
|
80
|
-
if (type ===
|
|
81
|
-
if (type ===
|
|
70
|
+
if (type === CellType.TEXT) return true;
|
|
71
|
+
if (type === CellType.GEOLOCATION) {
|
|
82
72
|
const {
|
|
83
73
|
geo_format
|
|
84
74
|
} = data || {};
|
|
@@ -86,7 +76,7 @@ const isWorldMapColumn = column => {
|
|
|
86
76
|
return true;
|
|
87
77
|
}
|
|
88
78
|
}
|
|
89
|
-
if (
|
|
79
|
+
if (FORMULA_COLUMN_TYPES.includes(type)) {
|
|
90
80
|
const {
|
|
91
81
|
data
|
|
92
82
|
} = column;
|
|
@@ -95,7 +85,7 @@ const isWorldMapColumn = column => {
|
|
|
95
85
|
array_type,
|
|
96
86
|
array_data
|
|
97
87
|
} = data || {};
|
|
98
|
-
if (result_type !==
|
|
88
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
99
89
|
return false;
|
|
100
90
|
}
|
|
101
91
|
const {
|
|
@@ -106,5 +96,4 @@ const isWorldMapColumn = column => {
|
|
|
106
96
|
}
|
|
107
97
|
}
|
|
108
98
|
return false;
|
|
109
|
-
};
|
|
110
|
-
exports.isWorldMapColumn = isWorldMapColumn;
|
|
99
|
+
};
|
package/es/utils/column.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDateColumnFormat = getDateColumnFormat;
|
|
7
|
-
exports.getSelectColumnOptions = getSelectColumnOptions;
|
|
8
|
-
var _dtableStore = require("dtable-store");
|
|
9
|
-
function getSelectColumnOptions(column) {
|
|
1
|
+
import { DEFAULT_DATE_FORMAT } from 'dtable-store';
|
|
2
|
+
export function getSelectColumnOptions(column) {
|
|
10
3
|
if (!column || !column.data || !Array.isArray(column.data.options)) {
|
|
11
4
|
return [];
|
|
12
5
|
}
|
|
13
6
|
return column.data.options;
|
|
14
7
|
}
|
|
15
|
-
function getDateColumnFormat(column) {
|
|
16
|
-
let format = column && column.data && column.data.format ? column.data.format :
|
|
8
|
+
export function getDateColumnFormat(column) {
|
|
9
|
+
let format = column && column.data && column.data.format ? column.data.format : DEFAULT_DATE_FORMAT;
|
|
17
10
|
// Old Europe format is D/M/YYYY new format is DD/MM/YYYY
|
|
18
11
|
format = format.replace(/D\/M\/YYYY/, 'DD/MM/YYYY');
|
|
19
12
|
return format;
|