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