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,21 +1,23 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useMemo } from 'react';
|
|
3
2
|
import TitleText from './title-text';
|
|
4
3
|
import { FontSizeSettings, FontWeightSettings } from '../font-settings';
|
|
5
4
|
import TextHorizontalSettings from '../text-horizontal-settings';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN } from '../../../constants';
|
|
6
|
+
const TitleSetting = props => {
|
|
7
|
+
const initialTitle = useMemo(() => {
|
|
9
8
|
return props.title || {};
|
|
10
9
|
}, [props.title]);
|
|
11
|
-
|
|
10
|
+
const modifyTitle = updated => {
|
|
12
11
|
if (!props.title) {
|
|
13
12
|
props.modifyTitle(updated);
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
16
|
-
props.modifyTitle(
|
|
15
|
+
props.modifyTitle({
|
|
16
|
+
...props.title,
|
|
17
|
+
...updated
|
|
18
|
+
});
|
|
17
19
|
};
|
|
18
|
-
|
|
20
|
+
const modifyText = updatedText => {
|
|
19
21
|
if (!updatedText && !initialTitle.text || updatedText === initialTitle.text) {
|
|
20
22
|
return;
|
|
21
23
|
}
|
|
@@ -23,17 +25,17 @@ var TitleSetting = function TitleSetting(props) {
|
|
|
23
25
|
text: updatedText
|
|
24
26
|
});
|
|
25
27
|
};
|
|
26
|
-
|
|
28
|
+
const modifyFontSize = updatedFontSize => {
|
|
27
29
|
modifyTitle({
|
|
28
30
|
font_size: updatedFontSize
|
|
29
31
|
});
|
|
30
32
|
};
|
|
31
|
-
|
|
33
|
+
const modifyHorizontalAlign = horizontalAlign => {
|
|
32
34
|
modifyTitle({
|
|
33
35
|
horizontal_align: horizontalAlign
|
|
34
36
|
});
|
|
35
37
|
};
|
|
36
|
-
|
|
38
|
+
const modifyFontWeight = updatedFontWeight => {
|
|
37
39
|
modifyTitle({
|
|
38
40
|
font_weight: updatedFontWeight
|
|
39
41
|
});
|
|
@@ -43,11 +45,11 @@ var TitleSetting = function TitleSetting(props) {
|
|
|
43
45
|
modifyText: modifyText
|
|
44
46
|
}), /*#__PURE__*/React.createElement(FontSizeSettings, {
|
|
45
47
|
fontSize: initialTitle.font_size,
|
|
46
|
-
defaultFontSize:
|
|
48
|
+
defaultFontSize: DEFAULT_CHART_TITLE_FONT_SIZE,
|
|
47
49
|
modifyFontSize: modifyFontSize
|
|
48
50
|
}), /*#__PURE__*/React.createElement(FontWeightSettings, {
|
|
49
|
-
fontWeight: initialTitle.font_weight ||
|
|
50
|
-
supportFontWeights:
|
|
51
|
+
fontWeight: initialTitle.font_weight || DEFAULT_CHART_FONT_WEIGHT,
|
|
52
|
+
supportFontWeights: CHART_SUPPORT_FONT_WEIGHTS,
|
|
51
53
|
modifyFontWeight: modifyFontWeight
|
|
52
54
|
}), /*#__PURE__*/React.createElement(TextHorizontalSettings, {
|
|
53
55
|
value: initialTitle.horizontal_align,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { FormGroup, Input, Label } from 'reactstrap';
|
|
3
|
+
import intl from '../../../intl';
|
|
4
|
+
const TitleText = props => {
|
|
5
|
+
const [currText, setCurrText] = useState(props.text || '');
|
|
6
|
+
const onKeyDown = event => {
|
|
7
|
+
if (event.key === 'Enter') {
|
|
8
|
+
event.preventDefault();
|
|
9
|
+
event.target.blur();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const onSaveText = () => {
|
|
13
|
+
props.modifyText(currText);
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
16
|
+
className: "-title-text"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Title')), /*#__PURE__*/React.createElement(Input, {
|
|
18
|
+
type: "text",
|
|
19
|
+
value: currText,
|
|
20
|
+
onBlur: onSaveText,
|
|
21
|
+
onChange: event => setCurrText(event.target.value),
|
|
22
|
+
onKeyDown: onKeyDown
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
export default TitleText;
|
|
File without changes
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { FormGroup, Label } from 'reactstrap';
|
|
3
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
4
|
+
import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
|
|
5
|
+
import NumericSummaryItem from './numeric-summary-item';
|
|
6
|
+
import SummaryMethodSettings from './summary-method-setting';
|
|
7
|
+
import Groupby from './group-by';
|
|
8
|
+
import { CHART_Y_GROUP_TYPE, CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_SUMMARY_TYPE, DATE_GRANULATES, GEOLOCATION_GRANULATES, CHART_DATE_SUMMARY_CALCULATION_METHOD, CHART_SUPPORT_COLUMNS } from '../../constants';
|
|
9
|
+
import { ChartUtils } from '../../utils';
|
|
10
|
+
import intl from '../../intl';
|
|
11
|
+
class YAxisGroupSettings extends Component {
|
|
12
|
+
constructor(_props) {
|
|
13
|
+
super(_props);
|
|
14
|
+
this.initTable = props => {
|
|
15
|
+
const {
|
|
16
|
+
chart,
|
|
17
|
+
tables
|
|
18
|
+
} = props;
|
|
19
|
+
const {
|
|
20
|
+
table_id
|
|
21
|
+
} = chart.config;
|
|
22
|
+
this.selectedTable = getTableById(tables, table_id);
|
|
23
|
+
};
|
|
24
|
+
this.initGroupTypeOptions = () => {
|
|
25
|
+
this.groupTypeOptions = [{
|
|
26
|
+
value: CHART_Y_GROUP_TYPE.COUNT,
|
|
27
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "select-module select-module-name ml-0"
|
|
29
|
+
}, intl.get(CHART_SUMMARY_SHOW['count'])), /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "summary-type-explanation"
|
|
31
|
+
}, intl.get('Count_the_number_of_records_in_each_group')))
|
|
32
|
+
}, {
|
|
33
|
+
value: CHART_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN,
|
|
34
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "select-module select-module-name ml-0"
|
|
36
|
+
}, intl.get(CHART_SUMMARY_SHOW['advanced'])), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "summary-type-explanation"
|
|
38
|
+
}, intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_a_field')))
|
|
39
|
+
}, {
|
|
40
|
+
value: CHART_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN,
|
|
41
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "select-module select-module-name ml-0"
|
|
43
|
+
}, intl.get('Summarize_multiple_fields')), /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "summary-type-explanation"
|
|
45
|
+
}, intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_multiple_fields')))
|
|
46
|
+
}];
|
|
47
|
+
};
|
|
48
|
+
this.initColumns = () => {
|
|
49
|
+
if (!this.selectedTable) {
|
|
50
|
+
this.numericColumns = [];
|
|
51
|
+
this.numericColumnOptions = [];
|
|
52
|
+
this.columnGroupbyColumnsOptions = [];
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const columns = Array.isArray(this.selectedTable.columns) ? this.selectedTable.columns : [];
|
|
56
|
+
this.columns = this.getAvailableColumns(columns);
|
|
57
|
+
this.columnGroupbyColumnsOptions = this.getColumnOptions(this.columns);
|
|
58
|
+
this.numericColumns = this.columns.filter(column => ChartUtils.isNumericSummaryColumn(column));
|
|
59
|
+
this.numericColumnOptions = this.getColumnOptions(this.numericColumns);
|
|
60
|
+
};
|
|
61
|
+
this.getAvailableColumns = columns => {
|
|
62
|
+
if (!columns || !Array.isArray(columns)) return [];
|
|
63
|
+
return columns.filter(column => CHART_SUPPORT_COLUMNS.includes(column.type));
|
|
64
|
+
};
|
|
65
|
+
this.getColumnOptions = columns => {
|
|
66
|
+
const options = columns.map(column => {
|
|
67
|
+
return {
|
|
68
|
+
value: column,
|
|
69
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
className: "sea-chart-column-icon"
|
|
71
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
72
|
+
className: COLUMNS_ICON_CONFIG[column.type]
|
|
73
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: 'select-module select-module-name ml-0'
|
|
75
|
+
}, column.name))
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return [{
|
|
79
|
+
value: {
|
|
80
|
+
key: 'Groupby_null'
|
|
81
|
+
},
|
|
82
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
83
|
+
className: 'select-module select-module-name null-option-name ml-0'
|
|
84
|
+
}, intl.get('Select_a_column')),
|
|
85
|
+
style: {
|
|
86
|
+
color: 'rgba(0, 0, 0, .25)'
|
|
87
|
+
}
|
|
88
|
+
}, ...options];
|
|
89
|
+
};
|
|
90
|
+
this.onGroupTypeChange = option => {
|
|
91
|
+
const {
|
|
92
|
+
chart
|
|
93
|
+
} = this.props;
|
|
94
|
+
const {
|
|
95
|
+
config
|
|
96
|
+
} = chart;
|
|
97
|
+
const value = option.value;
|
|
98
|
+
let update = {};
|
|
99
|
+
if (value === CHART_Y_GROUP_TYPE.COUNT) {
|
|
100
|
+
update.column_groupby_multiple_numeric_column = false;
|
|
101
|
+
update.summary_columns = [];
|
|
102
|
+
update.y_axis_summary_type = CHART_SUMMARY_TYPE.COUNT;
|
|
103
|
+
update.y_axis_summary_column_key = null;
|
|
104
|
+
update.y_axis_summary_method = CHART_SUMMARY_CALCULATION_METHOD[0];
|
|
105
|
+
update.column_groupby_column_key = config.column_groupby_column_key || null;
|
|
106
|
+
update.column_groupby_date_granularity = config.column_groupby_date_granularity || null;
|
|
107
|
+
update.column_groupby_geolocation_granularity = config.column_groupby_geolocation_granularity || null;
|
|
108
|
+
} else if (value === CHART_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN) {
|
|
109
|
+
update.column_groupby_multiple_numeric_column = false;
|
|
110
|
+
update.summary_columns = [];
|
|
111
|
+
update.y_axis_summary_type = CHART_SUMMARY_TYPE.ADVANCED;
|
|
112
|
+
update.y_axis_summary_column_key = this.numericColumns[0] ? this.numericColumns[0].key : null;
|
|
113
|
+
update.y_axis_summary_method = CHART_SUMMARY_CALCULATION_METHOD[0];
|
|
114
|
+
update.column_groupby_column_key = config.column_groupby_column_key || null;
|
|
115
|
+
update.column_groupby_date_granularity = config.column_groupby_date_granularity || null;
|
|
116
|
+
update.column_groupby_geolocation_granularity = config.column_groupby_geolocation_granularity || null;
|
|
117
|
+
} else if (value === CHART_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN) {
|
|
118
|
+
update.column_groupby_multiple_numeric_column = true;
|
|
119
|
+
update.summary_columns = [];
|
|
120
|
+
update.y_axis_summary_type = CHART_SUMMARY_TYPE.ADVANCED;
|
|
121
|
+
update.y_axis_summary_column_key = this.numericColumns[0] ? this.numericColumns[0].key : null;
|
|
122
|
+
update.y_axis_summary_method = CHART_SUMMARY_CALCULATION_METHOD[0];
|
|
123
|
+
update.column_groupby_date_granularity = null;
|
|
124
|
+
update.column_groupby_geolocation_granularity = null;
|
|
125
|
+
update.column_groupby_geolocation_granularity = null;
|
|
126
|
+
}
|
|
127
|
+
this.props.onChange(update);
|
|
128
|
+
};
|
|
129
|
+
this.getSelectedGroupType = () => {
|
|
130
|
+
const {
|
|
131
|
+
chart
|
|
132
|
+
} = this.props;
|
|
133
|
+
const {
|
|
134
|
+
config
|
|
135
|
+
} = chart;
|
|
136
|
+
const {
|
|
137
|
+
column_groupby_multiple_numeric_column,
|
|
138
|
+
y_axis_summary_type
|
|
139
|
+
} = config;
|
|
140
|
+
if (column_groupby_multiple_numeric_column) {
|
|
141
|
+
return this.groupTypeOptions.find(item => item.value === CHART_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN);
|
|
142
|
+
}
|
|
143
|
+
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
144
|
+
return this.groupTypeOptions[0];
|
|
145
|
+
}
|
|
146
|
+
if (y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
147
|
+
return this.groupTypeOptions[1];
|
|
148
|
+
}
|
|
149
|
+
return this.groupTypeOptions[0];
|
|
150
|
+
};
|
|
151
|
+
this.onDeleteNumericColumnItem = index => {
|
|
152
|
+
const {
|
|
153
|
+
chart
|
|
154
|
+
} = this.props;
|
|
155
|
+
const {
|
|
156
|
+
config
|
|
157
|
+
} = chart;
|
|
158
|
+
let {
|
|
159
|
+
summary_columns
|
|
160
|
+
} = config;
|
|
161
|
+
summary_columns = summary_columns || [];
|
|
162
|
+
summary_columns = [...summary_columns];
|
|
163
|
+
summary_columns.splice(index - 1, 1);
|
|
164
|
+
this.props.onChange({
|
|
165
|
+
summary_columns: [...summary_columns]
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
this.onGroupbyNumericColumnChange = (option, index) => {
|
|
169
|
+
const column = option.value;
|
|
170
|
+
const {
|
|
171
|
+
key: newXAxisColumnKey
|
|
172
|
+
} = column;
|
|
173
|
+
const validValue = newXAxisColumnKey === 'Groupby_null' ? null : newXAxisColumnKey;
|
|
174
|
+
const {
|
|
175
|
+
chart
|
|
176
|
+
} = this.props;
|
|
177
|
+
const {
|
|
178
|
+
config
|
|
179
|
+
} = chart;
|
|
180
|
+
const summaryMethods = ChartUtils.isDateSummaryColumn(column) ? CHART_DATE_SUMMARY_CALCULATION_METHOD : CHART_SUMMARY_CALCULATION_METHOD;
|
|
181
|
+
if (index === 0) {
|
|
182
|
+
let {
|
|
183
|
+
y_axis_summary_method
|
|
184
|
+
} = config;
|
|
185
|
+
if (!summaryMethods.includes(y_axis_summary_method)) {
|
|
186
|
+
y_axis_summary_method = summaryMethods[0];
|
|
187
|
+
}
|
|
188
|
+
this.props.onChange({
|
|
189
|
+
y_axis_summary_column_key: validValue,
|
|
190
|
+
y_axis_summary_method
|
|
191
|
+
});
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let {
|
|
195
|
+
summary_columns
|
|
196
|
+
} = config;
|
|
197
|
+
summary_columns = summary_columns || [];
|
|
198
|
+
summary_columns = [...summary_columns];
|
|
199
|
+
let selectedItem = summary_columns[index - 1];
|
|
200
|
+
const {
|
|
201
|
+
summary_method
|
|
202
|
+
} = selectedItem;
|
|
203
|
+
if (summaryMethods.includes(summary_method)) {
|
|
204
|
+
selectedItem = Object.assign({}, selectedItem, {
|
|
205
|
+
column_key: validValue
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
selectedItem = Object.assign({}, selectedItem, {
|
|
209
|
+
column_key: validValue,
|
|
210
|
+
summary_method: summaryMethods[0]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
summary_columns[index - 1] = selectedItem;
|
|
214
|
+
this.props.onChange({
|
|
215
|
+
summary_columns
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
this.onSummaryMethodChange = (option, index) => {
|
|
219
|
+
const value = option.value;
|
|
220
|
+
const {
|
|
221
|
+
chart
|
|
222
|
+
} = this.props;
|
|
223
|
+
const {
|
|
224
|
+
config
|
|
225
|
+
} = chart;
|
|
226
|
+
if (index === 0) {
|
|
227
|
+
this.props.onChange({
|
|
228
|
+
y_axis_summary_method: value
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
let {
|
|
233
|
+
summary_columns
|
|
234
|
+
} = config;
|
|
235
|
+
summary_columns = summary_columns || [];
|
|
236
|
+
summary_columns = [...summary_columns];
|
|
237
|
+
let selectedItem = summary_columns[index - 1];
|
|
238
|
+
selectedItem = Object.assign({}, selectedItem, {
|
|
239
|
+
summary_method: value
|
|
240
|
+
});
|
|
241
|
+
summary_columns[index - 1] = selectedItem;
|
|
242
|
+
this.props.onChange({
|
|
243
|
+
summary_columns
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
this.onAddNumericColumn = column => {
|
|
247
|
+
if (!column) return;
|
|
248
|
+
const {
|
|
249
|
+
chart
|
|
250
|
+
} = this.props;
|
|
251
|
+
const {
|
|
252
|
+
config
|
|
253
|
+
} = chart;
|
|
254
|
+
let {
|
|
255
|
+
summary_columns
|
|
256
|
+
} = config;
|
|
257
|
+
const newNumericColumnKey = column.key;
|
|
258
|
+
const summaryMethods = ChartUtils.isDateSummaryColumn(column) ? CHART_DATE_SUMMARY_CALCULATION_METHOD : CHART_SUMMARY_CALCULATION_METHOD;
|
|
259
|
+
if (Array.isArray(summary_columns)) {
|
|
260
|
+
summary_columns = [...summary_columns];
|
|
261
|
+
summary_columns.push({
|
|
262
|
+
column_key: newNumericColumnKey,
|
|
263
|
+
summary_method: summaryMethods[0]
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
summary_columns = [{
|
|
267
|
+
column_key: newNumericColumnKey,
|
|
268
|
+
summary_method: summaryMethods[0]
|
|
269
|
+
}];
|
|
270
|
+
}
|
|
271
|
+
this.props.onChange({
|
|
272
|
+
summary_columns: [...summary_columns]
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
this.onGroupByChange = option => {
|
|
276
|
+
const column = option.value;
|
|
277
|
+
const {
|
|
278
|
+
chart
|
|
279
|
+
} = this.props;
|
|
280
|
+
const {
|
|
281
|
+
config
|
|
282
|
+
} = chart;
|
|
283
|
+
const {
|
|
284
|
+
column_groupby_column_key
|
|
285
|
+
} = config;
|
|
286
|
+
if (column_groupby_column_key === column.key) return;
|
|
287
|
+
this.props.onChange({
|
|
288
|
+
column_groupby_column_key: column.key,
|
|
289
|
+
column_groupby_date_granularity: DATE_GRANULATES[0],
|
|
290
|
+
column_groupby_geolocation_granularity: GEOLOCATION_GRANULATES[0]
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
this.onGroupbyDateGranularityChange = option => {
|
|
294
|
+
const value = option.value;
|
|
295
|
+
const {
|
|
296
|
+
chart
|
|
297
|
+
} = this.props;
|
|
298
|
+
const {
|
|
299
|
+
config
|
|
300
|
+
} = chart;
|
|
301
|
+
const {
|
|
302
|
+
column_groupby_date_granularity
|
|
303
|
+
} = config;
|
|
304
|
+
if (column_groupby_date_granularity === value) return;
|
|
305
|
+
this.props.onChange({
|
|
306
|
+
column_groupby_date_granularity: value
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
this.onGroupbyGeolocationGranularityChange = option => {
|
|
310
|
+
const value = option.value;
|
|
311
|
+
const {
|
|
312
|
+
chart
|
|
313
|
+
} = this.props;
|
|
314
|
+
const {
|
|
315
|
+
config
|
|
316
|
+
} = chart;
|
|
317
|
+
const {
|
|
318
|
+
column_groupby_geolocation_granularity
|
|
319
|
+
} = config;
|
|
320
|
+
if (column_groupby_geolocation_granularity === value) return;
|
|
321
|
+
this.props.onChange({
|
|
322
|
+
column_groupby_geolocation_granularity: value
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
this.renderGroupbyNumericColumns = () => {
|
|
326
|
+
const {
|
|
327
|
+
chart
|
|
328
|
+
} = this.props;
|
|
329
|
+
const {
|
|
330
|
+
config
|
|
331
|
+
} = chart;
|
|
332
|
+
const {
|
|
333
|
+
summary_columns
|
|
334
|
+
} = config;
|
|
335
|
+
if (!summary_columns || !Array.isArray(summary_columns)) return null;
|
|
336
|
+
return summary_columns.map((item, index) => {
|
|
337
|
+
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
338
|
+
key: "number-column-".concat(index),
|
|
339
|
+
index: index + 1,
|
|
340
|
+
value: item,
|
|
341
|
+
chart: chart,
|
|
342
|
+
numericColumnOptions: this.numericColumnOptions,
|
|
343
|
+
onDelete: this.onDeleteNumericColumnItem,
|
|
344
|
+
onColumnOptionChange: this.onGroupbyNumericColumnChange,
|
|
345
|
+
onSummaryMethodChange: this.onSummaryMethodChange
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
this.renderColumnGroupbyMultipleNumericColumn = () => {
|
|
350
|
+
const {
|
|
351
|
+
chart
|
|
352
|
+
} = this.props;
|
|
353
|
+
const {
|
|
354
|
+
column_groupby_multiple_numeric_column,
|
|
355
|
+
y_axis_summary_column_key,
|
|
356
|
+
summary_columns
|
|
357
|
+
} = chart.config;
|
|
358
|
+
if (!column_groupby_multiple_numeric_column) return null;
|
|
359
|
+
const usedSummaryColumnKeys = Array.isArray(summary_columns) ? summary_columns.map(item => item.column_key) : [];
|
|
360
|
+
const unUsedSummaryColumns = this.numericColumns.filter(column => column.key !== y_axis_summary_column_key && !usedSummaryColumnKeys.includes(column.key));
|
|
361
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
362
|
+
className: "statistic-add-number"
|
|
363
|
+
}, this.renderGroupbyNumericColumns()), Array.isArray(unUsedSummaryColumns) && unUsedSummaryColumns.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
364
|
+
className: "statistic-add-number-columns d-flex align-items-center",
|
|
365
|
+
onClick: () => this.onAddNumericColumn(unUsedSummaryColumns[0])
|
|
366
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
367
|
+
className: "dtable-font dtable-icon-add-table mr-2"
|
|
368
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
369
|
+
className: "number-column-item add-number-column-description"
|
|
370
|
+
}, intl.get('Add_new_field'))));
|
|
371
|
+
};
|
|
372
|
+
this.initGroupTypeOptions();
|
|
373
|
+
this.initTable(_props);
|
|
374
|
+
this.initColumns();
|
|
375
|
+
}
|
|
376
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
377
|
+
if (nextProps.chart.config.table_id !== this.props.chart.config.table_id) {
|
|
378
|
+
this.initTable(nextProps);
|
|
379
|
+
this.initColumns();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
render() {
|
|
383
|
+
const {
|
|
384
|
+
label,
|
|
385
|
+
chart,
|
|
386
|
+
tables
|
|
387
|
+
} = this.props;
|
|
388
|
+
const selectedTypeOption = this.getSelectedGroupType();
|
|
389
|
+
const {
|
|
390
|
+
y_axis_summary_type,
|
|
391
|
+
column_groupby_multiple_numeric_column,
|
|
392
|
+
y_axis_summary_column_key,
|
|
393
|
+
y_axis_summary_method,
|
|
394
|
+
table_id,
|
|
395
|
+
column_groupby_column_key,
|
|
396
|
+
column_groupby_date_granularity,
|
|
397
|
+
column_groupby_geolocation_granularity
|
|
398
|
+
} = chart.config;
|
|
399
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
400
|
+
className: "sea-chart-parameter-item"
|
|
401
|
+
}, /*#__PURE__*/React.createElement(Label, null, label), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
402
|
+
classNamePrefix: "chart-summary-types",
|
|
403
|
+
value: selectedTypeOption,
|
|
404
|
+
onChange: this.onGroupTypeChange,
|
|
405
|
+
options: this.groupTypeOptions
|
|
406
|
+
})), y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED && (column_groupby_multiple_numeric_column ? /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
407
|
+
index: 0,
|
|
408
|
+
value: {
|
|
409
|
+
column_key: y_axis_summary_column_key,
|
|
410
|
+
summary_method: y_axis_summary_method
|
|
411
|
+
},
|
|
412
|
+
chart: chart,
|
|
413
|
+
numericColumnOptions: this.numericColumnOptions,
|
|
414
|
+
onColumnOptionChange: this.onGroupbyNumericColumnChange,
|
|
415
|
+
onSummaryMethodChange: this.onSummaryMethodChange
|
|
416
|
+
}) : /*#__PURE__*/React.createElement(SummaryMethodSettings, {
|
|
417
|
+
value: {
|
|
418
|
+
column_key: y_axis_summary_column_key,
|
|
419
|
+
summary_method: y_axis_summary_method
|
|
420
|
+
},
|
|
421
|
+
chart: chart,
|
|
422
|
+
numericColumnOptions: this.numericColumnOptions,
|
|
423
|
+
onColumnOptionChange: option => this.onGroupbyNumericColumnChange(option, 0),
|
|
424
|
+
onSummaryMethodChange: option => this.onSummaryMethodChange(option, 0)
|
|
425
|
+
})), this.renderColumnGroupbyMultipleNumericColumn(), (!column_groupby_multiple_numeric_column && y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED || y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) && /*#__PURE__*/React.createElement(Groupby, {
|
|
426
|
+
label: intl.get('Group_by'),
|
|
427
|
+
tables: tables,
|
|
428
|
+
selectedTableId: table_id,
|
|
429
|
+
selectedColumnKey: column_groupby_column_key,
|
|
430
|
+
selectedDateGranularity: column_groupby_date_granularity,
|
|
431
|
+
selectedGeolocationGranularity: column_groupby_geolocation_granularity,
|
|
432
|
+
onGroupByChange: this.onGroupByChange,
|
|
433
|
+
onGroupbyDateGranularityChange: this.onGroupbyDateGranularityChange,
|
|
434
|
+
onGroupbyGeolocationGranularityChange: this.onGroupbyGeolocationGranularityChange
|
|
435
|
+
}));
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
export default YAxisGroupSettings;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { COLLABORATOR_COLUMN_TYPES, FORMULA_RESULT_TYPE, getCollaboratorsName, getFormulaDisplayString } from 'dtable-utils';
|
|
2
|
+
import ObjectUtils from './object-utils';
|
|
3
|
+
export const getClientFormulaDisplayString = function (value, columnData) {
|
|
4
|
+
let {
|
|
5
|
+
collaborators = []
|
|
6
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7
|
+
if (!columnData || !value && value !== 0) return '';
|
|
8
|
+
const {
|
|
9
|
+
result_type,
|
|
10
|
+
array_type
|
|
11
|
+
} = columnData;
|
|
12
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
13
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
14
|
+
if (!value) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const collaboratorList = Array.isArray(value) ? value : [value];
|
|
18
|
+
return getCollaboratorsName(collaborators, collaboratorList);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return getFormulaDisplayString(value, columnData, {
|
|
22
|
+
collaborators
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const getClientLinkDisplayString = (links, columnData, _ref) => {
|
|
26
|
+
let {
|
|
27
|
+
collaborators = []
|
|
28
|
+
} = _ref;
|
|
29
|
+
if (!columnData || !Array.isArray(links) || links.length === 0) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line
|
|
34
|
+
const formulaData = ObjectUtils.hasOwnProperty(columnData, 'result_type') ? columnData : {
|
|
35
|
+
...columnData,
|
|
36
|
+
result_type: FORMULA_RESULT_TYPE.ARRAY
|
|
37
|
+
};
|
|
38
|
+
const displayValue = links.map(link => link.display_value);
|
|
39
|
+
return getClientFormulaDisplayString(displayValue, formulaData, {
|
|
40
|
+
collaborators
|
|
41
|
+
});
|
|
42
|
+
};
|