dtable-statistic 4.4.24-alpha.9 → 5.0.0
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/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/dashboard.css +0 -1
- package/es/assets/css/dialog.css +0 -30
- package/es/assets/css/slider.css +77 -0
- package/es/assets/css/statistic-chart.module.css +11 -0
- package/es/assets/css/statistic-custom-title.module.css +3 -0
- package/es/assets/css/statistic-custom.module.css +4 -0
- package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
- package/es/assets/css/statistic-time-picker.module.css +21 -0
- package/es/calculator/base-calculator.js +80 -0
- package/es/calculator/basic-chart-calculator.js +349 -0
- package/es/calculator/combination-calculator.js +246 -0
- package/es/calculator/compare-bar-calculator.js +197 -0
- package/es/calculator/completeness-calculator.js +215 -0
- package/es/calculator/copy-value.js +53 -0
- package/es/calculator/dashboard-calculator.js +70 -0
- package/es/calculator/heat-map-calculator.js +148 -0
- package/es/calculator/horizontal-bar-calculator.js +67 -0
- package/es/calculator/index.js +81 -0
- package/es/calculator/map-calculator.js +103 -0
- package/es/calculator/mirror-calculator.js +146 -0
- package/es/calculator/number-card-calculator.js +60 -0
- package/es/calculator/pivot-table-calculator.js +821 -0
- package/es/calculator/scatter-calculator.js +75 -0
- package/es/calculator/thread-manager.js +57 -0
- package/es/calculator/trend-calculator.js +113 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +495 -0
- package/es/calculator/workers/calculator.worker.js +44 -0
- package/es/calculator/workers/card-calculator-worker.js +40 -0
- package/es/calculator/workers/combination-calculator-worker.js +276 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +150 -0
- package/es/calculator/workers/completeness-calculator-worker.js +208 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +68 -0
- package/es/calculator/workers/mirror-calculator-worker.js +152 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +718 -0
- package/es/calculator/workers/scatter-calculator-worker.js +80 -0
- package/es/calculator/workers/trend-calculator-worker.js +108 -0
- package/es/calculator/world-map-calculator.js +124 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +90 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +259 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +83 -0
- package/es/components/dialog/enlarged-chart-dialog.js +13 -8
- package/es/components/dialog/statistic-record-dialog/index.js +34 -25
- package/es/components/dialog/statistic-types-dialog/index.css +14 -0
- package/es/components/dialog/statistic-types-dialog/index.js +62 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
- package/es/components/popover/color-rules/color-rule.js +183 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +221 -0
- package/es/components/popover/color-rules/rule-filters/index.css +210 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +78 -0
- package/es/components/popover/color-rules-popover.js +218 -0
- package/es/components/popover/color-selector-popover.js +83 -0
- package/es/constants/index.js +2 -1
- package/es/custom-g2.js +644 -0
- package/es/dashboard.js +31 -9
- package/es/desktop-dashboard.js +32 -51
- package/es/mobile-dashboard.js +16 -8
- package/es/model/bar-group.js +58 -0
- package/es/model/bar.js +47 -0
- package/es/model/base-model.js +18 -0
- package/es/model/basic-number-card.js +25 -0
- package/es/model/combination.js +48 -0
- package/es/model/compare-bar.js +56 -0
- package/es/model/completeness-group.js +31 -0
- package/es/model/completeness.js +25 -0
- package/es/model/custom-bar.js +25 -0
- package/es/model/dashboard.js +20 -0
- package/es/model/generic-model.js +222 -0
- package/es/model/heat-map.js +33 -0
- package/es/model/horizontal-bar-group.js +55 -0
- package/es/model/horizontal-bar.js +47 -0
- package/es/model/index.js +187 -0
- package/es/model/map.js +38 -0
- package/es/model/mirror.js +33 -0
- package/es/model/pie.js +38 -0
- package/es/model/ring.js +40 -0
- package/es/model/scatter.js +22 -0
- package/es/model/table.js +32 -0
- package/es/model/trend.js +32 -0
- package/es/model/world-map.js +34 -0
- package/es/service/chart-service.js +15 -8
- package/es/service/dashboard-service.js +29 -25
- package/es/stat-editor/chart-name-editor.js +68 -0
- package/es/stat-editor/index.js +75 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +153 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +422 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +203 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +23 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +104 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +334 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +119 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +240 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +331 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +143 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +144 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +214 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +121 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +172 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +366 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +142 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +473 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +182 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +564 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +112 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +87 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +187 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +300 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +113 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +289 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +58 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +359 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +48 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +121 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +143 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +269 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +104 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +366 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +55 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +130 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +374 -0
- package/es/stat-editor/stat-settings/map/map-level.js +72 -0
- package/es/stat-editor/stat-settings/map/map-province-city.js +151 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +108 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +154 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +125 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +24 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +62 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +61 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +35 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +123 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +33 -0
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +29 -0
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +82 -0
- package/es/stat-list/chart-preview.js +20 -19
- package/es/stat-list/index.js +21 -15
- package/es/stat-view/area-chart.js +551 -0
- package/es/stat-view/bar-chart.js +582 -0
- package/es/stat-view/base-chart.js +132 -0
- package/es/stat-view/basic-number-card.js +201 -0
- package/es/stat-view/combination-chart.js +546 -0
- package/es/stat-view/compare-chart.js +483 -0
- package/es/stat-view/completeness-chart.js +390 -0
- package/es/stat-view/custom-bar.js +418 -0
- package/es/stat-view/dashboard-chart.js +266 -0
- package/es/stat-view/heat-map.js +463 -0
- package/es/stat-view/horizontal-bar-chart.js +562 -0
- package/es/stat-view/index.js +156 -47
- package/es/stat-view/line-chart.js +518 -0
- package/es/stat-view/map.js +448 -0
- package/es/stat-view/mirror.js +275 -0
- package/es/stat-view/pie-chart.js +290 -0
- package/es/stat-view/pivot-table/index.js +196 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +156 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +176 -0
- package/es/stat-view/pivot-table/pivot-table-display-name.js +215 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +384 -0
- package/es/stat-view/ring-chart.js +392 -0
- package/es/stat-view/scatter-chart.js +306 -0
- package/es/stat-view/treemap-chart.js +253 -0
- package/es/stat-view/trend-chart.js +249 -0
- package/es/stat-view/world-map.js +431 -0
- package/es/tabs/tab.js +2 -2
- package/es/utils/basic-chart-utils.js +29 -0
- package/es/utils/cell-format.js +115 -0
- package/es/utils/collaborator.js +50 -0
- package/es/utils/color-utils.js +134 -0
- package/es/utils/column-utils.js +110 -0
- package/es/utils/column.js +20 -0
- package/es/utils/common-utils.js +352 -2
- package/es/utils/date-format.js +71 -0
- package/es/utils/export-table-utils.js +69 -0
- package/es/utils/index.js +89 -12
- package/es/utils/map.js +114 -0
- package/es/utils/model.js +19 -0
- package/es/utils/row-utils.js +134 -0
- package/es/utils/search.js +73 -0
- package/es/utils/sql-utils.js +359 -0
- package/es/utils/stat-utils.js +351 -0
- package/es/utils/trend-utils.js +135 -0
- package/package.json +8 -6
- package/es/components/dialog/chart-edit-dialog.js +0 -93
- package/es/components/dtable-popover.js +0 -97
- package/es/components/dtable-search-input.js +0 -135
- package/es/components/index.js +0 -41
- package/es/components/loading.js +0 -15
- package/es/components/modal-portal.js +0 -26
- package/es/model/conver-statItem.js +0 -124
package/es/dashboard.js
CHANGED
|
@@ -15,6 +15,8 @@ var _chartService = _interopRequireDefault(require("./service/chart-service"));
|
|
|
15
15
|
var _mapJson = require("./service/map-json");
|
|
16
16
|
var _desktopDashboard = _interopRequireDefault(require("./desktop-dashboard"));
|
|
17
17
|
var _mobileDashboard = _interopRequireDefault(require("./mobile-dashboard"));
|
|
18
|
+
var _threadManager = _interopRequireDefault(require("./calculator/thread-manager"));
|
|
19
|
+
var _calculator = _interopRequireDefault(require("./calculator"));
|
|
18
20
|
var _utils = require("./utils");
|
|
19
21
|
var _commonUtils = require("./utils/common-utils");
|
|
20
22
|
var _constants = require("./constants");
|
|
@@ -37,7 +39,6 @@ class DashBoard extends _react.Component {
|
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
this.onLocalDTableChanged = value => {
|
|
40
|
-
console.log('onLocalDTableChanged');
|
|
41
42
|
if (this.updatingLocalStatistics) {
|
|
42
43
|
// it's unnecessary to notify data changed during update statistics
|
|
43
44
|
this.value = value;
|
|
@@ -49,7 +50,6 @@ class DashBoard extends _react.Component {
|
|
|
49
50
|
});
|
|
50
51
|
};
|
|
51
52
|
this.onServerDTableChanged = value => {
|
|
52
|
-
console.log('onServerDTableChanged', value);
|
|
53
53
|
this.onDTableChanged({
|
|
54
54
|
value
|
|
55
55
|
});
|
|
@@ -75,10 +75,23 @@ class DashBoard extends _react.Component {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
this.initDashboard = () => {
|
|
78
|
+
const {
|
|
79
|
+
username,
|
|
80
|
+
userId,
|
|
81
|
+
userDepartmentIdsMap
|
|
82
|
+
} = window.dtable;
|
|
78
83
|
const value = this.value;
|
|
84
|
+
this.chartCalculator = new _calculator.default({
|
|
85
|
+
username,
|
|
86
|
+
userId,
|
|
87
|
+
userDepartmentIdsMap,
|
|
88
|
+
value,
|
|
89
|
+
statisticThreadManager: this.statisticThreadManager
|
|
90
|
+
});
|
|
79
91
|
this.dashboardService = new _dashboardService.default({
|
|
80
92
|
value,
|
|
81
93
|
defaultDashboardName: this.defaultDashboardName,
|
|
94
|
+
chartCalculator: this.chartCalculator,
|
|
82
95
|
chartService: this.chartService,
|
|
83
96
|
updateStatistics: this.props.updateStatistics,
|
|
84
97
|
deletePluginSettings: this.props.deletePluginSettings
|
|
@@ -111,6 +124,10 @@ class DashBoard extends _react.Component {
|
|
|
111
124
|
border_color: customColor.BORDER_COLOR
|
|
112
125
|
}))];
|
|
113
126
|
};
|
|
127
|
+
this.clearCalculations = () => {
|
|
128
|
+
this.statisticThreadManager.clearQueue();
|
|
129
|
+
this.statisticThreadManager.terminateWorkers();
|
|
130
|
+
};
|
|
114
131
|
this.getSelectedDashboardIdxFromLocal = key => {
|
|
115
132
|
const {
|
|
116
133
|
dtableUuid
|
|
@@ -163,6 +180,7 @@ class DashBoard extends _react.Component {
|
|
|
163
180
|
this.selectDashboard = selectedDashboardIdx => {
|
|
164
181
|
this.disabledUpdateLayout = true;
|
|
165
182
|
this.setSelectedDashboardIdx(selectedDashboardIdx);
|
|
183
|
+
this.clearCalculations();
|
|
166
184
|
this.setState({
|
|
167
185
|
selectedDashboardIdx
|
|
168
186
|
});
|
|
@@ -193,6 +211,7 @@ class DashBoard extends _react.Component {
|
|
|
193
211
|
dashboard
|
|
194
212
|
}
|
|
195
213
|
});
|
|
214
|
+
this.clearCalculations();
|
|
196
215
|
const selectedDashboardIdx = updatedStatistics.length - 1;
|
|
197
216
|
this.setSelectedDashboardIdx(selectedDashboardIdx);
|
|
198
217
|
this.updateStatistics({
|
|
@@ -233,6 +252,7 @@ class DashBoard extends _react.Component {
|
|
|
233
252
|
}
|
|
234
253
|
});
|
|
235
254
|
this.setSelectedDashboardIdx(nextSelectedDashboardIdx);
|
|
255
|
+
this.clearCalculations();
|
|
236
256
|
this.updateStatistics({
|
|
237
257
|
statistics: updatedStatistics,
|
|
238
258
|
selectedDashboardIdx: nextSelectedDashboardIdx
|
|
@@ -281,7 +301,7 @@ class DashBoard extends _react.Component {
|
|
|
281
301
|
selectedDashboardIdx
|
|
282
302
|
} = this.state;
|
|
283
303
|
const dashboard = statistics[selectedDashboardIdx];
|
|
284
|
-
const fromChart = dashboard && dashboard.stat_items.find(chart => chart.
|
|
304
|
+
const fromChart = dashboard && dashboard.stat_items.find(chart => chart._id === chartId);
|
|
285
305
|
if (!fromChart) return;
|
|
286
306
|
const newChart = this.chartService.getCopiedChart({
|
|
287
307
|
dashboard,
|
|
@@ -317,6 +337,9 @@ class DashBoard extends _react.Component {
|
|
|
317
337
|
});
|
|
318
338
|
};
|
|
319
339
|
this.addChart = chart => {
|
|
340
|
+
if (!this.chartCalculator.isValidChart(chart)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
320
343
|
this.disabledUpdateLayout = true;
|
|
321
344
|
const updatedStatistics = this.dashboardService.update({
|
|
322
345
|
action: _constants.DASHBOARD_ACTION_TYPE.ADD_CHART,
|
|
@@ -328,9 +351,8 @@ class DashBoard extends _react.Component {
|
|
|
328
351
|
this.updateStatistics({
|
|
329
352
|
statistics: updatedStatistics
|
|
330
353
|
}, () => {
|
|
331
|
-
var _document$getElementB;
|
|
332
354
|
// make the copied stat item display in the view
|
|
333
|
-
|
|
355
|
+
document.getElementById(chart._id).scrollIntoView(true);
|
|
334
356
|
});
|
|
335
357
|
};
|
|
336
358
|
this.modifyChart = chart => {
|
|
@@ -402,6 +424,7 @@ class DashBoard extends _react.Component {
|
|
|
402
424
|
this.chartService = new _chartService.default({
|
|
403
425
|
defaultChartTitle
|
|
404
426
|
});
|
|
427
|
+
this.statisticThreadManager = new _threadManager.default((navigator.hardwareConcurrency || 4) - 1);
|
|
405
428
|
this.mapJsonService = new _mapJson.MapJsonService({
|
|
406
429
|
mediaUrl
|
|
407
430
|
});
|
|
@@ -431,6 +454,7 @@ class DashBoard extends _react.Component {
|
|
|
431
454
|
this.unsubscribeLocalDtableChanged();
|
|
432
455
|
this.unsubscribeRemoteDtableChange();
|
|
433
456
|
this.unsubscribeRefreshCharts();
|
|
457
|
+
this.clearCalculations();
|
|
434
458
|
}
|
|
435
459
|
render() {
|
|
436
460
|
const {
|
|
@@ -450,11 +474,10 @@ class DashBoard extends _react.Component {
|
|
|
450
474
|
dtableChangedTime: dtableChangedTime,
|
|
451
475
|
statistics: statistics,
|
|
452
476
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
477
|
+
chartCalculator: this.chartCalculator,
|
|
453
478
|
labelColorConfigs: this.labelColorConfigs,
|
|
454
479
|
eventBus: eventBus,
|
|
455
480
|
onCloseDashboard: this.props.onCloseStatistic,
|
|
456
|
-
getViewRows: this.props.getViewRows,
|
|
457
|
-
getTableFormulaResults: this.props.getTableFormulaResults,
|
|
458
481
|
selectDashboard: this.selectDashboard,
|
|
459
482
|
addDashboard: this.addDashboard,
|
|
460
483
|
renameDashboard: this.renameDashboard,
|
|
@@ -468,13 +491,12 @@ class DashBoard extends _react.Component {
|
|
|
468
491
|
statistics: statistics,
|
|
469
492
|
editingChart: editingChart,
|
|
470
493
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
494
|
+
chartCalculator: this.chartCalculator,
|
|
471
495
|
labelColorConfigs: this.labelColorConfigs,
|
|
472
496
|
eventBus: eventBus,
|
|
473
497
|
getActiveTable: this.getActiveTable,
|
|
474
498
|
getActiveView: this.getActiveView,
|
|
475
499
|
onCloseDashboard: this.props.onCloseStatistic,
|
|
476
|
-
getViewRows: this.props.getViewRows,
|
|
477
|
-
getTableFormulaResults: this.props.getTableFormulaResults,
|
|
478
500
|
selectDashboard: this.selectDashboard,
|
|
479
501
|
modifyColorTheme: this.modifyColorTheme,
|
|
480
502
|
addDashboard: this.addDashboard,
|
package/es/desktop-dashboard.js
CHANGED
|
@@ -10,13 +10,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _reactstrap = require("reactstrap");
|
|
12
12
|
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
13
|
-
var _seaChart = require("sea-chart");
|
|
14
13
|
var _tabs = _interopRequireDefault(require("./tabs"));
|
|
15
14
|
var _statList = _interopRequireDefault(require("./stat-list"));
|
|
16
15
|
var _colorThemeDialog = _interopRequireDefault(require("./components/dialog/color-theme-dialog"));
|
|
17
|
-
var
|
|
16
|
+
var _chartAdditionEditDialog = _interopRequireDefault(require("./components/dialog/chart-addition-edit-dialog"));
|
|
18
17
|
var _statisticRecordDialog = _interopRequireDefault(require("./components/dialog/statistic-record-dialog"));
|
|
19
|
-
var _dtableDbApi = _interopRequireDefault(require("./api/dtable-db-api"));
|
|
20
18
|
var _chartService = _interopRequireDefault(require("./service/chart-service"));
|
|
21
19
|
var _constants = require("./constants");
|
|
22
20
|
var _icon = _interopRequireDefault(require("./assets/images/icon.png"));
|
|
@@ -36,24 +34,10 @@ class DesktopDashboard extends _react.Component {
|
|
|
36
34
|
isFullScreen: !this.state.isFullScreen
|
|
37
35
|
});
|
|
38
36
|
};
|
|
39
|
-
this.
|
|
37
|
+
this.onToggleChartAddition = () => {
|
|
40
38
|
this.setState({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
this.onToggleEditChart = chartId => {
|
|
45
|
-
let editingChart = null;
|
|
46
|
-
if (chartId) {
|
|
47
|
-
const {
|
|
48
|
-
statistics,
|
|
49
|
-
selectedDashboardIdx
|
|
50
|
-
} = this.props;
|
|
51
|
-
const statistic = statistics[selectedDashboardIdx];
|
|
52
|
-
editingChart = statistic && statistic.stat_items.find(chart => chart.config._id === chartId);
|
|
53
|
-
}
|
|
54
|
-
this.setState({
|
|
55
|
-
isShowChartEditDialog: !this.state.isShowChartEditDialog,
|
|
56
|
-
editingChart
|
|
39
|
+
isShowChartAdditionDialog: !this.state.isShowChartAdditionDialog,
|
|
40
|
+
editingChart: null
|
|
57
41
|
});
|
|
58
42
|
};
|
|
59
43
|
this.toggleThemeMode = () => {
|
|
@@ -64,11 +48,16 @@ class DesktopDashboard extends _react.Component {
|
|
|
64
48
|
this.saveThemeMode2LocalStorage(theme);
|
|
65
49
|
});
|
|
66
50
|
};
|
|
67
|
-
this.
|
|
68
|
-
const
|
|
51
|
+
this.onToggleEditChart = chartId => {
|
|
52
|
+
const {
|
|
53
|
+
statistics,
|
|
54
|
+
selectedDashboardIdx
|
|
55
|
+
} = this.props;
|
|
56
|
+
const statistic = statistics[selectedDashboardIdx];
|
|
57
|
+
const editingChart = statistic && statistic.stat_items.find(chart => chart._id === chartId);
|
|
69
58
|
this.setState({
|
|
70
|
-
|
|
71
|
-
editingChart
|
|
59
|
+
isShowChartAdditionDialog: true,
|
|
60
|
+
editingChart
|
|
72
61
|
});
|
|
73
62
|
};
|
|
74
63
|
this.onCloseDashboard = () => {
|
|
@@ -147,21 +136,11 @@ class DesktopDashboard extends _react.Component {
|
|
|
147
136
|
this.state = {
|
|
148
137
|
theme: this.getThemeModeFromLocalStorage() || '',
|
|
149
138
|
isFullScreen: false,
|
|
150
|
-
|
|
151
|
-
isShowChartAddDialog: false,
|
|
139
|
+
isShowChartAdditionDialog: false,
|
|
152
140
|
isShowColorThemeDialog: false,
|
|
153
141
|
editingChart: null,
|
|
154
142
|
chartRecordsParams: null
|
|
155
143
|
};
|
|
156
|
-
this.api = {
|
|
157
|
-
sqlQuery: this.sqlQuery,
|
|
158
|
-
getViewRows: this.props.getViewRows,
|
|
159
|
-
getTableFormulaResults: this.props.getTableFormulaResults,
|
|
160
|
-
queryUsers: window.app.queryUsers || (() => {})
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
async sqlQuery(sql) {
|
|
164
|
-
return _dtableDbApi.default.sqlQuery(sql);
|
|
165
144
|
}
|
|
166
145
|
render() {
|
|
167
146
|
const {
|
|
@@ -172,14 +151,15 @@ class DesktopDashboard extends _react.Component {
|
|
|
172
151
|
colorThemeName,
|
|
173
152
|
statistics,
|
|
174
153
|
selectedDashboardIdx,
|
|
154
|
+
chartCalculator,
|
|
155
|
+
labelColorConfigs,
|
|
175
156
|
eventBus
|
|
176
157
|
} = this.props;
|
|
177
158
|
const {
|
|
178
159
|
theme,
|
|
179
160
|
isFullScreen,
|
|
180
161
|
editingChart,
|
|
181
|
-
chartRecordsParams
|
|
182
|
-
isShowChartAddDialog
|
|
162
|
+
chartRecordsParams
|
|
183
163
|
} = this.state;
|
|
184
164
|
const darkMode = theme === _constants.THEME_NAME_MAP.DARK;
|
|
185
165
|
const statistic = statistics[selectedDashboardIdx];
|
|
@@ -215,7 +195,7 @@ class DesktopDashboard extends _react.Component {
|
|
|
215
195
|
className: "statistic-header-operators d-flex align-items-center"
|
|
216
196
|
}, !isTableReadOnly && /*#__PURE__*/_react.default.createElement("button", {
|
|
217
197
|
className: "btn btn-secondary op-item add-stat",
|
|
218
|
-
onClick: this.
|
|
198
|
+
onClick: this.onToggleChartAddition
|
|
219
199
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
220
200
|
className: "op-item-icon add-chart-icon dtable-font dtable-icon-add-table"
|
|
221
201
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -264,12 +244,12 @@ class DesktopDashboard extends _react.Component {
|
|
|
264
244
|
theme: theme,
|
|
265
245
|
colorThemeName: colorThemeName,
|
|
266
246
|
statItems: statItems,
|
|
247
|
+
chartCalculator: chartCalculator,
|
|
267
248
|
eventBus: eventBus,
|
|
268
|
-
api: this.api,
|
|
269
|
-
getValue: getValue,
|
|
270
249
|
getOtherStatistics: this.getOtherStatistics,
|
|
271
250
|
getTableById: this.props.getTableById,
|
|
272
251
|
getTables: this.props.getTables,
|
|
252
|
+
queryMapJson: this.props.queryMapJson,
|
|
273
253
|
copyChart: this.props.copyChart,
|
|
274
254
|
moveChartToView: this.props.moveChartToView,
|
|
275
255
|
deleteChart: this.props.deleteChart,
|
|
@@ -277,22 +257,23 @@ class DesktopDashboard extends _react.Component {
|
|
|
277
257
|
onToggleEditChart: this.onToggleEditChart,
|
|
278
258
|
onCloseDashboard: this.props.onCloseDashboard,
|
|
279
259
|
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
280
|
-
})), this.state.
|
|
281
|
-
|
|
260
|
+
})), this.state.isShowChartAdditionDialog && /*#__PURE__*/_react.default.createElement(_chartAdditionEditDialog.default, {
|
|
261
|
+
dtableChangedTime: dtableChangedTime,
|
|
282
262
|
colorThemeName: colorThemeName,
|
|
283
263
|
editingChart: editingChart,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
264
|
+
labelColorConfigs: labelColorConfigs,
|
|
265
|
+
chartCalculator: chartCalculator,
|
|
266
|
+
eventBus: eventBus,
|
|
267
|
+
getTables: this.props.getTables,
|
|
268
|
+
getViews: this.props.getViews,
|
|
269
|
+
getTableById: this.props.getTableById,
|
|
270
|
+
queryMapJson: this.props.queryMapJson,
|
|
271
|
+
generateChart: this.generateChart,
|
|
272
|
+
hideChartAdditionDialog: this.onToggleChartAddition,
|
|
273
|
+
getConvertedChart: this.props.getConvertedChart,
|
|
288
274
|
addChart: this.props.addChart,
|
|
289
275
|
modifyChart: this.props.modifyChart,
|
|
290
|
-
onToggleEditChart: this.onToggleEditChart,
|
|
291
276
|
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
292
|
-
}), isShowChartAddDialog && /*#__PURE__*/_react.default.createElement(_seaChart.TypesDialog, {
|
|
293
|
-
type: "",
|
|
294
|
-
onToggle: this.onToggleAddChart,
|
|
295
|
-
onChange: this.onTypeChange
|
|
296
277
|
}), this.state.isShowColorThemeDialog && /*#__PURE__*/_react.default.createElement(_colorThemeDialog.default, {
|
|
297
278
|
colorThemeName: colorThemeName,
|
|
298
279
|
onToggleColorThemeDialog: this.onToggleColorThemeDialog,
|
package/es/mobile-dashboard.js
CHANGED
|
@@ -10,7 +10,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
11
|
var _tabs = _interopRequireDefault(require("./tabs"));
|
|
12
12
|
var _statView = _interopRequireDefault(require("./stat-view"));
|
|
13
|
-
var _seaChart = require("sea-chart");
|
|
14
13
|
var _constants = require("./constants");
|
|
15
14
|
var _icon = _interopRequireDefault(require("./assets/images/icon.png"));
|
|
16
15
|
var _mobileDashboardModule = _interopRequireDefault(require("./assets/css/mobile-dashboard.module.css"));
|
|
@@ -26,9 +25,13 @@ class MobileDashboard extends _react.Component {
|
|
|
26
25
|
render() {
|
|
27
26
|
const {
|
|
28
27
|
getTableById,
|
|
28
|
+
dtableChangedTime,
|
|
29
29
|
colorThemeName,
|
|
30
30
|
statistics,
|
|
31
|
-
selectedDashboardIdx
|
|
31
|
+
selectedDashboardIdx,
|
|
32
|
+
chartCalculator,
|
|
33
|
+
labelColorConfigs,
|
|
34
|
+
eventBus
|
|
32
35
|
} = this.props;
|
|
33
36
|
const statistic = statistics[selectedDashboardIdx];
|
|
34
37
|
const {
|
|
@@ -67,12 +70,10 @@ class MobileDashboard extends _react.Component {
|
|
|
67
70
|
}, statItems.map(statItem => {
|
|
68
71
|
const {
|
|
69
72
|
_id,
|
|
70
|
-
type
|
|
71
|
-
} = statItem.config;
|
|
72
|
-
const {
|
|
73
|
+
type,
|
|
73
74
|
name
|
|
74
|
-
} = statItem
|
|
75
|
-
const showStatName = !(type ===
|
|
75
|
+
} = statItem;
|
|
76
|
+
const showStatName = !(type === _constants.STAT_TYPE.BASIC_NUMBER_CARD || type === _constants.STAT_TYPE.DASHBOARD);
|
|
76
77
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
78
|
key: "mobile-statistic-chart-".concat(_id),
|
|
78
79
|
className: _mobileDashboardModule.default['mobile-statistic-chart-wrapper']
|
|
@@ -81,10 +82,17 @@ class MobileDashboard extends _react.Component {
|
|
|
81
82
|
}, showStatName && name), /*#__PURE__*/_react.default.createElement("div", {
|
|
82
83
|
className: _mobileDashboardModule.default['mobile-statistic-chart-container']
|
|
83
84
|
}, /*#__PURE__*/_react.default.createElement(_statView.default, {
|
|
85
|
+
isPreview: true,
|
|
86
|
+
isEnlarge: false,
|
|
87
|
+
dtableChangedTime: dtableChangedTime,
|
|
84
88
|
theme: _constants.THEME_NAME_MAP.LIGHT,
|
|
85
89
|
colorThemeName: colorThemeName,
|
|
86
90
|
statItem: statItem,
|
|
87
|
-
|
|
91
|
+
chartCalculator: chartCalculator,
|
|
92
|
+
labelColorConfigs: labelColorConfigs,
|
|
93
|
+
eventBus: eventBus,
|
|
94
|
+
getTableById: getTableById,
|
|
95
|
+
queryMapJson: this.props.queryMapJson
|
|
88
96
|
})));
|
|
89
97
|
})));
|
|
90
98
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
9
|
+
var _commonUtils = require("../utils/common-utils");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class BarGroup extends _baseModel.default {
|
|
12
|
+
constructor(object) {
|
|
13
|
+
super(object);
|
|
14
|
+
|
|
15
|
+
// x data
|
|
16
|
+
this.x_axis_column_key = object.x_axis_column_key;
|
|
17
|
+
this.x_axis_date_granularity = object.x_axis_date_granularity;
|
|
18
|
+
this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity;
|
|
19
|
+
this.x_axis_include_empty = object.x_axis_include_empty;
|
|
20
|
+
|
|
21
|
+
// x style
|
|
22
|
+
this.show_x_axis_label = (0, _commonUtils.isBoolean)(object.show_x_axis_label) ? object.show_x_axis_label : false;
|
|
23
|
+
this.x_axis_label_position = object.x_axis_label_position;
|
|
24
|
+
|
|
25
|
+
// y data
|
|
26
|
+
this.y_axis_summary_type = object.y_axis_summary_type || _constants.SUMMARY_TYPE.COUNT;
|
|
27
|
+
this.y_axis_column_key = object.y_axis_column_key;
|
|
28
|
+
this.y_axis_summary_method = object.y_axis_summary_method;
|
|
29
|
+
if (this.y_axis_summary_method === _constants.SUMMARY_METHOD_MAP.Row_count) {
|
|
30
|
+
this.y_axis_summary_method = _constants.SUMMARY_METHOD_MAP.Max;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// y style
|
|
34
|
+
this.y_axis_label_position = (0, _commonUtils.isBoolean)(object.y_axis_label_position) ? object.y_axis_label_position : false;
|
|
35
|
+
this.show_y_axis_label = object.show_y_axis_label;
|
|
36
|
+
this.y_axis_label_color = object.y_axis_label_color;
|
|
37
|
+
this.y_axis_use_stack = object.y_axis_use_stack;
|
|
38
|
+
if (this.type === _constants.STAT_TYPE.BAR_STACK) {
|
|
39
|
+
this.y_axis_use_stack = true;
|
|
40
|
+
}
|
|
41
|
+
this.y_axis_auto_range = object.y_axis_auto_range;
|
|
42
|
+
this.y_axis_max = object.y_axis_max;
|
|
43
|
+
this.y_axis_min = object.y_axis_min;
|
|
44
|
+
|
|
45
|
+
// group
|
|
46
|
+
this.column_groupby_column_key = object.column_groupby_column_key;
|
|
47
|
+
this.column_groupby_date_granularity = object.column_groupby_date_granularity;
|
|
48
|
+
this.column_groupby_geolocation_granularity = object.column_groupby_geolocation_granularity;
|
|
49
|
+
this.column_groupby_multiple_numeric_column = object.column_groupby_multiple_numeric_column;
|
|
50
|
+
this.column_groupby_numeric_columns = object.column_groupby_numeric_columns;
|
|
51
|
+
this.display_each_block_data = object.display_each_block_data;
|
|
52
|
+
this.title_name = object.title_name;
|
|
53
|
+
this.label_font_size = object.label_font_size;
|
|
54
|
+
this.display_data = object.display_data;
|
|
55
|
+
this.sort_type = object.sort_type;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = BarGroup;
|
package/es/model/bar.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
9
|
+
var _commonUtils = require("../utils/common-utils");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class Bar extends _baseModel.default {
|
|
12
|
+
constructor(object) {
|
|
13
|
+
super(object);
|
|
14
|
+
|
|
15
|
+
// x data
|
|
16
|
+
this.x_axis_column_key = object.x_axis_column_key;
|
|
17
|
+
this.x_axis_date_granularity = object.x_axis_date_granularity;
|
|
18
|
+
this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity;
|
|
19
|
+
this.x_axis_include_empty = object.x_axis_include_empty;
|
|
20
|
+
|
|
21
|
+
// x style
|
|
22
|
+
this.show_x_axis_label = (0, _commonUtils.isBoolean)(object.show_x_axis_label) ? object.show_x_axis_label : false;
|
|
23
|
+
this.x_axis_label_position = object.x_axis_label_position;
|
|
24
|
+
|
|
25
|
+
// y data
|
|
26
|
+
this.y_axis_summary_type = object.y_axis_summary_type || _constants.SUMMARY_TYPE.COUNT;
|
|
27
|
+
this.y_axis_column_key = object.y_axis_column_key;
|
|
28
|
+
this.y_axis_summary_method = object.y_axis_summary_method;
|
|
29
|
+
if (this.y_axis_summary_method === _constants.SUMMARY_METHOD_MAP.Row_count) {
|
|
30
|
+
this.y_axis_summary_method = _constants.SUMMARY_METHOD_MAP.Max;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// y style
|
|
34
|
+
this.color_option = object.color_option;
|
|
35
|
+
this.y_axis_label_color = object.y_axis_label_color;
|
|
36
|
+
this.y_axis_label_color_rules = object.y_axis_label_color_rules;
|
|
37
|
+
this.show_y_axis_label = (0, _commonUtils.isBoolean)(object.show_y_axis_label) ? object.show_y_axis_label : false;
|
|
38
|
+
this.y_axis_label_position = object.y_axis_label_position;
|
|
39
|
+
this.y_axis_auto_range = object.y_axis_auto_range;
|
|
40
|
+
this.y_axis_min = object.y_axis_min;
|
|
41
|
+
this.y_axis_max = object.y_axis_max;
|
|
42
|
+
this.sort_type = object.sort_type;
|
|
43
|
+
this.label_font_size = object.label_font_size;
|
|
44
|
+
this.display_data = object.display_data;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = Bar;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
class BaseModel {
|
|
8
|
+
constructor(object) {
|
|
9
|
+
this._id = object._id || null;
|
|
10
|
+
this.name = object.name || null;
|
|
11
|
+
this.type = object.type || null;
|
|
12
|
+
this.table_id = object.table_id || null;
|
|
13
|
+
this.view_id = object.view_id || null;
|
|
14
|
+
this.layout = object.layout;
|
|
15
|
+
this.chart_color_theme = object.chart_color_theme || 'theme0';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = BaseModel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dtableUtils = require("dtable-utils");
|
|
9
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class BasicNumberCard extends _baseModel.default {
|
|
12
|
+
constructor(object, table) {
|
|
13
|
+
super(object);
|
|
14
|
+
this.name = null;
|
|
15
|
+
this.numeric_column = object.x_axis_column_key;
|
|
16
|
+
if (this.numeric_column) {
|
|
17
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, this.numeric_column);
|
|
18
|
+
if (!(0, _dtableUtils.isNumericColumn)(column)) {
|
|
19
|
+
this.numeric_column = null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
this.summary_method = object.y_axis_summary_method || _constants.SUMMARY_METHOD_MAP.Row_count;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = BasicNumberCard;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
9
|
+
var _commonUtils = require("../utils/common-utils");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class Combination extends _baseModel.default {
|
|
12
|
+
constructor(object) {
|
|
13
|
+
super(object);
|
|
14
|
+
|
|
15
|
+
// x data
|
|
16
|
+
this.x_axis_column_key = object.x_axis_column_key;
|
|
17
|
+
this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity;
|
|
18
|
+
this.x_axis_date_granularity = object.x_axis_date_granularity;
|
|
19
|
+
this.x_axis_include_empty = object.x_axis_include_empty;
|
|
20
|
+
|
|
21
|
+
// y left/right data/style
|
|
22
|
+
this.y_axis_left_summary_type = object.y_axis_left_summary_type || _constants.STATISTICS_COUNT_TYPE.COUNT;
|
|
23
|
+
this.y_axis_right_summary_type = object.y_axis_right_summary_type || _constants.STATISTICS_COUNT_TYPE.COUNT;
|
|
24
|
+
this.y_axis_left_summary_method = object.y_axis_left_summary_method;
|
|
25
|
+
this.y_axis_right_summary_method = object.y_axis_right_summary_method;
|
|
26
|
+
this.y_axis_left_summary_column = object.y_axis_left__summary_column;
|
|
27
|
+
this.y_axis_right_summary_column = object.y_axis_right_summary_column;
|
|
28
|
+
this.y_axis_left_group_by_multiple_numeric_column = (0, _commonUtils.isBoolean)(object.y_axis_left_group_by_multiple_numeric_column) ? object.y_axis_left_group_by_multiple_numeric_column : false;
|
|
29
|
+
this.y_axis_left_group_by_numeric_columns = object.y_axis_left_group_by_numeric_columns;
|
|
30
|
+
this.y_axis_left_color = object.y_axis_left_color || _constants.LABEL_COLORS[0];
|
|
31
|
+
this.y_axis_right_color = object.y_axis_right_color || _constants.LABEL_COLORS[1];
|
|
32
|
+
this.show_x_axis_label = object.show_x_axis_label;
|
|
33
|
+
this.x_axis_label_position = object.x_axis_label_position;
|
|
34
|
+
this.show_y_axis_left_label = (0, _commonUtils.isBoolean)(object.show_y_axis_left_label) ? object.show_y_axis_left_label : false;
|
|
35
|
+
this.show_y_axis_right_label = (0, _commonUtils.isBoolean)(object.show_y_axis_right_label) ? object.show_y_axis_right_label : false;
|
|
36
|
+
this.y_axis_left_label_position = object.y_axis_left_label_position;
|
|
37
|
+
this.y_axis_right_label_position = object.y_axis_right_label_position;
|
|
38
|
+
this.y_axis_auto_range_left = object.y_axis_auto_range_left;
|
|
39
|
+
this.y_axis_min_left = object.y_axis_min_left;
|
|
40
|
+
this.y_axis_max_left = object.y_axis_max_left;
|
|
41
|
+
this.y_axis_auto_range_right = object.y_axis_auto_range_right;
|
|
42
|
+
this.y_axis_min_right = object.y_axis_min_right;
|
|
43
|
+
this.y_axis_max_right = object.y_axis_max_right;
|
|
44
|
+
this.display_data = object.display_data;
|
|
45
|
+
this.label_font_size = object.label_font_size;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = Combination;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dtableUtils = require("dtable-utils");
|
|
9
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
10
|
+
var _commonUtils = require("../utils/common-utils");
|
|
11
|
+
var _columnUtils = require("../utils/column-utils");
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
class CompareBar extends _baseModel.default {
|
|
14
|
+
constructor(object, table) {
|
|
15
|
+
super(object);
|
|
16
|
+
|
|
17
|
+
// x data
|
|
18
|
+
this.x_axis_column_key = object.x_axis_column_key;
|
|
19
|
+
if (this.x_axis_column_key) {
|
|
20
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, this.x_axis_column_key);
|
|
21
|
+
if (!(0, _columnUtils.isStatisticDateColumn)(column)) {
|
|
22
|
+
this.x_axis_column_key = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
this.x_axis_date_granularity = object.x_axis_date_granularity || _constants.DATE_GRANULARITY.MONTH;
|
|
26
|
+
this.x_axis_date_range_start = object.x_axis_date_range_start;
|
|
27
|
+
this.x_axis_date_range_end = object.x_axis_date_range_end;
|
|
28
|
+
this.x_axis_compared_date_range_start = object.x_axis_compared_date_range_start;
|
|
29
|
+
this.x_axis_compared_date_range_end = object.x_axis_compared_date_range_end;
|
|
30
|
+
|
|
31
|
+
// x style
|
|
32
|
+
this.show_x_axis_label = (0, _commonUtils.isBoolean)(object.show_x_axis_label) ? object.show_x_axis_label : false;
|
|
33
|
+
this.x_axis_label_position = object.x_axis_label_position;
|
|
34
|
+
|
|
35
|
+
// y data
|
|
36
|
+
this.y_axis_summary_type = object.y_axis_summary_type || _constants.SUMMARY_TYPE.COUNT;
|
|
37
|
+
this.y_axis_column_key = object.y_axis_column_key;
|
|
38
|
+
this.y_axis_summary_method = object.y_axis_summary_method;
|
|
39
|
+
if (this.y_axis_summary_method === _constants.SUMMARY_METHOD_MAP.Row_count) {
|
|
40
|
+
this.y_axis_summary_method = _constants.SUMMARY_METHOD_MAP.Max;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// y style
|
|
44
|
+
this.show_y_axis_label = object.show_y_axis_label;
|
|
45
|
+
this.y_axis_label_position = object.y_axis_label_position;
|
|
46
|
+
this.y_axis_compare_label_color = object.y_axis_compare_label_color;
|
|
47
|
+
this.y_axis_compared_label_color = object.y_axis_compared_label_color;
|
|
48
|
+
this.display_increase = (0, _commonUtils.isBoolean)(object.display_increase) ? object.display_increase : false;
|
|
49
|
+
this.display_increase_percentage = (0, _commonUtils.isBoolean)(object.display_increase_percentage) ? object.display_increase_percentage : false;
|
|
50
|
+
this.increase_display_color = object.increase_display_color;
|
|
51
|
+
this.label_font_size = object.label_font_size;
|
|
52
|
+
this.display_data = object.display_data;
|
|
53
|
+
this.increase_line_color = object.increase_line_color || '#fbd44a';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = CompareBar;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _baseModel = _interopRequireDefault(require("./base-model"));
|
|
9
|
+
var _commonUtils = require("../utils/common-utils");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
class CompletenessGroup extends _baseModel.default {
|
|
12
|
+
constructor(object) {
|
|
13
|
+
super(object);
|
|
14
|
+
this.name_column = object.x_axis_column_key;
|
|
15
|
+
this.target_value_column = object.target_value_column;
|
|
16
|
+
this.target_value_column_summary_method = object.target_value_column_summary_method || _constants.SUMMARY_METHOD_MAP.Row_count;
|
|
17
|
+
this.total_value_column = object.total_value_column;
|
|
18
|
+
this.total_value_column_summary_method = object.total_value_column_summary_method || _constants.SUMMARY_METHOD_MAP.Row_count;
|
|
19
|
+
this.completed_column = object.completed_column;
|
|
20
|
+
this.target_column = object.target_column;
|
|
21
|
+
this.display_percentage = (0, _commonUtils.isBoolean)(object.display_percentage) ? object.display_percentage : true;
|
|
22
|
+
this.group_column = object.column_groupby_column_key;
|
|
23
|
+
this.date_granularity = object.column_groupby_date_granularity;
|
|
24
|
+
this.geolocation_granularity = object.column_groupby_geolocation_granularity;
|
|
25
|
+
this.label_font_size = object.label_font_size;
|
|
26
|
+
this.y_axis_auto_range = object.y_axis_auto_range;
|
|
27
|
+
this.y_axis_max = object.y_axis_max;
|
|
28
|
+
this.y_axis_min = object.y_axis_min;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = CompletenessGroup;
|