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