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,191 +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 { eventStopPropagation } from '../../../utils';
|
|
9
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, LABEL_COLORS } from '../../../constants';
|
|
10
|
-
import intl from '../../../intl';
|
|
11
|
-
var StyleSettings = function StyleSettings(_ref) {
|
|
12
|
-
var statistic = _ref.statistic,
|
|
13
|
-
onChange = _ref.onChange;
|
|
14
|
-
var xAxisLabelOptions = useMemo(function () {
|
|
15
|
-
return X_LABEL_POSITIONS.map(function (item) {
|
|
16
|
-
return {
|
|
17
|
-
value: item,
|
|
18
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
}, []);
|
|
22
|
-
var yAxisLabelOptions = useMemo(function () {
|
|
23
|
-
return Y_LABEL_POSITIONS.map(function (item) {
|
|
24
|
-
return {
|
|
25
|
-
value: item,
|
|
26
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
}, []);
|
|
30
|
-
var onAxisLabelShowChange = useCallback(function (event, labelKey) {
|
|
31
|
-
eventStopPropagation(event);
|
|
32
|
-
var config = statistic.config;
|
|
33
|
-
var value = config[labelKey];
|
|
34
|
-
onChange && onChange(_defineProperty({}, labelKey, !value));
|
|
35
|
-
}, [statistic, onChange]);
|
|
36
|
-
var onAxisLabelPositionChange = useCallback(function (option, positionKey) {
|
|
37
|
-
var position = option.value;
|
|
38
|
-
var config = statistic.config;
|
|
39
|
-
var oldValue = config[positionKey];
|
|
40
|
-
if (position === oldValue) return;
|
|
41
|
-
onChange && onChange(_defineProperty({}, positionKey, position));
|
|
42
|
-
}, [statistic, onChange]);
|
|
43
|
-
var onYAxisAutoRangeChange = useCallback(function (event) {
|
|
44
|
-
eventStopPropagation(event);
|
|
45
|
-
var config = statistic.config;
|
|
46
|
-
var y_axis_auto_range = config.y_axis_auto_range;
|
|
47
|
-
onChange && onChange({
|
|
48
|
-
y_axis_auto_range: !y_axis_auto_range
|
|
49
|
-
});
|
|
50
|
-
}, [statistic, onChange]);
|
|
51
|
-
var onYAxisMinChange = useCallback(function (min) {
|
|
52
|
-
var newMin = parseInt(min);
|
|
53
|
-
if (Number.isNaN(newMin)) return;
|
|
54
|
-
var config = statistic.config;
|
|
55
|
-
var y_axis_min = config.y_axis_min;
|
|
56
|
-
if (y_axis_min === newMin) return;
|
|
57
|
-
onChange && onChange({
|
|
58
|
-
y_axis_min: newMin
|
|
59
|
-
});
|
|
60
|
-
}, [statistic, onChange]);
|
|
61
|
-
var onYAxisMaxChange = useCallback(function (max) {
|
|
62
|
-
var newMax = parseInt(max);
|
|
63
|
-
if (Number.isNaN(newMax)) return;
|
|
64
|
-
var config = statistic.config;
|
|
65
|
-
var y_axis_max = config.y_axis_max;
|
|
66
|
-
if (y_axis_max === newMax) return;
|
|
67
|
-
onChange && onChange({
|
|
68
|
-
y_axis_max: newMax
|
|
69
|
-
});
|
|
70
|
-
}, [statistic, onChange]);
|
|
71
|
-
var onDisplayValueChange = useCallback(function (event) {
|
|
72
|
-
eventStopPropagation(event);
|
|
73
|
-
var config = statistic.config;
|
|
74
|
-
var y_axis_show_value = config.y_axis_show_value;
|
|
75
|
-
onChange && onChange({
|
|
76
|
-
y_axis_show_value: !y_axis_show_value
|
|
77
|
-
});
|
|
78
|
-
}, [statistic, onChange]);
|
|
79
|
-
var onDisplayPercentageIncreaseChange = useCallback(function (event) {
|
|
80
|
-
eventStopPropagation(event);
|
|
81
|
-
var config = statistic.config;
|
|
82
|
-
var display_increase_percentage = config.display_increase_percentage;
|
|
83
|
-
onChange && onChange({
|
|
84
|
-
display_increase_percentage: !display_increase_percentage
|
|
85
|
-
});
|
|
86
|
-
}, [statistic, onChange]);
|
|
87
|
-
var onIncreaseDisplayColorChang = useCallback(function (event, value) {
|
|
88
|
-
eventStopPropagation(event);
|
|
89
|
-
var config = statistic.config;
|
|
90
|
-
var increase_display_color = config.increase_display_color;
|
|
91
|
-
if (increase_display_color === value) return;
|
|
92
|
-
onChange && onChange({
|
|
93
|
-
increase_display_color: value
|
|
94
|
-
});
|
|
95
|
-
}, [statistic, onChange]);
|
|
96
|
-
var config = statistic.config;
|
|
97
|
-
var x_axis_show_label = config.x_axis_show_label,
|
|
98
|
-
x_axis_label_position = config.x_axis_label_position,
|
|
99
|
-
y_axis_show_label = config.y_axis_show_label,
|
|
100
|
-
y_axis_label_position = config.y_axis_label_position,
|
|
101
|
-
_config$y_axis_auto_r = config.y_axis_auto_range,
|
|
102
|
-
y_axis_auto_range = _config$y_axis_auto_r === void 0 ? true : _config$y_axis_auto_r,
|
|
103
|
-
y_axis_min = config.y_axis_min,
|
|
104
|
-
y_axis_max = config.y_axis_max,
|
|
105
|
-
y_axis_show_value = config.y_axis_show_value,
|
|
106
|
-
display_increase = config.display_increase,
|
|
107
|
-
display_increase_percentage = config.display_increase_percentage,
|
|
108
|
-
increase_display_color = config.increase_display_color;
|
|
109
|
-
var xAxisLabelPosition = xAxisLabelOptions.find(function (option) {
|
|
110
|
-
return option.value === x_axis_label_position;
|
|
111
|
-
}) || xAxisLabelOptions[0];
|
|
112
|
-
var yAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
113
|
-
return option.value === y_axis_label_position;
|
|
114
|
-
}) || yAxisLabelOptions[0];
|
|
115
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
116
|
-
className: "seastatistic-parameter-item"
|
|
117
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('X_axis')), /*#__PURE__*/React.createElement(Switch, {
|
|
118
|
-
key: "x_axis_show_label",
|
|
119
|
-
checked: x_axis_show_label || false,
|
|
120
|
-
placeholder: intl.get('Display_title'),
|
|
121
|
-
onChange: function onChange(event) {
|
|
122
|
-
return onAxisLabelShowChange(event, 'x_axis_show_label');
|
|
123
|
-
}
|
|
124
|
-
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
125
|
-
value: xAxisLabelPosition,
|
|
126
|
-
options: xAxisLabelOptions,
|
|
127
|
-
onChange: function onChange(option) {
|
|
128
|
-
return onAxisLabelPositionChange(option, 'x_axis_label_position');
|
|
129
|
-
}
|
|
130
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
131
|
-
className: "seastatistic-parameter-item"
|
|
132
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Y_axis')), /*#__PURE__*/React.createElement(Switch, {
|
|
133
|
-
key: "y_axis_show_label",
|
|
134
|
-
checked: y_axis_show_label || false,
|
|
135
|
-
placeholder: intl.get('Display_title'),
|
|
136
|
-
onChange: function onChange(event) {
|
|
137
|
-
return onAxisLabelShowChange(event, 'y_axis_show_label');
|
|
138
|
-
}
|
|
139
|
-
}), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: "seastatistic-parameter-container"
|
|
141
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
142
|
-
value: yAxisLabelPosition,
|
|
143
|
-
classNamePrefix: "chart-y-axis-label-position",
|
|
144
|
-
options: yAxisLabelOptions,
|
|
145
|
-
onChange: function onChange(option) {
|
|
146
|
-
return onAxisLabelPositionChange(option, 'y_axis_label_position');
|
|
147
|
-
}
|
|
148
|
-
})), /*#__PURE__*/React.createElement(Switch, {
|
|
149
|
-
key: "y_axis_auto_range",
|
|
150
|
-
checked: y_axis_auto_range,
|
|
151
|
-
placeholder: intl.get('Auto_range'),
|
|
152
|
-
onChange: onYAxisAutoRangeChange
|
|
153
|
-
}), !y_axis_auto_range && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
154
|
-
min: y_axis_min,
|
|
155
|
-
max: y_axis_max,
|
|
156
|
-
onMinChange: onYAxisMinChange,
|
|
157
|
-
onMaxChange: onYAxisMaxChange
|
|
158
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Switch, {
|
|
159
|
-
key: "y_axis_show_value",
|
|
160
|
-
checked: y_axis_show_value,
|
|
161
|
-
placeholder: intl.get('Display_value'),
|
|
162
|
-
onChange: onDisplayValueChange
|
|
163
|
-
}), display_increase && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
164
|
-
className: "seastatistic-parameter-item"
|
|
165
|
-
}, /*#__PURE__*/React.createElement(Switch, {
|
|
166
|
-
key: "display_increase_percentage",
|
|
167
|
-
checked: display_increase_percentage || false,
|
|
168
|
-
placeholder: intl.get('Display_percentage_increase'),
|
|
169
|
-
onChange: onDisplayPercentageIncreaseChange
|
|
170
|
-
}), /*#__PURE__*/React.createElement(Label, null, intl.get('Color')), /*#__PURE__*/React.createElement("div", {
|
|
171
|
-
className: "d-flex align-items-center justify-content-between"
|
|
172
|
-
}, LABEL_COLORS.map(function (item, index) {
|
|
173
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
174
|
-
key: "y-axis-label-color-".concat(index)
|
|
175
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
176
|
-
className: "colorinput"
|
|
177
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
178
|
-
className: "colorinput-color statistic-colorinput d-flex justify-content-center align-items-center",
|
|
179
|
-
onClick: function onClick(event) {
|
|
180
|
-
return onIncreaseDisplayColorChang(event, item);
|
|
181
|
-
},
|
|
182
|
-
style: {
|
|
183
|
-
backgroundColor: item,
|
|
184
|
-
borderColor: item
|
|
185
|
-
}
|
|
186
|
-
}, item === (increase_display_color || LABEL_COLORS[3]) && /*#__PURE__*/React.createElement("i", {
|
|
187
|
-
className: "dtable-font dtable-icon-check-mark statistic-check-mark"
|
|
188
|
-
}))));
|
|
189
|
-
})))));
|
|
190
|
-
};
|
|
191
|
-
export default StyleSettings;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
.seastatistic-settings .summary-type-explanation {
|
|
2
|
-
color: #9c9c9c;
|
|
3
|
-
font-size: 12px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.seastatistic-settings .chart-summary-types__option--is-selected .summary-type-explanation {
|
|
7
|
-
color: #9c9c9c !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.seastatistic-settings .chart-summary-types__value-container .summary-type-explanation {
|
|
11
|
-
display: none;
|
|
12
|
-
}
|
|
@@ -1,173 +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 { COLUMNS_ICON_CONFIG, CellType, getTableById } from 'dtable-utils';
|
|
6
|
-
import { StatisticsUtils } from '../../../../utils';
|
|
7
|
-
import { STATISTIC_SUMMARY_SHOW, STATISTIC_SUMMARY_TYPES, STATISTIC_SUMMARY_TYPE, STATISTIC_SUMMARY_CALCULATION_METHOD, STATISTIC_DATE_SUMMARY_CALCULATION_METHOD } from '../../../../constants';
|
|
8
|
-
import intl from '../../../../intl';
|
|
9
|
-
import './index.css';
|
|
10
|
-
var BasicSummary = function BasicSummary(_ref) {
|
|
11
|
-
var tables = _ref.tables,
|
|
12
|
-
statistic = _ref.statistic,
|
|
13
|
-
onChange = _ref.onChange,
|
|
14
|
-
oldSummaryTypeOptions = _ref.summaryTypeOptions,
|
|
15
|
-
summaryTypeKey = _ref.summaryTypeKey,
|
|
16
|
-
summaryColumnKey = _ref.summaryColumnKey,
|
|
17
|
-
summaryMethodKey = _ref.summaryMethodKey,
|
|
18
|
-
_ref$showSummaryTypes = _ref.showSummaryTypes,
|
|
19
|
-
showSummaryTypes = _ref$showSummaryTypes === void 0 ? true : _ref$showSummaryTypes,
|
|
20
|
-
label = _ref.label,
|
|
21
|
-
supportColumnTypes = _ref.supportColumnTypes;
|
|
22
|
-
var selectedTable = useMemo(function () {
|
|
23
|
-
var table_id = statistic.config.table_id;
|
|
24
|
-
return getTableById(tables, table_id);
|
|
25
|
-
}, [tables, statistic.config]);
|
|
26
|
-
var numericColumns = useMemo(function () {
|
|
27
|
-
if (!selectedTable) return [];
|
|
28
|
-
var columns = selectedTable.columns;
|
|
29
|
-
return columns.filter(function (column) {
|
|
30
|
-
return supportColumnTypes.includes(CellType.NUMBER) && StatisticsUtils.isNumericSummaryColumn(column) || supportColumnTypes.includes(CellType.DATE) && StatisticsUtils.isDateSummaryColumn(column);
|
|
31
|
-
});
|
|
32
|
-
}, [selectedTable, supportColumnTypes]);
|
|
33
|
-
var numericColumnOptions = useMemo(function () {
|
|
34
|
-
return numericColumns.map(function (column) {
|
|
35
|
-
return {
|
|
36
|
-
value: column.key,
|
|
37
|
-
column: column,
|
|
38
|
-
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
39
|
-
className: "header-icon"
|
|
40
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
41
|
-
className: COLUMNS_ICON_CONFIG[column.type]
|
|
42
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
43
|
-
className: "select-module select-module-name ml-0"
|
|
44
|
-
}, column.name))
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}, [numericColumns]);
|
|
48
|
-
var summaryTypeOptions = useMemo(function () {
|
|
49
|
-
var summaryExplanation = StatisticsUtils.getSummaryExplanation(statistic);
|
|
50
|
-
return Array.isArray(oldSummaryTypeOptions) ? oldSummaryTypeOptions.map(function (summaryType) {
|
|
51
|
-
return {
|
|
52
|
-
value: summaryType,
|
|
53
|
-
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "select-module select-module-name ml-0"
|
|
55
|
-
}, intl.get(STATISTIC_SUMMARY_SHOW[summaryType])), /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
className: "summary-type-explanation"
|
|
57
|
-
}, summaryExplanation[summaryType]))
|
|
58
|
-
};
|
|
59
|
-
}) : [];
|
|
60
|
-
}, [statistic, oldSummaryTypeOptions]);
|
|
61
|
-
var summaryMethodOptions = useMemo(function () {
|
|
62
|
-
var summaryColumn = numericColumns.find(function (column) {
|
|
63
|
-
return column.key === statistic.config[summaryColumnKey];
|
|
64
|
-
});
|
|
65
|
-
var methods = StatisticsUtils.isNumericSummaryColumn(summaryColumn) ? STATISTIC_SUMMARY_CALCULATION_METHOD : STATISTIC_DATE_SUMMARY_CALCULATION_METHOD;
|
|
66
|
-
return methods.map(function (item) {
|
|
67
|
-
return {
|
|
68
|
-
value: item,
|
|
69
|
-
label: intl.get(STATISTIC_SUMMARY_SHOW[item])
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}, [statistic, numericColumns, summaryColumnKey]);
|
|
73
|
-
var onSummaryTypeChange = useCallback(function (option) {
|
|
74
|
-
var _update;
|
|
75
|
-
var summaryType = option.value;
|
|
76
|
-
var config = statistic.config;
|
|
77
|
-
var oldValue = config[summaryTypeKey];
|
|
78
|
-
if (summaryType === oldValue) return;
|
|
79
|
-
var update = (_update = {}, _defineProperty(_update, summaryTypeKey, summaryType), _defineProperty(_update, summaryColumnKey, ''), _defineProperty(_update, summaryMethodKey, ''), _update);
|
|
80
|
-
if (summaryType === STATISTIC_SUMMARY_TYPE.ADVANCED) {
|
|
81
|
-
update[summaryMethodKey] = STATISTIC_SUMMARY_CALCULATION_METHOD[0];
|
|
82
|
-
}
|
|
83
|
-
if (summaryType === STATISTIC_SUMMARY_TYPE.ADVANCED && numericColumns[0]) {
|
|
84
|
-
update[summaryColumnKey] = numericColumns[0].key;
|
|
85
|
-
}
|
|
86
|
-
onChange && onChange(update);
|
|
87
|
-
}, [statistic, summaryTypeKey, summaryColumnKey, summaryMethodKey, onChange, numericColumns]);
|
|
88
|
-
var onSummaryColumnChange = useCallback(function (option) {
|
|
89
|
-
var _update2;
|
|
90
|
-
var value = option.value;
|
|
91
|
-
var config = statistic.config;
|
|
92
|
-
var oldValue = config[summaryColumnKey];
|
|
93
|
-
if (value === oldValue) return;
|
|
94
|
-
var update = (_update2 = {}, _defineProperty(_update2, summaryColumnKey, value), _defineProperty(_update2, summaryMethodKey, config[summaryMethodKey]), _update2);
|
|
95
|
-
var oldColumn = numericColumns.find(function (column) {
|
|
96
|
-
return column.key === oldValue;
|
|
97
|
-
});
|
|
98
|
-
var newColumn = numericColumns.find(function (column) {
|
|
99
|
-
return column.key === value;
|
|
100
|
-
});
|
|
101
|
-
var isDateColumn = StatisticsUtils.isDateSummaryColumn(newColumn);
|
|
102
|
-
if (StatisticsUtils.isDateSummaryColumn(oldColumn) !== isDateColumn) {
|
|
103
|
-
var methods = isDateColumn ? STATISTIC_DATE_SUMMARY_CALCULATION_METHOD : STATISTIC_SUMMARY_CALCULATION_METHOD;
|
|
104
|
-
if (!methods.includes(config[summaryMethodKey])) {
|
|
105
|
-
update[summaryMethodKey] = methods[0];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
onChange && onChange(update);
|
|
109
|
-
}, [statistic, summaryColumnKey, summaryMethodKey, onChange, numericColumns]);
|
|
110
|
-
var onSummaryMethodChange = useCallback(function (option) {
|
|
111
|
-
var value = option.value;
|
|
112
|
-
var config = statistic.config;
|
|
113
|
-
var oldValue = config[summaryMethodKey];
|
|
114
|
-
if (value === oldValue) return;
|
|
115
|
-
onChange && onChange(_defineProperty({}, summaryMethodKey, value));
|
|
116
|
-
}, [statistic, summaryMethodKey, onChange]);
|
|
117
|
-
var renderNumericColumn = useCallback(function () {
|
|
118
|
-
var column_key = statistic.config[summaryColumnKey];
|
|
119
|
-
var selectedColumnOption = numericColumnOptions.find(function (option) {
|
|
120
|
-
return option.value === column_key;
|
|
121
|
-
});
|
|
122
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
123
|
-
className: "seastatistic-parameter-item"
|
|
124
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
125
|
-
value: selectedColumnOption,
|
|
126
|
-
onChange: onSummaryColumnChange,
|
|
127
|
-
options: numericColumnOptions,
|
|
128
|
-
placeholder: intl.get('Select_a_column'),
|
|
129
|
-
noOptionsMessage: function noOptionsMessage() {
|
|
130
|
-
return /*#__PURE__*/React.createElement("span", null, intl.get('No_options'));
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
}, [statistic, summaryColumnKey, numericColumnOptions, onSummaryColumnChange]);
|
|
134
|
-
var renderSummaryMethod = useCallback(function () {
|
|
135
|
-
var summaryMethod = statistic.config[summaryMethodKey];
|
|
136
|
-
var selectedMethodOption = summaryMethodOptions.find(function (option) {
|
|
137
|
-
return option.value === summaryMethod;
|
|
138
|
-
});
|
|
139
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
140
|
-
className: "seastatistic-parameter-item"
|
|
141
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
142
|
-
value: selectedMethodOption,
|
|
143
|
-
onChange: onSummaryMethodChange,
|
|
144
|
-
options: summaryMethodOptions
|
|
145
|
-
}));
|
|
146
|
-
}, [statistic, summaryMethodKey, onSummaryMethodChange, summaryMethodOptions]);
|
|
147
|
-
var renderOtherSummaries = useCallback(function () {
|
|
148
|
-
var summaryType = statistic.config[summaryTypeKey] || STATISTIC_SUMMARY_TYPE.COUNT;
|
|
149
|
-
if (summaryType !== STATISTIC_SUMMARY_TYPE.ADVANCED) return null;
|
|
150
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderNumericColumn(), renderSummaryMethod());
|
|
151
|
-
}, [summaryTypeKey, statistic, renderNumericColumn, renderSummaryMethod]);
|
|
152
|
-
var summaryType = statistic.config[summaryTypeKey] || STATISTIC_SUMMARY_TYPE.COUNT;
|
|
153
|
-
var selectedSummaryTypeOption = summaryTypeOptions.find(function (item) {
|
|
154
|
-
return item.value === summaryType;
|
|
155
|
-
}) || summaryTypeOptions[0];
|
|
156
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, showSummaryTypes && /*#__PURE__*/React.createElement(FormGroup, {
|
|
157
|
-
className: "seastatistic-parameter-item"
|
|
158
|
-
}, /*#__PURE__*/React.createElement(Label, null, label), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
159
|
-
classNamePrefix: "chart-summary-types",
|
|
160
|
-
value: selectedSummaryTypeOption,
|
|
161
|
-
onChange: onSummaryTypeChange,
|
|
162
|
-
options: summaryTypeOptions
|
|
163
|
-
})), renderOtherSummaries());
|
|
164
|
-
};
|
|
165
|
-
BasicSummary.defaultProps = {
|
|
166
|
-
showSummaryTypes: true,
|
|
167
|
-
summaryTypeKey: 'y_axis_summary_type',
|
|
168
|
-
summaryMethodKey: 'y_axis_summary_method',
|
|
169
|
-
summaryColumnKey: 'y_axis_summary_column_key',
|
|
170
|
-
supportColumnTypes: [CellType.NUMBER, CellType.DATE],
|
|
171
|
-
summaryTypeOptions: STATISTIC_SUMMARY_TYPES
|
|
172
|
-
};
|
|
173
|
-
export default BasicSummary;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
.seatable-app-custom-edit-page .seastatistic-data-filter {
|
|
2
|
-
width: 100%;
|
|
3
|
-
padding: 3px 4px;
|
|
4
|
-
border-radius: 4px;
|
|
5
|
-
line-height: 22px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.seatable-app-custom-edit-page .seastatistic-data-filter:hover {
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
background-color: #efefef;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.seatable-app-custom-edit-page .seastatistic-data-filter .dtable-icon-filter {
|
|
14
|
-
font-size: 14px;
|
|
15
|
-
color: #666;
|
|
16
|
-
margin-right: 10px;
|
|
17
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { Label, FormGroup } from 'reactstrap';
|
|
3
|
-
import DTableRadio from "dtable-ui-component/lib/DTableRadio";
|
|
4
|
-
import { eventStopPropagation } from '../../../utils/';
|
|
5
|
-
import { STATISTIC_DATA_SORT_TYPE, STATISTIC_DATA_SORT_TYPES, STATISTIC_DATA_SORT_TYPE_SHOW } from '../../../constants';
|
|
6
|
-
import intl from '../../../intl';
|
|
7
|
-
var DataSort = function DataSort(_ref) {
|
|
8
|
-
var statistic = _ref.statistic,
|
|
9
|
-
onChange = _ref.onChange;
|
|
10
|
-
var onChangeSortType = useCallback(function (event, sortType) {
|
|
11
|
-
eventStopPropagation(event);
|
|
12
|
-
var config = statistic.config;
|
|
13
|
-
var sort_type = config.sort_type;
|
|
14
|
-
var validSortType = sortType === STATISTIC_DATA_SORT_TYPE.NOT_SORTED ? '' : sortType;
|
|
15
|
-
if (sort_type === validSortType) return;
|
|
16
|
-
onChange && onChange({
|
|
17
|
-
sort_type: validSortType
|
|
18
|
-
});
|
|
19
|
-
}, [statistic, onChange]);
|
|
20
|
-
var sortType = statistic.config.sort_type;
|
|
21
|
-
var selectedSortType = sortType || STATISTIC_DATA_SORT_TYPE.NOT_SORTED;
|
|
22
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
23
|
-
className: "seastatistic-parameter-item"
|
|
24
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Data_sort')), STATISTIC_DATA_SORT_TYPES.map(function (sortType, index) {
|
|
25
|
-
var isChecked = sortType === selectedSortType;
|
|
26
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
key: 'chart-group-item-' + index,
|
|
28
|
-
className: "chart-group-item"
|
|
29
|
-
}, /*#__PURE__*/React.createElement(DTableRadio, {
|
|
30
|
-
isChecked: isChecked,
|
|
31
|
-
onCheckedChange: function onCheckedChange(event) {
|
|
32
|
-
return onChangeSortType(event, sortType);
|
|
33
|
-
},
|
|
34
|
-
label: intl.get(STATISTIC_DATA_SORT_TYPE_SHOW[sortType])
|
|
35
|
-
}));
|
|
36
|
-
}));
|
|
37
|
-
};
|
|
38
|
-
export default DataSort;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import { FormGroup, Label } from 'reactstrap';
|
|
7
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
8
|
-
import { getTableById } from 'dtable-utils';
|
|
9
|
-
import { STATISTIC_TYPE, STATISTIC_DATE_SUMMARY_CALCULATION_METHOD, STATISTIC_SUMMARY_SHOW, STATISTIC_DATE_COLUMN_LIST } from '../../../constants';
|
|
10
|
-
import intl from '../../../intl';
|
|
11
|
-
var DateSummaryItem = /*#__PURE__*/function (_Component) {
|
|
12
|
-
_inherits(DateSummaryItem, _Component);
|
|
13
|
-
var _super = _createSuper(DateSummaryItem);
|
|
14
|
-
function DateSummaryItem(_props) {
|
|
15
|
-
var _this;
|
|
16
|
-
_classCallCheck(this, DateSummaryItem);
|
|
17
|
-
_this = _super.call(this, _props);
|
|
18
|
-
_this.initSummaryMethodOptions = function () {
|
|
19
|
-
_this.summaryMethodOptions = STATISTIC_DATE_SUMMARY_CALCULATION_METHOD.map(function (item) {
|
|
20
|
-
return {
|
|
21
|
-
value: item,
|
|
22
|
-
label: intl.get(STATISTIC_SUMMARY_SHOW[item])
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
_this.initDateColumnOptions = function (props) {
|
|
27
|
-
var tables = props.tables,
|
|
28
|
-
statistic = props.statistic;
|
|
29
|
-
var table_id = statistic.config.table_id;
|
|
30
|
-
var selectedTable = getTableById(tables, table_id);
|
|
31
|
-
if (!selectedTable) {
|
|
32
|
-
_this.dateColumnOptions = [];
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
var columns = selectedTable.columns;
|
|
36
|
-
_this.dateColumnOptions = columns.filter(function (column) {
|
|
37
|
-
return STATISTIC_DATE_COLUMN_LIST.includes(column.type);
|
|
38
|
-
}).map(function (column) {
|
|
39
|
-
return {
|
|
40
|
-
value: column.key,
|
|
41
|
-
label: column.name
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
_this.onToggleExpand = function () {
|
|
46
|
-
_this.setState({
|
|
47
|
-
isExpand: !_this.state.isExpand
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
_this.state = {
|
|
51
|
-
isExpand: true
|
|
52
|
-
};
|
|
53
|
-
_this.initDateColumnOptions(_props);
|
|
54
|
-
_this.initSummaryMethodOptions();
|
|
55
|
-
return _this;
|
|
56
|
-
}
|
|
57
|
-
_createClass(DateSummaryItem, [{
|
|
58
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
59
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
60
|
-
var statistic = nextProps.statistic;
|
|
61
|
-
if (statistic.config.table_id !== this.props.statistic.config.table_id) {
|
|
62
|
-
this.initDateColumnOptions(nextProps);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "render",
|
|
67
|
-
value: function render() {
|
|
68
|
-
var _this2 = this;
|
|
69
|
-
var _this$props = this.props,
|
|
70
|
-
index = _this$props.index,
|
|
71
|
-
statistic = _this$props.statistic,
|
|
72
|
-
value = _this$props.value;
|
|
73
|
-
var type = statistic.config.type;
|
|
74
|
-
var column_key = value.column_key,
|
|
75
|
-
summary_method = value.summary_method;
|
|
76
|
-
var selectedColumnOption = this.dateColumnOptions.find(function (option) {
|
|
77
|
-
return option.value === column_key;
|
|
78
|
-
});
|
|
79
|
-
var selectedSummaryMethodOption = this.summaryMethodOptions.find(function (option) {
|
|
80
|
-
return option.value === summary_method;
|
|
81
|
-
});
|
|
82
|
-
var isExpand = this.state.isExpand;
|
|
83
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
84
|
-
style: {
|
|
85
|
-
paddingBottom: isExpand ? '14px' : '7px'
|
|
86
|
-
},
|
|
87
|
-
className: "seastatistic-parameter-item container"
|
|
88
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
-
className: "numeric-summary-item"
|
|
90
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
91
|
-
className: "title-item title-left"
|
|
92
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
93
|
-
onClick: this.onToggleExpand,
|
|
94
|
-
className: "icon dtable-font ".concat(isExpand ? 'dtable-icon-drop-down' : 'dtable-icon-right-slide')
|
|
95
|
-
}), /*#__PURE__*/React.createElement("label", null, (type === STATISTIC_TYPE.TABLE ? intl.get('Summary_field') : intl.get('Numeric_field')) + (1 + index))), /*#__PURE__*/React.createElement("span", {
|
|
96
|
-
className: "title-item title-right"
|
|
97
|
-
}, index !== 0 && /*#__PURE__*/React.createElement("i", {
|
|
98
|
-
className: "dtable-font dtable-icon-fork-number close-icon",
|
|
99
|
-
onClick: function onClick() {
|
|
100
|
-
return _this2.props.onDelete(index);
|
|
101
|
-
}
|
|
102
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: "".concat(isExpand ? 'expanded-numeric-summary-content' : 'collapsed-numeric-summary-content')
|
|
104
|
-
}, /*#__PURE__*/React.createElement(FormGroup, {
|
|
105
|
-
className: "seastatistic-parameter-item numeric-column"
|
|
106
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
107
|
-
value: selectedColumnOption,
|
|
108
|
-
placeholder: intl.get('Select_a_column'),
|
|
109
|
-
onChange: function onChange(option) {
|
|
110
|
-
return _this2.props.onColumnOptionChange(option, index);
|
|
111
|
-
},
|
|
112
|
-
options: this.dateColumnOptions
|
|
113
|
-
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
114
|
-
className: "seastatistic-parameter-item summary-method"
|
|
115
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
116
|
-
value: selectedSummaryMethodOption,
|
|
117
|
-
onChange: function onChange(option) {
|
|
118
|
-
return _this2.props.onSummaryMethodChange(option, index);
|
|
119
|
-
},
|
|
120
|
-
options: this.summaryMethodOptions
|
|
121
|
-
}))));
|
|
122
|
-
}
|
|
123
|
-
}]);
|
|
124
|
-
return DateSummaryItem;
|
|
125
|
-
}(Component);
|
|
126
|
-
export default DateSummaryItem;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.seastatistic-settings .display-value-settings {
|
|
2
|
-
margin-bottom: 12px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.seastatistic-settings .display-value-settings .custom-switch {
|
|
6
|
-
width: 100%;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.seastatistic-settings .display-value-settings .custom-switch .custom-switch-description {
|
|
11
|
-
flex: 1;
|
|
12
|
-
white-space: unset !important;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import './index.css';
|
|
4
|
-
var Divider = function Divider(_ref) {
|
|
5
|
-
var className = _ref.className;
|
|
6
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
-
className: classnames('seastatistic-divider', className)
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export default Divider;
|