sea-chart 2.0.37 → 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 +20 -69
- package/dist/assets/css/sea-chart-d3-tooltip.css +0 -1
- 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 +31 -37
- 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 +41 -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 +12 -23
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +11 -24
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +13 -16
- package/dist/components/popover/hide-column-popover/hide-column-popover.css +5 -1
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +28 -38
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +58 -69
- 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 +61 -68
- package/dist/components/tooltip/index.js +39 -28
- 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 +13 -16
- 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 +2 -7
- package/dist/locale/lang/en.js +2 -7
- package/dist/locale/lang/es.js +2 -7
- package/dist/locale/lang/fr.js +2 -7
- package/dist/locale/lang/pt.js +2 -7
- package/dist/locale/lang/ru.js +2 -7
- package/dist/locale/lang/zh_CN.js +2 -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 +14 -17
- 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 +14 -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 +66 -73
- 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 +51 -59
- package/dist/settings/basic-number-card/data-settings.js +50 -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 -64
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +67 -75
- 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 +44 -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 +22 -30
- 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 +57 -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 +49 -58
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.css +1 -31
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +113 -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 +44 -52
- 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 +59 -66
- 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 +27 -34
- package/dist/settings/widgets/data-filter/index.js +59 -59
- 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 +52 -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 +75 -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 +65 -72
- package/dist/utils/cell-format-utils.js +25 -33
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +467 -367
- package/dist/utils/chart-utils/index.js +29 -40
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +78 -85
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -21
- 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 +28 -26
- 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 +94 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -25
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +50 -36
- package/dist/utils/chart-utils/sql-statistics-utils.js +385 -388
- 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 +88 -102
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +7 -11
- 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 +73 -219
- 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 +251 -183
- 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 +162 -172
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +50 -45
- package/dist/view/index.css +2 -8
- package/dist/view/index.js +102 -103
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +57 -57
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +56 -48
- package/dist/view/wrapper/bar-custom-stack.js +73 -55
- package/dist/view/wrapper/bar-group.js +94 -73
- package/dist/view/wrapper/bar-stack.js +49 -57
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +50 -34
- package/dist/view/wrapper/chart-component.js +164 -569
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +140 -93
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +104 -59
- 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 +70 -58
- package/dist/view/wrapper/horizontal-bar-stack.js +48 -56
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +49 -52
- 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 +40 -47
- package/dist/view/wrapper/map-world.js +42 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +45 -53
- package/dist/view/wrapper/ring.js +50 -58
- package/dist/view/wrapper/scatter.js +50 -56
- 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 -92
- 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 -16
- 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 +8 -13
- 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 +30 -43
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +80 -65
- package/package.json +15 -12
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,51 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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);
|
|
7
|
+
const dayOfWeekMap = {
|
|
8
|
+
'Sunday': 0,
|
|
9
|
+
'Monday': 1,
|
|
10
|
+
'Tuesday': 2,
|
|
11
|
+
'Wednesday': 3,
|
|
12
|
+
'Thursday': 4,
|
|
13
|
+
'Friday': 5,
|
|
14
|
+
'Saturday': 6
|
|
15
|
+
};
|
|
16
|
+
export function getCompareDate(dateGranularity, source) {
|
|
17
|
+
const currentDate = dayjs();
|
|
16
18
|
switch (dateGranularity) {
|
|
17
|
-
case
|
|
19
|
+
case CHART_SUMMARY_TYPE.DAY:
|
|
18
20
|
{
|
|
19
|
-
const compareDate = (
|
|
20
|
-
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');
|
|
21
23
|
return {
|
|
22
24
|
compareDate,
|
|
23
25
|
comparedDate
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
case
|
|
28
|
+
case CHART_SUMMARY_TYPE.WEEK:
|
|
27
29
|
{
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
30
|
+
var _dayOfWeekMap$firstDa;
|
|
31
|
+
const firstDayOfWeek = getFirstDayOfWeekForGroupby(source);
|
|
32
|
+
const startDayIndex = (_dayOfWeekMap$firstDa = dayOfWeekMap[firstDayOfWeek]) !== null && _dayOfWeekMap$firstDa !== void 0 ? _dayOfWeekMap$firstDa : 0; // default to Sunday
|
|
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');
|
|
31
36
|
return {
|
|
32
37
|
compareDate,
|
|
33
38
|
comparedDate
|
|
34
39
|
};
|
|
35
40
|
}
|
|
36
|
-
case
|
|
41
|
+
case CHART_SUMMARY_TYPE.MONTH:
|
|
37
42
|
{
|
|
38
|
-
const compareDate = (
|
|
39
|
-
const comparedDate = (
|
|
43
|
+
const compareDate = dayjs(currentDate).subtract(1, 'months').format('YYYY-MM');
|
|
44
|
+
const comparedDate = dayjs(currentDate).subtract(2, 'months').format('YYYY-MM');
|
|
40
45
|
return {
|
|
41
46
|
compareDate,
|
|
42
47
|
comparedDate
|
|
43
48
|
};
|
|
44
49
|
}
|
|
45
|
-
case
|
|
50
|
+
case CHART_SUMMARY_TYPE.QUARTER:
|
|
46
51
|
{
|
|
47
|
-
const currentQuarter = (
|
|
48
|
-
const currentYear = (
|
|
52
|
+
const currentQuarter = dayjs().quarter();
|
|
53
|
+
const currentYear = dayjs().year();
|
|
49
54
|
let lastQuarter = currentQuarter - 1;
|
|
50
55
|
let compareDate, comparedDate;
|
|
51
56
|
if (lastQuarter < 1) {
|
|
@@ -66,9 +71,9 @@ function getCompareDate(dateGranularity) {
|
|
|
66
71
|
comparedDate
|
|
67
72
|
};
|
|
68
73
|
}
|
|
69
|
-
case
|
|
74
|
+
case CHART_SUMMARY_TYPE.YEAR:
|
|
70
75
|
{
|
|
71
|
-
const currentYear = (
|
|
76
|
+
const currentYear = dayjs().year();
|
|
72
77
|
return {
|
|
73
78
|
compareDate: currentYear - 1 + '',
|
|
74
79
|
comparedDate: currentYear - 2 + ''
|
|
@@ -80,17 +85,17 @@ function getCompareDate(dateGranularity) {
|
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
|
-
function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
84
|
-
const currentTime = (
|
|
88
|
+
export function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
89
|
+
const currentTime = dayjs();
|
|
85
90
|
const days = duration === 'days_30' ? 30 : 7;
|
|
86
91
|
|
|
87
92
|
// set date to start of the day
|
|
88
93
|
const formattedEndDate = currentTime.format('YYYY-MM-DD');
|
|
89
94
|
const formattedMiddleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
|
|
90
|
-
const formattedStartDate = (
|
|
91
|
-
const endDate = (
|
|
92
|
-
const middleDate = (
|
|
93
|
-
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);
|
|
94
99
|
let compareValue = [];
|
|
95
100
|
let comparedValue = [];
|
|
96
101
|
if (useDataDb) {
|
|
@@ -98,7 +103,7 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
98
103
|
const days2 = [];
|
|
99
104
|
for (let index = 0; index < result.length; index++) {
|
|
100
105
|
const item = result[index];
|
|
101
|
-
const key = (
|
|
106
|
+
const key = dayjs(item[dbDateKey]);
|
|
102
107
|
if (!key.isValid()) continue;
|
|
103
108
|
if (key >= startDate && key < middleDate) {
|
|
104
109
|
comparedValue.push(item[valueKey]);
|
|
@@ -111,16 +116,16 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
111
116
|
} else {
|
|
112
117
|
// eslint-disable-next-line
|
|
113
118
|
for (let item of result) {
|
|
114
|
-
const key = (
|
|
119
|
+
const key = dayjs(item[0]);
|
|
115
120
|
if (!key.isValid()) continue;
|
|
116
121
|
if (key >= startDate && key < middleDate) {
|
|
117
|
-
if (summaryType ===
|
|
122
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
118
123
|
comparedValue = comparedValue.concat(item[1] || []);
|
|
119
124
|
} else {
|
|
120
125
|
comparedValue.push(item[1]);
|
|
121
126
|
}
|
|
122
127
|
} else if (key >= middleDate && key < endDate) {
|
|
123
|
-
if (summaryType ===
|
|
128
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
124
129
|
compareValue = compareValue.concat(item[1] || []);
|
|
125
130
|
} else {
|
|
126
131
|
compareValue.push(item[1]);
|
|
@@ -128,12 +133,12 @@ function summaryDurationResult(result, duration, summaryType, summaryMethod, use
|
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
|
-
if (summaryType ===
|
|
132
|
-
comparedValue =
|
|
133
|
-
compareValue =
|
|
136
|
+
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
137
|
+
comparedValue = BaseUtils.getSummaryResult(comparedValue, summaryMethod);
|
|
138
|
+
compareValue = BaseUtils.getSummaryResult(compareValue, summaryMethod);
|
|
134
139
|
} else {
|
|
135
|
-
compareValue =
|
|
136
|
-
comparedValue =
|
|
140
|
+
compareValue = BaseUtils.getSummaryResult(compareValue, 'Sum');
|
|
141
|
+
comparedValue = BaseUtils.getSummaryResult(comparedValue, 'Sum');
|
|
137
142
|
}
|
|
138
143
|
return {
|
|
139
144
|
compareValue,
|
package/dist/view/index.css
CHANGED
|
@@ -30,10 +30,6 @@
|
|
|
30
30
|
height: 100%
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.sea-chart-formatter .sea-chart-cavans-container.has-title {
|
|
34
|
-
height: calc(100% - 41px);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
33
|
.sea-chart-formatter .sea-chart-table-formatter-container:hover {
|
|
38
34
|
overflow: auto;
|
|
39
35
|
}
|
|
@@ -49,10 +45,8 @@
|
|
|
49
45
|
.sea-chart-formatter .sea-chart-container {
|
|
50
46
|
font-size: 12px;
|
|
51
47
|
position: absolute;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
top: 2%;
|
|
55
|
-
bottom: 8%;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
.sea-chart-formatter .sea-chart-container.plugin-number-card,
|
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
|
}
|
|
@@ -248,7 +241,7 @@ class View extends _react.default.PureComponent {
|
|
|
248
241
|
});
|
|
249
242
|
}
|
|
250
243
|
render() {
|
|
251
|
-
var
|
|
244
|
+
var _chart$config3;
|
|
252
245
|
const {
|
|
253
246
|
// style
|
|
254
247
|
className,
|
|
@@ -283,53 +276,47 @@ class View extends _react.default.PureComponent {
|
|
|
283
276
|
const {
|
|
284
277
|
type: chartType
|
|
285
278
|
} = config;
|
|
286
|
-
const
|
|
287
|
-
title
|
|
288
|
-
} = style_config;
|
|
289
|
-
const hasTitle = title && ((_title$text = title.text) === null || _title$text === void 0 ? void 0 : _title$text.length);
|
|
290
|
-
const validClassName = (0, _classnames.default)('sea-chart-formatter', className);
|
|
279
|
+
const validClassName = classnames('sea-chart-formatter', className);
|
|
291
280
|
const tipBackgroundColorClassName = 'sea-chart-formatter-tip';
|
|
292
281
|
if (!isCalculated) {
|
|
293
|
-
return /*#__PURE__*/
|
|
294
|
-
className: (
|
|
295
|
-
}, /*#__PURE__*/
|
|
282
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
283
|
+
className: classnames('loading', validClassName)
|
|
284
|
+
}, /*#__PURE__*/React.createElement(Loading, null));
|
|
296
285
|
}
|
|
297
286
|
if (errorMessage) {
|
|
298
|
-
return /*#__PURE__*/
|
|
299
|
-
className: (
|
|
300
|
-
}, /*#__PURE__*/
|
|
287
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
288
|
+
className: classnames('error', validClassName, tipBackgroundColorClassName)
|
|
289
|
+
}, /*#__PURE__*/React.createElement("span", null, errorMessage));
|
|
301
290
|
}
|
|
302
291
|
if (tipMessage) {
|
|
303
|
-
return /*#__PURE__*/
|
|
304
|
-
className: (
|
|
305
|
-
}, /*#__PURE__*/
|
|
292
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: classnames('error', validClassName, tipBackgroundColorClassName)
|
|
294
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.get(tipMessage)));
|
|
306
295
|
}
|
|
307
|
-
if (
|
|
308
|
-
return /*#__PURE__*/
|
|
309
|
-
className: (
|
|
310
|
-
}, /*#__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')));
|
|
311
300
|
}
|
|
312
|
-
return /*#__PURE__*/
|
|
301
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
313
302
|
className: validClassName
|
|
314
|
-
}, /*#__PURE__*/
|
|
315
|
-
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`, {
|
|
316
305
|
'big_screen_plugin': isBigScreenPlugin
|
|
317
306
|
})
|
|
318
|
-
}, !hideTitle && /*#__PURE__*/
|
|
307
|
+
}, !hideTitle && /*#__PURE__*/React.createElement(Title, {
|
|
319
308
|
chart: chart
|
|
320
|
-
}), /*#__PURE__*/
|
|
321
|
-
id:
|
|
322
|
-
className: (
|
|
323
|
-
|
|
324
|
-
})
|
|
325
|
-
}, /*#__PURE__*/_react.default.createElement(_wrapper.default, {
|
|
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, {
|
|
326
313
|
chart: chart,
|
|
327
314
|
data: data,
|
|
328
315
|
dtableStoreValue: dtableStoreValue,
|
|
329
316
|
tables: tables,
|
|
330
317
|
canvasStyle: canvasStyle,
|
|
331
318
|
customRender: render,
|
|
332
|
-
globalTheme: globalTheme ? globalTheme :
|
|
319
|
+
globalTheme: globalTheme ? globalTheme : THEME_NAME_MAP.LIGHT,
|
|
333
320
|
isCalculateByView: isCalculateByView,
|
|
334
321
|
isBigScreenPlugin: isBigScreenPlugin,
|
|
335
322
|
chartColorTheme: chartColorTheme,
|
|
@@ -339,33 +326,45 @@ class View extends _react.default.PureComponent {
|
|
|
339
326
|
}))));
|
|
340
327
|
}
|
|
341
328
|
}
|
|
342
|
-
|
|
329
|
+
View.defaultProps = {
|
|
330
|
+
canvasStyle: {},
|
|
331
|
+
tables: [],
|
|
332
|
+
chart: {
|
|
333
|
+
id: '',
|
|
334
|
+
config: {},
|
|
335
|
+
style_config: {}
|
|
336
|
+
},
|
|
337
|
+
collaborators: [],
|
|
338
|
+
globalTheme: THEME_NAME_MAP.LIGHT,
|
|
339
|
+
isCalculateByView: false
|
|
340
|
+
};
|
|
341
|
+
const propTypes = {
|
|
343
342
|
// style
|
|
344
|
-
className:
|
|
345
|
-
canvasStyle:
|
|
346
|
-
globalTheme:
|
|
343
|
+
className: PropTypes.string,
|
|
344
|
+
canvasStyle: PropTypes.object,
|
|
345
|
+
globalTheme: PropTypes.string,
|
|
347
346
|
// light or dark
|
|
348
|
-
chartColorTheme:
|
|
349
|
-
hideTitle:
|
|
350
|
-
render:
|
|
347
|
+
chartColorTheme: PropTypes.string,
|
|
348
|
+
hideTitle: PropTypes.bool,
|
|
349
|
+
render: PropTypes.func,
|
|
351
350
|
// User-defined rendering content
|
|
352
|
-
resizeSignal:
|
|
351
|
+
resizeSignal: PropTypes.number,
|
|
353
352
|
// data
|
|
354
|
-
chart:
|
|
355
|
-
tables:
|
|
356
|
-
api:
|
|
357
|
-
config:
|
|
358
|
-
collaboratorManager:
|
|
359
|
-
collaborators:
|
|
360
|
-
departments:
|
|
361
|
-
dtableStoreValue:
|
|
362
|
-
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,
|
|
363
362
|
// event
|
|
364
|
-
integratedEventTypes:
|
|
365
|
-
integratedEventBus:
|
|
366
|
-
onViewRef:
|
|
363
|
+
integratedEventTypes: PropTypes.object,
|
|
364
|
+
integratedEventBus: PropTypes.object,
|
|
365
|
+
onViewRef: PropTypes.func
|
|
367
366
|
};
|
|
368
|
-
const defaultProps =
|
|
367
|
+
const defaultProps = {
|
|
369
368
|
canvasStyle: {},
|
|
370
369
|
tables: [],
|
|
371
370
|
chart: {
|
|
@@ -374,8 +373,8 @@ const defaultProps = exports.defaultProps = {
|
|
|
374
373
|
style_config: {}
|
|
375
374
|
},
|
|
376
375
|
collaborators: [],
|
|
377
|
-
globalTheme:
|
|
376
|
+
globalTheme: THEME_NAME_MAP.LIGHT,
|
|
378
377
|
isCalculateByView: false
|
|
379
378
|
};
|
|
380
|
-
|
|
381
|
-
|
|
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;
|