sea-chart 0.0.1 → 0.0.2
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/README.md +117 -1
- package/dist/api/index.js +101 -0
- package/{lib → dist}/components/collaborator/index.js +8 -6
- package/{lib → dist}/components/icon/index.css +1 -1
- package/{lib → dist}/components/icon/index.js +7 -5
- package/dist/components/index.js +8 -0
- package/{lib → dist}/components/loading/index.js +4 -2
- package/dist/components/number-input/index.js +31 -0
- package/{lib → dist}/components/pixel-editor/index.css +4 -4
- package/{lib → dist}/components/pixel-editor/index.js +11 -15
- package/{lib → dist}/components/select-group/index.css +10 -10
- package/dist/components/select-group/index.js +52 -0
- package/dist/components/types-dialog/index.css +97 -0
- package/dist/components/types-dialog/index.js +117 -0
- package/{lib → dist}/constants/geolocation.js +3 -3
- package/dist/constants/index.js +184 -0
- package/{lib → dist}/constants/model.js +25 -5
- package/dist/constants/style.js +15 -0
- package/dist/constants/type-image.js +59 -0
- package/dist/constants/type.js +124 -0
- package/dist/context.js +83 -0
- package/dist/editor/index.js +41 -0
- package/dist/index.js +9 -0
- package/dist/intl.js +37 -0
- package/dist/locale/index.js +18 -0
- package/{lib → dist}/locale/lang/de.js +1 -1
- package/{lib → dist}/locale/lang/en.js +1 -1
- package/{lib → dist}/locale/lang/es.js +1 -1
- package/{lib → dist}/locale/lang/fr.js +1 -1
- package/{lib → dist}/locale/lang/pt.js +1 -1
- package/{lib → dist}/locale/lang/ru.js +1 -1
- package/{lib → dist}/locale/lang/zh_CN.js +1 -1
- package/dist/model/area-group.js +41 -0
- package/dist/model/area.js +32 -0
- package/dist/model/bar-group.js +44 -0
- package/dist/model/bar-stack.js +41 -0
- package/dist/model/bar.js +38 -0
- package/dist/model/base-model.js +9 -0
- package/dist/model/basic-number-card.js +22 -0
- package/dist/model/chart.js +23 -0
- package/dist/model/combination.js +38 -0
- package/dist/model/compare-bar.js +39 -0
- package/dist/model/completeness-group.js +24 -0
- package/dist/model/completeness.js +18 -0
- package/dist/model/dashboard.js +16 -0
- package/dist/model/generic-model.js +224 -0
- package/dist/model/heat-map.js +23 -0
- package/dist/model/horizontal-bar.js +38 -0
- package/dist/model/horizontal-group-bar.js +43 -0
- package/dist/model/index.js +63 -0
- package/dist/model/line-group.js +44 -0
- package/dist/model/line.js +38 -0
- package/dist/model/map-bubble.js +27 -0
- package/dist/model/map.js +27 -0
- package/dist/model/mirror.js +26 -0
- package/dist/model/pie.js +26 -0
- package/dist/model/ring.js +26 -0
- package/dist/model/scatter.js +19 -0
- package/dist/model/stacked-horizontal-bar.js +32 -0
- package/dist/model/table.js +23 -0
- package/dist/model/tree-map.js +20 -0
- package/dist/model/trend.js +24 -0
- package/dist/model/user.js +15 -0
- package/dist/model/world-map-bubble.js +26 -0
- package/dist/model/world-map.js +26 -0
- package/{lib/components → dist}/settings/advance-bar-settings/data-settings.js +68 -45
- package/dist/settings/advance-bar-settings/style-settings.js +161 -0
- package/{lib/components → dist}/settings/bar-settings/data-settings.js +76 -51
- package/dist/settings/bar-settings/style-settings.js +179 -0
- package/dist/settings/basic-number-card/data-settings.js +126 -0
- package/dist/settings/basic-number-card/style-settings.js +42 -0
- package/dist/settings/combination-settings/data-settings.js +279 -0
- package/dist/settings/combination-settings/style-settings.js +174 -0
- package/dist/settings/dashboard-settings/data-settings.js +179 -0
- package/{lib/components → dist}/settings/data-settings.js +28 -22
- package/dist/settings/horizontal-bar-settings/data-settings.js +55 -0
- package/dist/settings/horizontal-bar-settings/style-settings.js +46 -0
- package/dist/settings/index.css +85 -0
- package/dist/settings/index.js +76 -0
- package/{lib/components → dist}/settings/pie-settings/data-settings.js +67 -44
- package/{lib/components → dist}/settings/pie-settings/style-settings.js +67 -49
- package/dist/settings/style-settings.js +118 -0
- package/{lib/components → dist}/settings/table-settings/data-settings.js +269 -208
- package/{lib/components → dist}/settings/time-comparison-settings/data-settings.js +82 -67
- package/dist/settings/time-comparison-settings/style-settings.js +213 -0
- package/dist/settings/widgets/basic-summary/index.css +12 -0
- package/dist/settings/widgets/basic-summary/index.js +176 -0
- package/{lib/components/settings/widgets/statistic-type → dist/settings/widgets/chart-type}/index.css +5 -5
- package/dist/settings/widgets/chart-type/index.js +59 -0
- package/{lib/components → dist}/settings/widgets/common-data-settings.js +24 -18
- package/dist/settings/widgets/data-filter/index.css +17 -0
- package/{lib/components → dist}/settings/widgets/data-filter/index.js +51 -37
- package/dist/settings/widgets/data-sort.js +44 -0
- package/dist/settings/widgets/date-summary-item.js +111 -0
- package/dist/settings/widgets/display-values-settings/index.css +13 -0
- package/{lib/components → dist}/settings/widgets/display-values-settings/index.js +19 -14
- package/{lib/components → dist}/settings/widgets/divider/index.css +1 -1
- package/dist/settings/widgets/divider/index.js +12 -0
- package/{lib/components → dist}/settings/widgets/font-settings/font-size-settings.js +14 -12
- package/{lib/components → dist}/settings/widgets/font-settings/font-weight-settings.js +14 -16
- package/dist/settings/widgets/group-by.js +160 -0
- package/{lib/components → dist}/settings/widgets/label-color.js +10 -10
- package/dist/settings/widgets/min-max-setting.js +52 -0
- package/dist/settings/widgets/mininum-slice-percent.js +63 -0
- package/dist/settings/widgets/numeric-summary-item.js +90 -0
- package/dist/settings/widgets/select-table/index.js +38 -0
- package/dist/settings/widgets/stack.js +50 -0
- package/dist/settings/widgets/summary-method-setting.js +66 -0
- package/dist/settings/widgets/summary-settings.js +411 -0
- package/dist/settings/widgets/switch/index.css +37 -0
- package/{lib/components → dist}/settings/widgets/switch/index.js +11 -8
- package/{lib/components → dist}/settings/widgets/text-horizontal-settings.js +12 -10
- package/dist/settings/widgets/time-picker.js +174 -0
- package/{lib/components → dist}/settings/widgets/title-settings/index.js +15 -13
- package/dist/settings/widgets/title-settings/title-text.js +25 -0
- package/dist/settings/widgets/x-axios.js +0 -0
- package/dist/settings/widgets/y-axis-group-settings.js +438 -0
- package/dist/utils/cell-format-utils.js +42 -0
- package/dist/utils/chart-data-sql.js +606 -0
- package/dist/utils/chart-utils.js +1803 -0
- package/dist/utils/chart.js +6 -0
- package/dist/utils/collaborator-manager.js +24 -0
- package/dist/utils/collaborator-utils.js +40 -0
- package/dist/utils/column-2-sql-column.js +551 -0
- package/dist/utils/column-utils.js +208 -0
- package/{lib → dist}/utils/custom-g2.js +11 -11
- package/{lib → dist}/utils/date-translate.js +11 -11
- package/dist/utils/index.js +48 -0
- package/dist/utils/key-generator.js +13 -0
- package/dist/utils/object-utils.js +45 -0
- package/{lib → dist}/utils/options-utils.js +17 -18
- package/dist/view/index.css +53 -0
- package/dist/view/index.js +169 -0
- package/{lib/layout → dist/view}/title/index.css +1 -1
- package/dist/view/title/index.js +46 -0
- package/dist/view/wrapper/area.js +150 -0
- package/dist/view/wrapper/bar-group.js +148 -0
- package/dist/view/wrapper/bar.js +138 -0
- package/dist/view/wrapper/basic-number-card.js +127 -0
- package/dist/view/wrapper/chart-component.js +261 -0
- package/dist/view/wrapper/combination.js +399 -0
- package/dist/view/wrapper/dashboard.js +164 -0
- package/dist/view/wrapper/horizontal-bar-group.js +149 -0
- package/dist/view/wrapper/horizontal-bar.js +140 -0
- package/dist/view/wrapper/horizontal-component.js +78 -0
- package/{lib/components/formatter → dist/view/wrapper}/index.js +90 -71
- package/dist/view/wrapper/line-group.js +145 -0
- package/dist/view/wrapper/line.js +157 -0
- package/dist/view/wrapper/pie.js +185 -0
- package/dist/view/wrapper/ring.js +264 -0
- package/{lib/components/formatter → dist/view/wrapper}/table/index.css +18 -18
- package/dist/view/wrapper/table/index.js +31 -0
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +144 -0
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +198 -0
- package/dist/view/wrapper/table/pivot-table-display-name.js +248 -0
- package/dist/view/wrapper/table/two-dimension-table.js +249 -0
- package/dist/view/wrapper/treemap.js +186 -0
- package/package.json +91 -100
- package/lib/components/formatter/area.js +0 -162
- package/lib/components/formatter/bar-group.js +0 -160
- package/lib/components/formatter/bar.js +0 -150
- package/lib/components/formatter/basic-number-card.js +0 -138
- package/lib/components/formatter/chart-component.js +0 -266
- package/lib/components/formatter/combination.js +0 -407
- package/lib/components/formatter/dashboard.js +0 -182
- package/lib/components/formatter/horizontal-bar-group.js +0 -161
- package/lib/components/formatter/horizontal-bar.js +0 -152
- package/lib/components/formatter/horizontal-component.js +0 -91
- package/lib/components/formatter/line-group.js +0 -157
- package/lib/components/formatter/line.js +0 -170
- package/lib/components/formatter/pie.js +0 -201
- package/lib/components/formatter/ring.js +0 -277
- package/lib/components/formatter/table/index.js +0 -42
- package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +0 -145
- package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +0 -193
- package/lib/components/formatter/table/pivot-table-display-name.js +0 -249
- package/lib/components/formatter/table/two-dimension-table.js +0 -241
- package/lib/components/formatter/treemap.js +0 -213
- package/lib/components/index.js +0 -5
- package/lib/components/number-input/index.js +0 -31
- package/lib/components/select-group/index.js +0 -63
- package/lib/components/settings/advance-bar-settings/style-settings.js +0 -149
- package/lib/components/settings/bar-settings/style-settings.js +0 -163
- package/lib/components/settings/basic-number-card/data-settings.js +0 -121
- package/lib/components/settings/basic-number-card/style-settings.js +0 -42
- package/lib/components/settings/combination-settings/data-settings.js +0 -256
- package/lib/components/settings/combination-settings/style-settings.js +0 -183
- package/lib/components/settings/dashboard-settings/data-settings.js +0 -167
- package/lib/components/settings/horizontal-bar-settings/data-settings.js +0 -45
- package/lib/components/settings/horizontal-bar-settings/style-settings.js +0 -38
- package/lib/components/settings/index.css +0 -73
- package/lib/components/settings/index.js +0 -74
- package/lib/components/settings/style-settings.js +0 -100
- package/lib/components/settings/time-comparison-settings/style-settings.js +0 -191
- package/lib/components/settings/widgets/basic-summary/index.css +0 -12
- package/lib/components/settings/widgets/basic-summary/index.js +0 -173
- package/lib/components/settings/widgets/data-filter/index.css +0 -17
- package/lib/components/settings/widgets/data-sort.js +0 -38
- package/lib/components/settings/widgets/date-summary-item.js +0 -126
- package/lib/components/settings/widgets/display-values-settings/index.css +0 -13
- package/lib/components/settings/widgets/divider/index.js +0 -10
- package/lib/components/settings/widgets/group-by.js +0 -168
- package/lib/components/settings/widgets/min-max-setting.js +0 -64
- package/lib/components/settings/widgets/mininum-slice-percent.js +0 -72
- package/lib/components/settings/widgets/numeric-summary-item.js +0 -109
- package/lib/components/settings/widgets/select-table/index.js +0 -49
- package/lib/components/settings/widgets/stack.js +0 -58
- package/lib/components/settings/widgets/statistic-type/index.js +0 -54
- package/lib/components/settings/widgets/summary-method-setting.js +0 -80
- package/lib/components/settings/widgets/summary-settings.js +0 -394
- package/lib/components/settings/widgets/switch/index.css +0 -37
- package/lib/components/settings/widgets/time-picker.js +0 -182
- package/lib/components/settings/widgets/title-settings/title-text.js +0 -31
- package/lib/components/settings/widgets/y-axis-group-settings.js +0 -399
- package/lib/components/types-dialog/index.css +0 -97
- package/lib/components/types-dialog/index.js +0 -127
- package/lib/constants/index.js +0 -164
- package/lib/constants/style.js +0 -13
- package/lib/constants/type-image.js +0 -32
- package/lib/constants/type.js +0 -97
- package/lib/context.js +0 -49
- package/lib/index.js +0 -6
- package/lib/intl.js +0 -37
- package/lib/layout/index.js +0 -4
- package/lib/layout/statistic/index.css +0 -53
- package/lib/layout/statistic/index.js +0 -190
- package/lib/layout/title/index.js +0 -41
- package/lib/locale/index.js +0 -11
- package/lib/model/area-group.js +0 -51
- package/lib/model/area.js +0 -42
- package/lib/model/bar-group.js +0 -54
- package/lib/model/bar-stack.js +0 -51
- package/lib/model/bar.js +0 -48
- package/lib/model/base-model.js +0 -11
- package/lib/model/basic-number-card.js +0 -32
- package/lib/model/combination.js +0 -48
- package/lib/model/compare-bar.js +0 -49
- package/lib/model/completeness-group.js +0 -34
- package/lib/model/completeness.js +0 -28
- package/lib/model/dashboard.js +0 -26
- package/lib/model/generic-model.js +0 -235
- package/lib/model/heat-map.js +0 -33
- package/lib/model/horizontal-bar.js +0 -48
- package/lib/model/horizontal-group-bar.js +0 -53
- package/lib/model/index.js +0 -36
- package/lib/model/line-group.js +0 -54
- package/lib/model/line.js +0 -48
- package/lib/model/map-bubble.js +0 -37
- package/lib/model/map.js +0 -37
- package/lib/model/mirror.js +0 -36
- package/lib/model/pie.js +0 -36
- package/lib/model/ring.js +0 -36
- package/lib/model/scatter.js +0 -29
- package/lib/model/stacked-horizontal-bar.js +0 -42
- package/lib/model/statistic.js +0 -22
- package/lib/model/table.js +0 -33
- package/lib/model/tree-map.js +0 -30
- package/lib/model/trend.js +0 -34
- package/lib/model/user.js +0 -22
- package/lib/model/world-map-bubble.js +0 -36
- package/lib/model/world-map.js +0 -36
- package/lib/utils/cell-format-utils.js +0 -41
- package/lib/utils/chart.js +0 -6
- package/lib/utils/collaborator-utils.js +0 -40
- package/lib/utils/column-utils.js +0 -247
- package/lib/utils/data-filter/filter-item-utils.js +0 -80
- package/lib/utils/data-filter/filters-utils.js +0 -406
- package/lib/utils/data-filter/index.js +0 -3
- package/lib/utils/index.js +0 -50
- package/lib/utils/key-generator.js +0 -13
- package/lib/utils/object-utils.js +0 -61
- package/lib/utils/statistic-column-2-sql-column-utils.js +0 -499
- package/lib/utils/statistic-utils.js +0 -1685
- /package/{lib → dist}/assets/icons/area-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/bar-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/card.svg +0 -0
- /package/{lib → dist}/assets/icons/combination-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/dtable-logo.svg +0 -0
- /package/{lib → dist}/assets/icons/facet-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/gauge.svg +0 -0
- /package/{lib → dist}/assets/icons/heat-map.svg +0 -0
- /package/{lib → dist}/assets/icons/histogram.svg +0 -0
- /package/{lib → dist}/assets/icons/line-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/map.svg +0 -0
- /package/{lib → dist}/assets/icons/pie-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/rectangular-tree-diagram.svg +0 -0
- /package/{lib → dist}/assets/icons/scatter-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/type-change.svg +0 -0
- /package/{lib → dist}/assets/img/area-chart.png +0 -0
- /package/{lib → dist}/assets/img/area-group-chart.png +0 -0
- /package/{lib → dist}/assets/img/bar-group.png +0 -0
- /package/{lib → dist}/assets/img/bar-stack.png +0 -0
- /package/{lib → dist}/assets/img/bar.png +0 -0
- /package/{lib → dist}/assets/img/combination-chart.png +0 -0
- /package/{lib → dist}/assets/img/compared-chart.png +0 -0
- /package/{lib → dist}/assets/img/completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/custom-bar.png +0 -0
- /package/{lib → dist}/assets/img/dashboard-chart.png +0 -0
- /package/{lib → dist}/assets/img/group-completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/group_line.png +0 -0
- /package/{lib → dist}/assets/img/heat-map.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-group-bar.png +0 -0
- /package/{lib → dist}/assets/img/line.png +0 -0
- /package/{lib → dist}/assets/img/map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/map.png +0 -0
- /package/{lib → dist}/assets/img/mirror.png +0 -0
- /package/{lib → dist}/assets/img/number-card.png +0 -0
- /package/{lib → dist}/assets/img/pie.png +0 -0
- /package/{lib → dist}/assets/img/pivot-table.png +0 -0
- /package/{lib → dist}/assets/img/ring.png +0 -0
- /package/{lib → dist}/assets/img/scatter.png +0 -0
- /package/{lib → dist}/assets/img/stacked-horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/treemap.png +0 -0
- /package/{lib → dist}/assets/img/trend-chart.png +0 -0
- /package/{lib → dist}/assets/img/world-map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/world-map.png +0 -0
- /package/{lib → dist}/components/loading/index.css +0 -0
- /package/{lib/components/settings/widgets/select-table → dist/editor}/index.css +0 -0
- /package/{lib/components → dist}/settings/advance-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/basic-number-card/index.js +0 -0
- /package/{lib/components → dist}/settings/combination-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/dashboard-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/horizontal-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/pie-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/table-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/time-comparison-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/widgets/font-settings/index.js +0 -0
- /package/{lib/components/settings/widgets/x-axios.js → dist/settings/widgets/select-table/index.css} +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import React, { useCallback, useMemo } from 'react';
|
|
3
|
-
import { FormGroup } from 'reactstrap';
|
|
4
|
-
import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
|
|
5
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
6
|
-
import CommonDataSettings from '../widgets/common-data-settings';
|
|
7
|
-
import { StatisticsUtils } from '../../../utils';
|
|
8
|
-
import { STATISTIC_SUMMARY_SHOW, STATISTIC_SUMMARY_CALCULATION_METHOD, STATISTIC_SUPPORT_COLUMNS, BASIC_NUMBER_CARD_CALCULATION_METHOD } from '../../../constants';
|
|
9
|
-
import intl from '../../../intl';
|
|
10
|
-
var DataSettings = function DataSettings(_ref) {
|
|
11
|
-
var tables = _ref.tables,
|
|
12
|
-
statistic = _ref.statistic,
|
|
13
|
-
FilterSettings = _ref.FilterSettings,
|
|
14
|
-
onChange = _ref.onChange;
|
|
15
|
-
var summaryMethodsOptions = useMemo(function () {
|
|
16
|
-
var numberCardSummaryMethod = [BASIC_NUMBER_CARD_CALCULATION_METHOD].concat(_toConsumableArray(STATISTIC_SUMMARY_CALCULATION_METHOD));
|
|
17
|
-
return numberCardSummaryMethod.map(function (method) {
|
|
18
|
-
return {
|
|
19
|
-
label: /*#__PURE__*/React.createElement("span", {
|
|
20
|
-
className: "select-option-name"
|
|
21
|
-
}, intl.get(STATISTIC_SUMMARY_SHOW[method])),
|
|
22
|
-
value: method
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}, []);
|
|
26
|
-
var selectedTable = useMemo(function () {
|
|
27
|
-
var selectedTableId = statistic.config.table_id;
|
|
28
|
-
return getTableById(tables, selectedTableId);
|
|
29
|
-
}, [statistic.config, tables]);
|
|
30
|
-
var validColumns = useMemo(function () {
|
|
31
|
-
var columns = selectedTable && Array.isArray(selectedTable.columns) ? selectedTable.columns : [];
|
|
32
|
-
if (!columns || !Array.isArray(columns)) return [];
|
|
33
|
-
return columns.filter(function (column) {
|
|
34
|
-
return STATISTIC_SUPPORT_COLUMNS.includes(column.type);
|
|
35
|
-
});
|
|
36
|
-
}, [selectedTable]);
|
|
37
|
-
var numericColumns = useMemo(function () {
|
|
38
|
-
return validColumns.filter(function (column) {
|
|
39
|
-
return StatisticsUtils.isNumericSummaryColumn(column);
|
|
40
|
-
});
|
|
41
|
-
}, [validColumns]);
|
|
42
|
-
var numericColumnOptions = useMemo(function () {
|
|
43
|
-
var options = numericColumns.map(function (column) {
|
|
44
|
-
return {
|
|
45
|
-
value: column,
|
|
46
|
-
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
47
|
-
className: "header-icon"
|
|
48
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
49
|
-
className: COLUMNS_ICON_CONFIG[column.type]
|
|
50
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
51
|
-
className: 'select-module select-module-name ml-0'
|
|
52
|
-
}, column.name))
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
return [{
|
|
56
|
-
value: {
|
|
57
|
-
key: 'Groupby_null'
|
|
58
|
-
},
|
|
59
|
-
label: /*#__PURE__*/React.createElement("span", {
|
|
60
|
-
className: 'select-module select-module-name null-option-name ml-0'
|
|
61
|
-
}, intl.get('Select_a_column')),
|
|
62
|
-
style: {
|
|
63
|
-
color: 'rgba(0, 0, 0, .25)'
|
|
64
|
-
}
|
|
65
|
-
}].concat(_toConsumableArray(options));
|
|
66
|
-
}, [numericColumns]);
|
|
67
|
-
var onSelectColumnChange = useCallback(function (option) {
|
|
68
|
-
var config = statistic.config;
|
|
69
|
-
var numeric_column_key = config.numeric_column_key;
|
|
70
|
-
var newColumnKey = option.value.key;
|
|
71
|
-
if (numeric_column_key === newColumnKey) return;
|
|
72
|
-
onChange && onChange({
|
|
73
|
-
numeric_column_key: newColumnKey
|
|
74
|
-
});
|
|
75
|
-
}, [statistic, onChange]);
|
|
76
|
-
var onSelectSummaryMethod = useCallback(function (option) {
|
|
77
|
-
var config = statistic.config;
|
|
78
|
-
var summary_method = config.summary_method;
|
|
79
|
-
var newSummaryMethod = option.value;
|
|
80
|
-
if (newSummaryMethod === summary_method) return;
|
|
81
|
-
onChange && onChange({
|
|
82
|
-
summary_method: newSummaryMethod
|
|
83
|
-
});
|
|
84
|
-
}, [statistic, onChange]);
|
|
85
|
-
var getSelectedMethodOption = useCallback(function (method, summaryMethodsOptions) {
|
|
86
|
-
return summaryMethodsOptions.find(function (m) {
|
|
87
|
-
return m.value === method;
|
|
88
|
-
}) || summaryMethodsOptions[0];
|
|
89
|
-
}, []);
|
|
90
|
-
var renderSummaryMethod = useCallback(function () {
|
|
91
|
-
var summary_method = statistic.config.summary_method;
|
|
92
|
-
var selectedMethodOption = getSelectedMethodOption(summary_method, summaryMethodsOptions);
|
|
93
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
className: "dtable-plugin-stat-parameter-item"
|
|
95
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
96
|
-
value: selectedMethodOption,
|
|
97
|
-
onChange: onSelectSummaryMethod,
|
|
98
|
-
options: summaryMethodsOptions
|
|
99
|
-
}));
|
|
100
|
-
}, [statistic, getSelectedMethodOption, onSelectSummaryMethod, summaryMethodsOptions]);
|
|
101
|
-
var config = statistic.config;
|
|
102
|
-
var selectedColumnOption = numericColumnOptions.find(function (option) {
|
|
103
|
-
return option.value.key === config.numeric_column_key;
|
|
104
|
-
}) || numericColumnOptions[0];
|
|
105
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
106
|
-
statistic: statistic,
|
|
107
|
-
tables: tables,
|
|
108
|
-
FilterSettings: FilterSettings,
|
|
109
|
-
onChange: onChange
|
|
110
|
-
}), /*#__PURE__*/React.createElement(FormGroup, {
|
|
111
|
-
className: "seastatistic-parameter-item"
|
|
112
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Statistic_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
113
|
-
value: selectedColumnOption,
|
|
114
|
-
options: numericColumnOptions,
|
|
115
|
-
placeholder: intl.get('Select_a_column'),
|
|
116
|
-
onChange: onSelectColumnChange
|
|
117
|
-
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
118
|
-
className: "seastatistic-parameter-item"
|
|
119
|
-
}, renderSummaryMethod()));
|
|
120
|
-
};
|
|
121
|
-
export default DataSettings;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { Input, FormGroup } from 'reactstrap';
|
|
4
|
-
import intl from '../../../intl';
|
|
5
|
-
var StyleSettings = function StyleSettings(_ref) {
|
|
6
|
-
var statistic = _ref.statistic,
|
|
7
|
-
onChange = _ref.onChange;
|
|
8
|
-
var _useState = useState(statistic.config.name || ''),
|
|
9
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
-
name = _useState2[0],
|
|
11
|
-
setName = _useState2[1];
|
|
12
|
-
var onChangeName = useCallback(function (event) {
|
|
13
|
-
var newName = event.target.value;
|
|
14
|
-
if (newName === name) return;
|
|
15
|
-
setName(newName);
|
|
16
|
-
}, [name]);
|
|
17
|
-
var onSaveName = useCallback(function () {
|
|
18
|
-
var oldName = statistic.config.name || '';
|
|
19
|
-
if (oldName === name) return;
|
|
20
|
-
onChange && onChange({
|
|
21
|
-
name: name
|
|
22
|
-
});
|
|
23
|
-
}, [name, statistic, onChange]);
|
|
24
|
-
var onKeyDown = useCallback(function (e) {
|
|
25
|
-
if (e.key === 'Enter') {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
e.target.blur();
|
|
28
|
-
}
|
|
29
|
-
}, []);
|
|
30
|
-
var config = statistic.config;
|
|
31
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
32
|
-
className: "seastatistic-parameter-item"
|
|
33
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Label')), /*#__PURE__*/React.createElement(Input, {
|
|
34
|
-
type: "text",
|
|
35
|
-
value: name,
|
|
36
|
-
placeholder: config.name || '',
|
|
37
|
-
onBlur: onSaveName,
|
|
38
|
-
onChange: onChangeName,
|
|
39
|
-
onKeyDown: onKeyDown
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
export default StyleSettings;
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { CellType, DATE_COLUMN_OPTIONS } from 'dtable-utils';
|
|
3
|
-
import CommonDataSettings from '../widgets/common-data-settings';
|
|
4
|
-
import Divider from '../widgets/divider';
|
|
5
|
-
import GroupBy from '../widgets/group-by';
|
|
6
|
-
import Switch from '../widgets/switch';
|
|
7
|
-
import SummarySettings from '../widgets/summary-settings';
|
|
8
|
-
import { eventStopPropagation } from '../../../utils';
|
|
9
|
-
import { STATISTIC_SUMMARY_TYPE, STATISTIC_Y_GROUP_TYPE, STATISTIC_SUMMARY_CALCULATION_METHOD, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, COMBINATION_POSITION } from '../../../constants';
|
|
10
|
-
import intl from '../../../intl';
|
|
11
|
-
var DataSettings = function DataSettings(_ref) {
|
|
12
|
-
var statistic = _ref.statistic,
|
|
13
|
-
tables = _ref.tables,
|
|
14
|
-
xLabel = _ref.xLabel,
|
|
15
|
-
FilterSettings = _ref.FilterSettings,
|
|
16
|
-
onChange = _ref.onChange;
|
|
17
|
-
var onXAxisColumnChange = useCallback(function (option) {
|
|
18
|
-
var config = statistic.config;
|
|
19
|
-
var x_axis_column_key = config.x_axis_column_key;
|
|
20
|
-
var column = option.value;
|
|
21
|
-
var newXAxisColumnKey = column.key,
|
|
22
|
-
type = column.type;
|
|
23
|
-
var validValue = newXAxisColumnKey === 'Groupby_null' ? null : newXAxisColumnKey;
|
|
24
|
-
if (x_axis_column_key === validValue) return;
|
|
25
|
-
var update = {
|
|
26
|
-
x_axis_column_key: validValue
|
|
27
|
-
};
|
|
28
|
-
if (!validValue) {
|
|
29
|
-
update['x_axis_date_granularity'] = null;
|
|
30
|
-
update['x_axis_geolocation_granularity'] = null;
|
|
31
|
-
} else {
|
|
32
|
-
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
33
|
-
update['x_axis_date_granularity'] = STATISTIC_SUMMARY_TYPE.MONTH;
|
|
34
|
-
update['x_axis_geolocation_granularity'] = null;
|
|
35
|
-
} else if (type === CellType.GEOLOCATION) {
|
|
36
|
-
var _ref2 = column.data || {},
|
|
37
|
-
geo_format = _ref2.geo_format;
|
|
38
|
-
if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE) {
|
|
39
|
-
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_MAP.PROVINCE;
|
|
40
|
-
} else if (geo_format === GEOLOCATION_FORMAT_MAP.PROVINCE_CITY) {
|
|
41
|
-
update['x_axis_geolocation_granularity'] = GEOLOCATION_FORMAT_CITY;
|
|
42
|
-
} else if (geo_format === GEOLOCATION_FORMAT_MAP.GEOLOCATION || !geo_format) {
|
|
43
|
-
update['x_axis_geolocation_granularity'] = 'district';
|
|
44
|
-
} else {
|
|
45
|
-
update['x_axis_geolocation_granularity'] = null;
|
|
46
|
-
}
|
|
47
|
-
update['x_axis_date_granularity'] = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
onChange && onChange(update);
|
|
51
|
-
}, [statistic, onChange]);
|
|
52
|
-
var onGroupbyDateGranularityChange = useCallback(function (option) {
|
|
53
|
-
var config = statistic.config;
|
|
54
|
-
var x_axis_date_granularity = config.x_axis_date_granularity;
|
|
55
|
-
var value = option.value;
|
|
56
|
-
if (value === x_axis_date_granularity) return;
|
|
57
|
-
onChange && onChange({
|
|
58
|
-
x_axis_date_granularity: value
|
|
59
|
-
});
|
|
60
|
-
}, [statistic, onChange]);
|
|
61
|
-
var onGroupbyGeolocationGranularityChange = useCallback(function (option) {
|
|
62
|
-
var config = statistic.config;
|
|
63
|
-
var x_axis_geolocation_granularity = config.x_axis_geolocation_granularity;
|
|
64
|
-
var value = option.value;
|
|
65
|
-
if (value === x_axis_geolocation_granularity) return;
|
|
66
|
-
onChange && onChange({
|
|
67
|
-
x_axis_geolocation_granularity: value
|
|
68
|
-
});
|
|
69
|
-
}, [statistic, onChange]);
|
|
70
|
-
var onIncludeEmptyChange = useCallback(function (event) {
|
|
71
|
-
eventStopPropagation(event);
|
|
72
|
-
var config = statistic.config;
|
|
73
|
-
var x_axis_include_empty_cells = config.x_axis_include_empty_cells;
|
|
74
|
-
onChange && onChange({
|
|
75
|
-
x_axis_include_empty_cells: !x_axis_include_empty_cells
|
|
76
|
-
});
|
|
77
|
-
}, [statistic, onChange]);
|
|
78
|
-
var _onChangeSummaryType = useCallback(function (option, position) {
|
|
79
|
-
var config = statistic.config;
|
|
80
|
-
var y_axis_right_summary_type = config.y_axis_right_summary_type,
|
|
81
|
-
y_axis_left_summary_type = config.y_axis_left_summary_type,
|
|
82
|
-
y_axis_right_summary_column = config.y_axis_right_summary_column,
|
|
83
|
-
y_axis_left_summary_column = config.y_axis_left_summary_column,
|
|
84
|
-
y_axis_left_group_by_multiple_numeric_column = config.y_axis_left_group_by_multiple_numeric_column,
|
|
85
|
-
y_axis_left_summary_method = config.y_axis_left_summary_method,
|
|
86
|
-
y_axis_left_group_by_numeric_columns = config.y_axis_left_group_by_numeric_columns;
|
|
87
|
-
var newSummaryType = option === STATISTIC_Y_GROUP_TYPE.COUNT ? STATISTIC_SUMMARY_TYPE.COUNT : STATISTIC_SUMMARY_TYPE.ADVANCED;
|
|
88
|
-
if (position === COMBINATION_POSITION.LEFT) {
|
|
89
|
-
if (newSummaryType === STATISTIC_SUMMARY_TYPE.COUNT && y_axis_left_summary_type === STATISTIC_SUMMARY_TYPE.COUNT) return;
|
|
90
|
-
if (option === STATISTIC_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN && !y_axis_left_group_by_multiple_numeric_column && y_axis_left_summary_type !== STATISTIC_SUMMARY_TYPE.COUNT) return;
|
|
91
|
-
if (option === STATISTIC_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN && y_axis_left_group_by_multiple_numeric_column) return;
|
|
92
|
-
if (option === STATISTIC_Y_GROUP_TYPE.COUNT) {
|
|
93
|
-
y_axis_left_summary_column = null;
|
|
94
|
-
y_axis_left_summary_method = 'sum';
|
|
95
|
-
y_axis_left_group_by_multiple_numeric_column = false;
|
|
96
|
-
y_axis_left_group_by_numeric_columns = [];
|
|
97
|
-
}
|
|
98
|
-
if (option === STATISTIC_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN) {
|
|
99
|
-
y_axis_left_summary_column = null;
|
|
100
|
-
y_axis_left_summary_method = STATISTIC_SUMMARY_CALCULATION_METHOD[0];
|
|
101
|
-
y_axis_left_group_by_multiple_numeric_column = false;
|
|
102
|
-
y_axis_left_group_by_numeric_columns = [];
|
|
103
|
-
}
|
|
104
|
-
if (option === STATISTIC_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN) {
|
|
105
|
-
y_axis_left_summary_column = null;
|
|
106
|
-
y_axis_left_summary_method = STATISTIC_SUMMARY_CALCULATION_METHOD[0];
|
|
107
|
-
y_axis_left_group_by_multiple_numeric_column = true;
|
|
108
|
-
y_axis_left_group_by_numeric_columns = [];
|
|
109
|
-
}
|
|
110
|
-
onChange && onChange({
|
|
111
|
-
y_axis_left_summary_type: newSummaryType,
|
|
112
|
-
y_axis_left_summary_column: y_axis_left_summary_column,
|
|
113
|
-
y_axis_left_summary_method: y_axis_left_summary_method,
|
|
114
|
-
y_axis_left_group_by_multiple_numeric_column: y_axis_left_group_by_multiple_numeric_column,
|
|
115
|
-
y_axis_left_group_by_numeric_columns: y_axis_left_group_by_numeric_columns
|
|
116
|
-
});
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (y_axis_right_summary_type === newSummaryType) return;
|
|
120
|
-
y_axis_right_summary_type = newSummaryType;
|
|
121
|
-
var y_axis_right_summary_method = STATISTIC_SUMMARY_CALCULATION_METHOD[0];
|
|
122
|
-
if (newSummaryType === STATISTIC_SUMMARY_TYPE.COUNT) {
|
|
123
|
-
y_axis_right_summary_column = null;
|
|
124
|
-
y_axis_right_summary_method = 'sum';
|
|
125
|
-
}
|
|
126
|
-
onChange && onChange({
|
|
127
|
-
y_axis_right_summary_type: newSummaryType,
|
|
128
|
-
y_axis_right_summary_column: y_axis_right_summary_column,
|
|
129
|
-
y_axis_right_summary_method: y_axis_right_summary_method
|
|
130
|
-
});
|
|
131
|
-
}, [statistic, onChange]);
|
|
132
|
-
var _onSelectSummaryColumn = useCallback(function (option, position) {
|
|
133
|
-
var config = statistic.config;
|
|
134
|
-
var y_axis_right_summary_column = config.y_axis_right_summary_column,
|
|
135
|
-
y_axis_left_summary_column = config.y_axis_left_summary_column,
|
|
136
|
-
y_axis_left_summary_method = config.y_axis_left_summary_method,
|
|
137
|
-
y_axis_right_summary_method = config.y_axis_right_summary_method;
|
|
138
|
-
var newSummaryColumnKey = option;
|
|
139
|
-
if (position === COMBINATION_POSITION.LEFT) {
|
|
140
|
-
if (y_axis_left_summary_column === newSummaryColumnKey) return;
|
|
141
|
-
if (!y_axis_left_summary_method) {
|
|
142
|
-
y_axis_left_summary_method = 'Sum';
|
|
143
|
-
}
|
|
144
|
-
onChange && onChange({
|
|
145
|
-
y_axis_left_summary_column: newSummaryColumnKey,
|
|
146
|
-
y_axis_left_summary_method: y_axis_left_summary_method
|
|
147
|
-
});
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (y_axis_right_summary_column === newSummaryColumnKey) return;
|
|
151
|
-
if (!y_axis_right_summary_method) {
|
|
152
|
-
y_axis_right_summary_method = 'Sum';
|
|
153
|
-
}
|
|
154
|
-
onChange && onChange({
|
|
155
|
-
y_axis_right_summary_column: newSummaryColumnKey,
|
|
156
|
-
y_axis_right_summary_method: y_axis_right_summary_method
|
|
157
|
-
});
|
|
158
|
-
}, [statistic, onChange]);
|
|
159
|
-
var _onSelectSummaryMethod = useCallback(function (option, position) {
|
|
160
|
-
var config = statistic.config;
|
|
161
|
-
var y_axis_right_summary_method = config.y_axis_right_summary_method,
|
|
162
|
-
y_axis_left_summary_method = config.y_axis_left_summary_method;
|
|
163
|
-
var newSummaryColumnMethod = option;
|
|
164
|
-
if (position === COMBINATION_POSITION.LEFT) {
|
|
165
|
-
if (y_axis_left_summary_method !== newSummaryColumnMethod) {
|
|
166
|
-
onChange && onChange({
|
|
167
|
-
y_axis_left_summary_method: newSummaryColumnMethod
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (y_axis_right_summary_method === newSummaryColumnMethod) return;
|
|
173
|
-
onChange && onChange({
|
|
174
|
-
y_axis_right_summary_method: newSummaryColumnMethod
|
|
175
|
-
});
|
|
176
|
-
}, [statistic, onChange]);
|
|
177
|
-
var config = statistic.config;
|
|
178
|
-
var table_id = config.table_id,
|
|
179
|
-
x_axis_column_key = config.x_axis_column_key,
|
|
180
|
-
x_axis_date_granularity = config.x_axis_date_granularity,
|
|
181
|
-
x_axis_geolocation_granularity = config.x_axis_geolocation_granularity,
|
|
182
|
-
x_axis_include_empty_cells = config.x_axis_include_empty_cells,
|
|
183
|
-
y_axis_right_summary_type = config.y_axis_right_summary_type,
|
|
184
|
-
y_axis_right_summary_method = config.y_axis_right_summary_method,
|
|
185
|
-
y_axis_right_summary_column = config.y_axis_right_summary_column,
|
|
186
|
-
y_axis_left_summary_type = config.y_axis_left_summary_type,
|
|
187
|
-
y_axis_left_summary_method = config.y_axis_left_summary_method,
|
|
188
|
-
y_axis_left_summary_column = config.y_axis_left_summary_column;
|
|
189
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
190
|
-
statistic: statistic,
|
|
191
|
-
tables: tables,
|
|
192
|
-
FilterSettings: FilterSettings,
|
|
193
|
-
onChange: onChange
|
|
194
|
-
}), /*#__PURE__*/React.createElement(GroupBy, {
|
|
195
|
-
tables: tables,
|
|
196
|
-
className: "selected-x-axis",
|
|
197
|
-
label: intl.get(xLabel),
|
|
198
|
-
selectedTableId: table_id,
|
|
199
|
-
selectedColumnKey: x_axis_column_key,
|
|
200
|
-
selectedDateGranularity: x_axis_date_granularity,
|
|
201
|
-
selectedGeolocationGranularity: x_axis_geolocation_granularity,
|
|
202
|
-
onGroupByChange: onXAxisColumnChange,
|
|
203
|
-
onGroupbyDateGranularityChange: onGroupbyDateGranularityChange,
|
|
204
|
-
onGroupbyGeolocationGranularityChange: onGroupbyGeolocationGranularityChange
|
|
205
|
-
}), /*#__PURE__*/React.createElement(Switch, {
|
|
206
|
-
key: "x_axis_include_empty_cells",
|
|
207
|
-
checked: x_axis_include_empty_cells,
|
|
208
|
-
placeholder: intl.get('Include_empty'),
|
|
209
|
-
onChange: onIncludeEmptyChange
|
|
210
|
-
}), /*#__PURE__*/React.createElement(Divider, {
|
|
211
|
-
className: "mt-4"
|
|
212
|
-
}), /*#__PURE__*/React.createElement(SummarySettings, {
|
|
213
|
-
chartType: 'combination_chart',
|
|
214
|
-
label: intl.get('Y-axis(left side)'),
|
|
215
|
-
config: config,
|
|
216
|
-
statistic: statistic,
|
|
217
|
-
summaryType: y_axis_left_summary_type,
|
|
218
|
-
summaryMethod: y_axis_left_summary_method,
|
|
219
|
-
summaryColumn: y_axis_left_summary_column,
|
|
220
|
-
onChangeSummaryType: function onChangeSummaryType(option) {
|
|
221
|
-
return _onChangeSummaryType(option, COMBINATION_POSITION.LEFT);
|
|
222
|
-
},
|
|
223
|
-
onSelectSummaryColumn: function onSelectSummaryColumn(option) {
|
|
224
|
-
return _onSelectSummaryColumn(option, COMBINATION_POSITION.LEFT);
|
|
225
|
-
},
|
|
226
|
-
onSelectSummaryMethod: function onSelectSummaryMethod(option) {
|
|
227
|
-
return _onSelectSummaryMethod(option, COMBINATION_POSITION.LEFT);
|
|
228
|
-
},
|
|
229
|
-
useMultipleSummaryColumns: true,
|
|
230
|
-
tables: tables,
|
|
231
|
-
onChange: onChange
|
|
232
|
-
}), /*#__PURE__*/React.createElement(SummarySettings, {
|
|
233
|
-
chartType: 'combination_chart',
|
|
234
|
-
label: intl.get('Y-axis(right side)'),
|
|
235
|
-
config: config,
|
|
236
|
-
summaryType: y_axis_right_summary_type,
|
|
237
|
-
summaryMethod: y_axis_right_summary_method,
|
|
238
|
-
summaryColumn: y_axis_right_summary_column,
|
|
239
|
-
onChangeSummaryType: function onChangeSummaryType(option) {
|
|
240
|
-
return _onChangeSummaryType(option, COMBINATION_POSITION.RIGHT);
|
|
241
|
-
},
|
|
242
|
-
onSelectSummaryColumn: function onSelectSummaryColumn(option) {
|
|
243
|
-
return _onSelectSummaryColumn(option, COMBINATION_POSITION.RIGHT);
|
|
244
|
-
},
|
|
245
|
-
onSelectSummaryMethod: function onSelectSummaryMethod(option) {
|
|
246
|
-
return _onSelectSummaryMethod(option, COMBINATION_POSITION.RIGHT);
|
|
247
|
-
},
|
|
248
|
-
tables: tables,
|
|
249
|
-
statistic: statistic,
|
|
250
|
-
onChange: onChange
|
|
251
|
-
}));
|
|
252
|
-
};
|
|
253
|
-
DataSettings.defaultProps = {
|
|
254
|
-
xLabel: 'X_axis'
|
|
255
|
-
};
|
|
256
|
-
export default DataSettings;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import React, { useCallback, useMemo } from 'react';
|
|
3
|
-
import { Label, FormGroup } from 'reactstrap';
|
|
4
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
5
|
-
import Switch from '../widgets/switch';
|
|
6
|
-
import Divider from '../widgets/divider';
|
|
7
|
-
import MinMaxSetting from '../widgets/min-max-setting';
|
|
8
|
-
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
9
|
-
import { eventStopPropagation } from '../../../utils';
|
|
10
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../../constants';
|
|
11
|
-
import intl from '../../../intl';
|
|
12
|
-
var StyleSettings = function StyleSettings(_ref) {
|
|
13
|
-
var statistic = _ref.statistic,
|
|
14
|
-
onChange = _ref.onChange,
|
|
15
|
-
xLabel = _ref.xLabel;
|
|
16
|
-
var xAxisLabelOptions = useMemo(function () {
|
|
17
|
-
return X_LABEL_POSITIONS.map(function (item) {
|
|
18
|
-
return {
|
|
19
|
-
value: item,
|
|
20
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
}, []);
|
|
24
|
-
var yAxisLabelOptions = useMemo(function () {
|
|
25
|
-
return Y_LABEL_POSITIONS.map(function (item) {
|
|
26
|
-
return {
|
|
27
|
-
value: item,
|
|
28
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}, []);
|
|
32
|
-
var onAxisLabelShowChange = useCallback(function (event, labelKey) {
|
|
33
|
-
eventStopPropagation(event);
|
|
34
|
-
var config = statistic.config;
|
|
35
|
-
var value = config[labelKey];
|
|
36
|
-
onChange && onChange(_defineProperty({}, labelKey, !value));
|
|
37
|
-
}, [statistic, onChange]);
|
|
38
|
-
var onAxisLabelPositionChange = useCallback(function (option, positionKey) {
|
|
39
|
-
var position = option.value;
|
|
40
|
-
var config = statistic.config;
|
|
41
|
-
var oldValue = config[positionKey];
|
|
42
|
-
if (position === oldValue) return;
|
|
43
|
-
onChange && onChange(_defineProperty({}, positionKey, position));
|
|
44
|
-
}, [statistic, onChange]);
|
|
45
|
-
var onToggleYAxisAutoRange = useCallback(function (key) {
|
|
46
|
-
var config = statistic.config;
|
|
47
|
-
var update = _defineProperty({}, key, config[key] === undefined ? false : !config[key]);
|
|
48
|
-
onChange && onChange(update);
|
|
49
|
-
}, [statistic, onChange]);
|
|
50
|
-
var onYAxisMinChange = useCallback(function (key, min) {
|
|
51
|
-
var newMin = parseInt(min);
|
|
52
|
-
if (Number.isNaN(newMin)) return;
|
|
53
|
-
var update = _defineProperty({}, key, newMin);
|
|
54
|
-
onChange && onChange(update);
|
|
55
|
-
}, [onChange]);
|
|
56
|
-
var onYAxisMaxChange = useCallback(function (key, max) {
|
|
57
|
-
var newMax = parseInt(max);
|
|
58
|
-
if (Number.isNaN(newMax)) return;
|
|
59
|
-
var update = _defineProperty({}, key, newMax);
|
|
60
|
-
onChange && onChange(update);
|
|
61
|
-
}, [onChange]);
|
|
62
|
-
var onDisplayValueChange = useCallback(function (update) {
|
|
63
|
-
onChange && onChange(update);
|
|
64
|
-
}, [onChange]);
|
|
65
|
-
var config = statistic.config;
|
|
66
|
-
var x_axis_show_label = config.x_axis_show_label,
|
|
67
|
-
x_axis_label_position = config.x_axis_label_position,
|
|
68
|
-
show_y_axis_left_label = config.show_y_axis_left_label,
|
|
69
|
-
y_axis_left_label_position = config.y_axis_left_label_position,
|
|
70
|
-
y_axis_right_label_position = config.y_axis_right_label_position,
|
|
71
|
-
show_y_axis_right_label = config.show_y_axis_right_label,
|
|
72
|
-
y_axis_min_left = config.y_axis_min_left,
|
|
73
|
-
y_axis_auto_range_left = config.y_axis_auto_range_left,
|
|
74
|
-
y_axis_max_left = config.y_axis_max_left,
|
|
75
|
-
y_axis_auto_range_right = config.y_axis_auto_range_right,
|
|
76
|
-
y_axis_min_right = config.y_axis_min_right,
|
|
77
|
-
y_axis_max_right = config.y_axis_max_right,
|
|
78
|
-
display_data = config.display_data,
|
|
79
|
-
label_font_size = config.label_font_size;
|
|
80
|
-
var xAxisLabelPosition = xAxisLabelOptions.find(function (option) {
|
|
81
|
-
return option.value === x_axis_label_position;
|
|
82
|
-
}) || xAxisLabelOptions[0];
|
|
83
|
-
var yLeftAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
84
|
-
return option.value === y_axis_left_label_position;
|
|
85
|
-
}) || yAxisLabelOptions[0];
|
|
86
|
-
var yRightAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
87
|
-
return option.value === y_axis_right_label_position;
|
|
88
|
-
}) || yAxisLabelOptions[0];
|
|
89
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
90
|
-
className: "seastatistic-parameter-item"
|
|
91
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
92
|
-
key: "x_axis_show_label",
|
|
93
|
-
checked: x_axis_show_label || false,
|
|
94
|
-
placeholder: intl.get('Display_title'),
|
|
95
|
-
onChange: function onChange(event) {
|
|
96
|
-
return onAxisLabelShowChange(event, 'x_axis_show_label');
|
|
97
|
-
}
|
|
98
|
-
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
99
|
-
value: xAxisLabelPosition,
|
|
100
|
-
options: xAxisLabelOptions,
|
|
101
|
-
onChange: function onChange(option) {
|
|
102
|
-
return onAxisLabelPositionChange(option, 'x_axis_label_position');
|
|
103
|
-
}
|
|
104
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
105
|
-
className: "seastatistic-parameter-item"
|
|
106
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Y-axis(left side)')), /*#__PURE__*/React.createElement(Switch, {
|
|
107
|
-
key: "show_y_axis_left_label",
|
|
108
|
-
checked: show_y_axis_left_label || false,
|
|
109
|
-
placeholder: intl.get('Display_title'),
|
|
110
|
-
onChange: function onChange(event) {
|
|
111
|
-
return onAxisLabelShowChange(event, 'show_y_axis_left_label');
|
|
112
|
-
}
|
|
113
|
-
}), show_y_axis_left_label && /*#__PURE__*/React.createElement("div", {
|
|
114
|
-
className: "seastatistic-parameter-container"
|
|
115
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
116
|
-
value: yLeftAxisLabelPosition,
|
|
117
|
-
classNamePrefix: "chart-y-axis-label-position",
|
|
118
|
-
options: yAxisLabelOptions,
|
|
119
|
-
onChange: function onChange(option) {
|
|
120
|
-
return onAxisLabelPositionChange(option, 'y_axis_left_label_position');
|
|
121
|
-
}
|
|
122
|
-
})), /*#__PURE__*/React.createElement(Switch, {
|
|
123
|
-
key: "y_axis_auto_range_left",
|
|
124
|
-
checked: y_axis_auto_range_left,
|
|
125
|
-
placeholder: intl.get('Auto_range'),
|
|
126
|
-
onChange: function onChange() {
|
|
127
|
-
return onToggleYAxisAutoRange('y_axis_auto_range_left');
|
|
128
|
-
}
|
|
129
|
-
}), !y_axis_auto_range_left && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
130
|
-
min: y_axis_min_left,
|
|
131
|
-
max: y_axis_max_left,
|
|
132
|
-
onMinChange: function onMinChange(value) {
|
|
133
|
-
return onYAxisMinChange('y_axis_min_left', value);
|
|
134
|
-
},
|
|
135
|
-
onMaxChange: function onMaxChange(value) {
|
|
136
|
-
return onYAxisMaxChange('y_axis_max_left', value);
|
|
137
|
-
}
|
|
138
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
139
|
-
className: "seastatistic-parameter-item"
|
|
140
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Y-axis(right side)')), /*#__PURE__*/React.createElement(Switch, {
|
|
141
|
-
key: "show_y_axis_right_label",
|
|
142
|
-
checked: show_y_axis_right_label || false,
|
|
143
|
-
placeholder: intl.get('Display_title'),
|
|
144
|
-
onChange: function onChange(event) {
|
|
145
|
-
return onAxisLabelShowChange(event, 'show_y_axis_right_label');
|
|
146
|
-
}
|
|
147
|
-
}), show_y_axis_right_label && /*#__PURE__*/React.createElement("div", {
|
|
148
|
-
className: "seastatistic-parameter-container"
|
|
149
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
150
|
-
value: yRightAxisLabelPosition,
|
|
151
|
-
classNamePrefix: "chart-y-axis-label-position",
|
|
152
|
-
options: yAxisLabelOptions,
|
|
153
|
-
onChange: function onChange(option) {
|
|
154
|
-
return onAxisLabelPositionChange(option, 'y_axis_right_label_position');
|
|
155
|
-
}
|
|
156
|
-
})), /*#__PURE__*/React.createElement(Switch, {
|
|
157
|
-
key: "y_axis_auto_range_right",
|
|
158
|
-
checked: y_axis_auto_range_right,
|
|
159
|
-
placeholder: intl.get('Auto_range'),
|
|
160
|
-
onChange: function onChange() {
|
|
161
|
-
return onToggleYAxisAutoRange('y_axis_auto_range_right');
|
|
162
|
-
}
|
|
163
|
-
}), !y_axis_auto_range_right && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
164
|
-
min: y_axis_min_right,
|
|
165
|
-
max: y_axis_max_right,
|
|
166
|
-
onMinChange: function onMinChange(value) {
|
|
167
|
-
return onYAxisMinChange('y_axis_min_right', value);
|
|
168
|
-
},
|
|
169
|
-
onMaxChange: function onMaxChange(value) {
|
|
170
|
-
return onYAxisMaxChange('y_axis_max_right', value);
|
|
171
|
-
}
|
|
172
|
-
})), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
173
|
-
isShowValueKey: "display_data",
|
|
174
|
-
isShowValue: display_data,
|
|
175
|
-
fontSizeKey: "label_font_size",
|
|
176
|
-
fontSize: label_font_size,
|
|
177
|
-
onChange: onDisplayValueChange
|
|
178
|
-
}));
|
|
179
|
-
};
|
|
180
|
-
StyleSettings.defaultProps = {
|
|
181
|
-
xLabel: 'X_axis'
|
|
182
|
-
};
|
|
183
|
-
export default StyleSettings;
|