dtable-statistic 4.3.4 → 4.3.6
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 +72 -70
- 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 +69 -67
- package/es/utils/trend-utils.js +40 -32
- package/package.json +3 -3
package/es/utils/trend-utils.js
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getCompareDate = getCompareDate;
|
|
8
|
+
exports.summaryDurationResult = summaryDurationResult;
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
var _quarterOfYear = _interopRequireDefault(require("dayjs/plugin/quarterOfYear"));
|
|
11
|
+
var _commonUtils = require("./common-utils");
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
_dayjs.default.extend(_quarterOfYear.default);
|
|
14
|
+
function getCompareDate(dateGranularity) {
|
|
15
|
+
const currentDate = (0, _dayjs.default)();
|
|
8
16
|
switch (dateGranularity) {
|
|
9
|
-
case DATE_GRANULARITY.DAY:
|
|
17
|
+
case _constants.DATE_GRANULARITY.DAY:
|
|
10
18
|
{
|
|
11
|
-
const compareDate =
|
|
12
|
-
const comparedDate =
|
|
19
|
+
const compareDate = (0, _dayjs.default)(currentDate).subtract(1, 'days').format('YYYY-MM-DD');
|
|
20
|
+
const comparedDate = (0, _dayjs.default)(currentDate).subtract(2, 'days').format('YYYY-MM-DD');
|
|
13
21
|
return {
|
|
14
22
|
compareDate,
|
|
15
23
|
comparedDate
|
|
16
24
|
};
|
|
17
25
|
}
|
|
18
|
-
case DATE_GRANULARITY.WEEK:
|
|
26
|
+
case _constants.DATE_GRANULARITY.WEEK:
|
|
19
27
|
{
|
|
20
|
-
const currentWeek =
|
|
21
|
-
const compareDate =
|
|
22
|
-
const comparedDate =
|
|
28
|
+
const currentWeek = (0, _dayjs.default)().day(1);
|
|
29
|
+
const compareDate = (0, _dayjs.default)(currentWeek).subtract(1, 'weeks').format('YYYY-MM-DD');
|
|
30
|
+
const comparedDate = (0, _dayjs.default)(currentWeek).subtract(2, 'weeks').format('YYYY-MM-DD');
|
|
23
31
|
return {
|
|
24
32
|
compareDate,
|
|
25
33
|
comparedDate
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
|
-
case DATE_GRANULARITY.MONTH:
|
|
36
|
+
case _constants.DATE_GRANULARITY.MONTH:
|
|
29
37
|
{
|
|
30
|
-
const compareDate =
|
|
31
|
-
const comparedDate =
|
|
38
|
+
const compareDate = (0, _dayjs.default)(currentDate).subtract(1, 'months').format('YYYY-MM');
|
|
39
|
+
const comparedDate = (0, _dayjs.default)(currentDate).subtract(2, 'months').format('YYYY-MM');
|
|
32
40
|
return {
|
|
33
41
|
compareDate,
|
|
34
42
|
comparedDate
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
|
-
case DATE_GRANULARITY.QUARTER:
|
|
45
|
+
case _constants.DATE_GRANULARITY.QUARTER:
|
|
38
46
|
{
|
|
39
|
-
const currentQuarter =
|
|
40
|
-
const currentYear =
|
|
47
|
+
const currentQuarter = (0, _dayjs.default)().quarter();
|
|
48
|
+
const currentYear = (0, _dayjs.default)().year();
|
|
41
49
|
let lastQuarter = currentQuarter - 1;
|
|
42
50
|
let compareDate, comparedDate;
|
|
43
51
|
if (lastQuarter < 1) {
|
|
@@ -58,9 +66,9 @@ export function getCompareDate(dateGranularity) {
|
|
|
58
66
|
comparedDate
|
|
59
67
|
};
|
|
60
68
|
}
|
|
61
|
-
case DATE_GRANULARITY.YEAR:
|
|
69
|
+
case _constants.DATE_GRANULARITY.YEAR:
|
|
62
70
|
{
|
|
63
|
-
const currentYear =
|
|
71
|
+
const currentYear = (0, _dayjs.default)().year();
|
|
64
72
|
return {
|
|
65
73
|
compareDate: currentYear - 1 + '',
|
|
66
74
|
comparedDate: currentYear - 2 + ''
|
|
@@ -72,12 +80,12 @@ export function getCompareDate(dateGranularity) {
|
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
|
|
76
|
-
const currentTime =
|
|
83
|
+
function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
84
|
+
const currentTime = (0, _dayjs.default)();
|
|
77
85
|
const days = duration === 'days_30' ? 30 : 7;
|
|
78
86
|
const endDate = currentTime.format('YYYY-MM-DD');
|
|
79
87
|
const middleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
|
|
80
|
-
const startDate =
|
|
88
|
+
const startDate = (0, _dayjs.default)(middleDate).subtract(days, 'days').format('YYYY-MM-DD');
|
|
81
89
|
let compareValue = [];
|
|
82
90
|
let comparedValue = [];
|
|
83
91
|
if (useDataDb) {
|
|
@@ -98,13 +106,13 @@ export function summaryDurationResult(result, duration, summaryType, summaryMeth
|
|
|
98
106
|
for (let item of result) {
|
|
99
107
|
const key = item[0];
|
|
100
108
|
if (key >= startDate && key < middleDate) {
|
|
101
|
-
if (summaryType === SUMMARY_TYPE.ADVANCED) {
|
|
109
|
+
if (summaryType === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
102
110
|
comparedValue = comparedValue.concat(item[1] || []);
|
|
103
111
|
} else {
|
|
104
112
|
comparedValue.push(item[1]);
|
|
105
113
|
}
|
|
106
114
|
} else if (key >= middleDate && key < endDate) {
|
|
107
|
-
if (summaryType === SUMMARY_TYPE.ADVANCED) {
|
|
115
|
+
if (summaryType === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
108
116
|
compareValue = compareValue.concat(item[1] || []);
|
|
109
117
|
} else {
|
|
110
118
|
compareValue.push(item[1]);
|
|
@@ -112,12 +120,12 @@ export function summaryDurationResult(result, duration, summaryType, summaryMeth
|
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
}
|
|
115
|
-
if (summaryType === SUMMARY_TYPE.ADVANCED) {
|
|
116
|
-
comparedValue = getSummaryResult(comparedValue, summaryMethod);
|
|
117
|
-
compareValue = getSummaryResult(compareValue, summaryMethod);
|
|
123
|
+
if (summaryType === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
124
|
+
comparedValue = (0, _commonUtils.getSummaryResult)(comparedValue, summaryMethod);
|
|
125
|
+
compareValue = (0, _commonUtils.getSummaryResult)(compareValue, summaryMethod);
|
|
118
126
|
} else {
|
|
119
|
-
compareValue = getSummaryResult(compareValue, 'Sum');
|
|
120
|
-
comparedValue = getSummaryResult(comparedValue, 'Sum');
|
|
127
|
+
compareValue = (0, _commonUtils.getSummaryResult)(compareValue, 'Sum');
|
|
128
|
+
comparedValue = (0, _commonUtils.getSummaryResult)(comparedValue, 'Sum');
|
|
121
129
|
}
|
|
122
130
|
return {
|
|
123
131
|
compareValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.6",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"@seafile/seafile-calendar": "0.0.24",
|
|
13
13
|
"comlink": "^4.3.1",
|
|
14
14
|
"dayjs": "1.10.7",
|
|
15
|
-
"dtable-store": "4.3.
|
|
16
|
-
"dtable-web-api": "4.
|
|
15
|
+
"dtable-store": "4.3.6",
|
|
16
|
+
"dtable-web-api": "4.3.5",
|
|
17
17
|
"glamor": "^2.20.40",
|
|
18
18
|
"html2canvas": "^1.4.1",
|
|
19
19
|
"rc-slider": "^9.7.4",
|