sea-chart 2.0.36 → 2.0.38
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/dist/api/index.js +8 -15
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +30 -38
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +12 -19
- package/dist/components/color-popover/color-rules/color-rule.js +26 -34
- package/dist/components/color-popover/color-rules/index.js +7 -15
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +9 -17
- package/dist/components/color-popover/color-rules-popover.js +30 -38
- package/dist/components/color-popover/color-selector-popover.js +12 -20
- package/dist/components/color-setting/color-group-selector.js +13 -21
- package/dist/components/common-add-tool/index.js +8 -15
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +13 -20
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +18 -26
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +40 -48
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +5 -12
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +26 -34
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +55 -65
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +17 -24
- package/dist/components/row-card/row-card-header.js +15 -22
- package/dist/components/row-card/row-card-item.js +35 -43
- package/dist/components/row-card/row-card.js +17 -25
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +14 -21
- package/dist/components/types-dialog/index.js +62 -70
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +142 -271
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +13 -20
- package/dist/editor/index.js +8 -15
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +4 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +15 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +11 -18
- package/dist/model/horizontal-group-bar.js +10 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +12 -19
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +11 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +11 -17
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +63 -71
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +49 -57
- package/dist/settings/basic-number-card/data-settings.js +49 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +19 -27
- package/dist/settings/combination-settings/data-settings.js +55 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +65 -73
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +43 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +52 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +27 -35
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +65 -73
- package/dist/settings/table-element-settings/components/data-filter.js +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +112 -120
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +42 -50
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +19 -27
- package/dist/settings/widgets/basic-summary/index.js +55 -63
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +26 -34
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +51 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +25 -33
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +74 -82
- package/dist/settings/widgets/switch/index.js +9 -16
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +64 -72
- package/dist/utils/cell-format-utils.js +17 -27
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +324 -332
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +77 -84
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +90 -96
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +229 -237
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +19 -31
- package/dist/utils/collaborator.js +6 -15
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +77 -104
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +12 -20
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +54 -221
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +2 -8
- package/dist/utils/options-utils.js +10 -18
- package/dist/utils/row-record-utils.js +166 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +106 -112
- package/dist/utils/sql/column-2-sql-column.js +158 -168
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.js +90 -96
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +45 -53
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +38 -46
- package/dist/view/wrapper/bar-custom-stack.js +39 -47
- package/dist/view/wrapper/bar-group.js +45 -53
- package/dist/view/wrapper/bar-stack.js +48 -56
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +26 -34
- package/dist/view/wrapper/chart-component.js +123 -131
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +40 -48
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +39 -44
- package/dist/view/wrapper/funnel.js +40 -43
- package/dist/view/wrapper/heat-map.js +62 -70
- package/dist/view/wrapper/horizontal-bar-group.js +52 -60
- package/dist/view/wrapper/horizontal-bar-stack.js +47 -55
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +43 -51
- package/dist/view/wrapper/line.js +42 -50
- package/dist/view/wrapper/map-bubble.js +40 -48
- package/dist/view/wrapper/map-world-bubble.js +39 -47
- package/dist/view/wrapper/map-world.js +41 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +44 -52
- package/dist/view/wrapper/ring.js +49 -57
- package/dist/view/wrapper/scatter.js +42 -50
- package/dist/view/wrapper/table/index.js +14 -22
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +53 -61
- package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
- package/dist/view/wrapper/table/two-dimension-table.js +85 -93
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +90 -99
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/record.js +13 -20
- package/dist/view/wrapper/table-element/components/records-body.js +9 -17
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +25 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
- package/dist/view/wrapper/table-element/components/utils.js +6 -16
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +18 -26
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +58 -66
- package/package.json +5 -5
package/dist/utils/sql/index.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "ChartDataSQL", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return _chartDataSql.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "chartColumn2SqlColumn", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return _column2SqlColumn.default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "summaryMethodColumn2SqlColumn", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return _column2SqlColumn.summaryMethodColumn2SqlColumn;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
var _column2SqlColumn = _interopRequireWildcard(require("./column-2-sql-column"));
|
|
27
|
-
var _chartDataSql = _interopRequireDefault(require("./chart-data-sql"));
|
|
1
|
+
import chartColumn2SqlColumn, { summaryMethodColumn2SqlColumn } from './column-2-sql-column';
|
|
2
|
+
import ChartDataSQL from './chart-data-sql';
|
|
3
|
+
export { chartColumn2SqlColumn, summaryMethodColumn2SqlColumn, ChartDataSQL };
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 _constants = require("../constants");
|
|
12
|
-
var _chartUtils = require("./chart-utils");
|
|
13
|
-
var _index = require("./index");
|
|
14
|
-
_dayjs.default.extend(_quarterOfYear.default);
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
|
|
3
|
+
import { CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
import { BaseUtils } from './chart-utils';
|
|
5
|
+
import { getFirstDayOfWeekForGroupby } from './index';
|
|
6
|
+
dayjs.extend(quarterOfYear);
|
|
15
7
|
const dayOfWeekMap = {
|
|
16
8
|
'Sunday': 0,
|
|
17
9
|
'Monday': 1,
|
|
@@ -21,44 +13,44 @@ const dayOfWeekMap = {
|
|
|
21
13
|
'Friday': 5,
|
|
22
14
|
'Saturday': 6
|
|
23
15
|
};
|
|
24
|
-
function getCompareDate(dateGranularity, source) {
|
|
25
|
-
const currentDate = (
|
|
16
|
+
export function getCompareDate(dateGranularity, source) {
|
|
17
|
+
const currentDate = dayjs();
|
|
26
18
|
switch (dateGranularity) {
|
|
27
|
-
case
|
|
19
|
+
case CHART_SUMMARY_TYPE.DAY:
|
|
28
20
|
{
|
|
29
|
-
const compareDate = (
|
|
30
|
-
const comparedDate = (
|
|
21
|
+
const compareDate = dayjs(currentDate).subtract(1, 'days').format('YYYY-MM-DD');
|
|
22
|
+
const comparedDate = dayjs(currentDate).subtract(2, 'days').format('YYYY-MM-DD');
|
|
31
23
|
return {
|
|
32
24
|
compareDate,
|
|
33
25
|
comparedDate
|
|
34
26
|
};
|
|
35
27
|
}
|
|
36
|
-
case
|
|
28
|
+
case CHART_SUMMARY_TYPE.WEEK:
|
|
37
29
|
{
|
|
38
30
|
var _dayOfWeekMap$firstDa;
|
|
39
|
-
const firstDayOfWeek =
|
|
31
|
+
const firstDayOfWeek = getFirstDayOfWeekForGroupby(source);
|
|
40
32
|
const startDayIndex = (_dayOfWeekMap$firstDa = dayOfWeekMap[firstDayOfWeek]) !== null && _dayOfWeekMap$firstDa !== void 0 ? _dayOfWeekMap$firstDa : 0; // default to Sunday
|
|
41
|
-
const currentWeek = (
|
|
42
|
-
const compareDate = (
|
|
43
|
-
const comparedDate = (
|
|
33
|
+
const currentWeek = dayjs().day(startDayIndex);
|
|
34
|
+
const compareDate = dayjs(currentWeek).subtract(1, 'weeks').format('YYYY-MM-DD');
|
|
35
|
+
const comparedDate = dayjs(currentWeek).subtract(2, 'weeks').format('YYYY-MM-DD');
|
|
44
36
|
return {
|
|
45
37
|
compareDate,
|
|
46
38
|
comparedDate
|
|
47
39
|
};
|
|
48
40
|
}
|
|
49
|
-
case
|
|
41
|
+
case CHART_SUMMARY_TYPE.MONTH:
|
|
50
42
|
{
|
|
51
|
-
const compareDate = (
|
|
52
|
-
const comparedDate = (
|
|
43
|
+
const compareDate = dayjs(currentDate).subtract(1, 'months').format('YYYY-MM');
|
|
44
|
+
const comparedDate = dayjs(currentDate).subtract(2, 'months').format('YYYY-MM');
|
|
53
45
|
return {
|
|
54
46
|
compareDate,
|
|
55
47
|
comparedDate
|
|
56
48
|
};
|
|
57
49
|
}
|
|
58
|
-
case
|
|
50
|
+
case CHART_SUMMARY_TYPE.QUARTER:
|
|
59
51
|
{
|
|
60
|
-
const currentQuarter = (
|
|
61
|
-
const currentYear = (
|
|
52
|
+
const currentQuarter = dayjs().quarter();
|
|
53
|
+
const currentYear = dayjs().year();
|
|
62
54
|
let lastQuarter = currentQuarter - 1;
|
|
63
55
|
let compareDate, comparedDate;
|
|
64
56
|
if (lastQuarter < 1) {
|
|
@@ -79,9 +71,9 @@ function getCompareDate(dateGranularity, source) {
|
|
|
79
71
|
comparedDate
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
|
-
case
|
|
74
|
+
case CHART_SUMMARY_TYPE.YEAR:
|
|
83
75
|
{
|
|
84
|
-
const currentYear = (
|
|
76
|
+
const currentYear = dayjs().year();
|
|
85
77
|
return {
|
|
86
78
|
compareDate: currentYear - 1 + '',
|
|
87
79
|
comparedDate: currentYear - 2 + ''
|
|
@@ -93,17 +85,17 @@ function getCompareDate(dateGranularity, source) {
|
|
|
93
85
|
}
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
|
-
function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
97
|
-
const currentTime = (
|
|
88
|
+
export function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
89
|
+
const currentTime = dayjs();
|
|
98
90
|
const days = duration === 'days_30' ? 30 : 7;
|
|
99
91
|
|
|
100
92
|
// set date to start of the day
|
|
101
93
|
const formattedEndDate = currentTime.format('YYYY-MM-DD');
|
|
102
94
|
const formattedMiddleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
|
|
103
|
-
const formattedStartDate = (
|
|
104
|
-
const endDate = (
|
|
105
|
-
const middleDate = (
|
|
106
|
-
const startDate = (
|
|
95
|
+
const formattedStartDate = dayjs(formattedMiddleDate).subtract(days, 'days').format('YYYY-MM-DD');
|
|
96
|
+
const endDate = dayjs(formattedEndDate);
|
|
97
|
+
const middleDate = dayjs(formattedMiddleDate);
|
|
98
|
+
const startDate = dayjs(formattedStartDate);
|
|
107
99
|
let compareValue = [];
|
|
108
100
|
let comparedValue = [];
|
|
109
101
|
if (useDataDb) {
|
|
@@ -111,7 +103,7 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
111
103
|
const days2 = [];
|
|
112
104
|
for (let index = 0; index < result.length; index++) {
|
|
113
105
|
const item = result[index];
|
|
114
|
-
const key = (
|
|
106
|
+
const key = dayjs(item[dbDateKey]);
|
|
115
107
|
if (!key.isValid()) continue;
|
|
116
108
|
if (key >= startDate && key < middleDate) {
|
|
117
109
|
comparedValue.push(item[valueKey]);
|
|
@@ -124,16 +116,16 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
124
116
|
} else {
|
|
125
117
|
// eslint-disable-next-line
|
|
126
118
|
for (let item of result) {
|
|
127
|
-
const key = (
|
|
119
|
+
const key = dayjs(item[0]);
|
|
128
120
|
if (!key.isValid()) continue;
|
|
129
121
|
if (key >= startDate && key < middleDate) {
|
|
130
|
-
if (summaryType ===
|
|
122
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
131
123
|
comparedValue = comparedValue.concat(item[1] || []);
|
|
132
124
|
} else {
|
|
133
125
|
comparedValue.push(item[1]);
|
|
134
126
|
}
|
|
135
127
|
} else if (key >= middleDate && key < endDate) {
|
|
136
|
-
if (summaryType ===
|
|
128
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
137
129
|
compareValue = compareValue.concat(item[1] || []);
|
|
138
130
|
} else {
|
|
139
131
|
compareValue.push(item[1]);
|
|
@@ -141,12 +133,12 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
141
133
|
}
|
|
142
134
|
}
|
|
143
135
|
}
|
|
144
|
-
if (summaryType ===
|
|
145
|
-
comparedValue =
|
|
146
|
-
compareValue =
|
|
136
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
137
|
+
comparedValue = BaseUtils.getSummaryResult(comparedValue, summaryMethod);
|
|
138
|
+
compareValue = BaseUtils.getSummaryResult(compareValue, summaryMethod);
|
|
147
139
|
} else {
|
|
148
|
-
compareValue =
|
|
149
|
-
comparedValue =
|
|
140
|
+
compareValue = BaseUtils.getSummaryResult(compareValue, 'Sum');
|
|
141
|
+
comparedValue = BaseUtils.getSummaryResult(comparedValue, 'Sum');
|
|
150
142
|
}
|
|
151
143
|
return {
|
|
152
144
|
compareValue,
|
package/dist/view/index.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
var _commonConstants = require("../constants/common-constants");
|
|
19
|
-
var _concurrencyManager = _interopRequireDefault(require("../utils/concurrency-manager"));
|
|
20
|
-
var _wrapper = _interopRequireDefault(require("./wrapper"));
|
|
21
|
-
var _title = _interopRequireDefault(require("./title"));
|
|
22
|
-
require("./index.css");
|
|
23
|
-
class View extends _react.default.PureComponent {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import shallowEqual from 'shallowequal';
|
|
5
|
+
import context from '../context';
|
|
6
|
+
import intl from '../intl';
|
|
7
|
+
import eventBus from '../utils/event-bus';
|
|
8
|
+
import { Loading } from '../components';
|
|
9
|
+
import { ChartUtils, BaseUtils } from '../utils/chart-utils';
|
|
10
|
+
import { DEFAULT_LANG, THEME_NAME_MAP } from '../constants';
|
|
11
|
+
import { CommonEventTypes } from '../constants/common-constants';
|
|
12
|
+
import concurrencyManager from '../utils/concurrency-manager';
|
|
13
|
+
import Wrapper from './wrapper';
|
|
14
|
+
import Title from './title';
|
|
15
|
+
import './index.css';
|
|
16
|
+
class View extends React.PureComponent {
|
|
24
17
|
constructor(props) {
|
|
25
18
|
var _this;
|
|
26
19
|
super(props);
|
|
@@ -36,7 +29,7 @@ class View extends _react.default.PureComponent {
|
|
|
36
29
|
const {
|
|
37
30
|
chart
|
|
38
31
|
} = this.props;
|
|
39
|
-
if ((_chart$config = chart.config)
|
|
32
|
+
if (((_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.table_id) && table_id === ((_chart$config2 = chart.config) === null || _chart$config2 === void 0 ? void 0 : _chart$config2.table_id)) {
|
|
40
33
|
// refresh cache calculated before
|
|
41
34
|
const refreshCache = true;
|
|
42
35
|
this.calculateStatistic(true, null, refreshCache);
|
|
@@ -92,16 +85,16 @@ class View extends _react.default.PureComponent {
|
|
|
92
85
|
const {
|
|
93
86
|
data
|
|
94
87
|
} = _this.state;
|
|
95
|
-
const collaborators =
|
|
88
|
+
const collaborators = context.getCollaboratorsFromCache();
|
|
96
89
|
if (isCalculateByView) {
|
|
97
|
-
if (
|
|
98
|
-
|
|
90
|
+
if (BaseUtils.isArchiveView(chart.config, tables)) {
|
|
91
|
+
ChartUtils.calculateChart(chart, {
|
|
99
92
|
tables,
|
|
100
93
|
collaborators,
|
|
101
94
|
isCalculateByView
|
|
102
95
|
}, _this.callback);
|
|
103
96
|
} else {
|
|
104
|
-
|
|
97
|
+
ChartUtils.calculateStaticChart(chart, {
|
|
105
98
|
tables,
|
|
106
99
|
collaborators
|
|
107
100
|
}, {
|
|
@@ -113,7 +106,7 @@ class View extends _react.default.PureComponent {
|
|
|
113
106
|
return;
|
|
114
107
|
}
|
|
115
108
|
if (!isNeedRequestData) {
|
|
116
|
-
|
|
109
|
+
ChartUtils.calculateStaticChart(chart, {
|
|
117
110
|
tables,
|
|
118
111
|
collaborators
|
|
119
112
|
}, {
|
|
@@ -121,7 +114,7 @@ class View extends _react.default.PureComponent {
|
|
|
121
114
|
data_sources: null
|
|
122
115
|
}, _this.callback);
|
|
123
116
|
} else {
|
|
124
|
-
|
|
117
|
+
ChartUtils.calculateChart(chart, {
|
|
125
118
|
tables,
|
|
126
119
|
collaborators,
|
|
127
120
|
isCalculateByView
|
|
@@ -134,10 +127,10 @@ class View extends _react.default.PureComponent {
|
|
|
134
127
|
errorMessage: '',
|
|
135
128
|
tipMessage: ''
|
|
136
129
|
};
|
|
137
|
-
|
|
130
|
+
context.init(props);
|
|
138
131
|
props.onViewRef && props.onViewRef(this);
|
|
139
|
-
const lang =
|
|
140
|
-
|
|
132
|
+
const lang = context.getSetting('lang') || DEFAULT_LANG;
|
|
133
|
+
intl.setLang(lang);
|
|
141
134
|
}
|
|
142
135
|
componentDidMount() {
|
|
143
136
|
var _window$app;
|
|
@@ -147,17 +140,17 @@ class View extends _react.default.PureComponent {
|
|
|
147
140
|
refreshInterval,
|
|
148
141
|
pageId
|
|
149
142
|
} = this.props;
|
|
150
|
-
this.unsubscribeReFreshChart =
|
|
143
|
+
this.unsubscribeReFreshChart = eventBus.subscribe(CommonEventTypes.REFRESH_CHARTS, this.refreshChart);
|
|
151
144
|
|
|
152
145
|
// pageId was used to determine whether the page has changed
|
|
153
146
|
// cancel all the cached request if pageId changed
|
|
154
|
-
if (pageId &&
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
if (pageId && concurrencyManager.currentPageId !== pageId) {
|
|
148
|
+
concurrencyManager.clearPendingRequests();
|
|
149
|
+
concurrencyManager.setCurrentPageId(pageId);
|
|
157
150
|
}
|
|
158
|
-
if ((_window$app = window.app)
|
|
159
|
-
window.app.eventBus.subscribe(
|
|
160
|
-
window.app.eventBus.subscribe(
|
|
151
|
+
if (((_window$app = window.app) === null || _window$app === void 0 ? void 0 : _window$app.eventBus) && isCalculateByView) {
|
|
152
|
+
window.app.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_UPDATED, this.handleModifyRecord);
|
|
153
|
+
window.app.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_DELETED, this.handleDeleteRecord);
|
|
161
154
|
}
|
|
162
155
|
|
|
163
156
|
// refreshInterval is minutes
|
|
@@ -204,13 +197,13 @@ class View extends _react.default.PureComponent {
|
|
|
204
197
|
} else {
|
|
205
198
|
this.refreshTimer && clearInterval(this.refreshTimer);
|
|
206
199
|
}
|
|
207
|
-
|
|
200
|
+
context.api = this.props.api;
|
|
208
201
|
|
|
209
202
|
// pageId was used to determine whether the page has changed
|
|
210
203
|
// cancel all the cached request if pageId changed
|
|
211
|
-
if (pageId &&
|
|
212
|
-
|
|
213
|
-
|
|
204
|
+
if (pageId && concurrencyManager.currentPageId !== pageId) {
|
|
205
|
+
concurrencyManager.clearPendingRequests();
|
|
206
|
+
concurrencyManager.setCurrentPageId(pageId);
|
|
214
207
|
}
|
|
215
208
|
|
|
216
209
|
// universal-apps will not trigger calculation of the chart before the chart config saved
|
|
@@ -222,25 +215,25 @@ class View extends _react.default.PureComponent {
|
|
|
222
215
|
}
|
|
223
216
|
|
|
224
217
|
// version was used to dectect table change in big screen plugin
|
|
225
|
-
if ((
|
|
218
|
+
if (shallowEqual(chart, oldChart) && version === nextVersion) return;
|
|
226
219
|
this.setState({
|
|
227
220
|
isCalculated: false
|
|
228
221
|
}, () => {
|
|
229
|
-
if (
|
|
222
|
+
if (BaseUtils.isChartTypeChange(chart, oldChart)) {
|
|
230
223
|
this.calculateStatistic();
|
|
231
224
|
return;
|
|
232
225
|
}
|
|
233
|
-
if (
|
|
226
|
+
if (BaseUtils.isChartViewChange(chart, oldChart)) {
|
|
234
227
|
this.calculateStatistic();
|
|
235
228
|
return;
|
|
236
229
|
}
|
|
237
|
-
if (
|
|
230
|
+
if (BaseUtils.isChartStyleChange(chart, oldChart)) {
|
|
238
231
|
this.setState({
|
|
239
232
|
isCalculated: true
|
|
240
233
|
});
|
|
241
234
|
return;
|
|
242
235
|
}
|
|
243
|
-
if (
|
|
236
|
+
if (BaseUtils.isChartSortChange(chart, oldChart)) {
|
|
244
237
|
this.calculateStatistic(false);
|
|
245
238
|
return;
|
|
246
239
|
}
|
|
@@ -283,47 +276,47 @@ class View extends _react.default.PureComponent {
|
|
|
283
276
|
const {
|
|
284
277
|
type: chartType
|
|
285
278
|
} = config;
|
|
286
|
-
const validClassName = (
|
|
279
|
+
const validClassName = classnames('sea-chart-formatter', className);
|
|
287
280
|
const tipBackgroundColorClassName = 'sea-chart-formatter-tip';
|
|
288
281
|
if (!isCalculated) {
|
|
289
|
-
return /*#__PURE__*/
|
|
290
|
-
className: (
|
|
291
|
-
}, /*#__PURE__*/
|
|
282
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
283
|
+
className: classnames('loading', validClassName)
|
|
284
|
+
}, /*#__PURE__*/React.createElement(Loading, null));
|
|
292
285
|
}
|
|
293
286
|
if (errorMessage) {
|
|
294
|
-
return /*#__PURE__*/
|
|
295
|
-
className: (
|
|
296
|
-
}, /*#__PURE__*/
|
|
287
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
288
|
+
className: classnames('error', validClassName, tipBackgroundColorClassName)
|
|
289
|
+
}, /*#__PURE__*/React.createElement("span", null, errorMessage));
|
|
297
290
|
}
|
|
298
291
|
if (tipMessage) {
|
|
299
|
-
return /*#__PURE__*/
|
|
300
|
-
className: (
|
|
301
|
-
}, /*#__PURE__*/
|
|
292
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: classnames('error', validClassName, tipBackgroundColorClassName)
|
|
294
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get(tipMessage)));
|
|
302
295
|
}
|
|
303
|
-
if (
|
|
304
|
-
return /*#__PURE__*/
|
|
305
|
-
className: (
|
|
306
|
-
}, /*#__PURE__*/
|
|
296
|
+
if (BaseUtils.imEmptyChartResult(data) && !chartType.includes('map')) {
|
|
297
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: classnames('error', validClassName, tipBackgroundColorClassName)
|
|
299
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get('There_are_no_statistic_results_yet')));
|
|
307
300
|
}
|
|
308
|
-
return /*#__PURE__*/
|
|
301
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
309
302
|
className: validClassName
|
|
310
|
-
}, /*#__PURE__*/
|
|
311
|
-
className: (
|
|
303
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: classnames('sea-chart-formatter-container', `sea-chart-${chart === null || chart === void 0 ? void 0 : (_chart$config3 = chart.config) === null || _chart$config3 === void 0 ? void 0 : _chart$config3.type}-formatter-container`, {
|
|
312
305
|
'big_screen_plugin': isBigScreenPlugin
|
|
313
306
|
})
|
|
314
|
-
}, !hideTitle && /*#__PURE__*/
|
|
307
|
+
}, !hideTitle && /*#__PURE__*/React.createElement(Title, {
|
|
315
308
|
chart: chart
|
|
316
|
-
}), /*#__PURE__*/
|
|
317
|
-
id:
|
|
318
|
-
className: (
|
|
319
|
-
}, /*#__PURE__*/
|
|
309
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
310
|
+
id: `sea-chart-cavans-container-${chart.id}`,
|
|
311
|
+
className: classnames('sea-chart-cavans-container')
|
|
312
|
+
}, /*#__PURE__*/React.createElement(Wrapper, {
|
|
320
313
|
chart: chart,
|
|
321
314
|
data: data,
|
|
322
315
|
dtableStoreValue: dtableStoreValue,
|
|
323
316
|
tables: tables,
|
|
324
317
|
canvasStyle: canvasStyle,
|
|
325
318
|
customRender: render,
|
|
326
|
-
globalTheme: globalTheme ? globalTheme :
|
|
319
|
+
globalTheme: globalTheme ? globalTheme : THEME_NAME_MAP.LIGHT,
|
|
327
320
|
isCalculateByView: isCalculateByView,
|
|
328
321
|
isBigScreenPlugin: isBigScreenPlugin,
|
|
329
322
|
chartColorTheme: chartColorTheme,
|
|
@@ -342,36 +335,36 @@ View.defaultProps = {
|
|
|
342
335
|
style_config: {}
|
|
343
336
|
},
|
|
344
337
|
collaborators: [],
|
|
345
|
-
globalTheme:
|
|
338
|
+
globalTheme: THEME_NAME_MAP.LIGHT,
|
|
346
339
|
isCalculateByView: false
|
|
347
340
|
};
|
|
348
|
-
const propTypes =
|
|
341
|
+
const propTypes = {
|
|
349
342
|
// style
|
|
350
|
-
className:
|
|
351
|
-
canvasStyle:
|
|
352
|
-
globalTheme:
|
|
343
|
+
className: PropTypes.string,
|
|
344
|
+
canvasStyle: PropTypes.object,
|
|
345
|
+
globalTheme: PropTypes.string,
|
|
353
346
|
// light or dark
|
|
354
|
-
chartColorTheme:
|
|
355
|
-
hideTitle:
|
|
356
|
-
render:
|
|
347
|
+
chartColorTheme: PropTypes.string,
|
|
348
|
+
hideTitle: PropTypes.bool,
|
|
349
|
+
render: PropTypes.func,
|
|
357
350
|
// User-defined rendering content
|
|
358
|
-
resizeSignal:
|
|
351
|
+
resizeSignal: PropTypes.number,
|
|
359
352
|
// data
|
|
360
|
-
chart:
|
|
361
|
-
tables:
|
|
362
|
-
api:
|
|
363
|
-
config:
|
|
364
|
-
collaboratorManager:
|
|
365
|
-
collaborators:
|
|
366
|
-
departments:
|
|
367
|
-
dtableStoreValue:
|
|
368
|
-
isCalculateByView:
|
|
353
|
+
chart: PropTypes.object.isRequired,
|
|
354
|
+
tables: PropTypes.array.isRequired,
|
|
355
|
+
api: PropTypes.object.isRequired,
|
|
356
|
+
config: PropTypes.object,
|
|
357
|
+
collaboratorManager: PropTypes.object,
|
|
358
|
+
collaborators: PropTypes.array,
|
|
359
|
+
departments: PropTypes.array,
|
|
360
|
+
dtableStoreValue: PropTypes.object,
|
|
361
|
+
isCalculateByView: PropTypes.bool,
|
|
369
362
|
// event
|
|
370
|
-
integratedEventTypes:
|
|
371
|
-
integratedEventBus:
|
|
372
|
-
onViewRef:
|
|
363
|
+
integratedEventTypes: PropTypes.object,
|
|
364
|
+
integratedEventBus: PropTypes.object,
|
|
365
|
+
onViewRef: PropTypes.func
|
|
373
366
|
};
|
|
374
|
-
const defaultProps =
|
|
367
|
+
const defaultProps = {
|
|
375
368
|
canvasStyle: {},
|
|
376
369
|
tables: [],
|
|
377
370
|
chart: {
|
|
@@ -380,7 +373,8 @@ const defaultProps = exports.defaultProps = {
|
|
|
380
373
|
style_config: {}
|
|
381
374
|
},
|
|
382
375
|
collaborators: [],
|
|
383
|
-
globalTheme:
|
|
376
|
+
globalTheme: THEME_NAME_MAP.LIGHT,
|
|
384
377
|
isCalculateByView: false
|
|
385
378
|
};
|
|
386
|
-
|
|
379
|
+
export default View;
|
|
380
|
+
export { defaultProps, propTypes };
|
package/dist/view/title/index.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _dtableUtils = require("dtable-utils");
|
|
11
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
require("./index.css");
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { isNumber } from 'dtable-utils';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS } from '../../constants';
|
|
5
|
+
import './index.css';
|
|
14
6
|
const Title = _ref => {
|
|
15
7
|
let {
|
|
16
8
|
chart,
|
|
17
9
|
className
|
|
18
10
|
} = _ref;
|
|
19
|
-
const getTitleStyle =
|
|
11
|
+
const getTitleStyle = useCallback(() => {
|
|
20
12
|
var _chart$style_config, _chart$style_config2;
|
|
21
13
|
let style = {
|
|
22
|
-
fontSize:
|
|
23
|
-
fontWeight:
|
|
14
|
+
fontSize: `${DEFAULT_CHART_TITLE_FONT_SIZE}px`,
|
|
15
|
+
fontWeight: DEFAULT_CHART_FONT_WEIGHT
|
|
24
16
|
};
|
|
25
|
-
if (!chart || !chart.style_config || !((_chart$style_config = chart.style_config)
|
|
17
|
+
if (!chart || !chart.style_config || !((_chart$style_config = chart.style_config) === null || _chart$style_config === void 0 ? void 0 : _chart$style_config.title)) {
|
|
26
18
|
return style;
|
|
27
19
|
}
|
|
28
20
|
const {
|
|
@@ -31,16 +23,16 @@ const Title = _ref => {
|
|
|
31
23
|
font_color,
|
|
32
24
|
horizontal_align
|
|
33
25
|
} = (_chart$style_config2 = chart.style_config) === null || _chart$style_config2 === void 0 ? void 0 : _chart$style_config2.title;
|
|
34
|
-
if (
|
|
35
|
-
style.fontSize = font_size < 0 ? 0 :
|
|
26
|
+
if (isNumber(font_size)) {
|
|
27
|
+
style.fontSize = font_size < 0 ? 0 : `${font_size}px`;
|
|
36
28
|
}
|
|
37
|
-
if (
|
|
29
|
+
if (CHART_SUPPORT_FONT_WEIGHTS.includes(font_weight)) {
|
|
38
30
|
style.fontWeight = font_weight;
|
|
39
31
|
}
|
|
40
32
|
if (font_color) {
|
|
41
33
|
style.color = font_color;
|
|
42
34
|
}
|
|
43
|
-
style.textAlign = horizontal_align &&
|
|
35
|
+
style.textAlign = horizontal_align && HORIZONTAL_ALIGNS.includes(horizontal_align) ? horizontal_align : HORIZONTAL_ALIGN.LEFT;
|
|
44
36
|
return style;
|
|
45
37
|
}, [chart]);
|
|
46
38
|
if (!chart) return null;
|
|
@@ -48,9 +40,9 @@ const Title = _ref => {
|
|
|
48
40
|
const text = title && title.text;
|
|
49
41
|
if (!text) return null;
|
|
50
42
|
const style = getTitleStyle();
|
|
51
|
-
return /*#__PURE__*/
|
|
52
|
-
className: (
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: classnames('sea-chart-title', className),
|
|
53
45
|
style: style
|
|
54
46
|
}, text);
|
|
55
47
|
};
|
|
56
|
-
|
|
48
|
+
export default Title;
|